Off the top of my head...
1. What are the values passed at *pSize? You don't check the return
value of MemPtrNew(), so it could be failing. And, since it is not
apparent that you ever free the allocated memory, it's possible you
are running out of memory.
2. Where does pData point? I assume you don't actually do a
MemPtrNew() in the real code, because there's no reason for it. When
you do the MemMove(), where are you moving the data to?
3. You claim the http class is reading the socket correctly, but I
don't see the class, so cannot be certain there are no side effects.
Are you sure the http class works as expected?

On 10/25/07, Ryan Dorn <[EMAIL PROTECTED]> wrote:
> I am writing an application for my Treo 700p to
> download a PRC or PDB file from an HTTP web server and
> save it to my device, and am having some trouble
> getting ExgDBRead to work correctly.
>
> Once I've confirmed that the user wishes to download
> the file, I execute:
>
> LocalID db_id;
> ExgDBRead(&exgReadProc, &exgDeleteProc, NULL, &db_id,
> 0, false, true);
>
> My exgReadProc is as follows:
>
> Err exgReadProc(void *pData, UInt32 *pSize, void
> *pUserData) {
>  Char *buf = (Char *)MemPtrNew(*pSize);
>  UInt32 bytes_received = *pSize;
>  http_cl.ReceiveBytes(buf, &bytes_received);
>  MemMove(pData, buf, bytes_received);
>  *pSize = bytes_received;
> }
>
> Now, I realize that I can consolidate alot of those
> lines in the read proc, but I split them up so I could
> try to see where I'm going wrong.
>
> The call to http_cl.ReceiveBytes() is an http class
> that I wrote that will just download the given amount
> of bytes from the socket and return how many bytes it
> successfully received in &br
>
> I've put some Alerts in for debugging purposes to make
> sure that the data is actually getting read from the
> socket, and it is, however, when I test it on the
> Garnet OS Simulator, after the read procedure executes
> about 15 times, it gives me a fatal alert:
>
> Run68K.c, line 2245, Invalid read from F9F7A164
>
> When I try this on my actual palm treo 700p, it
> reboots the device at the same point.  I've tried it
> with two different .prc applications that I've
> confirmed to be OK, because I can download them
> through Blazer directly to my card and all is well.
>
> Is there something I'm missing somewhere?  I'm pulling
> my hair out over this.  Any help or advice is much appreciated.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> --
> For information on using the ACCESS Developer Forums, or to unsubscribe, 
> please see http://www.access-company.com/developers/forums/
>


-- 
[Jeff Loucks, Gig Harbor, WA, USA]

-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to