Bug 605180 - Fix build warnings in netwerk/. r=jduell
authorMs2ger <ms2ger@gmail.com>
Sat, 07 Apr 2012 14:25:00 -0700
changeset 94804 bfa27d58769d5c1d83a2b6d3f6e52d2e98443884
parent 94803 380e6f8bd681ee99176bbb08c05f490cbe6593ee
child 94805 b774546790d72c97debc66afc69ebd9f8a6bcfa9
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs605180
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 605180 - Fix build warnings in netwerk/. r=jduell
netwerk/base/src/nsInputStreamPump.cpp
netwerk/base/src/nsSocketTransport2.cpp
netwerk/base/src/nsStandardURL.cpp
netwerk/base/src/nsURLHelper.cpp
netwerk/cache/nsCacheService.cpp
netwerk/cache/nsDiskCacheBlockFile.h
netwerk/cache/nsDiskCacheDeviceSQL.cpp
netwerk/cookie/nsCookieService.cpp
netwerk/mime/nsMIMEHeaderParamImpl.cpp
netwerk/protocol/data/Makefile.in
netwerk/protocol/device/Makefile.in
netwerk/protocol/file/Makefile.in
netwerk/protocol/ftp/Makefile.in
netwerk/protocol/http/HttpChannelParentListener.cpp
netwerk/protocol/http/PHttpChannelParams.h
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/res/Makefile.in
netwerk/protocol/viewsource/Makefile.in
netwerk/protocol/websocket/Makefile.in
netwerk/protocol/wyciwyg/Makefile.in
netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
netwerk/streamconv/test/TestStreamConv.cpp
netwerk/test/TestCookie.cpp
--- a/netwerk/base/src/nsInputStreamPump.cpp
+++ b/netwerk/base/src/nsInputStreamPump.cpp
@@ -399,16 +399,20 @@ nsInputStreamPump::OnInputStreamReady(ns
             nextState = OnStateStart();
             break;
         case STATE_TRANSFER:
             nextState = OnStateTransfer();
             break;
         case STATE_STOP:
             nextState = OnStateStop();
             break;
+        default:
+            nextState = 0;
+            NS_NOTREACHED("Unknown enum value.");
+            return NS_ERROR_UNEXPECTED;
         }
 
         if (mState == nextState && !mSuspendCount) {
             NS_ASSERTION(mState == STATE_TRANSFER, "unexpected state");
             NS_ASSERTION(NS_SUCCEEDED(mStatus), "unexpected status");
 
             mWaiting = false;
             mStatus = EnsureWaiting();
--- a/netwerk/base/src/nsSocketTransport2.cpp
+++ b/netwerk/base/src/nsSocketTransport2.cpp
@@ -338,17 +338,17 @@ nsSocketInputStream::Available(PRUint32 
 
 NS_IMETHODIMP
 nsSocketInputStream::Read(char *buf, PRUint32 count, PRUint32 *countRead)
 {
     SOCKET_LOG(("nsSocketInputStream::Read [this=%x count=%u]\n", this, count));
 
     *countRead = 0;
 
-    PRFileDesc *fd;
+    PRFileDesc* fd = nsnull;
     {
         MutexAutoLock lock(mTransport->mLock);
 
         if (NS_FAILED(mCondition))
             return (mCondition == NS_BASE_STREAM_CLOSED) ? NS_OK : mCondition;
 
         fd = mTransport->GetFD_Locked();
         if (!fd)
@@ -359,17 +359,17 @@ nsSocketInputStream::Read(char *buf, PRU
 
     // cannot hold lock while calling NSPR.  (worried about the fact that PSM
     // synchronously proxies notifications over to the UI thread, which could
     // mistakenly try to re-enter this code.)
     PRInt32 n = PR_Read(fd, buf, count);
 
     SOCKET_LOG(("  PR_Read returned [n=%d]\n", n));
 
-    nsresult rv;
+    nsresult rv = NS_OK;
     {
         MutexAutoLock lock(mTransport->mLock);
 
 #ifdef ENABLE_SOCKET_TRACING
         if (n > 0)
             mTransport->TraceInBuf(buf, n);
 #endif
 
@@ -562,17 +562,17 @@ nsSocketOutputStream::Write(const char *
     SOCKET_LOG(("nsSocketOutputStream::Write [this=%x count=%u]\n", this, count));
 
     *countWritten = 0;
 
     // A write of 0 bytes can be used to force the initial SSL handshake.
     if (count == 0 && mByteCount)
         return NS_OK;
 
-    PRFileDesc *fd;
+    PRFileDesc* fd = nsnull;
     {
         MutexAutoLock lock(mTransport->mLock);
 
         if (NS_FAILED(mCondition))
             return mCondition;
         
         fd = mTransport->GetFD_Locked();
         if (!fd)
@@ -583,23 +583,23 @@ nsSocketOutputStream::Write(const char *
 
     // cannot hold lock while calling NSPR.  (worried about the fact that PSM
     // synchronously proxies notifications over to the UI thread, which could
     // mistakenly try to re-enter this code.)
     PRInt32 n = PR_Write(fd, buf, count);
 
     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);
 
         if (n > 0)
             mByteCount += (*countWritten = n);
         else if (n < 0) {
             PRErrorCode code = PR_GetError();
@@ -1870,17 +1870,17 @@ nsSocketTransport::SetEventSink(nsITrans
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSocketTransport::IsAlive(bool *result)
 {
     *result = false;
 
-    PRFileDesc *fd;
+    PRFileDesc* fd = nsnull;
     {
         MutexAutoLock lock(mLock);
         if (NS_FAILED(mCondition))
             return NS_OK;
         fd = GetFD_Locked();
         if (!fd)
             return NS_OK;
     }
--- a/netwerk/base/src/nsStandardURL.cpp
+++ b/netwerk/base/src/nsStandardURL.cpp
@@ -501,18 +501,18 @@ nsStandardURL::BuildNormalizedSpec(const
 {
     // Assumptions: all member URLSegments must be relative the |spec| argument
     // passed to this function.
 
     // buffers for holding escaped url segments (these will remain empty unless
     // 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;
 
     //
     // escape each URL segment, if necessary, and calculate approximate normalized
     // spec length.
     //
     // [scheme://][username[:password]@]host[:port]/path[?query_string][#ref]
 
--- a/netwerk/base/src/nsURLHelper.cpp
+++ b/netwerk/base/src/nsURLHelper.cpp
@@ -853,18 +853,18 @@ net_ParseMediaType(const nsACString &aMe
     // Trim LWS leading and trailing whitespace from type.  We include '(' in
     // the trailing trim set to catch media-type comments, which are not at all
     // standard, but may occur in rare cases.
     const char* type = net_FindCharNotInSet(start, end, HTTP_LWS);
     const char* typeEnd = net_FindCharInSet(type, end, HTTP_LWS ";(");
 
     const char* charset = "";
     const char* charsetEnd = charset;
-    PRInt32 charsetParamStart;
-    PRInt32 charsetParamEnd;
+    PRInt32 charsetParamStart = 0;
+    PRInt32 charsetParamEnd = 0;
 
     // Iterate over parameters
     bool typeHasCharset = false;
     PRUint32 paramStart = flatStr.FindChar(';', typeEnd - start);
     if (paramStart != PRUint32(kNotFound)) {
         // We have parameters.  Iterate over them.
         PRUint32 curParamStart = paramStart + 1;
         do {
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -1,12 +1,11 @@
 /* -*- 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
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
  * Software distributed under the License is distributed on an "AS IS" basis,
@@ -1382,45 +1381,46 @@ nsCacheService::EvictEntriesForClient(co
 
     nsCacheServiceAutoLock lock;
     nsresult res = NS_OK;
 
     if (storagePolicy == nsICache::STORE_ANYWHERE ||
         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;
         }
     }
 
     return res;
 }
 
 
 nsresult        
--- a/netwerk/cache/nsDiskCacheBlockFile.h
+++ b/netwerk/cache/nsDiskCacheBlockFile.h
@@ -1,11 +1,11 @@
-/* -*- 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
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
  * Software distributed under the License is distributed on an "AS IS" basis,
--- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp
@@ -1890,17 +1890,17 @@ nsOfflineCacheDevice::GetMatchingNamespa
   bool hasRows;
   rv = statement->ExecuteStep(&hasRows);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *out = nsnull;
 
   bool found = false;
   nsCString nsSpec;
-  PRInt32 nsType;
+  PRInt32 nsType = 0;
   nsCString nsData;
 
   while (hasRows)
   {
     PRInt32 itemType;
     rv = statement->GetInt32(2, &itemType);
     NS_ENSURE_SUCCESS(rv, rv);
 
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -79,16 +79,17 @@
 #include "nsNetCID.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsIPrivateBrowsingService.h"
 #include "nsNetCID.h"
 #include "mozilla/storage.h"
 #include "mozilla/FunctionTimer.h"
 #include "mozilla/Util.h" // for DebugOnly
 
+using namespace mozilla;
 using namespace mozilla::net;
 
 /******************************************************************************
  * nsCookieService impl:
  * useful types & constants
  ******************************************************************************/
 
 static nsCookieService *gCookieService;
@@ -3536,17 +3537,17 @@ nsCookieService::CookieExists(nsICookie2
 // by lastAccessed time.
 void
 nsCookieService::FindStaleCookie(nsCookieEntry *aEntry,
                                  PRInt64 aCurrentTime,
                                  nsListIter &aIter)
 {
   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];
 
     // If we found an expired cookie, we're done.
     if (cookie->Expiry() <= aCurrentTime) {
       aIter.entry = aEntry;
       aIter.index = i;
@@ -3667,18 +3668,19 @@ nsCookieService::RemoveCookieFromList(co
     nsCOMPtr<mozIStorageBindingParamsArray> paramsArray(aParamsArray);
     if (!paramsArray) {
       stmt->NewBindingParamsArray(getter_AddRefs(paramsArray));
     }
 
     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"),
                                       aIter.Cookie()->Host());
     NS_ASSERT_SUCCESS(rv);
 
     rv = params->BindUTF8StringByName(NS_LITERAL_CSTRING("path"),
                                       aIter.Cookie()->Path());
@@ -3713,22 +3715,22 @@ nsCookieService::RemoveCookieFromList(co
 
 void
 bindCookieParameters(mozIStorageBindingParamsArray *aParamsArray,
                      const nsCString &aBaseDomain,
                      const nsCookie *aCookie)
 {
   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
   rv = params->BindUTF8StringByName(NS_LITERAL_CSTRING("baseDomain"),
                                     aBaseDomain);
   NS_ASSERT_SUCCESS(rv);
 
   rv = params->BindUTF8StringByName(NS_LITERAL_CSTRING("name"),
--- a/netwerk/mime/nsMIMEHeaderParamImpl.cpp
+++ b/netwerk/mime/nsMIMEHeaderParamImpl.cpp
@@ -1,11 +1,10 @@
 /* -*- 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
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -918,17 +917,17 @@ static const char especials[] = "()<>@,;
 // Decode RFC2047-encoded words in the input and convert the result to UTF-8.
 // If aOverrideCharset is true, charset in RFC2047-encoded words is 
 // ignored and aDefaultCharset is assumed, instead. aDefaultCharset
 // is also used to convert raw octets (without RFC 2047 encoding) to UTF-8.
 //static
 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;
   const char *charsetStart, *charsetEnd;
   char charset[80];
 
   // initialize charset name to an empty string
   charset[0] = '\0';
@@ -1054,9 +1053,8 @@ nsresult DecodeRFC2047Str(const char *aH
   CopyRawHeader(begin, strlen(begin), aDefaultCharset, aResult);
 
   nsCAutoString tempStr(aResult);
   tempStr.ReplaceChar('\t', ' ');
   aResult = tempStr;
 
   return NS_OK;
 }
-
--- a/netwerk/protocol/data/Makefile.in
+++ b/netwerk/protocol/data/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
+FAIL_ON_WARNINGS = 1
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE         = necko
 LIBRARY_NAME   = nkdata_s
 LIBXUL_LIBRARY = 1
 
 FORCE_STATIC_LIB = 1
--- a/netwerk/protocol/device/Makefile.in
+++ b/netwerk/protocol/device/Makefile.in
@@ -33,16 +33,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
+FAIL_ON_WARNINGS = 1
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = deviceprotocol
 LIBRARY_NAME = nkdevice_s
 FORCE_STATIC_LIB = 1
 LIBXUL_LIBRARY = 1
 
--- a/netwerk/protocol/file/Makefile.in
+++ b/netwerk/protocol/file/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
+FAIL_ON_WARNINGS = 1
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE         = necko
 LIBRARY_NAME   = nkfile_s
 LIBXUL_LIBRARY = 1
 XPIDL_MODULE   = necko_file
 GRE_MODULE     = 1
--- a/netwerk/protocol/ftp/Makefile.in
+++ b/netwerk/protocol/ftp/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
+FAIL_ON_WARNINGS = 1
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE         = necko
 LIBRARY_NAME   = nkftp_s
 LIBXUL_LIBRARY = 1
 XPIDL_MODULE   = necko_ftp
 GRE_MODULE     = 1
--- a/netwerk/protocol/http/HttpChannelParentListener.cpp
+++ b/netwerk/protocol/http/HttpChannelParentListener.cpp
@@ -1,11 +1,10 @@
 /* -*- 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
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
--- a/netwerk/protocol/http/PHttpChannelParams.h
+++ b/netwerk/protocol/http/PHttpChannelParams.h
@@ -1,28 +1,27 @@
 /* -*- 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
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
  *
  * 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.
  *
  * Contributor(s):
  *   Jae-Seong Lee-Russo <lusian@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -2374,21 +2374,23 @@ nsHttpChannel::OpenNormalCacheEntry()
     nsCAutoString cacheKey;
     GenerateCacheKey(mPostID, cacheKey);
 
     nsCacheStoragePolicy storagePolicy = DetermineStoragePolicy();
 
     nsCOMPtr<nsICacheSession> session;
     rv = gHttpHandler->GetCacheSession(storagePolicy,
                                        getter_AddRefs(session));
-    if (NS_FAILED(rv)) return rv;
-
-    nsCacheAccessMode accessRequested;
+    if (NS_FAILED(rv))
+        return rv;
+
+    nsCacheAccessMode accessRequested = 0;
     rv = DetermineCacheAccess(&accessRequested);
-    if (NS_FAILED(rv)) return rv;
+    if (NS_FAILED(rv))
+        return rv;
 
     mOnCacheEntryAvailableCallback =
         &nsHttpChannel::OnNormalCacheEntryAvailable;
     rv = session->AsyncOpenCacheEntry(
         cacheKey,
         accessRequested,
         this,
         mLoadFlags & LOAD_BYPASS_LOCAL_CACHE_IF_BUSY);
--- a/netwerk/protocol/res/Makefile.in
+++ b/netwerk/protocol/res/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
+FAIL_ON_WARNINGS = 1
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE         = necko
 LIBRARY_NAME   = nkres_s
 LIBXUL_LIBRARY = 1
 XPIDL_MODULE   = necko_res
 GRE_MODULE     = 1
--- a/netwerk/protocol/viewsource/Makefile.in
+++ b/netwerk/protocol/viewsource/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
+FAIL_ON_WARNINGS = 1
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE         = necko
 LIBRARY_NAME   = nkviewsource_s
 LIBXUL_LIBRARY = 1
 XPIDL_MODULE   = necko_viewsource
 GRE_MODULE     = 1
--- a/netwerk/protocol/websocket/Makefile.in
+++ b/netwerk/protocol/websocket/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK ***** */
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
+FAIL_ON_WARNINGS = 1
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE         = necko
 LIBRARY_NAME   = nkwebsocket_s
 LIBXUL_LIBRARY = 1
 XPIDL_MODULE   = necko_websocket
 GRE_MODULE     = 1
--- a/netwerk/protocol/wyciwyg/Makefile.in
+++ b/netwerk/protocol/wyciwyg/Makefile.in
@@ -33,16 +33,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+FAIL_ON_WARNINGS = 1
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= necko
 LIBRARY_NAME	= nkwyciwyg_s
 LIBXUL_LIBRARY	= 1
 XPIDL_MODULE	= necko_wyciwyg
 GRE_MODULE	= 1
--- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
+++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
@@ -799,17 +799,17 @@ mozTXTToHTMLConv::GlyphHit(const PRUnich
 {
   PRUnichar text0 = aInString[0]; 
   PRUnichar text1 = aInString[1];
   PRUnichar firstChar = (col0 ? text0 : text1);
 
   // 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
   // there are two cases that need to be tried one after another. To avoid a lot of
   // duplicate code, rolling into a loop
 
   i = 0;
   while ( i < 2 )
--- a/netwerk/streamconv/test/TestStreamConv.cpp
+++ b/netwerk/streamconv/test/TestStreamConv.cpp
@@ -98,17 +98,18 @@ public:
         if (NS_FAILED(rv)) return rv;
 
         char *buffer = (char*)nsMemory::Alloc(len + 1);
         if (!buffer) return NS_ERROR_OUT_OF_MEMORY;
 
         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);
 
         return NS_OK;
     }
 
     // nsIRequestObserver methods
     NS_IMETHOD OnStartRequest(nsIRequest* request, nsISupports *ctxt) { return NS_OK; }
--- a/netwerk/test/TestCookie.cpp
+++ b/netwerk/test/TestCookie.cpp
@@ -520,17 +520,17 @@ main(PRInt32 argc, char *argv[])
       // (a later cookie overwriting an earlier one, in the same header string)
       SetACookie(cookieService, "http://multiple.cookies/", nsnull, "test=multiple; domain=.multiple.cookies \n test=different \n test=same; domain=.multiple.cookies \n newtest=ciao \n newtest=foo; max-age=-6 \n newtest=reincarnated", nsnull);
       GetACookie(cookieService, "http://multiple.cookies/", nsnull, getter_Copies(cookie));
       rv[0] = CheckResult(cookie.get(), MUST_NOT_CONTAIN, "test=multiple");
       rv[1] = CheckResult(cookie.get(), MUST_CONTAIN, "test=different");
       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");
       SetACookie(cookieService, "http://multiple.cookies/", nsnull,  "\n test=different; max-age=0 \n", nsnull);
       GetACookie(cookieService, "http://multiple.cookies/", nsnull, getter_Copies(cookie));
       rv[7] = CheckResult(cookie.get(), MUST_NOT_CONTAIN, "test=different");
       SetACookie(cookieService, "http://multiple.cookies/", nsnull,  "newtest=dead; max-age=0", nsnull);
       GetACookie(cookieService, "http://multiple.cookies/", nsnull, getter_Copies(cookie));