summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-01-19 22:23:59 +0100
committerEike Rathke <erack@redhat.com>2012-01-19 22:31:02 +0100
commit0dc4e9cd0aac2d203219bb5ea4266693427c744c (patch)
treed1fa0453890e959a314ff747e4950be04f53f656 /i18npool
parent28e1b3984080e238866fcd44034de6ea47895962 (diff)
added check for duplicated date acceptance patterns
Also insert full date acceptance pattern at first position instead of appending to have it be first in checks.
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 1b1e777ed0f2..42cf5837fb36 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -1185,7 +1185,8 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
{
fprintf( stderr, "Generated date acceptance pattern: '%s' from '%s'\n",
OSTR( aPattern), OSTR( sTheDateEditFormat));
- theDateAcceptancePatterns.push_back( aPattern);
+ // Insert at front so full date pattern is first in checks.
+ theDateAcceptancePatterns.insert( theDateAcceptancePatterns.begin(), aPattern);
}
if (aPatternBuf2.getLength() > 0)
{
@@ -1200,7 +1201,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
{
fprintf( stderr, "Generated 2nd acceptance pattern: '%s' from '%s'\n",
OSTR( aPattern2), OSTR( sTheDateEditFormat));
- theDateAcceptancePatterns.push_back( aPattern2);
+ theDateAcceptancePatterns.insert( theDateAcceptancePatterns.begin(), aPattern2);
}
}
@@ -1222,6 +1223,23 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
}
}
+ // Check for duplicates.
+ for (vector<OUString>::const_iterator aIt = theDateAcceptancePatterns.begin();
+ aIt != theDateAcceptancePatterns.end(); ++aIt)
+ {
+ for (vector<OUString>::iterator aComp = theDateAcceptancePatterns.begin();
+ aComp != theDateAcceptancePatterns.end(); /*nop*/)
+ {
+ if (aIt != aComp && *aIt == *aComp)
+ {
+ incErrorStr( "Duplicated DateAcceptancePattern", *aComp);
+ aComp = theDateAcceptancePatterns.erase( aComp);
+ }
+ else
+ ++aComp;
+ }
+ }
+
sal_Int16 nbOfDateAcceptancePatterns = static_cast<sal_Int16>(theDateAcceptancePatterns.size());
for (sal_Int16 i = 0; i < nbOfDateAcceptancePatterns; ++i)