]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Expand passing of a last error argument to the getLastErrorMsg function. Also, remov...
authormistachkin <mistachkin@noemail.net>
Thu, 10 Nov 2011 21:45:06 +0000 (21:45 +0000)
committermistachkin <mistachkin@noemail.net>
Thu, 10 Nov 2011 21:45:06 +0000 (21:45 +0000)
FossilOrigin-Name: 8f28797984c1d4700357a75815ca4b324c3ebf5c

manifest
manifest.uuid
src/os_win.c

index 69f18e241a4106bd18152fc3680ff89a6a276dd1..1e9639f02b79ddb623430c58fb1cdb8198ad1491 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\swinAccess,\ssave\sthe\sWin32\slast\serror\svalue\sprior\sto\sinvoking\suser\slogging\scallback.\s\sAlso,\sexplicitly\spass\sthe\sWin32\slast\serror\svalue\sto\swinLogError\sin\sorder\sto\skeep\sit\saccurate.\s\sFixes\sa\sproblem\sreported\son\sthe\smailing\slist.
-D 2011-11-10T20:21:20.308
+C Expand\spassing\sof\sa\slast\serror\sargument\sto\sthe\sgetLastErrorMsg\sfunction.\s\sAlso,\sremove\sunused\sSQLITE_W32_THREADS\sdefine.
+D 2011-11-10T21:45:06.907
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -167,7 +167,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
 F src/os_unix.c 4fbb91726165e105c1679a2660f49a3f4c376e4f
-F src/os_win.c a9190cb70e5071776e0064f7a04778c594c2afad
+F src/os_win.c d6cf718667c4d89d930f30caa6cdc7f7753e259a
 F src/pager.c db33d4bf1e3e019c34c220971cc6c3aa07c30f54
 F src/pager.h 9f81b08efb06db4ba8be69446e10b005c351373d
 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
@@ -974,7 +974,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P 0c951a970436725b6bbd64568de500f7a4e6460b
-R 07fcb0ebb49fcaa5a3b1285d87c90ade
+P 32ab365715e2c50f30aa2f92a323857b9d917bf6
+R d5d8a9a49f50a40940976e300037af02
 U mistachkin
-Z 984e599e94c8add22fe67965d6d580c6
+Z a0f426067c598247950f7d47f9af3362
index cee874f887ea62c9408eff5ee7611afb02e094f3..b053265d1fd4ee59f059a6210ee0beadcca54fa1 100644 (file)
@@ -1 +1 @@
-32ab365715e2c50f30aa2f92a323857b9d917bf6
\ No newline at end of file
+8f28797984c1d4700357a75815ca4b324c3ebf5c
\ No newline at end of file
index e8ea45583f85f5342d0a547e1c94add1cfb39fbc..8032b04bdd49ed9e2ac3d534f826d1a5fbd9b38b 100644 (file)
 # include <sys/cygwin.h>
 #endif
 
-/*
-** Macros used to determine whether or not to use threads.
-*/
-#if defined(THREADSAFE) && THREADSAFE
-# define SQLITE_W32_THREADS 1
-#endif
-
 /*
 ** Include code that is common to all os_*.c files
 */
@@ -558,20 +551,21 @@ char *sqlite3_win32_utf8_to_mbcs(const char *zFilename){
 ** is zero if the error message fits in the buffer, or non-zero
 ** otherwise (if the message was truncated).
 */
-static int getLastErrorMsg(int nBuf, char *zBuf){
+static int getLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){
   /* FormatMessage returns 0 on failure.  Otherwise it
   ** returns the number of TCHARs written to the output
   ** buffer, excluding the terminating null char.
   */
-  DWORD error = GetLastError();
   DWORD dwLen = 0;
   char *zOut = 0;
 
   if( isNT() ){
     WCHAR *zTempWide = NULL;
-    dwLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+    dwLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                           FORMAT_MESSAGE_FROM_SYSTEM |
+                           FORMAT_MESSAGE_IGNORE_INSERTS,
                            NULL,
-                           error,
+                           lastErrno,
                            0,
                            (LPWSTR) &zTempWide,
                            0,
@@ -589,9 +583,11 @@ static int getLastErrorMsg(int nBuf, char *zBuf){
 #if SQLITE_OS_WINCE==0
   }else{
     char *zTemp = NULL;
-    dwLen = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+    dwLen = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                           FORMAT_MESSAGE_FROM_SYSTEM |
+                           FORMAT_MESSAGE_IGNORE_INSERTS,
                            NULL,
-                           error,
+                           lastErrno,
                            0,
                            (LPSTR) &zTemp,
                            0,
@@ -605,7 +601,7 @@ static int getLastErrorMsg(int nBuf, char *zBuf){
 #endif
   }
   if( 0 == dwLen ){
-    sqlite3_snprintf(nBuf, zBuf, "OsError 0x%x (%u)", error, error);
+    sqlite3_snprintf(nBuf, zBuf, "OsError 0x%x (%u)", lastErrno, lastErrno);
   }else{
     /* copy a maximum of nBuf chars to output buffer */
     sqlite3_snprintf(nBuf, zBuf, "%s", zOut);
@@ -642,7 +638,7 @@ static int winLogErrorAtLine(
   int i;                          /* Loop counter */
 
   zMsg[0] = 0;
-  getLastErrorMsg(sizeof(zMsg), zMsg);
+  getLastErrorMsg(lastErrno, sizeof(zMsg), zMsg);
   assert( errcode!=SQLITE_OK );
   if( zPath==0 ) zPath = "";
   for(i=0; zMsg[i] && zMsg[i]!='\r' && zMsg[i]!='\n'; i++){}
@@ -2998,7 +2994,7 @@ static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
 }
 static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
   UNUSED_PARAMETER(pVfs);
-  getLastErrorMsg(nBuf, zBufOut);
+  getLastErrorMsg(GetLastError(), nBuf, zBufOut);
 }
 static void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){
   UNUSED_PARAMETER(pVfs);
@@ -3172,7 +3168,7 @@ static int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){
 */
 static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
   UNUSED_PARAMETER(pVfs);
-  return getLastErrorMsg(nBuf, zBuf);
+  return getLastErrorMsg(GetLastError(), nBuf, zBuf);
 }