summaryrefslogtreecommitdiff
path: root/xmlIO.c
diff options
context:
space:
mode:
authorRaphaël Hertzog <hertzog@debian.org>2015-08-25 21:55:54 +0200
committerRaphaël Hertzog <hertzog@debian.org>2015-08-25 21:55:54 +0200
commit7300193becde71a344c8ac0973dc290fa24d800d (patch)
tree6490c364e7764294c209e536d42f3d31d23ebc0d /xmlIO.c
parent3871a83a5f0aebd8c00879eab14fe901c93dbfcf (diff)
downloadlibxml2-7300193becde71a344c8ac0973dc290fa24d800d.tar.gz
Imported Upstream version 2.9.1+dfsg1
Diffstat (limited to 'xmlIO.c')
-rw-r--r--xmlIO.c47
1 files changed, 8 insertions, 39 deletions
diff --git a/xmlIO.c b/xmlIO.c
index e628ab0..847cb7e 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -800,13 +800,6 @@ xmlCheckFilename (const char *path)
return 1;
}
-/**
- * xmlNop:
- *
- * No Operation function, does nothing, no input
- *
- * Returns zero
- */
int
xmlNop(void) {
return(0);
@@ -894,7 +887,7 @@ xmlFileMatch (const char *filename ATTRIBUTE_UNUSED) {
*/
static void *
xmlFileOpen_real (const char *filename) {
- const char *path = filename;
+ const char *path = NULL;
FILE *fd;
if (filename == NULL)
@@ -924,8 +917,11 @@ xmlFileOpen_real (const char *filename) {
#else
path = &filename[5];
#endif
- }
+ } else
+ path = filename;
+ if (path == NULL)
+ return(NULL);
if (!xmlCheckFilename(path))
return(NULL);
@@ -1163,12 +1159,7 @@ xmlGzfileOpen_real (const char *filename) {
gzFile fd;
if (!strcmp(filename, "-")) {
- int duped_fd = dup(fileno(stdin));
- fd = gzdopen(duped_fd, "rb");
- if (fd == Z_NULL && duped_fd >= 0) {
- close(duped_fd); /* gzdOpen() does not close on failure */
- }
-
+ fd = gzdopen(dup(0), "rb");
return((void *) fd);
}
@@ -1242,12 +1233,7 @@ xmlGzfileOpenW (const char *filename, int compression) {
snprintf(mode, sizeof(mode), "wb%d", compression);
if (!strcmp(filename, "-")) {
- int duped_fd = dup(fileno(stdout));
- fd = gzdopen(duped_fd, "rb");
- if (fd == Z_NULL && duped_fd >= 0) {
- close(duped_fd); /* gzdOpen() does not close on failure */
- }
-
+ fd = gzdopen(dup(1), mode);
return((void *) fd);
}
@@ -1369,7 +1355,7 @@ xmlXzfileOpen_real (const char *filename) {
xzFile fd;
if (!strcmp(filename, "-")) {
- fd = __libxml2_xzdopen(dup(fileno(stdin)), "rb");
+ fd = __libxml2_xzdopen(dup(0), "rb");
return((void *) fd);
}
@@ -2683,12 +2669,6 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
#endif
}
#endif
-#ifdef HAVE_LZMA_H
- if ((xmlInputCallbackTable[i].opencallback == xmlXzfileOpen) &&
- (strcmp(URI, "-") != 0)) {
- ret->compressed = __libxml2_xzcompressed(context);
- }
-#endif
}
else
xmlInputCallbackTable[i].closecallback (context);
@@ -3345,17 +3325,6 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
if (res < 0) {
return(-1);
}
-
- /*
- * try to establish compressed status of input if not done already
- */
- if (in->compressed == -1) {
-#ifdef HAVE_LZMA_H
- if (in->readcallback == xmlXzfileRead)
- in->compressed = __libxml2_xzcompressed(in->context);
-#endif
- }
-
len = res;
if (in->encoder != NULL) {
unsigned int use;