From: drh Date: Thu, 3 Dec 2015 20:42:28 +0000 (+0000) Subject: Cleaner code and additional comments on the handling of 8+3 filenames when X-Git-Tag: version-3.10.0~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=90e5dda217b4d939d8609d8728dc7c3015f9c164;p=thirdparty%2Fsqlite.git Cleaner code and additional comments on the handling of 8+3 filenames when trying to find the name of a database file based on its journal filename, in the unix VFS. FossilOrigin-Name: 9e489a71f2aeb1f13f9ca6f106b9144d07ca25aa --- diff --git a/manifest b/manifest index c5398fbeca..ce05de0d3c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sthe\ssqlite3_status64(),\ssqlite3_strlike(),\sand\nsqlite3_db_cacheflush()\sAPIs\savailable\sto\sloadable\sextensions. -D 2015-12-03T13:43:07.848 +C Cleaner\scode\sand\sadditional\scomments\son\sthe\shandling\sof\s8+3\sfilenames\swhen\ntrying\sto\sfind\sthe\sname\sof\sa\sdatabase\sfile\sbased\son\sits\sjournal\sfilename,\s\nin\sthe\sunix\sVFS. +D 2015-12-03T20:42:28.920 F Makefile.in 28bcd6149e050dff35d4dcfd97e890cd387a499d F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc e8fdca1cb89a1b58b5f4d3a130ea9a3d28cb314d @@ -323,7 +323,7 @@ F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h abdb9a191a367793268fe553d25bab894e986a0e F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c 60997373a8d90bd17e1c0e49d11ef361b713439b +F src/os_unix.c 2563734669b06432cea640cbb4f7e9d543f227b9 F src/os_win.c 386fba30419e8458b13209781c2af5590eab2811 F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c f92aacd5216d8815136c9e0190041783c602641a @@ -1408,7 +1408,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d96de532cc4a192cfebae900701dcee0a7d29273 -R ea1163e38de91a0ef50bee8a60cd0c9a +P a78e865607194718e2ef958879dbf549ac3c9970 +R 2562256032b891190294739fad90243c U drh -Z 21e053713b9d8cfc5b99a96ebe62cd3d +Z b2f15a80162f9f125f88e21b8ca96ffa diff --git a/manifest.uuid b/manifest.uuid index 619e0d1a54..2df7d425e6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a78e865607194718e2ef958879dbf549ac3c9970 \ No newline at end of file +9e489a71f2aeb1f13f9ca6f106b9144d07ca25aa \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 5f4cbca2aa..beaac0d15d 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5521,16 +5521,19 @@ static int findCreateFileMode( ** used by the test_multiplex.c module. */ nDb = sqlite3Strlen30(zPath) - 1; -#ifdef SQLITE_ENABLE_8_3_NAMES - while( nDb>0 && sqlite3Isalnum(zPath[nDb]) ) nDb--; - if( nDb==0 || zPath[nDb]!='-' ) return SQLITE_OK; -#else while( zPath[nDb]!='-' ){ +#ifndef SQLITE_ENABLE_8_3_NAMES + /* In the normal case (8+3 filenames disabled) the journal filename + ** is guaranteed to contain a '-' character. */ assert( nDb>0 ); - assert( zPath[nDb]!='\n' ); + assert( sqlite3Isalnum(zPath[nDb]) ); +#else + /* If 8+3 names are possible, then the journal file might not contain + ** a '-' character. So check for that case and return early. */ + if( nDb==0 || zPath[nDb]=='.' ) return SQLITE_OK; +#endif nDb--; } -#endif memcpy(zDb, zPath, nDb); zDb[nDb] = '\0';