mirror of
https://git.rtems.org/rtems-tools/
synced 2025-10-19 04:59:52 +08:00
rtemstoolkit: More warning fixes to ConvertUTF.c
This commit is contained in:
@@ -267,10 +267,10 @@ ConversionResult ConvertUTF16toUTF8 (
|
|||||||
target -= bytesToWrite; result = targetExhausted; break;
|
target -= bytesToWrite; result = targetExhausted; break;
|
||||||
}
|
}
|
||||||
switch (bytesToWrite) { /* note: everything falls through. */
|
switch (bytesToWrite) { /* note: everything falls through. */
|
||||||
case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; /* fall-thru */
|
||||||
case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; /* fall-thru */
|
||||||
case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6; /* fall-thru */
|
||||||
case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
|
case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]); /* fall-thru */
|
||||||
}
|
}
|
||||||
target += bytesToWrite;
|
target += bytesToWrite;
|
||||||
}
|
}
|
||||||
@@ -298,9 +298,9 @@ static Boolean isLegalUTF8(const UTF8 *source, int length) {
|
|||||||
switch (length) {
|
switch (length) {
|
||||||
default: return false;
|
default: return false;
|
||||||
/* Everything else falls through when "true"... */
|
/* Everything else falls through when "true"... */
|
||||||
case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
|
case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; /* fall-thru */
|
||||||
case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
|
case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; /* fall-thru */
|
||||||
case 2: if ((a = (*--srcptr)) > 0xBF) return false;
|
case 2: if ((a = (*--srcptr)) > 0xBF) return false; /* fall-thru */
|
||||||
|
|
||||||
switch (*source) {
|
switch (*source) {
|
||||||
/* no fall-through in this inner switch */
|
/* no fall-through in this inner switch */
|
||||||
@@ -308,10 +308,10 @@ static Boolean isLegalUTF8(const UTF8 *source, int length) {
|
|||||||
case 0xED: if (a > 0x9F) return false; break;
|
case 0xED: if (a > 0x9F) return false; break;
|
||||||
case 0xF0: if (a < 0x90) return false; break;
|
case 0xF0: if (a < 0x90) return false; break;
|
||||||
case 0xF4: if (a > 0x8F) return false; break;
|
case 0xF4: if (a > 0x8F) return false; break;
|
||||||
default: if (a < 0x80) return false;
|
default: if (a < 0x80) return false; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 1: if (*source >= 0x80 && *source < 0xC2) return false;
|
case 1: if (*source >= 0x80 && *source < 0xC2) return false; /* fall-thru */
|
||||||
}
|
}
|
||||||
if (*source > 0xF4) return false;
|
if (*source > 0xF4) return false;
|
||||||
return true;
|
return true;
|
||||||
@@ -354,12 +354,12 @@ ConversionResult ConvertUTF8toUTF16 (
|
|||||||
* The cases all fall through. See "Note A" below.
|
* The cases all fall through. See "Note A" below.
|
||||||
*/
|
*/
|
||||||
switch (extraBytesToRead) {
|
switch (extraBytesToRead) {
|
||||||
case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
|
case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */ /* fall-thru */
|
||||||
case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
|
case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */ /* fall-thru */
|
||||||
case 3: ch += *source++; ch <<= 6;
|
case 3: ch += *source++; ch <<= 6; /* fall-thru */
|
||||||
case 2: ch += *source++; ch <<= 6;
|
case 2: ch += *source++; ch <<= 6; /* fall-thru */
|
||||||
case 1: ch += *source++; ch <<= 6;
|
case 1: ch += *source++; ch <<= 6; /* fall-thru */
|
||||||
case 0: ch += *source++;
|
case 0: ch += *source++; /* fall-thru */
|
||||||
}
|
}
|
||||||
ch -= offsetsFromUTF8[extraBytesToRead];
|
ch -= offsetsFromUTF8[extraBytesToRead];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user