Skip to content

Commit

Permalink
Bug 745296 - Enable FAIL_ON_WARNINGS in more of /netwerk r=jduell
Browse files Browse the repository at this point in the history
  • Loading branch information
valenting committed Aug 25, 2012
1 parent c2ed4ab commit 94e0356
Show file tree
Hide file tree
Showing 41 changed files with 109 additions and 70 deletions.
1 change: 1 addition & 0 deletions netwerk/base/public/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

Expand Down
1 change: 1 addition & 0 deletions netwerk/base/src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

Expand Down
6 changes: 3 additions & 3 deletions netwerk/base/src/nsFileStreams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ nsPartialFileInputStream::Init(nsIFile* aFile, uint64_t aStart,
NS_IMETHODIMP
nsPartialFileInputStream::Tell(int64_t *aResult)
{
int64_t tell;
int64_t tell = 0;
nsresult rv = nsFileInputStream::Tell(&tell);
if (NS_SUCCEEDED(rv)) {
*aResult = tell - mStart;
Expand All @@ -611,7 +611,7 @@ nsPartialFileInputStream::Tell(int64_t *aResult)
NS_IMETHODIMP
nsPartialFileInputStream::Available(uint64_t* aResult)
{
uint64_t available;
uint64_t available = 0;
nsresult rv = nsFileInputStream::Available(&available);
if (NS_SUCCEEDED(rv)) {
*aResult = TruncateSize(available);
Expand Down Expand Up @@ -980,4 +980,4 @@ nsFileStream::GetLastModified(int64_t* _retval)
return NS_OK;
}

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
1 change: 1 addition & 0 deletions netwerk/base/src/nsFileStreams.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ class nsPartialFileInputStream : public nsFileInputStream,
{
public:
using nsFileInputStream::Init;
using nsFileInputStream::Read;
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIPARTIALFILEINPUTSTREAM
NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM
Expand Down
4 changes: 3 additions & 1 deletion netwerk/base/src/nsURLParsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,9 @@ nsAuthURLParser::ParseAuthority(const char *auth, int32_t authLen,

// search backwards for @
const char *p = auth + authLen - 1;
for (; (*p != '@') && (p > auth); --p);
for (; (*p != '@') && (p > auth); --p) {
continue;
}
if ( *p == '@' ) {
// auth = <user-info@server-info>
rv = ParseUserInfo(auth, p - auth,
Expand Down
1 change: 1 addition & 0 deletions netwerk/build/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

Expand Down
3 changes: 1 addition & 2 deletions netwerk/cache/nsCacheService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2522,10 +2522,9 @@ nsCacheService::CloseDescriptor(nsCacheEntryDescriptor * descriptor)
// ask entry to remove descriptor
nsCacheEntry * entry = descriptor->CacheEntry();
bool stillActive = entry->RemoveDescriptor(descriptor);
nsresult rv = NS_OK;

if (!entry->IsValid()) {
rv = gService->ProcessPendingRequests(entry);
gService->ProcessPendingRequests(entry);
}

if (!stillActive) {
Expand Down
24 changes: 14 additions & 10 deletions netwerk/cache/nsDiskCacheBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,12 @@ nsDiskCacheBindery::FindActiveBinding(uint32_t hashNumber)
NS_ASSERTION(initialized, "nsDiskCacheBindery not initialized");
// find hash entry for key
HashTableEntry * hashEntry;
hashEntry = (HashTableEntry *) PL_DHashTableOperate(&table, (void*) hashNumber, PL_DHASH_LOOKUP);
hashEntry =
(HashTableEntry *) PL_DHashTableOperate(&table,
(void*)(uintptr_t) hashNumber,
PL_DHASH_LOOKUP);
if (PL_DHASH_ENTRY_IS_FREE(hashEntry)) return nullptr;

// walk list looking for active entry
NS_ASSERTION(hashEntry->mBinding, "hash entry left with no binding");
nsDiskCacheBinding * binding = hashEntry->mBinding;
Expand Down Expand Up @@ -234,9 +237,10 @@ nsDiskCacheBindery::AddBinding(nsDiskCacheBinding * binding)

// find hash entry for key
HashTableEntry * hashEntry;
hashEntry = (HashTableEntry *) PL_DHashTableOperate(&table,
(void*) binding->mRecord.HashNumber(),
PL_DHASH_ADD);
hashEntry = (HashTableEntry *)
PL_DHashTableOperate(&table,
(void *)(uintptr_t) binding->mRecord.HashNumber(),
PL_DHASH_ADD);
if (!hashEntry) return NS_ERROR_OUT_OF_MEMORY;

if (hashEntry->mBinding == nullptr) {
Expand Down Expand Up @@ -296,10 +300,10 @@ nsDiskCacheBindery::RemoveBinding(nsDiskCacheBinding * binding)
if (!initialized) return;

HashTableEntry * hashEntry;
void * key = (void *)binding->mRecord.HashNumber();
void * key = (void *)(uintptr_t)binding->mRecord.HashNumber();

hashEntry = (HashTableEntry*) PL_DHashTableOperate(&table,
(void*) key,
(void*)(uintptr_t) key,
PL_DHASH_LOOKUP);
if (!PL_DHASH_ENTRY_IS_BUSY(hashEntry)) {
NS_WARNING("### disk cache: binding not in hashtable!");
Expand All @@ -309,9 +313,9 @@ nsDiskCacheBindery::RemoveBinding(nsDiskCacheBinding * binding)
if (binding == hashEntry->mBinding) {
if (PR_CLIST_IS_EMPTY(binding)) {
// remove this hash entry
(void) PL_DHashTableOperate(&table,
(void*) binding->mRecord.HashNumber(),
PL_DHASH_REMOVE);
PL_DHashTableOperate(&table,
(void*)(uintptr_t) binding->mRecord.HashNumber(),
PL_DHASH_REMOVE);
return;

} else {
Expand Down
3 changes: 1 addition & 2 deletions netwerk/cache/nsDiskCacheStreams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,10 @@ nsDiskCacheInputStream::Read(char * buffer, uint32_t count, uint32_t * bytesRead
// just read from file
int32_t result = PR_Read(mFD, buffer, count);
if (result < 0) {
PRErrorCode error = PR_GetError();
nsresult rv = NS_ErrorAccordingToNSPR();
CACHE_LOG_DEBUG(("CACHE: nsDiskCacheInputStream::Read PR_Read failed"
"[stream=%p, rv=%d, NSPR error %s",
this, int(rv), PR_ErrorToName(error)));
this, int(rv), PR_ErrorToName(PR_GetError())));
return rv;
}

Expand Down
1 change: 1 addition & 0 deletions netwerk/cookie/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = @relativesrcdir@
FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

Expand Down
9 changes: 6 additions & 3 deletions netwerk/cookie/nsCookieService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2829,15 +2829,17 @@ nsCookieService::GetTokenValue(nsASingleFragmentCString::const_char_iterator &aI
// remove trailing <LWS>; first check we're not at the beginning
lastSpace = aIter;
if (lastSpace != start) {
while (--lastSpace != start && iswhitespace(*lastSpace));
while (--lastSpace != start && iswhitespace(*lastSpace))
continue;
++lastSpace;
}
aTokenString.Rebind(start, lastSpace);

aEqualsFound = (*aIter == '=');
if (aEqualsFound) {
// find <value>
while (++aIter != aEndIter && iswhitespace(*aIter));
while (++aIter != aEndIter && iswhitespace(*aIter))
continue;

start = aIter;

Expand All @@ -2849,7 +2851,8 @@ nsCookieService::GetTokenValue(nsASingleFragmentCString::const_char_iterator &aI
// remove trailing <LWS>; first check we're not at the beginning
if (aIter != start) {
lastSpace = aIter;
while (--lastSpace != start && iswhitespace(*lastSpace));
while (--lastSpace != start && iswhitespace(*lastSpace))
continue;
aTokenValue.Rebind(start, ++lastSpace);
}
}
Expand Down
1 change: 1 addition & 0 deletions netwerk/dns/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

Expand Down
1 change: 1 addition & 0 deletions netwerk/ipc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

Expand Down
1 change: 1 addition & 0 deletions netwerk/mime/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

Expand Down
2 changes: 1 addition & 1 deletion netwerk/mime/nsMIMEHeaderParamImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ nsMIMEHeaderParamImpl::DecodeRFC5987Param(const nsACString& aParamVal,
if (tc == '\'') {
// single quote
delimiters++;
} else if (tc >= 128) {
} else if (((unsigned char)tc) >= 128) {
// fail early, not ASCII
NS_WARNING("non-US-ASCII character in RFC5987-encoded param");
return NS_ERROR_INVALID_ARG;
Expand Down
1 change: 1 addition & 0 deletions netwerk/protocol/about/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

Expand Down
9 changes: 4 additions & 5 deletions netwerk/protocol/about/nsAboutBlank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ NS_IMETHODIMP
nsAboutBlank::NewChannel(nsIURI *aURI, nsIChannel **result)
{
NS_ENSURE_ARG_POINTER(aURI);
nsresult rv;
nsIChannel* channel;

nsCOMPtr<nsIInputStream> in;
rv = NS_NewCStringInputStream(getter_AddRefs(in), EmptyCString());
nsresult rv = NS_NewCStringInputStream(getter_AddRefs(in), EmptyCString());
if (NS_FAILED(rv)) return rv;

rv = NS_NewInputStreamChannel(&channel, aURI, in,
nsCOMPtr<nsIChannel> channel;
rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aURI, in,
NS_LITERAL_CSTRING("text/html"),
NS_LITERAL_CSTRING("utf-8"));
if (NS_FAILED(rv)) return rv;

*result = channel;
channel.forget(result);
return rv;
}

Expand Down
6 changes: 3 additions & 3 deletions netwerk/protocol/about/nsAboutCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ nsAboutCache::NewChannel(nsIURI *aURI, nsIChannel **result)
rv = storageStream->NewInputStream(0, getter_AddRefs(inStr));
if (NS_FAILED(rv)) return rv;

nsIChannel* channel;
rv = NS_NewInputStreamChannel(&channel, aURI, inStr,
nsCOMPtr<nsIChannel> channel;
rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aURI, inStr,
NS_LITERAL_CSTRING("text/html"),
NS_LITERAL_CSTRING("utf-8"));
if (NS_FAILED(rv)) return rv;

*result = channel;
channel.forget(result);
return rv;
}

Expand Down
1 change: 1 addition & 0 deletions netwerk/protocol/http/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

Expand Down
5 changes: 3 additions & 2 deletions netwerk/protocol/http/nsHttpConnectionMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ nsresult
nsHttpConnectionMgr::UpdateParam(nsParamName name, uint16_t value)
{
uint32_t param = (uint32_t(name) << 16) | uint32_t(value);
return PostEvent(&nsHttpConnectionMgr::OnMsgUpdateParam, 0, (void *) param);
return PostEvent(&nsHttpConnectionMgr::OnMsgUpdateParam, 0,
(void *)(uintptr_t) param);
}

nsresult
Expand Down Expand Up @@ -953,7 +954,7 @@ nsHttpConnectionMgr::ProcessPendingQForEntry(nsConnectionEntry *ent)
if (dispatchedSuccessfully)
return true;

NS_ABORT_IF_FALSE(count == ((int32_t) ent->mPendingQ.Length()),
NS_ABORT_IF_FALSE(count == ent->mPendingQ.Length(),
"something mutated pending queue from "
"GetConnection()");
}
Expand Down
3 changes: 1 addition & 2 deletions netwerk/protocol/http/nsHttpHeaderArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ nsresult
nsHttpHeaderArray::SetHeaderFromNet(nsHttpAtom header, const nsACString &value)
{
nsEntry *entry = nullptr;
int32_t index;

index = LookupEntry(header, &entry);
LookupEntry(header, &entry);

if (!entry) {
if (value.IsEmpty()) {
Expand Down
1 change: 0 additions & 1 deletion netwerk/protocol/http/nsHttpPipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class nsHttpPipeline : public nsAHttpConnection

// used when calling ReadSegments/WriteSegments on a transaction.
nsAHttpSegmentReader *mReader;
nsAHttpSegmentWriter *mWriter;

// send buffer
nsCOMPtr<nsIInputStream> mSendBufIn;
Expand Down
1 change: 1 addition & 0 deletions netwerk/socket/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

Expand Down
8 changes: 4 additions & 4 deletions netwerk/socket/nsSOCKSIOLayer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:set expandtab ts=4 sw=4 sts=4 cin: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

Expand Down Expand Up @@ -934,7 +934,7 @@ nsSOCKSSocketInfo::ReadUint32()
void
nsSOCKSSocketInfo::ReadNetAddr(PRNetAddr *addr, uint16_t fam)
{
uint32_t amt;
uint32_t amt = 0;
const uint8_t *ip = mData + mReadOffset;

addr->raw.family = fam;
Expand Down
1 change: 1 addition & 0 deletions netwerk/streamconv/converters/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

Expand Down
5 changes: 0 additions & 5 deletions netwerk/streamconv/converters/ParseFTPList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ int ParseFTPList(const char *line, struct list_state *state,
return 0;

memset( result, 0, sizeof(*result) );
if (state->magic != ((void *)ParseFTPList))
{
memset( state, 0, sizeof(*state) );
state->magic = ((void *)ParseFTPList);
}
state->numlines++;

/* carry buffer is only valid from one line to the next */
Expand Down
5 changes: 4 additions & 1 deletion netwerk/streamconv/converters/ParseFTPList.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@

struct list_state
{
void *magic; /* to determine if previously initialized */
list_state() {
memset(this, 0, sizeof(*this));
}

PRTime now_time; /* needed for year determination */
PRExplodedTime now_tm; /* needed for year determination */
int32_t lstyle; /* LISTing style */
Expand Down
1 change: 0 additions & 1 deletion netwerk/streamconv/converters/nsFTPDirListingConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ nsFTPDirListingConv::DigestBufferLines(char *aBuffer, nsCString &aString) {
bool cr = false;

list_state state;
state.magic = 0;

// while we have new lines, parse 'em into application/http-index-format.
while ( line && (eol = PL_strchr(line, nsCRT::LF)) ) {
Expand Down
Loading

0 comments on commit 94e0356

Please sign in to comment.