Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


On Sun, 2010-11-21 at 16:44 +0100, Julien Nabet wrote:
Hello,

Here's a patch for libs-core/sfx2

Watch out here, see...

sKey  = ::rtl::OUString::createFromAscii(JOBCFG_ROOT);

JOBCFG_ROOT is actually...

static const sal_Char* JOBCFG_ROOT = "foo"

so JOBCFG_ROOT is a pointer, not a string literal, or an array.
which means that

::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(JOBCFG_ROOT));

would expand to something like

::rtl::OUString(JOBCFG, 8, US_ASCII);

(of 4 on a 32bit system, i.e. sizeof(JOBCFG) operates on a pointer) and
not the expected

::rtl::OUString("foo", 3, US_ASCII);

In contrast, in sfx2

static ::rtl::OUString
content(::rtl::OUString::createFromAscii(s_content));

s_content here is an array, not a pointer.

const char s_content [] = "content.xml";

so this one can be converted to 

static ::rtl::OUString content(RTL_CONSTASCII_USTRINGPARAM(s_content));

I have some magic on a feature branch to catch this sort of error if it
happens, but it needs c++0x to be completely correct to roll-out, I
should work on that as something of a priority.

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.