diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-09-27 12:56:59 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-10-01 21:08:25 +0000 |
commit | 8233e401b1892b27e669546c8df02c2320e8e775 (patch) | |
tree | cc14c5ad0ef3f338332cb880461be09057ce812a /src/corelib | |
parent | b39cda2ec2f8ffcd2e26c7a2f1a9f19d47f46b30 (diff) |
QLocale: remove (harmless) dead code
On line 92 and on line 146, len == 2 or len == 3, so uc1 and uc2 cannot
be 0, ever.
Found by Coverity, CID 11013 and CID 11012.
Change-Id: I42e7ef1a481840699a8dffff1407edefd3e7aa4f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 181daa04e4..57ef53eea4 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -89,9 +89,9 @@ QLocale::Language QLocalePrivate::codeToLanguage(const QString &code) int len = code.length(); if (len != 2 && len != 3) return QLocale::C; - ushort uc1 = len-- > 0 ? code[0].toLower().unicode() : 0; - ushort uc2 = len-- > 0 ? code[1].toLower().unicode() : 0; - ushort uc3 = len-- > 0 ? code[2].toLower().unicode() : 0; + ushort uc1 = code[0].toLower().unicode(); + ushort uc2 = code[1].toLower().unicode(); + ushort uc3 = len > 2 ? code[2].toLower().unicode() : 0; const unsigned char *c = language_code_list; for (; *c != 0; c += 3) { @@ -145,9 +145,9 @@ QLocale::Country QLocalePrivate::codeToCountry(const QString &code) int len = code.length(); if (len != 2 && len != 3) return QLocale::AnyCountry; - ushort uc1 = len-- > 0 ? code[0].toUpper().unicode() : 0; - ushort uc2 = len-- > 0 ? code[1].toUpper().unicode() : 0; - ushort uc3 = len-- > 0 ? code[2].toUpper().unicode() : 0; + ushort uc1 = code[0].toUpper().unicode(); + ushort uc2 = code[1].toUpper().unicode(); + ushort uc3 = len > 2 ? code[2].toUpper().unicode() : 0; const unsigned char *c = country_code_list; for (; *c != 0; c += 3) { |