33 #define WITH_BUFFER_COMPAT 55 #ifdef WITH_BUFFER_COMPAT 60 #define UPDATE_COMPAT(buf) \ 61 if (buf->size < INT_MAX) buf->compat_size = buf->size; \ 62 else buf->compat_size = INT_MAX; \ 63 if (buf->use < INT_MAX) buf->compat_use = buf->use; \ 64 else buf->compat_use = INT_MAX; 71 #define CHECK_COMPAT(buf) \ 72 if (buf->size != (size_t) buf->compat_size) \ 73 if (buf->compat_size < INT_MAX) \ 74 buf->size = buf->compat_size; \ 75 if (buf->use != (size_t) buf->compat_use) \ 76 if (buf->compat_use < INT_MAX) \ 77 buf->use = buf->compat_use; 80 #define UPDATE_COMPAT(buf) 81 #define CHECK_COMPAT(buf) 95 if ((
buf) && (
buf->error == 0))
110 if ((
buf) && (
buf->error == 0))
213 buf->compat_size = 0;
271 "xmlBufGetAllocationScheme: buf == NULL\n");
293 "xmlBufSetAllocationScheme: buf == NULL or in error\n");
316 buf->contentIO =
buf->content;
333 "xmlBufFree: buf == NULL\n");
341 }
else if ((
buf->content !=
NULL) &&
356 if ((
buf ==
NULL) || (
buf->error != 0))
return;
357 if (
buf->content ==
NULL)
return;
364 size_t start_buf =
buf->content -
buf->contentIO;
366 buf->size += start_buf;
367 buf->content =
buf->contentIO;
389 if ((
buf ==
NULL) || (
buf->error != 0))
return(0);
391 if (
len == 0)
return(0);
392 if (
len >
buf->use)
return(0);
409 size_t start_buf =
buf->content -
buf->contentIO;
410 if (start_buf >=
buf->size) {
412 buf->content =
buf->contentIO;
413 buf->content[
buf->use] = 0;
414 buf->size += start_buf;
419 buf->content[
buf->use] = 0;
441 if ((
buf ==
NULL) || (
buf->error != 0))
return(0);
446 return(
buf->size -
buf->use);
455 if (
buf->size > (
size_t)
len)
476 size_t start_buf =
buf->content -
buf->contentIO;
479 if (newbuf ==
NULL) {
483 buf->contentIO = newbuf;
484 buf->content = newbuf + start_buf;
487 if (newbuf ==
NULL) {
491 buf->content = newbuf;
495 return(
buf->size -
buf->use);
554 "xmlBufDump: buf == NULL or in error\n");
561 "xmlBufDump: buf->content == NULL\n");
584 if ((!
buf) || (
buf->error))
587 return(
buf->content);
602 if ((!
buf) || (
buf->error))
606 return(&
buf->content[
buf->use]);
630 buf->content[
buf->use] = 0;
653 buf->content[
buf->use] = 0;
670 if ((!
buf) || (
buf->error))
689 if ((!
buf) || (
buf->error))
710 if ((!
buf) || (
buf->error))
714 return(
buf->size -
buf->use);
728 if ((!
buf) || (
buf->error))
732 return(
buf->use == 0);
747 unsigned int newSize;
775 newSize = (
buf->size ?
buf->size*2 :
size + 10);
776 while (
size > newSize) {
791 newSize =
buf->size * 2;
792 while (
size > newSize) {
808 start_buf =
buf->content -
buf->contentIO;
810 if (start_buf > newSize) {
813 buf->content =
buf->contentIO;
814 buf->content[
buf->use] = 0;
815 buf->size += start_buf;
822 buf->contentIO = rebuf;
823 buf->content = rebuf + start_buf;
828 }
else if (
buf->size -
buf->use < 100) {
847 buf->content = rebuf;
869 unsigned int needSize;
879 "xmlBufAdd: len < 0\n");
883 if (
len == 0)
return 0;
888 if (
len < 0)
return -1;
889 if (
len == 0)
return 0;
891 needSize =
buf->use +
len + 2;
892 if (needSize >
buf->size){
910 buf->content[
buf->use] = 0;
929 unsigned int needSize;
938 "xmlBufAddHead: str == NULL\n");
945 "xmlBufAddHead: len < 0\n");
949 if (
len == 0)
return 0;
954 if (
len <= 0)
return -1;
957 size_t start_buf =
buf->content -
buf->contentIO;
959 if (start_buf > (
unsigned int)
len) {
971 needSize =
buf->use +
len + 2;
972 if (needSize >
buf->size){
991 buf->content[
buf->use] = 0;
1037 "xmlBufCCat: str == NULL\n");
1042 if (
buf->use + 10 >=
buf->size) {
1050 buf->content[
buf->use] = 0;
1122 "xmlBufWriteQuotedString: string contains quote and double-quotes !\n");
1239 ret->size = (
int)
buf->size;
1241 ret->content =
buf->content;
1242 ret->contentIO =
buf->contentIO;
int xmlBufGrow(xmlBufPtr buf, int len)
int xmlBufWriteChar(xmlBufPtr buf, const char *string)
xmlChar * xmlBufContent(const xmlBuf *buf)
XMLPUBVAR xmlMallocFunc xmlMallocAtomic
#define memmove(s1, s2, n)
static void xmlBufMemoryError(xmlBufPtr buf, const char *extra)
int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input, size_t base, size_t cur)
size_t xmlBufUse(const xmlBufPtr buf)
xmlBufferAllocationScheme alloc
static void xmlBufOverflowError(xmlBufPtr buf, const char *extra)
int xmlBufAddLen(xmlBufPtr buf, size_t len)
int xmlBufCat(xmlBufPtr buf, const xmlChar *str)
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
XMLPUBFUN void XMLCALL xmlBufferFree(xmlBufferPtr buf)
int xmlBufCCat(xmlBufPtr buf, const char *str)
#define CHECK_COMPAT(buf)
xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer)
size_t xmlBufLength(const xmlBufPtr buf)
xmlBufPtr xmlBufCreateStatic(void *mem, size_t size)
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input)
#define XML_MAX_TEXT_LENGTH
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
XMLPUBFUN const xmlChar *XMLCALL xmlStrchr(const xmlChar *str, xmlChar val)
xmlChar * xmlBufDetach(xmlBufPtr buf)
GLenum GLuint GLenum GLsizei const GLchar * buf
#define UPDATE_COMPAT(buf)
int xmlBufWriteCHAR(xmlBufPtr buf, const xmlChar *string)
xmlBufferAllocationScheme
int xmlBufErase(xmlBufPtr buf, size_t len)
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
xmlBufPtr xmlBufCreateSize(size_t size)
void xmlBufEmpty(xmlBufPtr buf)
void xmlBufFree(xmlBufPtr buf)
XMLPUBVAR xmlReallocFunc xmlRealloc
int xmlBufIsEmpty(const xmlBufPtr buf)
size_t xmlBufDump(FILE *file, xmlBufPtr buf)
size_t xmlBufShrink(xmlBufPtr buf, size_t len)
XMLPUBVAR xmlFreeFunc xmlFree
int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len)
int xmlBufInflate(xmlBufPtr buf, size_t len)
size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input)
xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf)
#define memcpy(s1, s2, n)
size_t xmlBufAvail(const xmlBufPtr buf)
static size_t xmlBufGrowInternal(xmlBufPtr buf, size_t len)
xmlBufPtr xmlBufCreate(void)
int xmlBufGetAllocationScheme(xmlBufPtr buf)
int xmlBufSetAllocationScheme(xmlBufPtr buf, xmlBufferAllocationScheme scheme)
GLenum GLenum GLenum input
xmlChar * xmlBufEnd(xmlBufPtr buf)
int xmlBufResize(xmlBufPtr buf, size_t size)
XMLPUBVAR xmlMallocFunc xmlMalloc
XMLPUBVAR int xmlDefaultBufferSize
int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer)
int xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len)
XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme
int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
XMLPUBVAR void * xmlGenericErrorContext