http://d.puremagic.com/issues/show_bug.cgi?id=9421
--- Comment #6 from Andrej Mitrovic <[email protected]> 2013-02-12 20:30:07 PST --- (In reply to comment #5) > The idea being that getting a pointer to the internal string shouldn't change > the contents. Ok, but then what do we need scopedData for? If we're returning a char* and it's not zero-terminated I don't see how it can be used. So far I've got this: /** Extract a zero-terminated string. The caller takes ownership. */ const char *OutBuffer::extractString() { if (!data || data[offset] != '\0') writeByte(0); char *p; p = (char *)data; data = NULL; offset = 0; size = 0; return p; } /** Verify the internal buffer is zero-terminated and return a reference to it. */ const char *OutBuffer::scopedString() { assert(data && data[offset] == '\0'); return (char *)data; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
