| 1097 | } |
| 1098 | |
| 1099 | static void |
| 1100 | check_utf_bom(rec_iconv_t *cd, ushort *wbuf, int *wbufsize) |
| 1101 | { |
| 1102 | /* If we have a BOM, trust it, despite what the caller said */ |
| 1103 | if (wbuf[0] == 0xFFFE && (cd->from.flags & FLAG_USE_BOM_ENDIAN)) |
| 1104 | { |
| 1105 | /* swap endian: 1200 <-> 1201 or 12000 <-> 12001 */ |
| 1106 | cd->from.codepage ^= 1; |
| 1107 | cd->from.mode |= UNICODE_MODE_SWAPPED; |
| 1108 | wbuf[0] = 0xFEFF; |
| 1109 | } |
| 1110 | |
| 1111 | /* |
| 1112 | * Remove BOM. |
| 1113 | * Don't do this if "to" is Unicode, |
| 1114 | * except if "to" is UTF-8. |
| 1115 | */ |
| 1116 | if (wbuf[0] == 0xFEFF && (!is_unicode(cd->to.codepage) || cd->to.codepage == 65001)) |
| 1117 | *wbufsize = 0; |
| 1118 | } |
| 1119 | |
| 1120 | static char * |
| 1121 | strrstr(const char *str, const char *token) |
no test coverage detected
searching dependent graphs…