mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +03:00
io: Remove xmlParserInputBufferCreateFilenameSafe
This commit is contained in:
@@ -12,8 +12,8 @@ XML_HIDDEN int
|
|||||||
xmlNoNetExists(const char *filename);
|
xmlNoNetExists(const char *filename);
|
||||||
|
|
||||||
XML_HIDDEN int
|
XML_HIDDEN int
|
||||||
xmlParserInputBufferCreateFilenameSafe(const char *URI, xmlCharEncoding enc,
|
xmlParserInputBufferCreateFilenameInt(const char *URI, xmlCharEncoding enc,
|
||||||
xmlParserInputBufferPtr *out);
|
xmlParserInputBufferPtr *out);
|
||||||
|
|
||||||
XML_HIDDEN xmlParserInputBufferPtr
|
XML_HIDDEN xmlParserInputBufferPtr
|
||||||
xmlNewInputBufferString(const char *str, int flags);
|
xmlNewInputBufferString(const char *str, int flags);
|
||||||
|
|||||||
@@ -2039,14 +2039,21 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
|
|||||||
xmlParserInputPtr inputStream;
|
xmlParserInputPtr inputStream;
|
||||||
const xmlChar *URI;
|
const xmlChar *URI;
|
||||||
xmlChar *canonic;
|
xmlChar *canonic;
|
||||||
int code;
|
int code = XML_ERR_OK;
|
||||||
|
|
||||||
if ((ctxt == NULL) || (filename == NULL))
|
if ((ctxt == NULL) || (filename == NULL))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
code = xmlParserInputBufferCreateFilenameSafe(filename,
|
if (xmlParserInputBufferCreateFilenameValue != NULL) {
|
||||||
XML_CHAR_ENCODING_NONE, &buf);
|
buf = xmlParserInputBufferCreateFilenameValue(filename,
|
||||||
if (buf == NULL) {
|
XML_CHAR_ENCODING_NONE);
|
||||||
|
if (buf == NULL)
|
||||||
|
code = XML_IO_ENOENT;
|
||||||
|
} else {
|
||||||
|
code = xmlParserInputBufferCreateFilenameInt(filename,
|
||||||
|
XML_CHAR_ENCODING_NONE, &buf);
|
||||||
|
}
|
||||||
|
if (code != XML_ERR_OK) {
|
||||||
xmlCtxtErrIO(ctxt, code, filename);
|
xmlCtxtErrIO(ctxt, code, filename);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
31
xmlIO.c
31
xmlIO.c
@@ -1503,7 +1503,7 @@ xmlOutputBufferClose(xmlOutputBufferPtr out)
|
|||||||
*
|
*
|
||||||
* Returns an xmlParserErrors code.
|
* Returns an xmlParserErrors code.
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
xmlParserInputBufferCreateFilenameInt(const char *URI, xmlCharEncoding enc,
|
xmlParserInputBufferCreateFilenameInt(const char *URI, xmlCharEncoding enc,
|
||||||
xmlParserInputBufferPtr *out) {
|
xmlParserInputBufferPtr *out) {
|
||||||
xmlParserInputBufferPtr buf;
|
xmlParserInputBufferPtr buf;
|
||||||
@@ -1577,34 +1577,13 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
|
|||||||
*/
|
*/
|
||||||
xmlParserInputBufferPtr
|
xmlParserInputBufferPtr
|
||||||
xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
|
xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
|
||||||
|
xmlParserInputBufferPtr ret;
|
||||||
|
|
||||||
if (xmlParserInputBufferCreateFilenameValue != NULL)
|
if (xmlParserInputBufferCreateFilenameValue != NULL)
|
||||||
return(xmlParserInputBufferCreateFilenameValue(URI, enc));
|
return(xmlParserInputBufferCreateFilenameValue(URI, enc));
|
||||||
|
|
||||||
return(__xmlParserInputBufferCreateFilename(URI, enc));
|
xmlParserInputBufferCreateFilenameInt(URI, enc, &ret);
|
||||||
}
|
return(ret);
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlParserInputBufferCreateFilenameSafe:
|
|
||||||
* @URI: the filename or URI
|
|
||||||
* @enc: encoding enum (deprecated)
|
|
||||||
* @out: pointer to resulting input buffer
|
|
||||||
*
|
|
||||||
* Create an input buffer for a filename or URI.
|
|
||||||
*
|
|
||||||
* Returns an xmlParserErrors code.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xmlParserInputBufferCreateFilenameSafe(const char *URI, xmlCharEncoding enc,
|
|
||||||
xmlParserInputBufferPtr *out) {
|
|
||||||
if (xmlParserInputBufferCreateFilenameValue != NULL) {
|
|
||||||
*out = xmlParserInputBufferCreateFilenameValue(URI, enc);
|
|
||||||
|
|
||||||
if (*out == NULL)
|
|
||||||
return(XML_IO_ENOENT);
|
|
||||||
return(XML_ERR_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(xmlParserInputBufferCreateFilenameInt(URI, enc, out));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LIBXML_OUTPUT_ENABLED
|
#ifdef LIBXML_OUTPUT_ENABLED
|
||||||
|
|||||||
Reference in New Issue
Block a user