[Libreoffice] rtl_uString/rtl::OUString and osl_getCommandArg

Caolán McNamara caolanm at redhat.com
Tue Oct 26 03:50:20 PDT 2010


FWIW

rtl_uString * pFoo;
osl_getCommandArg(0, &pFoo);

is a bit unsafe, this should at least be...

rtl_uString * pFoo = 0;
osl_getCommandArg(0, &pFoo);

But note that you have to call rtl_uString_release on that pFoo at some
stage or its a memleak.

Far easier altogether when in c++ code is to use a rtl::OUString (which
just wraps a rtl_uString) like so...

rtl::OUString aFoo;
osl_getCommandArg(0, &aFoo.pData);

C.



More information about the LibreOffice mailing list