30#define SIZE_MAX ((size_t) -1)
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))
264 "xmlBufGetAllocationScheme: buf == NULL\n");
286 "xmlBufSetAllocationScheme: buf == NULL or in error\n");
309 buf->contentIO =
buf->content;
326 "xmlBufFree: buf == NULL\n");
334 }
else if ((
buf->content !=
NULL) &&
349 if ((
buf ==
NULL) || (
buf->error != 0))
return;
350 if (
buf->content ==
NULL)
return;
357 size_t start_buf =
buf->content -
buf->contentIO;
359 buf->size += start_buf;
360 buf->content =
buf->contentIO;
382 if ((
buf ==
NULL) || (
buf->error != 0))
return(0);
384 if (
len == 0)
return(0);
385 if (
len >
buf->use)
return(0);
402 size_t start_buf =
buf->content -
buf->contentIO;
403 if (start_buf >=
buf->size) {
405 buf->content =
buf->contentIO;
406 buf->content[
buf->use] = 0;
407 buf->size += start_buf;
412 buf->content[
buf->use] = 0;
434 if ((
buf ==
NULL) || (
buf->error != 0))
return(0);
438 if (len < buf->
size -
buf->use)
439 return(
buf->size -
buf->use - 1);
445 if (
buf->size > (
size_t)
len) {
465 size_t start_buf =
buf->content -
buf->contentIO;
468 if (newbuf ==
NULL) {
472 buf->contentIO = newbuf;
473 buf->content = newbuf + start_buf;
476 if (newbuf ==
NULL) {
480 buf->content = newbuf;
484 return(
buf->size -
buf->use - 1);
525 "xmlBufDump: buf == NULL or in error\n");
532 "xmlBufDump: buf->content == NULL\n");
555 if ((!
buf) || (
buf->error))
558 return(
buf->content);
573 if ((!
buf) || (
buf->error))
577 return(&
buf->content[
buf->use]);
599 buf->content[
buf->use] = 0;
616 if ((!
buf) || (
buf->error))
635 if ((!
buf) || (
buf->error))
657 if ((!
buf) || (
buf->error))
661 return((
buf->size >
buf->use) ? (
buf->size -
buf->use - 1) : 0);
675 if ((!
buf) || (
buf->error))
679 return(
buf->use == 0);
714 if (size < buf->
size)
722 if (
buf->size == 0) {
727 while (
size > newSize) {
743 while (
size > newSize) {
759 start_buf =
buf->content -
buf->contentIO;
761 if (start_buf > newSize) {
764 buf->content =
buf->contentIO;
765 buf->content[
buf->use] = 0;
766 buf->size += start_buf;
773 buf->contentIO = rebuf;
774 buf->content = rebuf + start_buf;
781 }
else if (
buf->size -
buf->use < 100) {
800 buf->content = rebuf;
832 "xmlBufAdd: len < 0\n");
836 if (
len == 0)
return 0;
841 if (
len < 0)
return -1;
842 if (
len == 0)
return 0;
845 if ((
size_t)
len >=
buf->size -
buf->use) {
850 needSize =
buf->use +
len + 1;
868 buf->content[
buf->use] = 0;
932 "xmlBufWriteQuotedString: string contains quote and double-quotes !\n");
1049 ret->size = (
int)
buf->size;
1052 ret->content =
buf->content;
1053 ret->contentIO =
buf->contentIO;
size_t xmlBufAvail(const xmlBufPtr buf)
int xmlBufAddLen(xmlBufPtr buf, size_t len)
void xmlBufEmpty(xmlBufPtr buf)
static size_t xmlBufGrowInternal(xmlBufPtr buf, size_t len)
xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer)
int xmlBufGetAllocationScheme(xmlBufPtr buf)
int xmlBufResize(xmlBufPtr buf, size_t size)
xmlChar * xmlBufEnd(xmlBufPtr buf)
size_t xmlBufLength(const xmlBufPtr buf)
static void xmlBufOverflowError(xmlBufPtr buf, const char *extra)
#define UPDATE_COMPAT(buf)
int xmlBufIsEmpty(const xmlBufPtr buf)
void xmlBufFree(xmlBufPtr buf)
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input)
xmlChar * xmlBufDetach(xmlBufPtr buf)
xmlBufPtr xmlBufCreateStatic(void *mem, size_t size)
xmlBufPtr xmlBufCreateSize(size_t size)
xmlBufPtr xmlBufCreate(void)
int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer)
xmlChar * xmlBufContent(const xmlBuf *buf)
int xmlBufSetAllocationScheme(xmlBufPtr buf, xmlBufferAllocationScheme scheme)
size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input)
int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string)
xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf)
size_t xmlBufDump(FILE *file, xmlBufPtr buf)
size_t xmlBufUse(const xmlBufPtr buf)
#define CHECK_COMPAT(buf)
int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len)
int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input, size_t base, size_t cur)
int xmlBufGrow(xmlBufPtr buf, int len)
static void xmlBufMemoryError(xmlBufPtr buf, const char *extra)
int xmlBufCat(xmlBufPtr buf, const xmlChar *str)
int xmlBufCCat(xmlBufPtr buf, const char *str)
size_t xmlBufShrink(xmlBufPtr buf, size_t len)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLenum GLenum input
_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)
#define memcpy(s1, s2, n)
#define memmove(s1, s2, n)
#define XML_MAX_TEXT_LENGTH
XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme
XMLPUBVAR xmlMallocFunc xmlMallocAtomic
XMLPUBVAR xmlMallocFunc xmlMalloc
XMLPUBVAR int xmlDefaultBufferSize
XMLPUBVAR xmlFreeFunc xmlFree
XMLPUBVAR void * xmlGenericErrorContext
XMLPUBVAR xmlReallocFunc xmlRealloc
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
XMLPUBFUN void XMLCALL xmlBufferFree(xmlBufferPtr buf)
xmlBufferAllocationScheme
@ XML_BUFFER_ALLOC_BOUNDED
@ XML_BUFFER_ALLOC_IMMUTABLE
@ XML_BUFFER_ALLOC_DOUBLEIT
@ XML_BUFFER_ALLOC_HYBRID
xmlBufferAllocationScheme alloc
XMLPUBFUN const xmlChar *XMLCALL xmlStrchr(const xmlChar *str, xmlChar val)
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)