> I'm having trouble with my first attempt to read off an Application Info
> Block from a database [a short list of strings created by a conduit].
> Everything seems to run fine, but when execution goes into a following
> method, the execution bombs out on an attempt to call MemPtrNew.
>
> I've included a pruned down copy of the code I use in the method. I'm
> unlocking the pointer I got from MemLocalIDToLockedPtr - am I perhaps
meant
> to use some method to release the LocalIDs that get returned, as well?
no, that is all you have to do.
>
> Thanks for any help.
>
>
> void static LoadDbAppInfo(FormPtr frmP, DmOpenRef dbP)
> {
> LocalID dbID, appInfoIDP;
> unsigned short cardNo;
> int catCtr;
> char *p;
>
> dbID = NULL; appInfoIDP = NULL;
>
> if (dbP == NULL) goto FillOutList;
>
> if (DmOpenDatabaseInfo(dbP, &dbID, NULL, NULL, &cardNo, NULL)) goto
> FillOutList;
>
> if (DmDatabaseInfo(0, dbID, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> &appInfoIDP, NULL, NULL, NULL)) goto FillOutList;
> if (!appInfoIDP) goto FillOutList;
>
you only arrive here if all your tests fail.
I am fed up with you topiarists.
> p = (char *) MemLocalIDToLockedPtr(appInfoIDP, cardNo);
>
> FillOutList:
>
> ...Here I process the data block, or do some default handling if there
was
> none ...
>
> // Release the resources
> if (p) MemPtrUnlock(catListP);
you just want to unlock p
> }
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/