From: mistachkin Date: Tue, 17 Jun 2014 18:43:42 +0000 (+0000) Subject: Experimental changes to use GetFileInformationByHandle instead of GetFileSize in... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fheads%2Ffilesize-debug;p=thirdparty%2Fsqlite.git Experimental changes to use GetFileInformationByHandle instead of GetFileSize in the Win32 VFS. FossilOrigin-Name: d22c8142972dec13435f2023fbaf51dd012b5896 --- diff --git a/manifest b/manifest index 361c677d21..390a771a9a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\ssqlite3_log()\sdiagnostic\smessages\sfor\sa\sspecific\stype\sof\scorruption\nwhere\sthe\sfile\ssize\sis\sreported\sto\sbe\stoo\ssmall\srelative\sto\sthe\ssize\sin\nthe\sheader.\s\sThis\sbranch\sis\sintended\sto\shelp\sdebug\sa\sspecific\sproblem\nreported\sfrom\sthe\swild\sand\sis\snot\sfor\sgeneral\suse. -D 2014-04-24T13:20:33.894 +C Experimental\schanges\sto\suse\sGetFileInformationByHandle\sinstead\sof\sGetFileSize\sin\sthe\sWin32\sVFS. +D 2014-06-17T18:43:42.173 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c 10e0c4dcdbec8d4189890fdf3e71b32efae194e3 -F src/os_win.c 0fc0f46c94b0385a940b0ee32992a833019a5985 +F src/os_win.c 20a15a885fc5947fe8f9fc175049b5f7d30621ab F src/pager.c ddf6e9950ccf70e2b7381d45120c14af910770b6 F src/pager.h 996123976d473220d2a9c3e8f8609e9cce1c87ee F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -963,10 +963,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P 3e0da808d2f5b4d12046e05980ca04578f581177 -R d5f0790d7c68cdafa07773bb8ff37593 -T *branch * filesize-debug -T *sym-filesize-debug * -T -sym-trunk * -U drh -Z 1f0fd56c3eff1640d4907b3dac4ae63d +P 34155c406c7135accdc25e4828cb28137d3840fb +R 3058df9a712ad8bd7e6e0b38ee343f17 +U mistachkin +Z 237e76772eab49f2aa7f7ab4b4f8db7b diff --git a/manifest.uuid b/manifest.uuid index 50a6d54f92..806a08c36f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -34155c406c7135accdc25e4828cb28137d3840fb \ No newline at end of file +d22c8142972dec13435f2023fbaf51dd012b5896 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 33ca96c92c..42742e0c7d 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1305,22 +1305,20 @@ static int winSync(sqlite3_file *id, int flags){ ** Determine the current size of a file in bytes */ static int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){ - DWORD upperBits; - DWORD lowerBits; + BY_HANDLE_FILE_INFORMATION info; winFile *pFile = (winFile*)id; - DWORD error; assert( id!=0 ); SimulateIOError(return SQLITE_IOERR_FSTAT); - lowerBits = GetFileSize(pFile->h, &upperBits); - if( (lowerBits == INVALID_FILE_SIZE) - && ((error = GetLastError()) != NO_ERROR) ) - { - pFile->lastErrno = error; + + memset(&info, 0, sizeof(BY_HANDLE_FILE_INFORMATION)); + if( GetFileInformationByHandle(pFile->h, &info) ){ + *pSize = (((u64)info.nFileSizeHigh)<<32) + info.nFileSizeLow; + return SQLITE_OK; + }else{ + pFile->lastErrno = GetLastError(); return winLogError(SQLITE_IOERR_FSTAT, "winFileSize", pFile->zPath); } - *pSize = (((sqlite3_int64)upperBits)<<32) + lowerBits; - return SQLITE_OK; } /*