Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: third_party/libxml/src/xmlIO.c

Issue 1752223002: Roll libxml to 2.9.3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-cherry-pick fprintf formatting fix. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * xmlIO.c : implementation of the I/O interfaces used by the parser 2 * xmlIO.c : implementation of the I/O interfaces used by the parser
3 * 3 *
4 * See Copyright for the status of this software. 4 * See Copyright for the status of this software.
5 * 5 *
6 * daniel@veillard.com 6 * daniel@veillard.com
7 * 7 *
8 * 14 Nov 2000 ht - for VMS, truncated name of long functions to under 32 char 8 * 14 Nov 2000 ht - for VMS, truncated name of long functions to under 32 char
9 */ 9 */
10 10
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 static int 1327 static int
1328 xmlGzfileClose (void * context) { 1328 xmlGzfileClose (void * context) {
1329 int ret; 1329 int ret;
1330 1330
1331 ret = (gzclose((gzFile) context) == Z_OK ) ? 0 : -1; 1331 ret = (gzclose((gzFile) context) == Z_OK ) ? 0 : -1;
1332 if (ret < 0) xmlIOErr(0, "gzclose()"); 1332 if (ret < 0) xmlIOErr(0, "gzclose()");
1333 return(ret); 1333 return(ret);
1334 } 1334 }
1335 #endif /* HAVE_ZLIB_H */ 1335 #endif /* HAVE_ZLIB_H */
1336 1336
1337 #ifdef HAVE_LZMA_H 1337 #ifdef LIBXML_LZMA_ENABLED
1338 /************************************************************************ 1338 /************************************************************************
1339 * * 1339 * *
1340 * I/O for compressed file accesses * 1340 * I/O for compressed file accesses *
1341 * * 1341 * *
1342 ************************************************************************/ 1342 ************************************************************************/
1343 #include "xzlib.h" 1343 #include "xzlib.h"
1344 /** 1344 /**
1345 * xmlXzfileMatch: 1345 * xmlXzfileMatch:
1346 * @filename: the URI for matching 1346 * @filename: the URI for matching
1347 * 1347 *
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 * Close a compressed I/O channel 1444 * Close a compressed I/O channel
1445 */ 1445 */
1446 static int 1446 static int
1447 xmlXzfileClose (void * context) { 1447 xmlXzfileClose (void * context) {
1448 int ret; 1448 int ret;
1449 1449
1450 ret = (__libxml2_xzclose((xzFile) context) == LZMA_OK ) ? 0 : -1; 1450 ret = (__libxml2_xzclose((xzFile) context) == LZMA_OK ) ? 0 : -1;
1451 if (ret < 0) xmlIOErr(0, "xzclose()"); 1451 if (ret < 0) xmlIOErr(0, "xzclose()");
1452 return(ret); 1452 return(ret);
1453 } 1453 }
1454 #endif /* HAVE_LZMA_H */ 1454 #endif /* LIBXML_LZMA_ENABLED */
1455 1455
1456 #ifdef LIBXML_HTTP_ENABLED 1456 #ifdef LIBXML_HTTP_ENABLED
1457 /************************************************************************ 1457 /************************************************************************
1458 * * 1458 * *
1459 * I/O for HTTP file accesses * 1459 * I/O for HTTP file accesses *
1460 * * 1460 * *
1461 ************************************************************************/ 1461 ************************************************************************/
1462 1462
1463 #ifdef LIBXML_OUTPUT_ENABLED 1463 #ifdef LIBXML_OUTPUT_ENABLED
1464 typedef struct xmlIOHTTPWriteCtxt_ 1464 typedef struct xmlIOHTTPWriteCtxt_
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) 2321 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
2322 xmlInitPlatformSpecificIo(); 2322 xmlInitPlatformSpecificIo();
2323 #endif 2323 #endif
2324 2324
2325 xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen, 2325 xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen,
2326 xmlFileRead, xmlFileClose); 2326 xmlFileRead, xmlFileClose);
2327 #ifdef HAVE_ZLIB_H 2327 #ifdef HAVE_ZLIB_H
2328 xmlRegisterInputCallbacks(xmlGzfileMatch, xmlGzfileOpen, 2328 xmlRegisterInputCallbacks(xmlGzfileMatch, xmlGzfileOpen,
2329 xmlGzfileRead, xmlGzfileClose); 2329 xmlGzfileRead, xmlGzfileClose);
2330 #endif /* HAVE_ZLIB_H */ 2330 #endif /* HAVE_ZLIB_H */
2331 #ifdef HAVE_LZMA_H 2331 #ifdef LIBXML_LZMA_ENABLED
2332 xmlRegisterInputCallbacks(xmlXzfileMatch, xmlXzfileOpen, 2332 xmlRegisterInputCallbacks(xmlXzfileMatch, xmlXzfileOpen,
2333 xmlXzfileRead, xmlXzfileClose); 2333 xmlXzfileRead, xmlXzfileClose);
2334 #endif /* HAVE_ZLIB_H */ 2334 #endif /* LIBXML_LZMA_ENABLED */
2335 2335
2336 #ifdef LIBXML_HTTP_ENABLED 2336 #ifdef LIBXML_HTTP_ENABLED
2337 xmlRegisterInputCallbacks(xmlIOHTTPMatch, xmlIOHTTPOpen, 2337 xmlRegisterInputCallbacks(xmlIOHTTPMatch, xmlIOHTTPOpen,
2338 xmlIOHTTPRead, xmlIOHTTPClose); 2338 xmlIOHTTPRead, xmlIOHTTPClose);
2339 #endif /* LIBXML_HTTP_ENABLED */ 2339 #endif /* LIBXML_HTTP_ENABLED */
2340 2340
2341 #ifdef LIBXML_FTP_ENABLED 2341 #ifdef LIBXML_FTP_ENABLED
2342 xmlRegisterInputCallbacks(xmlIOFTPMatch, xmlIOFTPOpen, 2342 xmlRegisterInputCallbacks(xmlIOFTPMatch, xmlIOFTPOpen,
2343 xmlIOFTPRead, xmlIOFTPClose); 2343 xmlIOFTPRead, xmlIOFTPClose);
2344 #endif /* LIBXML_FTP_ENABLED */ 2344 #endif /* LIBXML_FTP_ENABLED */
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 if (strncmp(buff4, cptr, 4) == 0) 2676 if (strncmp(buff4, cptr, 4) == 0)
2677 ret->compressed = 0; 2677 ret->compressed = 0;
2678 else 2678 else
2679 ret->compressed = 1; 2679 ret->compressed = 1;
2680 gzrewind(context); 2680 gzrewind(context);
2681 } 2681 }
2682 } 2682 }
2683 #endif 2683 #endif
2684 } 2684 }
2685 #endif 2685 #endif
2686 #ifdef HAVE_LZMA_H 2686 #ifdef LIBXML_LZMA_ENABLED
2687 if ((xmlInputCallbackTable[i].opencallback == xmlXzfileOpen) && 2687 if ((xmlInputCallbackTable[i].opencallback == xmlXzfileOpen) &&
2688 (strcmp(URI, "-") != 0)) { 2688 (strcmp(URI, "-") != 0)) {
2689 ret->compressed = __libxml2_xzcompressed(context); 2689 ret->compressed = __libxml2_xzcompressed(context);
2690 } 2690 }
2691 #endif 2691 #endif
2692 } 2692 }
2693 else 2693 else
2694 xmlInputCallbackTable[i].closecallback (context); 2694 xmlInputCallbackTable[i].closecallback (context);
2695 2695
2696 return(ret); 2696 return(ret);
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
3343 return(-1); 3343 return(-1);
3344 } 3344 }
3345 if (res < 0) { 3345 if (res < 0) {
3346 return(-1); 3346 return(-1);
3347 } 3347 }
3348 3348
3349 /* 3349 /*
3350 * try to establish compressed status of input if not done already 3350 * try to establish compressed status of input if not done already
3351 */ 3351 */
3352 if (in->compressed == -1) { 3352 if (in->compressed == -1) {
3353 #ifdef HAVE_LZMA_H 3353 #ifdef LIBXML_LZMA_ENABLED
3354 if (in->readcallback == xmlXzfileRead) 3354 if (in->readcallback == xmlXzfileRead)
3355 in->compressed = __libxml2_xzcompressed(in->context); 3355 in->compressed = __libxml2_xzcompressed(in->context);
3356 #endif 3356 #endif
3357 } 3357 }
3358 3358
3359 len = res; 3359 len = res;
3360 if (in->encoder != NULL) { 3360 if (in->encoder != NULL) {
3361 unsigned int use; 3361 unsigned int use;
3362 3362
3363 /* 3363 /*
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
4177 } 4177 }
4178 } 4178 }
4179 input = xmlDefaultExternalEntityLoader((const char *) resource, ID, ctxt); 4179 input = xmlDefaultExternalEntityLoader((const char *) resource, ID, ctxt);
4180 if (resource != (xmlChar *) URL) 4180 if (resource != (xmlChar *) URL)
4181 xmlFree(resource); 4181 xmlFree(resource);
4182 return(input); 4182 return(input);
4183 } 4183 }
4184 4184
4185 #define bottom_xmlIO 4185 #define bottom_xmlIO
4186 #include "elfgcchack.h" 4186 #include "elfgcchack.h"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698