On Tue, 2011-02-15 at 14:50 +0000, Michael Meeks wrote:
std::vector< char > * blob = data.newBlob();
blob->insert(blob->begin(), str.getStr(), str.getStr() + str.getLength() + 1)
As passint a char * start and end iterator to the stl insert. The end
iterator is not used, we terminate the append before we hit it
Yes, ::insert don't dereference the final end iterator, but it does use
the one before that. So lets take a OUString str of "a", its getLength()
is 1, so the final end iterator is now str.getStr()+2. i.e. dereference
+0 for 'a' and +1 for '\0' and stop and not dereference +2, so input str
has to actually be ['a', '\0']. Which is where I was going with my
question to make sure that's the case.
The original problem to be fixed is a lack of a zero terminator in the
*output* blob, its just an issue of copying it from the original string
or adding a new one, just making sure that if we go with copying it from
the original string, that the original string has one ;-)
C.
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.