From 8b6d167608d74986e97d462fde8efcae4c28b564 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 10 Apr 2023 11:15:02 +0200 Subject: Use of O(U)StringNumber for float/double is actually a pessimisation They use rtl_(u)str_valueOf(Float|Double), to fill the buffer, and the latter use doubleToString, which creates an rtl_(u)String, copies to the buffer, and releases the rtl_(u)String. So instead just use the rtl_(u)String from rtl_math_doubleTo(U)String directly. Even when the end result is not needed as O(U)String, this would avoid an extra copy step. Also, this avoids separate LIBO_INTERNAL_ONLY implementations. Change-Id: Ib1d9ecebd7876dfff7dc758f89ee4c1536647a50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150150 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- .../source/uielement/spinfieldtoolbarcontroller.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'framework') diff --git a/framework/source/uielement/spinfieldtoolbarcontroller.cxx b/framework/source/uielement/spinfieldtoolbarcontroller.cxx index ce74c9041ef9..9ba295f30932 100644 --- a/framework/source/uielement/spinfieldtoolbarcontroller.cxx +++ b/framework/source/uielement/spinfieldtoolbarcontroller.cxx @@ -256,7 +256,7 @@ void SpinfieldToolbarController::executeControlCommand( const css::frame::Contro double fValue; bool bFloat( false ); if ( impl_getValue( arg.Value, nValue, fValue, bFloat )) - aStep = bFloat ? OUString( OUString::number( fValue )) : + aStep = bFloat ? OUString::number( fValue ) : OUString( OUString::number( nValue )); break; } @@ -274,7 +274,7 @@ void SpinfieldToolbarController::executeControlCommand( const css::frame::Contro if ( impl_getValue( arg.Value, nValue, fValue, bFloat )) { - aValue = bFloat ? OUString( OUString::number( fValue )) : + aValue = bFloat ? OUString::number( fValue ) : OUString( OUString::number( nValue )); bFloatValue = bFloat; } @@ -295,18 +295,18 @@ void SpinfieldToolbarController::executeControlCommand( const css::frame::Contro { if ( aName == "Value" ) { - aValue = bFloat ? OUString( OUString::number( fValue )) : + aValue = bFloat ? OUString::number( fValue ) : OUString( OUString::number( nValue )); bFloatValue = bFloat; } else if ( aName == "Step" ) - aStep = bFloat ? OUString( OUString::number( fValue )) : + aStep = bFloat ? OUString::number( fValue ) : OUString( OUString::number( nValue )); else if ( aName == "LowerLimit" ) - aMin = bFloat ? OUString( OUString::number( fValue )) : + aMin = bFloat ? OUString::number( fValue ) : OUString( OUString::number( nValue )); else if ( aName == "UpperLimit" ) - aMax = bFloat ? OUString( OUString::number( fValue )) : + aMax = bFloat ? OUString::number( fValue ) : OUString( OUString::number( nValue )); } else if ( aName == "OutputFormat" ) @@ -323,7 +323,7 @@ void SpinfieldToolbarController::executeControlCommand( const css::frame::Contro double fValue; bool bFloat( false ); if ( impl_getValue( arg.Value, nValue, fValue, bFloat )) - aMin = bFloat ? OUString( OUString::number( fValue )) : + aMin = bFloat ? OUString::number( fValue ) : OUString( OUString::number( nValue )); break; } @@ -339,7 +339,7 @@ void SpinfieldToolbarController::executeControlCommand( const css::frame::Contro double fValue; bool bFloat( false ); if ( impl_getValue( arg.Value, nValue, fValue, bFloat )) - aMax = bFloat ? OUString( OUString::number( fValue )) : + aMax = bFloat ? OUString::number( fValue ) : OUString( OUString::number( nValue )); break; } -- cgit