Fossil SCM
merge unicode branch
Commit
b4ea94b488dcf04760a22ec56f1af0a3070d35f8
Parent
abbc00fc5b666f0…
9 files changed
+3
-2
+3
-2
+7
-9
+7
-9
+20
-9
+20
-9
+21
-10
+21
-10
+1
+3
-2
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -422,12 +422,12 @@ | ||
| 422 | 422 | file_delete(zName); |
| 423 | 423 | } |
| 424 | 424 | if( rc!=1 ){ |
| 425 | 425 | #if defined(_WIN32) |
| 426 | 426 | int rc; |
| 427 | - char *zMbcs = fossil_utf8_to_mbcs(zName); | |
| 428 | - rc = mkdir(zMbcs); | |
| 427 | + wchar_t *zMbcs = fossil_utf8_to_unicode(zName); | |
| 428 | + rc = _wmkdir(zMbcs); | |
| 429 | 429 | fossil_mbcs_free(zMbcs); |
| 430 | 430 | return rc; |
| 431 | 431 | #else |
| 432 | 432 | return mkdir(zName, 0755); |
| 433 | 433 | #endif |
| @@ -1032,10 +1032,11 @@ | ||
| 1032 | 1032 | /* |
| 1033 | 1033 | ** Translate Unicode to UTF8. Return a pointer to the translated text. |
| 1034 | 1034 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| 1035 | 1035 | ** returned pointer when done. |
| 1036 | 1036 | */ |
| 1037 | +#undef fossil_unicode_to_utf8 | |
| 1037 | 1038 | char *fossil_unicode_to_utf8(const void *zUnicode){ |
| 1038 | 1039 | #ifdef _WIN32 |
| 1039 | 1040 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0); |
| 1040 | 1041 | char *zUtf = sqlite3_malloc( nByte ); |
| 1041 | 1042 | if( zUtf==0 ){ |
| 1042 | 1043 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -422,12 +422,12 @@ | |
| 422 | file_delete(zName); |
| 423 | } |
| 424 | if( rc!=1 ){ |
| 425 | #if defined(_WIN32) |
| 426 | int rc; |
| 427 | char *zMbcs = fossil_utf8_to_mbcs(zName); |
| 428 | rc = mkdir(zMbcs); |
| 429 | fossil_mbcs_free(zMbcs); |
| 430 | return rc; |
| 431 | #else |
| 432 | return mkdir(zName, 0755); |
| 433 | #endif |
| @@ -1032,10 +1032,11 @@ | |
| 1032 | /* |
| 1033 | ** Translate Unicode to UTF8. Return a pointer to the translated text. |
| 1034 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| 1035 | ** returned pointer when done. |
| 1036 | */ |
| 1037 | char *fossil_unicode_to_utf8(const void *zUnicode){ |
| 1038 | #ifdef _WIN32 |
| 1039 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0); |
| 1040 | char *zUtf = sqlite3_malloc( nByte ); |
| 1041 | if( zUtf==0 ){ |
| 1042 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -422,12 +422,12 @@ | |
| 422 | file_delete(zName); |
| 423 | } |
| 424 | if( rc!=1 ){ |
| 425 | #if defined(_WIN32) |
| 426 | int rc; |
| 427 | wchar_t *zMbcs = fossil_utf8_to_unicode(zName); |
| 428 | rc = _wmkdir(zMbcs); |
| 429 | fossil_mbcs_free(zMbcs); |
| 430 | return rc; |
| 431 | #else |
| 432 | return mkdir(zName, 0755); |
| 433 | #endif |
| @@ -1032,10 +1032,11 @@ | |
| 1032 | /* |
| 1033 | ** Translate Unicode to UTF8. Return a pointer to the translated text. |
| 1034 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| 1035 | ** returned pointer when done. |
| 1036 | */ |
| 1037 | #undef fossil_unicode_to_utf8 |
| 1038 | char *fossil_unicode_to_utf8(const void *zUnicode){ |
| 1039 | #ifdef _WIN32 |
| 1040 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0); |
| 1041 | char *zUtf = sqlite3_malloc( nByte ); |
| 1042 | if( zUtf==0 ){ |
| 1043 |
+3
-2
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -422,12 +422,12 @@ | ||
| 422 | 422 | file_delete(zName); |
| 423 | 423 | } |
| 424 | 424 | if( rc!=1 ){ |
| 425 | 425 | #if defined(_WIN32) |
| 426 | 426 | int rc; |
| 427 | - char *zMbcs = fossil_utf8_to_mbcs(zName); | |
| 428 | - rc = mkdir(zMbcs); | |
| 427 | + wchar_t *zMbcs = fossil_utf8_to_unicode(zName); | |
| 428 | + rc = _wmkdir(zMbcs); | |
| 429 | 429 | fossil_mbcs_free(zMbcs); |
| 430 | 430 | return rc; |
| 431 | 431 | #else |
| 432 | 432 | return mkdir(zName, 0755); |
| 433 | 433 | #endif |
| @@ -1032,10 +1032,11 @@ | ||
| 1032 | 1032 | /* |
| 1033 | 1033 | ** Translate Unicode to UTF8. Return a pointer to the translated text. |
| 1034 | 1034 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| 1035 | 1035 | ** returned pointer when done. |
| 1036 | 1036 | */ |
| 1037 | +#undef fossil_unicode_to_utf8 | |
| 1037 | 1038 | char *fossil_unicode_to_utf8(const void *zUnicode){ |
| 1038 | 1039 | #ifdef _WIN32 |
| 1039 | 1040 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0); |
| 1040 | 1041 | char *zUtf = sqlite3_malloc( nByte ); |
| 1041 | 1042 | if( zUtf==0 ){ |
| 1042 | 1043 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -422,12 +422,12 @@ | |
| 422 | file_delete(zName); |
| 423 | } |
| 424 | if( rc!=1 ){ |
| 425 | #if defined(_WIN32) |
| 426 | int rc; |
| 427 | char *zMbcs = fossil_utf8_to_mbcs(zName); |
| 428 | rc = mkdir(zMbcs); |
| 429 | fossil_mbcs_free(zMbcs); |
| 430 | return rc; |
| 431 | #else |
| 432 | return mkdir(zName, 0755); |
| 433 | #endif |
| @@ -1032,10 +1032,11 @@ | |
| 1032 | /* |
| 1033 | ** Translate Unicode to UTF8. Return a pointer to the translated text. |
| 1034 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| 1035 | ** returned pointer when done. |
| 1036 | */ |
| 1037 | char *fossil_unicode_to_utf8(const void *zUnicode){ |
| 1038 | #ifdef _WIN32 |
| 1039 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0); |
| 1040 | char *zUtf = sqlite3_malloc( nByte ); |
| 1041 | if( zUtf==0 ){ |
| 1042 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -422,12 +422,12 @@ | |
| 422 | file_delete(zName); |
| 423 | } |
| 424 | if( rc!=1 ){ |
| 425 | #if defined(_WIN32) |
| 426 | int rc; |
| 427 | wchar_t *zMbcs = fossil_utf8_to_unicode(zName); |
| 428 | rc = _wmkdir(zMbcs); |
| 429 | fossil_mbcs_free(zMbcs); |
| 430 | return rc; |
| 431 | #else |
| 432 | return mkdir(zName, 0755); |
| 433 | #endif |
| @@ -1032,10 +1032,11 @@ | |
| 1032 | /* |
| 1033 | ** Translate Unicode to UTF8. Return a pointer to the translated text. |
| 1034 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| 1035 | ** returned pointer when done. |
| 1036 | */ |
| 1037 | #undef fossil_unicode_to_utf8 |
| 1038 | char *fossil_unicode_to_utf8(const void *zUnicode){ |
| 1039 | #ifdef _WIN32 |
| 1040 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0); |
| 1041 | char *zUtf = sqlite3_malloc( nByte ); |
| 1042 | if( zUtf==0 ){ |
| 1043 |
+7
-9
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -36,10 +36,16 @@ | ||
| 36 | 36 | #endif |
| 37 | 37 | #ifdef FOSSIL_ENABLE_TCL |
| 38 | 38 | #include "tcl.h" |
| 39 | 39 | #endif |
| 40 | 40 | |
| 41 | +#if !defined(_WIN32) | |
| 42 | +# define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 | |
| 43 | +# define wchar_t char | |
| 44 | +# define wmain main | |
| 45 | +#endif | |
| 46 | + | |
| 41 | 47 | /* |
| 42 | 48 | ** Number of elements in an array |
| 43 | 49 | */ |
| 44 | 50 | #define count(X) (sizeof(X)/sizeof(X[0])) |
| 45 | 51 | |
| @@ -352,15 +358,11 @@ | ||
| 352 | 358 | char const * zFileName; /* input file name */ |
| 353 | 359 | FILE * zInFile; /* input FILE */ |
| 354 | 360 | |
| 355 | 361 | g.argc = argc; |
| 356 | 362 | g.argv = argv; |
| 357 | -#if defined(_WIN32) && defined(UNICODE) | |
| 358 | 363 | for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]); |
| 359 | -#else | |
| 360 | - for(i=0; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]); | |
| 361 | -#endif | |
| 362 | 364 | for(i=1; i<g.argc-1; i++){ |
| 363 | 365 | z = g.argv[i]; |
| 364 | 366 | if( z[0]!='-' ) continue; |
| 365 | 367 | z++; |
| 366 | 368 | if( z[0]=='-' ) z++; |
| @@ -414,15 +416,11 @@ | ||
| 414 | 416 | } |
| 415 | 417 | |
| 416 | 418 | /* |
| 417 | 419 | ** This procedure runs first. |
| 418 | 420 | */ |
| 419 | -#if defined(_WIN32) && defined(UNICODE) | |
| 420 | -int wmain(int argc, char **argv) | |
| 421 | -#else | |
| 422 | -int main(int argc, char **argv) | |
| 423 | -#endif | |
| 421 | +int wmain(int argc, wchar_t **argv) | |
| 424 | 422 | { |
| 425 | 423 | const char *zCmdName = "unknown"; |
| 426 | 424 | int idx; |
| 427 | 425 | int rc; |
| 428 | 426 | |
| 429 | 427 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -36,10 +36,16 @@ | |
| 36 | #endif |
| 37 | #ifdef FOSSIL_ENABLE_TCL |
| 38 | #include "tcl.h" |
| 39 | #endif |
| 40 | |
| 41 | /* |
| 42 | ** Number of elements in an array |
| 43 | */ |
| 44 | #define count(X) (sizeof(X)/sizeof(X[0])) |
| 45 | |
| @@ -352,15 +358,11 @@ | |
| 352 | char const * zFileName; /* input file name */ |
| 353 | FILE * zInFile; /* input FILE */ |
| 354 | |
| 355 | g.argc = argc; |
| 356 | g.argv = argv; |
| 357 | #if defined(_WIN32) && defined(UNICODE) |
| 358 | for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]); |
| 359 | #else |
| 360 | for(i=0; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]); |
| 361 | #endif |
| 362 | for(i=1; i<g.argc-1; i++){ |
| 363 | z = g.argv[i]; |
| 364 | if( z[0]!='-' ) continue; |
| 365 | z++; |
| 366 | if( z[0]=='-' ) z++; |
| @@ -414,15 +416,11 @@ | |
| 414 | } |
| 415 | |
| 416 | /* |
| 417 | ** This procedure runs first. |
| 418 | */ |
| 419 | #if defined(_WIN32) && defined(UNICODE) |
| 420 | int wmain(int argc, char **argv) |
| 421 | #else |
| 422 | int main(int argc, char **argv) |
| 423 | #endif |
| 424 | { |
| 425 | const char *zCmdName = "unknown"; |
| 426 | int idx; |
| 427 | int rc; |
| 428 | |
| 429 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -36,10 +36,16 @@ | |
| 36 | #endif |
| 37 | #ifdef FOSSIL_ENABLE_TCL |
| 38 | #include "tcl.h" |
| 39 | #endif |
| 40 | |
| 41 | #if !defined(_WIN32) |
| 42 | # define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 |
| 43 | # define wchar_t char |
| 44 | # define wmain main |
| 45 | #endif |
| 46 | |
| 47 | /* |
| 48 | ** Number of elements in an array |
| 49 | */ |
| 50 | #define count(X) (sizeof(X)/sizeof(X[0])) |
| 51 | |
| @@ -352,15 +358,11 @@ | |
| 358 | char const * zFileName; /* input file name */ |
| 359 | FILE * zInFile; /* input FILE */ |
| 360 | |
| 361 | g.argc = argc; |
| 362 | g.argv = argv; |
| 363 | for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]); |
| 364 | for(i=1; i<g.argc-1; i++){ |
| 365 | z = g.argv[i]; |
| 366 | if( z[0]!='-' ) continue; |
| 367 | z++; |
| 368 | if( z[0]=='-' ) z++; |
| @@ -414,15 +416,11 @@ | |
| 416 | } |
| 417 | |
| 418 | /* |
| 419 | ** This procedure runs first. |
| 420 | */ |
| 421 | int wmain(int argc, wchar_t **argv) |
| 422 | { |
| 423 | const char *zCmdName = "unknown"; |
| 424 | int idx; |
| 425 | int rc; |
| 426 | |
| 427 |
+7
-9
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -36,10 +36,16 @@ | ||
| 36 | 36 | #endif |
| 37 | 37 | #ifdef FOSSIL_ENABLE_TCL |
| 38 | 38 | #include "tcl.h" |
| 39 | 39 | #endif |
| 40 | 40 | |
| 41 | +#if !defined(_WIN32) | |
| 42 | +# define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 | |
| 43 | +# define wchar_t char | |
| 44 | +# define wmain main | |
| 45 | +#endif | |
| 46 | + | |
| 41 | 47 | /* |
| 42 | 48 | ** Number of elements in an array |
| 43 | 49 | */ |
| 44 | 50 | #define count(X) (sizeof(X)/sizeof(X[0])) |
| 45 | 51 | |
| @@ -352,15 +358,11 @@ | ||
| 352 | 358 | char const * zFileName; /* input file name */ |
| 353 | 359 | FILE * zInFile; /* input FILE */ |
| 354 | 360 | |
| 355 | 361 | g.argc = argc; |
| 356 | 362 | g.argv = argv; |
| 357 | -#if defined(_WIN32) && defined(UNICODE) | |
| 358 | 363 | for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]); |
| 359 | -#else | |
| 360 | - for(i=0; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]); | |
| 361 | -#endif | |
| 362 | 364 | for(i=1; i<g.argc-1; i++){ |
| 363 | 365 | z = g.argv[i]; |
| 364 | 366 | if( z[0]!='-' ) continue; |
| 365 | 367 | z++; |
| 366 | 368 | if( z[0]=='-' ) z++; |
| @@ -414,15 +416,11 @@ | ||
| 414 | 416 | } |
| 415 | 417 | |
| 416 | 418 | /* |
| 417 | 419 | ** This procedure runs first. |
| 418 | 420 | */ |
| 419 | -#if defined(_WIN32) && defined(UNICODE) | |
| 420 | -int wmain(int argc, char **argv) | |
| 421 | -#else | |
| 422 | -int main(int argc, char **argv) | |
| 423 | -#endif | |
| 421 | +int wmain(int argc, wchar_t **argv) | |
| 424 | 422 | { |
| 425 | 423 | const char *zCmdName = "unknown"; |
| 426 | 424 | int idx; |
| 427 | 425 | int rc; |
| 428 | 426 | |
| 429 | 427 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -36,10 +36,16 @@ | |
| 36 | #endif |
| 37 | #ifdef FOSSIL_ENABLE_TCL |
| 38 | #include "tcl.h" |
| 39 | #endif |
| 40 | |
| 41 | /* |
| 42 | ** Number of elements in an array |
| 43 | */ |
| 44 | #define count(X) (sizeof(X)/sizeof(X[0])) |
| 45 | |
| @@ -352,15 +358,11 @@ | |
| 352 | char const * zFileName; /* input file name */ |
| 353 | FILE * zInFile; /* input FILE */ |
| 354 | |
| 355 | g.argc = argc; |
| 356 | g.argv = argv; |
| 357 | #if defined(_WIN32) && defined(UNICODE) |
| 358 | for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]); |
| 359 | #else |
| 360 | for(i=0; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]); |
| 361 | #endif |
| 362 | for(i=1; i<g.argc-1; i++){ |
| 363 | z = g.argv[i]; |
| 364 | if( z[0]!='-' ) continue; |
| 365 | z++; |
| 366 | if( z[0]=='-' ) z++; |
| @@ -414,15 +416,11 @@ | |
| 414 | } |
| 415 | |
| 416 | /* |
| 417 | ** This procedure runs first. |
| 418 | */ |
| 419 | #if defined(_WIN32) && defined(UNICODE) |
| 420 | int wmain(int argc, char **argv) |
| 421 | #else |
| 422 | int main(int argc, char **argv) |
| 423 | #endif |
| 424 | { |
| 425 | const char *zCmdName = "unknown"; |
| 426 | int idx; |
| 427 | int rc; |
| 428 | |
| 429 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -36,10 +36,16 @@ | |
| 36 | #endif |
| 37 | #ifdef FOSSIL_ENABLE_TCL |
| 38 | #include "tcl.h" |
| 39 | #endif |
| 40 | |
| 41 | #if !defined(_WIN32) |
| 42 | # define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 |
| 43 | # define wchar_t char |
| 44 | # define wmain main |
| 45 | #endif |
| 46 | |
| 47 | /* |
| 48 | ** Number of elements in an array |
| 49 | */ |
| 50 | #define count(X) (sizeof(X)/sizeof(X[0])) |
| 51 | |
| @@ -352,15 +358,11 @@ | |
| 358 | char const * zFileName; /* input file name */ |
| 359 | FILE * zInFile; /* input FILE */ |
| 360 | |
| 361 | g.argc = argc; |
| 362 | g.argv = argv; |
| 363 | for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]); |
| 364 | for(i=1; i<g.argc-1; i++){ |
| 365 | z = g.argv[i]; |
| 366 | if( z[0]!='-' ) continue; |
| 367 | z++; |
| 368 | if( z[0]=='-' ) z++; |
| @@ -414,15 +416,11 @@ | |
| 416 | } |
| 417 | |
| 418 | /* |
| 419 | ** This procedure runs first. |
| 420 | */ |
| 421 | int wmain(int argc, wchar_t **argv) |
| 422 | { |
| 423 | const char *zCmdName = "unknown"; |
| 424 | int idx; |
| 425 | int rc; |
| 426 | |
| 427 |
+20
-9
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -21,10 +21,21 @@ | ||
| 21 | 21 | #include "rebuild.h" |
| 22 | 22 | #include <assert.h> |
| 23 | 23 | #include <dirent.h> |
| 24 | 24 | #include <errno.h> |
| 25 | 25 | |
| 26 | +#if !defined(_WIN32) | |
| 27 | +# define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 | |
| 28 | +# define fossil_utf8_to_unicode fossil_utf8_to_mbcs | |
| 29 | +# define wchar_t char | |
| 30 | +# define _WDIR DIR | |
| 31 | +# define _wdirent dirent | |
| 32 | +# define _wopendir opendir | |
| 33 | +# define _wreaddir readdir | |
| 34 | +# define _wclosedir closedir | |
| 35 | +#endif | |
| 36 | + | |
| 26 | 37 | /* |
| 27 | 38 | ** Make changes to the stable part of the schema (the part that is not |
| 28 | 39 | ** simply deleted and reconstructed on a rebuild) to bring the schema |
| 29 | 40 | ** up to the latest. |
| 30 | 41 | */ |
| @@ -818,28 +829,28 @@ | ||
| 818 | 829 | /* |
| 819 | 830 | ** Recursively read all files from the directory zPath and install |
| 820 | 831 | ** every file read as a new artifact in the repository. |
| 821 | 832 | */ |
| 822 | 833 | void recon_read_dir(char *zPath){ |
| 823 | - DIR *d; | |
| 824 | - struct dirent *pEntry; | |
| 834 | + _WDIR *d; | |
| 835 | + struct _wdirent *pEntry; | |
| 825 | 836 | Blob aContent; /* content of the just read artifact */ |
| 826 | 837 | static int nFileRead = 0; |
| 827 | - char *zMbcsPath; | |
| 838 | + wchar_t *zMbcsPath; | |
| 828 | 839 | char *zUtf8Name; |
| 829 | 840 | |
| 830 | - zMbcsPath = fossil_utf8_to_mbcs(zPath); | |
| 831 | - d = opendir(zMbcsPath); | |
| 841 | + zMbcsPath = fossil_utf8_to_unicode(zPath); | |
| 842 | + d = _wopendir(zMbcsPath); | |
| 832 | 843 | if( d ){ |
| 833 | - while( (pEntry=readdir(d))!=0 ){ | |
| 844 | + while( (pEntry=_wreaddir(d))!=0 ){ | |
| 834 | 845 | Blob path; |
| 835 | 846 | char *zSubpath; |
| 836 | 847 | |
| 837 | - if( pEntry->d_name[0]=='.' ){ | |
| 848 | + if( pEntry->d_name[0]==L'.' ){ | |
| 838 | 849 | continue; |
| 839 | 850 | } |
| 840 | - zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name); | |
| 851 | + zUtf8Name = fossil_unicode_to_utf8(pEntry->d_name); | |
| 841 | 852 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 842 | 853 | fossil_mbcs_free(zUtf8Name); |
| 843 | 854 | if( file_isdir(zSubpath)==1 ){ |
| 844 | 855 | recon_read_dir(zSubpath); |
| 845 | 856 | } |
| @@ -854,11 +865,11 @@ | ||
| 854 | 865 | blob_reset(&aContent); |
| 855 | 866 | free(zSubpath); |
| 856 | 867 | fossil_print("\r%d", ++nFileRead); |
| 857 | 868 | fflush(stdout); |
| 858 | 869 | } |
| 859 | - closedir(d); | |
| 870 | + _wclosedir(d); | |
| 860 | 871 | }else { |
| 861 | 872 | fossil_panic("encountered error %d while trying to open \"%s\".", |
| 862 | 873 | errno, g.argv[3]); |
| 863 | 874 | } |
| 864 | 875 | fossil_mbcs_free(zMbcsPath); |
| 865 | 876 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -21,10 +21,21 @@ | |
| 21 | #include "rebuild.h" |
| 22 | #include <assert.h> |
| 23 | #include <dirent.h> |
| 24 | #include <errno.h> |
| 25 | |
| 26 | /* |
| 27 | ** Make changes to the stable part of the schema (the part that is not |
| 28 | ** simply deleted and reconstructed on a rebuild) to bring the schema |
| 29 | ** up to the latest. |
| 30 | */ |
| @@ -818,28 +829,28 @@ | |
| 818 | /* |
| 819 | ** Recursively read all files from the directory zPath and install |
| 820 | ** every file read as a new artifact in the repository. |
| 821 | */ |
| 822 | void recon_read_dir(char *zPath){ |
| 823 | DIR *d; |
| 824 | struct dirent *pEntry; |
| 825 | Blob aContent; /* content of the just read artifact */ |
| 826 | static int nFileRead = 0; |
| 827 | char *zMbcsPath; |
| 828 | char *zUtf8Name; |
| 829 | |
| 830 | zMbcsPath = fossil_utf8_to_mbcs(zPath); |
| 831 | d = opendir(zMbcsPath); |
| 832 | if( d ){ |
| 833 | while( (pEntry=readdir(d))!=0 ){ |
| 834 | Blob path; |
| 835 | char *zSubpath; |
| 836 | |
| 837 | if( pEntry->d_name[0]=='.' ){ |
| 838 | continue; |
| 839 | } |
| 840 | zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name); |
| 841 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 842 | fossil_mbcs_free(zUtf8Name); |
| 843 | if( file_isdir(zSubpath)==1 ){ |
| 844 | recon_read_dir(zSubpath); |
| 845 | } |
| @@ -854,11 +865,11 @@ | |
| 854 | blob_reset(&aContent); |
| 855 | free(zSubpath); |
| 856 | fossil_print("\r%d", ++nFileRead); |
| 857 | fflush(stdout); |
| 858 | } |
| 859 | closedir(d); |
| 860 | }else { |
| 861 | fossil_panic("encountered error %d while trying to open \"%s\".", |
| 862 | errno, g.argv[3]); |
| 863 | } |
| 864 | fossil_mbcs_free(zMbcsPath); |
| 865 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -21,10 +21,21 @@ | |
| 21 | #include "rebuild.h" |
| 22 | #include <assert.h> |
| 23 | #include <dirent.h> |
| 24 | #include <errno.h> |
| 25 | |
| 26 | #if !defined(_WIN32) |
| 27 | # define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 |
| 28 | # define fossil_utf8_to_unicode fossil_utf8_to_mbcs |
| 29 | # define wchar_t char |
| 30 | # define _WDIR DIR |
| 31 | # define _wdirent dirent |
| 32 | # define _wopendir opendir |
| 33 | # define _wreaddir readdir |
| 34 | # define _wclosedir closedir |
| 35 | #endif |
| 36 | |
| 37 | /* |
| 38 | ** Make changes to the stable part of the schema (the part that is not |
| 39 | ** simply deleted and reconstructed on a rebuild) to bring the schema |
| 40 | ** up to the latest. |
| 41 | */ |
| @@ -818,28 +829,28 @@ | |
| 829 | /* |
| 830 | ** Recursively read all files from the directory zPath and install |
| 831 | ** every file read as a new artifact in the repository. |
| 832 | */ |
| 833 | void recon_read_dir(char *zPath){ |
| 834 | _WDIR *d; |
| 835 | struct _wdirent *pEntry; |
| 836 | Blob aContent; /* content of the just read artifact */ |
| 837 | static int nFileRead = 0; |
| 838 | wchar_t *zMbcsPath; |
| 839 | char *zUtf8Name; |
| 840 | |
| 841 | zMbcsPath = fossil_utf8_to_unicode(zPath); |
| 842 | d = _wopendir(zMbcsPath); |
| 843 | if( d ){ |
| 844 | while( (pEntry=_wreaddir(d))!=0 ){ |
| 845 | Blob path; |
| 846 | char *zSubpath; |
| 847 | |
| 848 | if( pEntry->d_name[0]==L'.' ){ |
| 849 | continue; |
| 850 | } |
| 851 | zUtf8Name = fossil_unicode_to_utf8(pEntry->d_name); |
| 852 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 853 | fossil_mbcs_free(zUtf8Name); |
| 854 | if( file_isdir(zSubpath)==1 ){ |
| 855 | recon_read_dir(zSubpath); |
| 856 | } |
| @@ -854,11 +865,11 @@ | |
| 865 | blob_reset(&aContent); |
| 866 | free(zSubpath); |
| 867 | fossil_print("\r%d", ++nFileRead); |
| 868 | fflush(stdout); |
| 869 | } |
| 870 | _wclosedir(d); |
| 871 | }else { |
| 872 | fossil_panic("encountered error %d while trying to open \"%s\".", |
| 873 | errno, g.argv[3]); |
| 874 | } |
| 875 | fossil_mbcs_free(zMbcsPath); |
| 876 |
+20
-9
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -21,10 +21,21 @@ | ||
| 21 | 21 | #include "rebuild.h" |
| 22 | 22 | #include <assert.h> |
| 23 | 23 | #include <dirent.h> |
| 24 | 24 | #include <errno.h> |
| 25 | 25 | |
| 26 | +#if !defined(_WIN32) | |
| 27 | +# define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 | |
| 28 | +# define fossil_utf8_to_unicode fossil_utf8_to_mbcs | |
| 29 | +# define wchar_t char | |
| 30 | +# define _WDIR DIR | |
| 31 | +# define _wdirent dirent | |
| 32 | +# define _wopendir opendir | |
| 33 | +# define _wreaddir readdir | |
| 34 | +# define _wclosedir closedir | |
| 35 | +#endif | |
| 36 | + | |
| 26 | 37 | /* |
| 27 | 38 | ** Make changes to the stable part of the schema (the part that is not |
| 28 | 39 | ** simply deleted and reconstructed on a rebuild) to bring the schema |
| 29 | 40 | ** up to the latest. |
| 30 | 41 | */ |
| @@ -818,28 +829,28 @@ | ||
| 818 | 829 | /* |
| 819 | 830 | ** Recursively read all files from the directory zPath and install |
| 820 | 831 | ** every file read as a new artifact in the repository. |
| 821 | 832 | */ |
| 822 | 833 | void recon_read_dir(char *zPath){ |
| 823 | - DIR *d; | |
| 824 | - struct dirent *pEntry; | |
| 834 | + _WDIR *d; | |
| 835 | + struct _wdirent *pEntry; | |
| 825 | 836 | Blob aContent; /* content of the just read artifact */ |
| 826 | 837 | static int nFileRead = 0; |
| 827 | - char *zMbcsPath; | |
| 838 | + wchar_t *zMbcsPath; | |
| 828 | 839 | char *zUtf8Name; |
| 829 | 840 | |
| 830 | - zMbcsPath = fossil_utf8_to_mbcs(zPath); | |
| 831 | - d = opendir(zMbcsPath); | |
| 841 | + zMbcsPath = fossil_utf8_to_unicode(zPath); | |
| 842 | + d = _wopendir(zMbcsPath); | |
| 832 | 843 | if( d ){ |
| 833 | - while( (pEntry=readdir(d))!=0 ){ | |
| 844 | + while( (pEntry=_wreaddir(d))!=0 ){ | |
| 834 | 845 | Blob path; |
| 835 | 846 | char *zSubpath; |
| 836 | 847 | |
| 837 | - if( pEntry->d_name[0]=='.' ){ | |
| 848 | + if( pEntry->d_name[0]==L'.' ){ | |
| 838 | 849 | continue; |
| 839 | 850 | } |
| 840 | - zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name); | |
| 851 | + zUtf8Name = fossil_unicode_to_utf8(pEntry->d_name); | |
| 841 | 852 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 842 | 853 | fossil_mbcs_free(zUtf8Name); |
| 843 | 854 | if( file_isdir(zSubpath)==1 ){ |
| 844 | 855 | recon_read_dir(zSubpath); |
| 845 | 856 | } |
| @@ -854,11 +865,11 @@ | ||
| 854 | 865 | blob_reset(&aContent); |
| 855 | 866 | free(zSubpath); |
| 856 | 867 | fossil_print("\r%d", ++nFileRead); |
| 857 | 868 | fflush(stdout); |
| 858 | 869 | } |
| 859 | - closedir(d); | |
| 870 | + _wclosedir(d); | |
| 860 | 871 | }else { |
| 861 | 872 | fossil_panic("encountered error %d while trying to open \"%s\".", |
| 862 | 873 | errno, g.argv[3]); |
| 863 | 874 | } |
| 864 | 875 | fossil_mbcs_free(zMbcsPath); |
| 865 | 876 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -21,10 +21,21 @@ | |
| 21 | #include "rebuild.h" |
| 22 | #include <assert.h> |
| 23 | #include <dirent.h> |
| 24 | #include <errno.h> |
| 25 | |
| 26 | /* |
| 27 | ** Make changes to the stable part of the schema (the part that is not |
| 28 | ** simply deleted and reconstructed on a rebuild) to bring the schema |
| 29 | ** up to the latest. |
| 30 | */ |
| @@ -818,28 +829,28 @@ | |
| 818 | /* |
| 819 | ** Recursively read all files from the directory zPath and install |
| 820 | ** every file read as a new artifact in the repository. |
| 821 | */ |
| 822 | void recon_read_dir(char *zPath){ |
| 823 | DIR *d; |
| 824 | struct dirent *pEntry; |
| 825 | Blob aContent; /* content of the just read artifact */ |
| 826 | static int nFileRead = 0; |
| 827 | char *zMbcsPath; |
| 828 | char *zUtf8Name; |
| 829 | |
| 830 | zMbcsPath = fossil_utf8_to_mbcs(zPath); |
| 831 | d = opendir(zMbcsPath); |
| 832 | if( d ){ |
| 833 | while( (pEntry=readdir(d))!=0 ){ |
| 834 | Blob path; |
| 835 | char *zSubpath; |
| 836 | |
| 837 | if( pEntry->d_name[0]=='.' ){ |
| 838 | continue; |
| 839 | } |
| 840 | zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name); |
| 841 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 842 | fossil_mbcs_free(zUtf8Name); |
| 843 | if( file_isdir(zSubpath)==1 ){ |
| 844 | recon_read_dir(zSubpath); |
| 845 | } |
| @@ -854,11 +865,11 @@ | |
| 854 | blob_reset(&aContent); |
| 855 | free(zSubpath); |
| 856 | fossil_print("\r%d", ++nFileRead); |
| 857 | fflush(stdout); |
| 858 | } |
| 859 | closedir(d); |
| 860 | }else { |
| 861 | fossil_panic("encountered error %d while trying to open \"%s\".", |
| 862 | errno, g.argv[3]); |
| 863 | } |
| 864 | fossil_mbcs_free(zMbcsPath); |
| 865 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -21,10 +21,21 @@ | |
| 21 | #include "rebuild.h" |
| 22 | #include <assert.h> |
| 23 | #include <dirent.h> |
| 24 | #include <errno.h> |
| 25 | |
| 26 | #if !defined(_WIN32) |
| 27 | # define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 |
| 28 | # define fossil_utf8_to_unicode fossil_utf8_to_mbcs |
| 29 | # define wchar_t char |
| 30 | # define _WDIR DIR |
| 31 | # define _wdirent dirent |
| 32 | # define _wopendir opendir |
| 33 | # define _wreaddir readdir |
| 34 | # define _wclosedir closedir |
| 35 | #endif |
| 36 | |
| 37 | /* |
| 38 | ** Make changes to the stable part of the schema (the part that is not |
| 39 | ** simply deleted and reconstructed on a rebuild) to bring the schema |
| 40 | ** up to the latest. |
| 41 | */ |
| @@ -818,28 +829,28 @@ | |
| 829 | /* |
| 830 | ** Recursively read all files from the directory zPath and install |
| 831 | ** every file read as a new artifact in the repository. |
| 832 | */ |
| 833 | void recon_read_dir(char *zPath){ |
| 834 | _WDIR *d; |
| 835 | struct _wdirent *pEntry; |
| 836 | Blob aContent; /* content of the just read artifact */ |
| 837 | static int nFileRead = 0; |
| 838 | wchar_t *zMbcsPath; |
| 839 | char *zUtf8Name; |
| 840 | |
| 841 | zMbcsPath = fossil_utf8_to_unicode(zPath); |
| 842 | d = _wopendir(zMbcsPath); |
| 843 | if( d ){ |
| 844 | while( (pEntry=_wreaddir(d))!=0 ){ |
| 845 | Blob path; |
| 846 | char *zSubpath; |
| 847 | |
| 848 | if( pEntry->d_name[0]==L'.' ){ |
| 849 | continue; |
| 850 | } |
| 851 | zUtf8Name = fossil_unicode_to_utf8(pEntry->d_name); |
| 852 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 853 | fossil_mbcs_free(zUtf8Name); |
| 854 | if( file_isdir(zSubpath)==1 ){ |
| 855 | recon_read_dir(zSubpath); |
| 856 | } |
| @@ -854,11 +865,11 @@ | |
| 865 | blob_reset(&aContent); |
| 866 | free(zSubpath); |
| 867 | fossil_print("\r%d", ++nFileRead); |
| 868 | fflush(stdout); |
| 869 | } |
| 870 | _wclosedir(d); |
| 871 | }else { |
| 872 | fossil_panic("encountered error %d while trying to open \"%s\".", |
| 873 | errno, g.argv[3]); |
| 874 | } |
| 875 | fossil_mbcs_free(zMbcsPath); |
| 876 |
+21
-10
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -25,10 +25,21 @@ | ||
| 25 | 25 | #include "dirent.h" |
| 26 | 26 | #else |
| 27 | 27 | #include <dirent.h> |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | +#if !defined(_WIN32) | |
| 31 | +# define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 | |
| 32 | +# define fossil_utf8_to_unicode fossil_utf8_to_mbcs | |
| 33 | +# define wchar_t char | |
| 34 | +# define _WDIR DIR | |
| 35 | +# define _wdirent dirent | |
| 36 | +# define _wopendir opendir | |
| 37 | +# define _wreaddir readdir | |
| 38 | +# define _wclosedir closedir | |
| 39 | +#endif | |
| 40 | + | |
| 30 | 41 | /* |
| 31 | 42 | ** The input is guaranteed to be a 40-character well-formed UUID. |
| 32 | 43 | ** Find its rid. |
| 33 | 44 | */ |
| 34 | 45 | int fast_uuid_to_rid(const char *zUuid){ |
| @@ -381,18 +392,18 @@ | ||
| 381 | 392 | ** Any files or directories that match the glob pattern pIgnore are |
| 382 | 393 | ** excluded from the scan. Name matching occurs after the first |
| 383 | 394 | ** nPrefix characters are elided from the filename. |
| 384 | 395 | */ |
| 385 | 396 | void vfile_scan(Blob *pPath, int nPrefix, int allFlag, Glob *pIgnore){ |
| 386 | - DIR *d; | |
| 397 | + _WDIR *d; | |
| 387 | 398 | int origSize; |
| 388 | 399 | const char *zDir; |
| 389 | - struct dirent *pEntry; | |
| 400 | + struct _wdirent *pEntry; | |
| 390 | 401 | int skipAll = 0; |
| 391 | 402 | static Stmt ins; |
| 392 | 403 | static int depth = 0; |
| 393 | - char *zMbcs; | |
| 404 | + wchar_t *zMbcs; | |
| 394 | 405 | |
| 395 | 406 | origSize = blob_size(pPath); |
| 396 | 407 | if( pIgnore ){ |
| 397 | 408 | blob_appendf(pPath, "/"); |
| 398 | 409 | if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| @@ -407,22 +418,22 @@ | ||
| 407 | 418 | ); |
| 408 | 419 | } |
| 409 | 420 | depth++; |
| 410 | 421 | |
| 411 | 422 | zDir = blob_str(pPath); |
| 412 | - zMbcs = fossil_utf8_to_mbcs(zDir); | |
| 413 | - d = opendir(zMbcs); | |
| 423 | + zMbcs = fossil_utf8_to_unicode(zDir); | |
| 424 | + d = _wopendir(zMbcs); | |
| 414 | 425 | if( d ){ |
| 415 | - while( (pEntry=readdir(d))!=0 ){ | |
| 426 | + while( (pEntry=_wreaddir(d))!=0 ){ | |
| 416 | 427 | char *zPath; |
| 417 | 428 | char *zUtf8; |
| 418 | - if( pEntry->d_name[0]=='.' ){ | |
| 429 | + if( pEntry->d_name[0]==L'.' ){ | |
| 419 | 430 | if( !allFlag ) continue; |
| 420 | 431 | if( pEntry->d_name[1]==0 ) continue; |
| 421 | - if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; | |
| 432 | + if( pEntry->d_name[1]==L'.' && pEntry->d_name[2]==0 ) continue; | |
| 422 | 433 | } |
| 423 | - zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name); | |
| 434 | + zUtf8 = fossil_unicode_to_utf8(pEntry->d_name); | |
| 424 | 435 | blob_appendf(pPath, "/%s", zUtf8); |
| 425 | 436 | fossil_mbcs_free(zUtf8); |
| 426 | 437 | zPath = blob_str(pPath); |
| 427 | 438 | if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ |
| 428 | 439 | /* do nothing */ |
| @@ -435,11 +446,11 @@ | ||
| 435 | 446 | db_step(&ins); |
| 436 | 447 | db_reset(&ins); |
| 437 | 448 | } |
| 438 | 449 | blob_resize(pPath, origSize); |
| 439 | 450 | } |
| 440 | - closedir(d); | |
| 451 | + _wclosedir(d); | |
| 441 | 452 | } |
| 442 | 453 | fossil_mbcs_free(zMbcs); |
| 443 | 454 | |
| 444 | 455 | depth--; |
| 445 | 456 | if( depth==0 ){ |
| 446 | 457 | |
| 447 | 458 | ADDED test/世界/界世.txt |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -25,10 +25,21 @@ | |
| 25 | #include "dirent.h" |
| 26 | #else |
| 27 | #include <dirent.h> |
| 28 | #endif |
| 29 | |
| 30 | /* |
| 31 | ** The input is guaranteed to be a 40-character well-formed UUID. |
| 32 | ** Find its rid. |
| 33 | */ |
| 34 | int fast_uuid_to_rid(const char *zUuid){ |
| @@ -381,18 +392,18 @@ | |
| 381 | ** Any files or directories that match the glob pattern pIgnore are |
| 382 | ** excluded from the scan. Name matching occurs after the first |
| 383 | ** nPrefix characters are elided from the filename. |
| 384 | */ |
| 385 | void vfile_scan(Blob *pPath, int nPrefix, int allFlag, Glob *pIgnore){ |
| 386 | DIR *d; |
| 387 | int origSize; |
| 388 | const char *zDir; |
| 389 | struct dirent *pEntry; |
| 390 | int skipAll = 0; |
| 391 | static Stmt ins; |
| 392 | static int depth = 0; |
| 393 | char *zMbcs; |
| 394 | |
| 395 | origSize = blob_size(pPath); |
| 396 | if( pIgnore ){ |
| 397 | blob_appendf(pPath, "/"); |
| 398 | if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| @@ -407,22 +418,22 @@ | |
| 407 | ); |
| 408 | } |
| 409 | depth++; |
| 410 | |
| 411 | zDir = blob_str(pPath); |
| 412 | zMbcs = fossil_utf8_to_mbcs(zDir); |
| 413 | d = opendir(zMbcs); |
| 414 | if( d ){ |
| 415 | while( (pEntry=readdir(d))!=0 ){ |
| 416 | char *zPath; |
| 417 | char *zUtf8; |
| 418 | if( pEntry->d_name[0]=='.' ){ |
| 419 | if( !allFlag ) continue; |
| 420 | if( pEntry->d_name[1]==0 ) continue; |
| 421 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; |
| 422 | } |
| 423 | zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name); |
| 424 | blob_appendf(pPath, "/%s", zUtf8); |
| 425 | fossil_mbcs_free(zUtf8); |
| 426 | zPath = blob_str(pPath); |
| 427 | if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ |
| 428 | /* do nothing */ |
| @@ -435,11 +446,11 @@ | |
| 435 | db_step(&ins); |
| 436 | db_reset(&ins); |
| 437 | } |
| 438 | blob_resize(pPath, origSize); |
| 439 | } |
| 440 | closedir(d); |
| 441 | } |
| 442 | fossil_mbcs_free(zMbcs); |
| 443 | |
| 444 | depth--; |
| 445 | if( depth==0 ){ |
| 446 | |
| 447 | DDED test/世界/界世.txt |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -25,10 +25,21 @@ | |
| 25 | #include "dirent.h" |
| 26 | #else |
| 27 | #include <dirent.h> |
| 28 | #endif |
| 29 | |
| 30 | #if !defined(_WIN32) |
| 31 | # define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 |
| 32 | # define fossil_utf8_to_unicode fossil_utf8_to_mbcs |
| 33 | # define wchar_t char |
| 34 | # define _WDIR DIR |
| 35 | # define _wdirent dirent |
| 36 | # define _wopendir opendir |
| 37 | # define _wreaddir readdir |
| 38 | # define _wclosedir closedir |
| 39 | #endif |
| 40 | |
| 41 | /* |
| 42 | ** The input is guaranteed to be a 40-character well-formed UUID. |
| 43 | ** Find its rid. |
| 44 | */ |
| 45 | int fast_uuid_to_rid(const char *zUuid){ |
| @@ -381,18 +392,18 @@ | |
| 392 | ** Any files or directories that match the glob pattern pIgnore are |
| 393 | ** excluded from the scan. Name matching occurs after the first |
| 394 | ** nPrefix characters are elided from the filename. |
| 395 | */ |
| 396 | void vfile_scan(Blob *pPath, int nPrefix, int allFlag, Glob *pIgnore){ |
| 397 | _WDIR *d; |
| 398 | int origSize; |
| 399 | const char *zDir; |
| 400 | struct _wdirent *pEntry; |
| 401 | int skipAll = 0; |
| 402 | static Stmt ins; |
| 403 | static int depth = 0; |
| 404 | wchar_t *zMbcs; |
| 405 | |
| 406 | origSize = blob_size(pPath); |
| 407 | if( pIgnore ){ |
| 408 | blob_appendf(pPath, "/"); |
| 409 | if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| @@ -407,22 +418,22 @@ | |
| 418 | ); |
| 419 | } |
| 420 | depth++; |
| 421 | |
| 422 | zDir = blob_str(pPath); |
| 423 | zMbcs = fossil_utf8_to_unicode(zDir); |
| 424 | d = _wopendir(zMbcs); |
| 425 | if( d ){ |
| 426 | while( (pEntry=_wreaddir(d))!=0 ){ |
| 427 | char *zPath; |
| 428 | char *zUtf8; |
| 429 | if( pEntry->d_name[0]==L'.' ){ |
| 430 | if( !allFlag ) continue; |
| 431 | if( pEntry->d_name[1]==0 ) continue; |
| 432 | if( pEntry->d_name[1]==L'.' && pEntry->d_name[2]==0 ) continue; |
| 433 | } |
| 434 | zUtf8 = fossil_unicode_to_utf8(pEntry->d_name); |
| 435 | blob_appendf(pPath, "/%s", zUtf8); |
| 436 | fossil_mbcs_free(zUtf8); |
| 437 | zPath = blob_str(pPath); |
| 438 | if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ |
| 439 | /* do nothing */ |
| @@ -435,11 +446,11 @@ | |
| 446 | db_step(&ins); |
| 447 | db_reset(&ins); |
| 448 | } |
| 449 | blob_resize(pPath, origSize); |
| 450 | } |
| 451 | _wclosedir(d); |
| 452 | } |
| 453 | fossil_mbcs_free(zMbcs); |
| 454 | |
| 455 | depth--; |
| 456 | if( depth==0 ){ |
| 457 | |
| 458 | DDED test/世界/界世.txt |
+21
-10
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -25,10 +25,21 @@ | ||
| 25 | 25 | #include "dirent.h" |
| 26 | 26 | #else |
| 27 | 27 | #include <dirent.h> |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | +#if !defined(_WIN32) | |
| 31 | +# define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 | |
| 32 | +# define fossil_utf8_to_unicode fossil_utf8_to_mbcs | |
| 33 | +# define wchar_t char | |
| 34 | +# define _WDIR DIR | |
| 35 | +# define _wdirent dirent | |
| 36 | +# define _wopendir opendir | |
| 37 | +# define _wreaddir readdir | |
| 38 | +# define _wclosedir closedir | |
| 39 | +#endif | |
| 40 | + | |
| 30 | 41 | /* |
| 31 | 42 | ** The input is guaranteed to be a 40-character well-formed UUID. |
| 32 | 43 | ** Find its rid. |
| 33 | 44 | */ |
| 34 | 45 | int fast_uuid_to_rid(const char *zUuid){ |
| @@ -381,18 +392,18 @@ | ||
| 381 | 392 | ** Any files or directories that match the glob pattern pIgnore are |
| 382 | 393 | ** excluded from the scan. Name matching occurs after the first |
| 383 | 394 | ** nPrefix characters are elided from the filename. |
| 384 | 395 | */ |
| 385 | 396 | void vfile_scan(Blob *pPath, int nPrefix, int allFlag, Glob *pIgnore){ |
| 386 | - DIR *d; | |
| 397 | + _WDIR *d; | |
| 387 | 398 | int origSize; |
| 388 | 399 | const char *zDir; |
| 389 | - struct dirent *pEntry; | |
| 400 | + struct _wdirent *pEntry; | |
| 390 | 401 | int skipAll = 0; |
| 391 | 402 | static Stmt ins; |
| 392 | 403 | static int depth = 0; |
| 393 | - char *zMbcs; | |
| 404 | + wchar_t *zMbcs; | |
| 394 | 405 | |
| 395 | 406 | origSize = blob_size(pPath); |
| 396 | 407 | if( pIgnore ){ |
| 397 | 408 | blob_appendf(pPath, "/"); |
| 398 | 409 | if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| @@ -407,22 +418,22 @@ | ||
| 407 | 418 | ); |
| 408 | 419 | } |
| 409 | 420 | depth++; |
| 410 | 421 | |
| 411 | 422 | zDir = blob_str(pPath); |
| 412 | - zMbcs = fossil_utf8_to_mbcs(zDir); | |
| 413 | - d = opendir(zMbcs); | |
| 423 | + zMbcs = fossil_utf8_to_unicode(zDir); | |
| 424 | + d = _wopendir(zMbcs); | |
| 414 | 425 | if( d ){ |
| 415 | - while( (pEntry=readdir(d))!=0 ){ | |
| 426 | + while( (pEntry=_wreaddir(d))!=0 ){ | |
| 416 | 427 | char *zPath; |
| 417 | 428 | char *zUtf8; |
| 418 | - if( pEntry->d_name[0]=='.' ){ | |
| 429 | + if( pEntry->d_name[0]==L'.' ){ | |
| 419 | 430 | if( !allFlag ) continue; |
| 420 | 431 | if( pEntry->d_name[1]==0 ) continue; |
| 421 | - if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; | |
| 432 | + if( pEntry->d_name[1]==L'.' && pEntry->d_name[2]==0 ) continue; | |
| 422 | 433 | } |
| 423 | - zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name); | |
| 434 | + zUtf8 = fossil_unicode_to_utf8(pEntry->d_name); | |
| 424 | 435 | blob_appendf(pPath, "/%s", zUtf8); |
| 425 | 436 | fossil_mbcs_free(zUtf8); |
| 426 | 437 | zPath = blob_str(pPath); |
| 427 | 438 | if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ |
| 428 | 439 | /* do nothing */ |
| @@ -435,11 +446,11 @@ | ||
| 435 | 446 | db_step(&ins); |
| 436 | 447 | db_reset(&ins); |
| 437 | 448 | } |
| 438 | 449 | blob_resize(pPath, origSize); |
| 439 | 450 | } |
| 440 | - closedir(d); | |
| 451 | + _wclosedir(d); | |
| 441 | 452 | } |
| 442 | 453 | fossil_mbcs_free(zMbcs); |
| 443 | 454 | |
| 444 | 455 | depth--; |
| 445 | 456 | if( depth==0 ){ |
| 446 | 457 | |
| 447 | 458 | ADDED test/世界/界世.txt |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -25,10 +25,21 @@ | |
| 25 | #include "dirent.h" |
| 26 | #else |
| 27 | #include <dirent.h> |
| 28 | #endif |
| 29 | |
| 30 | /* |
| 31 | ** The input is guaranteed to be a 40-character well-formed UUID. |
| 32 | ** Find its rid. |
| 33 | */ |
| 34 | int fast_uuid_to_rid(const char *zUuid){ |
| @@ -381,18 +392,18 @@ | |
| 381 | ** Any files or directories that match the glob pattern pIgnore are |
| 382 | ** excluded from the scan. Name matching occurs after the first |
| 383 | ** nPrefix characters are elided from the filename. |
| 384 | */ |
| 385 | void vfile_scan(Blob *pPath, int nPrefix, int allFlag, Glob *pIgnore){ |
| 386 | DIR *d; |
| 387 | int origSize; |
| 388 | const char *zDir; |
| 389 | struct dirent *pEntry; |
| 390 | int skipAll = 0; |
| 391 | static Stmt ins; |
| 392 | static int depth = 0; |
| 393 | char *zMbcs; |
| 394 | |
| 395 | origSize = blob_size(pPath); |
| 396 | if( pIgnore ){ |
| 397 | blob_appendf(pPath, "/"); |
| 398 | if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| @@ -407,22 +418,22 @@ | |
| 407 | ); |
| 408 | } |
| 409 | depth++; |
| 410 | |
| 411 | zDir = blob_str(pPath); |
| 412 | zMbcs = fossil_utf8_to_mbcs(zDir); |
| 413 | d = opendir(zMbcs); |
| 414 | if( d ){ |
| 415 | while( (pEntry=readdir(d))!=0 ){ |
| 416 | char *zPath; |
| 417 | char *zUtf8; |
| 418 | if( pEntry->d_name[0]=='.' ){ |
| 419 | if( !allFlag ) continue; |
| 420 | if( pEntry->d_name[1]==0 ) continue; |
| 421 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; |
| 422 | } |
| 423 | zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name); |
| 424 | blob_appendf(pPath, "/%s", zUtf8); |
| 425 | fossil_mbcs_free(zUtf8); |
| 426 | zPath = blob_str(pPath); |
| 427 | if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ |
| 428 | /* do nothing */ |
| @@ -435,11 +446,11 @@ | |
| 435 | db_step(&ins); |
| 436 | db_reset(&ins); |
| 437 | } |
| 438 | blob_resize(pPath, origSize); |
| 439 | } |
| 440 | closedir(d); |
| 441 | } |
| 442 | fossil_mbcs_free(zMbcs); |
| 443 | |
| 444 | depth--; |
| 445 | if( depth==0 ){ |
| 446 | |
| 447 | DDED test/世界/界世.txt |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -25,10 +25,21 @@ | |
| 25 | #include "dirent.h" |
| 26 | #else |
| 27 | #include <dirent.h> |
| 28 | #endif |
| 29 | |
| 30 | #if !defined(_WIN32) |
| 31 | # define fossil_unicode_to_utf8 fossil_mbcs_to_utf8 |
| 32 | # define fossil_utf8_to_unicode fossil_utf8_to_mbcs |
| 33 | # define wchar_t char |
| 34 | # define _WDIR DIR |
| 35 | # define _wdirent dirent |
| 36 | # define _wopendir opendir |
| 37 | # define _wreaddir readdir |
| 38 | # define _wclosedir closedir |
| 39 | #endif |
| 40 | |
| 41 | /* |
| 42 | ** The input is guaranteed to be a 40-character well-formed UUID. |
| 43 | ** Find its rid. |
| 44 | */ |
| 45 | int fast_uuid_to_rid(const char *zUuid){ |
| @@ -381,18 +392,18 @@ | |
| 392 | ** Any files or directories that match the glob pattern pIgnore are |
| 393 | ** excluded from the scan. Name matching occurs after the first |
| 394 | ** nPrefix characters are elided from the filename. |
| 395 | */ |
| 396 | void vfile_scan(Blob *pPath, int nPrefix, int allFlag, Glob *pIgnore){ |
| 397 | _WDIR *d; |
| 398 | int origSize; |
| 399 | const char *zDir; |
| 400 | struct _wdirent *pEntry; |
| 401 | int skipAll = 0; |
| 402 | static Stmt ins; |
| 403 | static int depth = 0; |
| 404 | wchar_t *zMbcs; |
| 405 | |
| 406 | origSize = blob_size(pPath); |
| 407 | if( pIgnore ){ |
| 408 | blob_appendf(pPath, "/"); |
| 409 | if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| @@ -407,22 +418,22 @@ | |
| 418 | ); |
| 419 | } |
| 420 | depth++; |
| 421 | |
| 422 | zDir = blob_str(pPath); |
| 423 | zMbcs = fossil_utf8_to_unicode(zDir); |
| 424 | d = _wopendir(zMbcs); |
| 425 | if( d ){ |
| 426 | while( (pEntry=_wreaddir(d))!=0 ){ |
| 427 | char *zPath; |
| 428 | char *zUtf8; |
| 429 | if( pEntry->d_name[0]==L'.' ){ |
| 430 | if( !allFlag ) continue; |
| 431 | if( pEntry->d_name[1]==0 ) continue; |
| 432 | if( pEntry->d_name[1]==L'.' && pEntry->d_name[2]==0 ) continue; |
| 433 | } |
| 434 | zUtf8 = fossil_unicode_to_utf8(pEntry->d_name); |
| 435 | blob_appendf(pPath, "/%s", zUtf8); |
| 436 | fossil_mbcs_free(zUtf8); |
| 437 | zPath = blob_str(pPath); |
| 438 | if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ |
| 439 | /* do nothing */ |
| @@ -435,11 +446,11 @@ | |
| 446 | db_step(&ins); |
| 447 | db_reset(&ins); |
| 448 | } |
| 449 | blob_resize(pPath, origSize); |
| 450 | } |
| 451 | _wclosedir(d); |
| 452 | } |
| 453 | fossil_mbcs_free(zMbcs); |
| 454 | |
| 455 | depth--; |
| 456 | if( depth==0 ){ |
| 457 | |
| 458 | DDED test/世界/界世.txt |
+1
| --- a/test/世界/界世.txt | ||
| +++ b/test/世界/界世.txt | ||
| @@ -0,0 +1 @@ | ||
| 1 | +Just some text |
| --- a/test/世界/界世.txt | |
| +++ b/test/世界/界世.txt | |
| @@ -0,0 +1 @@ | |
| --- a/test/世界/界世.txt | |
| +++ b/test/世界/界世.txt | |
| @@ -0,0 +1 @@ | |
| 1 | Just some text |