mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-24 06:50:08 +03:00
encoding: Rename unprefixed public functions
This commit is contained in:
parent
66fdf94c55
commit
0b27097a92
@ -1957,7 +1957,7 @@ htmlEntityValueLookup(unsigned int value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* UTF8ToHtml:
|
||||
* htmlUTF8ToHtml:
|
||||
* @out: a pointer to an array of bytes to store the result
|
||||
* @outlen: the length of @out
|
||||
* @in: a pointer to an array of UTF-8 chars
|
||||
@ -1972,8 +1972,8 @@ htmlEntityValueLookup(unsigned int value) {
|
||||
* The value of @outlen after return is the number of octets consumed.
|
||||
*/
|
||||
int
|
||||
UTF8ToHtml(unsigned char* out, int *outlen,
|
||||
const unsigned char* in, int *inlen) {
|
||||
htmlUTF8ToHtml(unsigned char* out, int *outlen,
|
||||
const unsigned char* in, int *inlen) {
|
||||
const unsigned char* instart = in;
|
||||
const unsigned char* inend;
|
||||
unsigned char* outstart = out;
|
||||
|
@ -5,6 +5,7 @@
|
||||
<summary>interface for an HTML 4.0 non-verifying parser</summary>
|
||||
<description>this module implements an HTML 4.0 non-verifying parser with API compatible with the XML parser ones. It should be able to parse "real world" HTML, even if severely broken from a specification point of view. </description>
|
||||
<author>Daniel Veillard </author>
|
||||
<exports symbol='UTF8ToHtml' type='macro'/>
|
||||
<exports symbol='htmlDefaultSubelement' type='macro'/>
|
||||
<exports symbol='htmlElementAllowedHereDesc' type='macro'/>
|
||||
<exports symbol='htmlRequiredAttrs' type='macro'/>
|
||||
@ -44,7 +45,6 @@
|
||||
<exports symbol='_htmlElemDesc' type='struct'/>
|
||||
<exports symbol='_htmlEntityDesc' type='struct'/>
|
||||
<exports symbol='htmlDefaultSAXHandler' type='variable'/>
|
||||
<exports symbol='UTF8ToHtml' type='function'/>
|
||||
<exports symbol='htmlAttrAllowed' type='function'/>
|
||||
<exports symbol='htmlAutoCloseTag' type='function'/>
|
||||
<exports symbol='htmlCreateFileParserCtxt' type='function'/>
|
||||
@ -87,6 +87,7 @@
|
||||
<exports symbol='htmlSAXParseDoc' type='function'/>
|
||||
<exports symbol='htmlSAXParseFile' type='function'/>
|
||||
<exports symbol='htmlTagLookup' type='function'/>
|
||||
<exports symbol='htmlUTF8ToHtml' type='function'/>
|
||||
</file>
|
||||
<file name='HTMLtree'>
|
||||
<summary>specific APIs to process HTML tree, especially serialization</summary>
|
||||
@ -309,6 +310,8 @@
|
||||
<summary>interface for the encoding conversion functions</summary>
|
||||
<description>interface for the encoding conversion functions needed for XML basic encoding and iconv() support. Related specs are rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies [ISO-10646] UTF-8 and UTF-16 in Annexes [ISO-8859-1] ISO Latin-1 characters codes. [UNICODE] The Unicode Consortium, "The Unicode Standard -- Worldwide Character Encoding -- Version 1.0", Addison- Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is described in Unicode Technical Report #4. [US-ASCII] Coded Character Set--7-bit American Standard Code for Information Interchange, ANSI X3.4-1986. </description>
|
||||
<author>Daniel Veillard </author>
|
||||
<exports symbol='UTF8Toisolat1' type='macro'/>
|
||||
<exports symbol='isolat1ToUTF8' type='macro'/>
|
||||
<exports symbol='XML_CHAR_ENCODING_2022_JP' type='enum'/>
|
||||
<exports symbol='XML_CHAR_ENCODING_8859_1' type='enum'/>
|
||||
<exports symbol='XML_CHAR_ENCODING_8859_10' type='enum'/>
|
||||
@ -352,8 +355,6 @@
|
||||
<exports symbol='xmlCharEncodingHandlerPtr' type='typedef'/>
|
||||
<exports symbol='_xmlCharEncodingHandler' type='struct'/>
|
||||
<exports symbol='xmlCharEncConverter' type='struct'/>
|
||||
<exports symbol='UTF8Toisolat1' type='function'/>
|
||||
<exports symbol='isolat1ToUTF8' type='function'/>
|
||||
<exports symbol='xmlAddEncodingAlias' type='function'/>
|
||||
<exports symbol='xmlCharEncCloseFunc' type='function'/>
|
||||
<exports symbol='xmlCharEncConvCtxtDtor' type='function'/>
|
||||
@ -374,11 +375,13 @@
|
||||
<exports symbol='xmlGetCharEncodingName' type='function'/>
|
||||
<exports symbol='xmlGetEncodingAlias' type='function'/>
|
||||
<exports symbol='xmlInitCharEncodingHandlers' type='function'/>
|
||||
<exports symbol='xmlIsolat1ToUTF8' type='function'/>
|
||||
<exports symbol='xmlLookupCharEncodingHandler' type='function'/>
|
||||
<exports symbol='xmlNewCharEncodingHandler' type='function'/>
|
||||
<exports symbol='xmlOpenCharEncodingHandler' type='function'/>
|
||||
<exports symbol='xmlParseCharEncoding' type='function'/>
|
||||
<exports symbol='xmlRegisterCharEncodingHandler' type='function'/>
|
||||
<exports symbol='xmlUTF8ToIsolat1' type='function'/>
|
||||
</file>
|
||||
<file name='entities'>
|
||||
<summary>interface for the XML entities handling</summary>
|
||||
@ -3932,6 +3935,10 @@
|
||||
<macro name='LIBXML_ZLIB_ENABLED' file='xmlversion'>
|
||||
<info>Whether the Zlib support is compiled in</info>
|
||||
</macro>
|
||||
<macro name='UTF8ToHtml' file='HTMLparser'>
|
||||
</macro>
|
||||
<macro name='UTF8Toisolat1' file='encoding'>
|
||||
</macro>
|
||||
<macro name='XINCLUDE_FALLBACK' file='xinclude'>
|
||||
<info>Macro defining "fallback"</info>
|
||||
</macro>
|
||||
@ -4312,6 +4319,8 @@
|
||||
<info>Returns the attributes required for the specified element.</info>
|
||||
<arg name='elt' info='HTML element'/>
|
||||
</macro>
|
||||
<macro name='isolat1ToUTF8' file='encoding'>
|
||||
</macro>
|
||||
<macro name='xmlChildrenNode' file='tree'>
|
||||
<info>Macro for compatibility naming layer with libxml1. Maps to "children."</info>
|
||||
</macro>
|
||||
@ -6796,24 +6805,6 @@ crash if you try to modify the tree)'/>
|
||||
<variable name='xmlXPathNAN' file='xpath' type='double'/>
|
||||
<variable name='xmlXPathNINF' file='xpath' type='double'/>
|
||||
<variable name='xmlXPathPINF' file='xpath' type='double'/>
|
||||
<function name='UTF8ToHtml' file='HTMLparser' module='HTMLparser'>
|
||||
<cond>defined(LIBXML_HTML_ENABLED)</cond>
|
||||
<info>Take a block of UTF-8 chars in and try to convert it to an ASCII plus HTML entities block of chars out.</info>
|
||||
<return type='int' info='0 if success, -2 if the transcoding fails, or -1 otherwise The value of @inlen after return is the number of octets consumed as the return value is positive, else unpredictable. The value of @outlen after return is the number of octets consumed.'/>
|
||||
<arg name='out' type='unsigned char *' info='a pointer to an array of bytes to store the result'/>
|
||||
<arg name='outlen' type='int *' info='the length of @out'/>
|
||||
<arg name='in' type='const unsigned char *' info='a pointer to an array of UTF-8 chars'/>
|
||||
<arg name='inlen' type='int *' info='the length of @in'/>
|
||||
</function>
|
||||
<function name='UTF8Toisolat1' file='encoding' module='encoding'>
|
||||
<cond>defined(LIBXML_OUTPUT_ENABLED)</cond>
|
||||
<info>Take a block of UTF-8 chars in and try to convert it to an ISO Latin 1 block of chars out.</info>
|
||||
<return type='int' info='the number of bytes written or an XML_ENC_ERR code. The value of @inlen after return is the number of octets consumed if the return value is positive, else unpredictable. The value of @outlen after return is the number of octets produced.'/>
|
||||
<arg name='out' type='unsigned char *' info='a pointer to an array of bytes to store the result'/>
|
||||
<arg name='outlen' type='int *' info='the length of @out'/>
|
||||
<arg name='in' type='const unsigned char *' info='a pointer to an array of UTF-8 chars'/>
|
||||
<arg name='inlen' type='int *' info='the length of @in'/>
|
||||
</function>
|
||||
<functype name='attributeDeclSAXFunc' file='parser' module='parser'>
|
||||
<info>An attribute definition has been parsed.</info>
|
||||
<return type='void'/>
|
||||
@ -7405,6 +7396,15 @@ crash if you try to modify the tree)'/>
|
||||
<return type='const htmlElemDesc *' info='the related htmlElemDescPtr or NULL if not found.'/>
|
||||
<arg name='tag' type='const xmlChar *' info='The tag name in lowercase'/>
|
||||
</function>
|
||||
<function name='htmlUTF8ToHtml' file='HTMLparser' module='HTMLparser'>
|
||||
<cond>defined(LIBXML_HTML_ENABLED)</cond>
|
||||
<info>Take a block of UTF-8 chars in and try to convert it to an ASCII plus HTML entities block of chars out.</info>
|
||||
<return type='int' info='0 if success, -2 if the transcoding fails, or -1 otherwise The value of @inlen after return is the number of octets consumed as the return value is positive, else unpredictable. The value of @outlen after return is the number of octets consumed.'/>
|
||||
<arg name='out' type='unsigned char *' info='a pointer to an array of bytes to store the result'/>
|
||||
<arg name='outlen' type='int *' info='the length of @out'/>
|
||||
<arg name='in' type='const unsigned char *' info='a pointer to an array of UTF-8 chars'/>
|
||||
<arg name='inlen' type='int *' info='the length of @in'/>
|
||||
</function>
|
||||
<functype name='ignorableWhitespaceSAXFunc' file='parser' module='parser'>
|
||||
<info>Receiving some ignorable whitespaces from the parser. UNUSED: by default the DOM building will use characters.</info>
|
||||
<return type='void'/>
|
||||
@ -7441,14 +7441,6 @@ crash if you try to modify the tree)'/>
|
||||
<return type='int' info='1 if true'/>
|
||||
<arg name='ctx' type='void *' info='the user data (XML parser context)'/>
|
||||
</functype>
|
||||
<function name='isolat1ToUTF8' file='encoding' module='encoding'>
|
||||
<info>Take a block of ISO Latin 1 chars in and try to convert it to an UTF-8 block of chars out.</info>
|
||||
<return type='int' info='the number of bytes written or an XML_ENC_ERR code. The value of @inlen after return is the number of octets consumed if the return value is positive, else unpredictable. The value of @outlen after return is the number of octets produced.'/>
|
||||
<arg name='out' type='unsigned char *' info='a pointer to an array of bytes to store the result'/>
|
||||
<arg name='outlen' type='int *' info='the length of @out'/>
|
||||
<arg name='in' type='const unsigned char *' info='a pointer to an array of ISO Latin 1 chars'/>
|
||||
<arg name='inlen' type='int *' info='the length of @in'/>
|
||||
</function>
|
||||
<function name='namePop' file='parserInternals' module='parser'>
|
||||
<info>DEPRECATED: Internal function, do not use. Pops the top element name from the name stack</info>
|
||||
<return type='const xmlChar *' info='the name just removed'/>
|
||||
@ -10178,6 +10170,14 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='systemID' type='const xmlChar *' info='the system identifier'/>
|
||||
<arg name='publicID' type='const xmlChar *' info='the public identifier'/>
|
||||
</function>
|
||||
<function name='xmlIsolat1ToUTF8' file='encoding' module='encoding'>
|
||||
<info>Take a block of ISO Latin 1 chars in and try to convert it to an UTF-8 block of chars out.</info>
|
||||
<return type='int' info='the number of bytes written or an XML_ENC_ERR code. The value of @inlen after return is the number of octets consumed if the return value is positive, else unpredictable. The value of @outlen after return is the number of octets produced.'/>
|
||||
<arg name='out' type='unsigned char *' info='a pointer to an array of bytes to store the result'/>
|
||||
<arg name='outlen' type='int *' info='the length of @out'/>
|
||||
<arg name='in' type='const unsigned char *' info='a pointer to an array of ISO Latin 1 chars'/>
|
||||
<arg name='inlen' type='int *' info='the length of @in'/>
|
||||
</function>
|
||||
<function name='xmlKeepBlanksDefault' file='parser' module='parserInternals'>
|
||||
<info>DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS. Set and return the previous value for default blanks text nodes support. The 1.x version of the parser used an heuristic to try to detect ignorable white spaces. As a result the SAX callback was generating xmlSAX2IgnorableWhitespace() callbacks instead of characters() one, and when using the DOM output text nodes containing those blanks were not generated. The 2.x and later version will switch to the XML standard way and ignorableWhitespace() are only generated when running the parser in validating mode and when the current element doesn't allow CDATA or mixed content. This function is provided as a way to force the standard behavior on 1.X libs and to switch back to the old mode for compatibility when running 1.X client code on 2.X . Upgrade of 1.X code should be done by using xmlIsBlankNode() commodity function to detect the "empty" nodes generated. This value also affect autogeneration of indentation when saving code if blanks sections are kept, indentation is not generated.</info>
|
||||
<return type='int' info='the last value for 0 for no substitution, 1 for substitution.'/>
|
||||
@ -16156,6 +16156,15 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='start' type='int' info='relative pos of first char'/>
|
||||
<arg name='len' type='int' info='total number to copy'/>
|
||||
</function>
|
||||
<function name='xmlUTF8ToIsolat1' file='encoding' module='encoding'>
|
||||
<cond>defined(LIBXML_OUTPUT_ENABLED)</cond>
|
||||
<info>Take a block of UTF-8 chars in and try to convert it to an ISO Latin 1 block of chars out.</info>
|
||||
<return type='int' info='the number of bytes written or an XML_ENC_ERR code. The value of @inlen after return is the number of octets consumed if the return value is positive, else unpredictable. The value of @outlen after return is the number of octets produced.'/>
|
||||
<arg name='out' type='unsigned char *' info='a pointer to an array of bytes to store the result'/>
|
||||
<arg name='outlen' type='int *' info='the length of @out'/>
|
||||
<arg name='in' type='const unsigned char *' info='a pointer to an array of UTF-8 chars'/>
|
||||
<arg name='inlen' type='int *' info='the length of @in'/>
|
||||
</function>
|
||||
<function name='xmlUnlinkNode' file='tree' module='tree'>
|
||||
<info>Unlink a node from its tree. The node is not freed. Unless it is reinserted, it must be managed manually and freed eventually by calling xmlFreeNode.</info>
|
||||
<return type='void'/>
|
||||
|
10
encoding.c
10
encoding.c
@ -2161,7 +2161,7 @@ done:
|
||||
}
|
||||
|
||||
/**
|
||||
* isolat1ToUTF8:
|
||||
* xmlIsolat1ToUTF8:
|
||||
* @out: a pointer to an array of bytes to store the result
|
||||
* @outlen: the length of @out
|
||||
* @in: a pointer to an array of ISO Latin 1 chars
|
||||
@ -2177,8 +2177,8 @@ done:
|
||||
* The value of @outlen after return is the number of octets produced.
|
||||
*/
|
||||
int
|
||||
isolat1ToUTF8(unsigned char* out, int *outlen,
|
||||
const unsigned char* in, int *inlen) {
|
||||
xmlIsolat1ToUTF8(unsigned char* out, int *outlen,
|
||||
const unsigned char* in, int *inlen) {
|
||||
return(latin1ToUTF8(out, outlen, in, inlen, NULL));
|
||||
}
|
||||
|
||||
@ -2264,7 +2264,7 @@ done:
|
||||
}
|
||||
|
||||
/**
|
||||
* UTF8Toisolat1:
|
||||
* xmlUTF8ToIsolat1:
|
||||
* @out: a pointer to an array of bytes to store the result
|
||||
* @outlen: the length of @out
|
||||
* @in: a pointer to an array of UTF-8 chars
|
||||
@ -2280,7 +2280,7 @@ done:
|
||||
* The value of @outlen after return is the number of octets produced.
|
||||
*/
|
||||
int
|
||||
UTF8Toisolat1(unsigned char* out, int *outlen,
|
||||
xmlUTF8ToIsolat1(unsigned char* out, int *outlen,
|
||||
const unsigned char* in, int *inlen) {
|
||||
if ((out == NULL) || (outlen == NULL) || (in == NULL) || (inlen == NULL))
|
||||
return(XML_ENC_ERR_INTERNAL);
|
||||
|
@ -21,6 +21,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Backward compatibility
|
||||
*/
|
||||
#define UTF8ToHtml htmlUTF8ToHtml
|
||||
|
||||
/*
|
||||
* Most of the back-end structures from XML and HTML are shared.
|
||||
*/
|
||||
@ -150,7 +155,7 @@ XMLPUBFUN htmlDocPtr
|
||||
htmlParseFile (const char *filename,
|
||||
const char *encoding);
|
||||
XMLPUBFUN int
|
||||
UTF8ToHtml (unsigned char *out,
|
||||
htmlUTF8ToHtml (unsigned char *out,
|
||||
int *outlen,
|
||||
const unsigned char *in,
|
||||
int *inlen);
|
||||
|
@ -28,6 +28,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Backward compatibility
|
||||
*/
|
||||
#define UTF8Toisolat1 xmlUTF8ToIsolat1
|
||||
#define isolat1ToUTF8 xmlIsolat1ToUTF8
|
||||
|
||||
typedef enum {
|
||||
XML_ENC_ERR_SUCCESS = 0,
|
||||
XML_ENC_ERR_INTERNAL = -1,
|
||||
@ -268,13 +274,13 @@ XMLPUBFUN int
|
||||
*/
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN int
|
||||
UTF8Toisolat1 (unsigned char *out,
|
||||
xmlUTF8ToIsolat1 (unsigned char *out,
|
||||
int *outlen,
|
||||
const unsigned char *in,
|
||||
int *inlen);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
XMLPUBFUN int
|
||||
isolat1ToUTF8 (unsigned char *out,
|
||||
xmlIsolat1ToUTF8 (unsigned char *out,
|
||||
int *outlen,
|
||||
const unsigned char *in,
|
||||
int *inlen);
|
||||
|
348
testapi.c
348
testapi.c
@ -1271,61 +1271,6 @@ testlibxml2(void)
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_UTF8ToHtml(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_HTML_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
unsigned char * out; /* a pointer to an array of bytes to store the result */
|
||||
int n_out;
|
||||
int * outlen; /* the length of @out */
|
||||
int n_outlen;
|
||||
const unsigned char * in; /* a pointer to an array of UTF-8 chars */
|
||||
int n_in;
|
||||
int * inlen; /* the length of @in */
|
||||
int n_inlen;
|
||||
|
||||
for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
|
||||
for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
|
||||
for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
|
||||
for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
out = gen_unsigned_char_ptr(n_out, 0);
|
||||
outlen = gen_int_ptr(n_outlen, 1);
|
||||
in = gen_const_unsigned_char_ptr(n_in, 2);
|
||||
inlen = gen_int_ptr(n_inlen, 3);
|
||||
|
||||
ret_val = UTF8ToHtml(out, outlen, in, inlen);
|
||||
desret_int(ret_val);
|
||||
call_tests++;
|
||||
des_unsigned_char_ptr(n_out, out, 0);
|
||||
des_int_ptr(n_outlen, outlen, 1);
|
||||
des_const_unsigned_char_ptr(n_in, in, 2);
|
||||
des_int_ptr(n_inlen, inlen, 3);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in UTF8ToHtml",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_out);
|
||||
printf(" %d", n_outlen);
|
||||
printf(" %d", n_in);
|
||||
printf(" %d", n_inlen);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
#endif
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
#define gen_nb_const_htmlElemDesc_ptr 1
|
||||
@ -2955,12 +2900,66 @@ test_htmlTagLookup(void) {
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_htmlUTF8ToHtml(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_HTML_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
unsigned char * out; /* a pointer to an array of bytes to store the result */
|
||||
int n_out;
|
||||
int * outlen; /* the length of @out */
|
||||
int n_outlen;
|
||||
const unsigned char * in; /* a pointer to an array of UTF-8 chars */
|
||||
int n_in;
|
||||
int * inlen; /* the length of @in */
|
||||
int n_inlen;
|
||||
|
||||
for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
|
||||
for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
|
||||
for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
|
||||
for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
out = gen_unsigned_char_ptr(n_out, 0);
|
||||
outlen = gen_int_ptr(n_outlen, 1);
|
||||
in = gen_const_unsigned_char_ptr(n_in, 2);
|
||||
inlen = gen_int_ptr(n_inlen, 3);
|
||||
|
||||
ret_val = htmlUTF8ToHtml(out, outlen, in, inlen);
|
||||
desret_int(ret_val);
|
||||
call_tests++;
|
||||
des_unsigned_char_ptr(n_out, out, 0);
|
||||
des_int_ptr(n_outlen, outlen, 1);
|
||||
des_const_unsigned_char_ptr(n_in, in, 2);
|
||||
des_int_ptr(n_inlen, inlen, 3);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in htmlUTF8ToHtml",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_out);
|
||||
printf(" %d", n_outlen);
|
||||
printf(" %d", n_in);
|
||||
printf(" %d", n_inlen);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
#endif
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
static int
|
||||
test_HTMLparser(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
if (quiet == 0) printf("Testing HTMLparser : 37 of 43 functions ...\n");
|
||||
test_ret += test_UTF8ToHtml();
|
||||
test_ret += test_htmlAttrAllowed();
|
||||
test_ret += test_htmlAutoCloseTag();
|
||||
test_ret += test_htmlCreateFileParserCtxt();
|
||||
@ -2998,6 +2997,7 @@ test_HTMLparser(void) {
|
||||
test_ret += test_htmlSAXParseDoc();
|
||||
test_ret += test_htmlSAXParseFile();
|
||||
test_ret += test_htmlTagLookup();
|
||||
test_ret += test_htmlUTF8ToHtml();
|
||||
|
||||
if (test_ret != 0)
|
||||
printf("Module HTMLparser: %d errors\n", test_ret);
|
||||
@ -7916,116 +7916,6 @@ test_dict(void) {
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
static int
|
||||
test_UTF8Toisolat1(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_OUTPUT_ENABLED)
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
unsigned char * out; /* a pointer to an array of bytes to store the result */
|
||||
int n_out;
|
||||
int * outlen; /* the length of @out */
|
||||
int n_outlen;
|
||||
const unsigned char * in; /* a pointer to an array of UTF-8 chars */
|
||||
int n_in;
|
||||
int * inlen; /* the length of @in */
|
||||
int n_inlen;
|
||||
|
||||
for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
|
||||
for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
|
||||
for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
|
||||
for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
out = gen_unsigned_char_ptr(n_out, 0);
|
||||
outlen = gen_int_ptr(n_outlen, 1);
|
||||
in = gen_const_unsigned_char_ptr(n_in, 2);
|
||||
inlen = gen_int_ptr(n_inlen, 3);
|
||||
|
||||
ret_val = UTF8Toisolat1(out, outlen, in, inlen);
|
||||
desret_int(ret_val);
|
||||
call_tests++;
|
||||
des_unsigned_char_ptr(n_out, out, 0);
|
||||
des_int_ptr(n_outlen, outlen, 1);
|
||||
des_const_unsigned_char_ptr(n_in, in, 2);
|
||||
des_int_ptr(n_inlen, inlen, 3);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in UTF8Toisolat1",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_out);
|
||||
printf(" %d", n_outlen);
|
||||
printf(" %d", n_in);
|
||||
printf(" %d", n_inlen);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_isolat1ToUTF8(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
unsigned char * out; /* a pointer to an array of bytes to store the result */
|
||||
int n_out;
|
||||
int * outlen; /* the length of @out */
|
||||
int n_outlen;
|
||||
const unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
|
||||
int n_in;
|
||||
int * inlen; /* the length of @in */
|
||||
int n_inlen;
|
||||
|
||||
for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
|
||||
for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
|
||||
for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
|
||||
for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
out = gen_unsigned_char_ptr(n_out, 0);
|
||||
outlen = gen_int_ptr(n_outlen, 1);
|
||||
in = gen_const_unsigned_char_ptr(n_in, 2);
|
||||
inlen = gen_int_ptr(n_inlen, 3);
|
||||
|
||||
ret_val = isolat1ToUTF8(out, outlen, in, inlen);
|
||||
desret_int(ret_val);
|
||||
call_tests++;
|
||||
des_unsigned_char_ptr(n_out, out, 0);
|
||||
des_int_ptr(n_outlen, outlen, 1);
|
||||
des_const_unsigned_char_ptr(n_in, in, 2);
|
||||
des_int_ptr(n_inlen, inlen, 3);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in isolat1ToUTF8",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_out);
|
||||
printf(" %d", n_outlen);
|
||||
printf(" %d", n_in);
|
||||
printf(" %d", n_inlen);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlAddEncodingAlias(void) {
|
||||
int test_ret = 0;
|
||||
@ -8447,6 +8337,59 @@ test_xmlInitCharEncodingHandlers(void) {
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlIsolat1ToUTF8(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
unsigned char * out; /* a pointer to an array of bytes to store the result */
|
||||
int n_out;
|
||||
int * outlen; /* the length of @out */
|
||||
int n_outlen;
|
||||
const unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
|
||||
int n_in;
|
||||
int * inlen; /* the length of @in */
|
||||
int n_inlen;
|
||||
|
||||
for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
|
||||
for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
|
||||
for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
|
||||
for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
out = gen_unsigned_char_ptr(n_out, 0);
|
||||
outlen = gen_int_ptr(n_outlen, 1);
|
||||
in = gen_const_unsigned_char_ptr(n_in, 2);
|
||||
inlen = gen_int_ptr(n_inlen, 3);
|
||||
|
||||
ret_val = xmlIsolat1ToUTF8(out, outlen, in, inlen);
|
||||
desret_int(ret_val);
|
||||
call_tests++;
|
||||
des_unsigned_char_ptr(n_out, out, 0);
|
||||
des_int_ptr(n_outlen, outlen, 1);
|
||||
des_const_unsigned_char_ptr(n_in, in, 2);
|
||||
des_int_ptr(n_inlen, inlen, 3);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in xmlIsolat1ToUTF8",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_out);
|
||||
printf(" %d", n_outlen);
|
||||
printf(" %d", n_in);
|
||||
printf(" %d", n_inlen);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlLookupCharEncodingHandler(void) {
|
||||
int test_ret = 0;
|
||||
@ -8542,13 +8485,66 @@ test_xmlRegisterCharEncodingHandler(void) {
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlUTF8ToIsolat1(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_OUTPUT_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
unsigned char * out; /* a pointer to an array of bytes to store the result */
|
||||
int n_out;
|
||||
int * outlen; /* the length of @out */
|
||||
int n_outlen;
|
||||
const unsigned char * in; /* a pointer to an array of UTF-8 chars */
|
||||
int n_in;
|
||||
int * inlen; /* the length of @in */
|
||||
int n_inlen;
|
||||
|
||||
for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
|
||||
for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
|
||||
for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
|
||||
for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
out = gen_unsigned_char_ptr(n_out, 0);
|
||||
outlen = gen_int_ptr(n_outlen, 1);
|
||||
in = gen_const_unsigned_char_ptr(n_in, 2);
|
||||
inlen = gen_int_ptr(n_inlen, 3);
|
||||
|
||||
ret_val = xmlUTF8ToIsolat1(out, outlen, in, inlen);
|
||||
desret_int(ret_val);
|
||||
call_tests++;
|
||||
des_unsigned_char_ptr(n_out, out, 0);
|
||||
des_int_ptr(n_outlen, outlen, 1);
|
||||
des_const_unsigned_char_ptr(n_in, in, 2);
|
||||
des_int_ptr(n_inlen, inlen, 3);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in xmlUTF8ToIsolat1",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_out);
|
||||
printf(" %d", n_outlen);
|
||||
printf(" %d", n_in);
|
||||
printf(" %d", n_inlen);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
#endif
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
static int
|
||||
test_encoding(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
if (quiet == 0) printf("Testing encoding : 16 of 22 functions ...\n");
|
||||
test_ret += test_UTF8Toisolat1();
|
||||
test_ret += test_isolat1ToUTF8();
|
||||
test_ret += test_xmlAddEncodingAlias();
|
||||
test_ret += test_xmlCharEncCloseFunc();
|
||||
test_ret += test_xmlCharEncFirstLine();
|
||||
@ -8564,11 +8560,13 @@ test_encoding(void) {
|
||||
test_ret += test_xmlGetCharEncodingName();
|
||||
test_ret += test_xmlGetEncodingAlias();
|
||||
test_ret += test_xmlInitCharEncodingHandlers();
|
||||
test_ret += test_xmlIsolat1ToUTF8();
|
||||
test_ret += test_xmlLookupCharEncodingHandler();
|
||||
test_ret += test_xmlNewCharEncodingHandler();
|
||||
test_ret += test_xmlOpenCharEncodingHandler();
|
||||
test_ret += test_xmlParseCharEncoding();
|
||||
test_ret += test_xmlRegisterCharEncodingHandler();
|
||||
test_ret += test_xmlUTF8ToIsolat1();
|
||||
|
||||
if (test_ret != 0)
|
||||
printf("Module encoding: %d errors\n", test_ret);
|
||||
@ -13240,7 +13238,7 @@ test_xmlNewInputFromFd(void) {
|
||||
int n_url;
|
||||
int fd; /* file descriptor */
|
||||
int n_fd;
|
||||
int flags; /* unused, pass 0 */
|
||||
int flags; /* input flags */
|
||||
int n_flags;
|
||||
|
||||
for (n_url = 0;n_url < gen_nb_filepath;n_url++) {
|
||||
@ -17525,7 +17523,7 @@ test_pattern(void) {
|
||||
printf("Module pattern: %d errors\n", test_ret);
|
||||
return(test_ret);
|
||||
}
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
|
||||
#define gen_nb_xmlRelaxNGPtr 1
|
||||
#define gen_xmlRelaxNGPtr(no, nr) NULL
|
||||
@ -34483,7 +34481,7 @@ static int
|
||||
test_xmlSchemaDump(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
|
||||
int mem_base;
|
||||
FILE * output; /* the file output */
|
||||
int n_output;
|
||||
@ -35217,7 +35215,7 @@ test_xmlSchemaValidateStream(void) {
|
||||
int n_input;
|
||||
xmlCharEncoding enc; /* an optional encoding information */
|
||||
int n_enc;
|
||||
xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
|
||||
const xmlSAXHandler * sax; /* a SAX handler for the resulting events */
|
||||
int n_sax;
|
||||
void * user_data; /* the context to provide to the SAX handler. */
|
||||
int n_user_data;
|
||||
@ -35225,13 +35223,13 @@ test_xmlSchemaValidateStream(void) {
|
||||
for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
|
||||
for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
|
||||
for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
|
||||
for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
|
||||
for (n_sax = 0;n_sax < gen_nb_const_xmlSAXHandler_ptr;n_sax++) {
|
||||
for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
|
||||
input = gen_xmlParserInputBufferPtr(n_input, 1);
|
||||
enc = gen_xmlCharEncoding(n_enc, 2);
|
||||
sax = gen_xmlSAXHandlerPtr(n_sax, 3);
|
||||
sax = gen_const_xmlSAXHandler_ptr(n_sax, 3);
|
||||
user_data = gen_userdata(n_user_data, 4);
|
||||
|
||||
ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
|
||||
@ -35240,7 +35238,7 @@ test_xmlSchemaValidateStream(void) {
|
||||
des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
|
||||
des_xmlParserInputBufferPtr(n_input, input, 1);
|
||||
des_xmlCharEncoding(n_enc, enc, 2);
|
||||
des_xmlSAXHandlerPtr(n_sax, sax, 3);
|
||||
des_const_xmlSAXHandler_ptr(n_sax, sax, 3);
|
||||
des_userdata(n_user_data, user_data, 4);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user