tests: Don't use deprecated symbols

This commit is contained in:
Nick Wellnhofer 2023-09-20 15:49:03 +02:00
parent 692a5c40ce
commit 209516acbf
7 changed files with 10 additions and 105 deletions

View File

@ -184,18 +184,11 @@ parseGjobFile(char *filename ATTRIBUTE_UNUSED) {
xmlNsPtr ns;
xmlNodePtr cur;
#ifdef LIBXML_SAX1_ENABLED
/*
* build an XML tree from a the file;
*/
doc = xmlParseFile(filename);
doc = xmlReadFile(filename, NULL, XML_PARSE_NOBLANKS);
if (doc == NULL) return(NULL);
#else
/*
* the library has been compiled without some of the old interfaces
*/
return(NULL);
#endif /* LIBXML_SAX1_ENABLED */
/*
* Check the document is of the right kind
@ -291,7 +284,6 @@ int main(int argc, char **argv) {
/* COMPAT: Do not generate nodes for formatting spaces */
LIBXML_TEST_VERSION
xmlKeepBlanksDefault(0);
for (i = 1; i < argc ; i++) {
cur = parseGjobFile(argv[i]);

View File

@ -201,9 +201,6 @@ static xmlXPathContextPtr ctxtXPath;
static void
initializeLibxml2(void) {
xmlGetWarningsDefaultValue = 0;
xmlPedanticParserDefault(0);
xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);
xmlInitParser();
xmlSetExternalEntityLoader(testExternalEntityLoader);

View File

@ -558,7 +558,6 @@ initializeLibxml2(void) {
xmlMemStrdup = NULL;
xmlInitParser();
xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);
xmlPedanticParserDefault(0);
xmlSetExternalEntityLoader(testExternalEntityLoader);
xmlSetStructuredErrorFunc(NULL, testStructuredErrorHandler);
#ifdef LIBXML_SCHEMAS_ENABLED
@ -4065,9 +4064,6 @@ load_xpath_expr (xmlDocPtr parent_doc, const char* filename) {
/*
* load XPath expr as a file
*/
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
xmlSubstituteEntitiesDefault(1);
doc = xmlReadFile(filename, NULL, XML_PARSE_DTDATTR | XML_PARSE_NOENT);
if (doc == NULL) {
fprintf(stderr, "Error: unable to parse file \"%s\"\n", filename);
@ -4216,9 +4212,6 @@ c14nRunTest(const char* xml_filename, int with_comments, int mode,
* build an XML tree from a the file; we need to add default
* attributes and resolve all character and entities references
*/
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
xmlSubstituteEntitiesDefault(1);
doc = xmlReadFile(xml_filename, NULL, XML_PARSE_DTDATTR | XML_PARSE_NOENT);
if (doc == NULL) {
fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_filename);
@ -4391,13 +4384,6 @@ static xmlThreadParams threadParams[] = {
static const unsigned int num_threads = sizeof(threadParams) /
sizeof(threadParams[0]);
#ifndef xmlDoValidityCheckingDefaultValue
#error xmlDoValidityCheckingDefaultValue is not a macro
#endif
#ifndef xmlGenericErrorContext
#error xmlGenericErrorContext is not a macro
#endif
static void *
thread_specific_data(void *private_data)
{
@ -4406,43 +4392,13 @@ thread_specific_data(void *private_data)
const char *filename = params->filename;
int okay = 1;
if (!strcmp(filename, "test/threads/invalid.xml")) {
xmlDoValidityCheckingDefaultValue = 0;
xmlGenericErrorContext = stdout;
} else {
xmlDoValidityCheckingDefaultValue = 1;
xmlGenericErrorContext = stderr;
}
#ifdef LIBXML_SAX1_ENABLED
myDoc = xmlParseFile(filename);
#else
myDoc = xmlReadFile(filename, NULL, XML_WITH_CATALOG);
#endif
myDoc = xmlReadFile(filename, NULL, XML_PARSE_NOENT | XML_PARSE_DTDLOAD);
if (myDoc) {
xmlFreeDoc(myDoc);
} else {
printf("parse failed\n");
okay = 0;
}
if (!strcmp(filename, "test/threads/invalid.xml")) {
if (xmlDoValidityCheckingDefaultValue != 0) {
printf("ValidityCheckingDefaultValue override failed\n");
okay = 0;
}
if (xmlGenericErrorContext != stdout) {
printf("xmlGenericErrorContext override failed\n");
okay = 0;
}
} else {
if (xmlDoValidityCheckingDefaultValue != 1) {
printf("ValidityCheckingDefaultValue override failed\n");
okay = 0;
}
if (xmlGenericErrorContext != stderr) {
printf("xmlGenericErrorContext override failed\n");
okay = 0;
}
}
params->okay = okay;
return(NULL);
}

View File

@ -148,9 +148,6 @@ static xmlXPathContextPtr ctxtXPath;
static void
initializeLibxml2(void) {
xmlGetWarningsDefaultValue = 0;
xmlPedanticParserDefault(0);
xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);
xmlInitParser();
xmlSetExternalEntityLoader(testExternalEntityLoader);
@ -252,8 +249,10 @@ xmlconfTestNotNSWF(const char *id, const char *filename, int options) {
nb_errors++;
ret = 0;
} else {
if ((xmlLastError.code == XML_ERR_OK) ||
(xmlLastError.domain != XML_FROM_NAMESPACE)) {
xmlError *error = xmlGetLastError();
if ((error->code == XML_ERR_OK) ||
(error->domain != XML_FROM_NAMESPACE)) {
test_log("test %s : %s failed to detect namespace error\n",
id, filename);
nb_errors++;

View File

@ -43,13 +43,6 @@ static xmlThreadParams threadParams[] = {
static const unsigned int num_threads = sizeof(threadParams) /
sizeof(threadParams[0]);
#ifndef xmlDoValidityCheckingDefaultValue
#error xmlDoValidityCheckingDefaultValue is not a macro
#endif
#ifndef xmlGenericErrorContext
#error xmlGenericErrorContext is not a macro
#endif
static void *
thread_specific_data(void *private_data)
{
@ -57,6 +50,7 @@ thread_specific_data(void *private_data)
xmlThreadParams *params = (xmlThreadParams *) private_data;
const char *filename = params->filename;
int okay = 1;
int options = 0;
if (xmlCheckThreadLocalStorage() != 0) {
printf("xmlCheckThreadLocalStorage failed\n");
@ -64,43 +58,16 @@ thread_specific_data(void *private_data)
return(NULL);
}
if (!strcmp(filename, "test/threads/invalid.xml")) {
xmlDoValidityCheckingDefaultValue = 0;
xmlGenericErrorContext = stdout;
} else {
xmlDoValidityCheckingDefaultValue = 1;
xmlGenericErrorContext = stderr;
if (strcmp(filename, "test/threads/invalid.xml") != 0) {
options |= XML_PARSE_DTDVALID;
}
#ifdef LIBXML_SAX1_ENABLED
myDoc = xmlParseFile(filename);
#else
myDoc = xmlReadFile(filename, NULL, XML_WITH_CATALOG);
#endif
myDoc = xmlReadFile(filename, NULL, options);
if (myDoc) {
xmlFreeDoc(myDoc);
} else {
printf("parse failed\n");
okay = 0;
}
if (!strcmp(filename, "test/threads/invalid.xml")) {
if (xmlDoValidityCheckingDefaultValue != 0) {
printf("ValidityCheckingDefaultValue override failed\n");
okay = 0;
}
if (xmlGenericErrorContext != stdout) {
printf("xmlGenericErrorContext override failed\n");
okay = 0;
}
} else {
if (xmlDoValidityCheckingDefaultValue != 1) {
printf("ValidityCheckingDefaultValue override failed\n");
okay = 0;
}
if (xmlGenericErrorContext != stderr) {
printf("xmlGenericErrorContext override failed\n");
okay = 0;
}
}
params->okay = okay;
return(NULL);
}

View File

@ -659,9 +659,6 @@ testStructuredErrorHandler(void *ctx ATTRIBUTE_UNUSED, xmlErrorPtr err) {
static void
initializeLibxml2(void) {
xmlGetWarningsDefaultValue = 0;
xmlPedanticParserDefault(0);
xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);
xmlInitParser();
xmlSetExternalEntityLoader(testExternalEntityLoader);

View File

@ -627,9 +627,6 @@ testStructuredErrorHandler(void *ctx ATTRIBUTE_UNUSED, xmlErrorPtr err) {
static void
initializeLibxml2(void) {
xmlGetWarningsDefaultValue = 0;
xmlPedanticParserDefault(0);
xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);
xmlInitParser();
xmlSetExternalEntityLoader(testExternalEntityLoader);