MCPcopy Create free account
hub / github.com/acl-dev/acl / check_utf_bom

Function check_utf_bom

lib_acl_cpp/src/stdlib/internal/win_iconv.cpp:1099–1118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1097}
1098
1099static void
1100check_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
1120static char *
1121strrstr(const char *str, const char *token)

Callers 1

win_iconvFunction · 0.85

Calls 1

is_unicodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…