summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-07-18 11:46:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-18 21:32:39 +0200
commit48d60a717a588d93e82268dc80018ea9970c4e0e (patch)
tree755b8b1f46348b95a04b0a0fa387675566d0e71d /i18npool
parent4799ee69d7193fcb1e8c105ef6c8b4ddc5e6721b (diff)
osl::Mutex->std::mutex in NativeNumberSupplier
Change-Id: I5430636438723f99b584dd95be9d7cb5264a5af9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119131 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/nativenumber/nativenumbersupplier.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index 8541c9739e84..b337fc50f2c6 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -27,6 +27,7 @@
#include <comphelper/processfactory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <map>
+#include <mutex>
#include <memory>
#include <string_view>
#include <unordered_map>
@@ -70,7 +71,7 @@ namespace i18npool {
namespace {
-struct theNatNumMutex : public rtl::Static<osl::Mutex, theNatNumMutex> {};
+std::mutex theNatNumMutex;
}
@@ -553,7 +554,7 @@ struct Separators
Separators getLocaleSeparators(const Locale& rLocale, const OUString& rLocStr)
{
// Guard the static variable below.
- osl::MutexGuard aGuard(theNatNumMutex::get());
+ std::lock_guard aGuard(theNatNumMutex);
// Maximum a couple hundred of pairs with 4-byte structs - so no need for smart managing
static std::unordered_map<OUString, Separators> aLocaleSeparatorsBuf;
auto it = aLocaleSeparatorsBuf.find(rLocStr);
@@ -598,11 +599,12 @@ OUString getNumberText(const Locale& rLocale, const OUString& rNumberString,
// Handle also month and day names for NatNum12 date formatting
const OUString& rNumberStr = (count == 0) ? rNumberString : sBuf.makeStringAndClear();
- // Guard the static variables below.
- osl::MutexGuard aGuard( theNatNumMutex::get());
-
static auto xNumberText
= css::linguistic2::NumberText::create(comphelper::getProcessComponentContext());
+
+ // Guard the static variables below.
+ std::lock_guard aGuard( theNatNumMutex );
+
OUString numbertext_prefix;
// default "cardinal" gets empty prefix
if (!sNumberTextParams.empty() && sNumberTextParams != u"cardinal")