MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxUnicodeToUTF8Offset

Function fxUnicodeToUTF8Offset

xs/sources/xsCommon.c:1256–1275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1254#endif
1255
1256txSize fxUnicodeToUTF8Offset(txString theString, txSize theOffset)
1257{
1258 txU1* p = (txU1*)theString;
1259 txU1 c;
1260 txSize unicodeOffset = 0;
1261 txSize utf8Offset = 0;
1262
1263 while ((c = c_read8(p++))) {
1264 if ((c & 0xC0) != 0x80) {
1265 if (unicodeOffset == theOffset)
1266 return utf8Offset;
1267 unicodeOffset++;
1268 }
1269 utf8Offset++;
1270 }
1271 if (unicodeOffset == theOffset)
1272 return utf8Offset;
1273 else
1274 return -1;
1275}
1276
1277txFlag fxIntegerToIndex(void* the, txInteger theInteger, txIndex* theIndex)
1278{

Callers 15

PiuCodeFindWordBreakFunction · 0.85
PiuCodeHitOffsetFunction · 0.85
PiuCodeSelectFunction · 0.85
PiuCode_colorizeFunction · 0.85
PiuCode_findLineBreakFunction · 0.85
PiuCode_isSpaceFunction · 0.85
PiuCode_locateFunction · 0.85
fxStringAccessorGetterFunction · 0.85
fxStringGetOwnPropertyFunction · 0.85
fx_String_prototype_atFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected