diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-10 11:15:02 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-10 16:36:09 +0200 |
commit | 8b6d167608d74986e97d462fde8efcae4c28b564 (patch) | |
tree | 4d9f6aaa6566f9ae14df90718739e710a586012a /framework | |
parent | eb372cde829a667acb509ab9d55887ed934f7639 (diff) |
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/uielement/spinfieldtoolbarcontroller.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
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; } |