ReactOS 0.4.16-dev-340-g0540c21
|
#include "libxml.h"
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <stdlib.h>
#include <libxml/tree.h>
#include <libxml/globals.h>
#include <libxml/parserInternals.h>
#include "buf.h"
Go to the source code of this file.
Classes | |
struct | _xmlBuf |
Macros | |
#define | IN_LIBXML |
#define | SIZE_MAX ((size_t) -1) |
#define | WITH_BUFFER_COMPAT |
#define | UPDATE_COMPAT(buf) |
#define | CHECK_COMPAT(buf) |
xmlBufAdd: @buf: the buffer to dump @str: the xmlChar string @len: the number of xmlChar to add
Add a string range to an XML buffer. if len == -1, the length of str is recomputed.
Returns 0 successful, a positive error code number otherwise and -1 in case of internal or API error.
Definition at line 821 of file buf.c.
Referenced by xmlBufCat(), xmlBufMergeBuffer(), and xmlBufWriteQuotedString().
xmlBufAddLen: @buf: the buffer @len: the size which were added at the end
Sometime data may be added at the end of the buffer without using the xmlBuf APIs that is used to expand the used space and set the zero terminating at the end of the buffer
Returns -1 in case of error and 0 otherwise
Definition at line 592 of file buf.c.
Referenced by xmlCharEncFirstLineInput(), and xmlCharEncInput().
xmlBufAvail: @buf: the buffer
Function to find how much free space is allocated but not used in the buffer. It reserves one byte for the NUL terminator character that is usually needed, so there is no need to subtract 1 from the result anymore.
Returns the amount, or 0 if none or if an error occurred.
Definition at line 655 of file buf.c.
Referenced by xmlCharEncFirstLineInput(), and xmlCharEncInput().
xmlBufferPtr xmlBufBackToBuffer | ( | xmlBufPtr | buf | ) |
xmlBufBackToBuffer: @buf: new buffer wrapping the old one
Function to be called once internal processing had been done to update back the buffer provided by the user. This can lead to a failure in case the size accumulated in the xmlBuf is larger than what an xmlBuffer can support on 64 bits (INT_MAX) The xmlBufPtr @buf wrapper is deallocated by this call in any case.
Returns the old xmlBufferPtr unless the call failed and NULL is returned
Definition at line 1013 of file buf.c.
xmlBufCat: @buf: the buffer to add to @str: the xmlChar string
Append a zero terminated string to an XML buffer.
Returns 0 successful, a positive error code number otherwise and -1 in case of internal or API error.
Definition at line 884 of file buf.c.
Referenced by xmlBufCCat(), and xmlBufWriteQuotedString().
xmlBufCCat: @buf: the buffer to dump @str: the C char string
Append a zero terminated C string to an XML buffer.
Returns 0 successful, a positive error code number otherwise and -1 in case of internal or API error.
Definition at line 904 of file buf.c.
Referenced by xmlBufWriteQuotedString().
xmlBufContent: @buf: the buffer
Function to extract the content of a buffer
Returns the internal content
Definition at line 553 of file buf.c.
Referenced by xmlCharEncFirstLineInput(), xmlCharEncInput(), xmlParserInputGrow(), xmlParserInputShrink(), and xsltSaveResultToString().
xmlBufCreate:
routine to create an XML buffer. returns the new structure.
Definition at line 122 of file buf.c.
Referenced by xmlSwitchInputEncodingInt().
xmlBufCreateStatic: @mem: the memory area @size: the size in byte
routine to create an XML buffer from an immutable memory area. The area won't be modified nor copied, and is expected to be present until the end of the buffer lifetime.
returns the new structure.
xmlBufDetach: @buf: the buffer
Remove the string contained in a buffer and give it back to the caller. The buffer is reset to an empty content. This doesn't work with immutable buffers as they can't be reset.
Returns the previous string contained by the buffer.
Definition at line 519 of file buf.c.
xmlBufEnd: @buf: the buffer
Function to extract the end of the content of a buffer
Returns the end of the internal content or NULL in case of error
Definition at line 571 of file buf.c.
Referenced by xmlCharEncFirstLineInput(), xmlCharEncInput(), xmlParserInputGrow(), and xmlParserInputShrink().
xmlBufFree: @buf: the buffer to free
Frees an XML buffer. It frees both the content and the structure which encapsulate it.
Definition at line 322 of file buf.c.
Referenced by xmlBufBackToBuffer().
xmlBufPtr xmlBufFromBuffer | ( | xmlBufferPtr | buffer | ) |
xmlBufFromBuffer: @buffer: incoming old buffer to convert to a new one
Helper routine to switch from the old buffer structures in use in various APIs. It creates a wrapper xmlBufPtr which will be used for internal processing until the xmlBufBackToBuffer() is issued.
Returns a new xmlBufPtr unless the call failed and NULL is returned
size_t xmlBufGetInputBase | ( | xmlBufPtr | buf, |
xmlParserInputPtr | input | ||
) |
xmlBufGetInputBase: @buf: an xmlBufPtr @input: an xmlParserInputPtr
Get the base of the @input relative to the beginning of the buffer
Returns the size_t corresponding to the displacement
Definition at line 1113 of file buf.c.
Referenced by xmlCtxtResetPush().
xmlBufGrow: @buf: the buffer @len: the minimum free size to allocate
Grow the available space of an XML buffer, @len is the target value This is been kept compatible with xmlBufferGrow() as much as possible
Returns -1 in case of error or the length made available otherwise
Definition at line 498 of file buf.c.
Referenced by xmlCharEncFirstLineInput(), and xmlCharEncInput().
xmlBufGrowInternal: @buf: the buffer @len: the minimum free size to allocate
Grow the available space of an XML buffer, @len is the target value Error checking should be done on buf->error since using the return value doesn't work that well
Returns 0 in case of error or the length made available otherwise
Definition at line 430 of file buf.c.
Referenced by xmlBufGrow().
xmlBufIsEmpty: @buf: the buffer
Tell if a buffer is empty
Returns 0 if no, 1 if yes and -1 in case of error
Definition at line 673 of file buf.c.
Referenced by xmlSwitchInputEncodingInt().
xmlBufMemoryError: @extra: extra information
Handle an out of memory condition To be improved...
Definition at line 92 of file buf.c.
Referenced by xmlBufAdd(), xmlBufCreate(), xmlBufCreateSize(), xmlBufCreateStatic(), xmlBufFromBuffer(), xmlBufGrowInternal(), and xmlBufResize().
int xmlBufMergeBuffer | ( | xmlBufPtr | buf, |
xmlBufferPtr | buffer | ||
) |
xmlBufMergeBuffer: @buf: an xmlBufPtr @buffer: the buffer to consume into @buf
The content of @buffer is appended to @buf and @buffer is freed
Returns -1 in case of error, 0 otherwise, in any case @buffer is freed
Definition at line 1068 of file buf.c.
xmlBufOverflowError: @extra: extra information
Handle a buffer overflow error To be improved...
Definition at line 107 of file buf.c.
Referenced by xmlBufBackToBuffer(), and xmlBufGetInputBase().
int xmlBufResetInput | ( | xmlBufPtr | buf, |
xmlParserInputPtr | input | ||
) |
xmlBufResetInput: @buf: an xmlBufPtr @input: an xmlParserInputPtr
Update the input to use the current set of pointers from the buffer.
Returns -1 in case of error, 0 otherwise
Definition at line 1094 of file buf.c.
Referenced by xmlCreateMemoryParserCtxt(), xmlCtxtResetPush(), xmlNewInputFromFile(), xmlNewIOInputStream(), and xmlSwitchInputEncodingInt().
xmlBufResize: @buf: the buffer to resize @size: the desired size
Resize a buffer to accommodate minimum size of @size.
Returns 0 in case of problems, 1 otherwise
Definition at line 692 of file buf.c.
Referenced by xmlBufAdd().
int xmlBufSetAllocationScheme | ( | xmlBufPtr | buf, |
xmlBufferAllocationScheme | scheme | ||
) |
xmlBufSetAllocationScheme: @buf: the buffer to tune @scheme: allocation scheme to use
Sets the allocation scheme for this buffer
returns 0 in case of success and -1 in case of failure
Definition at line 281 of file buf.c.
int xmlBufSetInputBaseCur | ( | xmlBufPtr | buf, |
xmlParserInputPtr | input, | ||
size_t | base, | ||
size_t | cur | ||
) |
xmlBufSetInputBaseCur: @buf: an xmlBufPtr @input: an xmlParserInputPtr @base: the base value relative to the beginning of the buffer @cur: the cur value relative to the beginning of the buffer
Update the input to use the base and cur relative to the buffer after a possible reallocation of its content
Returns -1 in case of error, 0 otherwise
Definition at line 1144 of file buf.c.
Referenced by xmlCtxtResetPush().
xmlBufShrink: @buf: the buffer to dump @len: the number of xmlChar to remove
Remove the beginning of an XML buffer. NOTE that this routine behaviour differs from xmlBufferShrink() as it will return 0 on error instead of -1 due to size_t being used as the return type.
Returns the number of byte removed or 0 in case of failure
Definition at line 381 of file buf.c.
Referenced by xmlCharEncFirstLineInput(), xmlCharEncInput(), xmlParserInputShrink(), and xmlSwitchInputEncodingInt().
xmlBufUse: @buf: the buffer
Function to get the length of a buffer
Returns the length of data in the internal content
Definition at line 633 of file buf.c.
Referenced by xmlCharEncFirstLineInput(), xmlCharEncInput(), xmlParserInputGrow(), xmlParserInputShrink(), xmlSwitchInputEncodingInt(), and xsltSaveResultToString().
xmlBufWriteQuotedString: @buf: the XML buffer output @string: the string to add
routine which manage and grows an output buffer. This one writes a quoted or double quoted xmlChar string, checking first if it holds quote or double-quotes internally
Returns 0 if successful, a positive error code number otherwise and -1 in case of internal or API error.
Definition at line 921 of file buf.c.