Bug 784739 - Switch from NULL to nullptr in gfx/src/; r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Sat, 20 Jul 2013 11:48:56 +0300
changeset 151746 81b78a2ca7694888ac98b15de3c1f360a09d1f99
parent 151745 a36bd2e1c291b2cdfe9c33645f892beb6eb4c25e
child 151747 e37652a7c199d2e9580de3eb6d747cb0bbcbfba0
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs784739
milestone25.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 784739 - Switch from NULL to nullptr in gfx/src/; r=ehsan
gfx/src/X11Util.h
gfx/src/nsDeviceContext.cpp
gfx/src/nsDeviceContext.h
gfx/src/nsScriptableRegion.cpp
gfx/src/nsThebesGfxFactory.cpp
--- a/gfx/src/X11Util.h
+++ b/gfx/src/X11Util.h
@@ -39,18 +39,18 @@ DefaultXDisplay()
 #elif defined(MOZ_WIDGET_QT)
   return gfxQtPlatform::GetXDisplay();
 #endif
 }
 
 /**
  * Sets *aVisual to point to aDisplay's Visual struct corresponding to
  * aVisualID, and *aDepth to its depth.  When aVisualID is None, these are set
- * to NULL and 0 respectively.  Both out-parameter pointers are assumed
- * non-NULL.
+ * to nullptr and 0 respectively.  Both out-parameter pointers are assumed
+ * non-nullptr.
  */
 void
 FindVisualAndDepth(Display* aDisplay, VisualID aVisualID,
                    Visual** aVisual, int* aDepth);
 
 
 /**
  * Ensure that all X requests have been processed.
@@ -67,18 +67,18 @@ FinishX(Display* aDisplay);
 /**
  * Invoke XFree() on a pointer to memory allocated by Xlib (if the
  * pointer is nonnull) when this class goes out of scope.
  */
 template <typename T>
 struct ScopedXFreePtrTraits
 {
   typedef T *type;
-  static T *empty() { return NULL; }
-  static void release(T *ptr) { if (ptr!=NULL) XFree(ptr); }
+  static T *empty() { return nullptr; }
+  static void release(T *ptr) { if (ptr != nullptr) XFree(ptr); }
 };
 SCOPED_TEMPLATE(ScopedXFree, ScopedXFreePtrTraits)
 
 /**
  * On construction, set a graceful X error handler that doesn't crash the application and records X errors.
  * On destruction, restore the X error handler to what it was before construction.
  * 
  * The SyncAndGetError() method allows to know whether a X error occurred, optionally allows to get the full XErrorEvent,
--- a/gfx/src/nsDeviceContext.cpp
+++ b/gfx/src/nsDeviceContext.cpp
@@ -271,17 +271,17 @@ nsDeviceContext::FontMetricsDeleted(cons
         mFontCache->FontMetricsDeleted(aFontMetrics);
     }
     return NS_OK;
 }
 
 bool
 nsDeviceContext::IsPrinterSurface()
 {
-    return(mPrintingSurface != NULL);
+    return mPrintingSurface != nullptr;
 }
 
 void
 nsDeviceContext::SetDPI()
 {
     float dpi = -1.0f;
 
     // PostScript, PDF and Mac (when printing) all use 72 dpi
--- a/gfx/src/nsDeviceContext.h
+++ b/gfx/src/nsDeviceContext.h
@@ -158,17 +158,17 @@ public:
     nsresult GetClientRect(nsRect& aRect);
 
     /**
      * Inform the output device that output of a document is beginning
      * Used for print related device contexts. Must be matched 1:1 with
      * EndDocument() or AbortDocument().
      *
      * @param aTitle - title of Document
-     * @param aPrintToFileName - name of file to print to, if NULL
+     * @param aPrintToFileName - name of file to print to, if nullptr
      * then don't print to file
      * @param aStartPage - starting page number (must be greater than zero)
      * @param aEndPage - ending page number (must be less than or
      * equal to number of pages)
      *
      * @return error status
      */
     nsresult BeginDocument(PRUnichar  *aTitle,
--- a/gfx/src/nsScriptableRegion.cpp
+++ b/gfx/src/nsScriptableRegion.cpp
@@ -134,19 +134,19 @@ NS_IMETHODIMP nsScriptableRegion::GetRec
 
   *aRects = OBJECT_TO_JSVAL(destArray);
 
   uint32_t n = 0;
   nsIntRegionRectIterator iter(mRegion);
   const nsIntRect *rect;
 
   while ((rect = iter.Next())) {
-    if (!JS_DefineElement(aCx, destArray, n, INT_TO_JSVAL(rect->x), NULL, NULL, JSPROP_ENUMERATE) ||
-        !JS_DefineElement(aCx, destArray, n + 1, INT_TO_JSVAL(rect->y), NULL, NULL, JSPROP_ENUMERATE) ||
-        !JS_DefineElement(aCx, destArray, n + 2, INT_TO_JSVAL(rect->width), NULL, NULL, JSPROP_ENUMERATE) ||
-        !JS_DefineElement(aCx, destArray, n + 3, INT_TO_JSVAL(rect->height), NULL, NULL, JSPROP_ENUMERATE)) {
+    if (!JS_DefineElement(aCx, destArray, n, INT_TO_JSVAL(rect->x), nullptr, nullptr, JSPROP_ENUMERATE) ||
+        !JS_DefineElement(aCx, destArray, n + 1, INT_TO_JSVAL(rect->y), nullptr, nullptr, JSPROP_ENUMERATE) ||
+        !JS_DefineElement(aCx, destArray, n + 2, INT_TO_JSVAL(rect->width), nullptr, nullptr, JSPROP_ENUMERATE) ||
+        !JS_DefineElement(aCx, destArray, n + 3, INT_TO_JSVAL(rect->height), nullptr, nullptr, JSPROP_ENUMERATE)) {
       return NS_ERROR_FAILURE;
     }
     n += 4;
   }
 
   return NS_OK;
 }
--- a/gfx/src/nsThebesGfxFactory.cpp
+++ b/gfx/src/nsThebesGfxFactory.cpp
@@ -46,38 +46,38 @@ nsScriptableRegionConstructor(nsISupport
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(GfxInitialization)
 
 NS_DEFINE_NAMED_CID(NS_FONT_ENUMERATOR_CID);
 NS_DEFINE_NAMED_CID(NS_SCRIPTABLE_REGION_CID);
 NS_DEFINE_NAMED_CID(NS_GFX_INITIALIZATION_CID);
 
 static const mozilla::Module::CIDEntry kThebesCIDs[] = {
-    { &kNS_FONT_ENUMERATOR_CID, false, NULL, nsThebesFontEnumeratorConstructor },
-    { &kNS_SCRIPTABLE_REGION_CID, false, NULL, nsScriptableRegionConstructor },
-    { &kNS_GFX_INITIALIZATION_CID, false, NULL, GfxInitializationConstructor },
-    { NULL }
+    { &kNS_FONT_ENUMERATOR_CID, false, nullptr, nsThebesFontEnumeratorConstructor },
+    { &kNS_SCRIPTABLE_REGION_CID, false, nullptr, nsScriptableRegionConstructor },
+    { &kNS_GFX_INITIALIZATION_CID, false, nullptr, GfxInitializationConstructor },
+    { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kThebesContracts[] = {
     { "@mozilla.org/gfx/fontenumerator;1", &kNS_FONT_ENUMERATOR_CID },
     { "@mozilla.org/gfx/region;1", &kNS_SCRIPTABLE_REGION_CID },
     { "@mozilla.org/gfx/init;1", &kNS_GFX_INITIALIZATION_CID },
-    { NULL }
+    { nullptr }
 };
 
 static void
 nsThebesGfxModuleDtor()
 {
     gfxPlatform::Shutdown();
 }
 
 static const mozilla::Module kThebesModule = {
     mozilla::Module::kVersion,
     kThebesCIDs,
     kThebesContracts,
-    NULL,
-    NULL,
-    NULL,
+    nullptr,
+    nullptr,
+    nullptr,
     nsThebesGfxModuleDtor
 };
 
 NSMODULE_DEFN(nsGfxModule) = &kThebesModule;