From 0443d296720971697c48453912cc9ffb742f8640 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 7 Feb 2014 10:04:31 +0100 Subject: [PATCH] Avoid generation of unused replaceFrom* variables Change-Id: I2a65485b8dcaa7b6ed4a049f97d460878b8bb17d --- i18npool/source/localedata/LocaleNode.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 69360de102a8..05762c6b0c3b 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -617,9 +617,14 @@ void LCFormatNode::generateCode (const OFileWriter &of) const ::std::vector< OUString > theDateAcceptancePatterns; + OUString useLocale(getAttr().getValueByName("ref")); + OUString str; OUString strFrom( getAttr().getValueByName("replaceFrom")); - of.writeParameter("replaceFrom", strFrom, mnSection); + if (useLocale.isEmpty()) + { + of.writeParameter("replaceFrom", strFrom, mnSection); + } str = getAttr().getValueByName("replaceTo"); if (!strFrom.isEmpty() && str.isEmpty()) incErrorStr("replaceFrom=\"%s\" replaceTo=\"\" is empty replacement.", strFrom); @@ -640,9 +645,14 @@ void LCFormatNode::generateCode (const OFileWriter &of) const } } - OUString useLocale = getAttr().getValueByName("ref"); if (!useLocale.isEmpty()) { + if (!strFrom.isEmpty() && strFrom != "[CURRENCY]") //??? + { + incErrorStrStr( + "non-empty replaceFrom=\"%s\" with non-empty ref=\"%s\".", + strFrom, useLocale); + } useLocale = useLocale.replace( '-', '_'); switch (mnSection) {