summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-11-25 13:41:50 +0100
committerEike Rathke <erack@redhat.com>2016-11-25 13:42:42 +0100
commit9b1d3707106b2eca0e94c4c50dcbec104500dafb (patch)
tree4bb85c01476c46c12292df1bf6980c5e0802a6d1 /i18npool
parentf32a75c25b0450eba9cdd9b343e1263c600c0151 (diff)
show next free formatindex hint for errors
Change-Id: I4252a572c1cef02ff5e7de0ecc78d84ddc806919
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx28
1 files changed, 26 insertions, 2 deletions
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 26f0e69663f1..9f778e48cd98 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -661,6 +661,8 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
NameSet aDefaultsSet;
bool bCtypeIsRef = false;
bool bHaveEngineering = false;
+ bool bShowNextFreeFormatIndex = false;
+ const sal_Int16 nFirstFreeFormatIndex = 60;
for (sal_Int32 i = 0; i< getNumberOfChildren() ; i++, formatCount++)
{
@@ -707,10 +709,16 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
sal_Int16 formatindex = (sal_Int16)aFormatIndex.toInt32();
// Ensure the new reserved range is not used anymore, free usage start
// was up'ed from 50 to 60.
- if (50 <= formatindex && formatindex < 60)
- incErrorInt( "Error: Reserved formatindex=\"%d\" in FormatElement, free usage starts at 60.\n", formatindex);
+ if (50 <= formatindex && formatindex < nFirstFreeFormatIndex)
+ {
+ incErrorInt( "Error: Reserved formatindex=\"%d\" in FormatElement.\n", formatindex);
+ bShowNextFreeFormatIndex = true;
+ }
if (!aFormatIndexSet.insert( formatindex).second)
+ {
incErrorInt( "Error: Duplicated formatindex=\"%d\" in FormatElement.\n", formatindex);
+ bShowNextFreeFormatIndex = true;
+ }
of.writeIntParameter("Formatindex", formatCount, formatindex);
// Ensure only one default per usage and type.
@@ -906,6 +914,22 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
}
+ if (bShowNextFreeFormatIndex)
+ {
+ sal_Int16 nNext = nFirstFreeFormatIndex;
+ std::set<sal_Int16>::const_iterator it( aFormatIndexSet.find( nNext));
+ if (it != aFormatIndexSet.end())
+ {
+ // nFirstFreeFormatIndex already used, find next free including gaps.
+ do
+ {
+ ++nNext;
+ }
+ while (++it != aFormatIndexSet.end() && *it == nNext);
+ }
+ fprintf( stderr, "Hint: Next free formatindex is %d.\n", (int)nNext);
+ }
+
// Check presence of all required format codes only in first section
// LC_FORMAT, not in optional LC_FORMAT_1
if (mnSection == 0)