View | Details | Raw Unified | Return to bug 124602
Collapse All | Expand All

(-)Makefile (-2 / +2 lines)
Lines 7-13 Link Here
7
7
8
PORTNAME=	wbxml2
8
PORTNAME=	wbxml2
9
PORTVERSION=	0.9.2
9
PORTVERSION=	0.9.2
10
PORTREVISION=	1
10
PORTREVISION=	2
11
CATEGORIES=	textproc devel
11
CATEGORIES=	textproc devel
12
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE} \
12
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE} \
13
		http://czauner.onlineloop.com/pub/FreeBSD/distfiles/
13
		http://czauner.onlineloop.com/pub/FreeBSD/distfiles/
Lines 22-28 Link Here
22
USE_AUTOTOOLS=	aclocal:19 autoconf:261 autoheader:261 automake:19 libtool:15
22
USE_AUTOTOOLS=	aclocal:19 autoconf:261 autoheader:261 automake:19 libtool:15
23
AUTOMAKE_ARGS=	-acf
23
AUTOMAKE_ARGS=	-acf
24
USE_LDCONFIG=	yes
24
USE_LDCONFIG=	yes
25
USE_GNOME=	pkgconfig
25
USE_GNOME=	pkgconfig libxml2
26
CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include" \
26
CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include" \
27
		LDFLAGS="-L${LOCALBASE}/lib"
27
		LDFLAGS="-L${LOCALBASE}/lib"
28
28
(-)files/patch-configure.in (+16 lines)
Added Link Here
1
--- configure.in.orig	2008-06-15 05:56:12.000000000 +1000
2
+++ configure.in	2008-06-15 05:56:24.000000000 +1000
3
@@ -1,11 +1,11 @@
4
 dnl  Process this file with autoconf to produce a configure script.
5
 AC_INIT(doxygen.h)
6
-AM_INIT_AUTOMAKE(wbxml2, 0.9.0)
7
+AM_INIT_AUTOMAKE(wbxml2, 0.9.2)
8
 AM_CONFIG_HEADER(config.h)
9
 
10
 
11
 dnl Define common variables
12
-VERSION="0.9.0"
13
+VERSION="0.9.2"
14
 AC_SUBST(VERSION)
15
 RELEASE="1"
16
 AC_SUBST(RELEASE)
(-)files/patch-libwbxml2.pc.in (+8 lines)
Added Link Here
1
--- libwbxml2.pc.in.orig	2006-07-11 21:47:44.000000000 +1000
2
+++ libwbxml2.pc.in	2008-06-15 06:58:26.000000000 +1000
3
@@ -8,4 +8,4 @@
4
 Version: @VERSION@
5
 Requires: libxml-2.0 >= 2.6
6
 Libs: -L${libdir} -lwbxml2
7
-Cflags: -I${includedir}
8
+Cflags: -I${includedir} -DHAVE_EXPAT -D_REENTRANT -DWBXML_ENCODER_USE_STRTBL -DWBXML_SUPPORT_WML -DWBXML_SUPPORT_WTA -DWBXML_SUPPORT_SI -DWBXML_SUPPORT_SL -DWBXML_SUPPORT_CO -DWBXML_SUPPORT_PROV -DWBXML_SUPPORT_EMN -DWBXML_SUPPORT_DRMREL -DWBXML_SUPPORT_OTA_SETTINGS -DWBXML_SUPPORT_SYNCML -DWBXML_SUPPORT_WV -DWBXML_SUPPORT_AIRSYNC
(-)files/patch-src_wbxml.h (+9 lines)
Added Link Here
1
--- src/wbxml.h.orig	2006-07-11 21:47:44.000000000 +1000
2
+++ src/wbxml.h	2008-06-15 06:58:54.000000000 +1000
3
@@ -285,6 +285,7 @@
4
     WBXMLVersion wbxml_version; /**< WBXML Version */
5
     WB_BOOL keep_ignorable_ws;  /**< Keep Ignorable Whitespaces (Default: FALSE) */
6
     WB_BOOL use_strtbl;         /**< Generate String Table (Default: TRUE) */
7
+    WB_BOOL produce_anonymous;  /**< Produce an anonymous document (Default: FALSE) */
8
 } WBXMLGenWBXMLParams;
9
 
(-)files/patch-src_wbxml_encoder.c (+277 lines)
Added Link Here
1
--- src/wbxml_encoder.c.orig	2006-07-11 21:47:45.000000000 +1000
2
+++ src/wbxml_encoder.c	2008-06-15 08:45:31.000000000 +1000
3
@@ -136,6 +136,7 @@
4
     const WBXMLTagEntry *current_tag;       /**< Current Tag (See The Warning For This Field !) */
5
     const WBXMLTreeNode *current_text_parent; /**< Text parent of current Node (See The Warning For This Field !) */
6
     const WBXMLAttrEntry *current_attr;     /**< Current Attribute */
7
+    WBXMLTreeNode *current_node;
8
     WB_UTINY tagCodePage;                   /**< Current Tag Code Page */
9
     WB_UTINY attrCodePage;                  /**< Current Attribute Code Page */
10
     WB_BOOL ignore_empty_text;              /**< Do we ignore empty text nodes (ie: ignorable whitespaces)? */
11
@@ -153,6 +154,7 @@
12
     WB_BOOL use_strtbl;                     /**< Do we use String Table when generating WBXML output ? (default: YES) */
13
 #endif /* WBXML_ENCODER_USE_STRTBL */
14
     WB_BOOL xml_encode_header;              /**< Do we generate XML Header ? */
15
+    WB_BOOL produce_anonymous;
16
     WBXMLVersion wbxml_version;             /**< WBXML Version to use (when generating WBXML output) */
17
     WBXMLCharsetMIBEnum output_charset;     /**< Output charset encoding */
18
     WB_BOOL flow_mode;                      /**< Is Flow Mode encoding activated ? */
19
@@ -269,6 +271,7 @@
20
 static WBXMLError wbxml_encode_entity(WBXMLEncoder *encoder, WB_ULONG value);
21
 #endif /* 0 */
22
 static WBXMLError wbxml_encode_opaque(WBXMLEncoder *encoder, WBXMLBuffer *buff);
23
+static WBXMLError wbxml_encode_opaque_data(WBXMLEncoder *encoder, WB_UTINY *data, WB_ULONG data_len);
24
 #if defined( WBXML_ENCODER_USE_STRTBL )
25
 static WBXMLError wbxml_encode_tableref(WBXMLEncoder *encoder, WB_ULONG offset);
26
 #endif /* WBXML_ENCODER_USE_STRTBL */
27
@@ -292,7 +295,9 @@
28
 #if defined( WBXML_SUPPORT_DRMREL )
29
 static WBXMLError wbxml_encode_drmrel_content(WBXMLEncoder *encoder, WB_UTINY *buffer);
30
 #endif /* WBXML_SUPPORT_DRMREL */
31
-
32
+#if defined( WBXML_SUPPORT_OTA_SETTINGS )
33
+static WBXMLError wbxml_encode_ota_nokia_icon(WBXMLEncoder *encoder, WB_UTINY *buffer);
34
+#endif
35
 #if defined( WBXML_ENCODER_USE_STRTBL )
36
 /* WBXML String Table Functions */
37
 static WBXMLStringTableElement *wbxml_strtbl_element_create(WBXMLBuffer *string, WB_BOOL is_stat);
38
@@ -383,6 +388,7 @@
39
     encoder->current_tag = NULL;
40
     encoder->current_text_parent = NULL;
41
     encoder->current_attr = NULL;
42
+    encoder->current_node = NULL;
43
 
44
     encoder->tagCodePage = 0;
45
     encoder->attrCodePage = 0;
46
@@ -400,6 +406,7 @@
47
     encoder->cdata = NULL;
48
 
49
     encoder->xml_encode_header = TRUE;
50
+    encoder->produce_anonymous = FALSE;
51
 
52
     /* Default Version: WBXML 1.3 */
53
     encoder->wbxml_version = WBXML_VERSION_13;
54
@@ -450,6 +457,7 @@
55
     
56
     encoder->current_tag = NULL;
57
     encoder->current_attr = NULL;
58
+    encoder->current_node = NULL;
59
     
60
     encoder->tagCodePage = 0;
61
     encoder->attrCodePage = 0;
62
@@ -507,7 +515,13 @@
63
     encoder->use_strtbl = use_strtbl;
64
 #endif /* WBXML_ENCODER_USE_STRTBL */
65
 }
66
-
67
+WBXML_DECLARE(void) wbxml_encoder_set_produce_anonymous(WBXMLEncoder *encoder, WB_BOOL set_anonymous)
68
+{
69
+    if (encoder == NULL)
70
+        return;
71
+    
72
+    encoder->produce_anonymous = set_anonymous;
73
+}
74
 
75
 WBXML_DECLARE(void) wbxml_encoder_set_wbxml_version(WBXMLEncoder *encoder, WBXMLVersion version)
