Fossil SCM

Improvements to error handling and code formatting.

mistachkin 2014-06-16 20:28 UTC autoadjust
Commit 9270ae240d1730e38f609a5cbc6f3cd6c357824a
2 files changed +10 -6 +1 -1
+10 -6
--- src/comformat.c
+++ src/comformat.c
@@ -42,20 +42,24 @@
4242
int doIndent = 0;
4343
char *zBuf;
4444
char zBuffer[400];
4545
int lineCnt = 0;
4646
#if defined(_WIN32)
47
- if ( lineLength<0 ){
47
+ if( lineLength<0 ){
4848
CONSOLE_SCREEN_BUFFER_INFO csbi;
49
- GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
50
- tlen = csbi.srWindow.Right - csbi.srWindow.Left - indent + 1;
49
+ memset(&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));
50
+ if( GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) ){
51
+ tlen = csbi.srWindow.Right - csbi.srWindow.Left - indent + 1;
52
+ }
5153
}
5254
#elif defined(TIOCGWINSZ)
53
- if ( lineLength<0 ){
55
+ if( lineLength<0 ){
5456
struct winsize w;
55
- ioctl(0, TIOCGWINSZ, &w);
56
- tlen = w.ws_col - indent;
57
+ memset(&w, 0, sizeof(struct winsize));
58
+ if( ioctl(0, TIOCGWINSZ, &w)!=-1 ){
59
+ tlen = w.ws_col - indent;
60
+ }
5761
}
5862
#endif
5963
if( zText==0 ) zText = "(NULL)";
6064
if( tlen<=0 ){
6165
tlen = strlen(zText);
6266
--- src/comformat.c
+++ src/comformat.c
@@ -42,20 +42,24 @@
42 int doIndent = 0;
43 char *zBuf;
44 char zBuffer[400];
45 int lineCnt = 0;
46 #if defined(_WIN32)
47 if ( lineLength<0 ){
48 CONSOLE_SCREEN_BUFFER_INFO csbi;
49 GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
50 tlen = csbi.srWindow.Right - csbi.srWindow.Left - indent + 1;
 
 
51 }
52 #elif defined(TIOCGWINSZ)
53 if ( lineLength<0 ){
54 struct winsize w;
55 ioctl(0, TIOCGWINSZ, &w);
56 tlen = w.ws_col - indent;
 
 
57 }
58 #endif
59 if( zText==0 ) zText = "(NULL)";
60 if( tlen<=0 ){
61 tlen = strlen(zText);
62
--- src/comformat.c
+++ src/comformat.c
@@ -42,20 +42,24 @@
42 int doIndent = 0;
43 char *zBuf;
44 char zBuffer[400];
45 int lineCnt = 0;
46 #if defined(_WIN32)
47 if( lineLength<0 ){
48 CONSOLE_SCREEN_BUFFER_INFO csbi;
49 memset(&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));
50 if( GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) ){
51 tlen = csbi.srWindow.Right - csbi.srWindow.Left - indent + 1;
52 }
53 }
54 #elif defined(TIOCGWINSZ)
55 if( lineLength<0 ){
56 struct winsize w;
57 memset(&w, 0, sizeof(struct winsize));
58 if( ioctl(0, TIOCGWINSZ, &w)!=-1 ){
59 tlen = w.ws_col - indent;
60 }
61 }
62 #endif
63 if( zText==0 ) zText = "(NULL)";
64 if( tlen<=0 ){
65 tlen = strlen(zText);
66
+1 -1
--- src/stash.c
+++ src/stash.c
@@ -525,11 +525,11 @@
525525
width = atoi(zWidth);
526526
if( (width!=0) && (width<=46) ){
527527
fossil_fatal("-W|--width value must be >46 or 0");
528528
}
529529
}else{
530
- width = -1;
530
+ width = -1;
531531
}
532532
if( !verboseFlag ){
533533
verboseFlag = find_option("detail","l",0)!=0; /* deprecated */
534534
}
535535
verify_all_options();
536536
--- src/stash.c
+++ src/stash.c
@@ -525,11 +525,11 @@
525 width = atoi(zWidth);
526 if( (width!=0) && (width<=46) ){
527 fossil_fatal("-W|--width value must be >46 or 0");
528 }
529 }else{
530 width = -1;
531 }
532 if( !verboseFlag ){
533 verboseFlag = find_option("detail","l",0)!=0; /* deprecated */
534 }
535 verify_all_options();
536
--- src/stash.c
+++ src/stash.c
@@ -525,11 +525,11 @@
525 width = atoi(zWidth);
526 if( (width!=0) && (width<=46) ){
527 fossil_fatal("-W|--width value must be >46 or 0");
528 }
529 }else{
530 width = -1;
531 }
532 if( !verboseFlag ){
533 verboseFlag = find_option("detail","l",0)!=0; /* deprecated */
534 }
535 verify_all_options();
536

Keyboard Shortcuts

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