Fossil SCM

Fix some compiler warnings reported by clang 17.0.6 on FreeBSD.

florian 2024-10-05 13:27 comment-formatter-wcwidth
Commit b9e34fa9d29fa98e4640cb7e60e67bfc0c93a1122bae5e0bd654faadb7df14e6
1 file changed +2 -28
+2 -28
--- src/comformat.c
+++ src/comformat.c
@@ -136,36 +136,10 @@
136136
}
137137
}
138138
if( aUWidth[iLast].iFirst > c ) return aUWidth[iFirst].w;
139139
return aUWidth[iLast].w;
140140
}
141
-
142
-/*
143
-** Compute the value and length of a multi-byte UTF-8 character that
144
-** begins at z[0]. Return the length. Write the Unicode value into *pU.
145
-**
146
-** This routine only works for *multi-byte* UTF-8 characters.
147
-*/
148
-static int decodeUtf8(const unsigned char *z, int *pU){
149
- if( (z[0] & 0xe0)==0xc0 && (z[1] & 0xc0)==0x80 ){
150
- *pU = ((z[0] & 0x1f)<<6) | (z[1] & 0x3f);
151
- return 2;
152
- }
153
- if( (z[0] & 0xf0)==0xe0 && (z[1] & 0xc0)==0x80 && (z[2] & 0xc0)==0x80 ){
154
- *pU = ((z[0] & 0x0f)<<12) | ((z[1] & 0x3f)<<6) | (z[2] & 0x3f);
155
- return 3;
156
- }
157
- if( (z[0] & 0xf8)==0xf0 && (z[1] & 0xc0)==0x80 && (z[2] & 0xc0)==0x80
158
- && (z[3] & 0xc0)==0x80
159
- ){
160
- *pU = ((z[0] & 0x0f)<<18) | ((z[1] & 0x3f)<<12) | ((z[2] & 0x3f))<<6
161
- | (z[4] & 0x3f);
162
- return 4;
163
- }
164
- *pU = 0;
165
- return 1;
166
-}
167141
/******* End of code copied from SQLite *************************************/
168142
169143
/*
170144
** This is the previous value used by most external callers when they
171145
** needed to specify a default maximum line length to be used with the
@@ -271,11 +245,11 @@
271245
** are treated as invalid 1-byte sequences (as lone trail bytes), all resulting
272246
** in one invalid code point. Invalid UTF-8 sequences encoding a non-scalar code
273247
** point (UTF-16 surrogates U+D800 to U+DFFF) are allowed.
274248
*/
275249
void char_info_utf8(
276
- const unsigned char *z,
250
+ const char *z,
277251
int *pCchUTF8,
278252
int *pUtf32
279253
){
280254
int i = 0; /* Counted bytes. */
281255
int cchUTF8 = 1; /* Code units consumed. */
@@ -294,11 +268,11 @@
294268
cchUTF8++;
295269
i++;
296270
}
297271
*pCchUTF8 = cchUTF8;
298272
if( cchUTF8!=maxUTF8 || /* Incomplete UTF-8 sequence. */
299
- cchUTF8==1 && (c&0x80)==0x80 ){ /* Lone UTF-8 trail byte. */
273
+ ( cchUTF8==1 && (c&0x80)==0x80 )){ /* Lone UTF-8 trail byte. */
300274
*pUtf32 = 0xfffd; /* U+FFFD Replacement Character */
301275
#ifdef FOSSIL_DEBUG
302276
assert( *pUtf32!=0xfffd ); /* Invalid UTF-8 sequence. */
303277
#endif
304278
return;
305279
--- src/comformat.c
+++ src/comformat.c
@@ -136,36 +136,10 @@
136 }
137 }
138 if( aUWidth[iLast].iFirst > c ) return aUWidth[iFirst].w;
139 return aUWidth[iLast].w;
140 }
141
142 /*
143 ** Compute the value and length of a multi-byte UTF-8 character that
144 ** begins at z[0]. Return the length. Write the Unicode value into *pU.
145 **
146 ** This routine only works for *multi-byte* UTF-8 characters.
147 */
148 static int decodeUtf8(const unsigned char *z, int *pU){
149 if( (z[0] & 0xe0)==0xc0 && (z[1] & 0xc0)==0x80 ){
150 *pU = ((z[0] & 0x1f)<<6) | (z[1] & 0x3f);
151 return 2;
152 }
153 if( (z[0] & 0xf0)==0xe0 && (z[1] & 0xc0)==0x80 && (z[2] & 0xc0)==0x80 ){
154 *pU = ((z[0] & 0x0f)<<12) | ((z[1] & 0x3f)<<6) | (z[2] & 0x3f);
155 return 3;
156 }
157 if( (z[0] & 0xf8)==0xf0 && (z[1] & 0xc0)==0x80 && (z[2] & 0xc0)==0x80
158 && (z[3] & 0xc0)==0x80
159 ){
160 *pU = ((z[0] & 0x0f)<<18) | ((z[1] & 0x3f)<<12) | ((z[2] & 0x3f))<<6
161 | (z[4] & 0x3f);
162 return 4;
163 }
164 *pU = 0;
165 return 1;
166 }
167 /******* End of code copied from SQLite *************************************/
168
169 /*
170 ** This is the previous value used by most external callers when they
171 ** needed to specify a default maximum line length to be used with the
@@ -271,11 +245,11 @@
271 ** are treated as invalid 1-byte sequences (as lone trail bytes), all resulting
272 ** in one invalid code point. Invalid UTF-8 sequences encoding a non-scalar code
273 ** point (UTF-16 surrogates U+D800 to U+DFFF) are allowed.
274 */
275 void char_info_utf8(
276 const unsigned char *z,
277 int *pCchUTF8,
278 int *pUtf32
279 ){
280 int i = 0; /* Counted bytes. */
281 int cchUTF8 = 1; /* Code units consumed. */
@@ -294,11 +268,11 @@
294 cchUTF8++;
295 i++;
296 }
297 *pCchUTF8 = cchUTF8;
298 if( cchUTF8!=maxUTF8 || /* Incomplete UTF-8 sequence. */
299 cchUTF8==1 && (c&0x80)==0x80 ){ /* Lone UTF-8 trail byte. */
300 *pUtf32 = 0xfffd; /* U+FFFD Replacement Character */
301 #ifdef FOSSIL_DEBUG
302 assert( *pUtf32!=0xfffd ); /* Invalid UTF-8 sequence. */
303 #endif
304 return;
305
--- src/comformat.c
+++ src/comformat.c
@@ -136,36 +136,10 @@
136 }
137 }
138 if( aUWidth[iLast].iFirst > c ) return aUWidth[iFirst].w;
139 return aUWidth[iLast].w;
140 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141 /******* End of code copied from SQLite *************************************/
142
143 /*
144 ** This is the previous value used by most external callers when they
145 ** needed to specify a default maximum line length to be used with the
@@ -271,11 +245,11 @@
245 ** are treated as invalid 1-byte sequences (as lone trail bytes), all resulting
246 ** in one invalid code point. Invalid UTF-8 sequences encoding a non-scalar code
247 ** point (UTF-16 surrogates U+D800 to U+DFFF) are allowed.
248 */
249 void char_info_utf8(
250 const char *z,
251 int *pCchUTF8,
252 int *pUtf32
253 ){
254 int i = 0; /* Counted bytes. */
255 int cchUTF8 = 1; /* Code units consumed. */
@@ -294,11 +268,11 @@
268 cchUTF8++;
269 i++;
270 }
271 *pCchUTF8 = cchUTF8;
272 if( cchUTF8!=maxUTF8 || /* Incomplete UTF-8 sequence. */
273 ( cchUTF8==1 && (c&0x80)==0x80 )){ /* Lone UTF-8 trail byte. */
274 *pUtf32 = 0xfffd; /* U+FFFD Replacement Character */
275 #ifdef FOSSIL_DEBUG
276 assert( *pUtf32!=0xfffd ); /* Invalid UTF-8 sequence. */
277 #endif
278 return;
279

Keyboard Shortcuts

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