summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qtranslator.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-03-28 15:49:46 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-30 13:24:20 +0200
commitad921347f701ea7f732633c9c584be9300317537 (patch)
tree1b47e5cfe12c072631253b677746f05f1526e668 /src/corelib/kernel/qtranslator.cpp
parent5900305addd2cc1c484b0d1e3263191d207f1066 (diff)
Make numerus unsigned
It's the index number of the translation to be used. Change-Id: I959c6aaa1aad09e74286d201ea356bfc4409f02a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src/corelib/kernel/qtranslator.cpp')
-rw-r--r--src/corelib/kernel/qtranslator.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index 4af932aac9..892883bacd 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -204,9 +204,9 @@ static bool isValidNumerusRules(const uchar *rules, uint rulesSize)
This function has O(1) space and O(rulesSize) time complexity.
*/
-static int numerusHelper(int n, const uchar *rules, uint rulesSize)
+static uint numerusHelper(int n, const uchar *rules, uint rulesSize)
{
- int result = 0;
+ uint result = 0;
uint i = 0;
if (rulesSize == 0)
@@ -817,11 +817,10 @@ bool QTranslatorPrivate::do_load(const uchar *data, int len)
}
static QString getMessage(const uchar *m, const uchar *end, const char *context,
- const char *sourceText, const char *comment, int numerus)
+ const char *sourceText, const char *comment, uint numerus)
{
const uchar *tn = 0;
uint tn_length = 0;
- int currentNumerus = -1;
for (;;) {
uchar tag = 0;
@@ -835,7 +834,7 @@ static QString getMessage(const uchar *m, const uchar *end, const char *context,
if (len % 1)
return QString();
m += 4;
- if (++currentNumerus == numerus) {
+ if (!numerus--) {
tn_length = len;
tn = m;
}
@@ -925,7 +924,7 @@ QString QTranslatorPrivate::do_translate(const char *context, const char *source
if (!numItems)
return QString();
- int numerus = 0;
+ uint numerus = 0;
if (n >= 0)
numerus = numerusHelper(n, numerusRulesArray, numerusRulesLength);