From 285b9666706d8f42b4bc39cf166853af24214448 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 7 Nov 2012 15:44:56 +0100 Subject: 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 --- src/corelib/global/qlibraryinfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index ffdf8d0fd3..be608a4950 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -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); } -- cgit v1.2.3