io: Pass input flags to xmlParserInputBufferCreateUrl

This commit is contained in:
Nick Wellnhofer 2024-06-10 23:57:52 +02:00
parent b5890cb425
commit 1432949d3c
3 changed files with 14 additions and 11 deletions

View File

@ -12,8 +12,8 @@ XML_HIDDEN int
xmlNoNetExists(const char *filename);
XML_HIDDEN int
xmlParserInputBufferCreateFilenameInt(const char *URI, xmlCharEncoding enc,
xmlParserInputBufferPtr *out);
xmlParserInputBufferCreateUrl(const char *URI, xmlCharEncoding enc,
int flags, xmlParserInputBufferPtr *out);
XML_HIDDEN xmlParserInputBufferPtr
xmlNewInputBufferString(const char *str, int flags);

View File

@ -2050,8 +2050,8 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
if (buf == NULL)
code = XML_IO_ENOENT;
} else {
code = xmlParserInputBufferCreateFilenameInt(filename,
XML_CHAR_ENCODING_NONE, &buf);
code = xmlParserInputBufferCreateUrl(filename, XML_CHAR_ENCODING_NONE,
0, &buf);
}
if (code != XML_ERR_OK) {
xmlCtxtErrIO(ctxt, code, filename);

17
xmlIO.c
View File

@ -1100,11 +1100,13 @@ xmlIODefaultMatch(const char *filename ATTRIBUTE_UNUSED) {
* xmlInputDefaultOpen:
* @buf: input buffer to be filled
* @filename: filename or URI
* @flags: XML_INPUT flags
*
* Returns an xmlParserErrors code.
*/
static int
xmlInputDefaultOpen(xmlParserInputBufferPtr buf, const char *filename) {
xmlInputDefaultOpen(xmlParserInputBufferPtr buf, const char *filename,
int flags ATTRIBUTE_UNUSED) {
int ret;
int fd;
@ -1496,16 +1498,17 @@ xmlOutputBufferClose(xmlOutputBufferPtr out)
#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlParserInputBufferCreateFilenameInt:
* xmlParserInputBufferCreateUrl:
* @URI: the filename or URI
* @enc: encoding enum (deprecated)
* @flags: XML_INPUT flags
* @out: pointer to resulting input buffer
*
* Returns an xmlParserErrors code.
*/
int
xmlParserInputBufferCreateFilenameInt(const char *URI, xmlCharEncoding enc,
xmlParserInputBufferPtr *out) {
xmlParserInputBufferCreateUrl(const char *URI, xmlCharEncoding enc,
int flags, xmlParserInputBufferPtr *out) {
xmlParserInputBufferPtr buf;
int ret;
int i;
@ -1530,7 +1533,7 @@ xmlParserInputBufferCreateFilenameInt(const char *URI, xmlCharEncoding enc,
xmlInputCallback *cb = &xmlInputCallbackTable[i];
if (cb->matchcallback == xmlIODefaultMatch) {
ret = xmlInputDefaultOpen(buf, URI);
ret = xmlInputDefaultOpen(buf, URI, flags);
if ((ret == XML_ERR_OK) || (ret != XML_IO_ENOENT))
break;
@ -1559,7 +1562,7 @@ xmlParserInputBufferPtr
__xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
xmlParserInputBufferCreateFilenameInt(URI, enc, &ret);
xmlParserInputBufferCreateUrl(URI, enc, 0, &ret);
return(ret);
}
@ -1582,7 +1585,7 @@ xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
if (xmlParserInputBufferCreateFilenameValue != NULL)
return(xmlParserInputBufferCreateFilenameValue(URI, enc));
xmlParserInputBufferCreateFilenameInt(URI, enc, &ret);
xmlParserInputBufferCreateUrl(URI, enc, 0, &ret);
return(ret);
}