diff options
author | Eike Rathke <erack@redhat.com> | 2012-01-17 17:02:57 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2012-01-17 17:04:35 +0100 |
commit | c0bbf6f78aba568d3b3edb77fdfa973c183208ff (patch) | |
tree | ab54ddaab06a017ef0617b99565e5174866d1792 /i18npool | |
parent | added [zh-TW] date acceptance patterns (various) (diff) | |
download | core-c0bbf6f78aba568d3b3edb77fdfa973c183208ff.tar.gz core-c0bbf6f78aba568d3b3edb77fdfa973c183208ff.zip |
rudimentary check if date acceptance pattern interferes with decimal number
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/source/localedata/LocaleNode.cxx | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index dd07dfe875dd..1b1e777ed0f2 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -382,7 +382,8 @@ void LCInfoNode::generateCode (const OFileWriter &of) const } -OUString aDateSep; +static OUString aDateSep; +static OUString aDecSep; void LCCTYPENode::generateCode (const OFileWriter &of) const { @@ -400,7 +401,7 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const writeParameterCheckLen( of, "DateSeparator", "dateSeparator", 1, 1); OUString aThoSep = writeParameterCheckLen( of, "ThousandSeparator", "thousandSeparator", 1, 1); - OUString aDecSep = + aDecSep = writeParameterCheckLen( of, "DecimalSeparator", "decimalSeparator", 1, 1); OUString aTimeSep = writeParameterCheckLen( of, "TimeSeparator", "timeSeparator", 1, 1); @@ -1203,6 +1204,24 @@ void LCFormatNode::generateCode (const OFileWriter &of) const } } + // Rudimentary check if a pattern interferes with decimal number. + nIndex = 0; + sal_uInt32 cDecSep = aDecSep.iterateCodePoints( &nIndex); + for (vector<OUString>::const_iterator aIt = theDateAcceptancePatterns.begin(); + aIt != theDateAcceptancePatterns.end(); ++aIt) + { + if ((*aIt).getLength() == (cDecSep <= 0xffff ? 3 : 4)) + { + nIndex = 1; + if ((*aIt).iterateCodePoints( &nIndex) == cDecSep) + { + ++nError; + fprintf( stderr, "Error: Date acceptance pattern '%s' matches decimal number '#%s#'\n", + OSTR( *aIt), OSTR( aDecSep)); + } + } + } + sal_Int16 nbOfDateAcceptancePatterns = static_cast<sal_Int16>(theDateAcceptancePatterns.size()); for (sal_Int16 i = 0; i < nbOfDateAcceptancePatterns; ++i) |