[xml] "opening" default protocol callbacks from xmlIO.c



Please find attached the patch I proposed in [1]. Let me know if you'll have
any problems with it. I am going to check it in sometime tomorrow.

Aleksey.


[1] http://mail.gnome.org/archives/xml/2002-April/msg00242.html
Index: xmlIO.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/xmlIO.c,v
retrieving revision 1.80
diff -c -r1.80 xmlIO.c
*** xmlIO.c     26 Mar 2002 12:44:39 -0000      1.80
--- xmlIO.c     30 Apr 2002 17:00:19 -0000
***************
*** 268,274 ****
   *
   * Returns 1 if matches, 0 otherwise
   */
! static int
  xmlFileMatch (const char *filename ATTRIBUTE_UNUSED) {
      return(1);
  }
--- 268,274 ----
   *
   * Returns 1 if matches, 0 otherwise
   */
! int
  xmlFileMatch (const char *filename ATTRIBUTE_UNUSED) {
      return(1);
  }
***************
*** 282,288 ****
   *
   * Returns an I/O context or NULL in case of error
   */
! static void *
  xmlFileOpen (const char *filename) {
      const char *path = NULL;
      FILE *fd;
--- 282,288 ----
   *
   * Returns an I/O context or NULL in case of error
   */
! void *
  xmlFileOpen (const char *filename) {
      const char *path = NULL;
      FILE *fd;
***************
*** 363,369 ****
   *
   * Returns the number of bytes written
   */
! static int
  xmlFileRead (void * context, char * buffer, int len) {
      return(fread(&buffer[0], 1,  len, (FILE *) context));
  }
--- 363,369 ----
   *
   * Returns the number of bytes written
   */
! int
  xmlFileRead (void * context, char * buffer, int len) {
      return(fread(&buffer[0], 1,  len, (FILE *) context));
  }
***************
*** 389,395 ****
   *
   * Close an I/O channel
   */
! static int
  xmlFileClose (void * context) {
      FILE *fil;
  
--- 389,395 ----
   *
   * Close an I/O channel
   */
! int
  xmlFileClose (void * context) {
      FILE *fil;
  
***************
*** 931,937 ****
   *
   * Returns 1 if matches, 0 otherwise
   */
! static int
  xmlIOHTTPMatch (const char *filename) {
      if (!strncmp(filename, "http://";, 7))
        return(1);
--- 931,937 ----
   *
   * Returns 1 if matches, 0 otherwise
   */
! int
  xmlIOHTTPMatch (const char *filename) {
      if (!strncmp(filename, "http://";, 7))
        return(1);
***************
*** 946,952 ****
   *
   * Returns an I/O context or NULL in case of error
   */
! static void *
  xmlIOHTTPOpen (const char *filename) {
      return(xmlNanoHTTPOpen(filename, NULL));
  }
--- 946,952 ----
   *
   * Returns an I/O context or NULL in case of error
   */
! void *
  xmlIOHTTPOpen (const char *filename) {
      return(xmlNanoHTTPOpen(filename, NULL));
  }
***************
*** 1040,1046 ****
   *
   * Returns the number of bytes written
   */
! static int 
  xmlIOHTTPRead(void * context, char * buffer, int len) {
      return(xmlNanoHTTPRead(context, &buffer[0], len));
  }
--- 1040,1046 ----
   *
   * Returns the number of bytes written
   */
! int 
  xmlIOHTTPRead(void * context, char * buffer, int len) {
      return(xmlNanoHTTPRead(context, &buffer[0], len));
  }
***************
*** 1096,1102 ****
   *
   * Close an HTTP I/O channel
   */
! static int
  xmlIOHTTPClose (void * context) {
      xmlNanoHTTPClose(context);
      return 0;
--- 1096,1102 ----
   *
   * Close an HTTP I/O channel
   */
! int
  xmlIOHTTPClose (void * context) {
      xmlNanoHTTPClose(context);
      return 0;
***************
*** 1275,1281 ****
   *
   * Returns 1 if matches, 0 otherwise
   */
! static int
  xmlIOFTPMatch (const char *filename) {
      if (!strncmp(filename, "ftp://";, 6))
        return(1);
--- 1275,1281 ----
   *
   * Returns 1 if matches, 0 otherwise
   */
! int
  xmlIOFTPMatch (const char *filename) {
      if (!strncmp(filename, "ftp://";, 6))
        return(1);
***************
*** 1290,1296 ****
   *
   * Returns an I/O context or NULL in case of error
   */
! static void *
  xmlIOFTPOpen (const char *filename) {
      return(xmlNanoFTPOpen(filename));
  }
--- 1290,1296 ----
   *
   * Returns an I/O context or NULL in case of error
   */
! void *
  xmlIOFTPOpen (const char *filename) {
      return(xmlNanoFTPOpen(filename));
  }
***************
*** 1305,1311 ****
   *
   * Returns the number of bytes written
   */
! static int 
  xmlIOFTPRead(void * context, char * buffer, int len) {
      return(xmlNanoFTPRead(context, &buffer[0], len));
  }
--- 1305,1311 ----
   *
   * Returns the number of bytes written
   */
! int 
  xmlIOFTPRead(void * context, char * buffer, int len) {
      return(xmlNanoFTPRead(context, &buffer[0], len));
  }
***************
*** 1316,1322 ****
   *
   * Close an FTP I/O channel
   */
! static int
  xmlIOFTPClose (void * context) {
      return ( xmlNanoFTPClose(context) );
  }
--- 1316,1322 ----
   *
   * Close an FTP I/O channel
   */
! int
  xmlIOFTPClose (void * context) {
      return ( xmlNanoFTPClose(context) );
  }
Index: include/libxml/xmlIO.h
===================================================================
RCS file: /cvs/gnome/gnome-xml/include/libxml/xmlIO.h,v
retrieving revision 1.35
diff -c -r1.35 xmlIO.h
*** include/libxml/xmlIO.h      12 Apr 2002 21:03:34 -0000      1.35
--- include/libxml/xmlIO.h      30 Apr 2002 17:00:19 -0000
***************
*** 252,257 ****
--- 252,292 ----
                                         const char *ID,
                                         xmlParserCtxtPtr ctxt);
  
+ 
+ /**
+  * Default 'file://' protocol callbacks 
+  */
+ int   xmlFileMatch                    (const char *filename);
+ void *        xmlFileOpen                     (const char *filename);
+ int   xmlFileRead                     (void * context, 
+                                        char * buffer, 
+                                        int len);
+ int   xmlFileClose                    (void * context);
+ 
+ /**
+  * Default 'http://' protocol callbacks 
+  */
+ #ifdef LIBXML_HTTP_ENABLED
+ int   xmlIOHTTPMatch                  (const char *filename);
+ void *        xmlIOHTTPOpen                   (const char *filename);
+ int   xmlIOHTTPRead                   (void * context, 
+                                        char * buffer, 
+                                        int len);
+ int   xmlIOHTTPClose                  (void * context);
+ #endif /* LIBXML_HTTP_ENABLED */
+ 
+ /**
+  * Default 'ftp://' protocol callbacks 
+  */
+ #ifdef LIBXML_FTP_ENABLED 
+ int   xmlIOFTPMatch                   (const char *filename);
+ void *        xmlIOFTPOpen                    (const char *filename);
+ int   xmlIOFTPRead                    (void * context, 
+                                        char * buffer, 
+                                        int len);
+ int   xmlIOFTPClose                   (void * context);
+ #endif /* LIBXML_FTP_ENABLED */
+ 
  #ifdef __cplusplus
  }
  #endif
Index: win32/libxml2.def.src
===================================================================
RCS file: /cvs/gnome/gnome-xml/win32/libxml2.def.src,v
retrieving revision 1.2
diff -c -r1.2 libxml2.def.src
*** win32/libxml2.def.src       16 Apr 2002 17:47:01 -0000      1.2
--- win32/libxml2.def.src       30 Apr 2002 17:00:19 -0000
***************
*** 1081,1086 ****
--- 1081,1113 ----
        #endif /* LIBXML_HTTP_ENABLED */
        xmlNoNetExternalEntityLoader
  
+       /**
+        * Default 'file://' protocol callbacks 
+        */
+       xmlFileMatch
+       xmlFileOpen 
+       xmlFileRead 
+       xmlFileClose
+ 
+       /**
+        * Default 'http://' protocol callbacks 
+        */
+       #ifdef LIBXML_HTTP_ENABLED
+       xmlIOHTTPMatch
+       xmlIOHTTPOpen 
+       xmlIOHTTPRead
+         xmlIOHTTPClose
+       #endif /* LIBXML_HTTP_ENABLED */
+ 
+       /**
+        * Default 'ftp://' protocol callbacks 
+        */
+       #ifdef LIBXML_FTP_ENABLED 
+       xmlIOFTPMatch 
+       xmlIOFTPOpen 
+       xmlIOFTPRead
+       xmlIOFTPClose
+       #endif /* LIBXML_FTP_ENABLED */
  
  /* xmlmemory.h 
     --------------------------------------------------------------------- */
Index: win32/dsp/libxml2.def.src
===================================================================
RCS file: /cvs/gnome/gnome-xml/win32/dsp/libxml2.def.src,v
retrieving revision 1.10
diff -c -r1.10 libxml2.def.src
*** win32/dsp/libxml2.def.src   24 Mar 2002 20:56:09 -0000      1.10
--- win32/dsp/libxml2.def.src   30 Apr 2002 17:00:19 -0000
***************
*** 1062,1067 ****
--- 1062,1095 ----
        #endif /* LIBXML_HTTP_ENABLED */
        xmlNoNetExternalEntityLoader
  
+       /**
+        * Default 'file://' protocol callbacks 
+        */
+       xmlFileMatch
+       xmlFileOpen 
+       xmlFileRead 
+       xmlFileClose
+ 
+       /**
+        * Default 'http://' protocol callbacks 
+        */
+       #ifdef LIBXML_HTTP_ENABLED
+       xmlIOHTTPMatch
+       xmlIOHTTPOpen 
+       xmlIOHTTPRead
+         xmlIOHTTPClose
+       #endif /* LIBXML_HTTP_ENABLED */
+ 
+       /**
+        * Default 'ftp://' protocol callbacks 
+        */
+       #ifdef LIBXML_FTP_ENABLED 
+       xmlIOFTPMatch 
+       xmlIOFTPOpen 
+       xmlIOFTPRead
+       xmlIOFTPClose
+       #endif /* LIBXML_FTP_ENABLED */
+ 
  
  /* xmlmemory.h 
     --------------------------------------------------------------------- */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]