summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-04-19 08:52:46 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-04-20 11:52:24 +0200
commitfaac1cda391865c304d853a553aad3dabd05e263 (patch)
tree1ab02305514a89ca826f838fd2409a0bac6b7bbd /svl
parent7ba388ee8c7eb8db66b45c541e1e8421756e8b52 (diff)
cid#1596242 Side effect in assertion
Change-Id: Id9ffa49ae61824ee155cd4b5373d882381b40db0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166288 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zforlist.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index be23893d2571..9ae40a7f7f94 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -52,7 +52,7 @@
#include <rtl/strbuf.hxx>
#include <rtl/math.hxx>
-#include <math.h>
+#include <atomic>
#include <limits>
#include <memory>
#include <set>
@@ -242,7 +242,7 @@ void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBro
}
}
-static volatile bool bCurrencyTableInitialized = false;
+static std::atomic<bool> g_CurrencyTableInitialized;
SvNumberFormatterRegistry_Impl* SvNumberFormatter::pFormatterRegistry = nullptr;
namespace
@@ -3989,7 +3989,7 @@ void SvNumberFormatter::PrepForRoMode()
SvNFEngine::Accessor SvNFEngine::GetROPolicy(const SvNFFormatData& rFormatData, SvNFFormatData::DefaultFormatKeysMap& rFormatCache)
{
assert(rFormatData.nDefaultSystemCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND && "ensure PrepForRoMode is called");
- assert(bCurrencyTableInitialized && "ensure PrepForRoMode is called");
+ assert(g_CurrencyTableInitialized && "ensure PrepForRoMode is called");
return
{
std::bind(SvNFEngine::GetCLOffsetRO, std::ref(rFormatData), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3),
@@ -4112,7 +4112,7 @@ void SvNumberFormatter::resetTheCurrencyTable()
SAL_INFO("svl", "Resetting the currency table.");
nSystemCurrencyPosition = 0;
- bCurrencyTableInitialized = false;
+ g_CurrencyTableInitialized = false;
GetFormatterRegistry().ConfigurationChanged(nullptr, ConfigurationHints::Locale | ConfigurationHints::Currency | ConfigurationHints::DatePatterns);
}
@@ -4120,7 +4120,7 @@ void SvNumberFormatter::resetTheCurrencyTable()
// static
const NfCurrencyTable& SvNumberFormatter::GetTheCurrencyTable()
{
- while ( !bCurrencyTableInitialized )
+ while (!g_CurrencyTableInitialized)
ImpInitCurrencyTable();
return theCurrencyTable();
}
@@ -4638,10 +4638,10 @@ void SvNumberFormatter::ImpInitCurrencyTable()
{
// Race condition possible:
// ::osl::MutexGuard aGuard( GetMutex() );
- // while ( !bCurrencyTableInitialized )
+ // while (!g_CurrencyTableInitialized)
// ImpInitCurrencyTable();
static bool bInitializing = false;
- if ( bCurrencyTableInitialized || bInitializing )
+ if (g_CurrencyTableInitialized || bInitializing)
{
return ;
}
@@ -4792,7 +4792,7 @@ void SvNumberFormatter::ImpInitCurrencyTable()
pLocaleData.reset();
SvtSysLocaleOptions::SetCurrencyChangeLink( LINK( nullptr, SvNumberFormatter, CurrencyChangeLink ) );
bInitializing = false;
- bCurrencyTableInitialized = true;
+ g_CurrencyTableInitialized = true;
}
static std::ptrdiff_t addToCurrencyFormatsList( NfWSStringsDtor& rStrArr, const OUString& rFormat )