Bug 1073081 - Fix -Wunused-result, -Wunused-variable, and -Wunused-but-set-variable warnings. r=ehsan

--HG--
extra : source : a1ac7acfcf14207706eca29be3a20c576c8fae06
This commit is contained in:
Botond Ballo 2014-11-26 18:13:49 -05:00
parent e97c3508c5
commit 8296035077
14 changed files with 29 additions and 34 deletions

View File

@ -2592,8 +2592,8 @@ ContentParent::RecvAddNewProcess(const uint32_t& aPid,
size_t numNuwaPrefUpdates = sNuwaPrefUpdates ?
sNuwaPrefUpdates->Length() : 0;
// Resend pref updates to the forked child.
for (int i = 0; i < numNuwaPrefUpdates; i++) {
content->SendPreferenceUpdate(sNuwaPrefUpdates->ElementAt(i));
for (size_t i = 0; i < numNuwaPrefUpdates; i++) {
mozilla::unused << content->SendPreferenceUpdate(sNuwaPrefUpdates->ElementAt(i));
}
// Update offline settings.
@ -2602,7 +2602,7 @@ ContentParent::RecvAddNewProcess(const uint32_t& aPid,
ClipboardCapabilities clipboardCaps;
RecvGetXPCOMProcessAttributes(&isOffline, &unusedDictionaries,
&clipboardCaps);
content->SendSetOffline(isOffline);
mozilla::unused << content->SendSetOffline(isOffline);
MOZ_ASSERT(!clipboardCaps.supportsSelectionClipboard() &&
!clipboardCaps.supportsFindClipboard(),
"Unexpected values");

View File

@ -292,7 +292,7 @@ PreallocatedProcessManagerImpl::PublishSpareProcess(ContentParent* aContent)
AutoJSContext cx;
nsCOMPtr<nsIMessageBroadcaster> ppmm =
do_GetService("@mozilla.org/parentprocessmessagemanager;1");
nsresult rv = ppmm->BroadcastAsyncMessage(
mozilla::unused << ppmm->BroadcastAsyncMessage(
NS_LITERAL_STRING("TEST-ONLY:nuwa-add-new-process"),
JS::NullHandleValue, JS::NullHandleValue, cx, 1);
}
@ -355,7 +355,7 @@ PreallocatedProcessManagerImpl::PreallocatedProcessReady()
void
PreallocatedProcessManagerImpl::NuwaFork()
{
mPreallocatedAppProcess->SendNuwaFork();
mozilla::unused << mPreallocatedAppProcess->SendNuwaFork();
}
#endif

View File

@ -488,7 +488,7 @@ GonkVideoDecoderManager::codecReserved()
if (mNativeWindow != nullptr) {
surface = new Surface(mNativeWindow->getBufferQueue());
}
status_t err = mDecoder->configure(format, surface, nullptr, 0);
mDecoder->configure(format, surface, nullptr, 0);
mDecoder->Prepare();
if (mHandler != nullptr) {

View File

@ -8,6 +8,7 @@
#include "nsDebug.h"
#include "NfcGonkMessage.h"
#include "NfcOptions.h"
#include "mozilla/unused.h"
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "NfcMessageHandler", args)
@ -74,7 +75,7 @@ bool
NfcMessageHandler::Unmarshall(const Parcel& aParcel, EventOptions& aOptions)
{
bool result;
uint32_t parcelSize = htonl(aParcel.readInt32());
mozilla::unused << htonl(aParcel.readInt32()); // parcel size
int32_t type = aParcel.readInt32();
switch (type) {

View File

@ -444,13 +444,11 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult)
plugin->mLibrary = pluginLib;
pluginLib->SetPlugin(plugin);
NPError pluginCallError;
nsresult rv;
// Exchange NPAPI entry points.
#if defined(XP_WIN)
// NP_GetEntryPoints must be called before NP_Initialize on Windows.
rv = pluginLib->NP_GetEntryPoints(&plugin->mPluginFuncs, &pluginCallError);
NPError pluginCallError;
nsresult rv = pluginLib->NP_GetEntryPoints(&plugin->mPluginFuncs, &pluginCallError);
if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) {
return NS_ERROR_FAILURE;
}
@ -463,7 +461,8 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult)
#elif defined(XP_MACOSX)
// NP_Initialize must be called before NP_GetEntryPoints on Mac OS X.
// We need to match WebKit's behavior.
rv = pluginLib->NP_Initialize(&sBrowserFuncs, &pluginCallError);
NPError pluginCallError;
nsresult rv = pluginLib->NP_Initialize(&sBrowserFuncs, &pluginCallError);
if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) {
return NS_ERROR_FAILURE;
}
@ -474,7 +473,8 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult)
}
#elif defined(MOZ_WIDGET_GONK)
#else
rv = pluginLib->NP_Initialize(&sBrowserFuncs, &plugin->mPluginFuncs, &pluginCallError);
NPError pluginCallError;
nsresult rv = pluginLib->NP_Initialize(&sBrowserFuncs, &plugin->mPluginFuncs, &pluginCallError);
if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) {
return NS_ERROR_FAILURE;
}

