diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-04-27 18:43:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-28 08:24:45 +0200 |
commit | 601db233f5cc7ee8bcd948681345fa37d5bb1d84 (patch) | |
tree | f12eba7ef49af81c4b570e9f1bb9fb8784b855f7 /framework/source | |
parent | a33922e38b87db5b009986324c6543e90f18a752 (diff) |
remove dodgy code in OReadToolBoxDocumentHandler
comparing hashcodes without doing an actual comparison
is not safe.
Code was like this since
commit 6845330a228f7b516425e2dcb0aa5f2cdfaedc85
Author: Carsten Driesner <cd@openoffice.org>
Date: Wed Oct 17 09:57:37 2001 +0000
#87255# support toolbar item style and help id
Change-Id: Ie49647da257e6199d9502c916da2dd3d39d52377
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151136
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source')
-rw-r--r-- | framework/source/fwe/xml/toolboxdocumenthandler.cxx | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index 595845279d4c..67d67ed308a9 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -149,16 +149,6 @@ OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XInde } } - // pre-calculate a hash code for all style strings to speed up xml read process - m_nHashCode_Style_Radio = OUString( ATTRIBUTE_ITEMSTYLE_RADIO ).hashCode(); - m_nHashCode_Style_Left = OUString( ATTRIBUTE_ITEMSTYLE_LEFT ).hashCode(); - m_nHashCode_Style_AutoSize = OUString( ATTRIBUTE_ITEMSTYLE_AUTOSIZE ).hashCode(); - m_nHashCode_Style_DropDown = OUString( ATTRIBUTE_ITEMSTYLE_DROPDOWN ).hashCode(); - m_nHashCode_Style_Repeat = OUString( ATTRIBUTE_ITEMSTYLE_REPEAT ).hashCode(); - m_nHashCode_Style_DropDownOnly = OUString( ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY ).hashCode(); - m_nHashCode_Style_Text = OUString( ATTRIBUTE_ITEMSTYLE_TEXT ).hashCode(); - m_nHashCode_Style_Image = OUString( ATTRIBUTE_ITEMSTYLE_IMAGE ).hashCode(); - m_bToolBarStartFound = false; m_bToolBarItemStartFound = false; m_bToolBarSpaceStartFound = false; @@ -310,22 +300,21 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( OUString aToken = aTemp.getToken( 0, ' ', nIndex ); if ( !aToken.isEmpty() ) { - sal_Int32 nHashCode = aToken.hashCode(); - if ( nHashCode == m_nHashCode_Style_Radio ) + if ( aToken == ATTRIBUTE_ITEMSTYLE_RADIO ) nItemBits |= css::ui::ItemStyle::RADIO_CHECK; - else if ( nHashCode == m_nHashCode_Style_Left ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_LEFT ) nItemBits |= css::ui::ItemStyle::ALIGN_LEFT; - else if ( nHashCode == m_nHashCode_Style_AutoSize ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_AUTOSIZE ) nItemBits |= css::ui::ItemStyle::AUTO_SIZE; - else if ( nHashCode == m_nHashCode_Style_Repeat ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_REPEAT ) nItemBits |= css::ui::ItemStyle::REPEAT; - else if ( nHashCode == m_nHashCode_Style_DropDownOnly ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY ) nItemBits |= css::ui::ItemStyle::DROPDOWN_ONLY; - else if ( nHashCode == m_nHashCode_Style_DropDown ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_DROPDOWN ) nItemBits |= css::ui::ItemStyle::DROP_DOWN; - else if ( nHashCode == m_nHashCode_Style_Text ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_TEXT ) nItemBits |= css::ui::ItemStyle::TEXT; - else if ( nHashCode == m_nHashCode_Style_Image ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_IMAGE ) nItemBits |= css::ui::ItemStyle::ICON; } } |