summaryrefslogtreecommitdiff
path: root/chromium/third_party/libxml/src/xmlIO.c
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/libxml/src/xmlIO.c')
-rw-r--r--chromium/third_party/libxml/src/xmlIO.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/chromium/third_party/libxml/src/xmlIO.c b/chromium/third_party/libxml/src/xmlIO.c
index a80ef11f1a5..834b4ae5874 100644
--- a/chromium/third_party/libxml/src/xmlIO.c
+++ b/chromium/third_party/libxml/src/xmlIO.c
@@ -15,9 +15,6 @@
#include <stdlib.h>
#include <errno.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
@@ -37,6 +34,8 @@
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#include <io.h>
+#include <direct.h>
#endif
#ifndef S_ISDIR
@@ -64,8 +63,11 @@
#endif
#include <libxml/globals.h>
-#include "buf.h"
-#include "enc.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/io.h"
+#include "private/parser.h"
/* #define VERBOSE_FAILURE */
/* #define DEBUG_EXTERNAL_ENTITIES */
@@ -109,9 +111,6 @@ typedef struct _xmlOutputCallback {
static xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK];
static int xmlOutputCallbackNr = 0;
static int xmlOutputCallbackInitialized = 0;
-
-xmlOutputBufferPtr
-xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
@@ -120,7 +119,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
* *
************************************************************************/
-static const char *IOerr[] = {
+static const char* const IOerr[] = {
"Unknown IO error", /* UNKNOWN */
"Permission denied", /* EACCES */
"Resource temporarily unavailable",/* EAGAIN */
@@ -1128,7 +1127,7 @@ xmlGzfileOpen_real (const char *filename) {
* xmlGzfileOpen:
* @filename: the URI for matching
*
- * Wrapper around xmlGzfileOpen if the open fais, it will
+ * Wrapper around xmlGzfileOpen_real if the open fails, it will
* try to unescape @filename
*/
static void *
@@ -1264,7 +1263,7 @@ xmlGzfileClose (void * context) {
* I/O for compressed file accesses *
* *
************************************************************************/
-#include "xzlib.h"
+#include "private/xzlib.h"
/**
* xmlXzfileMatch:
* @filename: the URI for matching
@@ -2033,8 +2032,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
xmlGenericError( xmlGenericErrorContext,
"Transmitted content saved in file: %s\n", buffer );
- fwrite( http_content, sizeof( char ),
- content_lgth, tst_file );
+ fwrite( http_content, 1, content_lgth, tst_file );
fclose( tst_file );
}
@@ -2048,7 +2046,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
while ( (avail = xmlNanoHTTPRead( http_ctxt,
buffer, sizeof( buffer ) )) > 0 ) {
- fwrite( buffer, sizeof( char ), avail, tst_file );
+ fwrite( buffer, 1, avail, tst_file );
}
fclose( tst_file );
@@ -2344,7 +2342,7 @@ xmlAllocParserInputBuffer(xmlCharEncoding enc) {
xmlIOErrMemory("creating input buffer");
return(NULL);
}
- memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer));
+ memset(ret, 0, sizeof(xmlParserInputBuffer));
ret->buffer = xmlBufCreateSize(2 * xmlDefaultBufferSize);
if (ret->buffer == NULL) {
xmlFree(ret);
@@ -2383,16 +2381,13 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) {
xmlIOErrMemory("creating output buffer");
return(NULL);
}
- memset(ret, 0, (size_t) sizeof(xmlOutputBuffer));
+ memset(ret, 0, sizeof(xmlOutputBuffer));
ret->buffer = xmlBufCreate();
if (ret->buffer == NULL) {
xmlFree(ret);
return(NULL);
}
-
- /* try to avoid a performance problem with Windows realloc() */
- if (xmlBufGetAllocationScheme(ret->buffer) == XML_BUFFER_ALLOC_EXACT)
- xmlBufSetAllocationScheme(ret->buffer, XML_BUFFER_ALLOC_DOUBLEIT);
+ xmlBufSetAllocationScheme(ret->buffer, XML_BUFFER_ALLOC_DOUBLEIT);
ret->encoder = encoder;
if (encoder != NULL) {
@@ -2434,7 +2429,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder) {
xmlIOErrMemory("creating output buffer");
return(NULL);
}
- memset(ret, 0, (size_t) sizeof(xmlOutputBuffer));
+ memset(ret, 0, sizeof(xmlOutputBuffer));
ret->buffer = xmlBufCreate();
if (ret->buffer == NULL) {
xmlFree(ret);
@@ -2989,8 +2984,8 @@ xmlParserInputBufferCreateStatic(const char *mem, int size,
xmlIOErrMemory("creating input buffer");
return(NULL);
}
- memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer));
- ret->buffer = xmlBufCreateStatic((void *)mem, (size_t) size);
+ memset(ret, 0, sizeof(xmlParserInputBuffer));
+ ret->buffer = xmlBufCreateStatic((void *)mem, size);
if (ret->buffer == NULL) {
xmlFree(ret);
return(NULL);
@@ -3497,7 +3492,7 @@ xmlEscapeContent(unsigned char* out, int *outlen,
*out++ = '3';
*out++ = ';';
} else {
- *out++ = (unsigned char) *in;
+ *out++ = *in;
}
++in;
}
@@ -3548,7 +3543,7 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
* how many bytes to consume and how many bytes to store.
*/
cons = len;
- chunk = xmlBufAvail(out->buffer) - 1;
+ chunk = xmlBufAvail(out->buffer);
/*
* make sure we have enough room to save first, if this is