1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

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
This commit is contained in:
drh
2015-12-03 20:42:28 +00:00
parent 7be53fe441
commit 90e5dda217
3 changed files with 16 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
C Make\sthe\ssqlite3_status64(),\ssqlite3_strlike(),\sand\nsqlite3_db_cacheflush()\sAPIs\savailable\sto\sloadable\sextensions. 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-03T13:43:07.848 D 2015-12-03T20:42:28.920
F Makefile.in 28bcd6149e050dff35d4dcfd97e890cd387a499d F Makefile.in 28bcd6149e050dff35d4dcfd97e890cd387a499d
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc e8fdca1cb89a1b58b5f4d3a130ea9a3d28cb314d F Makefile.msc e8fdca1cb89a1b58b5f4d3a130ea9a3d28cb314d
@@ -323,7 +323,7 @@ F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8
F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf
F src/os_common.h abdb9a191a367793268fe553d25bab894e986a0e F src/os_common.h abdb9a191a367793268fe553d25bab894e986a0e
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa 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.c 386fba30419e8458b13209781c2af5590eab2811
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
F src/pager.c f92aacd5216d8815136c9e0190041783c602641a F src/pager.c f92aacd5216d8815136c9e0190041783c602641a
@@ -1408,7 +1408,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P d96de532cc4a192cfebae900701dcee0a7d29273 P a78e865607194718e2ef958879dbf549ac3c9970
R ea1163e38de91a0ef50bee8a60cd0c9a R 2562256032b891190294739fad90243c
U drh U drh
Z 21e053713b9d8cfc5b99a96ebe62cd3d Z b2f15a80162f9f125f88e21b8ca96ffa

View File

@@ -1 +1 @@
a78e865607194718e2ef958879dbf549ac3c9970 9e489a71f2aeb1f13f9ca6f106b9144d07ca25aa

View File

@@ -5521,16 +5521,19 @@ static int findCreateFileMode(
** used by the test_multiplex.c module. ** used by the test_multiplex.c module.
*/ */
nDb = sqlite3Strlen30(zPath) - 1; 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]!='-' ){ 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( 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--; nDb--;
} }
#endif
memcpy(zDb, zPath, nDb); memcpy(zDb, zPath, nDb);
zDb[nDb] = '\0'; zDb[nDb] = '\0';