Fossil SCM
Internationalize the opendir() function calls. Ticket [49db5c3993bef2].
Commit
e05fea385228ec82525134121a52c1732758bdda
Parent
ea2698e9c7de222…
2 files changed
+8
-2
+8
-2
+8
-2
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -775,21 +775,26 @@ | ||
| 775 | 775 | void recon_read_dir(char *zPath){ |
| 776 | 776 | DIR *d; |
| 777 | 777 | struct dirent *pEntry; |
| 778 | 778 | Blob aContent; /* content of the just read artifact */ |
| 779 | 779 | static int nFileRead = 0; |
| 780 | + char *zMbcsPath; | |
| 781 | + char *zUtf8Name; | |
| 780 | 782 | |
| 781 | - d = opendir(zPath); | |
| 783 | + zMbcsPath = fossil_utf8_to_mbcs(zPath); | |
| 784 | + d = opendir(zMbcsPath); | |
| 782 | 785 | if( d ){ |
| 783 | 786 | while( (pEntry=readdir(d))!=0 ){ |
| 784 | 787 | Blob path; |
| 785 | 788 | char *zSubpath; |
| 786 | 789 | |
| 787 | 790 | if( pEntry->d_name[0]=='.' ){ |
| 788 | 791 | continue; |
| 789 | 792 | } |
| 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); | |
| 791 | 796 | if( file_isdir(zSubpath)==1 ){ |
| 792 | 797 | recon_read_dir(zSubpath); |
| 793 | 798 | } |
| 794 | 799 | blob_init(&path, 0, 0); |
| 795 | 800 | blob_appendf(&path, "%s", zSubpath); |
| @@ -807,10 +812,11 @@ | ||
| 807 | 812 | closedir(d); |
| 808 | 813 | }else { |
| 809 | 814 | fossil_panic("encountered error %d while trying to open \"%s\".", |
| 810 | 815 | errno, g.argv[3]); |
| 811 | 816 | } |
| 817 | + fossil_mbcs_free(zMbcsPath); | |
| 812 | 818 | } |
| 813 | 819 | |
| 814 | 820 | /* |
| 815 | 821 | ** COMMAND: reconstruct |
| 816 | 822 | ** |
| 817 | 823 |
| --- 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 @@ | ||
| 335 | 335 | const char *zDir; |
| 336 | 336 | struct dirent *pEntry; |
| 337 | 337 | int skipAll = 0; |
| 338 | 338 | static Stmt ins; |
| 339 | 339 | static int depth = 0; |
| 340 | + char *zMbcs; | |
| 340 | 341 | |
| 341 | 342 | origSize = blob_size(pPath); |
| 342 | 343 | if( pIgnore ){ |
| 343 | 344 | blob_appendf(pPath, "/"); |
| 344 | 345 | if( glob_match(pIgnore, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; |
| @@ -353,20 +354,24 @@ | ||
| 353 | 354 | ); |
| 354 | 355 | } |
| 355 | 356 | depth++; |
| 356 | 357 | |
| 357 | 358 | zDir = blob_str(pPath); |
| 358 | - d = opendir(zDir); | |
| 359 | + zMbcs = fossil_utf8_to_mbcs(zDir); | |
| 360 | + d = opendir(zMbcs); | |
| 359 | 361 | if( d ){ |
| 360 | 362 | while( (pEntry=readdir(d))!=0 ){ |
| 361 | 363 | char *zPath; |
| 364 | + char *zUtf8; | |
| 362 | 365 | if( pEntry->d_name[0]=='.' ){ |
| 363 | 366 | if( !allFlag ) continue; |
| 364 | 367 | if( pEntry->d_name[1]==0 ) continue; |
| 365 | 368 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; |
| 366 | 369 | } |
| 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); | |
| 368 | 373 | zPath = blob_str(pPath); |
| 369 | 374 | if( glob_match(pIgnore, &zPath[nPrefix+1]) ){ |
| 370 | 375 | /* do nothing */ |
| 371 | 376 | }else if( file_isdir(zPath)==1 ){ |
| 372 | 377 | if( !vfile_top_of_checkout(zPath) ){ |
| @@ -379,10 +384,11 @@ | ||
| 379 | 384 | } |
| 380 | 385 | blob_resize(pPath, origSize); |
| 381 | 386 | } |
| 382 | 387 | closedir(d); |
| 383 | 388 | } |
| 389 | + fossil_mbcs_free(zMbcs); | |
| 384 | 390 | |
| 385 | 391 | depth--; |
| 386 | 392 | if( depth==0 ){ |
| 387 | 393 | db_finalize(&ins); |
| 388 | 394 | } |
| 389 | 395 |
| --- 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 |