Fossil SCM

Coding style and consistency improvements.

mistachkin 2016-10-04 23:29 trunk
Commit 824bfe849bcce6e0e769b6a54ff9f402e9cac686
2 files changed +4 -5 +1 -1
+4 -5
--- src/blob.c
+++ src/blob.c
@@ -851,19 +851,18 @@
851851
int blob_write_to_file(Blob *pBlob, const char *zFilename){
852852
FILE *out;
853853
int nWrote;
854854
855855
if( zFilename[0]==0 || (zFilename[0]=='-' && zFilename[1]==0) ){
856
- nWrote = blob_size(pBlob);
856
+ blob_is_init(pBlob);
857857
#if defined(_WIN32)
858
- if( fossil_utf8_to_console(blob_buffer(pBlob), nWrote, 0) >= 0 ){
859
- return nWrote;
860
- }
858
+ nWrote = fossil_utf8_to_console(blob_buffer(pBlob), blob_size(pBlob), 0);
859
+ if( nWrote>=0 ) return nWrote;
861860
fflush(stdout);
862861
_setmode(_fileno(stdout), _O_BINARY);
863862
#endif
864
- fwrite(blob_buffer(pBlob), 1, nWrote, stdout);
863
+ nWrote = fwrite(blob_buffer(pBlob), 1, blob_size(pBlob), stdout);
865864
#if defined(_WIN32)
866865
fflush(stdout);
867866
_setmode(_fileno(stdout), _O_TEXT);
868867
#endif
869868
}else{
870869
--- src/blob.c
+++ src/blob.c
@@ -851,19 +851,18 @@
851 int blob_write_to_file(Blob *pBlob, const char *zFilename){
852 FILE *out;
853 int nWrote;
854
855 if( zFilename[0]==0 || (zFilename[0]=='-' && zFilename[1]==0) ){
856 nWrote = blob_size(pBlob);
857 #if defined(_WIN32)
858 if( fossil_utf8_to_console(blob_buffer(pBlob), nWrote, 0) >= 0 ){
859 return nWrote;
860 }
861 fflush(stdout);
862 _setmode(_fileno(stdout), _O_BINARY);
863 #endif
864 fwrite(blob_buffer(pBlob), 1, nWrote, stdout);
865 #if defined(_WIN32)
866 fflush(stdout);
867 _setmode(_fileno(stdout), _O_TEXT);
868 #endif
869 }else{
870
--- src/blob.c
+++ src/blob.c
@@ -851,19 +851,18 @@
851 int blob_write_to_file(Blob *pBlob, const char *zFilename){
852 FILE *out;
853 int nWrote;
854
855 if( zFilename[0]==0 || (zFilename[0]=='-' && zFilename[1]==0) ){
856 blob_is_init(pBlob);
857 #if defined(_WIN32)
858 nWrote = fossil_utf8_to_console(blob_buffer(pBlob), blob_size(pBlob), 0);
859 if( nWrote>=0 ) return nWrote;
 
860 fflush(stdout);
861 _setmode(_fileno(stdout), _O_BINARY);
862 #endif
863 nWrote = fwrite(blob_buffer(pBlob), 1, blob_size(pBlob), stdout);
864 #if defined(_WIN32)
865 fflush(stdout);
866 _setmode(_fileno(stdout), _O_TEXT);
867 #endif
868 }else{
869
+1 -1
--- src/utf8.c
+++ src/utf8.c
@@ -317,11 +317,11 @@
317317
wchar_t *zUnicode; /* Unicode version of zUtf8 */
318318
DWORD dummy;
319319
Blob blob;
320320
321321
static int istty[2] = { -1, -1 };
322
- if( istty[toStdErr] == -1 ){
322
+ if( istty[toStdErr]==-1 ){
323323
istty[toStdErr] = _isatty(toStdErr + 1) != 0;
324324
}
325325
if( !istty[toStdErr] ){
326326
/* stdout/stderr is not a console. */
327327
return -1;
328328
--- src/utf8.c
+++ src/utf8.c
@@ -317,11 +317,11 @@
317 wchar_t *zUnicode; /* Unicode version of zUtf8 */
318 DWORD dummy;
319 Blob blob;
320
321 static int istty[2] = { -1, -1 };
322 if( istty[toStdErr] == -1 ){
323 istty[toStdErr] = _isatty(toStdErr + 1) != 0;
324 }
325 if( !istty[toStdErr] ){
326 /* stdout/stderr is not a console. */
327 return -1;
328
--- src/utf8.c
+++ src/utf8.c
@@ -317,11 +317,11 @@
317 wchar_t *zUnicode; /* Unicode version of zUtf8 */
318 DWORD dummy;
319 Blob blob;
320
321 static int istty[2] = { -1, -1 };
322 if( istty[toStdErr]==-1 ){
323 istty[toStdErr] = _isatty(toStdErr + 1) != 0;
324 }
325 if( !istty[toStdErr] ){
326 /* stdout/stderr is not a console. */
327 return -1;
328

Keyboard Shortcuts

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