Fossil SCM
Fix some compiler warnings reported by clang 17.0.6 on FreeBSD.
Commit
b9e34fa9d29fa98e4640cb7e60e67bfc0c93a1122bae5e0bd654faadb7df14e6
Parent
4e8dd7df46cf1ac…
1 file changed
+2
-28
+2
-28
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -136,36 +136,10 @@ | ||
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | if( aUWidth[iLast].iFirst > c ) return aUWidth[iFirst].w; |
| 139 | 139 | return aUWidth[iLast].w; |
| 140 | 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 | 141 | /******* End of code copied from SQLite *************************************/ |
| 168 | 142 | |
| 169 | 143 | /* |
| 170 | 144 | ** This is the previous value used by most external callers when they |
| 171 | 145 | ** needed to specify a default maximum line length to be used with the |
| @@ -271,11 +245,11 @@ | ||
| 271 | 245 | ** are treated as invalid 1-byte sequences (as lone trail bytes), all resulting |
| 272 | 246 | ** in one invalid code point. Invalid UTF-8 sequences encoding a non-scalar code |
| 273 | 247 | ** point (UTF-16 surrogates U+D800 to U+DFFF) are allowed. |
| 274 | 248 | */ |
| 275 | 249 | void char_info_utf8( |
| 276 | - const unsigned char *z, | |
| 250 | + const char *z, | |
| 277 | 251 | int *pCchUTF8, |
| 278 | 252 | int *pUtf32 |
| 279 | 253 | ){ |
| 280 | 254 | int i = 0; /* Counted bytes. */ |
| 281 | 255 | int cchUTF8 = 1; /* Code units consumed. */ |
| @@ -294,11 +268,11 @@ | ||
| 294 | 268 | cchUTF8++; |
| 295 | 269 | i++; |
| 296 | 270 | } |
| 297 | 271 | *pCchUTF8 = cchUTF8; |
| 298 | 272 | 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. */ | |
| 300 | 274 | *pUtf32 = 0xfffd; /* U+FFFD Replacement Character */ |
| 301 | 275 | #ifdef FOSSIL_DEBUG |
| 302 | 276 | assert( *pUtf32!=0xfffd ); /* Invalid UTF-8 sequence. */ |
| 303 | 277 | #endif |
| 304 | 278 | return; |
| 305 | 279 |
| --- 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 |