/ Check-in [c93d891b]
Login

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

Overview
Comment:Use a new error code to represent a failure to get the configured temporary directory on Windows.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c93d891b03c626b9ed01ed5ef2f246b2d4a40a64
User & Date: mistachkin 2013-07-31 22:27:16
Context
2013-07-31
22:39
Slight modifications to path name translation handling for Cygwin. check-in: 33ba1f4c user: mistachkin tags: trunk
22:27
Use a new error code to represent a failure to get the configured temporary directory on Windows. check-in: c93d891b user: mistachkin tags: trunk
19:55
The MAX_PATH constant in windows is measured in characters, so multiple by 3 to get the number of bytes assuming worst-case UTF8 pathnames. check-in: bb06e157 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

  1096   1096         case SQLITE_IOERR_SHMOPEN:      zName = "SQLITE_IOERR_SHMOPEN";     break;
  1097   1097         case SQLITE_IOERR_SHMSIZE:      zName = "SQLITE_IOERR_SHMSIZE";     break;
  1098   1098         case SQLITE_IOERR_SHMLOCK:      zName = "SQLITE_IOERR_SHMLOCK";     break;
  1099   1099         case SQLITE_IOERR_SHMMAP:       zName = "SQLITE_IOERR_SHMMAP";      break;
  1100   1100         case SQLITE_IOERR_SEEK:         zName = "SQLITE_IOERR_SEEK";        break;
  1101   1101         case SQLITE_IOERR_DELETE_NOENT: zName = "SQLITE_IOERR_DELETE_NOENT";break;
  1102   1102         case SQLITE_IOERR_MMAP:         zName = "SQLITE_IOERR_MMAP";        break;
         1103  +      case SQLITE_IOERR_GETTEMPPATH:  zName = "SQLITE_IOERR_GETTEMPPATH"; break;
  1103   1104         case SQLITE_CORRUPT:            zName = "SQLITE_CORRUPT";           break;
  1104   1105         case SQLITE_CORRUPT_VTAB:       zName = "SQLITE_CORRUPT_VTAB";      break;
  1105   1106         case SQLITE_NOTFOUND:           zName = "SQLITE_NOTFOUND";          break;
  1106   1107         case SQLITE_FULL:               zName = "SQLITE_FULL";              break;
  1107   1108         case SQLITE_CANTOPEN:           zName = "SQLITE_CANTOPEN";          break;
  1108   1109         case SQLITE_CANTOPEN_NOTEMPDIR: zName = "SQLITE_CANTOPEN_NOTEMPDIR";break;
  1109   1110         case SQLITE_CANTOPEN_ISDIR:     zName = "SQLITE_CANTOPEN_ISDIR";    break;

Changes to src/os_win.c.

  3901   3901       sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s",
  3902   3902                        sqlite3_temp_directory);
  3903   3903     }
  3904   3904   #if !SQLITE_OS_WINRT
  3905   3905     else if( isNT() ){
  3906   3906       char *zMulti;
  3907   3907       WCHAR zWidePath[MAX_PATH];
  3908         -    osGetTempPathW(MAX_PATH-30, zWidePath);
         3908  +    if( osGetTempPathW(MAX_PATH-30, zWidePath)==0 ){
         3909  +      OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n"));
         3910  +      return SQLITE_IOERR_GETTEMPPATH;
         3911  +    }
  3909   3912       zMulti = unicodeToUtf8(zWidePath);
  3910   3913       if( zMulti ){
  3911   3914         sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zMulti);
  3912   3915         sqlite3_free(zMulti);
  3913   3916       }else{
  3914   3917         OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
  3915   3918         return SQLITE_IOERR_NOMEM;
  3916   3919       }
  3917   3920     }
  3918   3921   #ifdef SQLITE_WIN32_HAS_ANSI
  3919   3922     else{
  3920   3923       char *zUtf8;
  3921   3924       char zMbcsPath[SQLITE_WIN32_MAX_PATH];
  3922         -    osGetTempPathA(SQLITE_WIN32_MAX_PATH-30, zMbcsPath);
         3925  +    if( osGetTempPathA(SQLITE_WIN32_MAX_PATH-30, zMbcsPath)==0 ){
         3926  +      OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n"));
         3927  +      return SQLITE_IOERR_GETTEMPPATH;
         3928  +    }
  3923   3929       zUtf8 = sqlite3_win32_mbcs_to_utf8(zMbcsPath);
  3924   3930       if( zUtf8 ){
  3925   3931         sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zUtf8);
  3926   3932         sqlite3_free(zUtf8);
  3927   3933       }else{
  3928   3934         OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
  3929   3935         return SQLITE_IOERR_NOMEM;

Changes to src/sqlite.h.in.

   469    469   #define SQLITE_IOERR_SHMOPEN           (SQLITE_IOERR | (18<<8))
   470    470   #define SQLITE_IOERR_SHMSIZE           (SQLITE_IOERR | (19<<8))
   471    471   #define SQLITE_IOERR_SHMLOCK           (SQLITE_IOERR | (20<<8))
   472    472   #define SQLITE_IOERR_SHMMAP            (SQLITE_IOERR | (21<<8))
   473    473   #define SQLITE_IOERR_SEEK              (SQLITE_IOERR | (22<<8))
   474    474   #define SQLITE_IOERR_DELETE_NOENT      (SQLITE_IOERR | (23<<8))
   475    475   #define SQLITE_IOERR_MMAP              (SQLITE_IOERR | (24<<8))
          476  +#define SQLITE_IOERR_GETTEMPPATH       (SQLITE_IOERR | (25<<8))
   476    477   #define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))
   477    478   #define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
   478    479   #define SQLITE_BUSY_SNAPSHOT           (SQLITE_BUSY   |  (2<<8))
   479    480   #define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
   480    481   #define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))
   481    482   #define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))
   482    483   #define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))