So NativeBoost allocate: 4096 will have to be followed with a null terminated byte.. for guarantee..

I will need to check if we can do ZeroMemory rather than just a plain allocation as the above seems to be..



On Thu, Feb 7, 2013 at 7:00 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 7 February 2013 14:15, S Krish <krishnamachari.sudhakar@gmail.com> wrote:
>
>
> Find that the NBExternalAddress >> readString returns extra bytes...
>
> did a simple cmd pipe interface .. and the readPipe with a buffer passed
> ends up with 4 bytes extra in specific boundary of passed buffer size.
>
> viz: if I pass buf := ( �NativeBoost allocate: 4096) as the buffer and then
> read it as buf readString. The size returned is 4100 instead of 4096. For
> some other lesser reads occassionally it is off by one byte..
>

well, readString copying a null-terminated string from memory to
ByteString instance
and to calculate the string size it searching for first zero byte in
provided buffer..
if you buffer contains no zeroes at all, it will keep looking until it
find it (since it has no idea
of your buffer size).


>
> Will try to post a simple example to replicate this.



--
Best regards,
Igor Stasenko.