summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-04-15 13:26:23 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-04-15 18:38:58 (GMT)
commita089be0d09c64e698d2fa404cf5eedb21dde6406 (patch)
tree1035d3410107bba14b7fa9c82b449b0a27a63f07 /tools
parent4f66b3c550ca1c90c33952ad8603cc6c1a702280 (diff)
downloadQt-a089be0d09c64e698d2fa404cf5eedb21dde6406.zip
Qt-a089be0d09c64e698d2fa404cf5eedb21dde6406.tar.gz
Qt-a089be0d09c64e698d2fa404cf5eedb21dde6406.tar.bz2
fix uninitialized variable read
Diffstat (limited to 'tools')
-rw-r--r--tools/linguist/shared/ui.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/linguist/shared/ui.cpp b/tools/linguist/shared/ui.cpp
index 4f4d4cd..ff98a90 100644
--- a/tools/linguist/shared/ui.cpp
+++ b/tools/linguist/shared/ui.cpp
@@ -60,7 +60,7 @@ class UiReader : public QXmlDefaultHandler
{
public:
UiReader(Translator &translator, ConversionData &cd)
- : m_translator(translator), m_cd(cd), m_lineNumber(-1),
+ : m_translator(translator), m_cd(cd), m_lineNumber(-1), m_isTrString(false),
m_needUtf8(translator.codecName() != "UTF-8")
{}
@@ -81,6 +81,7 @@ private:
QString m_context;
QString m_source;
QString m_comment;
+ QString m_extracomment;
QXmlLocator *m_locator;
QString m_accum;
@@ -97,20 +98,25 @@ bool UiReader::startElement(const QString &namespaceURI,
if (qName == QLatin1String("item")) { // UI3 menu entries
flush();
- if (!atts.value(QLatin1String("text")).isEmpty())
+ if (!atts.value(QLatin1String("text")).isEmpty()) {
m_source = atts.value(QLatin1String("text"));
+ m_isTrString = true;
+ if (!m_cd.m_noUiLines)
+ m_lineNumber = m_locator->lineNumber();
+ }
} else if (qName == QLatin1String("string")) {
flush();
if (atts.value(QLatin1String("notr")).isEmpty() ||
atts.value(QLatin1String("notr")) != QLatin1String("true")) {
m_isTrString = true;
m_comment = atts.value(QLatin1String("comment"));
+ m_extracomment = atts.value(QLatin1String("extracomment"));
+ if (!m_cd.m_noUiLines)
+ m_lineNumber = m_locator->lineNumber();
} else {
m_isTrString = false;
}
}
- if (m_isTrString && !m_cd.m_noUiLines)
- m_lineNumber = m_locator->lineNumber();
m_accum.clear();
return true;
}
@@ -161,12 +167,14 @@ void UiReader::flush()
TranslatorMessage msg(m_context, m_source,
m_comment, QString(), m_cd.m_sourceFileName,
m_lineNumber, QStringList());
+ msg.setExtraComment(m_extracomment);
if (m_needUtf8 && msg.needs8Bit())
msg.setUtf8(true);
m_translator.extend(msg);
}
m_source.clear();
m_comment.clear();
+ m_extracomment.clear();
}
bool loadUI(Translator &translator, QIODevice &dev, ConversionData &cd)