/src/libxml2/include/private/parser.h
Line | Count | Source (jump to first uncovered line) |
1 | | #ifndef XML_PARSER_H_PRIVATE__ |
2 | | #define XML_PARSER_H_PRIVATE__ |
3 | | |
4 | | #include <limits.h> |
5 | | |
6 | | #include <libxml/parser.h> |
7 | | #include <libxml/xmlversion.h> |
8 | | |
9 | 160M | #define XML_INVALID_CHAR 0x200000 |
10 | | |
11 | 770 | #define XML_MAX_URI_LENGTH 2000 |
12 | | |
13 | | /** |
14 | | * Set after xmlValidateDtdFinal was called. |
15 | | */ |
16 | 0 | #define XML_VCTXT_DTD_VALIDATED (1u << 0) |
17 | | /** |
18 | | * Set if the validation context is part of a parser context. |
19 | | */ |
20 | 19.5k | #define XML_VCTXT_USE_PCTXT (1u << 1) |
21 | | /** |
22 | | * Set if the validation is enabled. |
23 | | */ |
24 | 70.6k | #define XML_VCTXT_VALIDATE (1u << 2) |
25 | | |
26 | | /* |
27 | | * TODO: Rename to avoid confusion with xmlParserInputFlags |
28 | | */ |
29 | 30.1k | #define XML_INPUT_HAS_ENCODING (1u << 0) |
30 | 1.34k | #define XML_INPUT_AUTO_ENCODING (7u << 1) |
31 | 744 | #define XML_INPUT_AUTO_UTF8 (1u << 1) |
32 | 416 | #define XML_INPUT_AUTO_UTF16LE (2u << 1) |
33 | 294 | #define XML_INPUT_AUTO_UTF16BE (3u << 1) |
34 | 52 | #define XML_INPUT_AUTO_OTHER (4u << 1) |
35 | 5.44k | #define XML_INPUT_USES_ENC_DECL (1u << 4) |
36 | 2.50M | #define XML_INPUT_ENCODING_ERROR (1u << 5) |
37 | 16.3M | #define XML_INPUT_PROGRESSIVE (1u << 6) |
38 | 0 | #define XML_INPUT_MARKUP_DECL (1u << 7) |
39 | | |
40 | 144M | #define PARSER_STOPPED(ctxt) ((ctxt)->disableSAX > 1) |
41 | | |
42 | | #define PARSER_PROGRESSIVE(ctxt) \ |
43 | 16.1M | ((ctxt)->input->flags & XML_INPUT_PROGRESSIVE) |
44 | | |
45 | | #define PARSER_IN_PE(ctxt) \ |
46 | 330k | (((ctxt)->input->entity != NULL) && \ |
47 | 330k | (((ctxt)->input->entity->etype == XML_INTERNAL_PARAMETER_ENTITY) || \ |
48 | 0 | ((ctxt)->input->entity->etype == XML_EXTERNAL_PARAMETER_ENTITY))) |
49 | | |
50 | | #define PARSER_EXTERNAL(ctxt) \ |
51 | 511k | (((ctxt)->inSubset == 2) || \ |
52 | 511k | (((ctxt)->input->entity != NULL) && \ |
53 | 344k | ((ctxt)->input->entity->etype == XML_EXTERNAL_PARAMETER_ENTITY))) |
54 | | |
55 | | /** |
56 | | * The parser tries to always have that amount of input ready. |
57 | | * One of the point is providing context when reporting errors. |
58 | | */ |
59 | 166M | #define INPUT_CHUNK 250 |
60 | | |
61 | | struct _xmlAttrHashBucket { |
62 | | int index; |
63 | | }; |
64 | | |
65 | 16.9k | #define XML_SCAN_NC 1 |
66 | 355k | #define XML_SCAN_NMTOKEN 2 |
67 | 16.9k | #define XML_SCAN_OLD10 4 |
68 | | |
69 | | XML_HIDDEN const xmlChar * |
70 | | xmlScanName(const xmlChar *buf, size_t maxSize, int flags); |
71 | | |
72 | | XML_HIDDEN void |
73 | | xmlCtxtVErr(xmlParserCtxt *ctxt, xmlNode *node, xmlErrorDomain domain, |
74 | | xmlParserErrors code, xmlErrorLevel level, |
75 | | const xmlChar *str1, const xmlChar *str2, const xmlChar *str3, |
76 | | int int1, const char *msg, va_list ap); |
77 | | XML_HIDDEN void |
78 | | xmlCtxtErr(xmlParserCtxt *ctxt, xmlNode *node, xmlErrorDomain domain, |
79 | | xmlParserErrors code, xmlErrorLevel level, |
80 | | const xmlChar *str1, const xmlChar *str2, const xmlChar *str3, |
81 | | int int1, const char *msg, ...); |
82 | | XML_HIDDEN void |
83 | | xmlFatalErr(xmlParserCtxt *ctxt, xmlParserErrors error, const char *info); |
84 | | XML_HIDDEN void LIBXML_ATTR_FORMAT(3,0) |
85 | | xmlWarningMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, |
86 | | const char *msg, const xmlChar *str1, const xmlChar *str2); |
87 | | XML_HIDDEN void |
88 | | xmlCtxtErrIO(xmlParserCtxt *ctxt, int code, const char *uri); |
89 | | XML_HIDDEN int |
90 | | xmlCtxtIsCatastrophicError(xmlParserCtxt *ctxt); |
91 | | |
92 | | XML_HIDDEN int |
93 | | xmlParserGrow(xmlParserCtxt *ctxt); |
94 | | XML_HIDDEN void |
95 | | xmlParserShrink(xmlParserCtxt *ctxt); |
96 | | |
97 | | XML_HIDDEN void |
98 | | xmlDetectEncoding(xmlParserCtxt *ctxt); |
99 | | XML_HIDDEN void |
100 | | xmlSetDeclaredEncoding(xmlParserCtxt *ctxt, xmlChar *encoding); |
101 | | XML_HIDDEN const xmlChar * |
102 | | xmlGetActualEncoding(xmlParserCtxt *ctxt); |
103 | | |
104 | | XML_HIDDEN int |
105 | | nodePush(xmlParserCtxt *ctxt, xmlNode *value); |
106 | | XML_HIDDEN xmlNode * |
107 | | nodePop(xmlParserCtxt *ctxt); |
108 | | |
109 | | XML_HIDDEN xmlParserNsData * |
110 | | xmlParserNsCreate(void); |
111 | | XML_HIDDEN void |
112 | | xmlParserNsFree(xmlParserNsData *nsdb); |
113 | | /* |
114 | | * These functions allow SAX handlers to attach extra data to namespaces |
115 | | * efficiently and should be made public. |
116 | | */ |
117 | | XML_HIDDEN int |
118 | | xmlParserNsUpdateSax(xmlParserCtxt *ctxt, const xmlChar *prefix, |
119 | | void *saxData); |
120 | | XML_HIDDEN void * |
121 | | xmlParserNsLookupSax(xmlParserCtxt *ctxt, const xmlChar *prefix); |
122 | | |
123 | | XML_HIDDEN xmlParserInput * |
124 | | xmlLoadResource(xmlParserCtxt *ctxt, const char *url, const char *publicId, |
125 | | xmlResourceType type); |
126 | | XML_HIDDEN xmlParserInput * |
127 | | xmlCtxtNewInputFromUrl(xmlParserCtxt *ctxt, const char *url, |
128 | | const char *publicId, const char *encoding, |
129 | | xmlParserInputFlags flags); |
130 | | XML_HIDDEN xmlParserInput * |
131 | | xmlCtxtNewInputFromMemory(xmlParserCtxt *ctxt, const char *url, |
132 | | const void *mem, size_t size, |
133 | | const char *encoding, |
134 | | xmlParserInputFlags flags); |
135 | | XML_HIDDEN xmlParserInput * |
136 | | xmlCtxtNewInputFromString(xmlParserCtxt *ctxt, const char *url, |
137 | | const char *str, const char *encoding, |
138 | | xmlParserInputFlags flags); |
139 | | XML_HIDDEN xmlParserInput * |
140 | | xmlCtxtNewInputFromFd(xmlParserCtxt *ctxt, const char *filename, int fd, |
141 | | const char *encoding, xmlParserInputFlags flags); |
142 | | XML_HIDDEN xmlParserInput * |
143 | | xmlCtxtNewInputFromIO(xmlParserCtxt *ctxt, const char *url, |
144 | | xmlInputReadCallback ioRead, |
145 | | xmlInputCloseCallback ioClose, |
146 | | void *ioCtxt, |
147 | | const char *encoding, xmlParserInputFlags flags); |
148 | | XML_HIDDEN xmlParserInput * |
149 | | xmlNewPushInput(const char *url, const char *chunk, int size); |
150 | | |
151 | | XML_HIDDEN xmlChar * |
152 | | xmlExpandEntitiesInAttValue(xmlParserCtxt *ctxt, const xmlChar *str, |
153 | | int normalize); |
154 | | |
155 | | XML_HIDDEN void |
156 | | xmlParserCheckEOF(xmlParserCtxt *ctxt, xmlParserErrors code); |
157 | | |
158 | | XML_HIDDEN void |
159 | | xmlParserInputGetWindow(xmlParserInput *input, const xmlChar **startOut, |
160 | | int *sizeInOut, int *offsetOut); |
161 | | |
162 | | static XML_INLINE void |
163 | 41.2k | xmlSaturatedAdd(unsigned long *dst, unsigned long val) { |
164 | 41.2k | if (val > ULONG_MAX - *dst) |
165 | 0 | *dst = ULONG_MAX; |
166 | 41.2k | else |
167 | 41.2k | *dst += val; |
168 | 41.2k | } Line | Count | Source | 163 | 41.2k | xmlSaturatedAdd(unsigned long *dst, unsigned long val) { | 164 | 41.2k | if (val > ULONG_MAX - *dst) | 165 | 0 | *dst = ULONG_MAX; | 166 | 41.2k | else | 167 | 41.2k | *dst += val; | 168 | 41.2k | } |
Unexecuted instantiation: parserInternals.c:xmlSaturatedAdd Unexecuted instantiation: SAX2.c:xmlSaturatedAdd Unexecuted instantiation: tree.c:xmlSaturatedAdd Unexecuted instantiation: valid.c:xmlSaturatedAdd Unexecuted instantiation: xmlstring.c:xmlSaturatedAdd Unexecuted instantiation: HTMLparser.c:xmlSaturatedAdd Unexecuted instantiation: xpath.c:xmlSaturatedAdd Unexecuted instantiation: error.c:xmlSaturatedAdd Unexecuted instantiation: pattern.c:xmlSaturatedAdd Unexecuted instantiation: xmlreader.c:xmlSaturatedAdd Unexecuted instantiation: xinclude.c:xmlSaturatedAdd |
169 | | |
170 | | static XML_INLINE void |
171 | 879k | xmlSaturatedAddSizeT(unsigned long *dst, size_t val) { |
172 | 879k | if (val > ULONG_MAX - *dst) |
173 | 0 | *dst = ULONG_MAX; |
174 | 879k | else |
175 | 879k | *dst += val; |
176 | 879k | } parser.c:xmlSaturatedAddSizeT Line | Count | Source | 171 | 76.2k | xmlSaturatedAddSizeT(unsigned long *dst, size_t val) { | 172 | 76.2k | if (val > ULONG_MAX - *dst) | 173 | 0 | *dst = ULONG_MAX; | 174 | 76.2k | else | 175 | 76.2k | *dst += val; | 176 | 76.2k | } |
parserInternals.c:xmlSaturatedAddSizeT Line | Count | Source | 171 | 802k | xmlSaturatedAddSizeT(unsigned long *dst, size_t val) { | 172 | 802k | if (val > ULONG_MAX - *dst) | 173 | 0 | *dst = ULONG_MAX; | 174 | 802k | else | 175 | 802k | *dst += val; | 176 | 802k | } |
Unexecuted instantiation: SAX2.c:xmlSaturatedAddSizeT Unexecuted instantiation: tree.c:xmlSaturatedAddSizeT Unexecuted instantiation: valid.c:xmlSaturatedAddSizeT Unexecuted instantiation: xmlstring.c:xmlSaturatedAddSizeT Unexecuted instantiation: HTMLparser.c:xmlSaturatedAddSizeT Unexecuted instantiation: xpath.c:xmlSaturatedAddSizeT Unexecuted instantiation: error.c:xmlSaturatedAddSizeT Unexecuted instantiation: pattern.c:xmlSaturatedAddSizeT Unexecuted instantiation: xmlreader.c:xmlSaturatedAddSizeT Unexecuted instantiation: xinclude.c:xmlSaturatedAddSizeT |
177 | | |
178 | | #endif /* XML_PARSER_H_PRIVATE__ */ |