diff options
-rw-r--r-- | include/vcl/i18nhelp.hxx | 4 | ||||
-rw-r--r-- | vcl/source/app/i18nhelp.cxx | 17 |
2 files changed, 8 insertions, 13 deletions
diff --git a/include/vcl/i18nhelp.hxx b/include/vcl/i18nhelp.hxx index 5be46d598a7e..f48d562c40a9 100644 --- a/include/vcl/i18nhelp.hxx +++ b/include/vcl/i18nhelp.hxx @@ -22,7 +22,7 @@ #include <com/sun/star/uno/Reference.h> #include <i18nlangtag/languagetag.hxx> -#include <osl/mutex.hxx> +#include <mutex> #include <rtl/ustring.hxx> #include <tools/long.hxx> #include <vcl/dllapi.h> @@ -41,7 +41,7 @@ namespace vcl class VCL_DLLPUBLIC I18nHelper { - ::osl::Mutex maMutex; + mutable std::mutex maMutex; LanguageTag maLanguageTag; css::uno::Reference< css::uno::XComponentContext > m_xContext; diff --git a/vcl/source/app/i18nhelp.cxx b/vcl/source/app/i18nhelp.cxx index 8bf77ac25116..1cff03689ec5 100644 --- a/vcl/source/app/i18nhelp.cxx +++ b/vcl/source/app/i18nhelp.cxx @@ -106,7 +106,7 @@ OUString vcl::I18nHelper::filterFormattingChars( const OUString& rStr ) sal_Int32 vcl::I18nHelper::CompareString( const OUString& rStr1, const OUString& rStr2 ) const { - ::osl::Guard< ::osl::Mutex > aGuard( const_cast<vcl::I18nHelper*>(this)->maMutex ); + std::unique_lock aGuard( maMutex ); if ( mbTransliterateIgnoreCase ) { @@ -123,7 +123,7 @@ sal_Int32 vcl::I18nHelper::CompareString( const OUString& rStr1, const OUString& bool vcl::I18nHelper::MatchString( const OUString& rStr1, const OUString& rStr2 ) const { - ::osl::Guard< ::osl::Mutex > aGuard( const_cast<vcl::I18nHelper*>(this)->maMutex ); + std::unique_lock aGuard( maMutex ); if ( !mbTransliterateIgnoreCase ) { @@ -140,16 +140,11 @@ bool vcl::I18nHelper::MatchString( const OUString& rStr1, const OUString& rStr2 bool vcl::I18nHelper::MatchMnemonic( const OUString& rString, sal_Unicode cMnemonicChar ) const { - ::osl::Guard< ::osl::Mutex > aGuard( const_cast<vcl::I18nHelper*>(this)->maMutex ); - - bool bEqual = false; sal_Int32 n = rString.indexOf( '~' ); - if ( n != -1 ) - { - OUString aMatchStr = rString.copy( n+1 ); // not only one char, because of transliteration... - bEqual = MatchString( OUString(cMnemonicChar), aMatchStr ); - } - return bEqual; + if ( n == -1 ) + return false; + OUString aMatchStr = rString.copy( n+1 ); // not only one char, because of transliteration... + return MatchString( OUString(cMnemonicChar), aMatchStr ); } OUString vcl::I18nHelper::GetNum( tools::Long nNumber, sal_uInt16 nDecimals, bool bUseThousandSep, bool bTrailingZeros ) const |