Fossil

Check-in [8e8e3a11bc]
Login

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

Overview
Comment:The same, but then with modified SQLite (minimal patch to function winFullPathname this time). This way, applications wanting to use the "win32-longpath" VFS don't have to do tricky extended-path modifications any more.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | win32-longpath
Files: files | file ages | folders
SHA1: 8e8e3a11bc9665c025406eddd07114e1fbdb16a9
User & Date: jan.nijtmans 2013-12-20 12:12:32.308
Context
2013-12-30
20:57
merge trunk check-in: 02a0e8890e user: jan.nijtmans tags: win32-longpath
2013-12-20
12:12
The same, but then with modified SQLite (minimal patch to function winFullPathname this time). This way, applications wanting to use the "win32-longpath" VFS don't have to do tricky extended-path modifications any more. check-in: 8e8e3a11bc user: jan.nijtmans tags: win32-longpath
12:04
Merge trunk. Some more comments. check-in: 4e3f4d26d8 user: jan.nijtmans tags: win32-longpath
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
  int rc;
  sqlite3 *db;

#if defined(__CYGWIN__)
  /* Necessary if we want Cygwin fossil to recognize win32 file
   * paths, as SQLite doesn't handle that (yet) */
  zDbName = fossil_utf8_to_filename(zDbName);
#elif defined(_WIN32)
  /* Only necessary when SQLite doesn't handle Extended paths. */
  zDbName = fossil_utf8_to_filename(zDbName);
  zDbName = fossil_filename_to_utf8(zDbName);
#endif
  if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
  rc = sqlite3_open_v2(
       zDbName, &db,







|







713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
  int rc;
  sqlite3 *db;

#if defined(__CYGWIN__)
  /* Necessary if we want Cygwin fossil to recognize win32 file
   * paths, as SQLite doesn't handle that (yet) */
  zDbName = fossil_utf8_to_filename(zDbName);
#elif 0 && defined(_WIN32)
  /* Only necessary when SQLite doesn't handle Extended paths. */
  zDbName = fossil_utf8_to_filename(zDbName);
  zDbName = fossil_filename_to_utf8(zDbName);
#endif
  if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
  rc = sqlite3_open_v2(
       zDbName, &db,
Changes to src/sqlite3.c.
36167
36168
36169
36170
36171
36172
36173







36174












































36175
36176
36177


36178
36179
36180
36181
36182
36183
36184
    **       for converting the relative path name to an absolute
    **       one by prepending the data directory and a backslash.
    */
    sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s",
                     sqlite3_data_directory, winGetDirSep(), zRelative);
    return SQLITE_OK;
  }







  zConverted = winConvertFromUtf8Filename(zRelative);












































  if( zConverted==0 ){
    return SQLITE_IOERR_NOMEM;
  }


  if( osIsNT() ){
    LPWSTR zTemp;
    nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0);
    if( nByte==0 ){
      sqlite3_free(zConverted);
      return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
                         "winFullPathname1", zRelative);







>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>
>







36167
36168
36169
36170
36171
36172
36173
36174
36175
36176
36177
36178
36179
36180
36181
36182
36183
36184
36185
36186
36187
36188
36189
36190
36191
36192
36193
36194
36195
36196
36197
36198
36199
36200
36201
36202
36203
36204
36205
36206
36207
36208
36209
36210
36211
36212
36213
36214
36215
36216
36217
36218
36219
36220
36221
36222
36223
36224
36225
36226
36227
36228
36229
36230
36231
36232
36233
36234
36235
36236
36237
    **       for converting the relative path name to an absolute
    **       one by prepending the data directory and a backslash.
    */
    sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s",
                     sqlite3_data_directory, winGetDirSep(), zRelative);
    return SQLITE_OK;
  }
  nByte = osMultiByteToWideChar(CP_UTF8, 0, zRelative, -1, NULL, 0);
  if( nByte==0 ){
    return winLogError(SQLITE_IOERR_CONVPATH, (DWORD)osGetLastError(),
                       "winFullPathname", zRelative);
  }
  if( osIsNT() ){
    LPWSTR zWideFilename;

    if( nByte>SQLITE_WIN32_MAX_PATH_CHARS ){
      /* No Win32 API functions can handle such long paths. Let's see if
       * we can do something about it. If not, just leave it as is. */
      if( winIsDirSep(zRelative[0]) && winIsDirSep(zRelative[1])
          && zRelative[2]!='?' ){
        /* It's an UNC path, convert it to an extended UNC path. */
        zWideFilename = sqlite3MallocZero( (nByte+6)*sizeof(WCHAR) );
        if( zWideFilename==0 ){
          return SQLITE_IOERR_NOMEM;
        }
        memcpy(zWideFilename, L"\\\\?\\UNC\\", 16);
        nByte = osMultiByteToWideChar(CP_UTF8, 0, zRelative+2, -1,
                                      zWideFilename+8, nByte);
        goto finished;
      }else if( winIsDriveLetterAndColon(zRelative)
          && winIsDirSep(zRelative[2]) ){
        /* It has a correct drive prefix, convert to extended form. */
        zWideFilename = sqlite3MallocZero( (nByte+4)*sizeof(WCHAR) );
        if( zWideFilename==0 ){
          return SQLITE_IOERR_NOMEM;
        }
        memcpy(zWideFilename, L"\\\\?\\", 8);
        nByte = osMultiByteToWideChar(CP_UTF8, 0, zRelative, -1,
                                      zWideFilename+4, nByte);
        zWideFilename[6] = '\\';
        goto finished;
      }
      /* Another form, e.g. relative path or maybe it already
       * has the '\\?\' prefix. Just leave it as-is. */
    }
    zWideFilename = sqlite3Malloc( nByte*sizeof(WCHAR) );
    if( zWideFilename==0 ){
      return SQLITE_IOERR_NOMEM;
    }
    nByte = osMultiByteToWideChar(CP_UTF8, 0, zRelative, -1,
                                  zWideFilename, nByte);
    if( nByte==0 ){
      sqlite3_free(zWideFilename);
      return SQLITE_IOERR_NOMEM;
    }
  finished:
    zConverted = zWideFilename;
  }else{
    zConverted = sqlite3_win32_utf8_to_mbcs(zRelative);
    if( zConverted==0 ){
      return SQLITE_IOERR_NOMEM;
    }
  }

  if( osIsNT() ){
    LPWSTR zTemp;
    nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0);
    if( nByte==0 ){
      sqlite3_free(zConverted);
      return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
                         "winFullPathname1", zRelative);