diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/libxml/xmlIO.c | |
parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
download | ydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/libxml/xmlIO.c')
-rw-r--r-- | contrib/libs/libxml/xmlIO.c | 254 |
1 files changed, 127 insertions, 127 deletions
diff --git a/contrib/libs/libxml/xmlIO.c b/contrib/libs/libxml/xmlIO.c index 0ff67ef947..7921e793a0 100644 --- a/contrib/libs/libxml/xmlIO.c +++ b/contrib/libs/libxml/xmlIO.c @@ -12,7 +12,7 @@ #include "libxml.h" #include <string.h> -#include <stddef.h> +#include <stddef.h> #ifdef HAVE_ERRNO_H #include <errno.h> #endif @@ -33,15 +33,15 @@ #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif -#ifdef LIBXML_ZLIB_ENABLED -#include <zlib.h> +#ifdef LIBXML_ZLIB_ENABLED +#include <zlib.h> #endif -#ifdef LIBXML_LZMA_ENABLED +#ifdef LIBXML_LZMA_ENABLED #error #include <lzma.h> #endif -#if defined(_WIN32) && !defined(__CYGWIN__) -#define WIN32_LEAN_AND_MEAN +#if defined(_WIN32) && !defined(__CYGWIN__) +#define WIN32_LEAN_AND_MEAN #include <windows.h> #endif @@ -49,14 +49,14 @@ #include <winnls.h> /* for CP_UTF8 */ #endif -#ifndef S_ISDIR -# ifdef _S_ISDIR -# define S_ISDIR(x) _S_ISDIR(x) -# elif defined(S_IFDIR) -# ifdef S_IFMT -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -# elif defined(_S_IFMT) -# define S_ISDIR(m) (((m) & _S_IFMT) == S_IFDIR) +#ifndef S_ISDIR +# ifdef _S_ISDIR +# define S_ISDIR(x) _S_ISDIR(x) +# elif defined(S_IFDIR) +# ifdef S_IFMT +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# elif defined(_S_IFMT) +# define S_ISDIR(m) (((m) & _S_IFMT) == S_IFDIR) # endif # endif #endif @@ -185,9 +185,9 @@ static const char *IOerr[] = { "already connected", /* EISCONN */ "connection refused", /* ECONNREFUSED */ "unreachable network", /* ENETUNREACH */ - "address in use", /* EADDRINUSE */ + "address in use", /* EADDRINUSE */ "already in use", /* EALREADY */ - "unknown address family", /* EAFNOSUPPORT */ + "unknown address family", /* EAFNOSUPPORT */ }; #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) @@ -597,7 +597,7 @@ xmlWrapOpenUtf8(const char *path,int mode) return fd; } -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED static gzFile xmlWrapGzOpenUtf8(const char *path, const char *mode) { @@ -634,18 +634,18 @@ xmlWrapGzOpenUtf8(const char *path, const char *mode) * */ static int -xmlWrapStatUtf8(const char *path, struct _stat *info) { +xmlWrapStatUtf8(const char *path, struct _stat *info) { int retval = -1; wchar_t *wPath; wPath = __xmlIOWin32UTF8ToWChar(path); - if (wPath) { - retval = _wstat(wPath, info); + if (wPath) { + retval = _wstat(wPath, info); xmlFree(wPath); } /* maybe path in native encoding */ if(retval < 0) - retval = _stat(path, info); + retval = _stat(path, info); return retval; } @@ -669,12 +669,12 @@ int xmlCheckFilename (const char *path) { #ifdef HAVE_STAT -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - struct _stat stat_buffer; -#else +#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) + struct _stat stat_buffer; +#else struct stat stat_buffer; #endif -#endif +#endif if (path == NULL) return(0); @@ -688,7 +688,7 @@ xmlCheckFilename (const char *path) (path[3] == '\\') ) return 1; - if (xmlWrapStatUtf8(path, &stat_buffer) == -1) + if (xmlWrapStatUtf8(path, &stat_buffer) == -1) return 0; #else if (stat(path, &stat_buffer) == -1) @@ -703,16 +703,16 @@ xmlCheckFilename (const char *path) } /** - * xmlInputReadCallbackNop: + * xmlInputReadCallbackNop: * - * No Operation xmlInputReadCallback function, does nothing. + * No Operation xmlInputReadCallback function, does nothing. * * Returns zero */ int -xmlInputReadCallbackNop(void *context ATTRIBUTE_UNUSED, - char *buffer ATTRIBUTE_UNUSED, - int len ATTRIBUTE_UNUSED) { +xmlInputReadCallbackNop(void *context ATTRIBUTE_UNUSED, + char *buffer ATTRIBUTE_UNUSED, + int len ATTRIBUTE_UNUSED) { return(0); } @@ -730,7 +730,7 @@ static int xmlFdRead (void * context, char * buffer, int len) { int ret; - ret = read((int) (ptrdiff_t) context, &buffer[0], len); + ret = read((int) (ptrdiff_t) context, &buffer[0], len); if (ret < 0) xmlIOErr(0, "read()"); return(ret); } @@ -751,7 +751,7 @@ xmlFdWrite (void * context, const char * buffer, int len) { int ret = 0; if (len > 0) { - ret = write((int) (ptrdiff_t) context, &buffer[0], len); + ret = write((int) (ptrdiff_t) context, &buffer[0], len); if (ret < 0) xmlIOErr(0, "write()"); } return(ret); @@ -769,7 +769,7 @@ xmlFdWrite (void * context, const char * buffer, int len) { static int xmlFdClose (void * context) { int ret; - ret = close((int) (ptrdiff_t) context); + ret = close((int) (ptrdiff_t) context); if (ret < 0) xmlIOErr(0, "close()"); return(ret); } @@ -830,14 +830,14 @@ xmlFileOpen_real (const char *filename) { #endif } - /* Do not check DDNAME on zOS ! */ -#if !defined(__MVS__) + /* Do not check DDNAME on zOS ! */ +#if !defined(__MVS__) if (!xmlCheckFilename(path)) return(NULL); -#endif +#endif #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - fd = xmlWrapOpenUtf8(path, 0); + fd = xmlWrapOpenUtf8(path, 0); #else fd = fopen(path, "r"); #endif /* WIN32 */ @@ -910,14 +910,14 @@ xmlFileOpenW (const char *filename) { return(NULL); #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - fd = xmlWrapOpenUtf8(path, 1); -#elif(__MVS__) - fd = fopen(path, "w"); + fd = xmlWrapOpenUtf8(path, 1); +#elif(__MVS__) + fd = fopen(path, "w"); #else - fd = fopen(path, "wb"); + fd = fopen(path, "wb"); #endif /* WIN32 */ - if (fd == NULL) xmlIOErr(0, path); + if (fd == NULL) xmlIOErr(0, path); return((void *) fd); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -1038,7 +1038,7 @@ xmlBufferWrite (void * context, const char * buffer, int len) { } #endif -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED /************************************************************************ * * * I/O for compressed file accesses * @@ -1102,7 +1102,7 @@ xmlGzfileOpen_real (const char *filename) { return(NULL); #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - fd = xmlWrapGzOpenUtf8(path, "rb"); + fd = xmlWrapGzOpenUtf8(path, "rb"); #else fd = gzopen(path, "rb"); #endif @@ -1179,7 +1179,7 @@ xmlGzfileOpenW (const char *filename, int compression) { return(NULL); #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - fd = xmlWrapGzOpenUtf8(path, mode); + fd = xmlWrapGzOpenUtf8(path, mode); #else fd = gzopen(path, mode); #endif @@ -1195,7 +1195,7 @@ xmlGzfileOpenW (const char *filename, int compression) { * * Read @len bytes to @buffer from the compressed I/O channel. * - * Returns the number of bytes read. + * Returns the number of bytes read. */ static int xmlGzfileRead (void * context, char * buffer, int len) { @@ -1241,15 +1241,15 @@ xmlGzfileClose (void * context) { if (ret < 0) xmlIOErr(0, "gzclose()"); return(ret); } -#endif /* LIBXML_ZLIB_ENABLED */ +#endif /* LIBXML_ZLIB_ENABLED */ -#ifdef LIBXML_LZMA_ENABLED +#ifdef LIBXML_LZMA_ENABLED /************************************************************************ * * * I/O for compressed file accesses * * * ************************************************************************/ -#error #include "xzlib.h" +#error #include "xzlib.h" /** * xmlXzfileMatch: * @filename: the URI for matching @@ -1360,7 +1360,7 @@ xmlXzfileClose (void * context) { if (ret < 0) xmlIOErr(0, "xzclose()"); return(ret); } -#endif /* LIBXML_LZMA_ENABLED */ +#endif /* LIBXML_LZMA_ENABLED */ #ifdef LIBXML_HTTP_ENABLED /************************************************************************ @@ -1380,7 +1380,7 @@ typedef struct xmlIOHTTPWriteCtxt_ } xmlIOHTTPWriteCtxt, *xmlIOHTTPWriteCtxtPtr; -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED #define DFLT_WBITS ( -15 ) #define DFLT_MEM_LVL ( 8 ) @@ -1513,7 +1513,7 @@ xmlCreateZMemBuff( int compression ) { xmlFreeZMemBuff( buff ); buff = NULL; xmlStrPrintf(msg, 500, - "xmlCreateZMemBuff: %s %d\n", + "xmlCreateZMemBuff: %s %d\n", "Error initializing compression context. ZLIB error:", z_err ); xmlIOErr(XML_IO_WRITE, (const char *) msg); @@ -1581,9 +1581,9 @@ xmlZMemBuffExtend( xmlZMemBuffPtr buff, size_t ext_amt ) { else { xmlChar msg[500]; xmlStrPrintf(msg, 500, - "xmlZMemBuffExtend: %s %lu bytes.\n", + "xmlZMemBuffExtend: %s %lu bytes.\n", "Allocation failure extending output buffer to", - (unsigned long) new_size ); + (unsigned long) new_size ); xmlIOErr(XML_IO_WRITE, (const char *) msg); } @@ -1627,7 +1627,7 @@ xmlZMemBuffAppend( xmlZMemBuffPtr buff, const char * src, int len ) { if ( z_err != Z_OK ) { xmlChar msg[500]; xmlStrPrintf(msg, 500, - "xmlZMemBuffAppend: %s %d %s - %d", + "xmlZMemBuffAppend: %s %d %s - %d", "Compression error while appending", len, "bytes to buffer. ZLIB error", z_err ); xmlIOErr(XML_IO_WRITE, (const char *) msg); @@ -1700,7 +1700,7 @@ xmlZMemBuffGetContent( xmlZMemBuffPtr buff, char ** data_ref ) { else { xmlChar msg[500]; xmlStrPrintf(msg, 500, - "xmlZMemBuffGetContent: %s - %d\n", + "xmlZMemBuffGetContent: %s - %d\n", "Error flushing zlib buffers. Error code", z_err ); xmlIOErr(XML_IO_WRITE, (const char *) msg); } @@ -1708,7 +1708,7 @@ xmlZMemBuffGetContent( xmlZMemBuffPtr buff, char ** data_ref ) { return ( zlgth ); } #endif /* LIBXML_OUTPUT_ENABLED */ -#endif /* LIBXML_ZLIB_ENABLED */ +#endif /* LIBXML_ZLIB_ENABLED */ #ifdef LIBXML_OUTPUT_ENABLED /** @@ -1727,7 +1727,7 @@ xmlFreeHTTPWriteCtxt( xmlIOHTTPWriteCtxtPtr ctxt ) if ( ctxt->doc_buff != NULL ) { -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED if ( ctxt->compression > 0 ) { xmlFreeZMemBuff( ctxt->doc_buff ); } @@ -1785,7 +1785,7 @@ xmlIOHTTPOpen (const char *filename) { */ void * -xmlIOHTTPOpenW(const char *post_uri, int compression ATTRIBUTE_UNUSED) +xmlIOHTTPOpenW(const char *post_uri, int compression ATTRIBUTE_UNUSED) { xmlIOHTTPWriteCtxtPtr ctxt = NULL; @@ -1814,7 +1814,7 @@ xmlIOHTTPOpenW(const char *post_uri, int compression ATTRIBUTE_UNUSED) * ** is being used to avoid pushing the data to disk and back. */ -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED if ((compression > 0) && (compression <= 9)) { ctxt->compression = compression; @@ -1894,7 +1894,7 @@ xmlIOHTTPWrite( void * context, const char * buffer, int len ) { /* Use gzwrite or fwrite as previously setup in the open call */ -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED if ( ctxt->compression > 0 ) len = xmlZMemBuffAppend( ctxt->doc_buff, buffer, len ); @@ -1905,7 +1905,7 @@ xmlIOHTTPWrite( void * context, const char * buffer, int len ) { if ( len < 0 ) { xmlChar msg[500]; xmlStrPrintf(msg, 500, - "xmlIOHTTPWrite: %s\n%s '%s'.\n", + "xmlIOHTTPWrite: %s\n%s '%s'.\n", "Error appending to internal buffer.", "Error sending document to URI", ctxt->uri ); @@ -1958,7 +1958,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) { /* Retrieve the content from the appropriate buffer */ -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED if ( ctxt->compression > 0 ) { content_lgth = xmlZMemBuffGetContent( ctxt->doc_buff, &http_content ); @@ -1977,7 +1977,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) { if ( http_content == NULL ) { xmlChar msg[500]; xmlStrPrintf(msg, 500, - "xmlIOHTTPCloseWrite: %s '%s' %s '%s'.\n", + "xmlIOHTTPCloseWrite: %s '%s' %s '%s'.\n", "Error retrieving content.\nUnable to", http_mthd, "data to URI", ctxt->uri ); xmlIOErr(XML_IO_WRITE, (const char *) msg); @@ -2049,7 +2049,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) { else { xmlChar msg[500]; xmlStrPrintf(msg, 500, - "xmlIOHTTPCloseWrite: HTTP '%s' of %d %s\n'%s' %s %d\n", + "xmlIOHTTPCloseWrite: HTTP '%s' of %d %s\n'%s' %s %d\n", http_mthd, content_lgth, "bytes to URI", ctxt->uri, "failed. HTTP return code:", http_rtn ); @@ -2229,14 +2229,14 @@ xmlRegisterDefaultInputCallbacks(void) { xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen, xmlFileRead, xmlFileClose); -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED xmlRegisterInputCallbacks(xmlGzfileMatch, xmlGzfileOpen, xmlGzfileRead, xmlGzfileClose); -#endif /* LIBXML_ZLIB_ENABLED */ -#ifdef LIBXML_LZMA_ENABLED +#endif /* LIBXML_ZLIB_ENABLED */ +#ifdef LIBXML_LZMA_ENABLED xmlRegisterInputCallbacks(xmlXzfileMatch, xmlXzfileOpen, xmlXzfileRead, xmlXzfileClose); -#endif /* LIBXML_LZMA_ENABLED */ +#endif /* LIBXML_LZMA_ENABLED */ #ifdef LIBXML_HTTP_ENABLED xmlRegisterInputCallbacks(xmlIOHTTPMatch, xmlIOHTTPOpen, @@ -2274,7 +2274,7 @@ xmlRegisterDefaultOutputCallbacks (void) { uncompressed ones except opening if existing then closing and saving with same compression ratio ... a pain. -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED xmlRegisterOutputCallbacks(xmlGzfileMatch, xmlGzfileOpen, xmlGzfileWrite, xmlGzfileClose); #endif @@ -2383,7 +2383,7 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) { if (encoder != NULL) { ret->conv = xmlBufCreateSize(4000); if (ret->conv == NULL) { - xmlBufFree(ret->buffer); + xmlBufFree(ret->buffer); xmlFree(ret); return(NULL); } @@ -2436,7 +2436,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder) { if (encoder != NULL) { ret->conv = xmlBufCreateSize(4000); if (ret->conv == NULL) { - xmlBufFree(ret->buffer); + xmlBufFree(ret->buffer); xmlFree(ret); return(NULL); } @@ -2566,7 +2566,7 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) { ret->context = context; ret->readcallback = xmlInputCallbackTable[i].readcallback; ret->closecallback = xmlInputCallbackTable[i].closecallback; -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED if ((xmlInputCallbackTable[i].opencallback == xmlGzfileOpen) && (strcmp(URI, "-") != 0)) { #if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1230 @@ -2586,7 +2586,7 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) { #endif } #endif -#ifdef LIBXML_LZMA_ENABLED +#ifdef LIBXML_LZMA_ENABLED if ((xmlInputCallbackTable[i].opencallback == xmlXzfileOpen) && (strcmp(URI, "-") != 0)) { ret->compressed = __libxml2_xzcompressed(context); @@ -2630,7 +2630,7 @@ __xmlOutputBufferCreateFilename(const char *URI, int i = 0; void *context = NULL; char *unescaped = NULL; -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED int is_file_uri = 1; #endif @@ -2641,7 +2641,7 @@ __xmlOutputBufferCreateFilename(const char *URI, puri = xmlParseURI(URI); if (puri != NULL) { -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED if ((puri->scheme != NULL) && (!xmlStrEqual(BAD_CAST puri->scheme, BAD_CAST "file"))) is_file_uri = 0; @@ -2661,7 +2661,7 @@ __xmlOutputBufferCreateFilename(const char *URI, * try with an unescaped version of the URI */ if (unescaped != NULL) { -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) { context = xmlGzfileOpenW(unescaped, compression); if (context != NULL) { @@ -2679,7 +2679,7 @@ __xmlOutputBufferCreateFilename(const char *URI, for (i = xmlOutputCallbackNr - 1;i >= 0;i--) { if ((xmlOutputCallbackTable[i].matchcallback != NULL) && (xmlOutputCallbackTable[i].matchcallback(unescaped) != 0)) { -#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_ZLIB_ENABLED) +#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_ZLIB_ENABLED) /* Need to pass compression parameter into HTTP open calls */ if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch) context = xmlIOHTTPOpenW(unescaped, compression); @@ -2698,7 +2698,7 @@ __xmlOutputBufferCreateFilename(const char *URI, * filename */ if (context == NULL) { -#ifdef LIBXML_ZLIB_ENABLED +#ifdef LIBXML_ZLIB_ENABLED if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) { context = xmlGzfileOpenW(URI, compression); if (context != NULL) { @@ -2715,7 +2715,7 @@ __xmlOutputBufferCreateFilename(const char *URI, for (i = xmlOutputCallbackNr - 1;i >= 0;i--) { if ((xmlOutputCallbackTable[i].matchcallback != NULL) && (xmlOutputCallbackTable[i].matchcallback(URI) != 0)) { -#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_ZLIB_ENABLED) +#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_ZLIB_ENABLED) /* Need to pass compression parameter into HTTP open calls */ if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch) context = xmlIOHTTPOpenW(URI, compression); @@ -2845,8 +2845,8 @@ xmlOutputBufferCreateBuffer(xmlBufferPtr buffer, if (buffer == NULL) return(NULL); - ret = xmlOutputBufferCreateIO(xmlBufferWrite, NULL, (void *) buffer, - encoder); + ret = xmlOutputBufferCreateIO(xmlBufferWrite, NULL, (void *) buffer, + encoder); return(ret); } @@ -2904,7 +2904,7 @@ xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc) { ret = xmlAllocParserInputBuffer(enc); if (ret != NULL) { - ret->context = (void *) (ptrdiff_t) fd; + ret->context = (void *) (ptrdiff_t) fd; ret->readcallback = xmlFdRead; ret->closecallback = xmlFdClose; } @@ -2928,13 +2928,13 @@ xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) { xmlParserInputBufferPtr ret; int errcode; - if (size < 0) return(NULL); + if (size < 0) return(NULL); if (mem == NULL) return(NULL); ret = xmlAllocParserInputBuffer(enc); if (ret != NULL) { ret->context = (void *) mem; - ret->readcallback = xmlInputReadCallbackNop; + ret->readcallback = xmlInputReadCallbackNop; ret->closecallback = NULL; errcode = xmlBufAdd(ret->buffer, (const xmlChar *) mem, size); if (errcode != 0) { @@ -2964,7 +2964,7 @@ xmlParserInputBufferCreateStatic(const char *mem, int size, xmlCharEncoding enc) { xmlParserInputBufferPtr ret; - if (size < 0) return(NULL); + if (size < 0) return(NULL); if (mem == NULL) return(NULL); ret = (xmlParserInputBufferPtr) xmlMalloc(sizeof(xmlParserInputBuffer)); @@ -3010,7 +3010,7 @@ xmlOutputBufferCreateFd(int fd, xmlCharEncodingHandlerPtr encoder) { ret = xmlAllocOutputBufferInternal(encoder); if (ret != NULL) { - ret->context = (void *) (ptrdiff_t) fd; + ret->context = (void *) (ptrdiff_t) fd; ret->writecallback = xmlFdWrite; ret->closecallback = NULL; } @@ -3251,7 +3251,7 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) { * try to establish compressed status of input if not done already */ if (in->compressed == -1) { -#ifdef LIBXML_LZMA_ENABLED +#ifdef LIBXML_LZMA_ENABLED if (in->readcallback == xmlXzfileRead) in->compressed = __libxml2_xzcompressed(in->context); #endif @@ -3337,7 +3337,7 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) { int nbchars = 0; /* number of chars to output to I/O */ int ret; /* return from function call */ int written = 0; /* number of char written to I/O so far */ - int chunk; /* number of byte current processed from buf */ + int chunk; /* number of byte current processed from buf */ if ((out == NULL) || (out->error)) return(-1); if (len < 0) return(0); @@ -3374,25 +3374,25 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) { out->error = XML_IO_ENCODER; return(-1); } - if (out->writecallback) - nbchars = xmlBufUse(out->conv); - else - nbchars = ret; + if (out->writecallback) + nbchars = xmlBufUse(out->conv); + else + nbchars = ret; } else { ret = xmlBufAdd(out->buffer, (const xmlChar *) buf, chunk); if (ret != 0) return(-1); - if (out->writecallback) - nbchars = xmlBufUse(out->buffer); - else - nbchars = chunk; + if (out->writecallback) + nbchars = xmlBufUse(out->buffer); + else + nbchars = chunk; } buf += chunk; len -= chunk; - if (out->writecallback) { - if ((nbchars < MINLEN) && (len <= 0)) - goto done; + if (out->writecallback) { + if ((nbchars < MINLEN) && (len <= 0)) + goto done; /* * second write the stuff to the I/O channel @@ -3413,10 +3413,10 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) { out->error = XML_IO_WRITE; return(ret); } - if (out->written > INT_MAX - ret) - out->written = INT_MAX; - else - out->written += ret; + if (out->written > INT_MAX - ret) + out->written = INT_MAX; + else + out->written += ret; } written += nbchars; } while (len > 0); @@ -3496,7 +3496,7 @@ xmlEscapeContent(unsigned char* out, int *outlen, * @escaping: an optional escaping function (or NULL) * * Write the content of the string in the output I/O buffer - * This routine escapes the characters and then handle the I18N + * This routine escapes the characters and then handle the I18N * transcoding from internal UTF-8 * The buffer is lossless, i.e. will store in case of partial * or delayed writes. @@ -3572,26 +3572,26 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, out->error = XML_IO_ENCODER; return(-1); } - if (out->writecallback) - nbchars = xmlBufUse(out->conv); - else - nbchars = ret; + if (out->writecallback) + nbchars = xmlBufUse(out->conv); + else + nbchars = ret; } else { ret = escaping(xmlBufEnd(out->buffer), &chunk, str, &cons); if ((ret < 0) || (chunk == 0)) /* chunk==0 => nothing done */ return(-1); xmlBufAddLen(out->buffer, chunk); - if (out->writecallback) - nbchars = xmlBufUse(out->buffer); - else - nbchars = chunk; + if (out->writecallback) + nbchars = xmlBufUse(out->buffer); + else + nbchars = chunk; } str += cons; len -= cons; - if (out->writecallback) { - if ((nbchars < MINLEN) && (len <= 0)) - goto done; + if (out->writecallback) { + if ((nbchars < MINLEN) && (len <= 0)) + goto done; /* * second write the stuff to the I/O channel @@ -3612,10 +3612,10 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, out->error = XML_IO_WRITE; return(ret); } - if (out->written > INT_MAX - ret) - out->written = INT_MAX; - else - out->written += ret; + if (out->written > INT_MAX - ret) + out->written = INT_MAX; + else + out->written += ret; } else if (xmlBufAvail(out->buffer) < MINLEN) { xmlBufGrow(out->buffer, MINLEN); } @@ -3709,10 +3709,10 @@ xmlOutputBufferFlush(xmlOutputBufferPtr out) { out->error = XML_IO_FLUSH; return(ret); } - if (out->written > INT_MAX - ret) - out->written = INT_MAX; - else - out->written += ret; + if (out->written > INT_MAX - ret) + out->written = INT_MAX; + else + out->written += ret; #ifdef DEBUG_INPUT xmlGenericError(xmlGenericErrorContext, @@ -3745,7 +3745,7 @@ xmlParserGetDirectory(const char *filename) { if (filename == NULL) return(NULL); -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) # define IS_XMLPGD_SEP(ch) ((ch=='/')||(ch=='\\')) #else # define IS_XMLPGD_SEP(ch) (ch=='/') @@ -3960,7 +3960,7 @@ xmlResolveResourceFromCatalog(const char *URL, const char *ID, * @ID: the System ID for the entity to load * @ctxt: the context in which the entity is called or NULL * - * By default we don't load external entities, yet. + * By default we don't load external entities, yet. * * Returns a new allocated xmlParserInputPtr, or NULL. */ |