summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-02-14 21:45:32 -0800
committerThiago Macieira <thiago.macieira@intel.com>2015-02-17 00:42:00 +0000
commit738e9b185c72b6814bc3e4ea2a7a23adce326a73 (patch)
tree5af004d1e11d05f1429406fc43f98fa9ed9420ce /src
parentaa855afa44bbbdd17125b88f0ec277b0b3f510c8 (diff)
Fix Intel compiler warning about change of sign
The variable c is unsigned, so the second operand is unsigned, constraing the -1 to be unsigned too and causing a change of sign. Instead, cast the middle operations to int, as that's the return value anyway. error #68: integer conversion resulted in a change of sign Change-Id: I1a800c709d3543699131ffff13c2fd79f14f8b43 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qtools_p.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/tools/qtools_p.h b/src/corelib/tools/qtools_p.h
index b48ed94236..3a407aea5b 100644
--- a/src/corelib/tools/qtools_p.h
+++ b/src/corelib/tools/qtools_p.h
@@ -63,9 +63,9 @@ Q_DECL_CONSTEXPR inline char toHexLower(uint value) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR inline int fromHex(uint c) Q_DECL_NOTHROW
{
- return ((c >= '0') && (c <= '9')) ? c - '0' :
- ((c >= 'A') && (c <= 'F')) ? c - 'A' + 10 :
- ((c >= 'a') && (c <= 'f')) ? c - 'a' + 10 :
+ return ((c >= '0') && (c <= '9')) ? int(c - '0') :
+ ((c >= 'A') && (c <= 'F')) ? int(c - 'A' + 10) :
+ ((c >= 'a') && (c <= 'f')) ? int(c - 'a' + 10) :
/* otherwise */ -1;
}
@@ -76,7 +76,7 @@ Q_DECL_CONSTEXPR inline char toOct(uint value) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR inline int fromOct(uint c) Q_DECL_NOTHROW
{
- return ((c >= '0') && (c <= '7')) ? c - '0' : -1;
+ return ((c >= '0') && (c <= '7')) ? int(c - '0') : -1;
}
}