Fossil SCM

Internationalize the opendir() function calls. Ticket [49db5c3993bef2].

drh 2011-05-27 12:56 trunk
Commit e05fea385228ec82525134121a52c1732758bdda
2 files changed +8 -2 +8 -2
+8 -2
--- src/rebuild.c
+++ src/rebuild.c
@@ -775,21 +775,26 @@
775775
void recon_read_dir(char *zPath){
776776
DIR *d;
777777
struct dirent *pEntry;
778778
Blob aContent; /* content of the just read artifact */
779779
static int nFileRead = 0;
780
+ char *zMbcsPath;
781
+ char *zUtf8Name;
780782
781
- d = opendir(zPath);
783
+ zMbcsPath = fossil_utf8_to_mbcs(zPath);
784
+ d = opendir(zMbcsPath);
782785
if( d ){
783786
while( (pEntry=readdir(d))!=0 ){
784787
Blob path;
785788
char *zSubpath;
786789
787790
if( pEntry->d_name[0]=='.' ){
788791
continue;
789792
}
790
- zSubpath = mprintf("%s/%s",zPath,pEntry->d_name);
793
+ zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name);
794
+ zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
795
+ fossil_mbcs_free(zUtf8Name);
791796
if( file_isdir(zSubpath)==1 ){
792797
recon_read_dir(zSubpath);
793798
}
794799
blob_init(&path, 0, 0);
795800
blob_appendf(&path, "%s", zSubpath);
@@ -807,10 +812,11 @@
807812
closedir(d);
808813
}else {
809814
fossil_panic("encountered error %d while trying to open \"%s\".",
810815
errno, g.argv[3]);
811816
}
817
+ fossil_mbcs_free(zMbcsPath);
812818
}
813819
814820
/*
815821
** COMMAND: reconstruct
816822
**
817823
--- src/rebuild.c
+++ src/rebuild.c
@@ -775,21 +775,26 @@
775 void recon_read_dir(char *zPath){
776 DIR *d;
777 struct dirent *pEntry;
778 Blob aContent; /* content of the just read artifact */
779 static int nFileRead = 0;
 
 
780
781 d = opendir(zPath);
 
782 if( d ){
783 while( (pEntry=readdir(d))!=0 ){
784 Blob path;
785 char *zSubpath;
786
787 if( pEntry->d_name[0]=='.' ){
788 continue;
789 }
790 zSubpath = mprintf("%s/%s",zPath,pEntry->d_name);
 
 
791 if( file_isdir(zSubpath)==1 ){
792 recon_read_dir(zSubpath);
793 }
794 blob_init(&path, 0, 0);
795 blob_appendf(&path, "%s", zSubpath);
@@ -807,10 +812,11 @@
807 closedir(d);
808 }else {
809 fossil_panic("encountered error %d while trying to open \"%s\".",
810 errno, g.argv[3]);
811 }
 
812 }
813
814 /*
815 ** COMMAND: reconstruct
816 **
817
--- src/rebuild.c
+++ src/rebuild.c
@@ -775,21 +775,26 @@
775 void recon_read_dir(char *zPath){
776 DIR *d;
777 struct dirent *pEntry;
778 Blob aContent; /* content of the just read artifact */
779 static int nFileRead = 0;
780 char *zMbcsPath;
781 char *zUtf8Name;
782
783 zMbcsPath = fossil_utf8_to_mbcs(zPath);
784 d = opendir(zMbcsPath);
785 if( d ){
786 while( (pEntry=readdir(d))!=0 ){
787 Blob path;
788 char *zSubpath;
789
790 if( pEntry->d_name[0]=='.' ){
791 continue;
792 }
793 zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name);
794 zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
795 fossil_mbcs_free(zUtf8Name);
796 if( file_isdir(zSubpath)==1 ){
797 recon_read_dir(zSubpath);
798 }
799 blob_init(&path, 0, 0);
800 blob_appendf(&path, "%s", zSubpath);
@@ -807,10 +812,11 @@
812 closedir(d);
813 }else {
814 fossil_panic("encountered error %d while trying to open \"%s\".",
815 errno, g.argv[3]);
816 }
817 fossil_mbcs_free(zMbcsPath);
818 }
819
820 /*
821 ** COMMAND: reconstruct
822 **
823
+8 -2
--- src/vfile.c
+++ src/vfile.c
@@ -335,10 +335,11 @@
335335
const char *zDir;
336336
struct dirent *pEntry;
337337
int skipAll = 0;
338338
static Stmt ins;
339339
static int depth = 0;
340
+ char *zMbcs;
340341
341342
origSize = blob_size(pPath);
342343
if( pIgnore ){
343344
blob_appendf(pPath, "/");
344345
if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
@@ -353,20 +354,24 @@
353354
);
354355
}
355356
depth++;
356357
357358
zDir = blob_str(pPath);
358
- d = opendir(zDir);
359
+ zMbcs = fossil_utf8_to_mbcs(zDir);
360
+ d = opendir(zMbcs);
359361
if( d ){
360362
while( (pEntry=readdir(d))!=0 ){
361363
char *zPath;
364
+ char *zUtf8;
362365
if( pEntry->d_name[0]=='.' ){
363366
if( !allFlag ) continue;
364367
if( pEntry->d_name[1]==0 ) continue;
365368
if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
366369
}
367
- blob_appendf(pPath, "/%s", pEntry->d_name);
370
+ zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name);
371
+ blob_appendf(pPath, "/%s", zUtf8);
372
+ fossil_mbcs_free(zUtf8);
368373
zPath = blob_str(pPath);
369374
if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
370375
/* do nothing */
371376
}else if( file_isdir(zPath)==1 ){
372377
if( !vfile_top_of_checkout(zPath) ){
@@ -379,10 +384,11 @@
379384
}
380385
blob_resize(pPath, origSize);
381386
}
382387
closedir(d);
383388
}
389
+ fossil_mbcs_free(zMbcs);
384390
385391
depth--;
386392
if( depth==0 ){
387393
db_finalize(&ins);
388394
}
389395
--- src/vfile.c
+++ src/vfile.c
@@ -335,10 +335,11 @@
335 const char *zDir;
336 struct dirent *pEntry;
337 int skipAll = 0;
338 static Stmt ins;
339 static int depth = 0;
 
340
341 origSize = blob_size(pPath);
342 if( pIgnore ){
343 blob_appendf(pPath, "/");
344 if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
@@ -353,20 +354,24 @@
353 );
354 }
355 depth++;
356
357 zDir = blob_str(pPath);
358 d = opendir(zDir);
 
359 if( d ){
360 while( (pEntry=readdir(d))!=0 ){
361 char *zPath;
 
362 if( pEntry->d_name[0]=='.' ){
363 if( !allFlag ) continue;
364 if( pEntry->d_name[1]==0 ) continue;
365 if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
366 }
367 blob_appendf(pPath, "/%s", pEntry->d_name);
 
 
368 zPath = blob_str(pPath);
369 if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
370 /* do nothing */
371 }else if( file_isdir(zPath)==1 ){
372 if( !vfile_top_of_checkout(zPath) ){
@@ -379,10 +384,11 @@
379 }
380 blob_resize(pPath, origSize);
381 }
382 closedir(d);
383 }
 
384
385 depth--;
386 if( depth==0 ){
387 db_finalize(&ins);
388 }
389
--- src/vfile.c
+++ src/vfile.c
@@ -335,10 +335,11 @@
335 const char *zDir;
336 struct dirent *pEntry;
337 int skipAll = 0;
338 static Stmt ins;
339 static int depth = 0;
340 char *zMbcs;
341
342 origSize = blob_size(pPath);
343 if( pIgnore ){
344 blob_appendf(pPath, "/");
345 if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1;
@@ -353,20 +354,24 @@
354 );
355 }
356 depth++;
357
358 zDir = blob_str(pPath);
359 zMbcs = fossil_utf8_to_mbcs(zDir);
360 d = opendir(zMbcs);
361 if( d ){
362 while( (pEntry=readdir(d))!=0 ){
363 char *zPath;
364 char *zUtf8;
365 if( pEntry->d_name[0]=='.' ){
366 if( !allFlag ) continue;
367 if( pEntry->d_name[1]==0 ) continue;
368 if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
369 }
370 zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name);
371 blob_appendf(pPath, "/%s", zUtf8);
372 fossil_mbcs_free(zUtf8);
373 zPath = blob_str(pPath);
374 if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
375 /* do nothing */
376 }else if( file_isdir(zPath)==1 ){
377 if( !vfile_top_of_checkout(zPath) ){
@@ -379,10 +384,11 @@
384 }
385 blob_resize(pPath, origSize);
386 }
387 closedir(d);
388 }
389 fossil_mbcs_free(zMbcs);
390
391 depth--;
392 if( depth==0 ){
393 db_finalize(&ins);
394 }
395

Keyboard Shortcuts

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