From: shane Date: Thu, 10 Sep 2009 20:23:30 +0000 (+0000) Subject: Fixed some warnings and an assert in the WINCE code when compiling under MSVC. X-Git-Tag: fts3-refactor~187 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11bb41f8782901ba670c0a392a5cb3f065c8bfac;p=thirdparty%2Fsqlite.git Fixed some warnings and an assert in the WINCE code when compiling under MSVC. FossilOrigin-Name: f42ec993ac9d42ca31305f26b09924108c36d9f4 --- diff --git a/manifest b/manifest index 59d073c66b..35e4e36087 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,5 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -C Make\ssure\sthe\sthreadsOverrideEachOthersLocks\svariable\sis\sonly\sreferenced\sby\nlinux\ssystems\son\sa\sthreadsafe\scompile. -D 2009-09-10T19:20:03 +C Fixed\ssome\swarnings\sand\san\sassert\sin\sthe\sWINCE\scode\swhen\scompiling\sunder\sMSVC. +D 2009-09-10T20:23:30 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in e360e1214027efbf62cf18ac80ec646d4081c272 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -115,7 +112,7 @@ F src/btreeInt.h 1c86297e69380f6577e7ae67452597dd8d5c2705 F src/build.c 7569d7e263927530a75751fabd3e8889392f104a F src/callback.c f49c305dc94b78da948953c392963929c0e70f9b F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0 -F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3 +F src/date.c 6d936393716d21e6dc0d4222b3443137a60ebe93 F src/delete.c 7ef5a39beae236620825075ac7229316586aae80 F src/expr.c 638b599adad562d41c3bf90f542f9419664aa7b8 F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff @@ -149,7 +146,7 @@ F src/os.h 00a1334a4eecee7f7bef79ac606b88d325119f21 F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5 F src/os_unix.c 5369272992c14dd198c02ddfc2fd7a1516906c40 -F src/os_win.c 58bb163f327e79726dd119344d908e4d98483c3f +F src/os_win.c 49a360be4f42d5a63d00be9aa44449ed4d6717e0 F src/pager.c ebd0a8f2421e8f0ad5b78201440004bf3e1c96d8 F src/pager.h 11852d044c86cf5a9d6e34171fb0c4fcf1f6265f F src/parse.y 6c42631e72a3d14cde2bee85e79409066066d3df @@ -753,14 +750,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 5588cc96bbe0b9df5f8d31f8f2d2b48b3f54ff09 -R 48059c4d2f5d0989c3883467bec1489a -U drh -Z 5aa3ad6a21feb357d66dfc90a3ead484 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6 (GNU/Linux) - -iD8DBQFKqVFpoxKgR168RlERAidFAJ9ANSUJCpqBktcIlgSELFvnrbpweQCbBlq5 -ewjd6VogivVCLe1QqVjspzo= -=9Aym ------END PGP SIGNATURE----- +P e9d064bd9318c2bc9248df948f71fd30f24525eb +R fa073c3be9735e1ddbacea5f24724e02 +U shane +Z 244ab5dc2c61766a5855c53cce6b3a78 diff --git a/manifest.uuid b/manifest.uuid index 8ba6884672..96bfc373cc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e9d064bd9318c2bc9248df948f71fd30f24525eb \ No newline at end of file +f42ec993ac9d42ca31305f26b09924108c36d9f4 \ No newline at end of file diff --git a/src/date.c b/src/date.c index bcd0ea86d6..0429a64144 100644 --- a/src/date.c +++ b/src/date.c @@ -448,7 +448,7 @@ static sqlite3_int64 localtimeOffset(DateTime *p){ x.tz = 0; x.validJD = 0; computeJD(&x); - t = x.iJD/1000 - 21086676*(i64)10000; + t = (time_t)(x.iJD/1000 - 21086676*(i64)10000); #ifdef HAVE_LOCALTIME_R { struct tm sLocal; diff --git a/src/os_win.c b/src/os_win.c index 5d84637280..bc03a4bc66 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -307,8 +307,8 @@ struct tm *__cdecl localtime(const time_t *t) sqlite3_int64 t64; t64 = *t; t64 = (t64 + 11644473600)*10000000; - uTm.dwLowDateTime = (DWORD)(t64 & 0xFFFFFFFF); - uTm.dwHighDateTime= (DWORD)(t64 >> 32); + uTm.dwLowDateTime = (DWORD)(t64 & 0xFFFFFFFF); + uTm.dwHighDateTime= (DWORD)(t64 >> 32); FileTimeToLocalFileTime(&uTm,&lTm); FileTimeToSystemTime(&lTm,&pTm); y.tm_year = pTm.wYear - 1900; @@ -328,7 +328,7 @@ struct tm *__cdecl localtime(const time_t *t) #define UnlockFile(a,b,c,d,e) winceUnlockFile(&a, b, c, d, e) #define LockFileEx(a,b,c,d,e,f) winceLockFileEx(&a, b, c, d, e, f) -#define HANDLE_TO_WINFILE(a) (winFile*)&((char*)a)[-(int)offsetof(winFile,h)] +#define HANDLE_TO_WINFILE(a) (winFile*)&((char*)a)[-(int)offsetof(winFile,h)] /* ** Acquire a lock on the handle h @@ -467,15 +467,15 @@ static BOOL winceLockFile( winFile *pFile = HANDLE_TO_WINFILE(phFile); BOOL bReturn = FALSE; - UNUSED_PARAMETER(dwFileOffsetHigh); - UNUSED_PARAMETER(nNumberOfBytesToLockHigh); - + UNUSED_PARAMETER(dwFileOffsetHigh); + UNUSED_PARAMETER(nNumberOfBytesToLockHigh); + if (!pFile->hMutex) return TRUE; winceMutexAcquire(pFile->hMutex); /* Wanting an exclusive lock? */ - if (dwFileOffsetLow == SHARED_FIRST - && nNumberOfBytesToLockLow == SHARED_SIZE){ + if (dwFileOffsetLow == (DWORD)SHARED_FIRST + && nNumberOfBytesToLockLow == (DWORD)SHARED_SIZE){ if (pFile->shared->nReaders == 0 && pFile->shared->bExclusive == 0){ pFile->shared->bExclusive = TRUE; pFile->local.bExclusive = TRUE; @@ -484,7 +484,7 @@ static BOOL winceLockFile( } /* Want a read-only lock? */ - else if (dwFileOffsetLow == SHARED_FIRST && + else if (dwFileOffsetLow == (DWORD)SHARED_FIRST && nNumberOfBytesToLockLow == 1){ if (pFile->shared->bExclusive == 0){ pFile->local.nReaders ++; @@ -496,7 +496,7 @@ static BOOL winceLockFile( } /* Want a pending lock? */ - else if (dwFileOffsetLow == PENDING_BYTE && nNumberOfBytesToLockLow == 1){ + else if (dwFileOffsetLow == (DWORD)PENDING_BYTE && nNumberOfBytesToLockLow == 1){ /* If no pending lock has been acquired, then acquire it */ if (pFile->shared->bPending == 0) { pFile->shared->bPending = TRUE; @@ -506,7 +506,7 @@ static BOOL winceLockFile( } /* Want a reserved lock? */ - else if (dwFileOffsetLow == RESERVED_BYTE && nNumberOfBytesToLockLow == 1){ + else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE && nNumberOfBytesToLockLow == 1){ if (pFile->shared->bReserved == 0) { pFile->shared->bReserved = TRUE; pFile->local.bReserved = TRUE; @@ -531,17 +531,17 @@ static BOOL winceUnlockFile( winFile *pFile = HANDLE_TO_WINFILE(phFile); BOOL bReturn = FALSE; - UNUSED_PARAMETER(dwFileOffsetHigh); - UNUSED_PARAMETER(nNumberOfBytesToUnlockHigh); - + UNUSED_PARAMETER(dwFileOffsetHigh); + UNUSED_PARAMETER(nNumberOfBytesToUnlockHigh); + if (!pFile->hMutex) return TRUE; winceMutexAcquire(pFile->hMutex); /* Releasing a reader lock or an exclusive lock */ - if (dwFileOffsetLow == SHARED_FIRST){ + if (dwFileOffsetLow == (DWORD)SHARED_FIRST){ /* Did we have an exclusive lock? */ if (pFile->local.bExclusive){ - assert(nNumberOfBytesToUnlockLow == SHARED_SIZE); + assert(nNumberOfBytesToUnlockLow == (DWORD)SHARED_SIZE); pFile->local.bExclusive = FALSE; pFile->shared->bExclusive = FALSE; bReturn = TRUE; @@ -549,7 +549,7 @@ static BOOL winceUnlockFile( /* Did we just have a reader lock? */ else if (pFile->local.nReaders){ - assert(nNumberOfBytesToUnlockLow == 1); + assert(nNumberOfBytesToUnlockLow == (DWORD)SHARED_SIZE || nNumberOfBytesToUnlockLow == 1); pFile->local.nReaders --; if (pFile->local.nReaders == 0) { @@ -560,7 +560,7 @@ static BOOL winceUnlockFile( } /* Releasing a pending lock */ - else if (dwFileOffsetLow == PENDING_BYTE && nNumberOfBytesToUnlockLow == 1){ + else if (dwFileOffsetLow == (DWORD)PENDING_BYTE && nNumberOfBytesToUnlockLow == 1){ if (pFile->local.bPending){ pFile->local.bPending = FALSE; pFile->shared->bPending = FALSE; @@ -568,7 +568,7 @@ static BOOL winceUnlockFile( } } /* Releasing a reserved lock */ - else if (dwFileOffsetLow == RESERVED_BYTE && nNumberOfBytesToUnlockLow == 1){ + else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE && nNumberOfBytesToUnlockLow == 1){ if (pFile->local.bReserved) { pFile->local.bReserved = FALSE; pFile->shared->bReserved = FALSE; @@ -591,14 +591,14 @@ static BOOL winceLockFileEx( DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped ){ - UNUSED_PARAMETER(dwReserved); - UNUSED_PARAMETER(nNumberOfBytesToLockHigh); - + UNUSED_PARAMETER(dwReserved); + UNUSED_PARAMETER(nNumberOfBytesToLockHigh); + /* If the caller wants a shared read lock, forward this call ** to winceLockFile */ - if (lpOverlapped->Offset == SHARED_FIRST && + if (lpOverlapped->Offset == (DWORD)SHARED_FIRST && dwFlags == 1 && - nNumberOfBytesToLockLow == SHARED_SIZE){ + nNumberOfBytesToLockLow == (DWORD)SHARED_SIZE){ return winceLockFile(phFile, SHARED_FIRST, 0, 1, 0); } return FALSE; @@ -1600,15 +1600,15 @@ static int getSectorSize( const char *zRelative /* UTF-8 file name */ ){ DWORD bytesPerSector = SQLITE_DEFAULT_SECTOR_SIZE; - /* GetDiskFreeSpace is not supported under WINCE */ -#if SQLITE_OS_WINCE - UNUSED_PARAMETER(pVfs); - UNUSED_PARAMETER(zRelative); -#else + /* GetDiskFreeSpace is not supported under WINCE */ +#if SQLITE_OS_WINCE + UNUSED_PARAMETER(pVfs); + UNUSED_PARAMETER(zRelative); +#else char zFullpath[MAX_PATH+1]; int rc; - DWORD dwRet = 0; - DWORD dwDummy; + DWORD dwRet = 0; + DWORD dwDummy; /* ** We need to get the full path name of the file @@ -1655,7 +1655,7 @@ static int getSectorSize( bytesPerSector = SQLITE_DEFAULT_SECTOR_SIZE; } } -#endif +#endif return (int) bytesPerSector; }