[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Buffer size?



Hi David,

HTTPAPI does not null-terminate the strings.  It makes absolutely no 
sense to use %STR() to read them.

The worst part of this is that you could end up with a working 
application some of the time, because the spot in memory that just 
happens to be adjacent to your string just might (by luck) contain a 
null. So you could end up with code that works in test, and fails in 
production, etc.  Yuck.

Why did you decide to use %STR?  Seems a little random to me.

As for the question (limit of 1024) there is no such limit.  You are 
probably using the green screen debugger to view your variable, which 
will only display the first 1024 characters by default.

Since you're assigning the output to a 32k variable, I find myself 
wondering why on earth you're asking HTTPAPI to return a pointer?? 
ReturnPtr() support was added to HTTPAPI because RPG at the time only 
supported 64k in a single string, so we needed a way to handle XML 
elements longer than that.  But, in your case, your own code is limiting 
it to 32k (half of RPG's limit) so why make things more complicated by 
using ReturnPtr()?

-SK


On 2/1/2012 2:59 PM, David Baugh wrote:
>
>        if path = 'xxxxxxxxxxxx'
>
>             if (name = 'xxxxxxx');
>
>
>             val = %str(value.buf);
>
>
>     etc, etc.
>
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------