mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-09 04:58:16 +03:00
io: Remove xmlParserInputBufferCreateFilenameSafe
This commit is contained in:
parent
1b1e8b3c12
commit
b5890cb425
@ -12,8 +12,8 @@ XML_HIDDEN int
|
||||
xmlNoNetExists(const char *filename);
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlParserInputBufferCreateFilenameSafe(const char *URI, xmlCharEncoding enc,
|
||||
xmlParserInputBufferPtr *out);
|
||||
xmlParserInputBufferCreateFilenameInt(const char *URI, xmlCharEncoding enc,
|
||||
xmlParserInputBufferPtr *out);
|
||||
|
||||
XML_HIDDEN xmlParserInputBufferPtr
|
||||
xmlNewInputBufferString(const char *str, int flags);
|
||||
|
@ -2039,14 +2039,21 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
|
||||
xmlParserInputPtr inputStream;
|
||||
const xmlChar *URI;
|
||||
xmlChar *canonic;
|
||||
int code;
|
||||
int code = XML_ERR_OK;
|
||||
|
||||
if ((ctxt == NULL) || (filename == NULL))
|
||||
return(NULL);
|
||||
|
||||
code = xmlParserInputBufferCreateFilenameSafe(filename,
|
||||
XML_CHAR_ENCODING_NONE, &buf);
|
||||
if (buf == NULL) {
|
||||
if (xmlParserInputBufferCreateFilenameValue != NULL) {
|
||||
buf = xmlParserInputBufferCreateFilenameValue(filename,
|
||||
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);
|
||||
return(NULL);
|
||||
}
|
||||
|
31
xmlIO.c
31
xmlIO.c
@ -1503,7 +1503,7 @@ xmlOutputBufferClose(xmlOutputBufferPtr out)
|
||||
*
|
||||
* Returns an xmlParserErrors code.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
xmlParserInputBufferCreateFilenameInt(const char *URI, xmlCharEncoding enc,
|
||||
xmlParserInputBufferPtr *out) {
|
||||
xmlParserInputBufferPtr buf;
|
||||
@ -1577,34 +1577,13 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
|
||||
*/
|
||||
xmlParserInputBufferPtr
|
||||
xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
|
||||
xmlParserInputBufferPtr ret;
|
||||
|
||||
if (xmlParserInputBufferCreateFilenameValue != NULL)
|
||||
return(xmlParserInputBufferCreateFilenameValue(URI, enc));
|
||||
|
||||
return(__xmlParserInputBufferCreateFilename(URI, enc));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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));
|
||||
xmlParserInputBufferCreateFilenameInt(URI, enc, &ret);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
|
Loading…
x
Reference in New Issue
Block a user