ReactOS
0.4.15-dev-2087-g6bfb76b
|
#include "libxml.h"
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <stdlib.h>
#include <libxml/encoding.h>
#include <libxml/xmlmemory.h>
#include <libxml/globals.h>
#include <libxml/xmlerror.h>
#include "buf.h"
#include "enc.h"
#include "elfgcchack.h"
Go to the source code of this file.
Classes | |
struct | _xmlCharEncodingAlias |
Macros | |
#define | IN_LIBXML |
Typedefs | |
typedef struct _xmlCharEncodingAlias | xmlCharEncodingAlias |
typedef xmlCharEncodingAlias * | xmlCharEncodingAliasPtr |
Variables | |
static xmlCharEncodingHandlerPtr | xmlUTF16LEHandler = NULL |
static xmlCharEncodingHandlerPtr | xmlUTF16BEHandler = NULL |
static xmlCharEncodingAliasPtr | xmlCharEncodingAliases = NULL |
static int | xmlCharEncodingAliasesNb = 0 |
static int | xmlCharEncodingAliasesMax = 0 |
static int | xmlLittleEndian = 1 |
: the encoding name as parsed, in UTF-8 format (ASCII actually) | |
Compare the string to the encoding schemes already known. Note that the comparison is case insensitive accordingly to the section [XML] 4.3.3 Character Encoding in Entities. Returns one of the XML_CHAR_ENCODING_... values or XML_CHAR_ENCODING_NONE if not recognized. | |
#define | MAX_ENCODING_HANDLERS 50 |
static xmlCharEncodingHandlerPtr * | handlers = NULL |
static int | nbCharEncodingHandler = 0 |
static xmlCharEncodingHandlerPtr | xmlDefaultCharEncodingHandler = NULL |
xmlCharEncoding | xmlParseCharEncoding (const char *name) |
const char * | xmlGetCharEncodingName (xmlCharEncoding enc) |
#define bottom_encoding |
Definition at line 3917 of file encoding.c.
#define IN_LIBXML |
Definition at line 23 of file encoding.c.
#define MAX_ENCODING_HANDLERS 50 |
Definition at line 1296 of file encoding.c.
Definition at line 54 of file encoding.c.
Definition at line 55 of file encoding.c.
|
static |
asciiToUTF8: @out: a pointer to an array of bytes to store the result @outlen: the length of @out @in: a pointer to an array of ASCII chars @inlen: the length of @in
Take a block of ASCII chars in and try to convert it to an UTF-8 block of chars out. Returns 0 if success, or -1 otherwise The value of @inlen after return is the number of octets consumed if the return value is positive, else unpredictable. The value of @outlen after return is the number of octets consumed.
Definition at line 176 of file encoding.c.
Referenced by xmlInitCharEncodingHandlers().
isolat1ToUTF8: @out: a pointer to an array of bytes to store the result @outlen: the length of @out @in: a pointer to an array of ISO Latin 1 chars @inlen: the length of @in
Take a block of ISO Latin 1 chars in and try to convert it to an UTF-8 block of chars out. Returns the number of bytes written if success, or -1 otherwise The value of @inlen after return is the number of octets consumed if the return value is positive, else unpredictable. The value of @outlen after return is the number of octets consumed.
Definition at line 307 of file encoding.c.
Referenced by xmlInitCharEncodingHandlers().
|
static |
xmlErrEncoding: @error: the error number @msg: the error message
n encoding error
Definition at line 96 of file encoding.c.
|
static |
UTF16BEToUTF8: @out: a pointer to an array of bytes to store the result @outlen: the length of @out @inb: a pointer to an array of UTF-16 passed as a byte array @inlenb: the length of @in in UTF-16 chars
Take a block of UTF-16 ushorts in and try to convert it to an UTF-8 block of chars out. This function assumes the endian property is the same between the native type of this machine and the inputed one.
Returns the number of bytes written, or -1 if lack of space, or -2 if the transcoding fails (if *in is not a valid utf16 string) The value of *inlen after return is the number of octets consumed if the return value is positive, else unpredictable.
Definition at line 732 of file encoding.c.
Referenced by xmlInitCharEncodingHandlers().
|
static |
UTF16LEToUTF8: @out: a pointer to an array of bytes to store the result @outlen: the length of @out @inb: a pointer to an array of UTF-16LE passwd as a byte array @inlenb: the length of @in in UTF-16LE chars
Take a block of UTF-16LE ushorts in and try to convert it to an UTF-8 block of chars out. This function assumes the endian property is the same between the native type of this machine and the inputed one.
Returns the number of bytes written, or -1 if lack of space, or -2 if the transcoding fails (if *in is not a valid utf16 string) The value of *inlen after return is the number of octets consumed if the return value is positive, else unpredictable.
Definition at line 494 of file encoding.c.
Referenced by xmlInitCharEncodingHandlers().
|
static |
UTF8ToUTF8: @out: a pointer to an array of bytes to store the result @outlen: the length of @out @inb: a pointer to an array of UTF-8 chars @inlenb: the length of @in in UTF-8 chars
No op copy operation for UTF8 handling.
Returns the number of bytes written, or -1 if lack of space. The value of *inlen after return is the number of octets consumed if the return value is positive, else unpredictable.
Definition at line 355 of file encoding.c.
Referenced by xmlInitCharEncodingHandlers().
Definition at line 1057 of file encoding.c.
Referenced by main().
long xmlByteConsumed | ( | xmlParserCtxtPtr | ctxt | ) |
xmlByteConsumed: @ctxt: an XML parser context
This function provides the current index of the parser relative to the start of the current entity. This function is computed in bytes from the beginning starting at zero and finishing at the size in byte of the file if parsing a file. The function is of constant cost if the input is UTF-8 but can be costly if run on non-UTF-8 input.
Returns the index in bytes from the beginning of the entity or -1 in case the index could not be computed.
Definition at line 2803 of file encoding.c.
int xmlCharEncCloseFunc | ( | xmlCharEncodingHandler * | handler | ) |
xmlCharEncCloseFunc: @handler: char encoding transformation data structure
Generic front-end for encoding handler close function
Returns 0 if success, or -1 in case of error
Definition at line 2720 of file encoding.c.
Referenced by xmlSwitchInputEncodingInt().
int xmlCharEncFirstLine | ( | xmlCharEncodingHandler * | handler, |
xmlBufferPtr | out, | ||
xmlBufferPtr | in | ||
) |
xmlCharEncFirstLine: @handler: char encoding transformation data structure @out: an xmlBuffer for the output. @in: an xmlBuffer for the input
Front-end for the encoding handler input function, but handle only the very first line, i.e. limit itself to 45 chars.
Returns the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or
Definition at line 2075 of file encoding.c.
int xmlCharEncFirstLineInput | ( | xmlParserInputBufferPtr | input, |
int | len | ||
) |
xmlCharEncFirstLineInput: @input: a parser input buffer @len: number of bytes to convert for the first line, or -1
Front-end for the encoding handler input function, but handle only the very first line. Point is that this is based on autodetection of the encoding and once that first line is converted we may find out that a different decoder is needed to process the input.
Returns the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or
Definition at line 2096 of file encoding.c.
Referenced by xmlSwitchInputEncodingInt().
int xmlCharEncFirstLineInt | ( | xmlCharEncodingHandler * | handler, |
xmlBufferPtr | out, | ||
xmlBufferPtr | in, | ||
int | len | ||
) |
xmlCharEncFirstLineInt: @handler: char encoding transformation data structure @out: an xmlBuffer for the output. @in: an xmlBuffer for the input @len: number of bytes to convert for the first line, or -1
Front-end for the encoding handler input function, but handle only the very first line, i.e. limit itself to 45 chars.
Returns the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or
Definition at line 1989 of file encoding.c.
Referenced by xmlCharEncFirstLine().
int xmlCharEncInFunc | ( | xmlCharEncodingHandler * | handler, |
xmlBufferPtr | out, | ||
xmlBufferPtr | in | ||
) |
xmlCharEncInFunc: @handler: char encoding transformation data structure @out: an xmlBuffer for the output. @in: an xmlBuffer for the input
Generic front-end for the encoding handler input function
Returns the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or
Definition at line 2302 of file encoding.c.
int xmlCharEncInput | ( | xmlParserInputBufferPtr | input, |
int | flush | ||
) |
xmlCharEncInput: @input: a parser input buffer @flush: try to flush all the raw buffer
Generic front-end for the encoding handler on parser input
Returns the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or
Definition at line 2203 of file encoding.c.
Referenced by xmlSwitchInputEncodingInt().
int xmlCharEncOutFunc | ( | xmlCharEncodingHandler * | handler, |
xmlBufferPtr | out, | ||
xmlBufferPtr | in | ||
) |
xmlCharEncOutFunc: @handler: char encoding transformation data structure @out: an xmlBuffer for the output. @in: an xmlBuffer for the input
Generic front-end for the encoding handler output function a first call with @in == NULL has to be made firs to initiate the output in case of non-stateless encoding needing to initiate their state or the output (like the BOM in UTF16). In case of UTF8 sequence conversion errors for the given encoder, the content will be automatically remapped to a CharRef sequence.
Returns the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or
Definition at line 2566 of file encoding.c.
xmlCleanupCharEncodingHandlers:
Cleanup the memory allocated for the char encoding support, it unregisters all the encoding handlers and the aliases.
Definition at line 1455 of file encoding.c.
Referenced by xmlCleanupParser().
xmlCleanupEncodingAliases:
Unregisters all aliases
Definition at line 992 of file encoding.c.
Referenced by xmlCleanupCharEncodingHandlers().
xmlDelEncodingAlias: @alias: the alias name as parsed, in UTF-8 format (ASCII actually)
Unregisters an encoding alias @alias
Returns 0 in case of success, -1 in case of error
Definition at line 1114 of file encoding.c.
xmlCharEncoding xmlDetectCharEncoding | ( | const unsigned char * | in, |
int | len | ||
) |
xmlDetectCharEncoding: @in: a pointer to the first bytes of the XML entity, must be at least 2 bytes long (at least 4 if encoding is UTF4 variant). @len: pointer to the length of the buffer
Guess the encoding of the entity using the first bytes of the entity content according to the non-normative appendix F of the XML-1.0 recommendation.
Returns one of the XML_CHAR_ENCODING_... values.
Definition at line 932 of file encoding.c.
Referenced by xmlCtxtResetPush(), xmlParseCtxtExternalEntity(), xmlParseDocument(), xmlParseExternalEntityPrivate(), xmlParseExternalSubset(), xmlParseExtParsedEnt(), xmlParsePEReference(), and xmlSAX2ExternalSubset().
|
static |
Definition at line 1916 of file encoding.c.
Referenced by xmlCharEncFirstLineInput(), xmlCharEncFirstLineInt(), xmlCharEncInFunc(), and xmlCharEncInput().
xmlEncodingErrMemory: @extra: extra informations
Handle an out of memory condition
Definition at line 84 of file encoding.c.
Referenced by xmlInitCharEncodingHandlers(), and xmlNewCharEncodingHandler().
|
static |
Definition at line 1946 of file encoding.c.
Referenced by xmlByteConsumed(), and xmlCharEncOutFunc().
xmlCharEncodingHandlerPtr xmlFindCharEncodingHandler | ( | const char * | name | ) |
Definition at line 1641 of file encoding.c.
Referenced by xmlCtxtResetPush(), xmlDoRead(), xmlGetCharEncodingHandler(), xmlParseEncodingDecl(), xmlParseInNodeContext(), xsltSaveResultToFd(), xsltSaveResultToFile(), xsltSaveResultToFilename(), and xsltSaveResultToString().
xmlCharEncodingHandlerPtr xmlGetCharEncodingHandler | ( | xmlCharEncoding | enc | ) |
xmlGetCharEncodingHandler: @enc: an xmlCharEncoding value.
Search in the registered set the handler able to read/write that encoding.
Returns the handler or NULL if not found
Definition at line 1507 of file encoding.c.
Referenced by xmlSwitchEncoding().
const char* xmlGetCharEncodingName | ( | xmlCharEncoding | enc | ) |
xmlGetCharEncodingName: @enc: the encoding
The "canonical" name for XML encoding. C.f. http://www.w3.org/TR/REC-xml#charencoding Section 4.3.3 Character Encoding in Entities
Returns the canonical name for the given encoding
Definition at line 1234 of file encoding.c.
Referenced by xmlFindCharEncodingHandler(), and xsltSaveResultTo().
xmlGetEncodingAlias: @alias: the alias name as parsed, in UTF-8 format (ASCII actually)
Lookup an encoding name for the given alias.
Returns NULL if not found, otherwise the original name
Definition at line 1019 of file encoding.c.
Referenced by xmlFindCharEncodingHandler(), xmlNewCharEncodingHandler(), and xmlParseCharEncoding().
xmlInitCharEncodingHandlers:
Initialize the char encoding support, it registers the default encoding supported. NOTE: while public, this function usually doesn't need to be called in normal processing.
Definition at line 1397 of file encoding.c.
Referenced by xmlFindCharEncodingHandler(), xmlGetCharEncodingHandler(), xmlInitParser(), and xmlRegisterCharEncodingHandler().
xmlCharEncodingHandlerPtr xmlNewCharEncodingHandler | ( | const char * | name, |
xmlCharEncodingInputFunc | input, | ||
xmlCharEncodingOutputFunc | output | ||
) |
Definition at line 1318 of file encoding.c.
Referenced by xmlInitCharEncodingHandlers().
xmlCharEncoding xmlParseCharEncoding | ( | const char * | name | ) |
Definition at line 1150 of file encoding.c.
Referenced by xmlFindCharEncodingHandler().
void xmlRegisterCharEncodingHandler | ( | xmlCharEncodingHandlerPtr | handler | ) |
xmlRegisterCharEncodingHandler: @handler: the xmlCharEncodingHandlerPtr handler block
Register the char encoding handler, surprising, isn't it ?
Definition at line 1481 of file encoding.c.
Referenced by xmlNewCharEncodingHandler().
|
static |
Definition at line 1297 of file encoding.c.
Referenced by compile_state_table(), find_sink_entry(), notify_DllMain(), notify_TlsCallback(), xmlCharEncCloseFunc(), xmlCleanupCharEncodingHandlers(), xmlFindCharEncodingHandler(), xmlGetCharEncodingHandler(), xmlInitCharEncodingHandlers(), and xmlRegisterCharEncodingHandler().
|
static |
Definition at line 1298 of file encoding.c.
Referenced by xmlCharEncCloseFunc(), xmlCleanupCharEncodingHandlers(), xmlFindCharEncodingHandler(), and xmlRegisterCharEncodingHandler().
|
static |
Definition at line 61 of file encoding.c.
Referenced by xmlAddEncodingAlias(), xmlCleanupEncodingAliases(), xmlDelEncodingAlias(), and xmlGetEncodingAlias().
|
static |
Definition at line 63 of file encoding.c.
Referenced by xmlAddEncodingAlias(), and xmlCleanupEncodingAliases().
|
static |
Definition at line 62 of file encoding.c.
Referenced by xmlAddEncodingAlias(), xmlCleanupEncodingAliases(), xmlDelEncodingAlias(), and xmlGetEncodingAlias().
|
static |
Definition at line 1305 of file encoding.c.
Referenced by xmlCleanupCharEncodingHandlers(), and xmlFindCharEncodingHandler().
|
static |
Definition at line 75 of file encoding.c.
Referenced by UTF16BEToUTF8(), UTF16LEToUTF8(), and xmlInitCharEncodingHandlers().
|
static |
Definition at line 52 of file encoding.c.
Referenced by xmlGetCharEncodingHandler(), and xmlInitCharEncodingHandlers().
|
static |
Definition at line 51 of file encoding.c.
Referenced by xmlGetCharEncodingHandler(), and xmlInitCharEncodingHandlers().