chart2/source/tools/ObjectIdentifier.cxx | 20 +++++---- chart2/source/view/charttypes/VSeriesPlotter.cxx | 2 chart2/source/view/main/VTitle.cxx | 6 +- i18npool/inc/breakiterator_unicode.hxx | 17 ++++++-- i18npool/source/breakiterator/breakiterator_unicode.cxx | 34 ++++++---------- icu/makefile.mk | 3 + sal/inc/rtl/string.hxx | 2 sal/inc/rtl/ustring.hxx | 2 8 files changed, 48 insertions(+), 38 deletions(-)
New commits: commit 022f7f0c256dd9c1ce6b9f099813a79cc28acd6c Author: Caolán McNamara <caol...@redhat.com> Date: Wed May 2 11:20:12 2012 +0100 can use -O2 without -fstrict-aliasing for icu Change-Id: I9841adb2e17e11c32823ac9e438bae824d30599e diff --git a/icu/makefile.mk b/icu/makefile.mk index eb32cc8..ddc6fe0 100644 --- a/icu/makefile.mk +++ b/icu/makefile.mk @@ -87,6 +87,9 @@ CC:=gcc $(EXTRA_CFLAGS) .IF "$(debug)" != "" icu_CFLAGS+=-g $(ARCH_FLAGS) icu_CXXFLAGS+=-g $(ARCH_FLAGS) +.ELIF "$(COM)"=="GCC" +icu_CFLAGS+=-O2 -fnostrict-aliasing $(ARCH_FLAGS) +icu_CXXFLAGS+=-O2 -fno-fstrict-aliasing $(ARCH_FLAGS) .ELSE icu_CFLAGS+=-O $(ARCH_FLAGS) icu_CXXFLAGS+=-O $(ARCH_FLAGS) commit 27d8c527012e2759b1d2b282feff433b26fdc4ce Author: Caolán McNamara <caol...@redhat.com> Date: Wed May 2 10:23:02 2012 +0100 WaE: simple-minded msvc2008 considers code unreachable Change-Id: I97da4392bb3ca814e8d9037346c83fde4d460f97 diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index b386b79..39a0135 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -717,6 +717,7 @@ OUString ObjectIdentifier::getDragParameterString( const OUString& rCID ) bool ObjectIdentifier::isDragableObject( const OUString& rClassifiedIdentifier ) { + bool bReturn = false; ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier ); switch( eObjectType ) { @@ -725,14 +726,14 @@ bool ObjectIdentifier::isDragableObject( const OUString& rClassifiedIdentifier ) case OBJECTTYPE_DIAGRAM: case OBJECTTYPE_DATA_CURVE_EQUATION: //case OBJECTTYPE_DIAGRAM_WALL: - return true; + bReturn = true; + break; default: OUString aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( rClassifiedIdentifier ) ); - if( !aDragMethodServiceName.isEmpty() ) - return true; - return false; + bReturn = !aDragMethodServiceName.isEmpty(); + break; } - return false; + return bReturn; } bool ObjectIdentifier::isDragableObject() @@ -751,16 +752,19 @@ bool ObjectIdentifier::isDragableObject() bool ObjectIdentifier::isRotateableObject( const OUString& rClassifiedIdentifier ) { + bool bReturn = false; ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier ); switch( eObjectType ) { case OBJECTTYPE_DIAGRAM: //case OBJECTTYPE_DIAGRAM_WALL: - return true; + bReturn = true; + break; default: - return false; + bReturn = false; + break; } - return false; + return bReturn; } bool ObjectIdentifier::isMultiClickObject( const OUString& rClassifiedIdentifier ) commit 4cd9b2fbd39cca3553588ae9f61e674f1416a582 Author: Caolán McNamara <caol...@redhat.com> Date: Wed May 2 10:22:19 2012 +0100 WaE: doubles truncated to floats Change-Id: I42b67cc0670f3d0990708fb299243098c1aa972b diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index c693a0b..f1194f0 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -466,7 +466,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re if( xProps.is() ) xProps->getPropertyValue( C2U( "CharHeight" )) >>= fViewFontSize; // pt -> 1/100th mm - fViewFontSize *= (2540.0 / 72.0); + fViewFontSize *= (2540.0f / 72.0f); } Reference< drawing::XShape > xSymbol; if(pLabel->ShowLegendSymbol) diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx index c6d7754..bfbecdf 100644 --- a/chart2/source/view/main/VTitle.cxx +++ b/chart2/source/view/main/VTitle.cxx @@ -248,10 +248,10 @@ void VTitle::createShapes( float fFontHeight = 0.0; if ( xShapeProp.is() && ( xShapeProp->getPropertyValue( C2U( "CharHeight" ) ) >>= fFontHeight ) ) { - fFontHeight *= ( 2540. / 72. ); // pt -> 1/100 mm - float fXFraction = 0.18; + fFontHeight *= ( 2540.0f / 72.0f ); // pt -> 1/100 mm + float fXFraction = 0.18f; sal_Int32 nXDistance = static_cast< sal_Int32 >( ::rtl::math::round( fFontHeight * fXFraction ) ); - float fYFraction = 0.30; + float fYFraction = 0.30f; sal_Int32 nYDistance = static_cast< sal_Int32 >( ::rtl::math::round( fFontHeight * fYFraction ) ); xShapeProp->setPropertyValue( C2U( "TextLeftDistance" ), uno::makeAny( nXDistance ) ); xShapeProp->setPropertyValue( C2U( "TextRightDistance" ), uno::makeAny( nXDistance ) ); commit 2b168feccee9c367152e106386101be903e4f1db Author: Caolán McNamara <caol...@redhat.com> Date: Wed May 2 10:20:26 2012 +0100 Related: fdo#49208 implement operator== with faster equals we have an optimized equals which checks that the strings being compared for equality share the same underlying pImpl, but out operator== implementations don't use it! Change-Id: Ie5c464494ff875315a5ca369a2da80c22c29f431 diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx index 1701b28..0d90b53 100644 --- a/sal/inc/rtl/string.hxx +++ b/sal/inc/rtl/string.hxx @@ -712,7 +712,7 @@ public: } friend sal_Bool operator == ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(()) - { return rStr1.getLength() == rStr2.getLength() && rStr1.compareTo( rStr2 ) == 0; } + { return rStr1.equals(rStr2); } friend sal_Bool operator != ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(()) { return !(operator == ( rStr1, rStr2 )); } friend sal_Bool operator < ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(()) diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx index 883fb93..f3d224e 100644 --- a/sal/inc/rtl/ustring.hxx +++ b/sal/inc/rtl/ustring.hxx @@ -988,7 +988,7 @@ public: } friend sal_Bool operator == ( const OUString& rStr1, const OUString& rStr2 ) SAL_THROW(()) - { return rStr1.getLength() == rStr2.getLength() && rStr1.compareTo( rStr2 ) == 0; } + { return rStr1.equals(rStr2); } friend sal_Bool operator == ( const OUString& rStr1, const sal_Unicode * pStr2 ) SAL_THROW(()) { return rStr1.compareTo( pStr2 ) == 0; } friend sal_Bool operator == ( const sal_Unicode * pStr1, const OUString& rStr2 ) SAL_THROW(()) commit 6f0503c82c0a019678458ded9e339a71f96d837d Author: Caolán McNamara <caol...@redhat.com> Date: Wed May 2 09:18:26 2012 +0100 Related: fdo#49208 use UText adaptor to underlying rtl::OUString Don't convert to icu UnicodeString, retain text as shallow-copy of original via rtl::OUString and use UText adaptor. Allows use of equals to do super fast compare that new string is the same as the old string Change-Id: Ie9a3dc981b22a6866f3712c786331a1d6fcf153a diff --git a/i18npool/inc/breakiterator_unicode.hxx b/i18npool/inc/breakiterator_unicode.hxx index 57e0aad..a9273f1 100644 --- a/i18npool/inc/breakiterator_unicode.hxx +++ b/i18npool/inc/breakiterator_unicode.hxx @@ -84,11 +84,22 @@ protected: const sal_Char *cBreakIterator, *wordRule, *lineRule; Boundary result; // for word break iterator - struct BI_Data { - UnicodeString aICUText; + struct BI_Data + { + rtl::OUString aICUText; + UText *ut; icu::BreakIterator *aBreakIterator; - BI_Data() : aICUText(), aBreakIterator(NULL) {} + BI_Data() + : ut(NULL) + , aBreakIterator(NULL) + { + } + ~BI_Data() + { + utext_close(ut); + } + } character, word, sentence, line, *icuBI; com::sun::star::lang::Locale aLocale; diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 4005780..34e6918 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -95,24 +95,6 @@ class OOoRuleBasedBreakIterator : public RuleBasedBreakIterator { }; -namespace -{ - bool isEqual(const UnicodeString &rOne, const rtl::OUString &rOther) - { - sal_Int32 nLength = rOne.length(); - if (nLength != rOther.getLength()) - return false; - - //fdo#49208 operator== is implemented by compareTo etc in icu which is - //horrifically slow when all you want to know is that they're the same - //or not - const UChar *pOne = rOne.getBuffer(); - // UChar != sal_Unicode in MinGW - const UChar *pOther = reinterpret_cast<const UChar *>(rOther.getStr()); - return memcmp(pOne, pOther, nLength * sizeof(UChar)) == 0; - } -} - // loading ICU breakiterator on demand. void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const com::sun::star::lang::Locale& rLocale, sal_Int16 rBreakType, sal_Int16 rWordType, const sal_Char *rule, const OUString& rText) throw(uno::RuntimeException) @@ -218,12 +200,22 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const com::sun::star:: } } - if (newBreak || !isEqual(icuBI->aICUText, rText)) + if (newBreak || !icuBI->aICUText.equals(rText)) { // UChar != sal_Unicode in MinGW const UChar *pText = reinterpret_cast<const UChar *>(rText.getStr()); - icuBI->aICUText=UnicodeString(pText, rText.getLength()); - icuBI->aBreakIterator->setText(icuBI->aICUText); + + icuBI->ut = utext_openUChars(icuBI->ut, pText, rText.getLength(), &status); + + if (!U_SUCCESS(status)) + throw ERROR; + + icuBI->aBreakIterator->setText(icuBI->ut, status); + + if (!U_SUCCESS(status)) + throw ERROR; + + icuBI->aICUText = rText; } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits