Fossil SCM

merge unicode branch

jan.nijtmans 2012-08-24 14:50 eclipse-project merge
Commit b4ea94b488dcf04760a22ec56f1af0a3070d35f8
+3 -2
--- src/file.c
+++ src/file.c
@@ -422,12 +422,12 @@
422422
file_delete(zName);
423423
}
424424
if( rc!=1 ){
425425
#if defined(_WIN32)
426426
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);
429429
fossil_mbcs_free(zMbcs);
430430
return rc;
431431
#else
432432
return mkdir(zName, 0755);
433433
#endif
@@ -1032,10 +1032,11 @@
10321032
/*
10331033
** Translate Unicode to UTF8. Return a pointer to the translated text.
10341034
** Call fossil_mbcs_free() to deallocate any memory used to store the
10351035
** returned pointer when done.
10361036
*/
1037
+#undef fossil_unicode_to_utf8
10371038
char *fossil_unicode_to_utf8(const void *zUnicode){
10381039
#ifdef _WIN32
10391040
int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0);
10401041
char *zUtf = sqlite3_malloc( nByte );
10411042
if( zUtf==0 ){
10421043
--- 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 @@
422422
file_delete(zName);
423423
}
424424
if( rc!=1 ){
425425
#if defined(_WIN32)
426426
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);
429429
fossil_mbcs_free(zMbcs);
430430
return rc;
431431
#else
432432
return mkdir(zName, 0755);
433433
#endif
@@ -1032,10 +1032,11 @@
10321032
/*
10331033
** Translate Unicode to UTF8. Return a pointer to the translated text.
10341034
** Call fossil_mbcs_free() to deallocate any memory used to store the
10351035
** returned pointer when done.
10361036
*/
1037
+#undef fossil_unicode_to_utf8
10371038
char *fossil_unicode_to_utf8(const void *zUnicode){
10381039
#ifdef _WIN32
10391040
int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0);
10401041
char *zUtf = sqlite3_malloc( nByte );
10411042
if( zUtf==0 ){
10421043
--- 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 @@
3636
#endif
3737
#ifdef FOSSIL_ENABLE_TCL
3838
#include "tcl.h"
3939
#endif
4040
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
+
4147
/*
4248
** Number of elements in an array
4349
*/
4450
#define count(X) (sizeof(X)/sizeof(X[0]))
4551
@@ -352,15 +358,11 @@
352358
char const * zFileName; /* input file name */
353359
FILE * zInFile; /* input FILE */
354360
355361
g.argc = argc;
356362
g.argv = argv;
357
-#if defined(_WIN32) && defined(UNICODE)
358363
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
362364
for(i=1; i<g.argc-1; i++){
363365
z = g.argv[i];
364366
if( z[0]!='-' ) continue;
365367
z++;
366368
if( z[0]=='-' ) z++;
@@ -414,15 +416,11 @@
414416
}
415417
416418
/*
417419
** This procedure runs first.
418420
*/
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)
424422
{
425423
const char *zCmdName = "unknown";
426424
int idx;
427425
int rc;
428426
429427
--- 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 @@
3636
#endif
3737
#ifdef FOSSIL_ENABLE_TCL
3838
#include "tcl.h"
3939
#endif
4040
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
+
4147
/*
4248
** Number of elements in an array
4349
*/
4450
#define count(X) (sizeof(X)/sizeof(X[0]))
4551
@@ -352,15 +358,11 @@
352358
char const * zFileName; /* input file name */
353359
FILE * zInFile; /* input FILE */
354360
355361
g.argc = argc;
356362
g.argv = argv;
357
-#if defined(_WIN32) && defined(UNICODE)
358363
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
362364
for(i=1; i<g.argc-1; i++){
363365
z = g.argv[i];
364366
if( z[0]!='-' ) continue;
365367
z++;
366368
if( z[0]=='-' ) z++;
@@ -414,15 +416,11 @@
414416
}
415417
416418
/*
417419
** This procedure runs first.
418420
*/
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)
424422
{
425423
const char *zCmdName = "unknown";
426424
int idx;
427425
int rc;
428426
429427
--- 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 @@
2121
#include "rebuild.h"
2222
#include <assert.h>
2323
#include <dirent.h>
2424
#include <errno.h>
2525
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
+
2637
/*
2738
** Make changes to the stable part of the schema (the part that is not
2839
** simply deleted and reconstructed on a rebuild) to bring the schema
2940
** up to the latest.
3041
*/
@@ -818,28 +829,28 @@
818829
/*
819830
** Recursively read all files from the directory zPath and install
820831
** every file read as a new artifact in the repository.
821832
*/
822833
void recon_read_dir(char *zPath){
823
- DIR *d;
824
- struct dirent *pEntry;
834
+ _WDIR *d;
835
+ struct _wdirent *pEntry;
825836
Blob aContent; /* content of the just read artifact */
826837
static int nFileRead = 0;
827
- char *zMbcsPath;
838
+ wchar_t *zMbcsPath;
828839
char *zUtf8Name;
829840
830
- zMbcsPath = fossil_utf8_to_mbcs(zPath);
831
- d = opendir(zMbcsPath);
841
+ zMbcsPath = fossil_utf8_to_unicode(zPath);
842
+ d = _wopendir(zMbcsPath);
832843
if( d ){
833
- while( (pEntry=readdir(d))!=0 ){
844
+ while( (pEntry=_wreaddir(d))!=0 ){
834845
Blob path;
835846
char *zSubpath;
836847
837
- if( pEntry->d_name[0]=='.' ){
848
+ if( pEntry->d_name[0]==L'.' ){
838849
continue;
839850
}
840
- zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name);
851
+ zUtf8Name = fossil_unicode_to_utf8(pEntry->d_name);
841852
zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
842853
fossil_mbcs_free(zUtf8Name);
843854
if( file_isdir(zSubpath)==1 ){
844855
recon_read_dir(zSubpath);
845856
}
@@ -854,11 +865,11 @@
854865
blob_reset(&aContent);
855866
free(zSubpath);
856867
fossil_print("\r%d", ++nFileRead);
857868
fflush(stdout);
858869
}
859
- closedir(d);
870
+ _wclosedir(d);
860871
}else {
861872
fossil_panic("encountered error %d while trying to open \"%s\".",
862873
errno, g.argv[3]);
863874
}
864875
fossil_mbcs_free(zMbcsPath);
865876
--- 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 @@
2121
#include "rebuild.h"
2222
#include <assert.h>
2323
#include <dirent.h>
2424
#include <errno.h>
2525
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
+
2637
/*
2738
** Make changes to the stable part of the schema (the part that is not
2839
** simply deleted and reconstructed on a rebuild) to bring the schema
2940
** up to the latest.
3041
*/
@@ -818,28 +829,28 @@
818829
/*
819830
** Recursively read all files from the directory zPath and install
820831
** every file read as a new artifact in the repository.
821832
*/
822833
void recon_read_dir(char *zPath){
823
- DIR *d;
824
- struct dirent *pEntry;
834
+ _WDIR *d;
835
+ struct _wdirent *pEntry;
825836
Blob aContent; /* content of the just read artifact */
826837
static int nFileRead = 0;
827
- char *zMbcsPath;
838
+ wchar_t *zMbcsPath;
828839
char *zUtf8Name;
829840
830
- zMbcsPath = fossil_utf8_to_mbcs(zPath);
831
- d = opendir(zMbcsPath);
841
+ zMbcsPath = fossil_utf8_to_unicode(zPath);
842
+ d = _wopendir(zMbcsPath);
832843
if( d ){
833
- while( (pEntry=readdir(d))!=0 ){
844
+ while( (pEntry=_wreaddir(d))!=0 ){
834845
Blob path;
835846
char *zSubpath;
836847
837
- if( pEntry->d_name[0]=='.' ){
848
+ if( pEntry->d_name[0]==L'.' ){
838849
continue;
839850
}
840
- zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name);
851
+ zUtf8Name = fossil_unicode_to_utf8(pEntry->d_name);
841852
zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
842853
fossil_mbcs_free(zUtf8Name);
843854
if( file_isdir(zSubpath)==1 ){
844855
recon_read_dir(zSubpath);
845856
}
@@ -854,11 +865,11 @@
854865
blob_reset(&aContent);
855866
free(zSubpath);
856867
fossil_print("\r%d", ++nFileRead);
857868
fflush(stdout);
858869
}
859
- closedir(d);
870
+ _wclosedir(d);
860871
}else {
861872
fossil_panic("encountered error %d while trying to open \"%s\".",
862873
errno, g.argv[3]);
863874
}
864875
fossil_mbcs_free(zMbcsPath);
865876
--- 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 @@
2525
#include "dirent.h"
2626
#else
2727
#include <dirent.h>
2828
#endif
2929
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
+
3041
/*
3142
** The input is guaranteed to be a 40-character well-formed UUID.
3243
** Find its rid.
3344
*/
3445
int fast_uuid_to_rid(const char *zUuid){
@@ -381,18 +392,18 @@
381392
** Any files or directories that match the glob pattern pIgnore are
382393
** excluded from the scan. Name matching occurs after the first
383394
** nPrefix characters are elided from the filename.
384395
*/
385396
void vfile_scan(Blob *pPath, int nPrefix, int allFlag, Glob *pIgnore){
386
- DIR *d;
397
+ _WDIR *d;
387398
int origSize;
388399
const char *zDir;
389
- struct dirent *pEntry;
400
+ struct _wdirent *pEntry;
390401
int skipAll = 0;
391402
static Stmt ins;
392403
static int depth = 0;
393
- char *zMbcs;
404
+ wchar_t *zMbcs;
394405
395406
origSize = blob_size(pPath);
396407
if( pIgnore ){
397408
blob_appendf(pPath, "/");
398409
if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
@@ -407,22 +418,22 @@
407418
);
408419
}
409420
depth++;
410421
411422
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);
414425
if( d ){
415
- while( (pEntry=readdir(d))!=0 ){
426
+ while( (pEntry=_wreaddir(d))!=0 ){
416427
char *zPath;
417428
char *zUtf8;
418
- if( pEntry->d_name[0]=='.' ){
429
+ if( pEntry->d_name[0]==L'.' ){
419430
if( !allFlag ) continue;
420431
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;
422433
}
423
- zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name);
434
+ zUtf8 = fossil_unicode_to_utf8(pEntry->d_name);
424435
blob_appendf(pPath, "/%s", zUtf8);
425436
fossil_mbcs_free(zUtf8);
426437
zPath = blob_str(pPath);
427438
if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
428439
/* do nothing */
@@ -435,11 +446,11 @@
435446
db_step(&ins);
436447
db_reset(&ins);
437448
}
438449
blob_resize(pPath, origSize);
439450
}
440
- closedir(d);
451
+ _wclosedir(d);
441452
}
442453
fossil_mbcs_free(zMbcs);
443454
444455
depth--;
445456
if( depth==0 ){
446457
447458
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 @@
2525
#include "dirent.h"
2626
#else
2727
#include <dirent.h>
2828
#endif
2929
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
+
3041
/*
3142
** The input is guaranteed to be a 40-character well-formed UUID.
3243
** Find its rid.
3344
*/
3445
int fast_uuid_to_rid(const char *zUuid){
@@ -381,18 +392,18 @@
381392
** Any files or directories that match the glob pattern pIgnore are
382393
** excluded from the scan. Name matching occurs after the first
383394
** nPrefix characters are elided from the filename.
384395
*/
385396
void vfile_scan(Blob *pPath, int nPrefix, int allFlag, Glob *pIgnore){
386
- DIR *d;
397
+ _WDIR *d;
387398
int origSize;
388399
const char *zDir;
389
- struct dirent *pEntry;
400
+ struct _wdirent *pEntry;
390401
int skipAll = 0;
391402
static Stmt ins;
392403
static int depth = 0;
393
- char *zMbcs;
404
+ wchar_t *zMbcs;
394405
395406
origSize = blob_size(pPath);
396407
if( pIgnore ){
397408
blob_appendf(pPath, "/");
398409
if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
@@ -407,22 +418,22 @@
407418
);
408419
}
409420
depth++;
410421
411422
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);
414425
if( d ){
415
- while( (pEntry=readdir(d))!=0 ){
426
+ while( (pEntry=_wreaddir(d))!=0 ){
416427
char *zPath;
417428
char *zUtf8;
418
- if( pEntry->d_name[0]=='.' ){
429
+ if( pEntry->d_name[0]==L'.' ){
419430
if( !allFlag ) continue;
420431
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;
422433
}
423
- zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name);
434
+ zUtf8 = fossil_unicode_to_utf8(pEntry->d_name);
424435
blob_appendf(pPath, "/%s", zUtf8);
425436
fossil_mbcs_free(zUtf8);
426437
zPath = blob_str(pPath);
427438
if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
428439
/* do nothing */
@@ -435,11 +446,11 @@
435446
db_step(&ins);
436447
db_reset(&ins);
437448
}
438449
blob_resize(pPath, origSize);
439450
}
440
- closedir(d);
451
+ _wclosedir(d);
441452
}
442453
fossil_mbcs_free(zMbcs);
443454
444455
depth--;
445456
if( depth==0 ){
446457
447458
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
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button