76
 {
77
@@ -637,6 +651,9 @@
78
 
79
 WBXML_DECLARE(WBXMLError) wbxml_encoder_encode_node(WBXMLEncoder *encoder, WBXMLTreeNode *node)
80
 {
81
+    if (encoder->flow_mode == FALSE) {
82
+        WBXML_WARNING((WBXML_ENCODER, "You should NOT call wbxml_encoder_encode_node() if you are not in Flow Mode encoding ! (use wbxml_encoder_set_flow_mode(encoder, TRUE))"));
83
+    }
84
     return wbxml_encoder_encode_node_with_elt_end(encoder, node, TRUE);
85
 }
86
 
87
@@ -649,10 +666,6 @@
88
     if ((encoder == NULL) || (node == NULL))
89
         return WBXML_ERROR_BAD_PARAMETER;
90
     
91
-    if (encoder->flow_mode == FALSE) {
92
-        WBXML_WARNING((WBXML_ENCODER, "You should NOT call wbxml_encoder_encode_node() if you are not in Flow Mode encoding ! (use wbxml_encoder_set_flow_mode(encoder, TRUE))"));
93
-    }
94
-    
95
     /* Check that language table has been set */
96
     if (encoder->lang == NULL)
97
         return WBXML_ERROR_BAD_PARAMETER;
98
@@ -965,6 +978,7 @@
99
 static WBXMLError parse_node(WBXMLEncoder *encoder, WBXMLTreeNode *node, WB_BOOL enc_end)
100
 {
101
     WBXMLError ret = WBXML_OK;
102
+    encoder->current_node = node;
103
 
104
     /* Parse this node */
105
     switch (node->type) {
106
@@ -1078,6 +1092,7 @@
107
 
108
     /* Reset Current Tag */
109
     encoder->current_tag = NULL;
110
+    encoder->current_node = NULL;
111
 
112
     /* Parse next node */
113
     if (node->next != NULL)
114
@@ -1464,7 +1479,7 @@
115
 
116
     /* Encode Public ID */
117
     /* If WBXML Public Id is '0x01' (unknown), or we forced it, add the XML Public ID in the String Table */
118
-    if (encoder->textual_publicid || (public_id == WBXML_PUBLIC_ID_UNKNOWN))
119
+    if ((encoder->textual_publicid || (public_id == WBXML_PUBLIC_ID_UNKNOWN)) && !encoder->produce_anonymous)
120
     {
121
         if (encoder->lang->publicID->xmlPublicID != NULL)
122
         {
123
@@ -1500,7 +1515,7 @@
124
             else {
125
 #endif /* WBXML_ENCODER_USE_STRTBL */
126
                 /* Length of String Table is length of XML Public ID */
127
-                strstbl_len = wbxml_buffer_len(pid);
128
+                strstbl_len = wbxml_buffer_len(pid) + 1;
129
 
130
                 /* There is only the XML Public ID in String Table */
131
                 public_id_index = 0;
132
@@ -1548,7 +1563,8 @@
133
             /* The append includes terminating NULL char */
134
             if (!wbxml_buffer_append(header, pid))
135
                 return WBXML_ERROR_ENCODER_APPEND_DATA;
136
-            
137
+            if (!wbxml_buffer_append_char(header, WBXML_STR_END))
138
+                return WBXML_ERROR_ENCODER_APPEND_DATA;
139
             /* Clean up */
140
             wbxml_buffer_destroy(pid);
141
         }
142
@@ -1870,7 +1886,7 @@
143
      *  Encoder Language Specific Attribute Values
144
      */
145
 
146
-    if (ctx == WBXML_VALUE_ELEMENT_CTX_ATTR) {
147
+    if ((ctx == WBXML_VALUE_ELEMENT_CTX_ATTR) && (encoder->current_attr != NULL)) {
148
         switch (encoder->lang->langID) {
149
 #if defined( WBXML_SUPPORT_SI )
150
         case WBXML_LANG_SI10:
151
@@ -1892,7 +1908,16 @@
152
             }
153
             break;
154
 #endif /* WBXML_SUPPORT_EMN */
155
-
156
+#if defined( WBXML_SUPPORT_OTA_SETTINGS )
157
+        case WBXML_LANG_OTA_SETTINGS:
158
+            if ((encoder->current_attr->wbxmlCodePage == 0x00) &&
159
+                (encoder->current_attr->wbxmlToken == 0x11))
160
+            {
161
+                if ((ret = wbxml_encode_ota_nokia_icon(encoder, buffer)) != WBXML_NOT_ENCODED)
162
+                    return ret;
163
+            }
164
+            break;
165
+#endif /* WBXML_SUPPORT_OTA_SETTINGS */
166
         default:
167
             break;
168
         }
169
@@ -1936,7 +1961,8 @@
170
 #if defined( WBXML_SUPPORT_SYNCML )
171
         /* If this is a SyncML document ? */
172
         if ((encoder->lang->langID == WBXML_LANG_SYNCML_SYNCML10) ||
173
-            (encoder->lang->langID == WBXML_LANG_SYNCML_SYNCML11))
174
+            (encoder->lang->langID == WBXML_LANG_SYNCML_SYNCML11) ||
175
+            (encoder->lang->langID == WBXML_LANG_SYNCML_SYNCML12))
176
         {
177
             /** @todo We must check too if we are in a <Type> */
178
 
179
@@ -2219,6 +2245,11 @@
180
  * @param list The Value Element list
181
  * @return WBXML_OK if encoding is OK, an error code otherwise
182
  */
183
+static WBXMLError wbxml_encode_opaque(WBXMLEncoder *encoder, WBXMLBuffer *buff)
184
+{
185
+    return wbxml_encode_opaque_data(encoder, wbxml_buffer_get_cstr(buff), wbxml_buffer_len(buff));
186
+}
187
+
188
 static WBXMLError wbxml_encode_value_element_list(WBXMLEncoder *encoder, WBXMLList *list)
189
 {
190
     WBXMLValueElement *elt = NULL;
191
@@ -2438,18 +2469,18 @@
192
  * @note  opaque = OPAQUE length *byte
193
  *        length = mb_u_int32
194
  */
195
-static WBXMLError wbxml_encode_opaque(WBXMLEncoder *encoder, WBXMLBuffer *buff)
196
+static WBXMLError wbxml_encode_opaque_data(WBXMLEncoder *encoder, WB_UTINY *data, WB_ULONG data_len)
197
 {
198
     /* Add WBXML_OPAQUE */
199
     if (!wbxml_buffer_append_char(encoder->output, WBXML_OPAQUE))
200
         return WBXML_ERROR_ENCODER_APPEND_DATA;
201
 
202
     /* Add Length */
203
-    if (!wbxml_buffer_append_mb_uint_32(encoder->output, wbxml_buffer_len(buff)))
204
+    if (!wbxml_buffer_append_mb_uint_32(encoder->output, data_len))
205
         return WBXML_ERROR_ENCODER_APPEND_DATA;
206
 
207
     /* Add Buffer */
208
-    if (!wbxml_buffer_append(encoder->output, buff))
209
+    if (!wbxml_buffer_append_data(encoder->output, data, data_len))
210
         return WBXML_ERROR_ENCODER_APPEND_DATA;
211
 
212
     return WBXML_OK;
213
@@ -3146,8 +3177,54 @@
214
 }
215
 
216
 #endif /* WBXML_SUPPORT_DRMREL */
217
+#if defined( WBXML_SUPPORT_OTA_SETTINGS )
218
+static WBXMLError wbxml_encode_ota_nokia_icon(WBXMLEncoder *encoder, WB_UTINY *buffer)
219
+{
220
+    WBXMLError ret = WBXML_NOT_ENCODED;
221
+
222
+    /* Is a VALUE attribute ? */
223
+    if ((encoder->current_tag != NULL) &&
224
+        (encoder->current_attr->wbxmlCodePage == 0x00) &&
225
+        (encoder->current_attr->wbxmlToken == 0x11) &&
226
+        (encoder->current_node && encoder->current_node->attrs))
227
+    {
228
+        WBXMLList *attrs = encoder->current_node->attrs;
229
+        WB_ULONG index = 0;
230
+        WB_ULONG nb_attrs = wbxml_list_len(attrs);
231
+        WB_BOOL found = FALSE;
232
+        
233
+        /* Search for a NAME="ICON" attribute */
234
+        while (!found && (index < nb_attrs)) {
235
+            WBXMLAttribute *attr = (WBXMLAttribute*)wbxml_list_get(attrs, index);
236
+        
237
+            if ((WBXML_STRCMP("NAME", wbxml_attribute_get_xml_name(attr)) == 0) &&
238
+                (WBXML_STRCMP("ICON", wbxml_attribute_get_xml_value(attr)) == 0))
239
+            {
240
+                WB_UTINY *data = NULL;
241
+                WB_LONG data_len = 0;
242
 
243
+                /* Decode Base64 */
244
+                if ((data_len = wbxml_base64_decode(buffer, &data)) < 0)
245
+                    return WBXML_NOT_ENCODED;
246
+
247
+                /* Encode opaque */
248
+                if ((ret = wbxml_encode_opaque_data(encoder, data, data_len)) != WBXML_OK)
249
+                    return ret;
250
+
251
+                /* Free Data */
252
+                wbxml_free(data);
253
+
254
+                found = TRUE;
255
+            }
256
+
257
+            index++;
258
+        }
259
+    }
260
+
261
+    return ret;
262
+}
263
 
264
+#endif /* WBXML_SUPPORT_OTA_SETTINGS */
265
 #if defined( WBXML_ENCODER_USE_STRTBL )
266
 
267
 /****************************
268
@@ -4019,7 +4096,8 @@
269
 #if defined( WBXML_SUPPORT_SYNCML )
270
         /* Change text in <Type> from "application/vnd.syncml-devinf+wbxml" to "application/vnd.syncml-devinf+xml" */
271
         if (((encoder->lang->langID == WBXML_LANG_SYNCML_SYNCML10) ||
272
-             (encoder->lang->langID == WBXML_LANG_SYNCML_SYNCML11)) &&
273
+             (encoder->lang->langID == WBXML_LANG_SYNCML_SYNCML11) ||
274
+             (encoder->lang->langID == WBXML_LANG_SYNCML_SYNCML12)) &&
275
             (encoder->current_tag != NULL) &&
276
             (encoder->current_tag->wbxmlCodePage == 0x01 ) &&
277
             (encoder->current_tag->wbxmlToken == 0x13 ) &&
(-)files/patch-src_wbxml_encoder.h (+10 lines)
Added Link Here
1
--- src/wbxml_encoder.h.orig	2008-06-15 07:38:14.000000000 +1000
2
+++ src/wbxml_encoder.h	2008-06-15 07:39:40.000000000 +1000
3
@@ -116,6 +116,7 @@
4
  * @note This function has no effect if WBXML_ENCODER_USE_STRTBL compilation flag is not set
5
  */
6
 WBXML_DECLARE(void) wbxml_encoder_set_use_strtbl(WBXMLEncoder *encoder, WB_BOOL use_strtbl);
7
+WBXML_DECLARE(void) wbxml_encoder_set_produce_anonymous(WBXMLEncoder *encoder, WB_BOOL set_anonymous);
8
 
9
 /**
10
  * @brief Set the WBXML Version of the output document, when generating WBXML [Default: 'WBXML_VERSION_TOKEN_13' (1.3)]
(-)files/patch-src_wbxml_parser.c (+300 lines)
Added Link Here
1
--- src/wbxml_parser.c.orig	2006-07-11 21:47:45.000000000 +1000
2
+++ src/wbxml_parser.c	2008-06-15 06:59:21.000000000 +1000
3
@@ -153,11 +153,14 @@
4
 static WBXMLError parse_mb_uint32(WBXMLParser *parser, WB_ULONG *result);
5
 
6
 /* Language Specific Decoding Functions */
7
+static WBXMLError decode_base64_value(WBXMLBuffer **data);
8
+
9
 #if defined( WBXML_SUPPORT_SI ) || defined( WBXML_SUPPORT_EMN )
10
 static WBXMLError decode_datetime(WBXMLBuffer *buff);
11
 #endif /* WBXML_SUPPORT_SI || WBXML_SUPPORT_EMN */
12
 
13
 static WBXMLError decode_opaque_content(WBXMLParser *parser, WBXMLBuffer **data);
14
+static WBXMLError decode_opaque_attr_value(WBXMLParser *parser, WBXMLBuffer **data);
15
 
16
 #if defined( WBXML_SUPPORT_WV )
17
 static WBXMLError decode_wv_content(WBXMLParser *parser, WBXMLBuffer **data);
18
@@ -165,10 +168,6 @@
19
 static WBXMLError decode_wv_datetime(WBXMLBuffer **data);
20
 #endif /* WBXML_SUPPORT_WV */
21
 
22
-#if defined( WBXML_SUPPORT_DRMREL )
23
-static WBXMLError decode_drmrel_keyvalue(WBXMLBuffer **data);
24
-#endif /* WBXML_SUPPORT_DRMREL */
25
-
26
 /* Macro for error handling */
27
 #define CHECK_ERROR if (ret != WBXML_OK) return ret;
28
 
29
@@ -277,7 +276,7 @@
30
             parser->charset = WBXML_PARSER_DEFAULT_CHARSET;
31
       
32
             WBXML_WARNING((WBXML_PARSER,
33
-                           "No charset information found, using default : %s",
34
+                           "No charset information found, using default : %x",
35
                            WBXML_PARSER_DEFAULT_CHARSET));
36
         }
37
     }
38
@@ -659,12 +658,14 @@
39
      * Do NOT keep 'WBXML_VERSION_UNKNOWN' (0xffffffff) because only one byte will change.
40
      * (for example, if the version is 0x02, then parser->version will be 0xffffff02)
41
      */
42
-    parser->version = WBXML_VERSION_10;
43
+    WB_UTINY version = WBXML_VERSION_10;
44
     
45
-    if ((ret = parse_uint8(parser, (WB_UTINY*) &parser->version)) != WBXML_OK)
46
+    if ((ret = parse_uint8(parser, &version)) != WBXML_OK)
47
         return ret;
48
+    
49
+    parser->version = version;
50
 
51
-    WBXML_DEBUG((WBXML_PARSER, "(%d) Parsed version: '0x%X'", parser->pos - 1, (WB_TINY) parser->version));
52
+    WBXML_DEBUG((WBXML_PARSER, "(%d) Parsed version: 1.%d", parser->pos - 1, parser->version));
53
 
54
     return WBXML_OK;
55
 }
56
@@ -938,6 +939,8 @@
57
     if ((ret = parse_stag(parser, &tag, &element)) != WBXML_OK ) {
58
         return ret;
59
     }
60
+
61
+    WBXML_DEBUG((WBXML_PARSER, "<%s>", wbxml_tag_get_xml_name(element)));
62
   
63
     /* Set Current Tag */
64
     if (element->type == WBXML_VALUE_TOKEN) {
65
@@ -990,11 +993,11 @@
66
                                                attrs,
67
                                                is_empty);
68
     }
69
-      
70
+    
71
     /* Free Attributes */
72
     free_attrs_table(attrs);
73
     
74
-      
75
+    
76
     /* Parse *content */
77
     if (!is_empty) {
78
         /* There can be NO content */
79
@@ -1023,7 +1026,7 @@
80
             content = NULL;
81
         }
82
         
83
-        WBXML_DEBUG((WBXML_PARSER, "(%d) End of Element", parser->pos));
84
+        WBXML_DEBUG((WBXML_PARSER, "(%d) End of Element", parser->pos - 1));
85
         
86
         /* Skip END */
87
         parser->pos++;
88
@@ -1037,7 +1040,9 @@
89
                                              element,
90
                                              is_empty);
91
     }
92
-      
93
+    
94
+    WBXML_DEBUG((WBXML_PARSER, "</%s>", wbxml_tag_get_xml_name(element)));
95
+    
96
     /* Free Tag */
97
     wbxml_tag_destroy(element);
98
       
99
@@ -1078,7 +1083,7 @@
100
     WBXML_DEBUG((WBXML_PARSER, "(%d) Parsing switchPage", parser->pos));
101
 
102
     if ((WB_UTINY) parser->version < (WB_UTINY) WBXML_VERSION_12)
103
-        WBXML_WARNING((WBXML_PARSER, "No Switch Page mecanism possible in WBXML < %s", WBXML_VERSION_TEXT_12));
104
+        WBXML_WARNING((WBXML_PARSER, "No Switch Page mecanism possible in WBXML < %s (current: %d)", WBXML_VERSION_TEXT_12, (WB_UTINY) parser->version));
105
 
106
     /* Skip SWITCH_PAGE token */
107
     parser->pos++;
108
@@ -1946,7 +1951,10 @@
109
             WBXML_ERROR((WBXML_PARSER, "An Attribute value can't be 'opaque' in WBXML version < %s", WBXML_VERSION_TEXT_12));
110
         }
