Ok. So I have done what you suggest, but I still get the problem about all of the data not being properly copied to the buf in SARreassemble.
What happes is I receive two WDP SAR packets with the following data (split at the "-------"): <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <template> <do type="accept" label="Home"><go href="http://192.168.0.1/wap/index.wml"/></do> <onevent type="onenterforward"> <setvar name="msg" value="Welcome to"/> </onevent> </template> <card title="WAPUniverse.com"> <do type="prev" label="Back"><prev/></do> <p align="center"><a href="#1"><img src="logo.wbmp" alt="WAPUniverse"/></a><br/> <b>$(msg) WAPUniverse.com</b><br/></p> <p align="left"><b>::news::</b></p> <p>WAPUniverse content service in the works.<br/> <a href="http://mymedia.corp.wapuniverse.com/">Check it out....</a><br/></p> <p><b>::services::</b></p> <p>WAP Portal: <a href="browser/en/index.wml">Enter >></a><br/> Test Pages: <a href="test/i.wml">Enter >></a><br/><br/> <a href="loadurl.wml">Open URL</a><br/> <a href="services/sendsms.wml">Send SMS</a><br/> <a href="services/push.wml">Send Push</a><br/> <a href="services/ota.wml">Send OTA</a><br/> ------<split here ________________<br/> Copyright (c) 2004 <a href="contact.wml">Donald C. Kirker</a>.<br/> <a href="http://www.wapuniverse.com/">WAPUniverse</a></p> </card> </wml> I have verified that the sizes and offsets are correct, but WAPUniverse only handles the following: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <template> <do type="accept" label="Ho (including the WTP header from the first packet and the WSP header). I also get a little garbage that follows. What might cause this. If I disable SAR support this page will come in fine. I also believe that the buf in SARreassemble is of a significant size, as I allocate about 59K before calling WspGetReply, and SARreassemble uses the same 59K buf. What might cause this? Should I flush buf before moving data back into it? If so, how? Thanks, Donald "Ben Combee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > At 02:27 PM 3/25/2005, you wrote: > > tmp = Malloc(sizeof(SARType)); > > MemSet(tmp,sizeof(SARType),0); > > ErrFatalDisplayIf (!tmp, "Malloc Failed"); > > Move the MemSet after the ErrFatalDisplayIf line. > > > tmp->pos = pos; > > tmp->last = last; > > if (type == 2) > > tmp->size = size-4; > > else > > tmp->size = size; > > Shouldn't the "2" here be some #define constant or enum. Magic numbers are > considered harmful. > > > tmp->data = Malloc(tmp->size+1); > > ErrFatalDisplayIf (!tmp->data, "Malloc Failed"); > > if (type == 2) { > > for (j=0; j<(tmp->size);j++) > > tmp->data[j] = data[j+4]; > > } else { > > for (j=0; j<(tmp->size);j++) > > tmp->data[j] = data[j]; > > } > > I'd probably have written this to offset "data" back in the previous if > statement, avoiding the need for a second loop. I'd probably also have > used a MemMove here rather than write my own loop. > > > if (MemPtrSize(buf) < (offset+tmp->size+1)) > > MemPtrResize(buf, offset+tmp->size+1); > > MemPtrResize can fail if it can't grow the size of the buf. If you really > need a resizable block of memory, you should use a MemHandle which you keep > unlocked. > > -- Ben Combee, Senior Software Engineer, palmOne, Inc. > "Combee on Palm OS" weblog: http://palmos.combee.net/ > Developer Forum Archives: http://news.palmos.com/read/all_forums/ > > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
