On Mon, 2008-11-10 at 09:57 -0500, Robert Joly wrote:

>                 [<<BOB JOLY>>]  This makes sense but in reading the
>                 example, I wonder about null-termination
>                 considerations, if any  When we set the content of the
>                 data buffer 'manually', must we supply a NULL
>                 termination?  Should the capacity() value we
>                 specify account for the NULL termination?  When I set
>                 the length, does that exclude the NULL termination?

The string contents of a UtlString are always supposed to have a NUL
after them.  This lets you use the result of UtlString::data() for input
to C library functions.  If one directly writes a string into the
string's buffer, who is responsible for supplying the ending NUL?

>From the code, it looks like mCapacity is intended to include the NUL at
the end of the string.  That is, the maximum length is 1 less than
mCapacity.  (The documentation does not make this clear at all.)

Dale


_______________________________________________
sipx-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev
Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev

Reply via email to