111
         
112
-        return parse_opaque(parser, result);
113
+        if ((ret = parse_opaque(parser, result)) != WBXML_OK) 
114
+            return ret;
115
+        
116
+        return decode_opaque_attr_value(parser, result);
117
     }
118
   
119
   
120
@@ -2209,6 +2217,40 @@
121
  * Language Specific Decoding Functions 
122
  */
123
 
124
+/**
125
+ * @brief Decode a BASE64 value
126
+ * @param data [in/out]The value to decode
127
+ * @return WBXML_OK if OK, another error code otherwise
128
+ */
129
+static WBXMLError decode_base64_value(WBXMLBuffer **data)
130
+{
131
+    WB_UTINY   *result = NULL;
132
+    WBXMLError  ret    = WBXML_OK;
133
+    
134
+    if ((data == NULL) || (*data == NULL)) {
135
+        return WBXML_ERROR_INTERNAL;
136
+    }
137
+    
138
+    if ((result = wbxml_base64_encode((const WB_UTINY *) wbxml_buffer_get_cstr(*data),
139
+                                      wbxml_buffer_len(*data))) == NULL)
140
+    {
141
+        return WBXML_ERROR_B64_ENC;
142
+    }
143
+    
144
+    /* Reset buffer */
145
+    wbxml_buffer_delete(*data, 0, wbxml_buffer_len(*data));
146
+    
147
+    /* Set data */
148
+    if (!wbxml_buffer_append_cstr(*data, result)) {
149
+        ret = WBXML_ERROR_NOT_ENOUGH_MEMORY;
150
+    }
151
+    
152
+    wbxml_free(result);
153
+    
154
+    return ret;
155
+}
156
+
157
+
158
 #if ( defined( WBXML_SUPPORT_SI ) || defined( WBXML_SUPPORT_EMN ) )
