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

Function htmlParseSystemLiteral

ThirdParty/libxml2/vtklibxml2/HTMLparser.c:2874–2919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2872 */
2873
2874static xmlChar *
2875htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) {
2876 size_t len = 0, startPosition = 0;
2877 int err = 0;
2878 int quote;
2879 xmlChar *ret = NULL;
2880
2881 if ((CUR != '"') && (CUR != '\'')) {
2882 htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED,
2883 "SystemLiteral \" or ' expected\n", NULL, NULL);
2884 return(NULL);
2885 }
2886 quote = CUR;
2887 NEXT;
2888
2889 if (CUR_PTR < BASE_PTR)
2890 return(ret);
2891 startPosition = CUR_PTR - BASE_PTR;
2892
2893 while ((PARSER_STOPPED(ctxt) == 0) &&
2894 (CUR != 0) && (CUR != quote)) {
2895 /* TODO: Handle UTF-8 */
2896 if (!IS_CHAR_CH(CUR)) {
2897 htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR,
2898 "Invalid char in SystemLiteral 0x%X\n", CUR);
2899 err = 1;
2900 }
2901 NEXT;
2902 len++;
2903 }
2904 if (CUR != quote) {
2905 htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
2906 "Unfinished SystemLiteral\n", NULL, NULL);
2907 } else {
2908 if (err == 0) {
2909 ret = xmlStrndup((BASE_PTR+startPosition), len);
2910 if (ret == NULL) {
2911 htmlErrMemory(ctxt);
2912 return(NULL);
2913 }
2914 }
2915 NEXT;
2916 }
2917
2918 return(ret);
2919}
2920
2921/**
2922 * htmlParsePubidLiteral:

Callers 1

htmlParseExternalIDFunction · 0.85

Calls 2

xmlStrndupFunction · 0.85
htmlErrMemoryFunction · 0.85

Tested by

no test coverage detected