Bug 626472 part 1 - Define nsnull as nullptr where available; r=ehsan
authorAryeh Gregor <ayg@aryeh.name>
Fri, 20 Jul 2012 14:16:17 +0300
changeset 100119 0a5b58d92843dcd90afe1e7e17f596c6957c15ca
parent 100118 4c75b59971a6afc9b6c4758ebe04513551d790ca
child 100120 5d09c7fdc9973967f72d1ef9ada15e22433216cc
push id12338
push userayg@aryeh.name
push dateMon, 23 Jul 2012 10:43:23 +0000
treeherdermozilla-inbound@0a5b58d92843 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs626472
milestone17.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 626472 part 1 - Define nsnull as nullptr where available; r=ehsan
accessible/src/atk/nsMaiInterfaceTable.cpp
accessible/src/atk/nsMaiInterfaceText.cpp
accessible/src/generic/HyperTextAccessible.cpp
configure.in
content/base/src/nsAttrAndChildArray.cpp
content/events/src/nsEventListenerManager.cpp
content/html/content/src/nsHTMLFormElement.cpp
content/media/ogg/nsOggReader.cpp
content/xbl/src/nsXBLPrototypeHandler.cpp
dom/indexedDB/IndexedDatabaseManager.cpp
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/base/nsPluginHost.cpp
dom/src/json/nsJSON.cpp
dom/src/jsurl/nsJSProtocolHandler.cpp
editor/libeditor/text/nsPlaintextDataTransfer.cpp
gfx/gl/GLContext.h
gfx/layers/basic/BasicCanvasLayer.cpp
gfx/thebes/gfxFontUtils.cpp
gfx/thebes/nsCoreAnimationSupport.h
gfx/thebes/nsCoreAnimationSupport.mm
layout/generic/nsBulletFrame.cpp
layout/printing/nsPrintData.cpp
layout/printing/nsPrintEngine.cpp
layout/style/nsCSSRuleProcessor.cpp
layout/svg/base/src/nsSVGGradientFrame.cpp
layout/xul/base/src/nsDocElementBoxFrame.cpp
layout/xul/base/src/nsXULTooltipListener.cpp
netwerk/base/src/nsTransportUtils.cpp
netwerk/wifi/nsWifiAccessPoint.cpp
parser/html/nsHtml5HtmlAttributes.cpp
parser/html/nsHtml5Tokenizer.cpp
parser/html/nsHtml5TreeBuilder.cpp
parser/htmlparser/src/CNavDTD.cpp
storage/src/mozStorageAsyncStatement.cpp
storage/src/mozStorageStatement.cpp
storage/test/test_AsXXX_helpers.cpp
toolkit/components/places/nsNavBookmarks.cpp
widget/cocoa/TextInputHandler.mm
widget/xpwidgets/PuppetWidget.cpp
xpcom/base/nscore.h
xpcom/glue/nsBaseHashtable.h
xpcom/glue/nsStringAPI.cpp
--- a/accessible/src/atk/nsMaiInterfaceTable.cpp
+++ b/accessible/src/atk/nsMaiInterfaceTable.cpp
@@ -334,17 +334,17 @@ getSelectedColumnsCB(AtkTable *aTable, g
     if (NS_FAILED(rv) || (size == 0) || !columns) {
         *aSelected = nsnull;
         return 0;
     }
 
     gint *atkColumns = g_new(gint, size);
     if (!atkColumns) {
         NS_WARNING("OUT OF MEMORY");
-        return nsnull;
+        return 0;
     }
 
     //copy
     for (PRUint32 index = 0; index < size; ++index)
         atkColumns[index] = static_cast<gint>(columns[index]);
     nsMemory::Free(columns);
 
     *aSelected = atkColumns;
@@ -369,17 +369,17 @@ getSelectedRowsCB(AtkTable *aTable, gint
     if (NS_FAILED(rv) || (size == 0) || !rows) {
         *aSelected = nsnull;
         return 0;
     }
 
     gint *atkRows = g_new(gint, size);
     if (!atkRows) {
         NS_WARNING("OUT OF MEMORY");
-        return nsnull;
+        return 0;
     }
 
     //copy
     for (PRUint32 index = 0; index < size; ++index)
         atkRows[index] = static_cast<gint>(rows[index]);
     nsMemory::Free(rows);
 
     *aSelected = atkRows;
--- a/accessible/src/atk/nsMaiInterfaceText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceText.cpp
@@ -344,22 +344,22 @@ getOffsetAtPointCB(AtkText *aText,
     return static_cast<gint>(offset);
 }
 
 static gint
 getTextSelectionCountCB(AtkText *aText)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
-    return nsnull;
+    return 0;
 
     nsCOMPtr<nsIAccessibleText> accText;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                             getter_AddRefs(accText));
-    NS_ENSURE_TRUE(accText, nsnull);
+    NS_ENSURE_TRUE(accText, 0);
 
     PRInt32 selectionCount;
     nsresult rv = accText->GetSelectionCount(&selectionCount);
  
     return NS_FAILED(rv) ? 0 : selectionCount;
 }
 
 static gchar*