159
 
160
 /**************************************
161
@@ -2297,8 +2339,6 @@
162
  * @param parser The WBXML Parser
163
  * @param data The Opaque data buffer
164
  * @return WBXML_OK if OK, another error code otherwise
165
- * @note Used for:
166
- *      - WV 1.1 / 1.2
167
  */
168
 static WBXMLError decode_opaque_content(WBXMLParser  *parser,
169
                                         WBXMLBuffer **data)
170
@@ -2318,13 +2358,14 @@
171
 #if defined( WBXML_SUPPORT_DRMREL )
172
 
173
     case WBXML_LANG_DRMREL10:
174
+        /* ds:KeyValue */
175
         if ((parser->current_tag->wbxmlCodePage == 0x00) &&
176
             (parser->current_tag->wbxmlToken == 0x0C))
177
         {
178
             WBXMLError ret = WBXML_OK;
179
             
180
-            /* Decode <KeyValue> */
181
-            if ((ret = decode_drmrel_keyvalue(data)) != WBXML_OK)
182
+            /* Decode base64 value */ 
183
+            if ((ret = decode_base64_value(data)) != WBXML_OK)
184
                 return ret;
185
 
186
             return WBXML_OK;
187
@@ -2332,7 +2373,62 @@
188
         break;
189
 
190
 #endif /* WBXML_SUPPORT_DRMREL */    
191
-    
192
+
193
+#if defined( WBXML_SUPPORT_SYNCML )
194
+
195
+    case WBXML_LANG_SYNCML_SYNCML10: 
196
+    case WBXML_LANG_SYNCML_SYNCML11: 
197
+    case WBXML_LANG_SYNCML_SYNCML12: 
198
+        /* NextNonce */
199
+        if ((parser->current_tag->wbxmlCodePage == 0x01) &&
200
+            (parser->current_tag->wbxmlToken == 0x10)) 
201
+        {
202
+            WBXMLError ret = WBXML_OK;
203
+            
204
+            /* Decode base64 value */ 
205
+            if ((ret = decode_base64_value(data)) != WBXML_OK)
206
+                return ret;
207
+                
208
+            return WBXML_OK;
209
+        }
210
+        break;
211
+
212
+#endif /* WBXML_SUPPORT_SYNCML */    
213
+
214
+    default:
215
+        /* NOP */
216
+        break;
217
+    } /* switch */
218
+  
219
+    return WBXML_OK;
220
+}
221
+
222
+
223
+/**
224
+ * @brief Decode an Opaque Attribute Value buffer
225
+ * @param parser The WBXML Parser
226
+ * @param data The Opaque data buffer
227
+ * @return WBXML_OK if OK, another error code otherwise
228
+ */
229
+static WBXMLError decode_opaque_attr_value(WBXMLParser *parser, WBXMLBuffer **data)
230
+{
231
+    switch (parser->langTable->langID) 
232
+    {
233
+#if defined( WBXML_SUPPORT_OTA_SETTINGS )
234
+
235
+    case WBXML_LANG_OTA_SETTINGS:
236
+    {
237
+        WBXMLError ret = WBXML_OK;
238
+        
239
+        /* Decode base64 value */
240
+        if ((ret = decode_base64_value(data)) != WBXML_OK)
241
+            return ret; 
242
+
243
+        return WBXML_OK;
244
+    }
245
+
246
+#endif /* WBXML_SUPPORT_OTA_SETTINGS */ 
247
+
248
     default:
249
         /* NOP */
250
         break;
251
@@ -2705,49 +2801,3 @@
252
 }
253
 
254
 #endif /* WBXML_SUPPORT_WV */
255
-
256
-
257
-#if defined( WBXML_SUPPORT_DRMREL )
258
-
259
-/**************************************
260
- * DRMREL 1.0
261
- */
262
-
263
-/**
264
- * @brief Decode a DRMREL 'KeyValue'
265
- * @param data The KeyValue to decode
266
- * @return WBXML_OK if OK, another error code otherwise
267
- * @note Used for:
268
- *      - DRMREL 1.0
269
- * @note [OMA-Download-DRMREL-v1_0-20020913-C.PDF] - 7.1:
270
- *       "The content of the <KeyValue> element MUST be in binary format using the ‘opaque’ token."
271
- */
272
-static WBXMLError decode_drmrel_keyvalue(WBXMLBuffer **data)
273
-{
274
-    WB_UTINY   *result = NULL;
275
-    WBXMLError  ret    = WBXML_OK;
276
-  
277
-    if ((data == NULL) || (*data == NULL)) {
278
-        return WBXML_ERROR_INTERNAL;
279
-    }
280
-  
281
-    if ((result = wbxml_base64_encode((const WB_UTINY *) wbxml_buffer_get_cstr(*data),
282
-                                      wbxml_buffer_len(*data))) == NULL)
283
-    {
284
-        return WBXML_ERROR_B64_ENC;
285
-    }
286
-
287
-    /* Reset buffer */
288
-    wbxml_buffer_delete(*data, 0, wbxml_buffer_len(*data));
289
-
290
-    /* Set data */
291
-    if (!wbxml_buffer_append_cstr(*data, result)) {
292
-        ret = WBXML_ERROR_NOT_ENOUGH_MEMORY;
293
-    }
294
-
295
-    wbxml_free(result);
296
-  
297
-    return ret;
298
-}
299
-
300
-#endif /* WBXML_SUPPORT_DRMREL */
(-)files/patch-src_wbxml_tables.h (+13 lines)
Added Link Here
1
--- src/wbxml_tables.h.orig	2008-06-15 07:35:57.000000000 +1000
2
+++ src/wbxml_tables.h	2008-06-15 07:36:37.000000000 +1000
3
@@ -108,8 +108,8 @@
4
 
5
 /* SyncML 1.2 */
6
 #define WBXML_PUBLIC_ID_SYNCML_SYNCML12 0x1201
7
-#define WBXML_PUBLIC_ID_SYNCML_DEVINF12 0x1202
8
-#define WBXML_PUBLIC_ID_SYNCML_METINF12 0x1203
9
+#define WBXML_PUBLIC_ID_SYNCML_METINF12 0x1202
10
+#define WBXML_PUBLIC_ID_SYNCML_DEVINF12 0x1203
11
 
12
 #define XML_PUBLIC_ID_SYNCML_SYNCML12 "-//SYNCML//DTD SyncML 1.2//EN"
13
 #define XML_PUBLIC_ID_SYNCML_DEVINF12 "-//SYNCML//DTD DevInf 1.2//EN"
(-)files/patch-src_wbxml_tree.c (+253 lines)
Added Link Here
1
--- src/wbxml_tree.c.orig	2006-07-11 21:47:45.000000000 +1000
2
+++ src/wbxml_tree.c	2008-06-15 06:59:31.000000000 +1000
3
@@ -137,6 +137,7 @@
4
 
5
         /* Use String Table */
6
         wbxml_encoder_set_use_strtbl(wbxml_encoder, TRUE);
7
+        wbxml_encoder_set_produce_anonymous(wbxml_encoder, FALSE);
8
     }
