diff --git a/rpm/buteo-syncml-qt5.spec b/rpm/buteo-syncml-qt5.spec index 274f02f..143d624 100644 --- a/rpm/buteo-syncml-qt5.spec +++ b/rpm/buteo-syncml-qt5.spec @@ -12,7 +12,7 @@ BuildRequires: pkgconfig(Qt5XmlPatterns) BuildRequires: pkgconfig(Qt5Xml) BuildRequires: pkgconfig(Qt5Sql) BuildRequires: pkgconfig(Qt5Test) -BuildRequires: pkgconfig(libwbxml2) +BuildRequires: pkgconfig(libwbxml2) >= 0.11.6 BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(openobex) BuildRequires: pkgconfig(buteosyncfw5) >= 0.6.24 diff --git a/src/src.pro b/src/src.pro index 083224d..abf5768 100644 --- a/src/src.pro +++ b/src/src.pro @@ -16,7 +16,8 @@ CONFIG += dll \ create_prl \ link_pkgconfig -PKGCONFIG = buteosyncfw5 +PKGCONFIG = buteosyncfw5 \ + libwbxml2 INCLUDEPATH += . \ syncelements \ @@ -114,7 +115,7 @@ HEADERS += SyncItem.h \ OTHER_FILES += config/meego-syncml-conf.xsd \ config/meego-syncml-conf.xml -LIBS += -lsqlite3 -lwbxml2 -lopenobex +LIBS += -lsqlite3 -lopenobex QTDIR = /usr/lib/qt5 diff --git a/src/transport/LibWbXML2Encoder.cpp b/src/transport/LibWbXML2Encoder.cpp index 1b2fd18..13bedae 100644 --- a/src/transport/LibWbXML2Encoder.cpp +++ b/src/transport/LibWbXML2Encoder.cpp @@ -35,6 +35,7 @@ #include "SyncMLMessage.h" #include "datatypes.h" +#include #include "LogMacros.h" @@ -174,19 +175,28 @@ bool LibWbXML2Encoder::decodeFromWbXML( const QByteArray& aWbXMLDocument, QByteA LOG_DEBUG("Converting WbXML to XML"); - WBXMLGenXMLParams params; - params.lang = WBXML_LANG_UNKNOWN; + WBXMLError error = WBXML_OK; + WBXMLConvWBXML2XML *conv = NULL; + + error = wbxml_conv_wbxml2xml_create( &conv ); + if (error != WBXML_OK) { + LOG_DEBUG("WbXML to XML conversion failed: " << (const char* )wbxml_errors_string( error ) ); + return false; + } + + wbxml_conv_wbxml2xml_set_language( conv, WBXML_LANG_UNKNOWN ); if( aPrettyPrint ) { - params.gen_type = WBXML_GEN_XML_INDENT; - params.indent = 3; + wbxml_conv_wbxml2xml_set_gen_type( conv, WBXML_GEN_XML_INDENT ); + wbxml_conv_wbxml2xml_set_indent( conv, 3 ); } else { - params.gen_type = WBXML_GEN_XML_COMPACT; - params.indent = 0; + wbxml_conv_wbxml2xml_set_gen_type( conv, WBXML_GEN_XML_COMPACT ); + wbxml_conv_wbxml2xml_set_indent( conv, 0 ); } - params.keep_ignorable_ws = TRUE; + wbxml_conv_wbxml2xml_enable_preserve_whitespaces( conv ); + wbxml_conv_wbxml2xml_set_charset( conv, WBXML_CHARSET_UNKNOWN ); const WB_UTINY* wbxml = reinterpret_cast( aWbXMLDocument.constData() ); WB_ULONG wbxml_len = aWbXMLDocument.size(); @@ -196,9 +206,9 @@ bool LibWbXML2Encoder::decodeFromWbXML( const QByteArray& aWbXMLDocument, QByteA LOG_DEBUG( "WbXML buffer size: " << wbxml_len ); - WBXMLError error = wbxml_conv_wbxml2xml_withlen( const_cast( wbxml ), wbxml_len, - &xml, &xml_len, - ¶ms ); + error = wbxml_conv_wbxml2xml_run( conv, const_cast( wbxml ), wbxml_len, + &xml, &xml_len); + wbxml_conv_wbxml2xml_destroy(conv); QByteArray data; diff --git a/src/transport/LibWbXML2Encoder.h b/src/transport/LibWbXML2Encoder.h index 3f80d6c..865e677 100644 --- a/src/transport/LibWbXML2Encoder.h +++ b/src/transport/LibWbXML2Encoder.h @@ -39,10 +39,14 @@ // libwbxml2-0 includes wbxml_config.h in wbxml.h. #define WBXML_SUPPORT_SYNCML -#include +#include #include "SyncAgentConsts.h" +// Defined opaquely to match the full definitions in +typedef struct WBXMLTree_s WBXMLTree; +typedef struct WBXMLTreeNode_s WBXMLTreeNode; + namespace DataSync { class SyncMLCmdObject; diff --git a/tests_meego/tests_common.pri b/tests_meego/tests_common.pri index 3796544..50f11ae 100644 --- a/tests_meego/tests_common.pri +++ b/tests_meego/tests_common.pri @@ -14,7 +14,8 @@ CONFIG += link_prl link_pkgconfig # So if remember to compile them when debugging LIBS += -L$${OUT_PWD}/$${tests_subdir_r}/../src/ -PKGCONFIG += buteosyncfw5 +PKGCONFIG += buteosyncfw5 \ + libwbxml2 LIBS += -lbuteosyncml5 # This is needed to avoid adding the /usr/lib link directory before the diff --git a/tests_meego/tests_meego.pro b/tests_meego/tests_meego.pro index fbfd316..fcb4280 100644 --- a/tests_meego/tests_meego.pro +++ b/tests_meego/tests_meego.pro @@ -1,6 +1,7 @@ include(tests_common.pri) TEMPLATE = subdirs CONFIG += ordered +PKGCONFIG = libwbxml2 SUBDIRS = \ TestUtils.pro \ generaltests.pro \