diff --git a/HTMLparser.c b/HTMLparser.c index 31457a66..737676e9 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -289,9 +289,9 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt) #define CUR_CHAR(l) htmlCurrentChar(ctxt, &l) -#define COPY_BUF(l,b,i,v) \ - if (l == 1) b[i++] = v; \ - else i += xmlCopyChar(l,&b[i],v) +#define COPY_BUF(b, i, v) \ + if (v < 0x80) b[i++] = v; \ + else i += xmlCopyCharMultiByte(&b[i],v) /** * htmlFindEncoding: @@ -3034,7 +3034,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { } } if (IS_CHAR(cur)) { - COPY_BUF(l,buf,nbchar,cur); + COPY_BUF(buf,nbchar,cur); } else { htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, "Invalid char in CDATA 0x%X\n", cur); @@ -3099,7 +3099,7 @@ htmlParseCharDataInternal(htmlParserCtxtPtr ctxt, int readahead) { htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, "Invalid char in CDATA 0x%X\n", cur); } else { - COPY_BUF(l,buf,nbchar,cur); + COPY_BUF(buf,nbchar,cur); } NEXTL(l); if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) { @@ -3298,7 +3298,7 @@ htmlParsePI(htmlParserCtxtPtr ctxt) { buf = tmp; } if (IS_CHAR(cur)) { - COPY_BUF(l,buf,len,cur); + COPY_BUF(buf,len,cur); } else { htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, "Invalid char in processing instruction " @@ -3420,7 +3420,7 @@ htmlParseComment(htmlParserCtxtPtr ctxt) { buf = tmp; } if (IS_CHAR(q)) { - COPY_BUF(ql,buf,len,q); + COPY_BUF(buf,len,q); } else { htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, "Invalid char in comment 0x%X\n", q); diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h index 6cac89a0..e540747f 100644 --- a/include/libxml/parserInternals.h +++ b/include/libxml/parserInternals.h @@ -620,6 +620,7 @@ XMLPUBFUN int xmlCurrentChar (xmlParserCtxtPtr ctxt, int *len); XMLPUBFUN int xmlCopyCharMultiByte (xmlChar *out, int val); +XML_DEPRECATED XMLPUBFUN int xmlCopyChar (int len, xmlChar *out, int val); diff --git a/parserInternals.c b/parserInternals.c index 8495ad0f..12f405e6 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -1056,6 +1056,8 @@ xmlCopyCharMultiByte(xmlChar *out, int val) { * @out: pointer to an array of xmlChar * @val: the char value * + * DEPRECATED: Don't use. + * * append the char value in the array * * Returns the number of xmlChar written diff --git a/python/generator.py b/python/generator.py index 02052402..0daa345f 100755 --- a/python/generator.py +++ b/python/generator.py @@ -303,6 +303,7 @@ deprecated_funcs = { 'xmlCheckLanguageID': True, 'xmlCleanupCharEncodingHandlers': True, 'xmlCleanupGlobals': True, + 'xmlCopyChar': True, 'xmlDefaultSAXHandlerInit': True, 'xmlDictCleanup': True, 'xmlFileMatch': True, diff --git a/xpath.c b/xpath.c index 119d6a02..79a4121c 100644 --- a/xpath.c +++ b/xpath.c @@ -2198,9 +2198,9 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) { #define CUR_PTR ctxt->cur #define CUR_CHAR(l) xmlXPathCurrentChar(ctxt, &l) -#define COPY_BUF(l,b,i,v) \ - if (l == 1) b[i++] = v; \ - else i += xmlCopyChar(l,&b[i],v) +#define COPY_BUF(b, i, v) \ + if (v < 0x80) b[i++] = v; \ + else i += xmlCopyCharMultiByte(&b[i],v) #define NEXTL(l) ctxt->cur += l @@ -8772,7 +8772,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) { (c == '_') || ((qualified) && (c == ':')) || (IS_COMBINING(c)) || (IS_EXTENDER(c)))) { - COPY_BUF(l,buf,len,c); + COPY_BUF(buf,len,c); NEXTL(l); c = CUR_CHAR(l); if (len >= XML_MAX_NAMELEN) { @@ -8812,7 +8812,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) { } buffer = tmp; } - COPY_BUF(l,buffer,len,c); + COPY_BUF(buffer,len,c); NEXTL(l); c = CUR_CHAR(l); }