From 40dadf0d080252711e457df5bb6a14c627ffcb4a Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Mon, 24 Nov 2014 19:54:33 -0500 Subject: [PATCH] Bug 1073081 - Fix -Wsign-compare and -Wsign-conversion warnings. r=ehsan --HG-- extra : source : 88c58a8cc276a4691ed23fd8b8f2f6c0713b50fd --- dom/bluetooth/bluez/BluetoothDBusService.cpp | 4 ++-- dom/system/gonk/NetworkUtils.cpp | 2 +- gfx/layers/GrallocImages.cpp | 2 +- gfx/layers/GrallocImages.h | 2 +- hal/gonk/GonkFMRadio.cpp | 2 +- ipc/glue/ProcessUtils_linux.cpp | 2 +- ipc/unixsocket/UnixSocket.cpp | 2 +- netwerk/protocol/http/nsHttpHandler.cpp | 2 +- widget/gonk/libdisplay/GonkDisplay.h | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dom/bluetooth/bluez/BluetoothDBusService.cpp b/dom/bluetooth/bluez/BluetoothDBusService.cpp index f4abdef747fc..4c092ae5a009 100644 --- a/dom/bluetooth/bluez/BluetoothDBusService.cpp +++ b/dom/bluetooth/bluez/BluetoothDBusService.cpp @@ -862,7 +862,7 @@ static int FindProperty(const InfallibleTArray& aProperties, const char* aPropertyType) { - for (int i = 0; i < aProperties.Length(); ++i) { + for (size_t i = 0; i < aProperties.Length(); ++i) { if (aProperties[i].name().EqualsASCII(aPropertyType)) { return i; } @@ -4086,7 +4086,7 @@ BluetoothDBusService::SendMetaData(const nsAString& aTitle, a2dp->GetTitle(prevTitle); a2dp->GetAlbum(prevAlbum); - if (aMediaNumber != a2dp->GetMediaNumber() || + if (aMediaNumber < 0 || (uint64_t)aMediaNumber != a2dp->GetMediaNumber() || !aTitle.Equals(prevTitle) || !aAlbum.Equals(prevAlbum)) { UpdateNotification(ControlEventId::EVENT_TRACK_CHANGED, aMediaNumber); diff --git a/dom/system/gonk/NetworkUtils.cpp b/dom/system/gonk/NetworkUtils.cpp index 39e020bf8c23..eac78e1ecc08 100644 --- a/dom/system/gonk/NetworkUtils.cpp +++ b/dom/system/gonk/NetworkUtils.cpp @@ -917,7 +917,7 @@ void NetworkUtils::setInterfaceDns(CommandChain* aChain, continue; } - if ((ret + written) >= sizeof(command)) { + if (((size_t)ret + written) >= sizeof(command)) { command[written] = '\0'; break; } diff --git a/gfx/layers/GrallocImages.cpp b/gfx/layers/GrallocImages.cpp index 20edeb6f9437..652348fe8b11 100644 --- a/gfx/layers/GrallocImages.cpp +++ b/gfx/layers/GrallocImages.cpp @@ -25,7 +25,7 @@ using namespace android; namespace mozilla { namespace layers { -uint32_t GrallocImage::sColorIdMap[] = { +int32_t GrallocImage::sColorIdMap[] = { HAL_PIXEL_FORMAT_YCbCr_420_P, OMX_COLOR_FormatYUV420Planar, HAL_PIXEL_FORMAT_YCbCr_422_P, OMX_COLOR_FormatYUV422Planar, HAL_PIXEL_FORMAT_YCbCr_420_SP, OMX_COLOR_FormatYUV420SemiPlanar, diff --git a/gfx/layers/GrallocImages.h b/gfx/layers/GrallocImages.h index 103c11e5a610..77d1516ed50c 100644 --- a/gfx/layers/GrallocImages.h +++ b/gfx/layers/GrallocImages.h @@ -47,7 +47,7 @@ class GrallocImage : public PlanarYCbCrImage , public ISharedImage { typedef PlanarYCbCrData Data; - static uint32_t sColorIdMap[]; + static int32_t sColorIdMap[]; public: struct GrallocData { nsRefPtr mGraphicBuffer; diff --git a/hal/gonk/GonkFMRadio.cpp b/hal/gonk/GonkFMRadio.cpp index 8aa56f62a155..5654c6bd0182 100644 --- a/hal/gonk/GonkFMRadio.cpp +++ b/hal/gonk/GonkFMRadio.cpp @@ -608,7 +608,7 @@ readRDSDataThread(void* data) // Skip the group if we skipped a block. // This stops us from processing blocks sent out of order. - if (block_bitmap != ((1 << blocknum) - 1)) { + if (block_bitmap != ((1u << blocknum) - 1u)) { block_bitmap |= 1 << V4L2_RDS_BLOCK_INVALID; continue; } diff --git a/ipc/glue/ProcessUtils_linux.cpp b/ipc/glue/ProcessUtils_linux.cpp index 5434f3e7102a..215fa2110c04 100644 --- a/ipc/glue/ProcessUtils_linux.cpp +++ b/ipc/glue/ProcessUtils_linux.cpp @@ -112,7 +112,7 @@ static void ProcLoaderClientDeinit(); * starting from kBeginReserveFileDescriptor so that operations like * __android_log_print() won't take these magic FDs. */ -static const int kReservedFileDescriptors = 5; +static const size_t kReservedFileDescriptors = 5; static const int kBeginReserveFileDescriptor = STDERR_FILENO + 1; class ProcLoaderParent : public PProcLoaderParent diff --git a/ipc/unixsocket/UnixSocket.cpp b/ipc/unixsocket/UnixSocket.cpp index 369578508b4f..cd4efccc8bb9 100644 --- a/ipc/unixsocket/UnixSocket.cpp +++ b/ipc/unixsocket/UnixSocket.cpp @@ -309,7 +309,7 @@ UnixSocketConsumerIO::OnAccepted(int aFd, MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop()); MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_LISTENING); MOZ_ASSERT(aAddr); - MOZ_ASSERT(aAddrLen <= sizeof(mAddr)); + MOZ_ASSERT(aAddrLen > 0 && (size_t)aAddrLen <= sizeof(mAddr)); memcpy (&mAddr, aAddr, aAddrLen); mAddrSize = aAddrLen; diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index af343ca84617..b71e1680c453 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -712,7 +712,7 @@ nsHttpHandler::InitUserAgentComponents() if (NS_SUCCEEDED(rv)) { bool valid = true; deviceId.Trim(" ", true, true); - for (int i = 0; i < deviceId.Length(); i++) { + for (size_t i = 0; i < deviceId.Length(); i++) { char c = deviceId.CharAt(i); if (!(isalnum(c) || c == '-' || c == '.')) { valid = false; diff --git a/widget/gonk/libdisplay/GonkDisplay.h b/widget/gonk/libdisplay/GonkDisplay.h index 2443cfee0006..37666e4d122a 100644 --- a/widget/gonk/libdisplay/GonkDisplay.h +++ b/widget/gonk/libdisplay/GonkDisplay.h @@ -64,7 +64,7 @@ public: virtual int GetPrevFBAcquireFd() = 0; float xdpi; - uint32_t surfaceformat; + int32_t surfaceformat; }; MOZ_EXPORT __attribute__ ((weak))