The mystery is solved. It turns out the problem was not on the Palm 
side. On the server side, I have a servlet that encrypts the pdb 
before sending it, and it was getting corrupted because of a byte[] 
-> String conversion (doh!).

Thanks for the help, Danny, and sorry to waste your time.

-- Michael

>  > I'm curious, how does DmCDFI know where the end of the db is?
>>  I transfer the pdb to memory I allocated using MemPtrNew(),
>>  so does it assume the pdb is of length MemPtrSize()?
>
>Good question. As you guessed, DmCDFI uses the size of the chunk. The
>pointer you pass to it must be the start of a chunk. If this chunk was too
>big, it'd try to allocate a larger than desired final record. If the pointer
>you pass isn't the beginning of a chunk, I'm not sure what would happen. A
>debug ROM would probably complain about the chunk header being invalid
>(because it's looking the wrong place for it).
>
>Lemme look at your code again...
>
>It looks like you're starting at the beginning of a chunk, but I should have
>noticed this in your original post:
>>  dbSize = weber->getContentLength();         // slightly larger than db
>
>Try doing a MemPtrResize to the exact size, once you know what it is. (It
>looks like you track it using totalBytes.) If it really is only slightly
>larger, then this shouldn't cause the error you're seeing. It should just
>cause the last record to be larger than desired.
>
>Some other minor issues...
>
>>  dbMemP = MemPtrNew(dbSize);
>
>Check that this doesn't return NULL.
>
>>  while (totalBytes < dbSize) {
>>     int reqBytes = min(1024, dbSize - totalBytes);
>
>Check that aren't running out of room prematurely. This condition should
>never cause the loop to exit. If it does, the pdb will be truncated and
>attempts to create a database from it could fail or produce a corrupt
>database.
>
>If you want to use ExgDBRead, you should be able to do it without buffering
>the received data. Just have your readProc callback function call
>weber->getDecryptedChunk().
>-
>Danny
>
>--
>For information on using the Palm Developer Forums, or to 
>unsubscribe, please see http://www.palmos.com/dev/support/forums/


-- 

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to