[Libreoffice-commits] core.git: include/svl svl/source
Eike Rathke
erack at redhat.com
Fri Aug 25 12:26:48 UTC 2017
include/svl/zforlist.hxx | 14 +++++++++++++-
svl/source/numbers/zforlist.cxx | 7 +++++++
2 files changed, 20 insertions(+), 1 deletion(-)
New commits:
commit 001e0e530f42b3838fa882ab77a3bb2b24f69ef7
Author: Eike Rathke <erack at redhat.com>
Date: Fri Aug 25 14:18:13 2017 +0200
Add check and comment for i18npool locale data using reserved formatIndex
Change-Id: I9401e353241973129bff764d6d7b7f94d7c9b7b0
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index 7929cc18cd7d..35a1bc5c50c1 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -182,7 +182,19 @@ enum NfIndexTableOffset
NF_DATETIME_ISO_YYYYMMDD_HHMMSS, // 1997-10-08 01:23:45 ISO (with blank instead of T)
- NF_INDEX_TABLE_ENTRIES // == 59, reserved up to 59 to not use in i18npool locale data.
+ // XXX When adding values here, follow the comment above about
+ // svx/source/items/numfmtsh.cxx
+
+ NF_INDEX_TABLE_ENTRIES // == 58, reserved up to #59 to not be used in i18npool locale data.
+
+ // XXX Adding values above may increment the reserved area that can't be
+ // used by i18npool's locale data FormatCode definitions, see the
+ // description at i18npool/source/localedata/data/locale.dtd for ELEMENT
+ // FormatCode what the current convention's value is. In that case, the
+ // used formatIndex values in i18npool/source/localedata/data/*.xml will
+ // have to be adjusted.
+ // Overlapping the area will bail out with a check in
+ // SvNumberFormatter::ImpInsertFormat() in debug builds.
};
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index bd6346a3ee39..8099fe888c33 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1823,6 +1823,13 @@ SvNumberformat* SvNumberFormatter::ImpInsertFormat( const css::i18n::NumberForma
sal_uInt32 nPos, bool bAfterChangingSystemCL,
sal_Int16 nOrgIndex )
{
+ SAL_WARN_IF( NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS <= rCode.Index && rCode.Index < NF_INDEX_TABLE_ENTRIES,
+ "svl.numbers", "i18npool locale '" << maLanguageTag.getBcp47() <<
+ "' uses reserved formatIndex value " << rCode.Index << ", next free: " << NF_INDEX_TABLE_ENTRIES <<
+ " Please see description in include/svl/zforlist.hxx at end of enum NfIndexTableOffset");
+ assert( (rCode.Index < NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS || NF_INDEX_TABLE_ENTRIES <= rCode.Index) &&
+ "reserved formatIndex, see warning above");
+
OUString aCodeStr( rCode.Code );
if ( rCode.Index < NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS &&
rCode.Usage == css::i18n::KNumberFormatUsage::CURRENCY &&
More information about the Libreoffice-commits
mailing list