]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Limit the number of memset() calls used when determining a temporary file name on...
authormistachkin <mistachkin@noemail.net>
Wed, 31 Jul 2013 23:28:36 +0000 (23:28 +0000)
committermistachkin <mistachkin@noemail.net>
Wed, 31 Jul 2013 23:28:36 +0000 (23:28 +0000)
FossilOrigin-Name: 136fc2931b156f91cdd76a7a009298cdf09d826a

manifest
manifest.uuid
src/os_win.c

index 372309654670964d681f2ab0a7b9cea374d77482..a763743c174332d11a516bfdb74edf07f152f73c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Slight\smodifications\sto\spath\sname\stranslation\shandling\sfor\sCygwin.
-D 2013-07-31T22:39:26.505
+C Limit\sthe\snumber\sof\smemset()\scalls\sused\swhen\sdetermining\sa\stemporary\sfile\sname\son\sWindows.\s\sAlso,\sfix\sa\sharmless\scompiler\swarning.
+D 2013-07-31T23:28:36.603
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -203,7 +203,7 @@ F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be
 F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f
 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
 F src/os_unix.c 9eafa5458cf2ff684ddccff82c9bb113c7cad847
-F src/os_win.c 3a74943b286746533963579337b1de4383cf963b
+F src/os_win.c 1d84f2079d9b91f91a4b5dbfa5e08f1b1a0ed0ff
 F src/pager.c 5d2f7475260a8588f9c441bb309d2b7eaa7ded3b
 F src/pager.h 5cb78b8e1adfd5451e600be7719f5a99d87ac3b1
 F src/parse.y 9acfcc83ddbf0cf82f0ed9582ccf0ad6c366ff37
@@ -1103,7 +1103,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P c93d891b03c626b9ed01ed5ef2f246b2d4a40a64
-R 1da5a28da1b68405b6ad12dd77b7c1d9
+P 33ba1f4c5dc2ef8292adf17a32ade0cde0887d88
+R 22ac6c086833ea6790806cfd601e6a5b
 U mistachkin
-Z 86b10e2366b2108534452cce8a04325b
+Z 4d19b2638b72ab835325f17f2f967fc6
index 56f062680e607498a6236d83e8cd44a8aca778db..491b5fb557c5fe7aeedaa6cf3505ce5f0fd848a9 100644 (file)
@@ -1 +1 @@
-33ba1f4c5dc2ef8292adf17a32ade0cde0887d88
\ No newline at end of file
+136fc2931b156f91cdd76a7a009298cdf09d826a
\ No newline at end of file
index 3647b0e474eab55af1562cf0331d8b22da1a9e5d..10c4316448f3a9b4f0fb323c06512bfe6c44d9f6 100644 (file)
@@ -3696,10 +3696,10 @@ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){
       return SQLITE_OK;
     }
     assert( (nMap % winSysInfo.dwPageSize)==0 );
+    assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff );
 #if SQLITE_OS_WINRT
-    pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, nMap);
+    pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap);
 #else
-    assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff );
     pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap);
 #endif
     if( pNew==NULL ){
@@ -3896,8 +3896,6 @@ static int getTempname(int nBuf, char *zBuf){
   */
   SimulateIOError( return SQLITE_IOERR );
 
-  memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2);
-
   if( sqlite3_temp_directory ){
     sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s",
                      sqlite3_temp_directory);
@@ -3936,8 +3934,24 @@ static int getTempname(int nBuf, char *zBuf){
       return SQLITE_IOERR_NOMEM;
     }
   }
-#endif
-#endif
+#else
+  else{
+    /*
+    ** Compiled without ANSI support and the current operating system
+    ** is not Windows NT; therefore, just zero the temporary buffer.
+    */
+    memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2);
+  }
+#endif /* SQLITE_WIN32_HAS_ANSI */
+#else
+  else{
+    /*
+    ** Compiled for WinRT and the sqlite3_temp_directory is not set;
+    ** therefore, just zero the temporary buffer.
+    */
+    memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2);
+  }
+#endif /* !SQLITE_OS_WINRT */
 
   /* Check that the output buffer is large enough for the temporary file 
   ** name. If it is not, return SQLITE_ERROR.
@@ -4089,7 +4103,6 @@ static int winOpen(
   */
   if( !zUtf8Name ){
     assert(isDelete && !isOpenJournal);
-    memset(zTmpname, 0, SQLITE_WIN32_MAX_PATH+2);
     rc = getTempname(SQLITE_WIN32_MAX_PATH+2, zTmpname);
     if( rc!=SQLITE_OK ){
       OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, sqlite3ErrName(rc)));