9
     else {
10
         /* WBXML Version */
11
@@ -153,6 +156,7 @@
12
 
13
         /* String Table */
14
         wbxml_encoder_set_use_strtbl(wbxml_encoder, params->use_strtbl);
15
+        wbxml_encoder_set_produce_anonymous(wbxml_encoder, params->produce_anonymous);
16
 
17
         /** @todo Add parameter to call : wbxml_encoder_set_output_charset() */
18
     }
19
@@ -256,7 +262,8 @@
20
 
21
 #else /* HAVE_EXPAT */
22
 
23
-#if defined( HAVE_LIBXML )
24
+//#if defined( HAVE_LIBXML )
25
+#if 0
26
 
27
     /** @todo Use LibXML2 SAX interface ! */
28
     return WBXML_ERROR_NO_XMLPARSER;
29
@@ -333,7 +340,8 @@
30
 }
31
 
32
 
33
-#if defined( HAVE_LIBXML )
34
+// #if defined( HAVE_LIBXML )
35
+#if 0
36
 
37
 WBXML_DECLARE(WBXMLError) wbxml_tree_from_libxml_doc(xmlDocPtr libxml_doc,
38
                                                      WBXMLTree **tree)
39
@@ -617,6 +625,40 @@
40
 }
41
 
42
 
