[Libreoffice] [PUSHED] Re: [PATCH] RTL_CONSTASCII_USTRINGPARAM for libs-core/connectivity/drivers

Takeshi Abe tabe at fixedpoint.jp
Sat Nov 20 09:36:10 PST 2010


Hi Caolán,

On Sat, 20 Nov 2010 16:38:45 +0000, Caolán McNamara <caolanm at redhat.com> wrote:
> -        (::rtl::OUString::createFromAscii( i18n("Address Book") ));
> +        (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( i18n("Address
> Book")) ));
> 
> Hmm, what's "i18n" in this context, I can't seem to see a define or
> function called i18n. Is that a KDE/QT thing, if its e.g. a function
> that returns a char * then it might not be a safe change, while if its a
> define, then depending on what it does it might be ok.
It comes from KDE. For current,
http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/klocalizedstring_8h.html
and for 3.5,
http://api.kde.org/3.5-api/kdelibs-apidocs/kdecore/html/klocale_8h_source.html
Both versions of "i18n" return a QString.

Cheers,
-- Takeshi Abe

> 
> 
> -m_sMozillaURI =
> rtl::OUString::createFromAscii( getSchemeURI( SCHEME_MOZILLA ) );
> +m_sMozillaURI =
> rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( getSchemeURI( SCHEME_MOZILLA )) );
> 
> is definitely not safe here. The RTL_CONSTASCII_USTRINGPARAM does a
> sizeof on its arg, so it should only be passed a string literal or
> array, not a char*.
> 
> Otherwise, it looks good, so pushed.


More information about the LibreOffice mailing list