MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlUTF8Strsub

Function xmlUTF8Strsub

ThirdParty/libxml2/vtklibxml2/xmlstring.c:1114–1142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1112 */
1113
1114xmlChar *
1115xmlUTF8Strsub(const xmlChar *utf, int start, int len) {
1116 int i;
1117 int ch;
1118
1119 if (utf == NULL) return(NULL);
1120 if (start < 0) return(NULL);
1121 if (len < 0) return(NULL);
1122
1123 /*
1124 * Skip over any leading chars
1125 */
1126 for (i = 0; i < start; i++) {
1127 ch = *utf++;
1128 if (ch == 0)
1129 return(NULL);
1130 /* skip over remaining bytes for this char */
1131 if (ch & 0x80) {
1132 ch <<= 1;
1133 while (ch & 0x80) {
1134 if (*utf++ == 0)
1135 return(NULL);
1136 ch <<= 1;
1137 }
1138 }
1139 }
1140
1141 return(xmlUTF8Strndup(utf, len));
1142}
1143
1144/**
1145 * xmlEscapeFormatString:

Callers 1

Calls 1

xmlUTF8StrndupFunction · 0.85

Tested by

no test coverage detected