View File

@ -15,6 +15,7 @@
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/Transport.h" // for Transport
#include "mozilla/UniquePtr.h" // for UniquePtr
#include "mozilla/unused.h"
#include "nsIMemoryReporter.h"
#ifdef MOZ_WIDGET_GONK
#include "mozilla/LinuxUtils.h"
@ -319,7 +320,7 @@ void SharedBufferManagerParent::DropGrallocBufferImpl(mozilla::layers::SurfaceDe
NS_ASSERTION(key != -1, "Invalid buffer key");
NS_ASSERTION(mBuffers.count(key) == 1, "No such buffer");
mBuffers.erase(key);
SendDropGrallocBuffer(handle);
mozilla::unused << SendDropGrallocBuffer(handle);
#endif
}

View File

@ -580,7 +580,6 @@ readRDSDataThread(void* data)
}
int blockcount = len / sizeof(rdsblocks[0]);
int lastblock = -1;
for (int i = 0; i < blockcount; i++) {
if ((rdsblocks[i].block & V4L2_RDS_BLOCK_MSK) == V4L2_RDS_BLOCK_INVALID ||
rdsblocks[i].block & V4L2_RDS_BLOCK_ERROR) {
@ -615,7 +614,6 @@ readRDSDataThread(void* data)
block_bitmap |= 1 << blocknum;
lastblock = blocknum;
blocks[blocknum] = (rdsblocks[i].msb << 8) | rdsblocks[i].lsb;
// Make sure we have all 4 blocks and that they're valid

View File

@ -189,10 +189,13 @@ void startKeyStoreService()
void startKeyStoreService() { return; }
#endif
static const char *CA_BEGIN = "-----BEGIN ",
*CA_END = "-----END ",
*CA_TAILER = "-----\n";
namespace mozilla {
namespace ipc {
static const char* KEYSTORE_SOCKET_NAME = "keystore";
static const char* KEYSTORE_SOCKET_PATH = "/dev/socket/keystore";
static const char* KEYSTORE_ALLOWED_USERS[] = {
"root",

View File

@ -48,9 +48,6 @@ static const int KEY_SIZE = ((NAME_MAX - 15) / 2);
static const int VALUE_SIZE = 32768;
static const int PASSWORD_SIZE = VALUE_SIZE;
static const char *CA_BEGIN = "-----BEGIN ",
*CA_END = "-----END ",
*CA_TAILER = "-----\n";
static const int CA_LINE_SIZE = 64;
struct ProtocolCommand {

View File

@ -50,9 +50,8 @@ RtspChannelParent::Init(const RtspChannelConnectArgs& aArgs)
bool
RtspChannelParent::ConnectChannel(const uint32_t& channelId)
{
nsresult rv;
nsCOMPtr<nsIChannel> channel;
rv = NS_LinkRedirectChannels(channelId, this, getter_AddRefs(channel));
NS_LinkRedirectChannels(channelId, this, getter_AddRefs(channel));
return true;
}

View File

@ -718,11 +718,10 @@ void ARTPConnection::onInjectPacket(const sp<AMessage> &msg) {
StreamInfo *s = &*it;
status_t err;
if (it->mInterleavedRTPIdx == index) {
err = parseRTP(s, buffer);
parseRTP(s, buffer);
} else {
err = parseRTCP(s, buffer);
parseRTCP(s, buffer);
}
}

View File

@ -234,7 +234,6 @@ int GonkNativeWindowClient::cancelBuffer(android_native_buffer_t* buffer,
int GonkNativeWindowClient::getSlotFromBufferLocked(
android_native_buffer_t* buffer) const {
bool dumpedState = false;
for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
if (mSlots[i].buffer != NULL &&
mSlots[i].buffer->handle == buffer->handle) {

View File

@ -151,10 +151,9 @@ void GonkNativeWindow::returnBuffer(TextureClient* client) {
fence = Fence::NO_FENCE;
}
status_t err;
err = addReleaseFenceLocked(index, fence);
addReleaseFenceLocked(index, fence);
err = releaseBufferLocked(index);
releaseBufferLocked(index);
}
TemporaryRef<TextureClient>

View File

@ -151,12 +151,11 @@ void GonkNativeWindow::returnBuffer(TextureClient* client) {
fence = Fence::NO_FENCE;
}
status_t err;
err = addReleaseFenceLocked(index,
mSlots[index].mGraphicBuffer,
fence);
addReleaseFenceLocked(index,
mSlots[index].mGraphicBuffer,
fence);
err = releaseBufferLocked(index, mSlots[index].mGraphicBuffer);
releaseBufferLocked(index, mSlots[index].mGraphicBuffer);
}
TemporaryRef<TextureClient>