diff -Nru wbxml2-0.9.2.orig/bootstrap wbxml2-0.9.2/bootstrap --- wbxml2-0.9.2.orig/bootstrap 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/bootstrap 2008-01-10 19:03:44.000000000 +0000 @@ -1,8 +1,2 @@ -#! /bin/sh -libtoolize -aclocal -autoheader -# automake --foreign --add-missing --copy -automake --add-missing -autoconf -./configure --prefix=/usr +#!/bin/sh +autoreconf -i diff -Nru wbxml2-0.9.2.orig/configure.in wbxml2-0.9.2/configure.in --- wbxml2-0.9.2.orig/configure.in 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/configure.in 2008-01-10 19:03:44.000000000 +0000 @@ -1,11 +1,11 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(doxygen.h) -AM_INIT_AUTOMAKE(wbxml2, 0.9.0) +AM_INIT_AUTOMAKE(wbxml2, 0.9.2) AM_CONFIG_HEADER(config.h) dnl Define common variables -VERSION="0.9.0" +VERSION="0.9.2" AC_SUBST(VERSION) RELEASE="1" AC_SUBST(RELEASE) diff -Nru wbxml2-0.9.2.orig/libwbxml2.pc.in wbxml2-0.9.2/libwbxml2.pc.in --- wbxml2-0.9.2.orig/libwbxml2.pc.in 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/libwbxml2.pc.in 2008-01-10 19:03:44.000000000 +0000 @@ -8,4 +8,4 @@ Version: @VERSION@ Requires: libxml-2.0 >= 2.6 Libs: -L${libdir} -lwbxml2 -Cflags: -I${includedir} +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 --- wbxml2-0.9.2.orig/src/Makefile.am 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/src/Makefile.am 2008-01-10 19:03:44.000000000 +0000 @@ -3,7 +3,7 @@ INCLUDES =\ -I. -I/usr/include -CFLAGS =\ +AM_CFLAGS =\ -DHAVE_CONFIG_H\ -DHAVE_EXPAT\ -D_REENTRANT\ @@ -20,9 +20,7 @@ -DWBXML_SUPPORT_SYNCML\ -DWBXML_SUPPORT_WV\ -DWBXML_SUPPORT_AIRSYNC\ - -Wall -Wimplicit -Wreturn-type -Wunused -Wswitch -Wcomment -Wuninitialized -Wparentheses -Wpointer-arith -Wmissing-prototypes\ - -O3\ - -g + -Wall -g lib_LTLIBRARIES = libwbxml2.la diff -Nru wbxml2-0.9.2.orig/src/wbxml_encoder.c wbxml2-0.9.2/src/wbxml_encoder.c --- wbxml2-0.9.2.orig/src/wbxml_encoder.c 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/src/wbxml_encoder.c 2008-01-10 19:03:44.000000000 +0000 @@ -153,6 +153,7 @@ WB_BOOL use_strtbl; /**< Do we use String Table when generating WBXML output ? (default: YES) */ #endif /* WBXML_ENCODER_USE_STRTBL */ WB_BOOL xml_encode_header; /**< Do we generate XML Header ? */ + WB_BOOL produce_anonymous; /**< Do we produce anonymous documents? (default: NO) */ WBXMLVersion wbxml_version; /**< WBXML Version to use (when generating WBXML output) */ WBXMLCharsetMIBEnum output_charset; /**< Output charset encoding */ WB_BOOL flow_mode; /**< Is Flow Mode encoding activated ? */ @@ -400,6 +401,7 @@ encoder->cdata = NULL; encoder->xml_encode_header = TRUE; + encoder->produce_anonymous = FALSE; /* Default Version: WBXML 1.3 */ encoder->wbxml_version = WBXML_VERSION_13; @@ -509,6 +511,15 @@ } +WBXML_DECLARE(void) wbxml_encoder_set_produce_anonymous(WBXMLEncoder *encoder, WB_BOOL set_anonymous) +{ + if (encoder == NULL) + return; + + encoder->produce_anonymous = set_anonymous; +} + + WBXML_DECLARE(void) wbxml_encoder_set_wbxml_version(WBXMLEncoder *encoder, WBXMLVersion version) { if (encoder == NULL) @@ -1464,7 +1475,8 @@ /* Encode Public ID */ /* If WBXML Public Id is '0x01' (unknown), or we forced it, add the XML Public ID in the String Table */ - if (encoder->textual_publicid || (public_id == WBXML_PUBLIC_ID_UNKNOWN)) + if ((encoder->textual_publicid || (public_id == WBXML_PUBLIC_ID_UNKNOWN)) && + !encoder->produce_anonymous) { if (encoder->lang->publicID->xmlPublicID != NULL) { @@ -1601,7 +1613,7 @@ } else { /* Search tag in Tags Table */ - if ((tag = wbxml_tables_get_tag_from_xml(encoder->lang, wbxml_tag_get_xml_name(node->name))) != NULL) + if ((tag = wbxml_tables_get_tag_from_xml(encoder->lang, encoder->tagCodePage, wbxml_tag_get_xml_name(node->name))) != NULL) { token = tag->wbxmlToken; page = tag->wbxmlCodePage; @@ -2897,7 +2909,7 @@ /* Date and time can be encoded as OPAQUE data or as a string as specified in [ISO8601]. For now we * keep the string... but if someone wants to code the Date and time encoding function :-) */ - /* return wbxml_encode_wv_datetime(encoder, buffer); */ + return wbxml_encode_wv_datetime(encoder, buffer); break; case WBXML_WV_DATA_TYPE_BINARY: /** @todo Binary Encoding !! */ diff -Nru wbxml2-0.9.2.orig/src/wbxml_encoder.h wbxml2-0.9.2/src/wbxml_encoder.h --- wbxml2-0.9.2.orig/src/wbxml_encoder.h 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/src/wbxml_encoder.h 2008-01-10 19:03:44.000000000 +0000 @@ -118,6 +118,13 @@ WBXML_DECLARE(void) wbxml_encoder_set_use_strtbl(WBXMLEncoder *encoder, WB_BOOL use_strtbl); /** + * @brief Set if we want to produce anonymous WBXML documents [Default: FALSE] + * @param encoder [in] The WBXML encoder + * @param set_anonymous [in] TRUE to produce anonymous documents, FALSE otherwise + */ +WBXML_DECLARE(void) wbxml_encoder_set_produce_anonymous(WBXMLEncoder *encoder, WB_BOOL set_anonymous); + +/** * @brief Set the WBXML Version of the output document, when generating WBXML [Default: 'WBXML_VERSION_TOKEN_13' (1.3)] * @param encoder [in] The WBXML Encoder * @param version [in] The WBXML Version diff -Nru wbxml2-0.9.2.orig/src/wbxml.h wbxml2-0.9.2/src/wbxml.h --- wbxml2-0.9.2.orig/src/wbxml.h 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/src/wbxml.h 2008-01-10 19:03:44.000000000 +0000 @@ -285,6 +285,7 @@ WBXMLVersion wbxml_version; /**< WBXML Version */ WB_BOOL keep_ignorable_ws; /**< Keep Ignorable Whitespaces (Default: FALSE) */ WB_BOOL use_strtbl; /**< Generate String Table (Default: TRUE) */ + WB_BOOL produce_anonymous; /**< Produce an anonymous document (Default: FALSE) */ } WBXMLGenWBXMLParams; diff -Nru wbxml2-0.9.2.orig/src/wbxml_tables.c wbxml2-0.9.2/src/wbxml_tables.c --- wbxml2-0.9.2.orig/src/wbxml_tables.c 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/src/wbxml_tables.c 2008-01-10 19:03:44.000000000 +0000 @@ -2992,17 +2992,40 @@ WBXML_DECLARE(const WBXMLTagEntry *) wbxml_tables_get_tag_from_xml(const WBXMLLangEntry *lang_table, + const int cur_code_page, const WB_UTINY *xml_name) { - WB_ULONG i = 0; + WB_ULONG i; + WB_BOOL found_current = FALSE; if ((lang_table == NULL) || (lang_table->tagTable == NULL) || (xml_name == NULL)) return NULL; - while (lang_table->tagTable[i].xmlName != NULL) { - if (WBXML_STRCMP(lang_table->tagTable[i].xmlName, xml_name) == 0) - return &(lang_table->tagTable[i]); - i++; + /* First off, try to find it in the current code page, if provided */ + for (i = 0; cur_code_page >= 0 && lang_table->tagTable[i].xmlName != NULL; i++) { + const WBXMLTagEntry *entry = &lang_table->tagTable[i]; + + if (entry->wbxmlCodePage == cur_code_page) { + found_current = TRUE; + + if (WBXML_STRCMP(entry->xmlName, xml_name) == 0) + return entry; + } else { + if (found_current) + break; + } + } + + /* Then try all others */ + for (i = 0; lang_table->tagTable[i].xmlName != NULL; i++) { + const WBXMLTagEntry *entry = &lang_table->tagTable[i]; + + /* We've already searched the current code page */ + if (cur_code_page >= 0 && entry->wbxmlCodePage == cur_code_page) + continue; + + if (WBXML_STRCMP(entry->xmlName, xml_name) == 0) + return entry; } return NULL; diff -Nru wbxml2-0.9.2.orig/src/wbxml_tables.h wbxml2-0.9.2/src/wbxml_tables.h --- wbxml2-0.9.2.orig/src/wbxml_tables.h 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/src/wbxml_tables.h 2008-01-10 19:03:44.000000000 +0000 @@ -255,10 +255,12 @@ /** * @brief Search for a Tag Entry in Language Table, given the XML Name of the Tag * @param lang_table The Language Table to search in + * @param cur_code_page The current code page so that it can be searched first, or -1 to start from the first one. * @param xml_name The XML Name of the Tag to search * @return The Tag Entry of this XML Name in Language Table, or NULL if not found */ WBXML_DECLARE(const WBXMLTagEntry *) wbxml_tables_get_tag_from_xml(const WBXMLLangEntry *lang_table, + const int cur_code_page, const WB_UTINY *xml_name); /** diff -Nru wbxml2-0.9.2.orig/src/wbxml_tree.c wbxml2-0.9.2/src/wbxml_tree.c --- wbxml2-0.9.2.orig/src/wbxml_tree.c 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/src/wbxml_tree.c 2008-01-10 19:03:44.000000000 +0000 @@ -137,6 +137,9 @@ /* Use String Table */ wbxml_encoder_set_use_strtbl(wbxml_encoder, TRUE); + + /* Don't produce an anonymous document by default */ + wbxml_encoder_set_produce_anonymous(wbxml_encoder, FALSE); } else { /* WBXML Version */ @@ -154,6 +157,10 @@ /* String Table */ wbxml_encoder_set_use_strtbl(wbxml_encoder, params->use_strtbl); + /* Produce an anonymous document? */ + wbxml_encoder_set_produce_anonymous(wbxml_encoder, + params->produce_anonymous); + /** @todo Add parameter to call : wbxml_encoder_set_output_charset() */ } @@ -455,7 +462,7 @@ WBXMLTag *tag = NULL; /* Search for XML Tag Name in Table */ - if ((tag_entry = wbxml_tables_get_tag_from_xml(lang_table, name)) != NULL) { + if ((tag_entry = wbxml_tables_get_tag_from_xml(lang_table, -1, name)) != NULL) { /* Found : token tag */ tag = wbxml_tag_create_token(tag_entry); } @@ -921,6 +928,7 @@ result->lang = wbxml_tables_get_table(lang); result->root = NULL; result->orig_charset = orig_charset; + result->cur_code_page = 0; return result; } @@ -1085,7 +1093,9 @@ WBXMLTag *tag = NULL; /* Search for XML Tag Name in Table */ - if ((tag_entry = wbxml_tables_get_tag_from_xml(tree->lang, (const WB_UTINY *) name)) != NULL) { + if ((tag_entry = wbxml_tables_get_tag_from_xml(tree->lang, tree->cur_code_page, (const WB_UTINY *) name)) != NULL) { + tree->cur_code_page = tag_entry->wbxmlCodePage; + /* Found : token tag */ tag = wbxml_tag_create_token(tag_entry); } diff -Nru wbxml2-0.9.2.orig/src/wbxml_tree.h wbxml2-0.9.2/src/wbxml_tree.h --- wbxml2-0.9.2.orig/src/wbxml_tree.h 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/src/wbxml_tree.h 2008-01-10 19:03:44.000000000 +0000 @@ -97,6 +97,7 @@ const WBXMLLangEntry *lang; /**< Language Table */ WBXMLTreeNode *root; /**< Root Element */ WBXMLCharsetMIBEnum orig_charset; /**< Charset encoding of original document */ + WB_UTINY cur_code_page;/**< Last seen code page */ } WBXMLTree; diff -Nru wbxml2-0.9.2.orig/tools/Makefile.am wbxml2-0.9.2/tools/Makefile.am --- wbxml2-0.9.2.orig/tools/Makefile.am 2008-01-10 19:03:28.000000000 +0000 +++ wbxml2-0.9.2/tools/Makefile.am 2008-01-10 19:03:44.000000000 +0000 @@ -3,7 +3,7 @@ INCLUDES =\ -I. -I../src -I/usr/include -CFLAGS =\ +AM_CFLAGS =\ -DHAVE_CONFIG_H\ -DHAVE_EXPAT\ -D_REENTRANT\ @@ -20,9 +20,7 @@ -DWBXML_SUPPORT_SYNCML\ -DWBXML_SUPPORT_WV\ -DWBXML_SUPPORT_AIRSYNC\ - -Wall -Wimplicit -Wreturn-type -Wunused -Wswitch -Wcomment -Wuninitialized -Wparentheses -Wpointer-arith -Wmissing-prototypes\ - -O3\ - -g + -Wall -g bin_PROGRAMS = wbxml2xml xml2wbxml