diff options
author | Eike Rathke <erack@redhat.com> | 2017-08-25 14:18:13 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-08-25 14:23:56 +0200 |
commit | 001e0e530f42b3838fa882ab77a3bb2b24f69ef7 (patch) | |
tree | 27d143bb246c51f9d1244894afc59100df0f1204 | |
parent | 9c8c4415f64d91c0c30b025edef649344649c3d7 (diff) |
Add check and comment for i18npool locale data using reserved formatIndex
Change-Id: I9401e353241973129bff764d6d7b7f94d7c9b7b0
-rw-r--r-- | include/svl/zforlist.hxx | 14 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 7 |
2 files changed, 20 insertions, 1 deletions
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 && |