Bug 605180 - Fix build warnings in netwerk/. r=jduell

This commit is contained in:
Ms2ger 2012-04-07 14:25:00 -07:00
parent 06c513557e
commit 630bc4c173
23 changed files with 56 additions and 43 deletions

View File

@ -404,6 +404,10 @@ nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream *stream)
case STATE_STOP:
nextState = OnStateStop();
break;
default:
nextState = 0;
NS_NOTREACHED("Unknown enum value.");
return NS_ERROR_UNEXPECTED;
}
if (mState == nextState && !mSuspendCount) {

View File

@ -343,7 +343,7 @@ nsSocketInputStream::Read(char *buf, PRUint32 count, PRUint32 *countRead)
*countRead = 0;
PRFileDesc *fd;
PRFileDesc* fd = nsnull;
{
MutexAutoLock lock(mTransport->mLock);
@ -364,7 +364,7 @@ nsSocketInputStream::Read(char *buf, PRUint32 count, PRUint32 *countRead)
SOCKET_LOG((" PR_Read returned [n=%d]\n", n));
nsresult rv;
nsresult rv = NS_OK;
{
MutexAutoLock lock(mTransport->mLock);
@ -567,7 +567,7 @@ nsSocketOutputStream::Write(const char *buf, PRUint32 count, PRUint32 *countWrit
if (count == 0 && mByteCount)
return NS_OK;
PRFileDesc *fd;
PRFileDesc* fd = nsnull;
{
MutexAutoLock lock(mTransport->mLock);
@ -588,13 +588,13 @@ nsSocketOutputStream::Write(const char *buf, PRUint32 count, PRUint32 *countWrit
SOCKET_LOG((" PR_Write returned [n=%d]\n", n));
nsresult rv;
nsresult rv = NS_OK;
{
MutexAutoLock lock(mTransport->mLock);
#ifdef ENABLE_SOCKET_TRACING
if (n > 0)
mTransport->TraceOutBuf(buf, n);
if (n > 0)
mTransport->TraceOutBuf(buf, n);
#endif
mTransport->ReleaseFD_Locked(fd);
@ -1875,7 +1875,7 @@ nsSocketTransport::IsAlive(bool *result)
{
*result = false;
PRFileDesc *fd;
PRFileDesc* fd = nsnull;
{
MutexAutoLock lock(mLock);
if (NS_FAILED(mCondition))

View File

@ -506,8 +506,8 @@ nsStandardURL::BuildNormalizedSpec(const char *spec)
// escaping is required).
nsCAutoString encUsername, encPassword, encHost, encDirectory,
encBasename, encExtension, encQuery, encRef;
bool useEncUsername, useEncPassword, useEncHost, useEncDirectory,
useEncBasename, useEncExtension, useEncQuery, useEncRef;
bool useEncUsername, useEncPassword, useEncHost = false,
useEncDirectory, useEncBasename, useEncExtension, useEncQuery, useEncRef;
nsCAutoString portbuf;
//

View File

@ -858,8 +858,8 @@ net_ParseMediaType(const nsACString &aMediaTypeStr,
const char* charset = "";
const char* charsetEnd = charset;
PRInt32 charsetParamStart;
PRInt32 charsetParamEnd;
PRInt32 charsetParamStart = 0;
PRInt32 charsetParamEnd = 0;
// Iterate over parameters
bool typeHasCharset = false;

View File

@ -1,7 +1,6 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/*
* ***** BEGIN LICENSE BLOCK *****
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
@ -1387,35 +1386,36 @@ nsCacheService::EvictEntriesForClient(const char * clientID,
storagePolicy == nsICache::STORE_ON_DISK) {
if (mEnableDiskDevice) {
nsresult rv;
nsresult rv = NS_OK;
if (!mDiskDevice)
rv = CreateDiskDevice();
if (mDiskDevice)
rv = mDiskDevice->EvictEntries(clientID);
if (NS_FAILED(rv)) res = rv;
if (NS_FAILED(rv))
res = rv;
}
}
// Only clear the offline cache if it has been specifically asked for.
if (storagePolicy == nsICache::STORE_OFFLINE) {
if (mEnableOfflineDevice) {
nsresult rv;
nsresult rv = NS_OK;
if (!mOfflineDevice)
rv = CreateOfflineDevice();
if (mOfflineDevice)
rv = mOfflineDevice->EvictEntries(clientID);
if (NS_FAILED(rv)) res = rv;
if (NS_FAILED(rv))
res = rv;
}
}
if (storagePolicy == nsICache::STORE_ANYWHERE ||
storagePolicy == nsICache::STORE_IN_MEMORY) {
// If there is no memory device, there is no need to evict it...
if (mMemoryDevice) {
nsresult rv;
rv = mMemoryDevice->EvictEntries(clientID);
if (NS_FAILED(rv)) res = rv;
nsresult rv = mMemoryDevice->EvictEntries(clientID);
if (NS_FAILED(rv))
res = rv;
}
}

View File

@ -1,6 +1,6 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* ***** BEGIN LICENSE BLOCK *****
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version

View File

@ -1895,7 +1895,7 @@ nsOfflineCacheDevice::GetMatchingNamespace(const nsCString &clientID,
bool found = false;
nsCString nsSpec;
PRInt32 nsType;
PRInt32 nsType = 0;
nsCString nsData;
while (hasRows)

View File

@ -84,6 +84,7 @@
#include "mozilla/FunctionTimer.h"
#include "mozilla/Util.h" // for DebugOnly
using namespace mozilla;
using namespace mozilla::net;
/******************************************************************************
@ -3541,7 +3542,7 @@ nsCookieService::FindStaleCookie(nsCookieEntry *aEntry,
{
aIter.entry = NULL;
PRInt64 oldestTime;
PRInt64 oldestTime = 0;
const nsCookieEntry::ArrayType &cookies = aEntry->GetCookies();
for (nsCookieEntry::IndexType i = 0; i < cookies.Length(); ++i) {
nsCookie *cookie = cookies[i];
@ -3672,8 +3673,9 @@ nsCookieService::RemoveCookieFromList(const nsListIter &aIter,
nsCOMPtr<mozIStorageBindingParams> params;
paramsArray->NewBindingParams(getter_AddRefs(params));
nsresult rv = params->BindUTF8StringByName(NS_LITERAL_CSTRING("name"),
aIter.Cookie()->Name());
DebugOnly<nsresult> rv =
params->BindUTF8StringByName(NS_LITERAL_CSTRING("name"),
aIter.Cookie()->Name());
NS_ASSERT_SUCCESS(rv);
rv = params->BindUTF8StringByName(NS_LITERAL_CSTRING("host"),
@ -3718,12 +3720,12 @@ bindCookieParameters(mozIStorageBindingParamsArray *aParamsArray,
{
NS_ASSERTION(aParamsArray, "Null params array passed to bindCookieParameters!");
NS_ASSERTION(aCookie, "Null cookie passed to bindCookieParameters!");
nsresult rv;
// Use the asynchronous binding methods to ensure that we do not acquire the
// database lock.
nsCOMPtr<mozIStorageBindingParams> params;
rv = aParamsArray->NewBindingParams(getter_AddRefs(params));
DebugOnly<nsresult> rv =
aParamsArray->NewBindingParams(getter_AddRefs(params));
NS_ASSERT_SUCCESS(rv);
// Bind our values to params

View File

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=4:
*/
/* vim: set sw=4 ts=8 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -923,7 +922,7 @@ static const char especials[] = "()<>@,;:\\\"/[]?.=";
nsresult DecodeRFC2047Str(const char *aHeader, const char *aDefaultCharset,
bool aOverrideCharset, nsACString &aResult)
{
const char *p, *q, *r;
const char *p, *q = nsnull, *r;
char *decodedText;
const char *begin; // tracking pointer for where we are in the input buffer
PRInt32 isLastEncodedWord = 0;
@ -1059,4 +1058,3 @@ nsresult DecodeRFC2047Str(const char *aHeader, const char *aDefaultCharset,
return NS_OK;
}

View File

@ -39,6 +39,7 @@ DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS = 1
include $(DEPTH)/config/autoconf.mk

View File

@ -38,6 +38,7 @@ DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS = 1
include $(DEPTH)/config/autoconf.mk

View File

@ -39,6 +39,7 @@ DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS = 1
include $(DEPTH)/config/autoconf.mk

View File

@ -39,6 +39,7 @@ DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS = 1
include $(DEPTH)/config/autoconf.mk

View File

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

View File

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et tw=80 : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -17,7 +16,7 @@
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*

View File

@ -2379,11 +2379,13 @@ nsHttpChannel::OpenNormalCacheEntry()
nsCOMPtr<nsICacheSession> session;
rv = gHttpHandler->GetCacheSession(storagePolicy,
getter_AddRefs(session));
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv))
return rv;
nsCacheAccessMode accessRequested;
nsCacheAccessMode accessRequested = 0;
rv = DetermineCacheAccess(&accessRequested);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv))
return rv;
mOnCacheEntryAvailableCallback =
&nsHttpChannel::OnNormalCacheEntryAvailable;

View File

@ -39,6 +39,7 @@ DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS = 1
include $(DEPTH)/config/autoconf.mk

View File

@ -40,6 +40,7 @@ DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS = 1
include $(DEPTH)/config/autoconf.mk

View File

@ -39,6 +39,7 @@ DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS = 1
include $(DEPTH)/config/autoconf.mk

View File

@ -38,6 +38,7 @@ DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS = 1
include $(DEPTH)/config/autoconf.mk

View File

@ -804,7 +804,7 @@ mozTXTToHTMLConv::GlyphHit(const PRUnichar * aInString, PRInt32 aInLength, bool
// temporary variable used to store the glyph html text
nsAutoString outputHTML;
bool bTestSmilie;
bool bArg;
bool bArg = false;
int i;
// refactor some of this mess to avoid code duplication and speed execution a bit

View File

@ -103,7 +103,8 @@ public:
rv = inStr->Read(buffer, len, &read);
buffer[len] = '\0';
if (NS_SUCCEEDED(rv)) {
printf("CONTEXT %p: Received %u bytes and the following data: \n %s\n\n", ctxt, read, buffer);
printf("CONTEXT %p: Received %u bytes and the following data: \n %s\n\n",
static_cast<void*>(ctxt), read, buffer);
}
nsMemory::Free(buffer);

View File

@ -525,7 +525,7 @@ main(PRInt32 argc, char *argv[])
rv[2] = CheckResult(cookie.get(), MUST_CONTAIN, "test=same");
rv[3] = CheckResult(cookie.get(), MUST_NOT_CONTAIN, "newtest=ciao");
rv[4] = CheckResult(cookie.get(), MUST_NOT_CONTAIN, "newtest=foo");
rv[5] = CheckResult(cookie.get(), MUST_CONTAIN, "newtest=reincarnated") != nsnull;
rv[5] = CheckResult(cookie.get(), MUST_CONTAIN, "newtest=reincarnated");
SetACookie(cookieService, "http://multiple.cookies/", nsnull, "test=expiry; domain=.multiple.cookies; max-age=0", nsnull);
GetACookie(cookieService, "http://multiple.cookies/", nsnull, getter_Copies(cookie));
rv[6] = CheckResult(cookie.get(), MUST_NOT_CONTAIN, "test=same");