[Libreoffice-commits] core.git: i18npool/source
Eike Rathke
erack at redhat.com
Fri Nov 25 12:43:28 UTC 2016
i18npool/source/localedata/LocaleNode.cxx | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
New commits:
commit 9b1d3707106b2eca0e94c4c50dcbec104500dafb
Author: Eike Rathke <erack at redhat.com>
Date: Fri Nov 25 13:41:50 2016 +0100
show next free formatindex hint for errors
Change-Id: I4252a572c1cef02ff5e7de0ecc78d84ddc806919
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 26f0e69..9f778e4 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)
More information about the Libreoffice-commits
mailing list