43
+WBXML_DECLARE(WBXMLError) wbxml_tree_node_extract(WBXMLTreeNode *node)
44
+{
45
+    if (node == NULL)
46
+        return WBXML_ERROR_BAD_PARAMETER;
47
+    
48
+    /* Parent link */
49
+    if (node->parent != NULL) {
50
+        if (node->parent->children == node) {
51
+            /* Update parent children */
52
+		    node->parent->children = node->next;
53
+        }
54
+
55
+        /* No more parent */
56
+        node->parent = NULL;
57
+    }
58
+
59
+    /* Next link */
60
+    if (node->next != NULL) {
61
+        /* Link next node to previous node */
62
+        node->next->prev = node->prev;
63
+        node->next = NULL;
64
+    }
65
+
66
+    /* Previous link */
67
+    if (node->prev != NULL) {
68
+        /* Link previous node to next node */
69
+        node->prev->next = node->next;
70
+        node->prev = NULL;
71
+    }
72
+    
73
+    return WBXML_OK;
74
+}
75
+
76
+
77
 WBXML_DECLARE(WBXMLError) wbxml_tree_node_add_attr(WBXMLTreeNode *node,
78
                                                    WBXMLAttribute *attr)
79
 {
80
@@ -938,34 +982,17 @@
81
 }
82
 
83
 
84
-/** @todo Rewrite this function (use wbxml_tree_node_* functions) */
85
 WBXML_DECLARE(WB_BOOL) wbxml_tree_add_node(WBXMLTree *tree, WBXMLTreeNode *parent, WBXMLTreeNode *node)
86
 {
87
     WBXMLTreeNode *tmp = NULL;
88
 
89
     if ((tree == NULL) || (node == NULL))
90
         return FALSE;
91
-
92
-    /* Set parent to new node */
93
-    node->parent = parent;    
94
-
95
+    
96
     /* Check if this is the Root Element */
97
     if (parent != NULL) {
98
-        /* This is not the Root Element... search for previous sibbling element */
99
-        if (parent->children != NULL) {
100
-            /* Add this Node to end of Sibbling Node list of Parent */
101
-            tmp = parent->children;
102
-
103
-            while (tmp->next != NULL)
104
-                tmp = tmp->next;
105
-            
106
-            node->prev = tmp;
107
-            tmp->next = node;
108
-        }
109
-        else {
110
-            /* No previous sibbling element */
111
-            parent->children = node;
112
-        }
113
+        if (!wbxml_tree_node_add_child(parent, node))
114
+            return FALSE;
115
     }
116
     else {
117
         /* We do NOT allow replacement of an existing Tree Node */
118
@@ -974,53 +1001,28 @@
119
 
120
         /* This is the Root Element */
121
         tree->root = node;
122
+        node->parent = NULL;
123
     }
124
 
125
     return TRUE;
126
 }
127
 
128
 
129
-/** @todo Rewrite this function (use wbxml_tree_node_* functions) */
130
 WBXML_DECLARE(WBXMLError) wbxml_tree_extract_node(WBXMLTree *tree,
131
                                                   WBXMLTreeNode *node)
