File: | libsynthesis/src/syncml_tk/src/sml/xlt/all/xltdecxml.c |
Warning: | line 933, column 25 Function call argument is an uninitialized value |
1 | /** | |||
2 | * @file | |||
3 | * XML scanner | |||
4 | * | |||
5 | * @target_system all | |||
6 | * @target_os all | |||
7 | * @description The XML scanner/tokenizer. Used by the SyncML parser. | |||
8 | */ | |||
9 | ||||
10 | /* | |||
11 | * Copyright Notice | |||
12 | * Copyright (c) Ericsson, IBM, Lotus, Matsushita Communication | |||
13 | * Industrial Co., Ltd., Motorola, Nokia, Openwave Systems, Inc., | |||
14 | * Palm, Inc., Psion, Starfish Software, Symbian, Ltd. (2001). | |||
15 | * All Rights Reserved. | |||
16 | * Implementation of all or part of any Specification may require | |||
17 | * licenses under third party intellectual property rights, | |||
18 | * including without limitation, patent rights (such a third party | |||
19 | * may or may not be a Supporter). The Sponsors of the Specification | |||
20 | * are not responsible and shall not be held responsible in any | |||
21 | * manner for identifying or failing to identify any or all such | |||
22 | * third party intellectual property rights. | |||
23 | * | |||
24 | * THIS DOCUMENT AND THE INFORMATION CONTAINED HEREIN ARE PROVIDED | |||
25 | * ON AN "AS IS" BASIS WITHOUT WARRANTY OF ANY KIND AND ERICSSON, IBM, | |||
26 | * LOTUS, MATSUSHITA COMMUNICATION INDUSTRIAL CO. LTD, MOTOROLA, | |||
27 | * NOKIA, PALM INC., PSION, STARFISH SOFTWARE AND ALL OTHER SYNCML | |||
28 | * SPONSORS DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING | |||
29 | * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION | |||
30 | * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF | |||
31 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT | |||
32 | * SHALL ERICSSON, IBM, LOTUS, MATSUSHITA COMMUNICATION INDUSTRIAL CO., | |||
33 | * LTD, MOTOROLA, NOKIA, PALM INC., PSION, STARFISH SOFTWARE OR ANY | |||
34 | * OTHER SYNCML SPONSOR BE LIABLE TO ANY PARTY FOR ANY LOSS OF | |||
35 | * PROFITS, LOSS OF BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF | |||
36 | * BUSINESS, OR FOR DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL, | |||
37 | * PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND IN CONNECTION WITH | |||
38 | * THIS DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED | |||
39 | * OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE. | |||
40 | * | |||
41 | * The above notice and this paragraph must be included on all copies | |||
42 | * of this document that are made. | |||
43 | * | |||
44 | */ | |||
45 | ||||
46 | #include "syncml_tk_prefix_file.h" // %%% luz: needed for precompiled headers in eVC++ | |||
47 | ||||
48 | #include "define.h" | |||
49 | #ifdef __SML_XML__ | |||
50 | /*************************************************************************/ | |||
51 | /* Definitions */ | |||
52 | /*************************************************************************/ | |||
53 | #include "xltdeccom.h" | |||
54 | #include "xlttags.h" | |||
55 | #include "xltdec.h" | |||
56 | ||||
57 | #include <libmem.h> | |||
58 | #include <libstr.h> | |||
59 | ||||
60 | #include <smlerr.h> | |||
61 | ||||
62 | /** @copydoc wbxmlScannerPriv_s */ | |||
63 | typedef struct xmlScannerPriv_s xmlScannerPriv_t, *xmlScannerPrivPtr_t; | |||
64 | /** | |||
65 | * Private Interface for the XML scanner. | |||
66 | */ | |||
67 | struct xmlScannerPriv_s | |||
68 | { | |||
69 | /* public */ | |||
70 | Ret_t (*nextTok)(XltDecScannerPtr_t); | |||
71 | Ret_t (*destroy)(XltDecScannerPtr_t); | |||
72 | Ret_t (*pushTok)(XltDecScannerPtr_t); | |||
73 | void (*setBuf)(XltDecScannerPtr_t pScanner, const MemPtr_t pBufStart, const MemPtr_t pBufEnd); | |||
74 | MemPtr_t (*getPos)(XltDecScannerPtr_t pScanner, Long_t *remaining); | |||
75 | ||||
76 | XltDecTokenPtr_t curtok; /**< current token */ | |||
77 | Long_t charset; /**< 0 */ | |||
78 | String_t charsetStr; /**< character set */ | |||
79 | Long_t pubID; /**< 0 */ | |||
80 | String_t pubIDStr; /**< document public identifier */ | |||
81 | SmlPcdataExtension_t ext; /**< which is the actual open namespace ? */ | |||
82 | SmlPcdataExtension_t prev_ext; /**< which is the previous open namespace ? */ | |||
83 | XltTagID_t ext_tag; /**< which tag started the actual namespace ? */ | |||
84 | XltTagID_t prev_ext_tag; /**< which tag started the previous open namespace ? */ | |||
85 | String_t nsprefix; /**< prefix used for active namespace (if any) */ | |||
86 | Byte_t nsprelen; /**< how long is the prefix ? (to save smlLibStrlen calls) */ | |||
87 | Flag_t finished; | |||
88 | ||||
89 | /* private */ | |||
90 | MemPtr_t pos; /**< current position */ | |||
91 | MemPtr_t bufend; /**< end of buffer */ | |||
92 | }; | |||
93 | ||||
94 | /* | |||
95 | * Public methods of the scanner interface. | |||
96 | * | |||
97 | * Description see XLTDecCom.h. | |||
98 | */ | |||
99 | static Ret_t _destroy(XltDecScannerPtr_t); | |||
100 | static Ret_t _nextTok(XltDecScannerPtr_t); | |||
101 | static Ret_t _pushTok(XltDecScannerPtr_t); | |||
102 | static void _setBuf(XltDecScannerPtr_t, const MemPtr_t, const MemPtr_t); | |||
103 | static MemPtr_t _getPos(XltDecScannerPtr_t, Long_t *remaining); | |||
104 | ||||
105 | /** | |||
106 | * Advance the current position pointer after checking whether the end of | |||
107 | * the buffer has been reached. If the end of the buffer has been reached | |||
108 | * the scanner's finished flag is set. | |||
109 | * | |||
110 | * @param bytes (IN) | |||
111 | * read this many bytes | |||
112 | * @param pScanner (IN/OUT) | |||
113 | * the scanner | |||
114 | * @return 1, if end of buffer has not been reached\n | |||
115 | * 0 otherwise | |||
116 | */ | |||
117 | static Boolean_t readBytes(xmlScannerPrivPtr_t pScanner, Long_t bytes); | |||
118 | ||||
119 | /* | |||
120 | * Skip whitespaces. | |||
121 | */ | |||
122 | static void skipS(xmlScannerPrivPtr_t pScanner); | |||
123 | ||||
124 | /** | |||
125 | * BOM processing. Currently only check BOMs for UTF-8, UTF-16le, UTF-16be, | |||
126 | * UTF-32le and UTF-32be. Note that SML_ERR_XLT_ENC_UNK is also returned | |||
127 | * when BOMs of UTF-16le, UTF-16be, UTF-32le and UTF-32be are processed for | |||
128 | * these encodings are not supported in the current code base. | |||
129 | * @param pScanner (IN/OUT) | |||
130 | * the scanner | |||
131 | * @return SML_ERR_OK if UTF-8 BOM or UTF-8 characters without a BOM | |||
132 | * or 8-bit encodings like US-ACII | |||
133 | * SML_ERR_XLT_ENC_UNK if other Encodings or Encoding BOMs | |||
134 | */ | |||
135 | static Ret_t bomDecl(xmlScannerPrivPtr_t pScanner); | |||
136 | ||||
137 | static Ret_t xmlTag(xmlScannerPrivPtr_t pScanner, Byte_t endtag); | |||
138 | static Ret_t xmlName(xmlScannerPrivPtr_t pScanner, String_t *name); | |||
139 | static Ret_t xmlCharData(xmlScannerPrivPtr_t pScanner); | |||
140 | static Ret_t xmlProlog(xmlScannerPrivPtr_t pScanner); | |||
141 | static Ret_t xmlDocTypeDecl(xmlScannerPrivPtr_t pScanner); | |||
142 | static Ret_t xmlXMLDecl(xmlScannerPrivPtr_t pScanner); | |||
143 | static Ret_t xmlAttribute(xmlScannerPrivPtr_t pScanner, String_t *name, String_t *value); | |||
144 | static Ret_t xmlStringConst(xmlScannerPrivPtr_t pScanner, String_t *value); | |||
145 | ||||
146 | static Ret_t xmlSkipPCDATA(xmlScannerPrivPtr_t pScanner); | |||
147 | static Ret_t xmlSkipComment(xmlScannerPrivPtr_t pScanner); | |||
148 | static Ret_t xmlSkipAttributes(xmlScannerPrivPtr_t pScanner); | |||
149 | static Ret_t xmlSkipPI(xmlScannerPrivPtr_t pScanner); | |||
150 | static Ret_t xmlCDATA(xmlScannerPrivPtr_t pScanner); | |||
151 | Boolean_t isPcdata(XltTagID_t tagid); | |||
152 | ||||
153 | /*************************************************************************/ | |||
154 | /* External Functions */ | |||
155 | /*************************************************************************/ | |||
156 | ||||
157 | ||||
158 | Ret_t | |||
159 | xltDecXmlInit(const MemPtr_t pBufEnd, MemPtr_t *ppBufPos, XltDecScannerPtr_t *ppScanner) | |||
160 | { | |||
161 | xmlScannerPrivPtr_t pScanner; | |||
162 | Ret_t rc; | |||
163 | ||||
164 | pScanner = (xmlScannerPrivPtr_t)smlLibMalloc(sizeof(xmlScannerPriv_t)); | |||
165 | if (pScanner == NULL((void*)0)) { | |||
166 | *ppScanner = NULL((void*)0); | |||
167 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
168 | } | |||
169 | ||||
170 | memset(pScanner, 0, sizeof(*pScanner)); | |||
171 | pScanner->pos = *ppBufPos; | |||
172 | pScanner->bufend = pBufEnd; | |||
173 | pScanner->curtok = (XltDecTokenPtr_t)smlLibMalloc(sizeof(XltDecToken_t)); | |||
174 | if (pScanner->curtok == NULL((void*)0)) { | |||
175 | smlLibFree(pScanner); | |||
176 | *ppScanner = NULL((void*)0); | |||
177 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
178 | } | |||
179 | ||||
180 | memset(pScanner->curtok, 0, sizeof(*pScanner->curtok)); | |||
181 | pScanner->curtok->tagid = TN_UNDEF; | |||
182 | pScanner->ext = SML_EXT_UNDEFINED; | |||
183 | pScanner->prev_ext = (SmlPcdataExtension_t)255; | |||
184 | pScanner->ext_tag = TN_UNDEF; | |||
185 | pScanner->prev_ext_tag = TN_UNDEF; | |||
186 | ||||
187 | /* point public/private methods to the right implementation */ | |||
188 | pScanner->nextTok = _nextTok; | |||
189 | pScanner->destroy = _destroy; | |||
190 | pScanner->pushTok = _pushTok; | |||
191 | pScanner->setBuf = _setBuf; | |||
192 | pScanner->getPos = _getPos; | |||
193 | ||||
194 | if((rc = bomDecl(pScanner)) != SML_ERR_OK0x00) | |||
195 | return rc; | |||
196 | ||||
197 | if ((rc = xmlProlog(pScanner)) != SML_ERR_OK0x00) { | |||
198 | smlLibFree(pScanner->curtok); | |||
199 | smlLibFree(pScanner); | |||
200 | *ppScanner = NULL((void*)0); | |||
201 | return rc; | |||
202 | } | |||
203 | ||||
204 | *ppScanner = (XltDecScannerPtr_t)pScanner; | |||
205 | ||||
206 | ||||
207 | ||||
208 | return SML_ERR_OK0x00; | |||
209 | } | |||
210 | ||||
211 | /** | |||
212 | * Free memory. Description see XltDecAll.h. | |||
213 | */ | |||
214 | static Ret_t | |||
215 | _destroy(XltDecScannerPtr_t pScanner) | |||
216 | { | |||
217 | xmlScannerPrivPtr_t pScannerPriv; | |||
218 | ||||
219 | if (pScanner == NULL((void*)0)) | |||
220 | return SML_ERR_OK0x00; | |||
221 | ||||
222 | pScannerPriv = (xmlScannerPrivPtr_t)pScanner; | |||
223 | smlLibFree(pScannerPriv->curtok); | |||
224 | smlLibFree(pScannerPriv->charsetStr); | |||
225 | smlLibFree(pScannerPriv->pubIDStr); | |||
226 | smlLibFree(pScannerPriv); | |||
227 | ||||
228 | return SML_ERR_OK0x00; | |||
229 | } | |||
230 | ||||
231 | /** | |||
232 | * Get next token. Description see XltDecAll.h. | |||
233 | */ | |||
234 | static Ret_t | |||
235 | _nextTok(XltDecScannerPtr_t pScanner) | |||
236 | { | |||
237 | xmlScannerPrivPtr_t pScannerPriv; | |||
238 | Ret_t rc; | |||
239 | ||||
240 | pScannerPriv = (xmlScannerPrivPtr_t)pScanner; | |||
241 | pScannerPriv->curtok->start = pScannerPriv->pos; | |||
242 | ||||
243 | if (pScannerPriv->curtok->type!=TOK_CONT) | |||
244 | skipS(pScannerPriv); | |||
245 | ||||
246 | /* skip unsupported elements until we find a supported one */ | |||
247 | rc = 0; | |||
248 | ||||
249 | ||||
250 | while (!rc) { | |||
251 | if (smlLibStrncmp((String_t)pScannerPriv->pos, "<!--", 4) == 0) { | |||
252 | rc = xmlSkipComment(pScannerPriv); | |||
253 | } else if (smlLibStrncmp((String_t)pScannerPriv->pos, "<?", 2) == 0) { | |||
254 | rc = xmlSkipPI(pScannerPriv); | |||
255 | } else if (smlLibStrncmp((String_t)pScannerPriv->pos, "</", 2) == 0) { | |||
256 | rc = xmlTag(pScannerPriv, 1); | |||
257 | break; | |||
258 | } else if (smlLibStrncmp((String_t)pScannerPriv->pos, "<![CDATA[", 9) == 0) { | |||
259 | rc = xmlCDATA(pScannerPriv); | |||
260 | break; | |||
261 | } else if ((isPcdata(pScannerPriv->curtok->tagid)) && (pScannerPriv->curtok->type != TOK_TAG_END)) { | |||
262 | rc = xmlSkipPCDATA(pScannerPriv); | |||
263 | break; | |||
264 | } else if (smlLibStrncmp((String_t)pScannerPriv->pos, "<", 1) == 0) { | |||
265 | rc = xmlTag(pScannerPriv, 0); | |||
266 | break; | |||
267 | } else { | |||
268 | rc = xmlCharData(pScannerPriv); | |||
269 | break; | |||
270 | } | |||
271 | } | |||
272 | if (rc) | |||
273 | return rc; | |||
274 | ||||
275 | return SML_ERR_OK0x00; | |||
276 | } | |||
277 | ||||
278 | /** | |||
279 | * Reset the scanner to the starting position of the current token within | |||
280 | * the buffer. Description see XltDecAll.h. | |||
281 | */ | |||
282 | static Ret_t _pushTok(XltDecScannerPtr_t pScanner) | |||
283 | { | |||
284 | xmlScannerPrivPtr_t pScannerPriv; | |||
285 | ||||
286 | pScannerPriv = (xmlScannerPrivPtr_t)pScanner; | |||
287 | pScannerPriv->pos = pScannerPriv->curtok->start; | |||
288 | ||||
289 | /* invalidate curtok */ | |||
290 | /* T.K. Possible Error. pScannerPriv->curtok is of type XltDecToken_t NOT ...Ptr_t */ | |||
291 | // OrigLine: | |||
292 | // smlLibMemset(pScannerPriv->curtok, 0, sizeof(XltDecTokenPtr_t)); | |||
293 | pScannerPriv->curtok->type = (XltTokType_t)0; | |||
294 | ||||
295 | return SML_ERR_OK0x00; | |||
296 | } | |||
297 | ||||
298 | /** | |||
299 | * Set the working buffer of the scanner. | |||
300 | */ | |||
301 | static void | |||
302 | _setBuf(XltDecScannerPtr_t pScanner, const MemPtr_t pBufStart, | |||
303 | const MemPtr_t pBufEnd) | |||
304 | { | |||
305 | xmlScannerPrivPtr_t pScannerPriv = (xmlScannerPrivPtr_t)pScanner; | |||
306 | pScannerPriv->pos = pBufStart; | |||
307 | pScannerPriv->bufend = pBufEnd; | |||
308 | } | |||
309 | ||||
310 | /** | |||
311 | * Get the current position of the scanner within its working buffer. | |||
312 | */ | |||
313 | static MemPtr_t | |||
314 | _getPos(XltDecScannerPtr_t pScanner, Long_t *remaining) | |||
315 | { | |||
316 | if (remaining) | |||
317 | *remaining = ((xmlScannerPrivPtr_t)pScanner)->bufend - ((xmlScannerPrivPtr_t)pScanner)->pos; | |||
318 | return ((xmlScannerPrivPtr_t)pScanner)->pos; | |||
319 | } | |||
320 | ||||
321 | ||||
322 | ||||
323 | ||||
324 | /*************************************************************************/ | |||
325 | /* Internal Functions */ | |||
326 | /*************************************************************************/ | |||
327 | ||||
328 | /* | |||
329 | * Advance the position pointer. Description see above. | |||
330 | */ | |||
331 | static Boolean_t | |||
332 | readBytes(xmlScannerPrivPtr_t pScanner, Long_t bytes) | |||
333 | { | |||
334 | if (pScanner->pos + bytes > pScanner->bufend) { | |||
335 | pScanner->finished = 1; | |||
336 | return 0; | |||
337 | } | |||
338 | pScanner->pos += bytes; | |||
339 | return 1; | |||
340 | } | |||
341 | ||||
342 | /** | |||
343 | * Skip whitespace. | |||
344 | */ | |||
345 | static void skipS(xmlScannerPrivPtr_t pScanner) | |||
346 | { | |||
347 | for (;;) { | |||
348 | switch (*pScanner->pos) { | |||
349 | case 9: /* tab stop */ | |||
350 | case 10: /* line feed */ | |||
351 | case 13: /* carriage return */ | |||
352 | case 32: /* space */ | |||
353 | // %%% luz: 2001-07-03: added exit from loop if no more bytes | |||
354 | if (!readBytes(pScanner, 1)) return; | |||
355 | break; | |||
356 | default: | |||
357 | return; | |||
358 | } | |||
359 | } | |||
360 | } | |||
361 | static Ret_t bomDecl(xmlScannerPrivPtr_t pScanner) | |||
362 | { | |||
363 | Short_t bomLength = 0; | |||
364 | MemByte_t bom0 = *(pScanner->pos); | |||
365 | MemByte_t bom1 = *(pScanner->pos + 1); | |||
366 | MemByte_t bom2 = *(pScanner->pos + 2); | |||
367 | MemByte_t bom3 = *(pScanner->pos + 3); | |||
368 | ||||
369 | if (pScanner->pos + 4 > pScanner->bufend) { /* 4 is the max length of BOM */ | |||
370 | return SML_ERR_OK0x00; | |||
371 | } | |||
372 | ||||
373 | if (bom0 != 0x00 && bom1 != 0x00 && | |||
374 | bom0 < 0xfe && bom1 < 0xfe) {//utf-8 | |||
375 | ||||
376 | /** check utf-8 BOM */ | |||
377 | if (bom0 == 0xef && bom1 == 0xbb && bom2 == 0xbf) | |||
378 | bomLength = 3; | |||
379 | //else no bom | |||
380 | } else if (bom0 == 0x00 && bom1 == 0x00 && | |||
381 | bom2 == 0xfe && bom3 == 0xff) {//utf-32(be) | |||
382 | return SML_ERR_XLT_ENC_UNK0x2007; | |||
383 | } else if (bom0 == 0xff && bom1 == 0xfe && | |||
384 | bom2 == 0x00 && bom3 == 0x00) {//utf-32(le) | |||
385 | return SML_ERR_XLT_ENC_UNK0x2007; | |||
386 | } else if (bom0 == 0xfe && bom1 == 0xff) {//utf-16(be) | |||
387 | return SML_ERR_XLT_ENC_UNK0x2007; | |||
388 | } else if (bom0 == 0xff && bom1 == 0xfe) {//utf-16(le) | |||
389 | return SML_ERR_XLT_ENC_UNK0x2007; | |||
390 | } else { // unknown encoding or unknown encoding BOM | |||
391 | return SML_ERR_XLT_ENC_UNK0x2007; | |||
392 | } | |||
393 | pScanner->pos += bomLength; | |||
394 | return SML_ERR_OK0x00; | |||
395 | } | |||
396 | ||||
397 | /** | |||
398 | * Scan the XML prolog (might be empty...). | |||
399 | */ | |||
400 | static Ret_t | |||
401 | xmlProlog(xmlScannerPrivPtr_t pScanner) | |||
402 | { | |||
403 | Ret_t rc; | |||
404 | ||||
405 | if (pScanner->pos + 5 > pScanner->bufend) | |||
406 | return SML_ERR_OK0x00; | |||
407 | if (smlLibStrncmp((String_t)pScanner->pos, "<?xml", 5) == 0) | |||
408 | if ((rc = xmlXMLDecl(pScanner)) != SML_ERR_OK0x00) | |||
409 | return rc; | |||
410 | ||||
411 | skipS(pScanner); | |||
412 | ||||
413 | while ((pScanner->pos + 4 <= pScanner->bufend) && | |||
414 | ((smlLibStrncmp((String_t)pScanner->pos, "<!--", 4) == 0) || | |||
415 | (smlLibStrncmp((String_t)pScanner->pos, "<?", 2) == 0))) { | |||
416 | if (smlLibStrncmp((String_t)pScanner->pos, "<!--", 4) == 0) | |||
417 | rc = xmlSkipComment(pScanner); | |||
418 | else | |||
419 | rc = xmlSkipPI(pScanner); | |||
420 | if (rc != SML_ERR_OK0x00) | |||
421 | return rc; | |||
422 | skipS(pScanner); | |||
423 | } | |||
424 | ||||
425 | if ((pScanner->pos + 9 <= pScanner->bufend) && | |||
426 | (smlLibStrncmp((String_t)pScanner->pos, "<!DOCTYPE", 9) == 0)) | |||
427 | if ((rc = xmlDocTypeDecl(pScanner)) != SML_ERR_OK0x00) | |||
428 | return rc; | |||
429 | ||||
430 | skipS(pScanner); | |||
431 | ||||
432 | return SML_ERR_OK0x00; | |||
433 | } | |||
434 | ||||
435 | /** | |||
436 | * Part of the Prolog scanning | |||
437 | */ | |||
438 | static Ret_t | |||
439 | xmlDocTypeDecl(xmlScannerPrivPtr_t pScanner) | |||
440 | { | |||
441 | Ret_t rc; | |||
442 | String_t name = NULL((void*)0); | |||
443 | String_t syslit = NULL((void*)0); | |||
444 | String_t publit = NULL((void*)0); | |||
445 | ||||
446 | readBytes(pScanner, 9); | |||
447 | skipS(pScanner); | |||
448 | if ((rc = xmlName(pScanner, &name)) != SML_ERR_OK0x00) { | |||
449 | smlLibFree(name); | |||
450 | return rc; | |||
451 | } | |||
452 | skipS(pScanner); | |||
453 | ||||
454 | /* parse ExternalID */ | |||
455 | if ((pScanner->pos + 6 <= pScanner->bufend) && | |||
456 | (smlLibStrncmp((String_t)pScanner->pos, "SYSTEM", 6) == 0)) { | |||
457 | readBytes(pScanner, 6); | |||
458 | skipS(pScanner); | |||
459 | if ((rc = xmlStringConst(pScanner, &syslit)) != SML_ERR_OK0x00) { | |||
460 | smlLibFree(name); | |||
461 | smlLibFree(syslit); | |||
462 | return rc; | |||
463 | } | |||
464 | } else if ((pScanner->pos + 6 <= pScanner->bufend) && | |||
465 | (smlLibStrncmp((String_t)pScanner->pos, "PUBLIC", 6) == 0)) { | |||
466 | readBytes(pScanner, 6); | |||
467 | skipS(pScanner); | |||
468 | if ((rc = xmlStringConst(pScanner, &publit)) != SML_ERR_OK0x00) { | |||
469 | smlLibFree(name); | |||
470 | smlLibFree(publit); | |||
471 | return rc; | |||
472 | } | |||
473 | skipS(pScanner); | |||
474 | if ((rc = xmlStringConst(pScanner, &syslit)) != SML_ERR_OK0x00) { | |||
475 | smlLibFree(name); | |||
476 | smlLibFree(syslit); | |||
477 | smlLibFree(publit); | |||
478 | return rc; | |||
479 | } | |||
480 | } | |||
481 | ||||
482 | smlLibFree(name); | |||
483 | smlLibFree(syslit); | |||
484 | smlLibFree(publit); | |||
485 | ||||
486 | skipS(pScanner); | |||
487 | ||||
488 | if (*pScanner->pos != '>') | |||
489 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_XML_DOC,pScanner,"xmlDocTypeDecl")show_decode_error(0x2013,(XltDecScannerPtr_t)pScanner,"xmlDocTypeDecl" ); | |||
490 | readBytes(pScanner, 1); | |||
491 | ||||
492 | return SML_ERR_OK0x00; | |||
493 | } | |||
494 | ||||
495 | /** | |||
496 | * Part of the Prolog scanning | |||
497 | */ | |||
498 | static Ret_t | |||
499 | xmlXMLDecl(xmlScannerPrivPtr_t pScanner) | |||
500 | { | |||
501 | String_t name, value; | |||
502 | Ret_t rc; | |||
503 | ||||
504 | readBytes(pScanner, 5); | |||
505 | skipS(pScanner); | |||
506 | ||||
507 | /* mandatory version info */ | |||
508 | if ((rc = xmlAttribute(pScanner, &name, &value)) != SML_ERR_OK0x00) | |||
509 | return rc; | |||
510 | if (smlLibStrcmp(name, "version") != 0) { | |||
511 | smlLibFree(name); | |||
512 | smlLibFree(value); | |||
513 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_XML_DOC,pScanner,"xmlXMLDecl")show_decode_error(0x2013,(XltDecScannerPtr_t)pScanner,"xmlXMLDecl" ); | |||
514 | } | |||
515 | smlLibFree(name); | |||
516 | smlLibFree(value); | |||
517 | ||||
518 | skipS(pScanner); | |||
519 | ||||
520 | /* optional attributes are encoding and standalone */ | |||
521 | while ((pScanner->pos + 2 <= pScanner->bufend) && | |||
522 | (smlLibStrncmp((String_t)pScanner->pos, "?>", 2) != 0)) { | |||
523 | if ((rc = xmlAttribute(pScanner, &name, &value)) != SML_ERR_OK0x00) | |||
524 | return rc; | |||
525 | smlLibFree(name); | |||
526 | smlLibFree(value); | |||
527 | skipS(pScanner); | |||
528 | } | |||
529 | ||||
530 | if (pScanner->pos + 2 > pScanner->bufend) | |||
531 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlXMLDecl")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlXMLDecl" ); | |||
532 | ||||
533 | readBytes(pScanner, 2); | |||
534 | ||||
535 | return SML_ERR_OK0x00; | |||
536 | } | |||
537 | ||||
538 | /** | |||
539 | * Handle Attributes //function can be used if attributes get necessary | |||
540 | */ | |||
541 | static Ret_t | |||
542 | xmlAttribute(xmlScannerPrivPtr_t pScanner, String_t *name, String_t *value) | |||
543 | { | |||
544 | Ret_t rc; | |||
545 | ||||
546 | skipS(pScanner); | |||
547 | ||||
548 | if ((rc = xmlName(pScanner, name)) != SML_ERR_OK0x00) | |||
549 | return rc; | |||
550 | ||||
551 | skipS(pScanner); | |||
552 | ||||
553 | /* no attributes found, because this tag has none -> bail out */ | |||
554 | if (*pScanner->pos == '>') { | |||
555 | return SML_DECODEERROR(SML_ERR_XLT_MISSING_CONT,pScanner,"xmlAttribute")show_decode_error(0x2001,(XltDecScannerPtr_t)pScanner,"xmlAttribute" ); | |||
556 | } | |||
557 | if (smlLibStrncmp((String_t)pScanner->pos, "/>", 2) == 0) { | |||
558 | return SML_DECODEERROR(SML_ERR_XLT_MISSING_CONT,pScanner,"xmlAttribute")show_decode_error(0x2001,(XltDecScannerPtr_t)pScanner,"xmlAttribute" ); | |||
559 | } | |||
560 | ||||
561 | if (*pScanner->pos != '=') { | |||
562 | smlLibFree(*name); | |||
563 | *name = NULL((void*)0); | |||
564 | *value = NULL((void*)0); | |||
565 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_XML_DOC,pScanner,"xmlAttribute")show_decode_error(0x2013,(XltDecScannerPtr_t)pScanner,"xmlAttribute" ); | |||
566 | } | |||
567 | readBytes(pScanner, 1); | |||
568 | ||||
569 | skipS(pScanner); | |||
570 | ||||
571 | if ((rc = xmlStringConst(pScanner, value)) != SML_ERR_OK0x00) { | |||
572 | smlLibFree(*name); | |||
573 | *name = NULL((void*)0); | |||
574 | *value = NULL((void*)0); | |||
575 | return rc; | |||
576 | } | |||
577 | ||||
578 | return SML_ERR_OK0x00; | |||
579 | } | |||
580 | ||||
581 | /** | |||
582 | * Handle Pcdata String Constants | |||
583 | */ | |||
584 | static Ret_t | |||
585 | xmlStringConst(xmlScannerPrivPtr_t pScanner, String_t *value) | |||
586 | { | |||
587 | String_t end; | |||
588 | int len; | |||
589 | char del; | |||
590 | ||||
591 | if ((*pScanner->pos != '"') && (*pScanner->pos != '\'')) { | |||
592 | *value = NULL((void*)0); | |||
593 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_XML_DOC,pScanner,"xmlStringConst")show_decode_error(0x2013,(XltDecScannerPtr_t)pScanner,"xmlStringConst" ); | |||
594 | } | |||
595 | del = *pScanner->pos; | |||
596 | readBytes(pScanner, 1); | |||
597 | ||||
598 | if ((end = smlLibStrchr((String_t)pScanner->pos, del)) == NULL((void*)0)) { | |||
599 | *value = NULL((void*)0); | |||
600 | ||||
601 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlStringConst")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlStringConst" ); | |||
602 | } | |||
603 | len = end - (String_t)pScanner->pos; | |||
604 | if ((*value = (String_t)smlLibMalloc(len + 1)) == NULL((void*)0)) | |||
605 | { | |||
606 | ||||
607 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
608 | } | |||
609 | smlLibMemset(*value, 0, len + 1); | |||
610 | smlLibStrncpy(*value, (String_t)pScanner->pos, len); | |||
611 | readBytes(pScanner, len + 1); | |||
612 | ||||
613 | return SML_ERR_OK0x00; | |||
614 | } | |||
615 | ||||
616 | /** | |||
617 | * parse HTML entity (like &) | |||
618 | * | |||
619 | * pScanner->pos must pointer to &. Afterwards entity is set | |||
620 | * to the character. | |||
621 | */ | |||
622 | static Ret_t | |||
623 | xmlHTMLEntity(xmlScannerPrivPtr_t pScanner, char *entityptr) | |||
624 | { | |||
625 | // start of an HTML entity: decode just that single character | |||
626 | static const struct { | |||
627 | const char *entity; | |||
628 | char character; | |||
629 | } entities[] = { | |||
630 | { "amp", '&' }, | |||
631 | { "gt", '>' }, | |||
632 | { "lt", '<' }, | |||
633 | { "apos", '\'' }, | |||
634 | { "quot", '"' }, | |||
635 | { "#43", '+'} | |||
636 | }; | |||
637 | MemPtr_t entity = pScanner->pos + 1; | |||
638 | int i; | |||
639 | int len; | |||
640 | ||||
641 | while (*pScanner->pos != ';') { | |||
642 | if (pScanner->pos >= pScanner->bufend) { | |||
643 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_SYNCML_DOC,pScanner,"xmlHTMLEntity")show_decode_error(0x200B,(XltDecScannerPtr_t)pScanner,"xmlHTMLEntity" ); | |||
644 | } | |||
645 | if (!readBytes(pScanner, 1)) { | |||
646 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlHTMLEntity")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlHTMLEntity" ); | |||
647 | } | |||
648 | } | |||
649 | ||||
650 | // remember length and skip ; | |||
651 | len = pScanner->pos - entity; | |||
652 | if (!readBytes(pScanner, 1)) { | |||
653 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlHTMLEntity")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlHTMLEntity" ); | |||
654 | } | |||
655 | ||||
656 | // identify the entity | |||
657 | for (i = 0; i < sizeof(entities)/sizeof(entities[0]); i++) { | |||
658 | if (!strncmp(entities[i].entity, (char *)entity, len)(__extension__ (__builtin_constant_p (len) && ((__builtin_constant_p (entities[i].entity) && strlen (entities[i].entity) < ((size_t) (len))) || (__builtin_constant_p ((char *)entity) && strlen ((char *)entity) < ((size_t) (len)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (entities [i].entity) && __builtin_constant_p ((char *)entity) && (__s1_len = __builtin_strlen (entities[i].entity), __s2_len = __builtin_strlen ((char *)entity), (!((size_t)(const void *) ((entities[i].entity) + 1) - (size_t)(const void *)(entities[ i].entity) == 1) || __s1_len >= 4) && (!((size_t)( const void *)(((char *)entity) + 1) - (size_t)(const void *)( (char *)entity) == 1) || __s2_len >= 4)) ? __builtin_strcmp (entities[i].entity, (char *)entity) : (__builtin_constant_p (entities[i].entity) && ((size_t)(const void *)((entities [i].entity) + 1) - (size_t)(const void *)(entities[i].entity) == 1) && (__s1_len = __builtin_strlen (entities[i].entity ), __s1_len < 4) ? (__builtin_constant_p ((char *)entity) && ((size_t)(const void *)(((char *)entity) + 1) - (size_t)(const void *)((char *)entity) == 1) ? __builtin_strcmp (entities[i ].entity, (char *)entity) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ((char *)entity ); int __result = (((const unsigned char *) (const char *) (entities [i].entity))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( entities[i].entity))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (entities[i].entity))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (entities[i].entity))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ((char *)entity) && (( size_t)(const void *)(((char *)entity) + 1) - (size_t)(const void *)((char *)entity) == 1) && (__s2_len = __builtin_strlen ((char *)entity), __s2_len < 4) ? (__builtin_constant_p ( entities[i].entity) && ((size_t)(const void *)((entities [i].entity) + 1) - (size_t)(const void *)(entities[i].entity) == 1) ? __builtin_strcmp (entities[i].entity, (char *)entity ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (entities[i].entity); int __result = ( ((const unsigned char *) (const char *) ((char *)entity))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ((char *)entity)) [1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ((char *)entity))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (( char *)entity))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (entities[i].entity, (char *)entity)))); }) : strncmp (entities [i].entity, (char *)entity, len))) && | |||
659 | entities[i].entity[len] == 0) { | |||
660 | *entityptr = entities[i].character; | |||
661 | return SML_ERR_OK0x00; | |||
662 | } | |||
663 | } | |||
664 | ||||
665 | // not one of the pre-defined entities | |||
666 | if (len >= 2 && *(char *)entity == '#') { | |||
667 | long value; | |||
668 | char *end; | |||
669 | // Either decimal or hexadecimal character reference. | |||
670 | if (((char *)entity)[1] == 'x') { | |||
671 | // hex | |||
672 | value = strtol((char *)entity + 2, &end, 16); | |||
673 | } else { | |||
674 | // dec | |||
675 | value = strtol((char *)entity + 1, &end, 10); | |||
676 | } | |||
677 | if (end != (char *)entity + len) { | |||
678 | // some character in the entity didn't decode in the expected base system | |||
679 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_SYNCML_DOC,pScanner,"xmlHTMLEntity")show_decode_error(0x200B,(XltDecScannerPtr_t)pScanner,"xmlHTMLEntity" ); | |||
680 | } | |||
681 | if (value < 0 || value > 255) { | |||
682 | // invalid value range | |||
683 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_SYNCML_DOC,pScanner,"xmlHTMLEntity")show_decode_error(0x200B,(XltDecScannerPtr_t)pScanner,"xmlHTMLEntity" ); | |||
684 | } | |||
685 | *entityptr = (unsigned char)value; | |||
686 | return SML_ERR_OK0x00; | |||
687 | } else { | |||
688 | // invalid entity: abort!? | |||
689 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_SYNCML_DOC,pScanner,"xmlHTMLEntity")show_decode_error(0x200B,(XltDecScannerPtr_t)pScanner,"xmlHTMLEntity" ); | |||
690 | } | |||
691 | } | |||
692 | ||||
693 | ||||
694 | /** | |||
695 | * FUNCTION: xmlCharData | |||
696 | * | |||
697 | * Handle Pcdata character data content | |||
698 | */ | |||
699 | static Ret_t | |||
700 | xmlCharData(xmlScannerPrivPtr_t pScanner) | |||
701 | { | |||
702 | SmlPcdataPtr_t pPCData; | |||
703 | MemPtr_t begin; | |||
704 | int len; | |||
705 | char entity; | |||
706 | ||||
707 | pPCData = (SmlPcdataPtr_t)smlLibMalloc(sizeof(SmlPcdata_t)); | |||
708 | if (pPCData == NULL((void*)0)) | |||
709 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
710 | pPCData->contentType = SML_PCDATA_UNDEFINED; | |||
711 | pPCData->length = 0; | |||
712 | pPCData->content = NULL((void*)0); | |||
713 | ||||
714 | begin = pScanner->pos; | |||
715 | ||||
716 | if (*pScanner->pos >= *pScanner->bufend) { | |||
717 | pPCData->content = NULL((void*)0); | |||
718 | pPCData->contentType = SML_PCDATA_UNDEFINED; | |||
719 | pPCData->extension = SML_EXT_UNDEFINED; | |||
720 | pPCData->length = 0; | |||
721 | pScanner->curtok->type = TOK_CONT; | |||
722 | pScanner->curtok->pcdata = pPCData; | |||
723 | //smlLibFree(pPCData); | |||
724 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlCharData")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlCharData" ); | |||
725 | } | |||
726 | ||||
727 | if (*pScanner->pos == '&') { | |||
728 | Ret_t ret = xmlHTMLEntity(pScanner, &entity); | |||
729 | if (ret) { | |||
730 | smlLibFree(pPCData); | |||
731 | return ret; | |||
732 | } | |||
733 | begin = (MemPtr_t)&entity; | |||
734 | len = 1; | |||
735 | } else { | |||
736 | while (*pScanner->pos != '<' && (*pScanner->pos != '&')) | |||
737 | { | |||
738 | if (pScanner->pos >= pScanner->bufend) | |||
739 | { | |||
740 | smlLibFree(pPCData); | |||
741 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_SYNCML_DOC,pScanner,"xmlCharData")show_decode_error(0x200B,(XltDecScannerPtr_t)pScanner,"xmlCharData" ); | |||
742 | } | |||
743 | if (!readBytes(pScanner, 1)) { | |||
744 | smlLibFree(pPCData); | |||
745 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlCharData")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlCharData" ); | |||
746 | } | |||
747 | } | |||
748 | len = pScanner->pos - begin; | |||
749 | } | |||
750 | ||||
751 | pPCData->content = smlLibMalloc(len + 1); | |||
752 | if (pPCData->content == NULL((void*)0)){ | |||
753 | smlLibFree(pPCData); | |||
754 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
755 | } | |||
756 | //%%%waste of CPU: smlLibMemset(pPCData->content, 0, len + 1); | |||
757 | ((MemPtr_t)pPCData->content)[len]=0; // set terminator | |||
758 | smlLibMemcpy(pPCData->content, begin, len); | |||
759 | pPCData->contentType = SML_PCDATA_STRING; | |||
760 | pPCData->length = len; | |||
761 | ||||
762 | pScanner->curtok->type = TOK_CONT; | |||
763 | pScanner->curtok->pcdata = pPCData; | |||
764 | ||||
765 | return SML_ERR_OK0x00; | |||
766 | } | |||
767 | ||||
768 | /** | |||
769 | * Handle Name Elements | |||
770 | */ | |||
771 | static Ret_t | |||
772 | xmlName(xmlScannerPrivPtr_t pScanner, String_t *name) | |||
773 | { | |||
774 | MemPtr_t begin; | |||
775 | String_t tmp; | |||
776 | int len; | |||
777 | ||||
778 | begin = pScanner->pos; | |||
779 | while (((*pScanner->pos >= 'a') && (*pScanner->pos <= 'z')) || | |||
780 | ((*pScanner->pos >= 'A') && (*pScanner->pos <= 'Z')) || | |||
781 | ((*pScanner->pos >= '0') && (*pScanner->pos <= '9')) || | |||
782 | (*pScanner->pos == '.') || (*pScanner->pos == '-') || | |||
783 | (*pScanner->pos == '_') || (*pScanner->pos == ':')) | |||
784 | if (!readBytes(pScanner, 1)) | |||
785 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlName")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlName" ); | |||
786 | ||||
787 | len = pScanner->pos - begin; | |||
788 | /* T.K. bail out if len is zero without modifying name */ | |||
789 | if (len == 0) return SML_ERR_OK0x00; | |||
790 | ||||
791 | ||||
792 | tmp = (String_t)smlLibMalloc(len + 1); | |||
793 | if (tmp == NULL((void*)0)) { | |||
794 | *name = NULL((void*)0); | |||
795 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
796 | } | |||
797 | smlLibMemset(tmp, 0, len + 1); | |||
798 | smlLibStrncpy(tmp, (String_t)begin, len); | |||
799 | *name = tmp; | |||
800 | return SML_ERR_OK0x00; | |||
801 | } | |||
802 | ||||
803 | /** | |||
804 | * FUNCTION: xmlTag | |||
805 | * | |||
806 | * Handle XML Tags | |||
807 | */ | |||
808 | static Ret_t | |||
809 | xmlTag(xmlScannerPrivPtr_t pScanner, Byte_t endtag) | |||
810 | { | |||
811 | Ret_t rc; | |||
812 | String_t name, attname=NULL((void*)0), value = NULL((void*)0), nsprefix = NULL((void*)0); | |||
| ||||
813 | Byte_t nsprelen = 0; | |||
814 | XltTagID_t tagid; | |||
815 | SmlPcdataExtension_t ext; | |||
816 | ||||
817 | ||||
818 | if (endtag) { | |||
819 | if (!readBytes(pScanner, 2)) | |||
820 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlTag")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlTag" ); | |||
821 | } else { | |||
822 | if (!readBytes(pScanner, 1)) | |||
823 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlTag")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlTag" ); | |||
824 | } | |||
825 | ||||
826 | if ((rc = xmlName(pScanner, &name)) != SML_ERR_OK0x00) | |||
827 | { | |||
828 | if (rc != SML_ERR_NOT_ENOUGH_SPACE0x11) | |||
829 | { | |||
830 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_XML_DOC,pScanner,"xmlTag")show_decode_error(0x2013,(XltDecScannerPtr_t)pScanner,"xmlTag" ); | |||
831 | } | |||
832 | else | |||
833 | { | |||
834 | return rc; | |||
835 | } | |||
836 | ||||
837 | } | |||
838 | ||||
839 | ext = pScanner->ext; | |||
840 | if (!endtag) { | |||
841 | /* Namespaces can only be defined on start, never on endtags | |||
842 | * but we have to make sure we close a namespace on the corrsponding endtag. | |||
843 | * Thats why we a) only open a namespace when it differs from the previous one, and | |||
844 | * b) record the tag_id that opend the namespace so we can close it when the | |||
845 | * corresponding endtag is reached. | |||
846 | */ | |||
847 | ||||
848 | if ((rc = xmlAttribute(pScanner, &attname, &value)) == SML_ERR_OK0x00) | |||
849 | { | |||
850 | if (smlLibStrncmp(attname, "xmlns", 5) == 0) { | |||
851 | /* Heureka we found a Namespace :-) */ | |||
852 | /* It's save to check attname[5] here, as it contains at least the terminating '\000' */ | |||
853 | if (attname[5] == ':') { /* we found a namespace prefixdefinition */ | |||
854 | nsprelen = (Byte_t)smlLibStrlen(&attname[6]); | |||
855 | nsprefix = smlLibMalloc(nsprelen+1); | |||
856 | if (nsprefix == NULL((void*)0)) { | |||
857 | smlLibFree(attname); | |||
858 | smlLibFree(value); | |||
859 | smlLibFree(name); | |||
860 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
861 | } | |||
862 | smlLibStrcpy(nsprefix,&attname[6]); | |||
863 | } | |||
864 | ext = getExtByName(value); | |||
865 | if (ext == (SmlPcdataExtension_t)255) { | |||
866 | smlLibFree(nsprefix); /* doesn't harm, even when empty */ | |||
867 | smlLibFree(attname); | |||
868 | smlLibFree(value); | |||
869 | smlLibFree(name); | |||
870 | return SML_DECODEERROR(SML_ERR_XLT_INVALID_CODEPAGE,pScanner,"xmlTag")show_decode_error(0x2011,(XltDecScannerPtr_t)pScanner,"xmlTag" ); | |||
871 | } | |||
872 | } else { | |||
873 | if (rc == SML_ERR_NOT_ENOUGH_SPACE0x11) { | |||
874 | smlLibFree(attname); | |||
875 | smlLibFree(value); | |||
876 | smlLibFree(name); | |||
877 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
878 | } | |||
879 | else { | |||
880 | /* we found an unknown attribute -> bail out */ | |||
881 | smlLibFree(attname); | |||
882 | smlLibFree(value); | |||
883 | /* nsprefix is empty here so we save us a function call */ | |||
884 | smlLibFree(name); | |||
885 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_XML_DOC,pScanner,"xmlTag")show_decode_error(0x2013,(XltDecScannerPtr_t)pScanner,"xmlTag" ); | |||
886 | } | |||
887 | } | |||
888 | } | |||
889 | else if ( rc != SML_DECODEERROR(SML_ERR_XLT_MISSING_CONT,pScanner,"xmlTag")show_decode_error(0x2001,(XltDecScannerPtr_t)pScanner,"xmlTag" )) | |||
890 | { | |||
891 | /* xmlAttribute returns an SML_ERR_XLT_MISSING_CONT error when | |||
892 | * no attribute was found. This is not an error, but everything else is. | |||
893 | */ | |||
894 | smlLibFree(value); | |||
895 | smlLibFree(name); | |||
896 | return rc; | |||
897 | } | |||
898 | } // if endtag | |||
899 | ||||
900 | if (pScanner->ext == ext) { | |||
901 | /* no new Namespace found - lets proceed with the active one */ | |||
902 | ||||
903 | /* first lets check wether a tag is in the right namespace, in case | |||
904 | * we are using namespaces with prefix notation ('mi:Format' instead of | |||
905 | * 'Format nsattr="..."). | |||
906 | * If we are and the token is not in this namespace -> bail out | |||
907 | */ | |||
908 | if (pScanner->nsprelen > 0 && smlLibStrlen(name) > pScanner->nsprelen+1) { | |||
909 | if (name[pScanner->nsprelen] != ':' || smlLibStrncmp(name,pScanner->nsprefix, pScanner->nsprelen) != 0) { | |||
910 | smlLibFree(name); | |||
911 | smlLibFree(attname); | |||
912 | smlLibFree(value); | |||
913 | smlLibFree(nsprefix); | |||
914 | return SML_DECODEERROR(SML_ERR_XLT_NO_MATCHING_CODEPAGE,pScanner,"xmlTag")show_decode_error(0x2017,(XltDecScannerPtr_t)pScanner,"xmlTag" ); | |||
915 | } | |||
916 | } | |||
917 | /* Strip off namespace prefixes and ':' to find the tag. | |||
918 | * If no prefix is defined (pScanner->nsprelen == 0) take the whole tagname. | |||
919 | */ | |||
920 | if (pScanner->nsprelen > 0) | |||
921 | rc = getTagIDByStringAndExt(&name[0+pScanner->nsprelen+1], pScanner->ext, &tagid); | |||
922 | else | |||
923 | rc = getTagIDByStringAndExt(name, pScanner->ext, &tagid); | |||
924 | // %%% luz 2005-11-11 : added implicit try with MetInf namespace (workaround for ill-formed xml like in sync4j pda clients) | |||
925 | if (rc==SML_ERR_XLT_INVAL_PROTO_ELEM0x2008) { | |||
926 | if (pScanner->nsprelen > 0) | |||
927 | rc = getTagIDByStringAndExt(&name[0+pScanner->nsprelen+1], SML_EXT_METINF, &tagid); | |||
928 | else | |||
929 | rc = getTagIDByStringAndExt(name, SML_EXT_METINF, &tagid); | |||
930 | } | |||
931 | } else { | |||
932 | /* we have a new Namespace */ | |||
933 | if (nsprelen > 0 && smlLibStrlen(name) > nsprelen+1) { | |||
| ||||
934 | if (name[nsprelen] != ':' || smlLibStrncmp(name,nsprefix, nsprelen) != 0) { | |||
935 | smlLibFree(name); | |||
936 | smlLibFree(attname); | |||
937 | smlLibFree(value); | |||
938 | smlLibFree(nsprefix); | |||
939 | return SML_DECODEERROR(SML_ERR_XLT_NO_MATCHING_CODEPAGE,pScanner,"xmlTag")show_decode_error(0x2017,(XltDecScannerPtr_t)pScanner,"xmlTag" ); | |||
940 | } | |||
941 | } | |||
942 | /* Strip off namespace prefixes and ':' to find the tag. | |||
943 | * If no prefix is defined (pScanner->nsprelen == 0) take the whole tagname. | |||
944 | */ | |||
945 | if (nsprelen > 0) | |||
946 | rc = getTagIDByStringAndExt(&name[nsprelen+1], ext, &tagid); | |||
947 | else | |||
948 | rc = getTagIDByStringAndExt(name, ext, &tagid); | |||
949 | } | |||
950 | /* free temporary buffers */ | |||
951 | smlLibFree(name); | |||
952 | smlLibFree(attname); | |||
953 | smlLibFree(value); | |||
954 | ||||
955 | if ((tagid == TN_UNDEF) || (rc != SML_ERR_OK0x00)) { | |||
956 | smlLibFree(nsprefix); | |||
957 | return rc; | |||
958 | } | |||
959 | ||||
960 | /* remember the old extension including the corresponding start tag if we found a new one */ | |||
961 | if (ext != pScanner->ext) { /* namespace changed */ | |||
962 | pScanner->prev_ext = pScanner->ext; /* remember the old ext */ | |||
963 | pScanner->prev_ext_tag = pScanner->ext_tag; /* and the corresponding start tag */ | |||
964 | pScanner->ext = ext; | |||
965 | pScanner->ext_tag = tagid; | |||
966 | smlLibFree(pScanner->nsprefix); | |||
967 | pScanner->nsprefix = nsprefix; | |||
968 | pScanner->nsprelen = nsprelen; | |||
969 | } | |||
970 | ||||
971 | ||||
972 | pScanner->curtok->tagid = tagid; | |||
973 | pScanner->curtok->ext = pScanner->ext; | |||
974 | skipS(pScanner); | |||
975 | ||||
976 | if (endtag) { | |||
977 | /* found end tag */ | |||
978 | if (smlLibStrncmp((String_t)pScanner->pos, ">", 1) != 0) | |||
979 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_XML_DOC,pScanner,"xmlTag")show_decode_error(0x2013,(XltDecScannerPtr_t)pScanner,"xmlTag" ); | |||
980 | pScanner->curtok->type = TOK_TAG_END; | |||
981 | readBytes(pScanner, 1); | |||
982 | /* in case of an endtag we might need to close the current CP */ | |||
983 | if (tagid == pScanner->ext_tag) { | |||
984 | pScanner->ext_tag = pScanner->prev_ext_tag; | |||
985 | pScanner->ext = pScanner->prev_ext; | |||
986 | pScanner->prev_ext = SML_EXT_UNDEFINED; | |||
987 | pScanner->prev_ext_tag = TN_UNDEF; | |||
988 | pScanner->nsprelen = 0; | |||
989 | smlLibFree(pScanner->nsprefix); | |||
990 | pScanner->nsprefix = NULL((void*)0); | |||
991 | } | |||
992 | } else { | |||
993 | /* Attributes are not supported in SyncML -> skip them*/ | |||
994 | if ((rc = xmlSkipAttributes(pScanner)) != SML_ERR_OK0x00) return rc; | |||
995 | ||||
996 | if (smlLibStrncmp((String_t)pScanner->pos, "/>", 2) == 0) { | |||
997 | /* found empty tag */ | |||
998 | pScanner->curtok->type = TOK_TAG_EMPTY; | |||
999 | readBytes(pScanner, 2); | |||
1000 | } else if (smlLibStrncmp((String_t)pScanner->pos, ">", 1) == 0) { | |||
1001 | pScanner->curtok->type = TOK_TAG_START; | |||
1002 | readBytes(pScanner, 1); | |||
1003 | } else { | |||
1004 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_XML_DOC,pScanner,"xmlTag")show_decode_error(0x2013,(XltDecScannerPtr_t)pScanner,"xmlTag" ); | |||
1005 | } | |||
1006 | } | |||
1007 | return SML_ERR_OK0x00; | |||
1008 | } | |||
1009 | ||||
1010 | /** | |||
1011 | * Skip PI elements | |||
1012 | */ | |||
1013 | static Ret_t | |||
1014 | xmlSkipPI(xmlScannerPrivPtr_t pScanner) | |||
1015 | { | |||
1016 | if (pScanner) { /* Get rid of warning, this should not be called anyway */ | |||
1017 | } | |||
1018 | ||||
1019 | return SML_ERR_UNSPECIFIC0x10; | |||
1020 | } | |||
1021 | ||||
1022 | /** | |||
1023 | * Skip comments | |||
1024 | */ | |||
1025 | static Ret_t | |||
1026 | xmlSkipComment(xmlScannerPrivPtr_t pScanner) | |||
1027 | { | |||
1028 | readBytes(pScanner, 4); | |||
1029 | ||||
1030 | while ((pScanner->pos + 3 <= pScanner->bufend) && | |||
1031 | (smlLibStrncmp((String_t)pScanner->pos, "-->", 3) != 0)) | |||
1032 | if (!readBytes(pScanner, 1)) | |||
1033 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlSkipComment")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlSkipComment" ); | |||
1034 | ||||
1035 | ||||
1036 | if (pScanner->pos + 3 > pScanner->bufend) | |||
1037 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlSkipComment")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlSkipComment" ); | |||
1038 | ||||
1039 | if (!readBytes(pScanner, 3)) | |||
1040 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlSkipComment")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlSkipComment" ); | |||
1041 | ||||
1042 | skipS(pScanner); | |||
1043 | ||||
1044 | return SML_ERR_OK0x00; | |||
1045 | } | |||
1046 | ||||
1047 | /** | |||
1048 | * Skip attributes -> they are not supported in SyncML | |||
1049 | */ | |||
1050 | static Ret_t | |||
1051 | xmlSkipAttributes(xmlScannerPrivPtr_t pScanner) | |||
1052 | { | |||
1053 | ||||
1054 | while ((pScanner->pos + 1 <= pScanner->bufend) && | |||
1055 | (smlLibStrncmp((String_t)pScanner->pos, ">", 1)) && (smlLibStrncmp((String_t)pScanner->pos, "/>", 2))) | |||
1056 | if (!readBytes(pScanner, 1)) | |||
1057 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlSkipAttributes")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlSkipAttributes" ); | |||
1058 | ||||
1059 | ||||
1060 | if (pScanner->pos + 1 > pScanner->bufend) | |||
1061 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlSkipAttributes")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlSkipAttributes" ); | |||
1062 | ||||
1063 | return SML_ERR_OK0x00; | |||
1064 | } | |||
1065 | ||||
1066 | /** | |||
1067 | * Handle a CDATA content | |||
1068 | */ | |||
1069 | static Ret_t | |||
1070 | xmlCDATA(xmlScannerPrivPtr_t pScanner) | |||
1071 | { | |||
1072 | SmlPcdataPtr_t pPCData; | |||
1073 | MemPtr_t begin; | |||
1074 | int len; | |||
1075 | ||||
1076 | readBytes(pScanner, 9); | |||
1077 | ||||
1078 | pPCData = (SmlPcdataPtr_t)smlLibMalloc(sizeof(SmlPcdata_t)); | |||
1079 | if (pPCData == NULL((void*)0)) | |||
1080 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
1081 | pPCData->contentType = SML_PCDATA_UNDEFINED; | |||
1082 | pPCData->length = 0; | |||
1083 | pPCData->content = NULL((void*)0); | |||
1084 | ||||
1085 | begin = pScanner->pos; | |||
1086 | while (!((pScanner->pos[0] == ']') && (pScanner->pos[1] == ']') && (pScanner->pos[2] == '>'))) | |||
1087 | if (!readBytes(pScanner, 1)) | |||
1088 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlCDATA")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlCDATA" ); | |||
1089 | ||||
1090 | len = pScanner->pos - begin; | |||
1091 | pPCData->content = smlLibMalloc(len + 1); | |||
1092 | if (pPCData->content == NULL((void*)0)) { | |||
1093 | smlLibFree(pPCData); | |||
1094 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
1095 | } | |||
1096 | ||||
1097 | //%%%waste of CPU: smlLibMemset(pPCData->content, 0, len + 1); | |||
1098 | ((MemPtr_t)pPCData->content)[len]=0; // set terminator | |||
1099 | smlLibMemcpy(pPCData->content, begin, len); // copy data | |||
1100 | pPCData->contentType = SML_PCDATA_CDATA; | |||
1101 | pPCData->length = len; | |||
1102 | ||||
1103 | pScanner->curtok->type = TOK_CONT; | |||
1104 | pScanner->curtok->pcdata = pPCData; | |||
1105 | ||||
1106 | readBytes(pScanner, 3); | |||
1107 | ||||
1108 | return SML_ERR_OK0x00; | |||
1109 | } | |||
1110 | ||||
1111 | /** | |||
1112 | * Read over a Pcdata content | |||
1113 | */ | |||
1114 | static Ret_t | |||
1115 | xmlSkipPCDATA(xmlScannerPrivPtr_t pScanner) | |||
1116 | { | |||
1117 | SmlPcdataPtr_t pPCData; | |||
1118 | MemPtr_t begin; | |||
1119 | int len; | |||
1120 | Ret_t rc; | |||
1121 | String_t _tagString = NULL((void*)0); | |||
1122 | String_t _tagString2 = NULL((void*)0); | |||
1123 | char entity; | |||
1124 | ||||
1125 | /* Check wether this PCData might contain a subdtd. | |||
1126 | ** We assume a Sub DTD starts with '<' as first char. | |||
1127 | ** If this char is present start further processing else | |||
1128 | ** take it as pure String data. If the scanning returns an | |||
1129 | ** error we reject the file, as '<' is not a valid char inside | |||
1130 | ** PCData elements. | |||
1131 | */ | |||
1132 | if (smlLibStrncmp((String_t)pScanner->pos, "<", 1) == 0) { | |||
1133 | rc = xmlTag(pScanner, 0); | |||
1134 | return rc; | |||
1135 | } | |||
1136 | ||||
1137 | _tagString = smlLibMalloc(XML_MAX_TAGLEN35); | |||
1138 | if (_tagString == NULL((void*)0)) return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
1139 | if ((rc = getTagString(pScanner->curtok->tagid, _tagString, pScanner->curtok->ext)) != SML_ERR_OK0x00) | |||
1140 | { | |||
1141 | smlLibFree(_tagString); | |||
1142 | return rc; | |||
1143 | } | |||
1144 | ||||
1145 | _tagString2 = smlLibMalloc(smlLibStrlen(_tagString) + 4 + (pScanner->nsprelen +1)); | |||
1146 | ||||
1147 | // build a end tag String to compate (e.g. </Meta>) | |||
1148 | // beware of possible namespace prefixes | |||
1149 | if (_tagString2 == NULL((void*)0)) | |||
1150 | { | |||
1151 | smlLibFree(_tagString); | |||
1152 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
1153 | } | |||
1154 | ||||
1155 | _tagString2 = smlLibStrcpy(_tagString2,"</"); | |||
1156 | if (pScanner->nsprelen > 0) { | |||
1157 | _tagString2 = smlLibStrcat(_tagString2,pScanner->nsprefix); | |||
1158 | _tagString2 = smlLibStrcat(_tagString2,":"); | |||
1159 | } | |||
1160 | _tagString2 = smlLibStrcat(_tagString2,_tagString); | |||
1161 | _tagString2 = smlLibStrcat(_tagString2,">"); | |||
1162 | smlLibFree(_tagString); | |||
1163 | ||||
1164 | pPCData = (SmlPcdataPtr_t)smlLibMalloc(sizeof(SmlPcdata_t)); | |||
1165 | ||||
1166 | ||||
1167 | ||||
1168 | if (pPCData == NULL((void*)0)) | |||
1169 | { | |||
1170 | smlLibFree(_tagString2); | |||
1171 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
1172 | } | |||
1173 | pPCData->contentType = SML_PCDATA_UNDEFINED; | |||
1174 | pPCData->extension = SML_EXT_UNDEFINED; | |||
1175 | pPCData->length = 0; | |||
1176 | pPCData->content = NULL((void*)0); | |||
1177 | ||||
1178 | begin = pScanner->pos; | |||
1179 | ||||
1180 | if (*pScanner->pos == '&') { | |||
1181 | Ret_t ret = xmlHTMLEntity(pScanner, &entity); | |||
1182 | if (ret) { | |||
1183 | smlLibFree(_tagString2); | |||
1184 | return ret; | |||
1185 | } | |||
1186 | begin = (MemPtr_t)&entity; | |||
1187 | len = 1; | |||
1188 | } else { | |||
1189 | // Read Pcdata content until end tag appears or we run into something which | |||
1190 | // requires special decoding: CDATA or HTML entity | |||
1191 | while (smlLibStrncmp((String_t)pScanner->pos, _tagString2, smlLibStrlen(_tagString2)) != 0) | |||
1192 | { | |||
1193 | // check if end of buffer | |||
1194 | if (pScanner->pos >= pScanner->bufend) { | |||
1195 | smlLibFree(_tagString2); | |||
1196 | return SML_DECODEERROR(SML_ERR_XLT_INVAL_SYNCML_DOC,pScanner,"xmlSkipPCDATA")show_decode_error(0x200B,(XltDecScannerPtr_t)pScanner,"xmlSkipPCDATA" ); | |||
1197 | } | |||
1198 | // %%% luz 2006-09-07 | |||
1199 | // check if another <![CDATA[ opens here or an HTML entity | |||
1200 | if (smlLibStrncmp((String_t)pScanner->pos,"<![CDATA[",9)==0 || | |||
1201 | *pScanner->pos == '&') { | |||
1202 | // stop PCDATA scanning here | |||
1203 | break; | |||
1204 | } | |||
1205 | if (!readBytes(pScanner, 1)) | |||
1206 | return SML_DECODEERROR(SML_ERR_XLT_END_OF_BUFFER,pScanner,"xmlSkipPCDATA")show_decode_error(0x2012,(XltDecScannerPtr_t)pScanner,"xmlSkipPCDATA" ); | |||
1207 | ||||
1208 | } | |||
1209 | len = pScanner->pos - begin; | |||
1210 | } | |||
1211 | ||||
1212 | smlLibFree(_tagString2); | |||
1213 | ||||
1214 | pPCData->content = smlLibMalloc(len + 1); | |||
1215 | if (pPCData->content == NULL((void*)0)) | |||
1216 | { | |||
1217 | smlLibFree(pPCData); | |||
1218 | return SML_ERR_NOT_ENOUGH_SPACE0x11; | |||
1219 | } | |||
1220 | ||||
1221 | //%%%waste of CPU: smlLibMemset(pPCData->content, 0, len + 1); | |||
1222 | ((MemPtr_t)pPCData->content)[len]=0; // set terminator | |||
1223 | smlLibMemcpy(pPCData->content, begin, len); | |||
1224 | pPCData->contentType = SML_PCDATA_STRING; | |||
1225 | pPCData->length = len; | |||
1226 | ||||
1227 | pScanner->curtok->type = TOK_CONT; | |||
1228 | pScanner->curtok->pcdata = pPCData; | |||
1229 | ||||
1230 | ||||
1231 | return SML_ERR_OK0x00; | |||
1232 | } | |||
1233 | ||||
1234 | /** | |||
1235 | * Check if the current tag id represents a Pcdata element | |||
1236 | */ | |||
1237 | Boolean_t isPcdata(XltTagID_t tagid) | |||
1238 | { | |||
1239 | switch (tagid) | |||
1240 | { | |||
1241 | case TN_CMD: | |||
1242 | case TN_CMDID: | |||
1243 | case TN_CMDREF: | |||
1244 | case TN_LANG: | |||
1245 | case TN_LOCNAME: | |||
1246 | case TN_LOCURI: | |||
1247 | case TN_MSGID: | |||
1248 | case TN_MSGREF: | |||
1249 | case TN_RESPURI: | |||
1250 | case TN_SESSIONID: | |||
1251 | case TN_SOURCEREF: | |||
1252 | case TN_TARGETREF: | |||
1253 | case TN_VERSION: | |||
1254 | case TN_PROTO: | |||
1255 | case TN_DATA: | |||
1256 | case TN_META: | |||
1257 | case TN_NUMBEROFCHANGES: | |||
1258 | /* SyncML DS 1.2, Synthesis/luz 2005-08-24 */ | |||
1259 | case TN_FILTERTYPE: | |||
1260 | #ifdef __USE_METINF__ | |||
1261 | case TN_METINF_EMI: | |||
1262 | case TN_METINF_FORMAT: | |||
1263 | case TN_METINF_FREEID: | |||
1264 | case TN_METINF_FREEMEM: | |||
1265 | case TN_METINF_LAST: | |||
1266 | case TN_METINF_MARK: | |||
1267 | case TN_METINF_MAXMSGSIZE: | |||
1268 | /* SCTSTK - 18/03/2002 S.H. 2002-04-05 : SyncML 1.1 */ | |||
1269 | case TN_METINF_MAXOBJSIZE: | |||
1270 | case TN_METINF_NEXT: | |||
1271 | case TN_METINF_NEXTNONCE: | |||
1272 | case TN_METINF_SIZE: | |||
1273 | case TN_METINF_TYPE: | |||
1274 | case TN_METINF_VERSION: | |||
1275 | #endif | |||
1276 | #ifdef __USE_DEVINF__ | |||
1277 | case TN_DEVINF_MAN: | |||
1278 | case TN_DEVINF_MOD: | |||
1279 | case TN_DEVINF_OEM: | |||
1280 | case TN_DEVINF_FWV: | |||
1281 | case TN_DEVINF_SWV: | |||
1282 | case TN_DEVINF_HWV: | |||
1283 | case TN_DEVINF_DEVID: | |||
1284 | case TN_DEVINF_DEVTYP: | |||
1285 | case TN_DEVINF_MAXGUIDSIZE: | |||
1286 | case TN_DEVINF_SOURCEREF: | |||
1287 | case TN_DEVINF_DISPLAYNAME: | |||
1288 | case TN_DEVINF_CTTYPE: | |||
1289 | case TN_DEVINF_DATATYPE: | |||
1290 | case TN_DEVINF_SIZE: | |||
1291 | case TN_DEVINF_PROPNAME: | |||
1292 | case TN_DEVINF_VALENUM: | |||
1293 | case TN_DEVINF_PARAMNAME: | |||
1294 | case TN_DEVINF_SYNCTYPE: | |||
1295 | case TN_DEVINF_XNAM: | |||
1296 | case TN_DEVINF_XVAL: | |||
1297 | case TN_DEVINF_MAXMEM: | |||
1298 | case TN_DEVINF_MAXID: | |||
1299 | case TN_DEVINF_VERCT: | |||
1300 | case TN_DEVINF_VERDTD: | |||
1301 | /* SyncML DS 1.2, Synthesis/luz 2005-08-24 */ | |||
1302 | case TN_DEVINF_MAXOCCUR: | |||
1303 | case TN_DEVINF_FILTERKEYWORD: | |||
1304 | case TN_DEVINF_MAXSIZE: | |||
1305 | #endif | |||
1306 | return 1; | |||
1307 | default: | |||
1308 | return 0; | |||
1309 | } | |||
1310 | } | |||
1311 | #endif |