While you're at it, while scanning over the code, I think there was a problem
with dealing with a result of "0". The code to calculate the resulting string's
length would end up with 1, instead of 2 (one for the digit, and one for the
NULL).

By the way, I'm having a hard time understanding the requirements for your
function. What's with the decNum struct? What's with the private string->number
converter (GetDecFromString)? Why not just call FlpAToF? And did you know that
you never use the "places" parameter?

-- Keith






"Tim Astle" <[EMAIL PROTECTED]> on 04/27/2000 07:58:19 AM

Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>

Sent by:  "Tim Astle" <[EMAIL PROTECTED]>


To:   "Palm Developer Forum" <[EMAIL PROTECTED]>
cc:    (Keith Rollin/HQ/3Com)
Subject:  Re: String Addition - Problem



Thanks!  I was wondering about that, and it completely skipped my mind.

--

Tim Astle


Lee Fyock <[EMAIL PROTECTED]> wrote in message news:9802@palm-dev-forum...
>
> Tim said:
>
> >Okay, I fixed the problem... it was pretty stupid.  I should have caught
it
> >earlier!  It was staring me right in the face :-)
>
> and later
>
> >     /************ FORGOT TO TERMINATE STRING :-) **********/
> >     strResult[j] = '\0';
> >
> >     // Free memory
> >     MemPtrFree(lstr);
> >     MemPtrFree(strResult);
> >
> >     return(strResult);
>
> The last two lines are just about guaranteed to cause a crash later on.
> If you free the memory that strResult is using, returning strResult (and
> using it later on) will probably cause problems, since the memory it was
> using can be used by something else (and eventually will).
>
> If you're allocating memory in this routine and passing strResult back,
> whoever calls this routine must be responsible for freeing the memory
> when it's done with it.
>
> Good luck!
> Lee
>
>



--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palm.com/devzone/mailinglists.html






-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to