/ Check-in [9e489a71]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9e489a71f2aeb1f13f9ca6f106b9144d07ca25aa
User & Date: drh 2015-12-03 20:42:28
Context
2015-12-03
20:50
Make the SQLITE_ENABLE_8_3_NAMES compile-time option available to sqlite3_compileoption_used(). check-in: 06338201 user: drh tags: trunk
20:42
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. check-in: 9e489a71 user: drh tags: trunk
13:43
Make the sqlite3_status64(), sqlite3_strlike(), and sqlite3_db_cacheflush() APIs available to loadable extensions. check-in: a78e8656 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

  5517   5517       **   "<path to db>-journalNN"
  5518   5518       **   "<path to db>-walNN"
  5519   5519       **
  5520   5520       ** where NN is a decimal number. The NN naming schemes are 
  5521   5521       ** used by the test_multiplex.c module.
  5522   5522       */
  5523   5523       nDb = sqlite3Strlen30(zPath) - 1; 
  5524         -#ifdef SQLITE_ENABLE_8_3_NAMES
  5525         -    while( nDb>0 && sqlite3Isalnum(zPath[nDb]) ) nDb--;
  5526         -    if( nDb==0 || zPath[nDb]!='-' ) return SQLITE_OK;
  5527         -#else
  5528   5524       while( zPath[nDb]!='-' ){
         5525  +#ifndef SQLITE_ENABLE_8_3_NAMES
         5526  +      /* In the normal case (8+3 filenames disabled) the journal filename
         5527  +      ** is guaranteed to contain a '-' character. */
  5529   5528         assert( nDb>0 );
  5530         -      assert( zPath[nDb]!='\n' );
         5529  +      assert( sqlite3Isalnum(zPath[nDb]) );
         5530  +#else
         5531  +      /* If 8+3 names are possible, then the journal file might not contain
         5532  +      ** a '-' character.  So check for that case and return early. */
         5533  +      if( nDb==0 || zPath[nDb]=='.' ) return SQLITE_OK;
         5534  +#endif
  5531   5535         nDb--;
  5532   5536       }
  5533         -#endif
  5534   5537       memcpy(zDb, zPath, nDb);
  5535   5538       zDb[nDb] = '\0';
  5536   5539   
  5537   5540       if( 0==osStat(zDb, &sStat) ){
  5538   5541         *pMode = sStat.st_mode & 0777;
  5539   5542         *pUid = sStat.st_uid;
  5540   5543         *pGid = sStat.st_gid;