Fossil SCM

Coding style fixes.

florian 2018-11-16 11:26 UTC comment-formatter-utf8
Commit aadbbb38d6cd3e7c12f990e15f5ff9549d4f210b
1 file changed +9 -9
+9 -9
--- src/comformat.c
+++ src/comformat.c
@@ -127,14 +127,14 @@
127127
){
128128
int nextIndex = index + 1;
129129
int fNonASCII=0;
130130
for(;;){
131131
char c = zLine[nextIndex];
132
- if ( (c&0x80)==0x80 ) fNonASCII=1;
132
+ if( (c&0x80)==0x80 ) fNonASCII=1;
133133
if( c==0 || fossil_isspace(c) ){
134
- if ( distUTF8 ){
135
- if ( fNonASCII!=0 ){
134
+ if( distUTF8 ){
135
+ if( fNonASCII!=0 ){
136136
*distUTF8 = strlen_utf8(&zLine[index], nextIndex-index);
137137
}else{
138138
*distUTF8 = nextIndex-index;
139139
}
140140
}
@@ -162,11 +162,11 @@
162162
int lengthUTF8=0; /* Counted UTF-8 sequences. */
163163
int i;
164164
for( i=0; i<lengthBytes; i++ ){
165165
char c = zString[i];
166166
lengthUTF8++;
167
- if ( (c&0xc0)==0xc0 ){ /* Any UTF-8 lead byte 11xxxxxx */
167
+ if( (c&0xc0)==0xc0 ){ /* Any UTF-8 lead byte 11xxxxxx */
168168
int cchUTF8=1; /* Code units consumed. */
169169
int maxUTF8=1; /* Expected sequence length. */
170170
if( (c&0xe0)==0xc0 )maxUTF8=2; /* UTF-8 lead byte 110vvvvv */
171171
else if( (c&0xf0)==0xe0 )maxUTF8=3; /* UTF-8 lead byte 1110vvvv */
172172
else if( (c&0xf8)==0xf0 )maxUTF8=4; /* UTF-8 lead byte 11110vvv */
@@ -228,28 +228,28 @@
228228
if( lineChars<=0 ) return;
229229
#if 0
230230
assert( indent<sizeof(zBuf)-5 ); /* See following comments to explain */
231231
assert( origIndent<sizeof(zBuf)-5 ); /* these limits. */
232232
#endif
233
- if ( indent>sizeof(zBuf)-6 ) /* Limit initial indent to fit output buffer. */
233
+ if( indent>sizeof(zBuf)-6 ) /* Limit initial indent to fit output buffer. */
234234
indent = sizeof(zBuf)-6;
235235
comment_calc_indent(zLine, indent, trimCrLf, trimSpace, &index);
236
- if ( indent>0 ){
236
+ if( indent>0 ){
237237
for ( i=0; i<indent; i++ ){
238238
zBuf[iBuf++] = ' ';
239239
}
240240
}
241
- if ( origIndent>sizeof(zBuf)-6 ) /* Limit line indent to fit output buffer. */
241
+ if( origIndent>sizeof(zBuf)-6 ) /* Limit line indent to fit output buffer. */
242242
origIndent = sizeof(zBuf)-6;
243243
maxChars = lineChars;
244244
for(;;){
245245
int useChars = 1;
246246
char c = zLine[index];
247247
/* Flush the output buffer if there's no space left for at least one more
248248
** (potentially 4-byte) UTF-8 sequence, one level of indentation spaces,
249249
** a new line, and a terminating NULL. */
250
- if ( iBuf>sizeof(zBuf)-origIndent-6 ){
250
+ if( iBuf>sizeof(zBuf)-origIndent-6 ){
251251
zBuf[iBuf]=0;
252252
iBuf=0;
253253
fossil_print("%s", zBuf);
254254
}
255255
if( c==0 ){
@@ -328,11 +328,11 @@
328328
if( charCnt>0 ){
329329
zBuf[iBuf++] = '\n';
330330
lineCnt++;
331331
}
332332
/* Flush the remaining output buffer. */
333
- if ( iBuf>0 ) {
333
+ if( iBuf>0 ) {
334334
zBuf[iBuf]=0;
335335
iBuf=0;
336336
fossil_print("%s", zBuf);
337337
}
338338
if( pLineCnt ){
339339
--- src/comformat.c
+++ src/comformat.c
@@ -127,14 +127,14 @@
127 ){
128 int nextIndex = index + 1;
129 int fNonASCII=0;
130 for(;;){
131 char c = zLine[nextIndex];
132 if ( (c&0x80)==0x80 ) fNonASCII=1;
133 if( c==0 || fossil_isspace(c) ){
134 if ( distUTF8 ){
135 if ( fNonASCII!=0 ){
136 *distUTF8 = strlen_utf8(&zLine[index], nextIndex-index);
137 }else{
138 *distUTF8 = nextIndex-index;
139 }
140 }
@@ -162,11 +162,11 @@
162 int lengthUTF8=0; /* Counted UTF-8 sequences. */
163 int i;
164 for( i=0; i<lengthBytes; i++ ){
165 char c = zString[i];
166 lengthUTF8++;
167 if ( (c&0xc0)==0xc0 ){ /* Any UTF-8 lead byte 11xxxxxx */
168 int cchUTF8=1; /* Code units consumed. */
169 int maxUTF8=1; /* Expected sequence length. */
170 if( (c&0xe0)==0xc0 )maxUTF8=2; /* UTF-8 lead byte 110vvvvv */
171 else if( (c&0xf0)==0xe0 )maxUTF8=3; /* UTF-8 lead byte 1110vvvv */
172 else if( (c&0xf8)==0xf0 )maxUTF8=4; /* UTF-8 lead byte 11110vvv */
@@ -228,28 +228,28 @@
228 if( lineChars<=0 ) return;
229 #if 0
230 assert( indent<sizeof(zBuf)-5 ); /* See following comments to explain */
231 assert( origIndent<sizeof(zBuf)-5 ); /* these limits. */
232 #endif
233 if ( indent>sizeof(zBuf)-6 ) /* Limit initial indent to fit output buffer. */
234 indent = sizeof(zBuf)-6;
235 comment_calc_indent(zLine, indent, trimCrLf, trimSpace, &index);
236 if ( indent>0 ){
237 for ( i=0; i<indent; i++ ){
238 zBuf[iBuf++] = ' ';
239 }
240 }
241 if ( origIndent>sizeof(zBuf)-6 ) /* Limit line indent to fit output buffer. */
242 origIndent = sizeof(zBuf)-6;
243 maxChars = lineChars;
244 for(;;){
245 int useChars = 1;
246 char c = zLine[index];
247 /* Flush the output buffer if there's no space left for at least one more
248 ** (potentially 4-byte) UTF-8 sequence, one level of indentation spaces,
249 ** a new line, and a terminating NULL. */
250 if ( iBuf>sizeof(zBuf)-origIndent-6 ){
251 zBuf[iBuf]=0;
252 iBuf=0;
253 fossil_print("%s", zBuf);
254 }
255 if( c==0 ){
@@ -328,11 +328,11 @@
328 if( charCnt>0 ){
329 zBuf[iBuf++] = '\n';
330 lineCnt++;
331 }
332 /* Flush the remaining output buffer. */
333 if ( iBuf>0 ) {
334 zBuf[iBuf]=0;
335 iBuf=0;
336 fossil_print("%s", zBuf);
337 }
338 if( pLineCnt ){
339
--- src/comformat.c
+++ src/comformat.c
@@ -127,14 +127,14 @@
127 ){
128 int nextIndex = index + 1;
129 int fNonASCII=0;
130 for(;;){
131 char c = zLine[nextIndex];
132 if( (c&0x80)==0x80 ) fNonASCII=1;
133 if( c==0 || fossil_isspace(c) ){
134 if( distUTF8 ){
135 if( fNonASCII!=0 ){
136 *distUTF8 = strlen_utf8(&zLine[index], nextIndex-index);
137 }else{
138 *distUTF8 = nextIndex-index;
139 }
140 }
@@ -162,11 +162,11 @@
162 int lengthUTF8=0; /* Counted UTF-8 sequences. */
163 int i;
164 for( i=0; i<lengthBytes; i++ ){
165 char c = zString[i];
166 lengthUTF8++;
167 if( (c&0xc0)==0xc0 ){ /* Any UTF-8 lead byte 11xxxxxx */
168 int cchUTF8=1; /* Code units consumed. */
169 int maxUTF8=1; /* Expected sequence length. */
170 if( (c&0xe0)==0xc0 )maxUTF8=2; /* UTF-8 lead byte 110vvvvv */
171 else if( (c&0xf0)==0xe0 )maxUTF8=3; /* UTF-8 lead byte 1110vvvv */
172 else if( (c&0xf8)==0xf0 )maxUTF8=4; /* UTF-8 lead byte 11110vvv */
@@ -228,28 +228,28 @@
228 if( lineChars<=0 ) return;
229 #if 0
230 assert( indent<sizeof(zBuf)-5 ); /* See following comments to explain */
231 assert( origIndent<sizeof(zBuf)-5 ); /* these limits. */
232 #endif
233 if( indent>sizeof(zBuf)-6 ) /* Limit initial indent to fit output buffer. */
234 indent = sizeof(zBuf)-6;
235 comment_calc_indent(zLine, indent, trimCrLf, trimSpace, &index);
236 if( indent>0 ){
237 for ( i=0; i<indent; i++ ){
238 zBuf[iBuf++] = ' ';
239 }
240 }
241 if( origIndent>sizeof(zBuf)-6 ) /* Limit line indent to fit output buffer. */
242 origIndent = sizeof(zBuf)-6;
243 maxChars = lineChars;
244 for(;;){
245 int useChars = 1;
246 char c = zLine[index];
247 /* Flush the output buffer if there's no space left for at least one more
248 ** (potentially 4-byte) UTF-8 sequence, one level of indentation spaces,
249 ** a new line, and a terminating NULL. */
250 if( iBuf>sizeof(zBuf)-origIndent-6 ){
251 zBuf[iBuf]=0;
252 iBuf=0;
253 fossil_print("%s", zBuf);
254 }
255 if( c==0 ){
@@ -328,11 +328,11 @@
328 if( charCnt>0 ){
329 zBuf[iBuf++] = '\n';
330 lineCnt++;
331 }
332 /* Flush the remaining output buffer. */
333 if( iBuf>0 ) {
334 zBuf[iBuf]=0;
335 iBuf=0;
336 fossil_print("%s", zBuf);
337 }
338 if( pLineCnt ){
339

Keyboard Shortcuts

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