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

Only require double-zero terminators on database filenames, not any every

files supplied to the xOpen method.  This backs out [2544f233f1].  Also
refactor the fillInUnixFile() routine in os_unix.c to reduce the number
of parameters.

FossilOrigin-Name: cb774b26e13745cfad0d76a71e47466d703e0007
This commit is contained in:
drh
2012-01-10 23:18:38 +00:00
7 changed files with 71 additions and 79 deletions

View File

@@ -1164,10 +1164,6 @@ int sqlite3AbsInt32(int x){
** If SQLITE_ENABLE_8_3_NAMES is set to 2 at compile-time, then always
** do the suffix shortening regardless of URI parameter.
**
** Assume that zBaseFilename contains two \000 terminator bytes (so that
** it can be harmlessly passed into sqlite3_uri_parameter()) and copy both
** zero terminator bytes into the end of the revised name.
**
** Examples:
**
** test.db-journal => test.nal
@@ -1176,7 +1172,6 @@ int sqlite3AbsInt32(int x){
** test.db-mj7f3319fa => test.9fa
*/
void sqlite3FileSuffix3(const char *zBaseFilename, char *z){
assert( z[strlen(z)+1]==0 ); /* z[] has no query parameters */
#if SQLITE_ENABLE_8_3_NAMES<2
if( sqlite3_uri_boolean(zBaseFilename, "8_3_names", 0) )
#endif
@@ -1184,7 +1179,7 @@ void sqlite3FileSuffix3(const char *zBaseFilename, char *z){
int i, sz;
sz = sqlite3Strlen30(z);
for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){}
if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 5);
if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 4);
}
}
#endif