Fossil SCM
Make arrangements for the output of "fossil status" to go through the UTF8 to MBCS translation. Ticket [3f0216560679fd]
Commit
02a6aa2d5e3ea14de47debbdb93ca8d2fb5c113e
Parent
a2e1c483734a293…
1 file changed
+3
-5
+3
-5
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -711,16 +711,15 @@ | ||
| 711 | 711 | ** |
| 712 | 712 | ** Return the number of bytes written. |
| 713 | 713 | */ |
| 714 | 714 | int blob_write_to_file(Blob *pBlob, const char *zFilename){ |
| 715 | 715 | FILE *out; |
| 716 | - int needToClose; | |
| 717 | 716 | int wrote; |
| 718 | 717 | |
| 719 | 718 | if( zFilename[0]==0 || (zFilename[0]=='-' && zFilename[1]==0) ){ |
| 720 | - out = stdout; | |
| 721 | - needToClose = 0; | |
| 719 | + fossil_puts(blob_str(pBlob), 0); | |
| 720 | + return blob_size(pBlob); | |
| 722 | 721 | }else{ |
| 723 | 722 | int i, nName; |
| 724 | 723 | char *zName, zBuf[1000]; |
| 725 | 724 | |
| 726 | 725 | nName = strlen(zFilename); |
| @@ -755,16 +754,15 @@ | ||
| 755 | 754 | out = fossil_fopen(zName, "wb"); |
| 756 | 755 | if( out==0 ){ |
| 757 | 756 | fossil_fatal_recursive("unable to open file \"%s\" for writing", zName); |
| 758 | 757 | return 0; |
| 759 | 758 | } |
| 760 | - needToClose = 1; | |
| 761 | 759 | if( zName!=zBuf ) free(zName); |
| 762 | 760 | } |
| 763 | 761 | blob_is_init(pBlob); |
| 764 | 762 | wrote = fwrite(blob_buffer(pBlob), 1, blob_size(pBlob), out); |
| 765 | - if( needToClose ) fclose(out); | |
| 763 | + fclose(out); | |
| 766 | 764 | if( wrote!=blob_size(pBlob) && out!=stdout ){ |
| 767 | 765 | fossil_fatal_recursive("short write: %d of %d bytes to %s", wrote, |
| 768 | 766 | blob_size(pBlob), zFilename); |
| 769 | 767 | } |
| 770 | 768 | return wrote; |
| 771 | 769 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -711,16 +711,15 @@ | |
| 711 | ** |
| 712 | ** Return the number of bytes written. |
| 713 | */ |
| 714 | int blob_write_to_file(Blob *pBlob, const char *zFilename){ |
| 715 | FILE *out; |
| 716 | int needToClose; |
| 717 | int wrote; |
| 718 | |
| 719 | if( zFilename[0]==0 || (zFilename[0]=='-' && zFilename[1]==0) ){ |
| 720 | out = stdout; |
| 721 | needToClose = 0; |
| 722 | }else{ |
| 723 | int i, nName; |
| 724 | char *zName, zBuf[1000]; |
| 725 | |
| 726 | nName = strlen(zFilename); |
| @@ -755,16 +754,15 @@ | |
| 755 | out = fossil_fopen(zName, "wb"); |
| 756 | if( out==0 ){ |
| 757 | fossil_fatal_recursive("unable to open file \"%s\" for writing", zName); |
| 758 | return 0; |
| 759 | } |
| 760 | needToClose = 1; |
| 761 | if( zName!=zBuf ) free(zName); |
| 762 | } |
| 763 | blob_is_init(pBlob); |
| 764 | wrote = fwrite(blob_buffer(pBlob), 1, blob_size(pBlob), out); |
| 765 | if( needToClose ) fclose(out); |
| 766 | if( wrote!=blob_size(pBlob) && out!=stdout ){ |
| 767 | fossil_fatal_recursive("short write: %d of %d bytes to %s", wrote, |
| 768 | blob_size(pBlob), zFilename); |
| 769 | } |
| 770 | return wrote; |
| 771 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -711,16 +711,15 @@ | |
| 711 | ** |
| 712 | ** Return the number of bytes written. |
| 713 | */ |
| 714 | int blob_write_to_file(Blob *pBlob, const char *zFilename){ |
| 715 | FILE *out; |
| 716 | int wrote; |
| 717 | |
| 718 | if( zFilename[0]==0 || (zFilename[0]=='-' && zFilename[1]==0) ){ |
| 719 | fossil_puts(blob_str(pBlob), 0); |
| 720 | return blob_size(pBlob); |
| 721 | }else{ |
| 722 | int i, nName; |
| 723 | char *zName, zBuf[1000]; |
| 724 | |
| 725 | nName = strlen(zFilename); |
| @@ -755,16 +754,15 @@ | |
| 754 | out = fossil_fopen(zName, "wb"); |
| 755 | if( out==0 ){ |
| 756 | fossil_fatal_recursive("unable to open file \"%s\" for writing", zName); |
| 757 | return 0; |
| 758 | } |
| 759 | if( zName!=zBuf ) free(zName); |
| 760 | } |
| 761 | blob_is_init(pBlob); |
| 762 | wrote = fwrite(blob_buffer(pBlob), 1, blob_size(pBlob), out); |
| 763 | fclose(out); |
| 764 | if( wrote!=blob_size(pBlob) && out!=stdout ){ |
| 765 | fossil_fatal_recursive("short write: %d of %d bytes to %s", wrote, |
| 766 | blob_size(pBlob), zFilename); |
| 767 | } |
| 768 | return wrote; |
| 769 |