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