Re: [Libreoffice] [PUSHED] Re: [PATCH] Easy Hacks : Use RTL_CONSTASCII_USTRINGPARAM macro 4
Selon Caolán McNamara caol...@redhat.com: Mostly good, though createFromAscii_7.patch has... OUString::createFromAscii( GetWindowState( WINDOWSTATE_MASK_POS ).GetBuffer() ) ); that one can't be changed to use RTL_CONSTASCII_USTRINGPARAM because GetWindowState is a method rather than a string literal, so that one is best left alone. Dropped that part, but otherwise pushed. C. oops !!! Regards. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [PUSHED] Re: [PATCH] Easy Hacks : Use RTL_CONSTASCII_USTRINGPARAM macro bis
On Sat, 2010-10-30 at 22:08 +0100, Caolán McNamara wrote: old: OUString sFoo(OUString::createFromAscii(bBool ? true : false)); new: OUString sFoo(RTL_CONSTASCII_USTRINGPARAM(bBool ? true : false)); would be expanded as... OUString sFoo(bBool ? true : false, ((sal_Int32)(sizeof(bBool ? true : false)-1)); I think this is fine, but I'm a little bit wary of making that change Resolved this to my satisfaction, fixed now, thanks :-) C. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [PUSHED] Re: [PATCH] Easy Hacks : Use RTL_CONSTASCII_USTRINGPARAM macro
Selon Caolán McNamara caol...@redhat.com: You have two typos in there however, i.e. - com.sun.star.chart.BarDiagram + com.sun.star.chart.BarDiagra - com.sun.star.chart2.ScatterChartType + com.sun.star.chart2.ScatterChartTyp in those two cases the trailing letter of the original string got removed !, eek that was close ;-). So I fixed up those two and committed and pushed this change. Thanks. C. Ah yes, sorry. Can see it with compilation... I've got 2388 files with 'createFromAscii'. That's a lot. The wiki says that this macro is 'faster'. Does it mean at running time ? Regards. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [PUSHED] Re: [PATCH] Easy Hacks : Use RTL_CONSTASCII_USTRINGPARAM macro
On Sat, 2010-10-30 at 18:16 +0200, Gert Faller wrote: I've got 2388 files with 'createFromAscii'. That's a lot. The wiki says that this macro is 'faster'. Does it mean at running time ? Yes, ever so slightly, sal/inc/rtl/ustring.hxx has OUString::createFromAscii in it, and that calls rtl_uString_newFromAscii which is in sal/rtl/source/ustring.c and in there you can see that it has to compute the length of the string, then allocate, and then copy into it. While using RTL_CONSTASCII_USTRINGPARAM you get the OUString( const sal_Char * value, sal_Int32 length, rtl_TextEncoding encoding, sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS ) constructor which calls rtl_string2UString in sal/rtl/source/ustring.c and that one only has to allocate and copy the string, skipping the length of string calculation because that can be calculated in advance at compile time. Now, this only works when you can compute the length of the string at compile time, i.e. its a string literal, so OUString::createFromAscii(foo) can be trivially replaced, while OUString::createFromAscii(pSomething) should be left alone. C. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [PUSHED] Re: [PATCH] Easy Hacks : Use RTL_CONSTASCII_USTRINGPARAM macro
OK, thanks. Now, this only works when you can compute the length of the string at compile time, i.e. its a string literal, so OUString::createFromAscii(foo) can be trivially replaced, while OUString::createFromAscii(pSomething) should be left alone. C. Yes, of course, I was just outlining that files must be checked. And for example in 'writer/sw/source/ui/vba/vbalisthelper.cxx':85, you get msStyleName = rtl::OUString::createFromAscii( WORD_BULLET_GALLERY ); and at line 43 : static const char WORD_BULLET_GALLERY[] = WdBullet; That's ok too ? Regards. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [PUSHED] Re: [PATCH] Easy Hacks : Use RTL_CONSTASCII_USTRINGPARAM macro
On Sat, Oct 30, 2010 at 10:35 PM, Gert Faller gertfal...@aliceadsl.fr wrote: OK, thanks. Now, this only works when you can compute the length of the string at compile time, i.e. its a string literal, so OUString::createFromAscii(foo) can be trivially replaced, while OUString::createFromAscii(pSomething) should be left alone. C. Yes, of course, I was just outlining that files must be checked. And for example in 'writer/sw/source/ui/vba/vbalisthelper.cxx':85, you get msStyleName = rtl::OUString::createFromAscii( WORD_BULLET_GALLERY ); and at line 43 : static const char WORD_BULLET_GALLERY[] = WdBullet; That's ok too ? Yes, that can be calculated at compile time too :) -- Jesús Corrius je...@softcatala.org Document Foundation founding member Skype: jcorrius | Twitter: @jcorrius ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice