Bug 784739 - Switch from NULL to nullptr in content/; r=ehsan

--HG--
extra : rebase_source : cfdb682506acc14ec811e21ae42f067950e1ff0c
This commit is contained in:
matekm 2013-04-02 21:14:24 -04:00
parent 932a76ee24
commit 00c2965124
46 changed files with 122 additions and 122 deletions

View File

@ -429,7 +429,7 @@ public:
* @param aNameSpaceID The namespace ID of the attribute. Must not
* be kNameSpaceID_Unknown.
* @param aName The name atom of the attribute. Must not be null.
* @param aValues a NULL-terminated array of pointers to atom values to test
* @param aValues a nullptr-terminated array of pointers to atom values to test
* against.
* @param aCaseSensitive Whether to do a case-sensitive compare on the values.
* @return ATTR_MISSING, ATTR_VALUE_NO_MATCH or the non-negative index

View File

@ -198,21 +198,21 @@ DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
nsCOMPtr<nsIDocument> doc = do_QueryInterface(document);
nsCOMPtr<nsIContent> root;
rv = doc->CreateElem(NS_LITERAL_STRING("html"), NULL, kNameSpaceID_XHTML,
rv = doc->CreateElem(NS_LITERAL_STRING("html"), nullptr, kNameSpaceID_XHTML,
getter_AddRefs(root));
NS_ENSURE_SUCCESS(rv, rv);
rv = doc->AppendChildTo(root, false);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> head;
rv = doc->CreateElem(NS_LITERAL_STRING("head"), NULL, kNameSpaceID_XHTML,
rv = doc->CreateElem(NS_LITERAL_STRING("head"), nullptr, kNameSpaceID_XHTML,
getter_AddRefs(head));
NS_ENSURE_SUCCESS(rv, rv);
rv = root->AppendChildTo(head, false);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> title;
rv = doc->CreateElem(NS_LITERAL_STRING("title"), NULL, kNameSpaceID_XHTML,
rv = doc->CreateElem(NS_LITERAL_STRING("title"), nullptr, kNameSpaceID_XHTML,
getter_AddRefs(title));
NS_ENSURE_SUCCESS(rv, rv);
rv = head->AppendChildTo(title, false);
@ -227,7 +227,7 @@ DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> body;
rv = doc->CreateElem(NS_LITERAL_STRING("body"), NULL, kNameSpaceID_XHTML,
rv = doc->CreateElem(NS_LITERAL_STRING("body"), nullptr, kNameSpaceID_XHTML,
getter_AddRefs(body));
NS_ENSURE_SUCCESS(rv, rv);
rv = root->AppendChildTo(body, false);

View File

@ -215,7 +215,7 @@ nsIContent::HasIndependentSelection()
dom::Element*
nsIContent::GetEditingHost()
{
// If this isn't editable, return NULL.
// If this isn't editable, return nullptr.
NS_ENSURE_TRUE(IsEditableInternal(), nullptr);
nsIDocument* doc = GetCurrentDoc();
@ -340,7 +340,7 @@ nsIContent::GetBaseURI() const
static inline JSObject*
GetJSObjectChild(nsWrapperCache* aCache)
{
return aCache->PreservingWrapper() ? aCache->GetWrapperPreserveColor() : NULL;
return aCache->PreservingWrapper() ? aCache->GetWrapperPreserveColor() : nullptr;
}
static bool

View File

@ -50,10 +50,10 @@ already_AddRefed<nsIURI>
ThirdPartyUtil::GetURIFromWindow(nsIDOMWindow* aWin)
{
nsCOMPtr<nsIScriptObjectPrincipal> scriptObjPrin = do_QueryInterface(aWin);
NS_ENSURE_TRUE(scriptObjPrin, NULL);
NS_ENSURE_TRUE(scriptObjPrin, nullptr);
nsIPrincipal* prin = scriptObjPrin->GetPrincipal();
NS_ENSURE_TRUE(prin, NULL);
NS_ENSURE_TRUE(prin, nullptr);
nsCOMPtr<nsIURI> result;
prin->GetURI(getter_AddRefs(result));

View File

@ -220,7 +220,7 @@ NS_IMPL_CYCLE_COLLECTION_4(nsContentIterator,
nsContentIterator::nsContentIterator(bool aPre) :
// don't need to explicitly initialize |nsCOMPtr|s, they will automatically
// be NULL
// be nullptr
mCachedIndex(0), mIsDone(false), mPre(aPre)
{
}
@ -613,7 +613,7 @@ nsContentIterator::GetNextSibling(nsINode* aNode,
if (aIndexes) {
// pop node off the stack, go up one level and return parent or fail.
// Don't leave the index empty, especially if we're
// returning NULL. This confuses other parts of the code.
// returning nullptr. This confuses other parts of the code.
if (aIndexes->Length() > 1) {
aIndexes->RemoveElementAt(aIndexes->Length()-1);
}
@ -749,7 +749,7 @@ nsContentIterator::NextNode(nsINode* aNode, nsTArray<int32_t>* aIndexes)
// else it's the parent, update cache
if (aIndexes) {
// Pop an entry off the index stack. Don't leave the index empty,
// especially if we're returning NULL. This confuses other parts of the
// especially if we're returning nullptr. This confuses other parts of the
// code.
if (aIndexes->Length() > 1) {
aIndexes->RemoveElementAt(aIndexes->Length()-1);

View File

@ -6419,7 +6419,7 @@ nsContentUtils::FindInternalContentViewer(const char* aType,
// one helper factory, please
nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
if (!catMan)
return NULL;
return nullptr;
nsCOMPtr<nsIDocumentLoaderFactory> docFactory;
@ -6448,7 +6448,7 @@ nsContentUtils::FindInternalContentViewer(const char* aType,
}
#endif // MOZ_MEDIA
return NULL;
return nullptr;
}
// static
@ -6522,7 +6522,7 @@ nsContentUtils::SetUpChannelOwner(nsIPrincipal* aLoadingPrincipal,
// can't provide their own security context!
//
// (Currently chrome URIs set the owner when they are created!
// So setting a NULL owner would be bad!)
// So setting a nullptr owner would be bad!)
//
// If aForceOwner is true, the owner will be set, even for a channel that
// can provide its own security context. This is used for the HTML5 IFRAME

View File

@ -309,7 +309,7 @@ nsIContent * const *
nsDOMAttribute::GetChildArray(uint32_t* aChildCount) const
{
*aChildCount = 0;
return NULL;
return nullptr;
}
int32_t

View File

@ -5055,7 +5055,7 @@ nsDocument::Register(JSContext* aCx, const nsAString& aName,
JSObject* protoObject;
if (!aOptions.mPrototype) {
protoObject = JS_NewObject(aCx, NULL, htmlProto, NULL);
protoObject = JS_NewObject(aCx, nullptr, htmlProto, nullptr);
if (!protoObject) {
rv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
@ -11184,7 +11184,7 @@ nsDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
0;
aWindowSizes->mDOMOther +=
mStyledLinks.SizeOfExcludingThis(NULL, aWindowSizes->mMallocSizeOf);
mStyledLinks.SizeOfExcludingThis(nullptr, aWindowSizes->mMallocSizeOf);
aWindowSizes->mDOMOther +=
mIdentifierMap.SizeOfExcludingThis(nsIdentifierMapEntry::SizeOfExcludingThis,

View File

@ -942,7 +942,7 @@ nsFrameLoader::ShowRemoteFrame(const nsIntSize& size,
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (OwnerIsBrowserOrAppFrame() && os && !mRemoteBrowserInitialized) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
"remote-browser-frame-shown", NULL);
"remote-browser-frame-shown", nullptr);
mRemoteBrowserInitialized = true;
}
} else {
@ -1679,7 +1679,7 @@ nsFrameLoader::MaybeCreateDocShell()
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
"in-process-browser-or-app-frame-shown", NULL);
"in-process-browser-or-app-frame-shown", nullptr);
}
if (mMessageManager) {

View File

@ -246,7 +246,7 @@ public:
* The "current" render frame is the one on which the most recent
* remote layer-tree transaction was executed. If no content has
* been drawn yet, or the remote browser doesn't have any drawn
* content for whatever reason, return NULL. The returned render
* content for whatever reason, return nullptr. The returned render
* frame has an associated shadow layer tree.
*
* Note that the returned render frame might not be a frame

View File

@ -380,7 +380,7 @@ nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
if (mCallback->DoSendSyncMessage(aMessageName, data, &retval)) {
JSAutoRequest ar(aCx);
uint32_t len = retval.Length();
JSObject* dataArray = JS_NewArrayObject(aCx, len, NULL);
JSObject* dataArray = JS_NewArrayObject(aCx, len, nullptr);
NS_ENSURE_TRUE(dataArray, NS_ERROR_OUT_OF_MEMORY);
for (uint32_t i = 0; i < len; ++i) {
@ -657,7 +657,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
JSAutoCompartment ac(ctx, object);
// The parameter for the listener function.
JSObject* param = JS_NewObject(ctx, NULL, NULL, NULL);
JSObject* param = JS_NewObject(ctx, nullptr, nullptr, nullptr);
NS_ENSURE_TRUE(param, NS_ERROR_OUT_OF_MEMORY);
JS::Value targetv;
@ -670,7 +670,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
if (!aObjectsArray) {
// Because we want JS messages to have always the same properties,
// create array even if len == 0.
aObjectsArray = JS_NewArrayObject(ctx, 0, NULL);
aObjectsArray = JS_NewArrayObject(ctx, 0, nullptr);
if (!aObjectsArray) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -692,14 +692,14 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
static_cast<const jschar*>(aMessage.BeginReading()),
aMessage.Length());
NS_ENSURE_TRUE(jsMessage, NS_ERROR_OUT_OF_MEMORY);
JS_DefineProperty(ctx, param, "target", targetv, NULL, NULL, JSPROP_ENUMERATE);
JS_DefineProperty(ctx, param, "target", targetv, nullptr, nullptr, JSPROP_ENUMERATE);
JS_DefineProperty(ctx, param, "name",
STRING_TO_JSVAL(jsMessage), NULL, NULL, JSPROP_ENUMERATE);
STRING_TO_JSVAL(jsMessage), nullptr, nullptr, JSPROP_ENUMERATE);
JS_DefineProperty(ctx, param, "sync",
BOOLEAN_TO_JSVAL(aSync), NULL, NULL, JSPROP_ENUMERATE);
JS_DefineProperty(ctx, param, "json", json, NULL, NULL, JSPROP_ENUMERATE); // deprecated
JS_DefineProperty(ctx, param, "data", json, NULL, NULL, JSPROP_ENUMERATE);
JS_DefineProperty(ctx, param, "objects", objectsv.jsval_value(), NULL, NULL, JSPROP_ENUMERATE);
BOOLEAN_TO_JSVAL(aSync), nullptr, nullptr, JSPROP_ENUMERATE);
JS_DefineProperty(ctx, param, "json", json, nullptr, nullptr, JSPROP_ENUMERATE); // deprecated
JS_DefineProperty(ctx, param, "data", json, nullptr, nullptr, JSPROP_ENUMERATE);
JS_DefineProperty(ctx, param, "objects", objectsv.jsval_value(), nullptr, nullptr, JSPROP_ENUMERATE);
JS::Value thisValue = JSVAL_VOID;
@ -1084,7 +1084,7 @@ nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
options.setNoScriptRval(true)
.setFileAndLine(url.get(), 1)
.setPrincipals(nsJSPrincipals::get(mPrincipal));
JS::RootedObject empty(mCx, NULL);
JS::RootedObject empty(mCx, nullptr);
JSScript* script = JS::Compile(mCx, empty, options,
dataString.get(), dataString.Length());

View File

@ -230,8 +230,8 @@ nsPropertyTable::SetPropertyInternal(nsPropertyOwner aObject,
(PL_DHashTableOperate(&propertyList->mObjectValueMap, aObject, PL_DHASH_ADD));
if (!entry)
return NS_ERROR_OUT_OF_MEMORY;
// A NULL entry->key is the sign that the entry has just been allocated
// for us. If it's non-NULL then we have an existing entry.
// A nullptr entry->key is the sign that the entry has just been allocated
// for us. If it's non-nullptr then we have an existing entry.
if (entry->key) {
if (aOldValue)
*aOldValue = entry->value;
@ -343,7 +343,7 @@ size_t
nsPropertyTable::PropertyList::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
{
size_t n = aMallocSizeOf(this);
n += PL_DHashTableSizeOfExcludingThis(&mObjectValueMap, NULL, aMallocSizeOf);
n += PL_DHashTableSizeOfExcludingThis(&mObjectValueMap, nullptr, aMallocSizeOf);
return n;
}

View File

@ -218,7 +218,7 @@ nsRange::CreateRange(nsIDOMNode* aStartParent, int32_t aStartOffset,
nsRange** aRange)
{
MOZ_ASSERT(aRange);
*aRange = NULL;
*aRange = nullptr;
nsCOMPtr<nsINode> startParent = do_QueryInterface(aStartParent);
NS_ENSURE_ARG_POINTER(startParent);

View File

@ -152,7 +152,7 @@ public:
do_QueryInterface(aGlobal.Get());
if (!window || ! principal) {
aRv.Throw(NS_ERROR_FAILURE);
return NULL;
return nullptr;
}
nsRefPtr<nsXMLHttpRequest> req = new nsXMLHttpRequest();
@ -179,7 +179,7 @@ public:
void Construct(nsIPrincipal* aPrincipal,
nsPIDOMWindow* aOwnerWindow,
nsIURI* aBaseURI = NULL)
nsIURI* aBaseURI = nullptr)
{
MOZ_ASSERT(aPrincipal);
MOZ_ASSERT_IF(aOwnerWindow, aOwnerWindow->IsInnerWindow());

View File

@ -269,7 +269,7 @@ public:
*
* aBounds specifies the bounds of the drawing operation that will be
* drawn to the target, it is given in device space! This function will
* change aBounds to incorporate shadow bounds. If this is NULL the drawing
* change aBounds to incorporate shadow bounds. If this is nullptr the drawing
* operation will be assumed to cover an infinite rect.
*/
class AdjustedTarget
@ -1419,7 +1419,7 @@ CanvasRenderingContext2D::CreatePattern(const HTMLImageOrCanvasOrVideoElement& e
repeatMode = CanvasPattern::NOREPEAT;
} else {
error.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return NULL;
return nullptr;
}
Element* htmlElement;
@ -1430,7 +1430,7 @@ CanvasRenderingContext2D::CreatePattern(const HTMLImageOrCanvasOrVideoElement& e
nsIntSize size = canvas->GetSize();
if (size.width == 0 || size.height == 0) {
error.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return NULL;
return nullptr;
}
// Special case for Canvas, which could be an Azure canvas!
@ -1458,12 +1458,12 @@ CanvasRenderingContext2D::CreatePattern(const HTMLImageOrCanvasOrVideoElement& e
if (!res.mSurface) {
error.Throw(NS_ERROR_NOT_AVAILABLE);
return NULL;
return nullptr;
}
// Ignore nullptr cairo surfaces! See bug 666312.
if (!res.mSurface->CairoSurface() || res.mSurface->CairoStatus()) {
return NULL;
return nullptr;
}
EnsureTarget();
@ -2253,7 +2253,7 @@ CanvasRenderingContext2D::MeasureText(const nsAString& rawText,
Optional<double> maxWidth;
error = DrawOrMeasureText(rawText, 0, 0, maxWidth, TEXT_DRAW_OPERATION_MEASURE, &width);
if (error.Failed()) {
return NULL;
return nullptr;
}
nsRefPtr<nsIDOMTextMetrics> textMetrics = new TextMetrics(width);
@ -3320,13 +3320,13 @@ CanvasRenderingContext2D::GetImageData(JSContext* aCx, double aSx,
EnsureTarget();
if (!IsTargetValid()) {
error.Throw(NS_ERROR_FAILURE);
return NULL;
return nullptr;
}
if (!mCanvasElement && !mDocShell) {
NS_ERROR("No canvas element and no docshell in GetImageData!!!");
error.Throw(NS_ERROR_DOM_SECURITY_ERR);
return NULL;
return nullptr;
}
// Check only if we have a canvas element; if we were created with a docshell,
@ -3336,18 +3336,18 @@ CanvasRenderingContext2D::GetImageData(JSContext* aCx, double aSx,
{
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
error.Throw(NS_ERROR_DOM_SECURITY_ERR);
return NULL;
return nullptr;
}
if (!NS_finite(aSx) || !NS_finite(aSy) ||
!NS_finite(aSw) || !NS_finite(aSh)) {
error.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return NULL;
return nullptr;
}
if (!aSw || !aSh) {
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return NULL;
return nullptr;
}
int32_t x = JS_DoubleToInt32(aSx);
@ -3381,7 +3381,7 @@ CanvasRenderingContext2D::GetImageData(JSContext* aCx, double aSx,
JSObject* array;
error = GetImageDataArray(aCx, x, y, w, h, &array);
if (error.Failed()) {
return NULL;
return nullptr;
}
MOZ_ASSERT(array);
@ -3689,14 +3689,14 @@ CreateImageData(JSContext* cx, CanvasRenderingContext2D* context,
CheckedInt<uint32_t> len = CheckedInt<uint32_t>(w) * h * 4;
if (!len.isValid()) {
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return NULL;
return nullptr;
}
// Create the fast typed array; it's initialized to 0 by default.
JSObject* darray = Uint8ClampedArray::Create(cx, context, len.value());
if (!darray) {
error.Throw(NS_ERROR_OUT_OF_MEMORY);
return NULL;
return nullptr;
}
nsRefPtr<mozilla::dom::ImageData> imageData =
@ -3710,7 +3710,7 @@ CanvasRenderingContext2D::CreateImageData(JSContext* cx, double sw,
{
if (!sw || !sh) {
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return NULL;
return nullptr;
}
int32_t wi = JS_DoubleToInt32(sw);

View File

@ -44,7 +44,7 @@ void
ImageData::DropData()
{
if (mData) {
mData = NULL;
mData = nullptr;
NS_DROP_JS_OBJECTS(this, ImageData);
}
}

View File

@ -314,7 +314,7 @@ GLenum WebGLContext::CheckedBufferData(GLenum target,
return LOCAL_GL_INVALID_VALUE;
}
#endif
WebGLBuffer *boundBuffer = NULL;
WebGLBuffer *boundBuffer = nullptr;
if (target == LOCAL_GL_ARRAY_BUFFER) {
boundBuffer = mBoundArrayBuffer;
} else if (target == LOCAL_GL_ELEMENT_ARRAY_BUFFER) {
@ -342,7 +342,7 @@ WebGLContext::BufferData(WebGLenum target, WebGLsizeiptr size,
if (!IsContextStable())
return;
WebGLBuffer *boundBuffer = NULL;
WebGLBuffer *boundBuffer = nullptr;
if (target == LOCAL_GL_ARRAY_BUFFER) {
boundBuffer = mBoundArrayBuffer;
@ -387,7 +387,7 @@ WebGLContext::BufferData(WebGLenum target, ArrayBuffer *data, WebGLenum usage)
return ErrorInvalidValue("bufferData: null object passed");
}
WebGLBuffer *boundBuffer = NULL;
WebGLBuffer *boundBuffer = nullptr;
if (target == LOCAL_GL_ARRAY_BUFFER) {
boundBuffer = mBoundArrayBuffer;
@ -425,7 +425,7 @@ WebGLContext::BufferData(WebGLenum target, ArrayBufferView& data, WebGLenum usag
if (!IsContextStable())
return;
WebGLBuffer *boundBuffer = NULL;
WebGLBuffer *boundBuffer = nullptr;
if (target == LOCAL_GL_ARRAY_BUFFER) {
boundBuffer = mBoundArrayBuffer;
@ -468,7 +468,7 @@ WebGLContext::BufferSubData(GLenum target, WebGLsizeiptr byteOffset,
return;
}
WebGLBuffer *boundBuffer = NULL;
WebGLBuffer *boundBuffer = nullptr;
if (target == LOCAL_GL_ARRAY_BUFFER) {
boundBuffer = mBoundArrayBuffer;
@ -506,7 +506,7 @@ WebGLContext::BufferSubData(WebGLenum target, WebGLsizeiptr byteOffset,
if (!IsContextStable())
return;
WebGLBuffer *boundBuffer = NULL;
WebGLBuffer *boundBuffer = nullptr;
if (target == LOCAL_GL_ARRAY_BUFFER) {
boundBuffer = mBoundArrayBuffer;
@ -731,7 +731,7 @@ WebGLContext::CopyTexSubImage2D_base(WebGLenum target,
// now that the size is known, create the buffer
// We need some zero pages, because GL doesn't guarantee the
// contents of a texture allocated with NULL data.
// contents of a texture allocated with nullptr data.
// Hopefully calloc will just mmap zero pages here.
void *tempZeroData = calloc(1, bytesNeeded);
if (!tempZeroData)
@ -4396,12 +4396,12 @@ WebGLContext::CompileShader(WebGLShader *shader)
const char *ts = translatedSrc.get();
gl->fShaderSource(shadername, 1, &ts, NULL);
gl->fShaderSource(shadername, 1, &ts, nullptr);
} else { // not useShaderSourceTranslation
// we just pass the raw untranslated shader source. We then can't use ANGLE idenfier mapping.
// that's really bad, as that means we can't be 100% conformant. We should work towards always
// using ANGLE identifier mapping.
gl->fShaderSource(shadername, 1, &s, NULL);
gl->fShaderSource(shadername, 1, &s, nullptr);
}
shader->SetTranslationSuccess();
@ -4875,11 +4875,11 @@ WebGLContext::TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum intern
if (format == LOCAL_GL_DEPTH_COMPONENT || format == LOCAL_GL_DEPTH_STENCIL) {
if (IsExtensionEnabled(WEBGL_depth_texture)) {
if (target != LOCAL_GL_TEXTURE_2D || data != NULL || level != 0)
if (target != LOCAL_GL_TEXTURE_2D || data != nullptr || level != 0)
return ErrorInvalidOperation("texImage2D: "
"with format of DEPTH_COMPONENT or DEPTH_STENCIL "
"target must be TEXTURE_2D, "
"data must be NULL, "
"data must be nullptr, "
"level must be zero");
}
else
@ -4954,7 +4954,7 @@ WebGLContext::TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum intern
}
} else {
// We need some zero pages, because GL doesn't guarantee the
// contents of a texture allocated with NULL data.
// contents of a texture allocated with nullptr data.
// Hopefully calloc will just mmap zero pages here.
void *tempZeroData = calloc(1, bytesNeeded);
if (!tempZeroData)

View File

@ -226,12 +226,12 @@ public:
}
T* operator->() const {
NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a NULL WebGLRefPtr with operator->()!");
NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a nullptr WebGLRefPtr with operator->()!");
return get();
}
T& operator*() const {
NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a NULL WebGLRefPtr with operator*()!");
NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a nullptr WebGLRefPtr with operator*()!");
return *get();
}

View File

@ -57,7 +57,7 @@ nsDOMEvent::nsDOMEvent(mozilla::dom::EventTarget* aOwner,
/*
A derived class might want to allocate its own type of aEvent
(derived from nsEvent). To do this, it should take care to pass
a non-NULL aEvent to this ctor, e.g.:
a non-nullptr aEvent to this ctor, e.g.:
nsDOMFooEvent::nsDOMFooEvent(..., nsEvent* aEvent)
: nsDOMEvent(..., aEvent ? aEvent : new nsFooEvent())

View File

@ -526,7 +526,7 @@ protected:
* @param aScrollableFrame A frame which will be scrolled by the event.
* The result of ComputeScrollTarget() is
* expected for this value.
* This can be NULL if there is no scrollable
* This can be nullptr if there is no scrollable
* frame. Then, this method uses root frame's
* line height or visible area's width and height.
*/

View File

@ -69,7 +69,7 @@ public:
// aContent must be:
// If the editor is for <input> or <textarea>, the element.
// If the editor is for contenteditable, the active editinghost.
// If the editor is for designMode, NULL.
// If the editor is for designMode, nullptr.
static void OnClickInEditor(nsPresContext* aPresContext,
nsIContent* aContent,
nsIDOMMouseEvent* aMouseEvent);
@ -78,7 +78,7 @@ public:
// aContent must be:
// If the editor is for <input> or <textarea>, the element.
// If the editor is for contenteditable, the active editinghost.
// If the editor is for designMode, NULL.
// If the editor is for designMode, nullptr.
static void OnFocusInEditor(nsPresContext* aPresContext,
nsIContent* aContent);

View File

@ -518,7 +518,7 @@ protected:
class WakeLockBoolWrapper {
public:
WakeLockBoolWrapper(bool val = false) : mValue(val), mOuter(NULL), mWakeLock(NULL) {}
WakeLockBoolWrapper(bool val = false) : mValue(val), mOuter(nullptr), mWakeLock(nullptr) {}
void SetOuter(HTMLMediaElement* outer) { mOuter = outer; }
operator bool() const { return mValue; }
WakeLockBoolWrapper& operator=(bool val);

View File

@ -217,7 +217,7 @@ HTMLAudioElement::MozWriteAudio(JSContext* aCx, JS::Value aData, ErrorResult& aR
JSObject* darray = &aData.toObject();
JS::AutoObjectRooter tvr(aCx);
JSObject* tsrc = NULL;
JSObject* tsrc = nullptr;
// Allow either Float32Array or plain JS Array
if (JS_IsFloat32Array(darray)) {

View File

@ -187,7 +187,7 @@ bool
HTMLButtonElement::IsDisabledForEvents(uint32_t aMessage)
{
nsIFormControlFrame* formControlFrame = GetFormControlFrame(false);
nsIFrame* formFrame = NULL;
nsIFrame* formFrame = nullptr;
if (formControlFrame) {
formFrame = do_QueryFrame(formControlFrame);
}

View File

@ -974,7 +974,7 @@ HTMLCanvasElement::GetContextAtIndex(int32_t index)
if (mCurrentContext && index == 0)
return mCurrentContext;
return NULL;
return nullptr;
}
bool

View File

@ -222,7 +222,7 @@ HTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
if (docshell) {
uint32_t newFlags = 0;
// If a NULL aValue is passed in, we want to clear the sandbox flags
// If a nullptr aValue is passed in, we want to clear the sandbox flags
// which we will do by setting them to 0.
if (aValue) {
nsAutoString strValue;

View File

@ -441,7 +441,7 @@ NS_IMPL_BOOL_ATTR(HTMLMediaElement, Controls, controls)
NS_IMPL_BOOL_ATTR(HTMLMediaElement, Autoplay, autoplay)
NS_IMPL_BOOL_ATTR(HTMLMediaElement, Loop, loop)
NS_IMPL_BOOL_ATTR(HTMLMediaElement, DefaultMuted, muted)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLMediaElement, Preload, preload, NULL)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLMediaElement, Preload, preload, nullptr)
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLMediaElement, MozAudioChannelType, mozaudiochannel, "normal")
already_AddRefed<DOMMediaStream>
@ -888,9 +888,9 @@ void HTMLMediaElement::LoadFromSourceChildren()
if (child->GetAttr(kNameSpaceID_None, nsGkAtoms::media, media) && !media.IsEmpty()) {
nsCSSParser cssParser;
nsRefPtr<nsMediaList> mediaList(new nsMediaList());
cssParser.ParseMediaList(media, NULL, 0, mediaList, false);
cssParser.ParseMediaList(media, nullptr, 0, mediaList, false);
nsIPresShell* presShell = OwnerDoc()->GetShell();
if (presShell && !mediaList->Matches(presShell->GetPresContext(), NULL)) {
if (presShell && !mediaList->Matches(presShell->GetPresContext(), nullptr)) {
DispatchAsyncSourceError(child);
const PRUnichar* params[] = { media.get(), src.get() };
ReportLoadError("MediaLoadSourceMediaNotMatched", params, ArrayLength(params));
@ -1573,7 +1573,7 @@ HTMLMediaElement::BuildObjectFromTags(nsCStringHashKey::KeyType aKey,
}
JS::Value value = STRING_TO_JSVAL(string);
if (!JS_DefineProperty(args->cx, args->tags, aKey.Data(), value,
NULL, NULL, JSPROP_ENUMERATE)) {
nullptr, nullptr, JSPROP_ENUMERATE)) {
NS_WARNING("Failed to set metadata property");
args->error = true;
return PL_DHASH_STOP;
@ -1590,7 +1590,7 @@ HTMLMediaElement::MozGetMetadata(JSContext* cx, ErrorResult& aRv)
return nullptr;
}
JSObject* tags = JS_NewObject(cx, NULL, NULL, NULL);
JSObject* tags = JS_NewObject(cx, nullptr, nullptr, nullptr);
if (!tags) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
@ -2089,7 +2089,7 @@ HTMLMediaElement::WakeLockBoolWrapper& HTMLMediaElement::WakeLockBoolWrapper::op
pmService->NewWakeLock(NS_LITERAL_STRING("Playing_media"), mOuter->OwnerDoc()->GetWindow(), getter_AddRefs(mWakeLock));
} else if (mWakeLock && val) {
mWakeLock->Unlock();
mWakeLock = NULL;
mWakeLock = nullptr;
}
mValue = val;
return *this;
@ -3424,7 +3424,7 @@ HTMLMediaElement::CopyInnerTo(Element* aDest)
if (frame && frame->GetType() == nsGkAtoms::HTMLVideoFrame &&
static_cast<nsVideoFrame*>(frame)->ShouldDisplayPoster()) {
nsIContent* content = static_cast<nsVideoFrame*>(frame)->GetPosterImage();
element = content ? content->AsElement() : NULL;
element = content ? content->AsElement() : nullptr;
} else {
element = const_cast<HTMLMediaElement*>(this);
}

View File

@ -124,7 +124,7 @@ NS_IMETHODIMP
HTMLPropertiesCollection::NamedItem(const nsAString& aName,
nsIDOMNode** aResult)
{
*aResult = NULL;
*aResult = nullptr;
return NS_OK;
}
@ -232,7 +232,7 @@ HTMLPropertiesCollection::EnsureFresh()
mProperties.Clear();
mNames->Clear();
// We don't clear NamedItemEntries because the PropertyNodeLists must be live.
mNamedItemEntries.EnumerateRead(MarkDirty, NULL);
mNamedItemEntries.EnumerateRead(MarkDirty, nullptr);
if (!mRoot->HasAttr(kNameSpaceID_None, nsGkAtoms::itemscope)) {
return;
}
@ -267,7 +267,7 @@ GetElementByIdForConnectedSubtree(nsIContent* aContent, const nsIAtom* aId)
aContent = aContent->GetNextNode();
} while(aContent);
return NULL;
return nullptr;
}
void
@ -376,7 +376,7 @@ PropertyNodeList::Item(uint32_t aIndex, nsIDOMNode** aReturn)
EnsureFresh();
nsINode* element = mElements.SafeElementAt(aIndex);
if (!element) {
*aReturn = NULL;
*aReturn = nullptr;
return NS_OK;
}
return CallQueryInterface(element, aReturn);

View File

@ -455,7 +455,7 @@ bool
HTMLTextAreaElement::IsDisabledForEvents(uint32_t aMessage)
{
nsIFormControlFrame* formControlFrame = GetFormControlFrame(false);
nsIFrame* formFrame = NULL;
nsIFrame* formFrame = nullptr;
if (formControlFrame) {
formFrame = do_QueryFrame(formControlFrame);
}

View File

@ -3253,7 +3253,7 @@ nsDOMSettableTokenListPropertyDestructor(void *aObject, nsIAtom *aProperty,
nsDOMSettableTokenList*
nsGenericHTMLElement::GetTokenList(nsIAtom* aAtom)
{
nsDOMSettableTokenList* list = NULL;
nsDOMSettableTokenList* list = nullptr;
if (HasProperties()) {
list = static_cast<nsDOMSettableTokenList*>(GetProperty(aAtom));
}

View File

@ -503,7 +503,7 @@ protected:
int32_t aEndIndex);
/**
* Get the frame as an nsISelectControlFrame (MAY RETURN NULL)
* Get the frame as an nsISelectControlFrame (MAY RETURN nullptr)
* @return the select frame, or null
*/
nsISelectControlFrame* GetSelectFrame();

View File

@ -3161,7 +3161,7 @@ static const struct MidasCommand gMidasCommandTable[] = {
{ "saveas", "cmd_saveAs", "", true, false },
{ "print", "cmd_print", "", true, false },
#endif
{ NULL, NULL, NULL, false, false }
{ nullptr, nullptr, nullptr, false, false }
};
#define MidasCommandCount ((sizeof(gMidasCommandTable) / sizeof(struct MidasCommand)) - 1)

View File

@ -567,7 +567,7 @@ nsSMILAnimationController::DoMilestoneSamples()
for (uint32_t i = 0; i < length; ++i) {
SVGAnimationElement* elem = params.mElements[i].get();
NS_ABORT_IF_FALSE(elem, "NULL animation element in list");
NS_ABORT_IF_FALSE(elem, "nullptr animation element in list");
nsSMILTimeContainer* container = elem->GetTimeContainer();
if (!container)
// The container may be nullptr if the element has been detached from its

View File

@ -80,7 +80,7 @@ public:
* media attribute is not allowed).
*
* @param aSpec The string containing a clock value, e.g. "10s"
* @param aResult The parsed result. May be NULL (e.g. if this method is
* @param aResult The parsed result. May be nullptr (e.g. if this method is
* being called just to test if aSpec is a valid clock value).
* [OUT]
* @param aFlags A combination of the kClockValue* bit flags OR'ed together

View File

@ -485,8 +485,8 @@ void
nsSMILTimedElement::SetTimeClient(nsSMILAnimationFunction* aClient)
{
//
// No need to check for NULL. A NULL parameter simply means to remove the
// previous client which we do by setting to NULL anyway.
// No need to check for nullptr. A nullptr parameter simply means to remove the
// previous client which we do by setting to nullptr anyway.
//
mClient = aClient;

View File

@ -1131,7 +1131,7 @@ nsXBLBinding::DoInitJSClass(JSContext *cx, JSObject *global, JSObject *obj,
}
JS::Value val;
JSObject* proto = NULL;
JSObject* proto = nullptr;
if ((!::JS_LookupPropertyWithFlags(cx, global, className.get(), 0, &val)) ||
JSVAL_IS_PRIMITIVE(val)) {
// We need to initialize the class.

View File

@ -54,7 +54,7 @@ public:
virtual nsresult EnsureScriptEnvironment();
void ClearScriptContext()
{
mScriptContext = NULL;
mScriptContext = nullptr;
}
virtual nsIScriptContext *GetContext();
@ -174,8 +174,8 @@ JSClass nsXBLDocGlobalObject::gSharedGlobalClass = {
nsXBLDocGlobalObject_getProperty, nsXBLDocGlobalObject_setProperty,
JS_EnumerateStub, nsXBLDocGlobalObject_resolve,
JS_ConvertStub, nsXBLDocGlobalObject_finalize,
nsXBLDocGlobalObject_checkAccess, NULL, NULL, NULL,
NULL
nsXBLDocGlobalObject_checkAccess, nullptr, nullptr, nullptr,
nullptr
};
//----------------------------------------------------------------------
@ -263,7 +263,7 @@ nsXBLDocGlobalObject::EnsureScriptEnvironment()
MOZ_ASSERT(newCtx);
newCtx->WillInitializeContext();
// NOTE: We init this context with a NULL global, so we automatically
// NOTE: We init this context with a nullptr global, so we automatically
// hook up to the existing nsIScriptGlobalObject global setup by
// nsGlobalWindow.
DebugOnly<nsresult> rv = newCtx->InitContext();
@ -351,7 +351,7 @@ void
nsXBLDocGlobalObject::OnFinalize(JSObject* aObject)
{
NS_ASSERTION(aObject == mJSObject, "Wrong object finalized!");
mJSObject = NULL;
mJSObject = nullptr;
}
void
@ -379,7 +379,7 @@ nsXBLDocGlobalObject::GetPrincipal()
nsCOMPtr<nsIDocument> document = docInfo->GetDocument();
if (!document)
return NULL;
return nullptr;
return document->NodePrincipal();
}
@ -533,7 +533,7 @@ nsXBLPrototypeBinding*
nsXBLDocumentInfo::GetPrototypeBinding(const nsACString& aRef)
{
if (!mBindingTable)
return NULL;
return nullptr;
if (aRef.IsEmpty()) {
// Return our first binding

View File

@ -123,7 +123,7 @@ nsXBLProtoImplMethod::InstallMember(JSContext* aCx,
!::JS_DefineUCProperty(aCx, aTargetClassObject,
static_cast<const jschar*>(mName),
name.Length(), OBJECT_TO_JSVAL(method),
NULL, NULL, JSPROP_ENUMERATE)) {
nullptr, nullptr, JSPROP_ENUMERATE)) {
return NS_ERROR_OUT_OF_MEMORY;
}
}

View File

@ -1028,7 +1028,7 @@ nsXBLPrototypeBinding::ConstructAttributeTable(nsIContent* aElement)
// so that we don't have to convert from Unicode to ASCII and then back
char* token = nsCRT::strtok( str, ", ", &newStr );
while( token != NULL ) {
while( token != nullptr ) {
// Build an atom out of this attribute.
nsCOMPtr<nsIAtom> atom;
int32_t atomNsID = kNameSpaceID_None;
@ -1137,7 +1137,7 @@ nsXBLPrototypeBinding::ConstructInsertionTable(nsIContent* aContent)
// so that we don't have to convert from Unicode to ASCII and then back
char* token = nsCRT::strtok( str, "| ", &newStr );
while( token != NULL ) {
while( token != nullptr ) {
nsAutoString tok;
tok.AssignWithConversion(token);
@ -1218,7 +1218,7 @@ nsXBLPrototypeBinding::ConstructInterfaceTable(const nsAString& aImpls)
// so that we don't have to convert from Unicode to ASCII and then back
char* token = nsCRT::strtok( str, ", ", &newStr );
while( token != NULL ) {
while( token != nullptr ) {
// get the InterfaceInfo for the name
nsCOMPtr<nsIInterfaceInfo> iinfo;
infoManager->GetInfoForName(token, getter_AddRefs(iinfo));

View File

@ -814,7 +814,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
char* str = ToNewCString(modifiers);
char* newStr;
char* token = nsCRT::strtok( str, ", \t", &newStr );
while( token != NULL ) {
while( token != nullptr ) {
if (PL_strcmp(token, "shift") == 0)
mKeyMask |= cShift | cShiftMask;
else if (PL_strcmp(token, "alt") == 0)

View File

@ -115,8 +115,8 @@ nsXBLResourceLoader::LoadResources(bool* aResult)
}
// Now kick off the image load...
// Passing NULL for pretty much everything -- cause we don't care!
// XXX: initialDocumentURI is NULL!
// Passing nullptr for pretty much everything -- cause we don't care!
// XXX: initialDocumentURI is nullptr!
nsRefPtr<imgRequestProxy> req;
nsContentUtils::LoadImage(url, doc, docPrincipal, docURL, nullptr,
nsIRequest::LOAD_BACKGROUND,

View File

@ -36,7 +36,7 @@ FunctionCall::evaluateToNumber(Expr* aExpr, txIEvalContext* aContext,
/*
* Evaluates the given Expression and converts its result to a NodeSet.
* If the result is not a NodeSet NULL is returned.
* If the result is not a NodeSet nullptr is returned.
*/
nsresult
FunctionCall::evaluateToNodeSet(Expr* aExpr, txIEvalContext* aContext,

View File

@ -16,7 +16,7 @@ nsresult
PredicateList::evaluatePredicates(txNodeSet* nodes,
txIMatchContext* aContext)
{
NS_ASSERTION(nodes, "called evaluatePredicates with NULL NodeSet");
NS_ASSERTION(nodes, "called evaluatePredicates with nullptr NodeSet");
nsresult rv = NS_OK;
uint32_t i, len = mPredicates.Length();

View File

@ -44,7 +44,7 @@
using namespace mozilla::dom;
#define TX_ENSURE_CURRENTNODE \
NS_ASSERTION(mCurrentNode, "mCurrentNode is NULL"); \
NS_ASSERTION(mCurrentNode, "mCurrentNode is nullptr"); \
if (!mCurrentNode) \
return NS_ERROR_UNEXPECTED

View File

@ -1189,7 +1189,7 @@ nsXULElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
if (commandEvent) {
commandEvent->GetSourceEvent(getter_AddRefs(domEvent));
} else {
domEvent = NULL;
domEvent = nullptr;
}
}

View File

@ -115,8 +115,8 @@ JSClass nsXULPDGlobalObject::gSharedGlobalClass = {
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0),
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, nsXULPDGlobalObject_resolve, JS_ConvertStub,
nsXULPDGlobalObject_finalize, NULL, NULL, NULL, NULL,
NULL
nsXULPDGlobalObject_finalize, nullptr, nullptr, nullptr, nullptr,
nullptr
};
@ -712,7 +712,7 @@ nsXULPrototypeDocument::GetScriptGlobalObject()
nsXULPDGlobalObject::nsXULPDGlobalObject(nsXULPrototypeDocument* owner)
: mGlobalObjectOwner(owner)
, mJSObject(NULL)
, mJSObject(nullptr)
{
}
@ -784,7 +784,7 @@ nsXULPDGlobalObject::EnsureScriptEnvironment()
ctxNew->DidInitializeContext();
JSObject* global = ctxNew->GetNativeGlobal();
NS_ASSERTION(global, "GetNativeGlobal returned NULL!");
NS_ASSERTION(global, "GetNativeGlobal returned nullptr!");
mContext = ctxNew;
mJSObject = global;
@ -804,7 +804,7 @@ nsXULPDGlobalObject::GetScriptContext()
nsresult rv = EnsureScriptEnvironment();
if (NS_FAILED(rv)) {
NS_ERROR("Failed to setup script language");
return NULL;
return nullptr;
}
return mContext;
@ -826,15 +826,15 @@ nsXULPDGlobalObject::ClearGlobalObjectOwner()
if (this != nsXULPrototypeDocument::gSystemGlobal)
mCachedPrincipal = mGlobalObjectOwner->DocumentPrincipal();
mContext = NULL;
mGlobalObjectOwner = NULL;
mContext = nullptr;
mGlobalObjectOwner = nullptr;
}
void
nsXULPDGlobalObject::OnFinalize(JSObject* aObject)
{
mJSObject = NULL;
mJSObject = nullptr;
}
void