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

This commit is contained in:
Ms2ger 2012-04-07 14:25:00 -07:00
Родитель 917295d881
Коммит 4f0704cc9f
23 изменённых файлов: 56 добавлений и 43 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

20
netwerk/cache/nsCacheService.cpp поставляемый
Просмотреть файл

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

6
netwerk/cache/nsDiskCacheBlockFile.h поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- /* -*- 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 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * The contents of this file are subject to the Mozilla Public License Version

2
netwerk/cache/nsDiskCacheDeviceSQL.cpp поставляемый
Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- 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 ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * 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, nsresult DecodeRFC2047Str(const char *aHeader, const char *aDefaultCharset,
bool aOverrideCharset, nsACString &aResult) bool aOverrideCharset, nsACString &aResult)
{ {
const char *p, *q, *r; const char *p, *q = nsnull, *r;
char *decodedText; char *decodedText;
const char *begin; // tracking pointer for where we are in the input buffer const char *begin; // tracking pointer for where we are in the input buffer
PRInt32 isLastEncodedWord = 0; PRInt32 isLastEncodedWord = 0;
@ -1059,4 +1058,3 @@ nsresult DecodeRFC2047Str(const char *aHeader, const char *aDefaultCharset,
return NS_OK; return NS_OK;
} }

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -103,7 +103,8 @@ public:
rv = inStr->Read(buffer, len, &read); rv = inStr->Read(buffer, len, &read);
buffer[len] = '\0'; buffer[len] = '\0';
if (NS_SUCCEEDED(rv)) { 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); nsMemory::Free(buffer);

Просмотреть файл

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