diff options
author | drh <drh@noemail.net> | 2008-12-08 18:19:17 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-12-08 18:19:17 +0000 |
commit | 1875f7a3dbbcc252804c60d92a7abbc4888b4996 (patch) | |
tree | 90da5a754e84e42c70ecd24247c02306ad4d429f | |
parent | 128255fce671bf3c19feb569f4b87e7e6003da24 (diff) | |
download | sqlite-1875f7a3dbbcc252804c60d92a7abbc4888b4996.tar.gz sqlite-1875f7a3dbbcc252804c60d92a7abbc4888b4996.zip |
The amalgamation now compiles cleanly on GCC with options
-pedantic-errors -Wno-long-long. (CVS 5991)
FossilOrigin-Name: 73c7302c5f76a2f61ecd75f8bda69bb500d3119c
-rw-r--r-- | manifest | 34 | ||||
-rw-r--r-- | manifest.uuid | 2 | ||||
-rw-r--r-- | src/global.c | 23 | ||||
-rw-r--r-- | src/loadext.c | 16 | ||||
-rw-r--r-- | src/mutex_unix.c | 5 | ||||
-rw-r--r-- | src/mutex_w32.c | 5 | ||||
-rw-r--r-- | src/os.c | 6 | ||||
-rw-r--r-- | src/os.h | 4 | ||||
-rw-r--r-- | src/os_unix.c | 87 | ||||
-rw-r--r-- | src/os_win.c | 8 | ||||
-rw-r--r-- | src/random.c | 6 | ||||
-rw-r--r-- | src/sqlite.h.in | 6 | ||||
-rw-r--r-- | src/sqliteInt.h | 8 | ||||
-rw-r--r-- | tool/mkkeywordhash.c | 40 |
14 files changed, 170 insertions, 80 deletions
@@ -1,5 +1,5 @@ -C Fix\stwo\sunused-parameter\swarnings\sin\sthe\sparser.\s(CVS\s5990) -D 2008-12-08T16:01:13 +C The\samalgamation\snow\scompiles\scleanly\son\sGCC\swith\soptions\n-pedantic-errors\s-Wno-long-long.\s(CVS\s5991) +D 2008-12-08T18:19:18 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in f7e4c81c347b04f7b0f1c1b081a168645d7b8af7 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -111,14 +111,14 @@ F src/delete.c d60885716666e5ea0f177b8db73c22c67ccba2cb F src/expr.c ee295129a9efa0466ae4ebdb03adc33cd5c2e184 F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff F src/func.c b4570eb73d873041b8e68f5cdbb4556ff13a94c3 -F src/global.c 20a3fe46c8287a01ba3a7442558f0eb70c66b19a +F src/global.c 91723e45a2ad03ae5bb97a0a0d2dbb1a0e69527b F src/hash.c 582c00618efe2051785e66ba1b6430d5a129de3f F src/hash.h 28f38ebb1006a5beedcb013bcdfe31befe7437ae F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb F src/insert.c 73c4b33767d9540f8ead5d903504ed93f48ad147 F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3 -F src/loadext.c 3872457afdf25bb174fd383cb4e3e0d2a9e60552 +F src/loadext.c 2f53996c693a347edc2d773e9217dde49d96ae64 F src/main.c d67d2eee7a643a4a894e5de91231a99ad88400b9 F src/malloc.c 89c7c58fbec06b80101fdc6dcdf9ee849b7cd7ac F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c @@ -131,14 +131,14 @@ F src/mutex.c e9cb5fbe94afb4328869afaf3ac49bd1327559eb F src/mutex.h 9e686e83a88838dac8b9c51271c651e833060f1e F src/mutex_noop.c f5a07671f25a1a9bd7c10ad7107bc2585446200f F src/mutex_os2.c 6b5a74f812082a8483c3df05b47bbaac2424b9a0 -F src/mutex_unix.c 3b1c895a044d45812ea1eae9019daeff8cfb27ce -F src/mutex_w32.c 017b522f63ef09b834fefc9daa876c9ec167e7b5 -F src/os.c 0b411644b87ad689d7250bbfd1834d99b81a3df4 -F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892 +F src/mutex_unix.c 2f936339dfef1a4c142db290d575a3509b77315f +F src/mutex_w32.c ee9cf003a330e2a9d80feefbd2c49899d5d43d6d +F src/os.c ed93a6b46132a602c4fd7a58142e2981c829c79d +F src/os.h 4ee25a35c00e75a569cecb5080be299b0c3e208e F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60 F src/os_os2.c 36196e71292a44bf2d393413cd8c86199694b8b4 -F src/os_unix.c e625d228800b367b32c6ec888df34a06103f6e8c -F src/os_win.c 3dff41670fb9798a869c636626bb7d6d8b6a45bb +F src/os_unix.c cec838fe55eaa53f1ff02ecb311cdd2188c4db95 +F src/os_win.c 79e55bbe2177c4824d24d365b1274703c710f504 F src/pager.c a193da9e271898077de815819e4c29fc2b6ece2a F src/pager.h a02ef8e6cc7e78b54874166e5ce786c9d4c489bf F src/parse.y 1f4b7ad690864911919da0c76fa96fd72694185e @@ -148,14 +148,14 @@ F src/pcache1.c fb6cf5b80996ed316842d25005f4981bef7ce548 F src/pragma.c 539e28c90e782fa909a3b3a6849d18a9eb11a548 F src/prepare.c fcadb25d2ad722d87103517333c825b56b79a770 F src/printf.c e29d9475c63e1dbfae005b98da3a60e07b5c1ca5 -F src/random.c a87afbd598aa877e23ac676ee92fd8ee5c786a51 +F src/random.c 67bf41b20f1983a0e481e7abb98d64704ee26884 F src/resolve.c 4af5391d2b4c1d6c583a6805ac6660181de4545b F src/rowset.c 2256fa4a928f750e2f3d6fc733523034beceb1d6 F src/select.c 1d3616e4e48f6c15a0c69bf14bc5423f31624f87 F src/shell.c be9eeb5811d1ad6ebbf6ae8b5aa04ae1368af033 -F src/sqlite.h.in b5d50f12fb9c7460a4ddfef8c1e799afaabefebf +F src/sqlite.h.in f13b2f27265b78226240cb0d2e07f165e2110bd9 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 -F src/sqliteInt.h 93d6ef19eb949aced1ae32338f3262304596fee8 +F src/sqliteInt.h 7bdc5726dff17a2e92b23d478b7024c535d77a47 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8 @@ -646,7 +646,7 @@ F tool/lempar.c 9ef6809804f9066fa94a0bdc02224ce015951843 F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133 F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8 F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf -F tool/mkkeywordhash.c c219ee2b8b5b8e7011cccfa1caec62d9812e82e7 +F tool/mkkeywordhash.c 7cd8f12dea17d26e4b2c6dee8be13515248da069 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c.tcl 75cb8cdbea59c0db53a2393df15229376c211ca1 @@ -664,7 +664,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 490138a2012fcb4c859e1cf12a35e314ec1060d2 -R f00482f9dbf81d06697eef8e8363dced +P cf419d0b01c0144b752f4283ba9668747339b218 +R 2d222f2ecf9d24abc952681891899e82 U drh -Z c2ae23ba51235354d257132525c0b6d8 +Z 730302298609f4c7f51091c009ffa471 diff --git a/manifest.uuid b/manifest.uuid index eb986f1d3..778cb1210 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cf419d0b01c0144b752f4283ba9668747339b218
\ No newline at end of file +73c7302c5f76a2f61ecd75f8bda69bb500d3119c
\ No newline at end of file diff --git a/src/global.c b/src/global.c index e05168362..757b75a5c 100644 --- a/src/global.c +++ b/src/global.c @@ -12,7 +12,7 @@ ** ** This file contains definitions of global variables and contants. ** -** $Id: global.c,v 1.8 2008/09/04 17:17:39 danielk1977 Exp $ +** $Id: global.c,v 1.9 2008/12/08 18:19:18 drh Exp $ */ #include "sqliteInt.h" @@ -73,7 +73,26 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = { 0x7ffffffe, /* mxStrlen */ 100, /* szLookaside */ 500, /* nLookaside */ - /* Other fields all default to zero */ + {0,0,0,0,0,0,0,0}, /* m */ + {0,0,0,0,0,0,0,0,0}, /* mutex */ + {0,0,0,0,0,0,0,0,0,0,0}, /* pcache */ + (void*)0, /* pHeap */ + 0, /* nHeap */ + 0, 0, /* mnHeap, mxHeap */ + (void*)0, /* pScratch */ + 0, /* szScratch */ + 0, /* nScratch */ + (void*)0, /* pPage */ + 0, /* szPage */ + 0, /* nPage */ + 0, /* mxParserStack */ + 0, /* sharedCacheEnabled */ + /* All the rest need to always be zero */ + 0, /* isInit */ + 0, /* inProgress */ + 0, /* isMallocInit */ + 0, /* pInitMutex */ + 0, /* nRefInitMutex */ }; diff --git a/src/loadext.c b/src/loadext.c index 517eed005..c59cd9c1f 100644 --- a/src/loadext.c +++ b/src/loadext.c @@ -12,7 +12,7 @@ ** This file contains code used to dynamically load extensions into ** the SQLite library. ** -** $Id: loadext.c,v 1.56 2008/10/12 00:27:53 shane Exp $ +** $Id: loadext.c,v 1.57 2008/12/08 18:19:18 drh Exp $ */ #ifndef SQLITE_CORE @@ -482,10 +482,10 @@ static const sqlite3_api_routines sqlite3Apis = { 0 }; ** This list is shared across threads. The SQLITE_MUTEX_STATIC_MASTER ** mutex must be held while accessing this list. */ -typedef struct sqlite3ExtType sqlite3ExtType; -static SQLITE_WSD struct sqlite3ExtType { - int nExt; /* Number of entries in aExt[] */ - void **aExt; /* Pointers to the extension init functions */ +typedef struct sqlite3AutoExtList sqlite3AutoExtList; +static SQLITE_WSD struct sqlite3AutoExtList { + int nExt; /* Number of entries in aExt[] */ + void (**aExt)(void); /* Pointers to the extension init functions */ } sqlite3Autoext = { 0, 0 }; /* The "wsdAutoext" macro will resolve to the autoextension @@ -496,7 +496,7 @@ static SQLITE_WSD struct sqlite3ExtType { */ #ifdef SQLITE_OMIT_WSD # define wsdAutoextInit \ - sqlite3ExtType *x = &GLOBAL(sqlite3ExtType,sqlite3Autoext) + sqlite3AutoExtList *x = &GLOBAL(sqlite3AutoExtList,sqlite3Autoext) # define wsdAutoext x[0] #else # define wsdAutoextInit @@ -508,7 +508,7 @@ static SQLITE_WSD struct sqlite3ExtType { ** Register a statically linked extension that is automatically ** loaded by every new database connection. */ -int sqlite3_auto_extension(void *xInit){ +int sqlite3_auto_extension(void (*xInit)(void)){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_AUTOINIT rc = sqlite3_initialize(); @@ -528,7 +528,7 @@ int sqlite3_auto_extension(void *xInit){ } if( i==wsdAutoext.nExt ){ int nByte = (wsdAutoext.nExt+1)*sizeof(wsdAutoext.aExt[0]); - void **aNew; + void (**aNew)(void); aNew = sqlite3_realloc(wsdAutoext.aExt, nByte); if( aNew==0 ){ rc = SQLITE_NOMEM; diff --git a/src/mutex_unix.c b/src/mutex_unix.c index f0e0879af..36b0682f0 100644 --- a/src/mutex_unix.c +++ b/src/mutex_unix.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains the C functions that implement mutexes for pthreads ** -** $Id: mutex_unix.c,v 1.15 2008/11/17 19:18:55 danielk1977 Exp $ +** $Id: mutex_unix.c,v 1.16 2008/12/08 18:19:18 drh Exp $ */ #include "sqliteInt.h" @@ -316,6 +316,9 @@ sqlite3_mutex_methods *sqlite3DefaultMutex(void){ #ifdef SQLITE_DEBUG pthreadMutexHeld, pthreadMutexNotheld +#else + 0, + 0 #endif }; diff --git a/src/mutex_w32.c b/src/mutex_w32.c index 0d9381109..320c448a6 100644 --- a/src/mutex_w32.c +++ b/src/mutex_w32.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains the C functions that implement mutexes for win32 ** -** $Id: mutex_w32.c,v 1.12 2008/11/10 20:01:41 shane Exp $ +** $Id: mutex_w32.c,v 1.13 2008/12/08 18:19:18 drh Exp $ */ #include "sqliteInt.h" @@ -243,6 +243,9 @@ sqlite3_mutex_methods *sqlite3DefaultMutex(void){ #ifdef SQLITE_DEBUG winMutexHeld, winMutexNotheld +#else + 0, + 0 #endif }; @@ -13,7 +13,7 @@ ** This file contains OS interface code that is common to all ** architectures. ** -** $Id: os.c,v 1.124 2008/10/07 15:25:48 drh Exp $ +** $Id: os.c,v 1.125 2008/12/08 18:19:18 drh Exp $ */ #define _SQLITE_OS_C_ 1 #include "sqliteInt.h" @@ -142,8 +142,8 @@ void *sqlite3OsDlOpen(sqlite3_vfs *pVfs, const char *zPath){ void sqlite3OsDlError(sqlite3_vfs *pVfs, int nByte, char *zBufOut){ pVfs->xDlError(pVfs, nByte, zBufOut); } -void *sqlite3OsDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){ - return pVfs->xDlSym(pVfs, pHandle, zSymbol); +void (*sqlite3OsDlSym(sqlite3_vfs *pVfs, void *pHdle, const char *zSym))(void){ + return pVfs->xDlSym(pVfs, pHdle, zSym); } void sqlite3OsDlClose(sqlite3_vfs *pVfs, void *pHandle){ pVfs->xDlClose(pVfs, pHandle); @@ -17,7 +17,7 @@ ** This header file is #include-ed by sqliteInt.h and thus ends up ** being included by every source file. ** -** $Id: os.h,v 1.105 2008/06/26 10:41:19 danielk1977 Exp $ +** $Id: os.h,v 1.106 2008/12/08 18:19:18 drh Exp $ */ #ifndef _SQLITE_OS_H_ #define _SQLITE_OS_H_ @@ -258,7 +258,7 @@ int sqlite3OsFullPathname(sqlite3_vfs *, const char *, int, char *); #ifndef SQLITE_OMIT_LOAD_EXTENSION void *sqlite3OsDlOpen(sqlite3_vfs *, const char *); void sqlite3OsDlError(sqlite3_vfs *, int, char *); -void *sqlite3OsDlSym(sqlite3_vfs *, void *, const char *); +void (*sqlite3OsDlSym(sqlite3_vfs *, void *, const char *))(void); void sqlite3OsDlClose(sqlite3_vfs *, void *); #endif /* SQLITE_OMIT_LOAD_EXTENSION */ int sqlite3OsRandomness(sqlite3_vfs *, int, char *); diff --git a/src/os_unix.c b/src/os_unix.c index 349725765..0e4975d3b 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -43,7 +43,7 @@ ** * Definitions of sqlite3_vfs objects for all locking methods ** plus implementations of sqlite3_os_init() and sqlite3_os_end(). ** -** $Id: os_unix.c,v 1.229 2008/12/04 12:34:16 drh Exp $ +** $Id: os_unix.c,v 1.230 2008/12/08 18:19:18 drh Exp $ */ #include "sqliteInt.h" #if SQLITE_OS_UNIX /* This file is used on unix only */ @@ -2217,9 +2217,6 @@ static int afpSetLock( pb.offset = offset; pb.length = length; pb.fd = pFile->h; - //SimulateIOErrorBenign(1); - //SimulateIOError( pb.fd=(-1) ) - //SimulateIOErrorBenign(0); OSTRACE6("AFPSETLOCK [%s] for %d%s in range %llx:%llx\n", (setLockFlag?"ON":"OFF"), pFile->h, (pb.fd==-1?"[testval-1]":""), @@ -3013,6 +3010,18 @@ static int unixDeviceCharacteristics(sqlite3_file *NotUsed){ ** looks at the filesystem type and tries to guess the best locking ** strategy from that. ** +** For finder-funtion F, two objects are created: +** +** (1) The real finder-function named "FImpt()". +** +** (2) A constant pointer to this functio named just "F". +** +** +** A pointer to the F pointer is used as the pAppData value for VFS +** objects. We have to do this instead of letting pAppData point +** directly at the finder-function since C90 rules prevent a void* +** from be cast into a function pointer. +** ** ** Each instance of this macro generates two objects: ** @@ -3038,10 +3047,12 @@ static const sqlite3_io_methods METHOD = { \ unixSectorSize, /* xSectorSize */ \ unixDeviceCharacteristics /* xDeviceCapabilities */ \ }; \ -static const sqlite3_io_methods *FINDER(const char *z, int h){ \ +static const sqlite3_io_methods *FINDER##Impl(const char *z, int h){ \ UNUSED_PARAMETER(z); UNUSED_PARAMETER(h); \ return &METHOD; \ -} +} \ +static const sqlite3_io_methods *(*const FINDER)(const char*,int) \ + = FINDER##Impl; /* ** Here are all of the sqlite3_io_methods objects for each of the @@ -3055,7 +3066,7 @@ IOMETHODS( unixLock, /* xLock method */ unixUnlock, /* xUnlock method */ unixCheckReservedLock /* xCheckReservedLock method */ -); +) IOMETHODS( nolockIoFinder, /* Finder function name */ nolockIoMethods, /* sqlite3_io_methods object name */ @@ -3063,7 +3074,7 @@ IOMETHODS( nolockLock, /* xLock method */ nolockUnlock, /* xUnlock method */ nolockCheckReservedLock /* xCheckReservedLock method */ -); +) IOMETHODS( dotlockIoFinder, /* Finder function name */ dotlockIoMethods, /* sqlite3_io_methods object name */ @@ -3071,7 +3082,7 @@ IOMETHODS( dotlockLock, /* xLock method */ dotlockUnlock, /* xUnlock method */ dotlockCheckReservedLock /* xCheckReservedLock method */ -); +) #if SQLITE_ENABLE_LOCKING_STYLE IOMETHODS( @@ -3081,7 +3092,7 @@ IOMETHODS( flockLock, /* xLock method */ flockUnlock, /* xUnlock method */ flockCheckReservedLock /* xCheckReservedLock method */ -); +) #endif #if OS_VXWORKS @@ -3092,7 +3103,7 @@ IOMETHODS( semLock, /* xLock method */ semUnlock, /* xUnlock method */ semCheckReservedLock /* xCheckReservedLock method */ -); +) #endif #if defined(__DARWIN__) && SQLITE_ENABLE_LOCKING_STYLE @@ -3103,7 +3114,7 @@ IOMETHODS( afpLock, /* xLock method */ afpUnlock, /* xUnlock method */ afpCheckReservedLock /* xCheckReservedLock method */ -); +) #endif /* @@ -3127,7 +3138,7 @@ IOMETHODS( proxyLock, /* xLock method */ proxyUnlock, /* xUnlock method */ proxyCheckReservedLock /* xCheckReservedLock method */ -); +) #endif @@ -3139,7 +3150,7 @@ IOMETHODS( ** ** This is for MacOSX only. */ -static const sqlite3_io_methods *autolockIoFinder( +static const sqlite3_io_methods *autolockIoFinderImpl( const char *filePath, /* name of the database file */ int fd /* file descriptor open on the database file */ ){ @@ -3192,6 +3203,9 @@ static const sqlite3_io_methods *autolockIoFinder( return &dotlockIoMethods; } } +static const sqlite3_io_methods (*const autolockIoFinder)(const char*,int) + = autolockIoFinderImpl; + #endif /* defined(__DARWIN__) && SQLITE_ENABLE_LOCKING_STYLE */ /* @@ -3250,7 +3264,7 @@ static int fillInUnixFile( if( noLock ){ pLockingStyle = &nolockIoMethods; }else{ - pLockingStyle = (*(finder_type)pVfs->pAppData)(zFilename, h); + pLockingStyle = (**(finder_type*)pVfs->pAppData)(zFilename, h); #if SQLITE_ENABLE_LOCKING_STYLE /* Cache zFilename in the locking context (AFP and dotlock override) for ** proxyLock activation is possible (remote proxy is based on db name) @@ -3764,9 +3778,28 @@ static void unixDlError(sqlite3_vfs *NotUsed, int nBuf, char *zBufOut){ } unixLeaveMutex(); } -static void *unixDlSym(sqlite3_vfs *NotUsed, void *pHandle, const char*zSymbol){ +static void (*unixDlSym(sqlite3_vfs *NotUsed, void *p, const char*zSym))(void){ + /* + ** GCC with -pedantic-errors says that C90 does not allow a void* to be + ** cast into a pointer to a function. And yet the library dlsym() routine + ** returns a void* which is really a pointer to a function. So how do we + ** use dlsym() with -pedantic-errors? + ** + ** Variable x below is defined to be a pointer to a function taking + ** parameters void* and const char* and returning a pointer to a function. + ** We initialize x by assigning it a pointer to the dlsym() function. + ** (That assignment requires a cast.) Then we call the function that + ** x points to. + ** + ** This work-around is unlikely to work correctly on any system where + ** you really cannot cast a function pointer into void*. But then, on the + ** other hand, dlsym() will not work on such a system either, so we have + ** not really lost anything. + */ + void (*(*x)(void*,const char*))(void); UNUSED_PARAMETER(NotUsed); - return dlsym(pHandle, zSymbol); + x = (void(*(*)(void*,const char*))(void))dlsym; + return (*x)(p, zSym); } static void unixDlClose(sqlite3_vfs *NotUsed, void *pHandle){ UNUSED_PARAMETER(NotUsed); @@ -4283,7 +4316,7 @@ static int proxyCreateUnixFile(const char *path, unixFile **ppFile) { } memset(pNew, 0, sizeof(unixFile)); - dummyVfs.pAppData = (void*)autolockIoFinder; + dummyVfs.pAppData = (void*)&autolockIoFinder; rc = fillInUnixFile(&dummyVfs, fd, dirfd, (sqlite3_file*)pNew, path, 0, 0); if( rc==SQLITE_OK ){ *ppFile = pNew; @@ -4322,7 +4355,7 @@ static int proxyTakeConch(unixFile *pFile){ rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, SHARED_LOCK); if( rc==SQLITE_OK ){ int pError = 0; - memset(testValue, 0, CONCHLEN); // conch is fixed size + memset(testValue, 0, CONCHLEN); /* conch is fixed size */ rc = proxyGetHostID(testValue, &pError); if( (rc&0xff)==SQLITE_IOERR ){ pFile->lastErrno = pError; @@ -4423,12 +4456,13 @@ end_takeconch: if( fd>=0 ){ pFile->h = fd; }else{ - rc=SQLITE_CANTOPEN; // SQLITE_BUSY? proxyTakeConch called during locking + rc=SQLITE_CANTOPEN; /* SQLITE_BUSY? proxyTakeConch called + during locking */ } } if( rc==SQLITE_OK && !pCtx->lockProxy ){ char *path = tLockPath ? tLockPath : pCtx->lockProxyPath; - // ACS: Need to make a copy of path sometimes + /* ACS: Need to make a copy of path sometimes */ rc = proxyCreateUnixFile(path, &pCtx->lockProxy); } if( rc==SQLITE_OK ){ @@ -4849,8 +4883,13 @@ static int proxyClose(sqlite3_file *id) { int sqlite3_os_init(void){ /* ** The following macro defines an initializer for an sqlite3_vfs object. - ** The name of the VFS is NAME. The pAppData is a pointer to a "finder" - ** function. The FINDER parameter to this macro is the name of the + ** The name of the VFS is NAME. The pAppData is a pointer to a pointer + ** to the "finder" function. (pAppData is a pointer to a pointer because + ** silly C90 rules prohibit a void* from being cast to a function pointer + ** and so we have to go through the intermediate pointer to avoid problems + ** when compiling with -pedantic-errors on GCC.) + ** + ** The FINDER parameter to this macro is the name of the pointer to the ** finder-function. The finder-function returns a pointer to the ** sqlite_io_methods object that implements the desired locking ** behaviors. See the division above that contains the IOMETHODS @@ -4868,7 +4907,7 @@ int sqlite3_os_init(void){ MAX_PATHNAME, /* mxPathname */ \ 0, /* pNext */ \ VFSNAME, /* zName */ \ - (void*)FINDER, /* pAppData */ \ + (void*)&FINDER, /* pAppData */ \ unixOpen, /* xOpen */ \ unixDelete, /* xDelete */ \ unixAccess, /* xAccess */ \ diff --git a/src/os_win.c b/src/os_win.c index 833c24ce7..7f32b43f1 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -12,7 +12,7 @@ ** ** This file contains code that is specific to windows. ** -** $Id: os_win.c,v 1.140 2008/11/19 21:35:47 shane Exp $ +** $Id: os_win.c,v 1.141 2008/12/08 18:19:18 drh Exp $ */ #include "sqliteInt.h" #if SQLITE_OS_WIN /* This file is used for windows only */ @@ -1527,14 +1527,14 @@ static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){ static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){ getLastErrorMsg(nBuf, zBufOut); } -void *winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){ +void (*winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol))(void){ #if SQLITE_OS_WINCE /* The GetProcAddressA() routine is only available on wince. */ - return GetProcAddressA((HANDLE)pHandle, zSymbol); + return (void(*)(void))GetProcAddressA((HANDLE)pHandle, zSymbol); #else /* All other windows platforms expect GetProcAddress() to take ** an Ansi string regardless of the _UNICODE setting */ - return GetProcAddress((HANDLE)pHandle, zSymbol); + return (void(*)(void))GetProcAddress((HANDLE)pHandle, zSymbol); #endif } void winDlClose(sqlite3_vfs *pVfs, void *pHandle){ diff --git a/src/random.c b/src/random.c index 7fe42a557..eb3ec1958 100644 --- a/src/random.c +++ b/src/random.c @@ -15,7 +15,7 @@ ** Random numbers are used by some of the database backends in order ** to generate random integer keys for tables or random filenames. ** -** $Id: random.c,v 1.27 2008/10/07 15:25:48 drh Exp $ +** $Id: random.c,v 1.28 2008/12/08 18:19:18 drh Exp $ */ #include "sqliteInt.h" @@ -27,7 +27,7 @@ static SQLITE_WSD struct sqlite3PrngType { unsigned char isInit; /* True if initialized */ unsigned char i, j; /* State variables */ unsigned char s[256]; /* State variables */ -} sqlite3Prng = { 0, }; +} sqlite3Prng; /* ** Get a single 8-bit random value from the RC4 PRNG. The Mutex @@ -126,7 +126,7 @@ void sqlite3_randomness(int N, void *pBuf){ ** The sqlite3_test_control() interface calls these routines to ** control the PRNG. */ -static SQLITE_WSD struct sqlite3PrngType sqlite3SavedPrng = { 0, }; +static SQLITE_WSD struct sqlite3PrngType sqlite3SavedPrng; void sqlite3PrngSaveState(void){ memcpy( &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng), diff --git a/src/sqlite.h.in b/src/sqlite.h.in index e98cf0308..57ae44298 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -30,7 +30,7 @@ ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** -** @(#) $Id: sqlite.h.in,v 1.416 2008/11/21 00:10:35 aswift Exp $ +** @(#) $Id: sqlite.h.in,v 1.417 2008/12/08 18:19:18 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ @@ -874,7 +874,7 @@ struct sqlite3_vfs { int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut); void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename); void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); - void *(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol); + void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void); void (*xDlClose)(sqlite3_vfs*, void*); int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); int (*xSleep)(sqlite3_vfs*, int microseconds); @@ -5448,7 +5448,7 @@ int sqlite3_enable_load_extension(sqlite3 *db, int onoff); ** ** {H12644} Automatic extensions apply across all threads. */ -int sqlite3_auto_extension(void *xEntryPoint); +int sqlite3_auto_extension(void (*xEntryPoint)(void)); /* ** CAPI3REF: Reset Automatic Extension Loading {H12660} <S20500> diff --git a/src/sqliteInt.h b/src/sqliteInt.h index adf051033..14a079329 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.803 2008/12/08 13:42:36 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.804 2008/12/08 18:19:18 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -1994,13 +1994,15 @@ struct Sqlite3Config { void *pPage; /* Page cache memory */ int szPage; /* Size of each page in pPage[] */ int nPage; /* Number of pages in pPage[] */ + int mxParserStack; /* maximum depth of the parser stack */ + int sharedCacheEnabled; /* true if shared-cache mode enabled */ + /* The above might be initialized to non-zero. The following need to always + ** initially be zero, however. */ int isInit; /* True after initialization has finished */ int inProgress; /* True while initialization in progress */ int isMallocInit; /* True after malloc is initialized */ sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */ int nRefInitMutex; /* Number of users of pInitMutex */ - int mxParserStack; /* maximum depth of the parser stack */ - int sharedCacheEnabled; /* true if shared-cache mode enabled */ }; /* diff --git a/tool/mkkeywordhash.c b/tool/mkkeywordhash.c index c8f6eebe3..681a6f9ac 100644 --- a/tool/mkkeywordhash.c +++ b/tool/mkkeywordhash.c @@ -15,7 +15,7 @@ static const char zHdr[] = "**\n" "** The code in this file has been automatically generated by\n" "**\n" - "** $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.32 2008/10/06 05:32:19 danielk1977 Exp $\n" + "** $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.33 2008/12/08 18:19:18 drh Exp $\n" "**\n" "** The code in this file implements a function that determines whether\n" "** or not a given identifier is really an SQL keyword. The same thing\n" @@ -335,6 +335,7 @@ int main(int argc, char **argv){ int nChar; int totalLen = 0; int aHash[1000]; /* 1000 is much bigger than nKeyword */ + char zText[2000]; /* Remove entries from the list of keywords that have mask==0 */ for(i=j=0; i<nKeyword; i++){ @@ -463,20 +464,43 @@ int main(int argc, char **argv){ printf("static int keywordCode(const char *z, int n){\n"); printf(" /* zText[] encodes %d bytes of keywords in %d bytes */\n", totalLen + nKeyword, nChar+1 ); - - printf(" static const char zText[%d] =\n", nChar+1); - for(i=j=0; i<nKeyword; i++){ + for(i=j=k=0; i<nKeyword; i++){ Keyword *p = &aKeywordTable[i]; if( p->substrId ) continue; - if( j==0 ) printf(" \""); + memcpy(&zText[k], p->zName, p->len); + k += p->len; + if( j+p->len>70 ){ + printf("%*s */\n", 74-j, ""); + j = 0; + } + if( j==0 ){ + printf(" /* "); + j = 8; + } printf("%s", p->zName); j += p->len; - if( j>60 ){ - printf("\"\n"); + } + if( j>0 ){ + printf("%*s */\n", 74-j, ""); + } + printf(" static const char zText[%d] = {\n", nChar+1); + for(i=j=0; i<=k; i++){ + if( j==0 ){ + printf(" "); + } + if( zText[i]==0 ){ + printf("0"); + }else{ + printf("'%c',", zText[i]); + } + j += 4; + if( j>68 ){ + printf("\n"); j = 0; } } - printf("%s;\n", j>0 ? "\"" : " "); + if( j>0 ) printf("\n"); + printf(" };\n"); printf(" static const unsigned char aHash[%d] = {\n", bestSize); for(i=j=0; i<bestSize; i++){ |