diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-12-22 21:42:49 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-12-23 15:42:46 +0100 |
commit | f7de7de1189ae4e63f73468076da47b37fe61ede (patch) | |
tree | 45838b81429257c3777a1352dca9d36a8849e213 /basic/source/sbx | |
parent | 49891758278fff055e9ef631078bf08cbf8ba7d6 (diff) |
Initialize method mapping table at compile time
This removes the need to calculate hashes for the table at runtime.
Also this introduces a static assertion to make sure that the table
has correct structure, and fixes some methods that had wrong argument
counts:
CreateUnoListener: 1 -> 2
MIRR: 2 -> 3
SLN: 2 -> 3
SYD: 2 -> 4
Changes in basic/source/classes/sb.cxx are related to the change of
SbxVariable::MakeHashCode into constexpr function taking string view.
Change-Id: I2fec4994e976f36c4b647c30b51a9e879a815775
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108220
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic/source/sbx')
-rw-r--r-- | basic/source/sbx/sbxvar.cxx | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 8e5b80ef1e08..34ab5bc24a4b 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -305,29 +305,6 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const return aToolString; } -// Create a simple hashcode: the first six characters are evaluated. - -sal_uInt16 SbxVariable::MakeHashCode( const OUString& rName ) -{ - sal_uInt16 n = 0; - sal_Int32 nLen = rName.getLength(); - if( nLen > 6 ) - { - nLen = 6; - } - for( sal_Int32 i=0; i<nLen; ++i ) - { - sal_uInt8 c = static_cast<sal_uInt8>(rName[i]); - // If we have a comment sign break!! - if( c >= 0x80 ) - { - return 0; - } - n = sal::static_int_cast< sal_uInt16 >( ( n << 3 ) + rtl::toAsciiUpperCase( c ) ); - } - return n; -} - // Operators SbxVariable& SbxVariable::operator=( const SbxVariable& r ) |