From ad921347f701ea7f732633c9c584be9300317537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 28 Mar 2012 15:49:46 +0200 Subject: Make numerus unsigned It's the index number of the translation to be used. Change-Id: I959c6aaa1aad09e74286d201ea356bfc4409f02a Reviewed-by: Oswald Buddenhagen --- src/corelib/kernel/qtranslator.cpp | 11 +++++------ 1 file 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); -- cgit v1.2.3