--- a/accessible/src/generic/HyperTextAccessible.cpp
+++ b/accessible/src/generic/HyperTextAccessible.cpp
@@ -477,17 +477,17 @@ HyperTextAccessible::GetCharacterCount(P
 
 /*
  * Gets the specified character.
  */
 NS_IMETHODIMP
 HyperTextAccessible::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar* aCharacter)
 {
   NS_ENSURE_ARG_POINTER(aCharacter);
-  *aCharacter = nsnull;
+  *aCharacter = L'\0';
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAutoString character;
   if (GetCharAt(aOffset, eGetAt, character)) {
     *aCharacter = character.First();
     return NS_OK;
--- a/configure.in
+++ b/configure.in
@@ -2766,16 +2766,31 @@ dnl Note that we assume that mac & win32
         else
             WCHAR_CFLAGS="-fshort-wchar"
         fi
     else
         CXXFLAGS=$_SAVE_CXXFLAGS
     fi
 fi
 
+dnl Check for nullptr (bug 626472)
+AC_LANG_CPLUSPLUS
+AC_MSG_CHECKING(for nullptr)
+AC_CACHE_VAL(ac_cv_nullptr,
+ [AC_TRY_COMPILE([],
+                 [int* foo = nullptr;],
+                 [ac_cv_nullptr=true],
+                 [ac_cv_nullptr=false])])
+if test "$ac_cv_nullptr" = true ; then
+  AC_DEFINE(HAVE_NULLPTR)
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+
 AC_LANG_C
 
 dnl Check for .hidden assembler directive and visibility attribute.
 dnl Borrowed from glibc configure.in
 dnl ===============================================================
 if test "$GNU_CC"; then
   AC_CACHE_CHECK(for visibility(hidden) attribute,
                  ac_cv_visibility_hidden,
--- a/content/base/src/nsAttrAndChildArray.cpp
+++ b/content/base/src/nsAttrAndChildArray.cpp
@@ -457,17 +457,17 @@ nsAttrAndChildArray::RemoveAttrAt(PRUint
   aPos -= mapped;
   ATTRS(mImpl)[aPos].mValue.SwapValueWith(aValue);
   ATTRS(mImpl)[aPos].~InternalAttr();
 
   PRUint32 slotCount = AttrSlotCount();
   memmove(&ATTRS(mImpl)[aPos],
           &ATTRS(mImpl)[aPos + 1],
           (slotCount - aPos - 1) * sizeof(InternalAttr));
-  memset(&ATTRS(mImpl)[slotCount - 1], nsnull, sizeof(InternalAttr));
+  memset(&ATTRS(mImpl)[slotCount - 1], 0, sizeof(InternalAttr));
 
   return NS_OK;
 }
 
 const nsAttrName*
 nsAttrAndChildArray::AttrNameAt(PRUint32 aPos) const
 {
   NS_ASSERTION(aPos < AttrCount(),
--- a/content/events/src/nsEventListenerManager.cpp
+++ b/content/events/src/nsEventListenerManager.cpp
@@ -597,17 +597,17 @@ nsEventListenerManager::AddScriptEventLi
         // build a "script sample" based on what we know about this element
         scriptSample.Assign(attr);
         scriptSample.AppendLiteral(" attribute on ");
         scriptSample.Append(tagName);
         scriptSample.AppendLiteral(" element");
         csp->LogViolationDetails(nsIContentSecurityPolicy::VIOLATION_TYPE_INLINE_SCRIPT,
                                  NS_ConvertUTF8toUTF16(asciiSpec),
                                  scriptSample,
-                                 nsnull);
+                                 0);
         return NS_OK;
       }
     }
   }
 
   // This might be the first reference to this language in the global
   // We must init the language before we attempt to fetch its context.
   if (NS_FAILED(global->EnsureScriptEnvironment())) {
--- a/content/html/content/src/nsHTMLFormElement.cpp
+++ b/content/html/content/src/nsHTMLFormElement.cpp
@@ -986,17 +986,17 @@ nsHTMLFormElement::WalkFormElements(nsFo
   return NS_OK;
 }
 
 // nsIForm
 
 NS_IMETHODIMP_(PRUint32)
 nsHTMLFormElement::GetElementCount() const 
 {
-  PRUint32 count = nsnull;
+  PRUint32 count = 0;
   mControls->GetLength(&count); 
   return count;
 }
 
 NS_IMETHODIMP_(nsIFormControl*)
 nsHTMLFormElement::GetElementAt(PRInt32 aIndex) const
 {
   return mControls->mElements.SafeElementAt(aIndex, nsnull);
@@ -1847,18 +1847,18 @@ nsHTMLFormElement::OnSecurityChange(nsIW
 {
   NS_NOTREACHED("notification excluded in AddProgressListener(...)");
   return NS_OK;
 }
  
 NS_IMETHODIMP_(PRInt32)
 nsHTMLFormElement::IndexOfControl(nsIFormControl* aControl)
 {
-  PRInt32 index = nsnull;
-  return mControls->IndexOfControl(aControl, &index) == NS_OK ? index : nsnull;
+  PRInt32 index = 0;
+  return mControls->IndexOfControl(aControl, &index) == NS_OK ? index : 0;
 }
 
 NS_IMETHODIMP
 nsHTMLFormElement::SetCurrentRadioButton(const nsAString& aName,
                                          nsIDOMHTMLInputElement* aRadio)
 {
   mSelectedRadioButtons.Put(aName, aRadio);
 
--- a/content/media/ogg/nsOggReader.cpp
+++ b/content/media/ogg/nsOggReader.cpp
@@ -729,19 +729,19 @@ GetChecksum(ogg_page* page)
                (p[3] << 24);
   return c;
 }
 
 PRInt64 nsOggReader::RangeStartTime(PRInt64 aOffset)
 {
   NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
   MediaResource* resource = mDecoder->GetResource();
-  NS_ENSURE_TRUE(resource != nsnull, nsnull);
+  NS_ENSURE_TRUE(resource != nsnull, 0);
   nsresult res = resource->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
-  NS_ENSURE_SUCCESS(res, nsnull);
+  NS_ENSURE_SUCCESS(res, 0);
   PRInt64 startTime = 0;
   nsBuiltinDecoderReader::FindStartTime(startTime);
   return startTime;
 }
 
 struct nsAutoOggSyncState {
   nsAutoOggSyncState() {
     ogg_sync_init(&mState);
--- a/content/xbl/src/nsXBLPrototypeHandler.cpp
+++ b/content/xbl/src/nsXBLPrototypeHandler.cpp
@@ -107,17 +107,17 @@ nsXBLPrototypeHandler::nsXBLPrototypeHan
   Init();
 
   // Make sure our prototype is initialized.
   ConstructPrototype(aHandlerElement);
 }
 
 nsXBLPrototypeHandler::nsXBLPrototypeHandler(nsXBLPrototypeBinding* aBinding)
   : mHandlerText(nsnull),
-    mLineNumber(nsnull),
+    mLineNumber(0),
     mNextHandler(nsnull),
     mPrototypeBinding(aBinding)
 {
   Init();
 }
 
 nsXBLPrototypeHandler::~nsXBLPrototypeHandler()
 {
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -380,17 +380,17 @@ IndexedDatabaseManager::FireWindowOnErro
   // Log an error to the error console.
   nsCOMPtr<nsIScriptError> scriptError =
     do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (NS_FAILED(scriptError->InitWithWindowID(event.errorMsg,
                                               event.fileName,
                                               nsnull, event.lineNr,
-                                              nsnull, 0,
+                                              0, 0,
                                               "IndexedDB",
                                               aOwner->WindowID()))) {
     NS_WARNING("Failed to init script error!");
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIConsoleService> consoleService =
     do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv);
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -1994,17 +1994,17 @@ NPError NP_CALLBACK
   case NPNVnetscapeWindow: {
     if (!npp || !npp->ndata)
       return NPERR_INVALID_INSTANCE_ERROR;
 
     nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *) npp->ndata;
 
     nsCOMPtr<nsIPluginInstanceOwner> owner;
     inst->GetOwner(getter_AddRefs(owner));
-    NS_ENSURE_TRUE(owner, nsnull);
+    NS_ENSURE_TRUE(owner, NPERR_NO_ERROR);
 
     if (NS_SUCCEEDED(owner->GetNetscapeWindow(result))) {
       return NPERR_NO_ERROR;
     }
     return NPERR_GENERIC_ERROR;
   }
 #endif
 
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -584,17 +584,17 @@ nsresult nsPluginHost::GetURL(nsISupport
                               const char* target,
                               nsNPAPIPluginStreamListener* streamListener,
                               const char* altHost,
                               const char* referrer,
                               bool forceJSEnabled)
 {
   return GetURLWithHeaders(static_cast<nsNPAPIPluginInstance*>(pluginInst),
                            url, target, streamListener, altHost, referrer,
-                           forceJSEnabled, nsnull, nsnull);
+                           forceJSEnabled, 0, nsnull);
 }
 
 nsresult nsPluginHost::GetURLWithHeaders(nsNPAPIPluginInstance* pluginInst,
                                          const char* url,
                                          const char* target,
                                          nsNPAPIPluginStreamListener* streamListener,
                                          const char* altHost,
                                          const char* referrer,
--- a/dom/src/json/nsJSON.cpp
+++ b/dom/src/json/nsJSON.cpp
@@ -281,17 +281,17 @@ nsJSONWriter::SetCharset(const char* aCh
   nsresult rv = NS_OK;
   if (mStream) {
     nsCOMPtr<nsICharsetConverterManager> ccm =
       do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = ccm->GetUnicodeEncoder(aCharset, getter_AddRefs(mEncoder));
     NS_ENSURE_SUCCESS(rv, rv);
     rv = mEncoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Signal,
-                                          nsnull, nsnull);
+                                          nsnull, '\0');
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return rv;
 }
 
 nsresult
 nsJSONWriter::Write(const PRUnichar *aBuffer, PRUint32 aLength)
--- a/dom/src/jsurl/nsJSProtocolHandler.cpp
+++ b/dom/src/jsurl/nsJSProtocolHandler.cpp
@@ -172,17 +172,17 @@ nsresult nsJSThunk::EvaluateScript(nsICh
           // gather information to log with violation report
           nsCOMPtr<nsIURI> uri;
           principal->GetURI(getter_AddRefs(uri));
           nsCAutoString asciiSpec;
           uri->GetAsciiSpec(asciiSpec);
 		  csp->LogViolationDetails(nsIContentSecurityPolicy::VIOLATION_TYPE_INLINE_SCRIPT,
 								   NS_ConvertUTF8toUTF16(asciiSpec),
 								   NS_ConvertUTF8toUTF16(mURL),
-                                   nsnull);
+                                   0);
           return NS_ERROR_DOM_RETVAL_UNDEFINED;
       }
     }
 
     // Get the global object we should be running on.
     nsIScriptGlobalObject* global = GetGlobalObject(aChannel);
     if (!global) {
         return NS_ERROR_FAILURE;
--- a/editor/libeditor/text/nsPlaintextDataTransfer.cpp
+++ b/editor/libeditor/text/nsPlaintextDataTransfer.cpp
@@ -336,17 +336,17 @@ NS_IMETHODIMP nsPlaintextEditor::Paste(P
     // Get the Data from the clipboard  
     if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)) && IsModifiable())
     {
       // handle transferable hooks
       nsCOMPtr<nsIDOMDocument> domdoc = GetDOMDocument();
       if (!nsEditorHookUtils::DoInsertionHook(domdoc, nsnull, trans))
         return NS_OK;
 
-      rv = InsertTextFromTransferable(trans, nsnull, nsnull, true);
+      rv = InsertTextFromTransferable(trans, nsnull, 0, true);
     }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP nsPlaintextEditor::PasteTransferable(nsITransferable *aTransferable)
 {
@@ -356,17 +356,17 @@ NS_IMETHODIMP nsPlaintextEditor::PasteTr
   if (!IsModifiable())
     return NS_OK;
 
   // handle transferable hooks
   nsCOMPtr<nsIDOMDocument> domdoc = GetDOMDocument();
   if (!nsEditorHookUtils::DoInsertionHook(domdoc, nsnull, aTransferable))
     return NS_OK;
 
-  return InsertTextFromTransferable(aTransferable, nsnull, nsnull, true);
+  return InsertTextFromTransferable(aTransferable, nsnull, 0, true);
 }
 
 NS_IMETHODIMP nsPlaintextEditor::CanPaste(PRInt32 aSelectionType, bool *aCanPaste)
 {
   NS_ENSURE_ARG_POINTER(aCanPaste);
   *aCanPaste = false;
 
   // can't paste if readonly
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -854,17 +854,17 @@ public:
 
     virtual bool SupportsOffscreenSplit() {
         return IsExtensionSupported(EXT_framebuffer_blit) || IsExtensionSupported(ANGLE_framebuffer_blit);
     }
 
     /**
      * Create new shared GLContext content handle, must be released by ReleaseSharedHandle.
      */
-    virtual SharedTextureHandle CreateSharedHandle(TextureImage::TextureShareType aType) { return nsnull; }
+    virtual SharedTextureHandle CreateSharedHandle(TextureImage::TextureShareType aType) { return 0; }
     /**
      * Publish GLContext content to intermediate buffer attached to shared handle.
      * Shared handle content is ready to be used after call returns, and no need extra Flush/Finish are required.
      * GLContext must be current before this call
      */
     virtual void UpdateSharedHandle(TextureImage::TextureShareType aType,
                                     SharedTextureHandle aSharedHandle) { }
     /**
--- a/gfx/layers/basic/BasicCanvasLayer.cpp
+++ b/gfx/layers/basic/BasicCanvasLayer.cpp
@@ -331,17 +331,17 @@ public:
 
 private:
   typedef mozilla::gl::SharedTextureHandle SharedTextureHandle;
   typedef mozilla::gl::TextureImage TextureImage;
   SharedTextureHandle GetSharedBackBufferHandle()
   {
     if (mBackBuffer.type() == SurfaceDescriptor::TSharedTextureDescriptor)
       return mBackBuffer.get_SharedTextureDescriptor().handle();
-    return nsnull;
+    return 0;
   }
 
   BasicShadowLayerManager* BasicManager()
   {
     return static_cast<BasicShadowLayerManager*>(mManager);
   }
 
   SurfaceDescriptor mBackBuffer;
--- a/gfx/thebes/gfxFontUtils.cpp
+++ b/gfx/thebes/gfxFontUtils.cpp
@@ -546,17 +546,17 @@ gfxFontUtils::FindPreferredSubtable(cons
         EncodingIDMicrosoft = 1,
         EncodingIDDefaultForUnicodePlatform = 0,
         EncodingIDUCS4ForUnicodePlatform = 3,
         EncodingIDUVSForUnicodePlatform = 5,
         EncodingIDUCS4ForMicrosoftPlatform = 10
     };
 
     if (aUVSTableOffset) {
-        *aUVSTableOffset = nsnull;
+        *aUVSTableOffset = 0;
     }
 
     if (!aBuf || aBufLength < SizeOfHeader) {
         // cmap table is missing, or too small to contain header fields!
         return 0;
     }
 
     // PRUint16 version = ReadShortAt(aBuf, OffsetVersion); // Unused: self-documenting.
--- a/gfx/thebes/nsCoreAnimationSupport.h
+++ b/gfx/thebes/nsCoreAnimationSupport.h
@@ -22,19 +22,19 @@ CGColorSpaceRef THEBES_API CreateSystemC
 struct _CGLPBufferObject;
 struct _CGLContextObject;
 
 enum AllowOfflineRendererEnum { ALLOW_OFFLINE_RENDERER, DISALLOW_OFFLINE_RENDERER };
 
 class THEBES_API nsCARenderer {
   NS_INLINE_DECL_REFCOUNTING(nsCARenderer)
 public:
-  nsCARenderer() : mCARenderer(nsnull), mFBOTexture(nsnull), mOpenGLContext(nsnull),
-                   mCGImage(nsnull), mCGData(nsnull), mIOSurface(nsnull), mFBO(nsnull),
-                   mIOTexture(nsnull),
+  nsCARenderer() : mCARenderer(nsnull), mFBOTexture(0), mOpenGLContext(nsnull),
+                   mCGImage(nsnull), mCGData(nsnull), mIOSurface(nsnull), mFBO(0),
+                   mIOTexture(0),
                    mUnsupportedWidth(UINT32_MAX), mUnsupportedHeight(UINT32_MAX),
                    mAllowOfflineRenderer(DISALLOW_OFFLINE_RENDERER) {}
   ~nsCARenderer();
   nsresult SetupRenderer(void* aCALayer, int aWidth, int aHeight,
                          AllowOfflineRendererEnum aAllowOfflineRenderer);
   nsresult Render(int aWidth, int aHeight, CGImageRef *aOutCAImage);
   bool isInit() { return mCARenderer != nsnull; }
   /*
--- a/gfx/thebes/nsCoreAnimationSupport.mm
+++ b/gfx/thebes/nsCoreAnimationSupport.mm
@@ -426,18 +426,18 @@ void nsCARenderer::Destroy() {
   }
   // mCGData is deallocated by cgdata_release_callback
 
   mCARenderer = nil;
   mFBOTexture = 0;
   mOpenGLContext = nsnull;
   mCGImage = nsnull;
   mIOSurface = nsnull;
-  mFBO = nsnull;
-  mIOTexture = nsnull;
+  mFBO = 0;
+  mIOTexture = 0;
 }
 
 nsresult nsCARenderer::SetupRenderer(void *aCALayer, int aWidth, int aHeight,
                                      AllowOfflineRendererEnum aAllowOfflineRenderer) {
   mAllowOfflineRenderer = aAllowOfflineRenderer;
 
   if (aWidth == 0 || aHeight == 0)
     return NS_ERROR_FAILURE;
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -406,30 +406,30 @@ static bool OtherDecimalToText(PRInt32 o
 {
    PRUnichar diff = zeroChar - PRUnichar('0');
    DecimalToText(ordinal, result);
    PRUnichar* p = result.BeginWriting();
    if (ordinal < 0) {
      // skip the leading '-'
      ++p;
    }     
-   for(; nsnull != *p ; p++) 
+   for(; '\0' != *p ; p++) 
       *p += diff;
    return true;
 }
 static bool TamilToText(PRInt32 ordinal,  nsString& result)
 {
    PRUnichar diff = 0x0BE6 - PRUnichar('0');
    DecimalToText(ordinal, result); 
    if (ordinal < 1 || ordinal > 9999) {
      // Can't do those in this system.
      return false;
    }
    PRUnichar* p = result.BeginWriting();
-   for(; nsnull != *p ; p++) 
+   for(; '\0' != *p ; p++) 
       if(*p != PRUnichar('0'))
          *p += diff;
    return true;
 }
 
 
 static const char gLowerRomanCharsA[] = "ixcm";
 static const char gUpperRomanCharsA[] = "IXCM";
--- a/layout/printing/nsPrintData.cpp
+++ b/layout/printing/nsPrintData.cpp
@@ -29,17 +29,17 @@ static PRLogModuleInfo * kPrintingLogMod
 #define PR_PL(_p1)
 #endif
 
 //---------------------------------------------------
 //-- nsPrintData Class Impl
 //---------------------------------------------------
 nsPrintData::nsPrintData(ePrintDataType aType) :
   mType(aType), mDebugFilePtr(nsnull), mPrintObject(nsnull), mSelectedPO(nsnull),
-  mPrintDocList(nsnull), mIsIFrameSelected(false),
+  mPrintDocList(0), mIsIFrameSelected(false),
   mIsParentAFrameSet(false), mOnStartSent(false),
   mIsAborted(false), mPreparingForPrint(false), mDocWasToBeDestroyed(false),
   mShrinkToFit(false), mPrintFrameType(nsIPrintSettings::kFramesAsIs), 
   mNumPrintablePages(0), mNumPagesPrinted(0),
   mShrinkRatio(1.0), mOrigDCScale(1.0), mPPEventListeners(NULL), 
   mBrandName(nsnull)
 {
   MOZ_COUNT_CTOR(nsPrintData);
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -3175,17 +3175,17 @@ nsPrintEngine::TurnScriptingOn(bool aDoT
 //-- Section: Finishing up or Cleaning up
 //-----------------------------------------------------------------
 
 //-----------------------------------------------------------------
 void
 nsPrintEngine::CloseProgressDialog(nsIWebProgressListener* aWebProgressListener)
 {
   if (aWebProgressListener) {
-    aWebProgressListener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP|nsIWebProgressListener::STATE_IS_DOCUMENT, nsnull);
+    aWebProgressListener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP|nsIWebProgressListener::STATE_IS_DOCUMENT, NS_OK);
   }
 }
 
 //-----------------------------------------------------------------
 nsresult
 nsPrintEngine::FinishPrintPreview()
 {
   nsresult rv = NS_OK;
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -501,17 +501,17 @@ protected:
   PRUint32    mElementTagCalls;
   PRUint32    mElementClassCalls;
   PRUint32    mElementIdCalls;
 #endif // RULE_HASH_STATS
 };
 
 RuleHash::RuleHash(bool aQuirksMode)
   : mRuleCount(0),
-    mUniversalRules(nsnull),
+    mUniversalRules(0),
     mEnumList(nsnull), mEnumListSize(0),
     mQuirksMode(aQuirksMode)
 #ifdef RULE_HASH_STATS
     ,
     mUniversalSelectors(0),
     mNameSpaceSelectors(0),
     mTagSelectors(0),
     mClassSelectors(0),
--- a/layout/svg/base/src/nsSVGGradientFrame.cpp
+++ b/layout/svg/base/src/nsSVGGradientFrame.cpp
@@ -384,17 +384,17 @@ nsSVGGradientFrame::GetStopFrame(PRInt32
     return stopCount;
   }
 
   // Our gradient element doesn't have stops - try to "inherit" them
 
   AutoGradientReferencer gradientRef(this);
   nsSVGGradientFrame* next = GetReferencedGradientIfNotInUse();
   if (!next)
-    return nsnull;
+    return 0;
 
   return next->GetStopFrame(aIndex, aStopFrame);
 }
 
 // -------------------------------------------------------------------------
 // Linear Gradients
 // -------------------------------------------------------------------------
 
--- a/layout/xul/base/src/nsDocElementBoxFrame.cpp
+++ b/layout/xul/base/src/nsDocElementBoxFrame.cpp
@@ -106,17 +106,17 @@ nsDocElementBoxFrame::CreateAnonymousCon
   nodeInfo = nodeInfoManager->GetNodeInfo(nsGkAtoms::tooltip, nsnull,
                                           kNameSpaceID_XUL,
                                           nsIDOMNode::ELEMENT_NODE);
   NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
 
   rv = NS_NewXULElement(getter_AddRefs(mTooltipContent), nodeInfo.forget());
   NS_ENSURE_SUCCESS(rv, rv);
 
-  mTooltipContent->SetAttr(nsnull, nsGkAtoms::_default,
+  mTooltipContent->SetAttr(kNameSpaceID_None, nsGkAtoms::_default,
                            NS_LITERAL_STRING("true"), false);
 
   if (!aElements.AppendElement(mTooltipContent))
     return NS_ERROR_OUT_OF_MEMORY;
 
   return NS_OK;
 }
 
--- a/layout/xul/base/src/nsXULTooltipListener.cpp
+++ b/layout/xul/base/src/nsXULTooltipListener.cpp
@@ -491,19 +491,19 @@ nsXULTooltipListener::LaunchTooltip()
     nsCOMPtr<nsITreeBoxObject> obx;
     GetSourceTreeBoxObject(getter_AddRefs(obx));
 
     SetTitletipLabel(obx, currentTooltip, mLastTreeRow, mLastTreeCol);
     if (!(currentTooltip = do_QueryReferent(mCurrentTooltip))) {
       // Because of mutation events, currentTooltip can be null.
       return;
     }
-    currentTooltip->SetAttr(nsnull, nsGkAtoms::titletip, NS_LITERAL_STRING("true"), true);
+    currentTooltip->SetAttr(kNameSpaceID_None, nsGkAtoms::titletip, NS_LITERAL_STRING("true"), true);
   } else {
-    currentTooltip->UnsetAttr(nsnull, nsGkAtoms::titletip, true);
+    currentTooltip->UnsetAttr(kNameSpaceID_None, nsGkAtoms::titletip, true);
   }
   if (!(currentTooltip = do_QueryReferent(mCurrentTooltip))) {
     // Because of mutation events, currentTooltip can be null.
     return;
   }
 
   nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
   if (pm) {
--- a/netwerk/base/src/nsTransportUtils.cpp
+++ b/netwerk/base/src/nsTransportUtils.cpp
@@ -72,17 +72,17 @@ public:
         {
             MutexAutoLock lock(mProxy->mLock);
             if (mProxy->mLastEvent == this)
                 mProxy->mLastEvent = nsnull;
         }
 
         mProxy->mSink->OnTransportStatus(mTransport, mStatus, mProgress,
                                          mProgressMax);
-        return nsnull;
+        return NS_OK;
     }
 
     nsRefPtr<nsTransportEventSinkProxy> mProxy;
 
     // parameters to OnTransportStatus
     nsCOMPtr<nsITransport> mTransport;
     nsresult               mStatus;
     PRUint64               mProgress;
--- a/netwerk/wifi/nsWifiAccessPoint.cpp
+++ b/netwerk/wifi/nsWifiAccessPoint.cpp
@@ -13,18 +13,18 @@ extern PRLogModuleInfo *gWifiMonitorLog;
 #define LOG(args)     PR_LOG(gWifiMonitorLog, PR_LOG_DEBUG, args)
 
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsWifiAccessPoint, nsIWifiAccessPoint)
 
 nsWifiAccessPoint::nsWifiAccessPoint()
 {
   // make sure these are null terminated (because we are paranoid)
-  mMac[0] = nsnull;
-  mSsid[0] = nsnull;
+  mMac[0] = '\0';
+  mSsid[0] = '\0';
   mSsidLen = 0;
 }
 
 nsWifiAccessPoint::~nsWifiAccessPoint()
 {
 }
 
 NS_IMETHODIMP nsWifiAccessPoint::GetMac(nsACString& aMac)
--- a/parser/html/nsHtml5HtmlAttributes.cpp
+++ b/parser/html/nsHtml5HtmlAttributes.cpp
@@ -111,17 +111,17 @@ nsHtml5HtmlAttributes::getAttributeName(
 }
 
 PRInt32 
 nsHtml5HtmlAttributes::getURI(PRInt32 index)
 {
   if (index < length && index >= 0) {
     return names[index]->getUri(mode);
   } else {
-    return nsnull;
+    return 0;
   }
 }
 
 nsIAtom* 
 nsHtml5HtmlAttributes::getPrefix(PRInt32 index)
 {
   if (index < length && index >= 0) {
     return names[index]->getPrefix(mode);
--- a/parser/html/nsHtml5Tokenizer.cpp
+++ b/parser/html/nsHtml5Tokenizer.cpp
@@ -3901,18 +3901,18 @@ nsHtml5Tokenizer::emitOrAppendOne(const 
   } else {
     tokenHandler->characters(val, 0, 1);
   }
 }
 
 void 
 nsHtml5Tokenizer::end()
 {
-  strBuf = nsnull;
-  longStrBuf = nsnull;
+  strBuf = 0;
+  longStrBuf = 0;
   doctypeName = nsnull;
   if (systemIdentifier) {
     nsHtml5Portability::releaseString(systemIdentifier);
     systemIdentifier = nsnull;
   }
   if (publicIdentifier) {
     nsHtml5Portability::releaseString(publicIdentifier);
     publicIdentifier = nsnull;
--- a/parser/html/nsHtml5TreeBuilder.cpp
+++ b/parser/html/nsHtml5TreeBuilder.cpp
@@ -543,28 +543,28 @@ nsHtml5TreeBuilder::endTokenization()
   formPointer = nsnull;
   headPointer = nsnull;
   deepTreeSurrogateParent = nsnull;
   if (stack) {
     while (currentPtr > -1) {
       stack[currentPtr]->release();
       currentPtr--;
     }
-    stack = nsnull;
+    stack = 0;
   }
   if (listOfActiveFormattingElements) {
     while (listPtr > -1) {
       if (listOfActiveFormattingElements[listPtr]) {
         listOfActiveFormattingElements[listPtr]->release();
       }
       listPtr--;
     }
-    listOfActiveFormattingElements = nsnull;
+    listOfActiveFormattingElements = 0;
   }
-  charBuffer = nsnull;
+  charBuffer = 0;
   end();
 }
 
 void 
 nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, bool selfClosing)
 {
   flushCharacters();
   PRInt32 eltPos;
--- a/parser/htmlparser/src/CNavDTD.cpp
+++ b/parser/htmlparser/src/CNavDTD.cpp
@@ -1093,17 +1093,17 @@ CNavDTD::HandleKeyGen(nsIParserNode* aNo
 
   theFormType.AssignLiteral("select");
 
   result = theFormProcessor->ProvideContent(theFormType, theContent,
                                             theAttribute);
   if (NS_FAILED(result)) {
     return result;
   }
-  PRInt32   theIndex = nsnull;
+  PRInt32   theIndex = 0;
 
   // Populate the tokenizer with the fabricated elements in the reverse
   // order such that <SELECT> is on the top fo the tokenizer followed by
   // <OPTION>s and </SELECT>.
   theToken = mTokenAllocator->CreateTokenOfType(eToken_end,
                                                 eHTMLTag_select);
   NS_ENSURE_TRUE(theToken, NS_ERROR_OUT_OF_MEMORY);
   mTokenizer->PushTokenFront(theToken);
--- a/storage/src/mozStorageAsyncStatement.cpp
+++ b/storage/src/mozStorageAsyncStatement.cpp
@@ -95,17 +95,17 @@ public:
   {
     *_language = nsIProgrammingLanguage::CPLUSPLUS;
     return NS_OK;
   }
 
   NS_IMETHODIMP
   GetFlags(PRUint32 *_flags)
   {
-    *_flags = nsnull;
+    *_flags = 0;
     return NS_OK;
   }
 
   NS_IMETHODIMP
   GetClassIDNoAlloc(nsCID *_cid)
   {
     return NS_ERROR_NOT_AVAILABLE;
   }
--- a/storage/src/mozStorageStatement.cpp
+++ b/storage/src/mozStorageStatement.cpp
@@ -98,17 +98,17 @@ public:
   {
     *_language = nsIProgrammingLanguage::CPLUSPLUS;
     return NS_OK;
   }
 
   NS_IMETHODIMP
   GetFlags(PRUint32 *_flags)
   {
-    *_flags = nsnull;
+    *_flags = 0;
     return NS_OK;
   }
 
   NS_IMETHODIMP
   GetClassIDNoAlloc(nsCID *_cid)
   {
     return NS_ERROR_NOT_AVAILABLE;
   }
--- a/storage/test/test_AsXXX_helpers.cpp
+++ b/storage/test/test_AsXXX_helpers.cpp
@@ -31,23 +31,23 @@ Spinner::HandleResult(mozIStorageResultS
   nsCOMPtr<mozIStorageRow> row;
   do_check_true(NS_SUCCEEDED(aResultSet->GetNextRow(getter_AddRefs(row))) && row);
 
   do_check_eq(row->AsInt32(0), 0);
   do_check_eq(row->AsInt64(0), 0);
   do_check_eq(row->AsDouble(0), 0.0);
 
   PRUint32 len = 100;
-  do_check_eq(row->AsSharedUTF8String(0, &len), nsnull);
+  do_check_eq(row->AsSharedUTF8String(0, &len), NULL);
   do_check_eq(len, 0);
   len = 100;
-  do_check_eq(row->AsSharedWString(0, &len), nsnull);
+  do_check_eq(row->AsSharedWString(0, &len), NULL);
   do_check_eq(len, 0);
   len = 100;
-  do_check_eq(row->AsSharedBlob(0, &len), nsnull);
+  do_check_eq(row->AsSharedBlob(0, &len), NULL);
   do_check_eq(len, 0);
 
   do_check_eq(row->IsNull(0), true);
   return NS_OK;
 }
 
 void
 test_NULLFallback()
@@ -64,37 +64,37 @@ test_NULLFallback()
 
   bool hasMore;
   do_check_true(NS_SUCCEEDED(stmt->ExecuteStep(&hasMore)) && hasMore);
 
   do_check_eq(stmt->AsInt32(0), 0);
   do_check_eq(stmt->AsInt64(0), 0);
   do_check_eq(stmt->AsDouble(0), 0.0);
   PRUint32 len = 100;
-  do_check_eq(stmt->AsSharedUTF8String(0, &len), nsnull);
+  do_check_eq(stmt->AsSharedUTF8String(0, &len), NULL);
   do_check_eq(len, 0);
   len = 100;
-  do_check_eq(stmt->AsSharedWString(0, &len), nsnull);
+  do_check_eq(stmt->AsSharedWString(0, &len), NULL);
   do_check_eq(len, 0);
   len = 100;
-  do_check_eq(stmt->AsSharedBlob(0, &len), nsnull);
+  do_check_eq(stmt->AsSharedBlob(0, &len), NULL);
   do_check_eq(len, 0);
   do_check_eq(stmt->IsNull(0), true);
 
   do_check_eq(valueArray->AsInt32(0), 0);
   do_check_eq(valueArray->AsInt64(0), 0);
   do_check_eq(valueArray->AsDouble(0), 0.0);
   len = 100;
-  do_check_eq(valueArray->AsSharedUTF8String(0, &len), nsnull);
+  do_check_eq(valueArray->AsSharedUTF8String(0, &len), NULL);
   do_check_eq(len, 0);
   len = 100;
-  do_check_eq(valueArray->AsSharedWString(0, &len), nsnull);
+  do_check_eq(valueArray->AsSharedWString(0, &len), NULL);
   do_check_eq(len, 0);
   len = 100;
-  do_check_eq(valueArray->AsSharedBlob(0, &len), nsnull);
+  do_check_eq(valueArray->AsSharedBlob(0, &len), NULL);
   do_check_eq(len, 0);
   do_check_eq(valueArray->IsNull(0), true);
 }
 
 void
 test_asyncNULLFallback()
 {
   nsCOMPtr<mozIStorageConnection> db(getMemoryDatabase());
--- a/toolkit/components/places/nsNavBookmarks.cpp
+++ b/toolkit/components/places/nsNavBookmarks.cpp
@@ -587,17 +587,17 @@ nsNavBookmarks::InsertBookmark(PRInt64 a
 
   *aNewBookmarkId = -1;
   PRTime dateAdded = PR_Now();
   nsCAutoString guid;
   nsCString title;
   TruncateTitle(aTitle, title);
 
   rv = InsertBookmarkInDB(placeId, BOOKMARK, aFolder, index, title, dateAdded,
-                          nsnull, folderGuid, grandParentId, aURI,
+                          0, folderGuid, grandParentId, aURI,
                           aNewBookmarkId, guid);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // If not a tag, recalculate frecency for this entry, since it changed.
   if (grandParentId != mTagsRoot) {
     rv = history->UpdateFrecency(placeId);
     NS_ENSURE_SUCCESS(rv, rv);
   }
@@ -850,17 +850,17 @@ nsNavBookmarks::CreateContainerWithID(PR
 
   *aNewFolder = aItemId;
   PRTime dateAdded = PR_Now();
   nsCAutoString guid;
   nsCString title;
   TruncateTitle(aTitle, title);
 
   rv = InsertBookmarkInDB(-1, FOLDER, aParent, index,
-                          title, dateAdded, nsnull, folderGuid, grandParentId,
+                          title, dateAdded, 0, folderGuid, grandParentId,
                           nsnull, aNewFolder, guid);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
                    nsINavBookmarkObserver,
@@ -903,17 +903,17 @@ nsNavBookmarks::InsertSeparator(PRInt64 
 
   *aNewItemId = -1;
   // Set a NULL title rather than an empty string.
   nsCString voidString;
   voidString.SetIsVoid(true);
   nsCAutoString guid;
   PRTime dateAdded = PR_Now();
   rv = InsertBookmarkInDB(-1, SEPARATOR, aParent, index, voidString, dateAdded,
-                          nsnull, folderGuid, grandParentId, nsnull,
+                          0, folderGuid, grandParentId, nsnull,
                           aNewItemId, guid);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
                    nsINavBookmarkObserver,
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -3103,17 +3103,17 @@ PluginTextInputHandler::ConvertUnicodeTo
                                                  unsigned char* aOutChar)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   UnicodeToTextInfo converterInfo;
   TextEncoding      systemEncoding;
   Str255            convertedString;
 
-  *aOutChar = nsnull;
+  *aOutChar = '\0';
 
   OSStatus err =
     ::UpgradeScriptInfoToTextEncoding(smSystemScript,
                                       kTextLanguageDontCare,
                                       kTextRegionDontCare,
                                       NULL,
                                       &systemEncoding);
   NS_ENSURE_TRUE(err == noErr, false);
--- a/widget/xpwidgets/PuppetWidget.cpp
+++ b/widget/xpwidgets/PuppetWidget.cpp
@@ -199,17 +199,17 @@ PuppetWidget::SetFocus(bool aRaise)
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PuppetWidget::Invalidate(const nsIntRect& aRect)
 {
 #ifdef DEBUG
   debug_DumpInvalidate(stderr, this, &aRect,
-                       nsCAutoString("PuppetWidget"), nsnull);
+                       nsCAutoString("PuppetWidget"), 0);
 #endif
 
   if (mChild) {
     return mChild->Invalidate(aRect);
   }
 
   mDirtyRegion.Or(mDirtyRegion, aRect);
 
@@ -236,17 +236,17 @@ PuppetWidget::InitEvent(nsGUIEvent& even
   event.time = PR_Now() / 1000;
 }
 
 NS_IMETHODIMP
 PuppetWidget::DispatchEvent(nsGUIEvent* event, nsEventStatus& aStatus)
 {
 #ifdef DEBUG
   debug_DumpEvent(stdout, event->widget, event,
-                  nsCAutoString("PuppetWidget"), nsnull);
+                  nsCAutoString("PuppetWidget"), 0);
 #endif
 
   NS_ABORT_IF_FALSE(!mChild || mChild->mWindowType == eWindowType_popup,
                     "Unexpected event dispatch!");
 
   aStatus = nsEventStatus_eIgnore;
 
   NS_ABORT_IF_FALSE(mViewCallback, "No view callback!");
@@ -490,17 +490,17 @@ PuppetWidget::DispatchPaintEvent()
   // reset repaint tracking
   mDirtyRegion.SetEmpty();
   mPaintTask.Revoke();
 
   nsEventStatus status;
   {
 #ifdef DEBUG
     debug_DumpPaintEvent(stderr, this, &event,
-                         nsCAutoString("PuppetWidget"), nsnull);
+                         nsCAutoString("PuppetWidget"), 0);
 #endif
 
     if (mozilla::layers::LAYERS_D3D10 == mLayerManager->GetBackendType()) {
       DispatchEvent(&event, status);
     } else {
       nsRefPtr<gfxContext> ctx = new gfxContext(mSurface);
       ctx->Rectangle(gfxRect(0,0,0,0));
       ctx->Clip();
@@ -564,17 +564,17 @@ PuppetWidget::GetDPI()
 }
 
 void*
 PuppetWidget::GetNativeData(PRUint32 aDataType)
 {
   switch (aDataType) {
   case NS_NATIVE_SHAREABLE_WINDOW: {
     NS_ABORT_IF_FALSE(mTabChild, "Need TabChild to get the nativeWindow from!");
-    mozilla::WindowsHandle nativeData = nsnull;
+    mozilla::WindowsHandle nativeData = 0;
     mTabChild->SendGetWidgetNativeData(&nativeData);
     return (void*)nativeData;
   }
   case NS_NATIVE_WINDOW:
   case NS_NATIVE_DISPLAY:
   case NS_NATIVE_PLUGIN_PORT:
   case NS_NATIVE_GRAPHIC:
   case NS_NATIVE_SHELLWIDGET:
--- a/xpcom/base/nscore.h
+++ b/xpcom/base/nscore.h
@@ -320,24 +320,28 @@ typedef PRUint32 nsresult;
  */
 #if defined(XP_WIN) && PR_BYTES_PER_LONG == 4
 typedef unsigned long nsrefcnt;
 #else
 typedef PRUint32 nsrefcnt;
 #endif
 
 /**
- * The preferred symbol for null.  Make sure this is the same size as
- * void* on the target.  See bug 547964.
+ * Use C++11 nullptr if available; otherwise use a C++ typesafe template; and
+ * for C, fall back to longs.  See bugs 547964 and 626472.
  */
+#ifndef HAVE_NULLPTR
 #if defined(_WIN64)
-# define nsnull 0LL
+# define nullptr 0LL
 #else
-# define nsnull 0L
+# define nullptr 0L
 #endif
+#endif /* defined(HAVE_NULLPTR) */
+
+#define nsnull nullptr
 
 
 #include "nsError.h"
 
 /* ------------------------------------------------------------------------ */
 /* Casting macros for hiding C++ features from older compilers */
 
   /* under VC++ (Windows), we don't have autoconf yet */
--- a/xpcom/glue/nsBaseHashtable.h
+++ b/xpcom/glue/nsBaseHashtable.h
@@ -120,17 +120,17 @@ public:
    * @return The found value, or nsnull if no entry was found with the given key.
    * @note If nsnull values are stored in the table, it is not possible to
    *       distinguish between a nsnull value and a missing entry.
    */
   UserDataType Get(KeyType aKey) const
   {
     EntryType* ent = this->GetEntry(aKey);
     if (!ent)
-      return nsnull;
+      return 0;
 
     return ent->mData;
   }
 
   /**
    * put a new value for the associated key
    * @param aKey the key to put
    * @param aData the new data
--- a/xpcom/glue/nsStringAPI.cpp
+++ b/xpcom/glue/nsStringAPI.cpp
@@ -263,33 +263,33 @@ nsAString::EqualsLiteral(const char *aAS
 
   for (; begin < end; ++begin, ++aASCIIString) {
     if (!*aASCIIString || !NS_IsAscii(*begin) ||
         (char) *begin != *aASCIIString) {
       return false;
     }
   }
 
-  return *aASCIIString == nsnull;
+  return *aASCIIString == '\0';
 }
 
 bool
 nsAString::LowerCaseEqualsLiteral(const char *aASCIIString) const
 {
   const PRUnichar *begin, *end;
   BeginReading(&begin, &end);
 
   for (; begin < end; ++begin, ++aASCIIString) {
     if (!*aASCIIString || !NS_IsAscii(*begin) ||
         NS_ToLower((char) *begin) != *aASCIIString) {
       return false;
     }
   }
 
-  return *aASCIIString == nsnull;
+  return *aASCIIString == '\0';
 }
 
 PRInt32
 nsAString::Find(const self_type& aStr, PRUint32 aOffset,
                 ComparatorFunc c) const
 {
   const char_type *begin, *end;
   PRUint32 selflen = BeginReading(&begin, &end);