Diff for /XML/xmlIO.c between versions 1.18 and 1.19

version 1.18, 2000/01/03 10:59:23 version 1.19, 2000/01/26 13:48:45
Line 39 Line 39
 #include "parserInternals.h"  #include "parserInternals.h"
 #include "xmlIO.h"  #include "xmlIO.h"
 #include "nanohttp.h"  #include "nanohttp.h"
   #include "nanoftp.h"
   
 /* #define DEBUG_INPUT */  /* #define DEBUG_INPUT */
 /* #define VERBOSE_FAILURE */  /* #define VERBOSE_FAILURE */
Line 76  xmlAllocParserInputBuffer(xmlCharEncodin Line 77  xmlAllocParserInputBuffer(xmlCharEncodin
     ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT;      ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT;
     ret->encoder = xmlGetCharEncodingHandler(enc);      ret->encoder = xmlGetCharEncodingHandler(enc);
     ret->fd = -1;      ret->fd = -1;
     ret->netIO = NULL;      ret->httpIO = NULL;
       ret->ftpIO = NULL;
   
     return(ret);      return(ret);
 }  }
Line 97  xmlFreeParserInputBuffer(xmlParserInputB Line 99  xmlFreeParserInputBuffer(xmlParserInputB
     if (in->gzfile != NULL)      if (in->gzfile != NULL)
         gzclose(in->gzfile);          gzclose(in->gzfile);
 #endif  #endif
     if (in->netIO != NULL)      if (in->httpIO != NULL)
         xmlNanoHTTPClose(in->netIO);          xmlNanoHTTPClose(in->httpIO);
       if (in->ftpIO != NULL)
           xmlNanoFTPClose(in->ftpIO);
     if (in->fd >= 0)      if (in->fd >= 0)
         close(in->fd);          close(in->fd);
     memset(in, 0xbe, (size_t) sizeof(xmlParserInputBuffer));      memset(in, 0xbe, (size_t) sizeof(xmlParserInputBuffer));
Line 125  xmlParserInputBufferCreateFilename(const Line 129  xmlParserInputBufferCreateFilename(const
 #else  #else
     int input = -1;      int input = -1;
 #endif  #endif
     void *netIO = NULL;      void *httpIO = NULL;
       void *ftpIO = NULL;
   
     if (filename == NULL) return(NULL);      if (filename == NULL) return(NULL);
   
     if (!strncmp(filename, "http://", 7)) {      if (!strncmp(filename, "http://", 7)) {
         netIO = xmlNanoHTTPOpen(filename, NULL);          httpIO = xmlNanoHTTPOpen(filename, NULL);
         if (netIO == NULL) {          if (httpIO == NULL) {
 #ifdef VERBOSE_FAILURE  #ifdef VERBOSE_FAILURE
             fprintf (stderr, "Cannot read URL %s\n", filename);              fprintf (stderr, "Cannot read URL %s\n", filename);
             perror ("xmlNanoHTTPOpen failed");              perror ("xmlNanoHTTPOpen failed");
 #endif  #endif
             return(NULL);              return(NULL);
         }          }
       } else if (!strncmp(filename, "ftp://", 6)) {
           ftpIO = xmlNanoFTPOpen(filename);
           if (ftpIO == NULL) {
   #ifdef VERBOSE_FAILURE
               fprintf (stderr, "Cannot read URL %s\n", filename);
               perror ("xmlNanoFTPOpen failed");
   #endif
               return(NULL);
           }
     } else if (!strcmp(filename, "-")) {      } else if (!strcmp(filename, "-")) {
 #ifdef HAVE_ZLIB_H  #ifdef HAVE_ZLIB_H
         input = gzdopen (fileno(stdin), "r");          input = gzdopen (fileno(stdin), "r");
Line 201  xmlParserInputBufferCreateFilename(const Line 215  xmlParserInputBufferCreateFilename(const
 #else  #else
         ret->fd = input;          ret->fd = input;
 #endif  #endif
         ret->netIO = netIO;          ret->httpIO = httpIO;
           ret->ftpIO = ftpIO;
     }      }
     xmlParserInputBufferRead(ret, 4);      xmlParserInputBufferRead(ret, 4);
   
Line 339  xmlParserInputBufferGrow(xmlParserInputB Line 354  xmlParserInputBufferGrow(xmlParserInputB
         fprintf(stderr, "xmlParserInputBufferGrow : out of memory !\n");          fprintf(stderr, "xmlParserInputBufferGrow : out of memory !\n");
         return(-1);          return(-1);
     }      }
     if (in->netIO != NULL) {      if (in->httpIO != NULL) {
         res = xmlNanoHTTPRead(in->netIO, &buffer[0], len);          res = xmlNanoHTTPRead(in->httpIO, &buffer[0], len);
       } else if (in->ftpIO != NULL) {
           res = xmlNanoFTPRead(in->ftpIO, &buffer[0], len);
     } else if (in->file != NULL) {      } else if (in->file != NULL) {
         res = fread(&buffer[0], 1, len, in->file);          res = fread(&buffer[0], 1, len, in->file);
 #ifdef HAVE_ZLIB_H  #ifdef HAVE_ZLIB_H
Line 405  xmlParserInputBufferGrow(xmlParserInputB Line 422  xmlParserInputBufferGrow(xmlParserInputB
 int  int
 xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len) {  xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len) {
     /* xmlBufferEmpty(in->buffer); */      /* xmlBufferEmpty(in->buffer); */
     if ((in->netIO != NULL) || (in->file != NULL) ||      if ((in->httpIO != NULL) || (in->ftpIO != NULL) || (in->file != NULL) ||
 #ifdef HAVE_ZLIB_H  #ifdef HAVE_ZLIB_H
         (in->gzfile != NULL) ||          (in->gzfile != NULL) ||
 #endif  #endif

Removed from v.1.18  
changed lines
  Added in v.1.19


Webmaster