On 28/05/2010 2:17 PM, Ralph Versteegen wrote:
On 29 May 2010 06:02, James Paige<[email protected]>  wrote:
How do zstrings work?

Back in the days of the one C/C++ class I took, I remember learning that
zstrings were a zero-terminated string buffer.

They were no good for storing arbitrary binary data, because the first 0
would terminate the string, causing any data from the 0 to the end of
the buffer to be ignored.

Am I correct to assume that the zstring ptr's used in Reload are not
like that?

I would hate to be losing saved tag data beccause 8 or more
low-numbered tags in a row happened to all be off.

Please put my probably-unfounded fears to rest :)

---
James

Right. They are actually just byte ptrs. I don't understand why Mike
used zstring instead of byte ptr, since there's a separate GetString
if you want a string instead of a binary lump.

Mike wrote in r3540:

  - Also, nodes now keep track of the size of their internal ZStrings,
in case they have embedded nulls.

I used ZString ptr so that I would only need one pointer to do all of the following:

- Cast to String if requested
- Store arbitrary binary daya
- Cache strings if needed (although, this doesn't happen currently with data)
- etc.

--
Mike
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to