Bug 794510: Part 6 - Fixups needed to build on Windows and Android and Mac OS X debug, plus shorten comment to be less than 80 columns; r=ehsan
authorBrian Smith <bsmith@mozilla.com>
Thu, 18 Oct 2012 15:55:48 -0400
changeset 110848 62627192e1563789da8b97907ffd342f4348f31d
parent 110847 52b59d7cff7c7fe85e4664a163ee3cd6df17e374
child 110849 1167feab3ae545d1f006525c9fbc8bbabc1677f5
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersehsan
bugs794510
milestone19.0a1
Bug 794510: Part 6 - Fixups needed to build on Windows and Android and Mac OS X debug, plus shorten comment to be less than 80 columns; r=ehsan
extensions/gio/nsGIOProtocolHandler.cpp
modules/libjar/nsJARInputStream.cpp
netwerk/base/src/nsDirectoryIndexStream.cpp
netwerk/cookie/nsCookieService.cpp
netwerk/protocol/about/nsAboutBloat.cpp
netwerk/protocol/about/nsAboutCache.cpp
netwerk/protocol/about/nsAboutCacheEntry.cpp
netwerk/streamconv/converters/nsFTPDirListingConv.cpp
netwerk/test/TestProtocols.cpp
rdf/base/src/rdfutil.cpp
security/manager/ssl/src/nsCertTree.cpp
toolkit/profile/nsToolkitProfileService.cpp
tools/trace-malloc/lib/nsDebugHelpWin32.cpp
tools/trace-malloc/lib/nsTraceMalloc.c
tools/trace-malloc/lib/nsTraceMallocCallbacks.h
tools/trace-malloc/spacetrace.c
tools/trace-malloc/spacetrace.h
tools/trace-malloc/tmreader.h
widget/cocoa/nsCocoaFeatures.h
xpcom/base/NSPRFormatTime.h
xpcom/glue/nsCRTGlue.cpp
--- a/extensions/gio/nsGIOProtocolHandler.cpp
+++ b/extensions/gio/nsGIOProtocolHandler.cpp
@@ -2,17 +2,17 @@
 /* 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/. */
 
 /*
  * This code is based on original Mozilla gnome-vfs extension. It implements
  * input stream provided by GVFS/GIO.
 */
-#include "NSPRFormatTime.h" // must include before any headers that include prtime.h
+#include "NSPRFormatTime.h" // must be before anything that includes prtime.h
 #include "mozilla/ModuleUtils.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIObserver.h"
 #include "nsThreadUtils.h"
 #include "nsProxyRelease.h"
 #include "nsIStringBundle.h"
 #include "nsIStandardURL.h"
--- a/modules/libjar/nsJARInputStream.cpp
+++ b/modules/libjar/nsJARInputStream.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* nsJARInputStream.cpp
  * 
  * 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/. */
 
-#include "NSPRFormatTime.h" // must include before any headers that include prtime.h
+#include "NSPRFormatTime.h" // must be before anything that includes prtime.h
 #include "nsJARInputStream.h"
 #include "zipstruct.h"         // defines ZIP compression codes
 #include "nsZipArchive.h"
 
 #include "nsNetUtil.h"
 #include "nsEscape.h"
 #include "nsIFile.h"
 #include "nsDebug.h"
--- a/netwerk/base/src/nsDirectoryIndexStream.cpp
+++ b/netwerk/base/src/nsDirectoryIndexStream.cpp
@@ -9,17 +9,17 @@
 
   The converts a filesystem directory into an "HTTP index" stream per
   Lou Montulli's original spec:
 
   http://www.mozilla.org/projects/netlib/dirindexformat.html
 
  */
 
-#include "NSPRFormatTime.h" // must include before any headers that include prtime.h
+#include "NSPRFormatTime.h" // must be before anything that includes prtime.h
 #include "nsEscape.h"
 #include "nsDirectoryIndexStream.h"
 #include "nsXPIDLString.h"
 #include "prio.h"
 #include "prlog.h"
 #include "prlong.h"
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gLog;
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #ifdef MOZ_LOGGING
 // this next define has to appear before the include of prlog.h
 #define FORCE_PR_LOG // Allow logging in the release build
 #endif
 