132
 {
133
     if ((tree == NULL) || (node == NULL))
134
         return WBXML_ERROR_BAD_PARAMETER;
135
-
136
-    /* Parent link */
137
-    if (node->parent != NULL) {
138
-        if (node->parent->children == node) {
139
-            /* Update parent children */
140
-		    node->parent->children = node->next;
141
-        }
142
-
143
-        /* No more parent */
144
-        node->parent = NULL;
145
-    }
146
-    else {
147
+    
148
+    if (node == tree->root) {
149
         /* Root removed ! */
150
         tree->root = node->next;
151
     }
152
 
153
-    /* Next link */
154
-    if (node->next != NULL) {
155
-        /* Link next node to previous node */
156
-        node->next->prev = node->prev;
157
-        node->next = NULL;
158
-    }
159
-
160
-    /* Previous link */
161
-    if (node->prev != NULL) {
162
-        /* Link previous node to next node */
163
-        node->prev->next = node->next;
164
-        node->prev = NULL;
165
-    }
166
-
167
-    return WBXML_OK;
168
+    return wbxml_tree_node_extract(node);
169
 }
170
 
171
 
172
-/** @todo Rewrite this function (use wbxml_tree_node_* functions) */
173
 WBXML_DECLARE(WBXMLTreeNode *) wbxml_tree_add_elt(WBXMLTree *tree,
174
                                                   WBXMLTreeNode *parent,
175
                                                   WBXMLTag *tag)
176
@@ -1048,7 +1050,6 @@
177
 }
178
 
179
 
180
-/** @todo Rewrite this function (use wbxml_tree_node_* functions) */
181
 WBXML_DECLARE(WBXMLTreeNode *) wbxml_tree_add_elt_with_attrs(WBXMLTree *tree,
182
                                                              WBXMLTreeNode *parent,
183
                                                              WBXMLTag *tag,
184
@@ -1075,36 +1076,15 @@
185
 }
186
 
187
 
188
-/** @todo Rewrite this function (use wbxml_tree_node_* functions) */
189
 WBXML_DECLARE(WBXMLTreeNode *) wbxml_tree_add_xml_elt(WBXMLTree *tree,
190
                                                       WBXMLTreeNode *parent,
191
                                                       WB_UTINY *name)
192
 {
193
-    const WBXMLTagEntry *tag_entry = NULL;
194
     WBXMLTreeNode *node = NULL;
195
-    WBXMLTag *tag = NULL;
196
     
197
-    /* Search for XML Tag Name in Table */
198
-    if ((tag_entry = wbxml_tables_get_tag_from_xml(tree->lang, (const WB_UTINY *) name)) != NULL) {
199
-        /* Found : token tag */
200
-        tag = wbxml_tag_create_token(tag_entry);
201
-    }
202
-    else {
203
-        /* Not found : literal tag */
204
-        tag = wbxml_tag_create_literal(name);
205
-    }
206
-
207
-    if (tag == NULL)
208
-        return NULL;
209
-
210
-    /* Create a new Node */
211
-    if ((node = wbxml_tree_node_create(WBXML_TREE_ELEMENT_NODE)) == NULL) {
212
-        wbxml_tag_destroy(tag);
213
+    /* Create element node */
214
+    if ((node = wbxml_tree_node_create_xml_elt(tree->lang, (const WB_UTINY *) name)) == NULL)
215
         return NULL;
216
-    }
217
-    
218
-    /* Set Node Tag */
219
-    node->name = tag;
220
 
221
     /* Add this Node to Tree  */
222
     if (!wbxml_tree_add_node(tree, parent, node)) {
223
@@ -1116,7 +1096,6 @@
224
 }
225
 
226
 
227
-/** @todo Rewrite this function (use wbxml_tree_node_* functions) */
228
 WBXML_DECLARE(WBXMLTreeNode *) wbxml_tree_add_xml_elt_with_attrs(WBXMLTree *tree,
229
                                                                  WBXMLTreeNode *parent,
230
                                                                  WB_UTINY *name,
231
@@ -1143,7 +1122,6 @@
232
 }
233
 
234
 
235
-/** @todo Rewrite this function (use wbxml_tree_node_* functions) */
236
 WBXML_DECLARE(WBXMLTreeNode *) wbxml_tree_add_text(WBXMLTree *tree,
237
                                                    WBXMLTreeNode *parent,
238
                                                    const WB_UTINY *text,
239
@@ -1152,13 +1130,7 @@
240
     WBXMLTreeNode *node = NULL;
241
 
242
     /* Create a new Node */
243
-    if ((node = wbxml_tree_node_create(WBXML_TREE_TEXT_NODE)) == NULL) {
244
-        return NULL;
245
-    }
246
-
247
-    /* Set Content */
248
-    if ((node->content = wbxml_buffer_create(text, len, len)) == NULL) {
249
-        wbxml_tree_node_destroy(node);
250
+    if ((node = wbxml_tree_node_create_text(text, len)) == NULL) {
251
         return NULL;
252
     }
253
 
(-)files/patch-src_wbxml_tree.h (+10 lines)
Added Link Here
1
--- src/wbxml_tree.h.orig	2008-06-15 08:10:30.000000000 +1000
2
+++ src/wbxml_tree.h	2008-06-15 08:11:09.000000000 +1000
3
@@ -308,6 +308,7 @@
4
 WBXML_DECLARE(WB_BOOL) wbxml_tree_node_add_child(WBXMLTreeNode *parent,
5
                                                  WBXMLTreeNode *node);
6
 
7
+WBXML_DECLARE(WBXMLError) wbxml_tree_node_extract(WBXMLTreeNode *node);
8
 /**
9
  * @brief Add a WBXML Attribute to a Tree Node structure
10
  * @param node The Tree Node to modify

Return to bug 124602