diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-03-28 09:55:06 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-03-29 09:51:12 +0100 |
commit | e8e0a3b1d7e706330ca343cf9dd5ba062e9ff0c4 (patch) | |
tree | 544402e3766feec77b0a717b45a43946da8f9ff2 /include/svl | |
parent | 40176bd39c94c32ac0269d9994e8e50518d84467 (diff) |
crashtesting: fix SvNFEngine::CacheFormatRO assert
since:
commit c6c6126aa3e8de256091b829b98b5943db6a8be6
Author: Caolán McNamara <caolan.mcnamara@collabora.com>
Date: Thu Mar 21 17:25:35 2024 +0000
Related: tdf#160056 refactor SvNumberFormatter
to split it into two constituent parts
Change-Id: I4add9f383789ab03ceab751b07973448a41911ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165490
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'include/svl')
-rw-r--r-- | include/svl/nfengine.hxx | 28 | ||||
-rw-r--r-- | include/svl/numformat.hxx | 2 |
2 files changed, 23 insertions, 7 deletions
diff --git a/include/svl/nfengine.hxx b/include/svl/nfengine.hxx index a4890e074d1a..c0b463c189f3 100644 --- a/include/svl/nfengine.hxx +++ b/include/svl/nfengine.hxx @@ -159,10 +159,12 @@ private: class SVL_DLLPUBLIC SvNFFormatData { +public: + typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap; + private: typedef std::map<sal_uInt32, std::unique_ptr<SvNumberformat>> FormatEntryMap; FormatEntryMap aFTable; // Table of format keys to format entries - typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap; DefaultFormatKeysMap aDefaultFormatKeys; // Table of default standard to format keys sal_uInt32 MaxCLOffset; // Max language/country offset used sal_uInt32 nDefaultSystemCurrencyFormat; // NewCurrency matching SYSTEM locale @@ -190,6 +192,8 @@ public: bool GetNewCurrencySymbolString(sal_uInt32 nFormat, OUString& rSymbol, const NfCurrencyEntry** ppEntry, bool* pBank = nullptr) const; + void MergeDefaultFormatKeys(const DefaultFormatKeysMap& rDefaultFormatKeys); + private: SvNFFormatData(const SvNFFormatData&) = delete; SvNFFormatData& operator=(const SvNFFormatData&) = delete; @@ -262,8 +266,7 @@ private: SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultSystemCurrencyFormat(SvNFLanguageData& rCurrentLanguage, const NativeNumberWrapper* pNatNum); - SVL_DLLPRIVATE std::pair<sal_uInt32, bool> - ImpGetDefaultFormat(SvNumFormatType nType, sal_uInt32 nSearch, sal_uInt32 CLOffset) const; + SVL_DLLPRIVATE sal_uInt32 FindCachedDefaultFormat(sal_uInt32 nSearch) const; SVL_DLLPRIVATE static sal_Int32 ImpGetFormatCodeIndex(const SvNFLanguageData& rCurrentLanguage, @@ -282,6 +285,7 @@ public: const NativeNumberWrapper* pNatNum, LanguageType eLnge)> GetCLOffset; typedef std::function<void(sal_uInt32 nSearch, sal_uInt32 nFormat)> CacheFormat; + typedef std::function<sal_uInt32(sal_uInt32 nSearch)> FindFormat; typedef std::function<sal_uInt32(SvNFLanguageData& rCurrentLanguage, const NativeNumberWrapper* pNatNum, sal_uInt32 CLOffset, @@ -292,11 +296,13 @@ public: { GetCLOffset mGetCLOffset; CacheFormat mCacheFormat; + FindFormat mFindFormat; GetDefaultCurrency mGetDefaultCurrency; }; static Accessor GetRWPolicy(SvNFFormatData& rFormatData); - static Accessor GetROPolicy(const SvNFFormatData& rFormatData); + static Accessor GetROPolicy(const SvNFFormatData& rFormatData, + SvNFFormatData::DefaultFormatKeysMap& rFormatCache); static void ChangeIntl(SvNFLanguageData& rCurrentLanguage, LanguageType eLnge); static void ChangeNullDate(SvNFLanguageData& rCurrentLanguage, sal_uInt16 nDay, @@ -403,9 +409,12 @@ public: bool IsRed, sal_uInt16 nPrecision, sal_uInt16 nLeadingZeros); private: - static sal_uInt32 ImpGetDefaultFormat(const SvNFFormatData& rFormatData, - const SvNFEngine::CacheFormat& rFunc, + static sal_uInt32 ImpGetDefaultFormat(const SvNFFormatData& rFormatData, const Accessor& rFuncs, SvNumFormatType nType, sal_uInt32 CLOffset); + + static sal_uInt32 ImpGetDefaultFormat(const SvNFFormatData& rFormatData, SvNumFormatType nType, + sal_uInt32 CLOffset); + static sal_uInt32 ImpGetStandardFormat(SvNFLanguageData& rCurrentLanguage, const SvNFFormatData& rFormatData, const NativeNumberWrapper* pNatNum, const SvNFEngine::Accessor& rFuncs, @@ -425,8 +434,13 @@ private: const NativeNumberWrapper*, LanguageType eLnge); static void CacheFormatRW(SvNFFormatData& rFormatData, sal_uInt32 nSearch, sal_uInt32 nFormat); - static void CacheFormatRO(const SvNFFormatData& rFormatData, sal_uInt32 nSearch, + static void CacheFormatRO(SvNFFormatData::DefaultFormatKeysMap& rMap, sal_uInt32 nSearch, sal_uInt32 nFormat); + + static sal_uInt32 FindFormatRW(const SvNFFormatData& rFormatData, sal_uInt32 nSearch); + static sal_uInt32 FindFormatRO(const SvNFFormatData& rFormatData, + const SvNFFormatData::DefaultFormatKeysMap& rMap, + sal_uInt32 nSearch); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svl/numformat.hxx b/include/svl/numformat.hxx index b26e245ca8d5..92f93bb1562a 100644 --- a/include/svl/numformat.hxx +++ b/include/svl/numformat.hxx @@ -507,6 +507,8 @@ public: language/country, used in XML import */ OUString GetStandardName(LanguageType eLnge); + void MergeDefaultFormatKeys(const SvNFFormatData::DefaultFormatKeysMap& rDefaultFormatKeys); + /** Check if a specific locale has supported locale data. */ static bool IsLocaleInstalled(LanguageType eLang); |