fix sign mismatch warnings

enums are signed, while sizeof is unsigned.
as a side effect, we can optimize away one comparison by taking
advantage of the two's complement representation.

Change-Id: Ic0871306d30ad7217f2909e51e96a876a3f393dc
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
bb10
Oswald Buddenhagen 2012-11-07 15:44:56 +01:00 committed by The Qt Project
parent dd904c3c48
commit 285b966670
1 changed files with 2 additions and 2 deletions

View File

@ -325,7 +325,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
#endif
{
const char *path = 0;
if (loc >= 0 && loc < sizeof(qt_configure_prefix_path_strs)/sizeof(qt_configure_prefix_path_strs[0]))
if (unsigned(loc) < sizeof(qt_configure_prefix_path_strs)/sizeof(qt_configure_prefix_path_strs[0]))
path = qt_configure_prefix_path_strs[loc] + 12;
#ifndef Q_OS_WIN // On Windows we use the registry
else if (loc == SettingsPath)
@ -338,7 +338,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
} else {
QString key;
QString defaultValue;
if (loc >= 0 && loc < sizeof(qtConfEntries)/sizeof(qtConfEntries[0])) {
if (unsigned(loc) < sizeof(qtConfEntries)/sizeof(qtConfEntries[0])) {
key = QLatin1String(qtConfEntries[loc].key);
defaultValue = QLatin1String(qtConfEntries[loc].value);
}