|
From: Thierry P. <thi...@gm...> - 2011-04-13 09:38:32
|
Hello there,
I'm using libwbxml (0.10.9 and 0.11.beta 2) so far I have experienced weird
behaviors while encoding and decoding XML/WBXML data.
The lib is compiled as static lib for one of my projects on mac platform
with Objective-C and I made a wrapper function to encode XML.
The issue I'm experiencing is some kind of stack crushing in the encoding
function. Here is a simple example:
#import <Foundation/Foundation.h>
#import "wbxml.h"
NSData* myencode(NSData *XMLData) {
NSData *WBXMLData = nil;
WBXMLGenWBXMLParams params;
params.wbxml_version = WBXML_VERSION_13;
params.use_strtbl = TRUE;
params.keep_ignorable_ws = FALSE;
WB_UTINY *wbxml = NULL;
WB_ULONG wbxml_len = 0;
WB_UTINY *xml = (WB_UTINY *)[XMLData bytes];
WB_LONG xml_len = [XMLData length];
WBXMLError ret = wbxml_conv_xml2wbxml_withlen(xml, xml_len, &wbxml,
&wbxml_len, ¶ms);
if (ret == WBXML_OK) {
WBXMLData = [NSData dataWithBytes:wbxml length:wbxml_len];
}
if (wbxml != NULL) free(wbxml);
return WBXMLData;
}
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSData *XMLData = [NSData dataWithContentsOfFile:@
"/Users/orion/Documents/_Clients/Mobiquant/test/test.txt"];
uint i;
for (i=0; i<10; i++){
NSLog(@"encoded: %@", myencode(XMLData));
}
[pool release];
return 0;
}
Now see the result log:
GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 UTC
2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".
tty /dev/ttys010
Pending breakpoint 1 - "objc_exception_throw" resolved
Pending breakpoint 4 - "_objc_error" resolved
[Switching to process 16086 thread 0x0]
*2011-04-13 10:13:56.109 wbxml-cmd-a[16086:903] encoded: <0300006a 1c2d2f2f
41495253 594e432f 2f445444 20416972 53796e63 2f2f454e 00000756 00004b03
30000101>*
*2011-04-13 10:13:56.123 wbxml-cmd-a[16086:903] encoded: <03016a00 00075600
004b0330 000101>*
*2011-04-13 10:13:56.126 wbxml-cmd-a[16086:903] encoded: <03016a00 00075600
004b0330 000101>*
*2011-04-13 10:13:56.130 wbxml-cmd-a[16086:903] encoded: <03016a00 00075600
004b0330 000101>*
*2011-04-13 10:13:56.134 wbxml-cmd-a[16086:903] encoded: <03016a00 00075600
004b0330 000101>*
*2011-04-13 10:13:56.138 wbxml-cmd-a[16086:903] encoded: <03016a00 00075600
004b0330 000101>*
*2011-04-13 10:13:56.142 wbxml-cmd-a[16086:903] encoded: <03016a00 00075600
004b0330 000101>*
*2011-04-13 10:13:56.152 wbxml-cmd-a[16086:903] encoded: <03016a00 00075600
004b0330 000101>*
*2011-04-13 10:13:56.163 wbxml-cmd-a[16086:903] encoded: <03016a00 00075600
004b0330 000101>*
*2011-04-13 10:13:56.168 wbxml-cmd-a[16086:903] encoded: <03016a00 00075600
004b0330 000101>*
Program ended with exit code: 0
Can anyone help me track the problem here ?
Which version of the lib should I use for ActiveSync, 0.11.beta 2 ?
Thanks and regards,
Thierry Passeron
|