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

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

Issue 2010803004: Roll libxml to bdec2183f34b37ee89ae1d330c6ad2bb4d76605f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update README.chromium Created 4 years, 7 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
« no previous file with comments | « third_party/libxml/src/xinclude.c ('k') | third_party/libxml/src/xmlmemory.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 return ( NULL ); 1597 return ( NULL );
1598 } 1598 }
1599 1599
1600 z_err = deflateInit2( &buff->zctrl, compression, Z_DEFLATED, 1600 z_err = deflateInit2( &buff->zctrl, compression, Z_DEFLATED,
1601 DFLT_WBITS, DFLT_MEM_LVL, Z_DEFAULT_STRATEGY ); 1601 DFLT_WBITS, DFLT_MEM_LVL, Z_DEFAULT_STRATEGY );
1602 if ( z_err != Z_OK ) { 1602 if ( z_err != Z_OK ) {
1603 xmlChar msg[500]; 1603 xmlChar msg[500];
1604 xmlFreeZMemBuff( buff ); 1604 xmlFreeZMemBuff( buff );
1605 buff = NULL; 1605 buff = NULL;
1606 xmlStrPrintf(msg, 500, 1606 xmlStrPrintf(msg, 500,
1607 » » (const xmlChar *) "xmlCreateZMemBuff: %s %d\n", 1607 » » "xmlCreateZMemBuff: %s %d\n",
1608 "Error initializing compression context. ZLIB error:", 1608 "Error initializing compression context. ZLIB error:",
1609 z_err ); 1609 z_err );
1610 xmlIOErr(XML_IO_WRITE, (const char *) msg); 1610 xmlIOErr(XML_IO_WRITE, (const char *) msg);
1611 return ( NULL ); 1611 return ( NULL );
1612 } 1612 }
1613 1613
1614 /* Set the header data. The CRC will be needed for the trailer */ 1614 /* Set the header data. The CRC will be needed for the trailer */
1615 buff->crc = crc32( 0L, NULL, 0 ); 1615 buff->crc = crc32( 0L, NULL, 0 );
1616 hdr_lgth = snprintf( (char *)buff->zbuff, buff->size, 1616 hdr_lgth = snprintf( (char *)buff->zbuff, buff->size,
1617 "%c%c%c%c%c%c%c%c%c%c", 1617 "%c%c%c%c%c%c%c%c%c%c",
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 if ( tmp_ptr != NULL ) { 1665 if ( tmp_ptr != NULL ) {
1666 rc = 0; 1666 rc = 0;
1667 buff->size = new_size; 1667 buff->size = new_size;
1668 buff->zbuff = tmp_ptr; 1668 buff->zbuff = tmp_ptr;
1669 buff->zctrl.next_out = tmp_ptr + cur_used; 1669 buff->zctrl.next_out = tmp_ptr + cur_used;
1670 buff->zctrl.avail_out = new_size - cur_used; 1670 buff->zctrl.avail_out = new_size - cur_used;
1671 } 1671 }
1672 else { 1672 else {
1673 xmlChar msg[500]; 1673 xmlChar msg[500];
1674 xmlStrPrintf(msg, 500, 1674 xmlStrPrintf(msg, 500,
1675 » » (const xmlChar *) "xmlZMemBuffExtend: %s %lu bytes.\n", 1675 » » "xmlZMemBuffExtend: %s %lu bytes.\n",
1676 "Allocation failure extending output buffer to", 1676 "Allocation failure extending output buffer to",
1677 new_size ); 1677 new_size );
1678 xmlIOErr(XML_IO_WRITE, (const char *) msg); 1678 xmlIOErr(XML_IO_WRITE, (const char *) msg);
1679 } 1679 }
1680 1680
1681 return ( rc ); 1681 return ( rc );
1682 } 1682 }
1683 1683
1684 /** 1684 /**
1685 * xmlZMemBuffAppend 1685 * xmlZMemBuffAppend
(...skipping 25 matching lines...) Expand all
1711 min_accept = buff->zctrl.avail_in / DFLT_ZLIB_RATIO; 1711 min_accept = buff->zctrl.avail_in / DFLT_ZLIB_RATIO;
1712 if ( buff->zctrl.avail_out <= min_accept ) { 1712 if ( buff->zctrl.avail_out <= min_accept ) {
1713 if ( xmlZMemBuffExtend( buff, buff->size ) == -1 ) 1713 if ( xmlZMemBuffExtend( buff, buff->size ) == -1 )
1714 return ( -1 ); 1714 return ( -1 );
1715 } 1715 }
1716 1716
1717 z_err = deflate( &buff->zctrl, Z_NO_FLUSH ); 1717 z_err = deflate( &buff->zctrl, Z_NO_FLUSH );
1718 if ( z_err != Z_OK ) { 1718 if ( z_err != Z_OK ) {
1719 xmlChar msg[500]; 1719 xmlChar msg[500];
1720 xmlStrPrintf(msg, 500, 1720 xmlStrPrintf(msg, 500,
1721 » » » (const xmlChar *) "xmlZMemBuffAppend: %s %d %s - %d", 1721 » » » "xmlZMemBuffAppend: %s %d %s - %d",
1722 "Compression error while appending", 1722 "Compression error while appending",
1723 len, "bytes to buffer. ZLIB error", z_err ); 1723 len, "bytes to buffer. ZLIB error", z_err );
1724 xmlIOErr(XML_IO_WRITE, (const char *) msg); 1724 xmlIOErr(XML_IO_WRITE, (const char *) msg);
1725 return ( -1 ); 1725 return ( -1 );
1726 } 1726 }
1727 } 1727 }
1728 1728
1729 buff->crc = crc32( buff->crc, (unsigned char *)src, len ); 1729 buff->crc = crc32( buff->crc, (unsigned char *)src, len );
1730 1730
1731 return ( len ); 1731 return ( len );
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 append_reverse_ulong( buff, buff->crc ); 1784 append_reverse_ulong( buff, buff->crc );
1785 append_reverse_ulong( buff, buff->zctrl.total_in ); 1785 append_reverse_ulong( buff, buff->zctrl.total_in );
1786 1786
1787 zlgth = buff->zctrl.next_out - buff->zbuff; 1787 zlgth = buff->zctrl.next_out - buff->zbuff;
1788 *data_ref = (char *)buff->zbuff; 1788 *data_ref = (char *)buff->zbuff;
1789 } 1789 }
1790 1790
1791 else { 1791 else {
1792 xmlChar msg[500]; 1792 xmlChar msg[500];
1793 xmlStrPrintf(msg, 500, 1793 xmlStrPrintf(msg, 500,
1794 » » (const xmlChar *) "xmlZMemBuffGetContent: %s - %d\n", 1794 » » "xmlZMemBuffGetContent: %s - %d\n",
1795 "Error flushing zlib buffers. Error code", z_err ); 1795 "Error flushing zlib buffers. Error code", z_err );
1796 xmlIOErr(XML_IO_WRITE, (const char *) msg); 1796 xmlIOErr(XML_IO_WRITE, (const char *) msg);
1797 } 1797 }
1798 1798
1799 return ( zlgth ); 1799 return ( zlgth );
1800 } 1800 }
1801 #endif /* LIBXML_OUTPUT_ENABLED */ 1801 #endif /* LIBXML_OUTPUT_ENABLED */
1802 #endif /* HAVE_ZLIB_H */ 1802 #endif /* HAVE_ZLIB_H */
1803 1803
1804 #ifdef LIBXML_OUTPUT_ENABLED 1804 #ifdef LIBXML_OUTPUT_ENABLED
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 if ( ctxt->compression > 0 ) 1989 if ( ctxt->compression > 0 )
1990 len = xmlZMemBuffAppend( ctxt->doc_buff, buffer, len ); 1990 len = xmlZMemBuffAppend( ctxt->doc_buff, buffer, len );
1991 1991
1992 else 1992 else
1993 #endif 1993 #endif
1994 len = xmlOutputBufferWrite( ctxt->doc_buff, len, buffer ); 1994 len = xmlOutputBufferWrite( ctxt->doc_buff, len, buffer );
1995 1995
1996 if ( len < 0 ) { 1996 if ( len < 0 ) {
1997 xmlChar msg[500]; 1997 xmlChar msg[500];
1998 xmlStrPrintf(msg, 500, 1998 xmlStrPrintf(msg, 500,
1999 » » » (const xmlChar *) "xmlIOHTTPWrite: %s\n%s '%s'.\n", 1999 » » » "xmlIOHTTPWrite: %s\n%s '%s'.\n",
2000 "Error appending to internal buffer.", 2000 "Error appending to internal buffer.",
2001 "Error sending document to URI", 2001 "Error sending document to URI",
2002 ctxt->uri ); 2002 ctxt->uri );
2003 xmlIOErr(XML_IO_WRITE, (const char *) msg); 2003 xmlIOErr(XML_IO_WRITE, (const char *) msg);
2004 } 2004 }
2005 } 2005 }
2006 2006
2007 return ( len ); 2007 return ( len );
2008 } 2008 }
2009 #endif /* LIBXML_OUTPUT_ENABLED */ 2009 #endif /* LIBXML_OUTPUT_ENABLED */
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2061 /* Pull the data out of the memory output buffer */ 2061 /* Pull the data out of the memory output buffer */
2062 2062
2063 xmlOutputBufferPtr dctxt = ctxt->doc_buff; 2063 xmlOutputBufferPtr dctxt = ctxt->doc_buff;
2064 http_content = (char *) xmlBufContent(dctxt->buffer); 2064 http_content = (char *) xmlBufContent(dctxt->buffer);
2065 content_lgth = xmlBufUse(dctxt->buffer); 2065 content_lgth = xmlBufUse(dctxt->buffer);
2066 } 2066 }
2067 2067
2068 if ( http_content == NULL ) { 2068 if ( http_content == NULL ) {
2069 xmlChar msg[500]; 2069 xmlChar msg[500];
2070 xmlStrPrintf(msg, 500, 2070 xmlStrPrintf(msg, 500,
2071 » » (const xmlChar *) "xmlIOHTTPCloseWrite: %s '%s' %s '%s'.\n ", 2071 » » "xmlIOHTTPCloseWrite: %s '%s' %s '%s'.\n",
2072 "Error retrieving content.\nUnable to", 2072 "Error retrieving content.\nUnable to",
2073 http_mthd, "data to URI", ctxt->uri ); 2073 http_mthd, "data to URI", ctxt->uri );
2074 xmlIOErr(XML_IO_WRITE, (const char *) msg); 2074 xmlIOErr(XML_IO_WRITE, (const char *) msg);
2075 } 2075 }
2076 2076
2077 else { 2077 else {
2078 2078
2079 http_ctxt = xmlNanoHTTPMethod( ctxt->uri, http_mthd, http_content, 2079 http_ctxt = xmlNanoHTTPMethod( ctxt->uri, http_mthd, http_content,
2080 &content_type, content_encoding, 2080 &content_type, content_encoding,
2081 content_lgth ); 2081 content_lgth );
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 free( dump_name ); 2133 free( dump_name );
2134 } 2134 }
2135 #endif /* DEBUG_HTTP */ 2135 #endif /* DEBUG_HTTP */
2136 2136
2137 http_rtn = xmlNanoHTTPReturnCode( http_ctxt ); 2137 http_rtn = xmlNanoHTTPReturnCode( http_ctxt );
2138 if ( ( http_rtn >= 200 ) && ( http_rtn < 300 ) ) 2138 if ( ( http_rtn >= 200 ) && ( http_rtn < 300 ) )
2139 close_rc = 0; 2139 close_rc = 0;
2140 else { 2140 else {
2141 xmlChar msg[500]; 2141 xmlChar msg[500];
2142 xmlStrPrintf(msg, 500, 2142 xmlStrPrintf(msg, 500,
2143 (const xmlChar *) "xmlIOHTTPCloseWrite: HTTP '%s' of %d %s\n'%s' %s %d\n", 2143 "xmlIOHTTPCloseWrite: HTTP '%s' of %d %s\n'%s' %s %d\n",
2144 http_mthd, content_lgth, 2144 http_mthd, content_lgth,
2145 "bytes to URI", ctxt->uri, 2145 "bytes to URI", ctxt->uri,
2146 "failed. HTTP return code:", http_rtn ); 2146 "failed. HTTP return code:", http_rtn );
2147 xmlIOErr(XML_IO_WRITE, (const char *) msg); 2147 xmlIOErr(XML_IO_WRITE, (const char *) msg);
2148 } 2148 }
2149 2149
2150 xmlNanoHTTPClose( http_ctxt ); 2150 xmlNanoHTTPClose( http_ctxt );
2151 xmlFree( content_type ); 2151 xmlFree( content_type );
2152 } 2152 }
2153 } 2153 }
(...skipping 2023 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
« no previous file with comments | « third_party/libxml/src/xinclude.c ('k') | third_party/libxml/src/xmlmemory.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698