-#include "NSPRFormatTime.h" // must include before any headers that include prtime.h
+#include "NSPRFormatTime.h" // must be before anything that includes prtime.h
 #include "mozilla/net/CookieServiceChild.h"
 #include "mozilla/net/NeckoCommon.h"
 
 #include "nsCookieService.h"
 #include "nsIServiceManager.h"
 
 #include "nsIIOService.h"
 #include "nsIPrefBranch.h"
--- a/netwerk/protocol/about/nsAboutBloat.cpp
+++ b/netwerk/protocol/about/nsAboutBloat.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
-#include "NSPRFormatTime.h" // must include before any headers that include prtime.h
+#include "NSPRFormatTime.h" // must be before anything that includes prtime.h
 #include "nsTraceRefcntImpl.h"
 
 // if NS_BUILD_REFCNT_LOGGING isn't defined, don't try to build
 #ifdef NS_BUILD_REFCNT_LOGGING
 
 #include "nsAboutBloat.h"
 #include "nsIIOService.h"
 #include "nsIServiceManager.h"
--- a/netwerk/protocol/about/nsAboutCache.cpp
+++ b/netwerk/protocol/about/nsAboutCache.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
-#include "NSPRFormatTime.h" // must include before any headers that include prtime.h
+#include "NSPRFormatTime.h" // must be before anything that includes prtime.h
 #include "nsAboutCache.h"
 #include "nsIIOService.h"
 #include "nsIServiceManager.h"
 #include "nsIInputStream.h"
 #include "nsIStorageStream.h"
 #include "nsISimpleEnumerator.h"
 #include "nsXPIDLString.h"
 #include "nsIURI.h"
--- a/netwerk/protocol/about/nsAboutCacheEntry.cpp
+++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp
@@ -1,16 +1,16 @@
 /* -*- 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
  * 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/. */
 
 #include <limits.h>
 
-#include "NSPRFormatTime.h" // must include before any headers that include prtime.h
+#include "NSPRFormatTime.h" // must be before anything that includes prtime.h
 #include "nsAboutCacheEntry.h"
 #include "nsICacheService.h"
 #include "nsICacheSession.h"
 #include "nsIStorageStream.h"
 #include "nsNetUtil.h"
 #include "nsAutoPtr.h"
 #include "prprf.h"
 #include "nsEscape.h"
--- a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp
+++ b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
-#include "NSPRFormatTime.h" // must include before any headers that include prtime.h
+#include "NSPRFormatTime.h" // must be before anything that includes prtime.h
 #include "nsFTPDirListingConv.h"
 #include "nsMemory.h"
 #include "plstr.h"
 #include "prlog.h"
 #include "nsIServiceManager.h"
 #include "nsXPIDLString.h"
 #include "nsReadableUtils.h"
 #include "nsCOMPtr.h"
--- a/netwerk/test/TestProtocols.cpp
+++ b/netwerk/test/TestProtocols.cpp
@@ -7,17 +7,17 @@
 /* 
     The TestProtocols tests the basic protocols architecture and can 
     be used to test individual protocols as well. If this grows too
     big then we should split it to individual protocols. 
 
     -Gagan Saksena 04/29/99
 */
 
-#include "NSPRFormatTime.h" // must include before any headers that include prtime.h
+#include "NSPRFormatTime.h" // must be before anything that includes prtime.h
 #include "TestCommon.h"
 
 #define FORCE_PR_LOG
 #include <stdio.h>
 #ifdef WIN32 
 #include <windows.h>
 #endif
 #ifdef XP_UNIX
--- a/rdf/base/src/rdfutil.cpp
+++ b/rdf/base/src/rdfutil.cpp
@@ -14,17 +14,17 @@
   1) Make this so that it doesn't permanently leak the RDF service
      object.
 
   2) Make container functions thread-safe. They currently don't ensure
      that the RDF:nextVal property is maintained safely.
 
  */
 
-#include "NSPRFormatTime.h" // must include before any headers that include prtime.h
+#include "NSPRFormatTime.h" // must be before anything that includes prtime.h
 #include "nsCOMPtr.h"
 #include "nsIRDFDataSource.h"
 #include "nsIRDFNode.h"
 #include "nsIRDFService.h"
 #include "nsIServiceManager.h"
 #include "nsIURL.h"
 #include "nsIIOService.h"
 #include "nsIURL.h"
--- a/security/manager/ssl/src/nsCertTree.cpp
+++ b/security/manager/ssl/src/nsCertTree.cpp
@@ -1,13 +1,13 @@
 /* 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/. */
 
-#include "NSPRFormatTime.h" // must include before any headers that include prtime.h
+#include "NSPRFormatTime.h" // must be before anything that includes prtime.h
 #include "nsNSSComponent.h" // for PIPNSS string bundle calls.
 #include "nsCertTree.h"
 #include "nsITreeColumns.h"
 #include "nsIX509Cert.h"
 #include "nsIX509CertValidity.h"
 #include "nsIX509CertDB.h"
 #include "nsXPIDLString.h"
 #include "nsReadableUtils.h"
--- a/toolkit/profile/nsToolkitProfileService.cpp
+++ b/toolkit/profile/nsToolkitProfileService.cpp
@@ -604,17 +604,17 @@ static const char kTable[] =
       'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
       '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
 
 static void SaltProfileName(nsACString& aName)
 {
     double fpTime = double(PR_Now());
 
     // use 1e-6, granularity of PR_Now() on the mac is seconds
-    srand((uint)(fpTime * 1e-6 + 0.5));
+    srand((unsigned int)(fpTime * 1e-6 + 0.5));
 
     char salt[9];
 
     int i;
     for (i = 0; i < 8; ++i)
         salt[i] = kTable[rand() % ArrayLength(kTable)];
 
     salt[8] = '.';
--- a/tools/trace-malloc/lib/nsDebugHelpWin32.cpp
+++ b/tools/trace-malloc/lib/nsDebugHelpWin32.cpp
@@ -219,17 +219,17 @@ DHWImportHooker::PatchOneModule(HMODULE 
     if(aModule == mIgnoreModule)
     {
         return true;
     }
 
     // do the fun stuff...
 
     PIMAGE_IMPORT_DESCRIPTOR desc;
-    uint32_t size;
+    ULONG size;
 
     desc = (PIMAGE_IMPORT_DESCRIPTOR) 
         dhwImageDirectoryEntryToData(aModule, true, 
                                      IMAGE_DIRECTORY_ENTRY_IMPORT, &size);
 
     if(!desc)
     {
         return true;
--- a/tools/trace-malloc/lib/nsTraceMalloc.c
+++ b/tools/trace-malloc/lib/nsTraceMalloc.c
@@ -91,18 +91,18 @@ typedef struct logfile logfile;
 #define LOGFILE_TMBUFSIZE (16 * 1024)
 
 struct logfile {
     int         fd;
     int         lfd;            /* logical fd, dense among all logfiles */
     char        *buf;
     int         bufsize;
     int         pos;
-    uint32_t      size;
-    uint32_t      simsize;
+    uint32_t    size;
+    uint32_t    simsize;
     logfile     *next;
     logfile     **prevp;
 };
 
 static char      default_buf[STARTUP_TMBUFSIZE];
 static logfile   default_logfile =
                    {-1, 0, default_buf, STARTUP_TMBUFSIZE, 0, 0, 0, NULL, NULL};
 static logfile   *logfile_list = NULL;
@@ -263,17 +263,17 @@ tm_get_thread(void)
 
         PR_ASSERT(stack_tm_thread.suppress_tracing == 1); /* balanced */
     }
 
     return t;
 }
 
 /* We don't want more than 32 logfiles open at once, ok? */
-typedef uint32_t          lfd_set;
+typedef uint32_t        lfd_set;
 
 #define LFD_SET_STATIC_INITIALIZER 0
 #define LFD_SET_SIZE    32
 
 #define LFD_ZERO(s)     (*(s) = 0)
 #define LFD_BIT(i)      ((uint32_t)1 << (i))
 #define LFD_TEST(i,s)   (LFD_BIT(i) & *(s))
 #define LFD_SET(i,s)    (*(s) |= LFD_BIT(i))
--- a/tools/trace-malloc/lib/nsTraceMallocCallbacks.h
+++ b/tools/trace-malloc/lib/nsTraceMallocCallbacks.h
@@ -4,16 +4,17 @@
  * 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/. */
 
 /* declarations needed by both nsTraceMalloc.c and nsWinTraceMalloc.cpp */
 
 #ifndef NSTRACEMALLOCCALLBACKS_H
 #define NSTRACEMALLOCCALLBACKS_H
 
+#include "mozilla/StandardInteger.h"
 #include <stdlib.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /* Used by backtrace. */
 typedef struct stack_buffer_info {
--- a/tools/trace-malloc/spacetrace.c
+++ b/tools/trace-malloc/spacetrace.c
@@ -114,17 +114,17 @@ ticks2xsec(tmreader * aReader, uint32_t 
     uint64_t bigone;
     uint64_t tmp64;
 
     LL_UI2L(bigone, aResolution);
     LL_UI2L(tmp64, aTicks);
     bigone *= tmp64;
     LL_UI2L(tmp64, aReader->ticksPerSec);
     bigone /= tmp64;
-    return (uint32)bigone;
+    return (uint32_t)bigone;
 }
 
 #define ticks2msec(reader, ticks) ticks2xsec((reader), (ticks), 1000)
 #define ticks2usec(reader, ticks) ticks2xsec((reader), (ticks), 1000000)
 
 /*
 ** initOptions
 **
--- a/tools/trace-malloc/spacetrace.h
+++ b/tools/trace-malloc/spacetrace.h
@@ -12,16 +12,17 @@
 **
 ** SpaceTrace is meant to take the output of trace-malloc and present
 **   a picture of allocations over the run of the application.
 */
 
 /*
 ** Required includes.
 */
+#include "mozilla/StandardInteger.h"
 #include "nspr.h"
 #include "prlock.h"
 #include "prrwlock.h"
 #include "nsTraceMalloc.h"
 #include "tmreader.h"
 #include "formdata.h"
 
 /*
--- a/tools/trace-malloc/tmreader.h
+++ b/tools/trace-malloc/tmreader.h
@@ -1,17 +1,16 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  *
  * 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/. */
 #ifndef tmreader_h___
 #define tmreader_h___
 
-#include "prtypes.h"
 #include "plhash.h"
 #include "nsTraceMalloc.h"
 #include "plarena.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
@@ -22,25 +21,25 @@ typedef struct tmallcounts  tmallcounts;
 typedef struct tmgraphlink  tmgraphlink;
 typedef struct tmgraphedge  tmgraphedge;
 typedef struct tmgraphnode  tmgraphnode;
 typedef struct tmcallsite   tmcallsite;
 typedef struct tmmethodnode tmmethodnode;
 
 struct tmevent {
     char            type;
-    uint32_t          serial;
+    uint32_t        serial;
     union {
         char        *libname;
         char        *srcname;
         struct {
             uint32_t  library;
             uint32_t  filename;
             uint32_t  linenumber;
-            char    *name;
+            char      *name;
         } method;
         struct {
             uint32_t  parent;
             uint32_t  method;
             uint32_t  offset;
         } site;
         struct {
             uint32_t  interval; /* in ticks */
@@ -81,17 +80,17 @@ struct tmgraphnode {
     tmallcounts     frees;
     double          sqsum;      /* sum of squared bytes.direct */
     int             sort;       /* sorted index in node table, -1 if no table */
 };
 
 struct tmmethodnode {
     tmgraphnode   graphnode;
     char          *sourcefile;
-    uint32_t        linenumber;
+    uint32_t      linenumber;
 };
 
 #define tmgraphnode_name(node)  ((char*) (node)->entry.value)
 #define tmmethodnode_name(node)  ((char*) (node)->graphnode.entry.value)
 
 #define tmlibrary_serial(lib)   ((uint32_t) (lib)->entry.key)
 #define tmcomponent_name(comp)  ((const char*) (comp)->entry.key)
 #define filename_name(hashentry) ((char*)hashentry->value)
@@ -121,17 +120,17 @@ struct tmgraphedge {
 #define TM_LINK_TO_EDGE(link,which) ((tmgraphedge*) &(link)[-(which)])
 
 struct tmcallsite {
     PLHashEntry     entry;      /* key is site serial number */
     tmcallsite      *parent;    /* calling site */
     tmcallsite      *siblings;  /* other sites reached from parent */
     tmcallsite      *kids;      /* sites reached from here */
     tmmethodnode    *method;    /* method node in tmr->methods graph */
-    uint32_t          offset;     /* pc offset from start of method */
+    uint32_t        offset;     /* pc offset from start of method */
     tmallcounts     allocs;
     tmallcounts     frees;
     void            *data;      /* tmreader clients can stick arbitrary
                                  *  data onto a callsite.
                                  */
 };
 
 struct tmreader {
@@ -139,17 +138,17 @@ struct tmreader {
     void            *data;
     PLHashTable     *libraries;
     PLHashTable     *filenames;
     PLHashTable     *components;
     PLHashTable     *methods;
     PLHashTable     *callsites;
     PLArenaPool     arena;
     tmcallsite      calltree_root;
-    uint32_t          ticksPerSec;
+    uint32_t        ticksPerSec;
 };
 
 typedef void (*tmeventhandler)(tmreader *tmr, tmevent *event);
 
 /* The tmreader constructor and destructor. */
 extern tmreader     *tmreader_new(const char *program, void *data);
 extern void         tmreader_destroy(tmreader *tmr);
 
--- a/widget/cocoa/nsCocoaFeatures.h
+++ b/widget/cocoa/nsCocoaFeatures.h
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #ifndef nsCocoaFeatures_h_
 #define nsCocoaFeatures_h_
 
+#include "mozilla/StandardInteger.h"
 #include "prtypes.h"
 
 class nsCocoaFeatures {
 public:
   static int32_t OSXVersion();
   static bool OnSnowLeopardOrLater();
   static bool OnLionOrLater();
   static bool SupportCoreAnimationPlugins();
--- a/xpcom/base/NSPRFormatTime.h
+++ b/xpcom/base/NSPRFormatTime.h
@@ -1,9 +1,12 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
 // Temporarily undefine to build successfully with NO_NSPR_10_SUPPORT
+#ifdef prtime_h___
+#error NSPRFormatTime.h must be included before any header that includes prtime.h
+#endif
 #undef NO_NSPR_10_SUPPORT
 #include "prtime.h"
 #define NO_NSPR_10_SUPPORT
--- a/xpcom/glue/nsCRTGlue.cpp
+++ b/xpcom/glue/nsCRTGlue.cpp
@@ -247,17 +247,17 @@ static const char table[] = {
   '4','5','6','7','8','9'
 };
 
 void NS_MakeRandomString(char *aBuf, int32_t aBufLen)
 {
   // turn PR_Now() into milliseconds since epoch
   // and salt rand with that.
   double fpTime = double(PR_Now());
-  srand((uint)(fpTime * 1e-6 + 0.5));   // use 1e-6, granularity of PR_Now() on the mac is seconds
+  srand((unsigned int)(fpTime * 1e-6 + 0.5));   // use 1e-6, granularity of PR_Now() on the mac is seconds
 
   int32_t i;
   for (i=0;i<aBufLen;i++) {
     *aBuf++ = table[rand()%TABLE_SIZE];
   }
   *aBuf = 0;
 }