From 1b34910a0c9345d8eee661a582a3a62d48603413 Mon Sep 17 00:00:00 2001 From: "jband%netscape.com" Date: Mon, 23 Aug 1999 07:16:50 +0000 Subject: [PATCH] changed all those pesky instances of 'NULL' to 'nsnull' --- js/src/xpconnect/src/nsXPConnect.cpp | 58 ++++++++-------- js/src/xpconnect/src/xpccomponents.cpp | 58 ++++++++-------- js/src/xpconnect/src/xpccontext.cpp | 14 ++-- js/src/xpconnect/src/xpcconvert.cpp | 40 +++++------ js/src/xpconnect/src/xpcjsid.cpp | 48 +++++++------- js/src/xpconnect/src/xpclog.cpp | 2 +- js/src/xpconnect/src/xpcmaps.cpp | 20 +++--- js/src/xpconnect/src/xpcmodule.cpp | 4 +- js/src/xpconnect/src/xpcprivate.h | 22 +++---- js/src/xpconnect/src/xpcstack.cpp | 8 +-- js/src/xpconnect/src/xpcthreadcontext.cpp | 8 +-- js/src/xpconnect/src/xpcthrower.cpp | 14 ++-- js/src/xpconnect/src/xpcwrappedjs.cpp | 32 ++++----- js/src/xpconnect/src/xpcwrappedjsclass.cpp | 54 +++++++-------- js/src/xpconnect/src/xpcwrappednative.cpp | 62 ++++++++--------- .../xpconnect/src/xpcwrappednativeclass.cpp | 66 +++++++++---------- 16 files changed, 255 insertions(+), 255 deletions(-) diff --git a/js/src/xpconnect/src/nsXPConnect.cpp b/js/src/xpconnect/src/nsXPConnect.cpp index 90dc5a8f26b4..838faf10a729 100644 --- a/js/src/xpconnect/src/nsXPConnect.cpp +++ b/js/src/xpconnect/src/nsXPConnect.cpp @@ -31,7 +31,7 @@ NS_IMPL_ISUPPORTS(nsXPConnect, kXPConnectIID) const char XPC_COMPONENTS_STR[] = "Components"; -nsXPConnect* nsXPConnect::mSelf = NULL; +nsXPConnect* nsXPConnect::mSelf = nsnull; /***************************************************************************/ @@ -95,20 +95,20 @@ GetPerThreadData() if(PR_FAILURE == PR_NewThreadPrivateIndex(&index, xpc_ThreadDataDtorCB)) { NS_ASSERTION(0, "PR_NewThreadPrivateIndex failed!"); - return NULL; + return nsnull; } } data = (xpcPerThreadData*) PR_GetThreadPrivate(index); if(!data) { - if(NULL != (data = new xpcPerThreadData())) + if(nsnull != (data = new xpcPerThreadData())) { if(PR_FAILURE == PR_SetThreadPrivate(index, data)) { NS_ASSERTION(0, "PR_SetThreadPrivate failed!"); delete data; - data = NULL; + data = nsnull; } } else @@ -145,14 +145,14 @@ nsXPConnect::GetXPConnect() // static nsIInterfaceInfoManager* -nsXPConnect::GetInterfaceInfoManager(nsXPConnect* xpc /*= NULL*/) +nsXPConnect::GetInterfaceInfoManager(nsXPConnect* xpc /*= nsnull*/) { nsIInterfaceInfoManager* iim; nsXPConnect* xpcl = xpc; if(!xpcl && !(xpcl = GetXPConnect())) - return NULL; - if(NULL != (iim = xpcl->mInterfaceInfoManager)) + return nsnull; + if(nsnull != (iim = xpcl->mInterfaceInfoManager)) NS_ADDREF(iim); if(!xpc) NS_RELEASE(xpcl); @@ -161,14 +161,14 @@ nsXPConnect::GetInterfaceInfoManager(nsXPConnect* xpc /*= NULL*/) // static nsIJSContextStack* -nsXPConnect::GetContextStack(nsXPConnect* xpc /*= NULL*/) +nsXPConnect::GetContextStack(nsXPConnect* xpc /*= nsnull*/) { nsIJSContextStack* cs; nsXPConnect* xpcl = xpc; if(!xpcl && !(xpcl = GetXPConnect())) - return NULL; - if(NULL != (cs = xpcl->mContextStack)) + return nsnull; + if(nsnull != (cs = xpcl->mContextStack)) NS_ADDREF(cs); if(!xpc) NS_RELEASE(xpcl); @@ -177,7 +177,7 @@ nsXPConnect::GetContextStack(nsXPConnect* xpc /*= NULL*/) // static XPCContext* -nsXPConnect::GetContext(JSContext* cx, nsXPConnect* xpc /*= NULL*/) +nsXPConnect::GetContext(JSContext* cx, nsXPConnect* xpc /*= nsnull*/) { NS_PRECONDITION(cx,"bad param"); @@ -185,7 +185,7 @@ nsXPConnect::GetContext(JSContext* cx, nsXPConnect* xpc /*= NULL*/) nsXPConnect* xpcl = xpc; if(!xpcl && !(xpcl = GetXPConnect())) - return NULL; + return nsnull; xpcc = xpcl->mContextMap->Find(cx); if(!xpcc) xpcc = xpcl->NewContext(cx, JS_GetGlobalObject(cx)); @@ -196,13 +196,13 @@ nsXPConnect::GetContext(JSContext* cx, nsXPConnect* xpc /*= NULL*/) // static XPCJSThrower* -nsXPConnect::GetJSThrower(nsXPConnect* xpc /*= NULL */) +nsXPConnect::GetJSThrower(nsXPConnect* xpc /*= nsnull */) { XPCJSThrower* thrower; nsXPConnect* xpcl = xpc; if(!xpcl && !(xpcl = GetXPConnect())) - return NULL; + return nsnull; thrower = xpcl->mThrower; if(!xpc) NS_RELEASE(xpcl); @@ -238,11 +238,11 @@ nsXPConnect::IsISupportsDescendent(nsIInterfaceInfo* info) } nsXPConnect::nsXPConnect() - : mContextMap(NULL), - mArbitraryScriptable(NULL), - mInterfaceInfoManager(NULL), - mThrower(NULL), - mContextStack(NULL) + : mContextMap(nsnull), + mArbitraryScriptable(nsnull), + mInterfaceInfoManager(nsnull), + mThrower(nsnull), + mContextStack(nsnull) { NS_INIT_REFCNT(); NS_ADDREF_THIS(); @@ -273,7 +273,7 @@ nsXPConnect::~nsXPConnect() delete mThrower; if(mContextStack) nsServiceManager::ReleaseService("nsThreadJSContextStack", mContextStack); - mSelf = NULL; + mSelf = nsnull; } NS_IMETHODIMP @@ -310,10 +310,10 @@ nsXPConnect::InitJSContextWithNewWrappedGlobal(JSContext* aJSContext, nsIXPConnectWrappedNative** aWrapper) { AUTO_PUSH_JSCONTEXT2(aJSContext, this); - nsXPCWrappedNative* wrapper = NULL; - XPCContext* xpcc = NULL; + nsXPCWrappedNative* wrapper = nsnull; + XPCContext* xpcc = nsnull; if(!mContextMap->Find(aJSContext) && - NULL != (xpcc = NewContext(aJSContext, NULL, JS_FALSE))) + nsnull != (xpcc = NewContext(aJSContext, nsnull, JS_FALSE))) { wrapper = nsXPCWrappedNative::GetNewOrUsedWrapper(xpcc, aCOMObj, aIID); if(wrapper) @@ -321,7 +321,7 @@ nsXPConnect::InitJSContextWithNewWrappedGlobal(JSContext* aJSContext, if(JS_InitStandardClasses(aJSContext, wrapper->GetJSObject()) && xpcc->Init(wrapper->GetJSObject()) && (!AddComponentsObject || - NS_SUCCEEDED(AddNewComponentsObject(aJSContext, NULL)))) + NS_SUCCEEDED(AddNewComponentsObject(aJSContext, nsnull)))) { *aWrapper = wrapper; return NS_OK; @@ -336,7 +336,7 @@ nsXPConnect::InitJSContextWithNewWrappedGlobal(JSContext* aJSContext, delete xpcc; } XPC_LOG_ERROR(("nsXPConnect::InitJSContextWithNewWrappedGlobal failed")); - *aWrapper = NULL; + *aWrapper = nsnull; return NS_ERROR_FAILURE; } @@ -415,7 +415,7 @@ nsXPConnect::NewContext(JSContext* cx, JSObject* global, { XPC_LOG_ERROR(("nsXPConnect::NewContext failed")); delete xpcc; - xpcc = NULL; + xpcc = nsnull; } if(xpcc) mContextMap->Add(xpcc); @@ -445,7 +445,7 @@ nsXPConnect::WrapNative(JSContext* aJSContext, } } XPC_LOG_ERROR(("nsXPConnect::WrapNative failed")); - *aWrapper = NULL; + *aWrapper = nsnull; return NS_ERROR_FAILURE; } @@ -472,7 +472,7 @@ nsXPConnect::WrapJS(JSContext* aJSContext, } } XPC_LOG_ERROR(("nsXPConnect::WrapJS failed")); - *aWrapper = NULL; + *aWrapper = nsnull; return NS_ERROR_FAILURE; } @@ -558,7 +558,7 @@ nsXPConnect::GetSecurityManagerForJSContext(JSContext* aJSContext, return NS_ERROR_INVALID_ARG; } - if(NULL != (*aManager = xpcc->GetSecurityManager())) + if(nsnull != (*aManager = xpcc->GetSecurityManager())) NS_ADDREF(*aManager); *flags = xpcc->GetSecurityManagerFlags(); return NS_OK; diff --git a/js/src/xpconnect/src/xpccomponents.cpp b/js/src/xpconnect/src/xpccomponents.cpp index c835809619ac..7cd08dc1df43 100644 --- a/js/src/xpconnect/src/xpccomponents.cpp +++ b/js/src/xpconnect/src/xpccomponents.cpp @@ -99,11 +99,11 @@ nsXPCInterfaces::LookupProperty(JSContext *cx, JSObject *obj, JSBool* retval) { if(NS_SUCCEEDED(arbitrary->LookupProperty(cx, obj, id, objp, propp, wrapper, - NULL, retval)) && *retval) + nsnull, retval)) && *retval) return NS_OK; CacheDynaProp(cx, obj, id, wrapper, arbitrary); return arbitrary->LookupProperty(cx, obj, id, objp, propp, wrapper, - NULL, retval); + nsnull, retval); } NS_IMETHODIMP @@ -114,12 +114,12 @@ nsXPCInterfaces::GetProperty(JSContext *cx, JSObject *obj, JSBool* retval) { if(NS_SUCCEEDED(arbitrary->GetProperty(cx, obj, id, vp, wrapper, - NULL, retval)) && *retval && + nsnull, retval)) && *retval && *vp != JSVAL_VOID) return NS_OK; CacheDynaProp(cx, obj, id, wrapper, arbitrary); - return arbitrary->GetProperty(cx, obj, id, vp, wrapper, NULL, retval); + return arbitrary->GetProperty(cx, obj, id, vp, wrapper, nsnull, retval); } @@ -219,7 +219,7 @@ nsXPCInterfaces::RealizeInterface(JSContext *cx, JSObject *obj, jsid id; JSString *jstrid; - if(NULL != (jstrid = JS_InternString(cx, iface_name)) && + if(nsnull != (jstrid = JS_InternString(cx, iface_name)) && JS_ValueToId(cx, STRING_TO_JSVAL(jstrid), &id)) { CacheDynaProp(cx, obj, id, wrapper, arbitrary); @@ -233,10 +233,10 @@ nsXPCInterfaces::CacheDynaProp(JSContext *cx, JSObject *obj, jsid id, nsIXPCScriptable* arbitrary) { jsval idval; - const char* property_name = NULL; + const char* property_name = nsnull; if(JS_IdToValue(cx, id, &idval) && JSVAL_IS_STRING(idval) && - (property_name = JS_GetStringBytes(JSVAL_TO_STRING(idval))) != NULL && + (property_name = JS_GetStringBytes(JSVAL_TO_STRING(idval))) != nsnull && property_name[0] != '{') // we only allow interfaces by name here { nsJSIID* nsid = nsJSIID::NewID(property_name); @@ -256,7 +256,7 @@ nsXPCInterfaces::CacheDynaProp(JSContext *cx, JSObject *obj, jsid id, JSBool retval; jsval val = OBJECT_TO_JSVAL(idobj); arbitrary->SetProperty(cx, obj, id, &val, wrapper, - NULL, &retval); + nsnull, &retval); } NS_RELEASE(nsid_wrapper); } @@ -352,11 +352,11 @@ nsXPCClasses::LookupProperty(JSContext *cx, JSObject *obj, JSBool* retval) { if(NS_SUCCEEDED(arbitrary->LookupProperty(cx, obj, id, objp, propp, wrapper, - NULL, retval)) && *retval) + nsnull, retval)) && *retval) return NS_OK; CacheDynaProp(cx, obj, id, wrapper, arbitrary); return arbitrary->LookupProperty(cx, obj, id, objp, propp, wrapper, - NULL, retval); + nsnull, retval); } NS_IMETHODIMP @@ -367,12 +367,12 @@ nsXPCClasses::GetProperty(JSContext *cx, JSObject *obj, JSBool* retval) { if(NS_SUCCEEDED(arbitrary->GetProperty(cx, obj, id, vp, wrapper, - NULL, retval)) && *retval && + nsnull, retval)) && *retval && *vp != JSVAL_VOID) return NS_OK; CacheDynaProp(cx, obj, id, wrapper, arbitrary); - return arbitrary->GetProperty(cx, obj, id, vp, wrapper, NULL, retval); + return arbitrary->GetProperty(cx, obj, id, vp, wrapper, nsnull, retval); } @@ -458,7 +458,7 @@ nsXPCClasses::RealizeClass(JSContext *cx, JSObject *obj, jsid id; JSString *jstrid; - if(NULL != (jstrid = JS_InternString(cx, class_name)) && + if(nsnull != (jstrid = JS_InternString(cx, class_name)) && JS_ValueToId(cx, STRING_TO_JSVAL(jstrid), &id)) { CacheDynaProp(cx, obj, id, wrapper, arbitrary); @@ -472,10 +472,10 @@ nsXPCClasses::CacheDynaProp(JSContext *cx, JSObject *obj, jsid id, nsIXPCScriptable* arbitrary) { jsval idval; - const char* property_name = NULL; + const char* property_name = nsnull; if(JS_IdToValue(cx, id, &idval) && JSVAL_IS_STRING(idval) && - (property_name = JS_GetStringBytes(JSVAL_TO_STRING(idval))) != NULL && + (property_name = JS_GetStringBytes(JSVAL_TO_STRING(idval))) != nsnull && property_name[0] != '{') // we only allow progids here { nsJSCID* nsid = nsJSCID::NewID(property_name); @@ -495,7 +495,7 @@ nsXPCClasses::CacheDynaProp(JSContext *cx, JSObject *obj, jsid id, JSBool retval; jsval val = OBJECT_TO_JSVAL(idobj); arbitrary->SetProperty(cx, obj, id, &val, wrapper, - NULL, &retval); + nsnull, &retval); } NS_RELEASE(nsid_wrapper); } @@ -592,11 +592,11 @@ nsXPCClassesByID::LookupProperty(JSContext *cx, JSObject *obj, JSBool* retval) { if(NS_SUCCEEDED(arbitrary->LookupProperty(cx, obj, id, objp, propp, wrapper, - NULL, retval)) && *retval) + nsnull, retval)) && *retval) return NS_OK; CacheDynaProp(cx, obj, id, wrapper, arbitrary, JS_FALSE); return arbitrary->LookupProperty(cx, obj, id, objp, propp, wrapper, - NULL, retval); + nsnull, retval); } NS_IMETHODIMP @@ -607,12 +607,12 @@ nsXPCClassesByID::GetProperty(JSContext *cx, JSObject *obj, JSBool* retval) { if(NS_SUCCEEDED(arbitrary->GetProperty(cx, obj, id, vp, wrapper, - NULL, retval)) && *retval && + nsnull, retval)) && *retval && *vp != JSVAL_VOID) return NS_OK; CacheDynaProp(cx, obj, id, wrapper, arbitrary, JS_FALSE); - return arbitrary->GetProperty(cx, obj, id, vp, wrapper, NULL, retval); + return arbitrary->GetProperty(cx, obj, id, vp, wrapper, nsnull, retval); } @@ -705,7 +705,7 @@ nsXPCClassesByID::RealizeClass(JSContext *cx, JSObject *obj, jsid id; JSString *jstrid; - if(NULL != (jstrid = JS_InternString(cx, class_name)) && + if(nsnull != (jstrid = JS_InternString(cx, class_name)) && JS_ValueToId(cx, STRING_TO_JSVAL(jstrid), &id)) { CacheDynaProp(cx, obj, id, wrapper, arbitrary, knownToBeRegistered); @@ -744,10 +744,10 @@ nsXPCClassesByID::CacheDynaProp(JSContext *cx, JSObject *obj, jsid id, JSBool knownToBeRegistered) { jsval idval; - const char* property_name = NULL; + const char* property_name = nsnull; if(JS_IdToValue(cx, id, &idval) && JSVAL_IS_STRING(idval) && - (property_name = JS_GetStringBytes(JSVAL_TO_STRING(idval))) != NULL && + (property_name = JS_GetStringBytes(JSVAL_TO_STRING(idval))) != nsnull && property_name[0] == '{') // we only allow canonical CLSIDs here { // in this case we are responsible for verifying that the @@ -773,7 +773,7 @@ nsXPCClassesByID::CacheDynaProp(JSContext *cx, JSObject *obj, jsid id, JSBool retval; jsval val = OBJECT_TO_JSVAL(idobj); arbitrary->SetProperty(cx, obj, id, &val, wrapper, - NULL, &retval); + nsnull, &retval); } NS_RELEASE(nsid_wrapper); } @@ -840,7 +840,7 @@ nsXPCResults::FillCache(JSContext *cx, JSObject *obj, if(!(jstrid = JS_InternString(cx, name)) || !JS_ValueToId(cx, STRING_TO_JSVAL(jstrid), &id) || !JS_NewNumberValue(cx, (jsdouble)rv, &val) || - NS_FAILED(arbitrary->SetProperty(cx, obj, id, &val, wrapper, NULL, &retval)) || + NS_FAILED(arbitrary->SetProperty(cx, obj, id, &val, wrapper, nsnull, &retval)) || !retval) { JS_ReportOutOfMemory(cx); @@ -893,7 +893,7 @@ nsXPCResults::LookupProperty(JSContext *cx, JSObject *obj, if(!mCacheFilled) FillCache(cx, obj, wrapper, arbitrary); return arbitrary->LookupProperty(cx, obj, id, objp, propp, wrapper, - NULL, retval); + nsnull, retval); } NS_IMETHODIMP @@ -905,7 +905,7 @@ nsXPCResults::GetProperty(JSContext *cx, JSObject *obj, { if(!mCacheFilled) FillCache(cx, obj, wrapper, arbitrary); - return arbitrary->GetProperty(cx, obj, id, vp, wrapper, NULL, retval); + return arbitrary->GetProperty(cx, obj, id, vp, wrapper, nsnull, retval); } @@ -1079,7 +1079,7 @@ nsXPCComponents::GetProperty(JSContext *cx, JSObject *obj, if(JS_NewNumberValue(cx, (jsdouble) xpcc->GetLastResult(), vp)) return NS_OK; } - return arbitrary->GetProperty(cx, obj, id, vp, wrapper, NULL, retval); + return arbitrary->GetProperty(cx, obj, id, vp, wrapper, nsnull, retval); } NS_IMETHODIMP @@ -1090,7 +1090,7 @@ nsXPCComponents::SetProperty(JSContext *cx, JSObject *obj, JSBool* retval) { if(mCreating) - return arbitrary->SetProperty(cx, obj, id, vp, wrapper, NULL, retval); + return arbitrary->SetProperty(cx, obj, id, vp, wrapper, nsnull, retval); *retval = JS_TRUE; return NS_OK; } diff --git a/js/src/xpconnect/src/xpccontext.cpp b/js/src/xpconnect/src/xpccontext.cpp index 87468a7f16d2..30801a172cbd 100644 --- a/js/src/xpconnect/src/xpccontext.cpp +++ b/js/src/xpconnect/src/xpccontext.cpp @@ -61,7 +61,7 @@ XPCContext::newXPCContext(JSContext* aJSContext, return xpcc; } delete xpcc; - return NULL; + return nsnull; } XPCContext::XPCContext(JSContext* aJSContext, @@ -90,7 +90,7 @@ XPCContext::XPCContext(JSContext* aJSContext, } } mLastResult = NS_OK; - mSecurityManager = NULL; + mSecurityManager = nsnull; mSecurityManagerFlags = 0; mException = nsnull; } @@ -128,22 +128,22 @@ XPCContext::~XPCContext() // important to notify the objects before the classes if(mWrappedJSMap) { - mWrappedJSMap->Enumerate(WrappedJSDestroyCB, NULL); + mWrappedJSMap->Enumerate(WrappedJSDestroyCB, nsnull); delete mWrappedJSMap; } if(mWrappedNativeMap) { - mWrappedNativeMap->Enumerate(WrappedNativeDestroyCB, NULL); + mWrappedNativeMap->Enumerate(WrappedNativeDestroyCB, nsnull); delete mWrappedNativeMap; } if(mWrappedNativeClassMap) { - mWrappedNativeClassMap->Enumerate(WrappedNativeClassDestroyCB, NULL); + mWrappedNativeClassMap->Enumerate(WrappedNativeClassDestroyCB, nsnull); delete mWrappedNativeClassMap; } if(mWrappedJSClassMap) { - mWrappedJSClassMap->Enumerate(WrappedJSClassDestroyCB, NULL); + mWrappedJSClassMap->Enumerate(WrappedJSClassDestroyCB, nsnull); delete mWrappedJSClassMap; } JS_RemoveArgumentFormatter(mJSContext, XPC_ARG_FORMATTER_FORMAT_STR); @@ -153,7 +153,7 @@ XPCContext::~XPCContext() } JSBool -XPCContext::Init(JSObject* aGlobalObj /*= NULL*/) +XPCContext::Init(JSObject* aGlobalObj /*= nsnull*/) { if(aGlobalObj) mGlobalObj = aGlobalObj; diff --git a/js/src/xpconnect/src/xpcconvert.cpp b/js/src/xpconnect/src/xpcconvert.cpp index 3c63b1c8f326..59f8d4d8c199 100644 --- a/js/src/xpconnect/src/xpcconvert.cpp +++ b/js/src/xpconnect/src/xpcconvert.cpp @@ -278,7 +278,7 @@ XPCConvert::NativeData2JS(JSContext* cx, jsval* d, const void* s, if(!iface) break; nsIScriptObjectOwner* owner; - JSObject* aJSObj = NULL; + JSObject* aJSObj = nsnull; // is this a wrapped JS object? if(nsXPCWrappedJSClass::IsWrappedJS(iface)) { @@ -302,10 +302,10 @@ XPCConvert::NativeData2JS(JSContext* cx, jsval* d, const void* s, JSObject* globalObject; nsISupports* domObject; NS_ASSERTION(owner,"QI succeeded but yielded NULL!"); - if(NULL != (globalObject = + if(nsnull != (globalObject = JS_GetGlobalObject(cx)) && ObjectHasPrivate(cx, globalObject) && - NULL != (domObject = (nsISupports*) + nsnull != (domObject = (nsISupports*) JS_GetPrivate(cx, globalObject))) { nsIScriptGlobalObject* scriptObject; @@ -314,7 +314,7 @@ XPCConvert::NativeData2JS(JSContext* cx, jsval* d, const void* s, (void**)&scriptObject))) { NS_ASSERTION(scriptObject,"QI succeeded but yielded NULL!"); - nsIScriptContext* scriptContext = NULL; + nsIScriptContext* scriptContext = nsnull; scriptObject->GetContext(&scriptContext); if(scriptContext) { @@ -334,7 +334,7 @@ XPCConvert::NativeData2JS(JSContext* cx, jsval* d, const void* s, else { // we need to build a wrapper - nsXPCWrappedNative* wrapper = NULL; + nsXPCWrappedNative* wrapper = nsnull; XPCContext* xpcc; if(!iid || !(xpcc = nsXPConnect::GetContext(cx)) || @@ -455,7 +455,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, break; case nsXPTType::T_CHAR : { - char* bytes=NULL; + char* bytes=nsnull; JSString* str; if(!(str = JS_ValueToString(cx, s))|| @@ -468,7 +468,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, } case nsXPTType::T_WCHAR : { - jschar* chars=NULL; + jschar* chars=nsnull; JSString* str; if(!(str = JS_ValueToString(cx, s))|| !(chars = JS_GetStringChars(str))) @@ -497,7 +497,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, NS_ASSERTION(useAllocator,"trying to convert a JSID to nsID without allocator : this would leak"); JSObject* obj; - const nsID* pid=NULL; + const nsID* pid=nsnull; if(JSVAL_IS_VOID(s) || JSVAL_IS_NULL(s)) { @@ -508,7 +508,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, return JS_FALSE; } // else ... - *((const nsID**)d) = NULL; + *((const nsID**)d) = nsnull; return JS_TRUE; } @@ -529,7 +529,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, case nsXPTType::T_CHAR_STR: { - char* bytes=NULL; + char* bytes=nsnull; JSString* str; if(JSVAL_IS_VOID(s) || JSVAL_IS_NULL(s)) @@ -541,7 +541,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, return JS_FALSE; } // else ... - *((char**)d) = NULL; + *((char**)d) = nsnull; return JS_TRUE; } @@ -567,7 +567,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, case nsXPTType::T_WCHAR_STR: { - jschar* chars=NULL; + jschar* chars=nsnull; JSString* str; if(JSVAL_IS_VOID(s) || JSVAL_IS_NULL(s)) @@ -579,7 +579,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, return JS_FALSE; } // else ... - *((jschar**)d) = NULL; + *((jschar**)d) = nsnull; return JS_TRUE; } @@ -609,7 +609,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, { NS_ASSERTION(iid,"can't do interface conversions without iid"); JSObject* obj; - nsISupports* iface = NULL; + nsISupports* iface = nsnull; if(JSVAL_IS_VOID(s) || JSVAL_IS_NULL(s)) { @@ -620,7 +620,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, return JS_FALSE; } // else ... - *((nsISupports**)d) = NULL; + *((nsISupports**)d) = nsnull; return JS_TRUE; } @@ -632,7 +632,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, // is this really a native xpcom object with a wrapper? nsXPCWrappedNative* wrapper; - if(NULL != (wrapper = + if(nsnull != (wrapper = nsXPCWrappedNativeClass::GetWrappedNativeOfJSObject(cx,obj))) { iface = wrapper->GetNative(); @@ -648,7 +648,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, iface->QueryInterface(*iid, (void**)&iface); else { - *((nsISupports**)d) = NULL; + *((nsISupports**)d) = nsnull; return JS_TRUE; } } @@ -656,7 +656,7 @@ XPCConvert::JSData2Native(JSContext* cx, void* d, jsval s, { // lets try to build a wrapper around the JSObject XPCContext* xpcc; - if(NULL != (xpcc = nsXPConnect::GetContext(cx))) + if(nsnull != (xpcc = nsXPConnect::GetContext(cx))) iface = nsXPCWrappedJS::GetNewOrUsedWrapper(xpcc, obj, *iid); } if(iface) @@ -725,7 +725,7 @@ XPCConvert::JSValToXPCException(JSContext* cx, // is this really a native xpcom object with a wrapper? nsXPCWrappedNative* wrapper; - if(NULL != (wrapper = + if(nsnull != (wrapper = nsXPCWrappedNativeClass::GetWrappedNativeOfJSObject(cx,obj))) { nsIXPCException* iface; @@ -757,7 +757,7 @@ XPCConvert::JSValToXPCException(JSContext* cx, { // lets try to build a wrapper around the JSObject XPCContext* xpcc; - if(NULL != (xpcc = nsXPConnect::GetContext(cx))) + if(nsnull != (xpcc = nsXPConnect::GetContext(cx))) { return (nsIXPCException*) nsXPCWrappedJS::GetNewOrUsedWrapper(xpcc, obj, diff --git a/js/src/xpconnect/src/xpcjsid.cpp b/js/src/xpconnect/src/xpcjsid.cpp index 5345b0ce52b2..5bd80b71be36 100644 --- a/js/src/xpconnect/src/xpcjsid.cpp +++ b/js/src/xpconnect/src/xpcjsid.cpp @@ -64,7 +64,7 @@ void nsJSID::reset() if(mName && mName != gNoString) delete [] mName; - mNumber = mName = NULL; + mNumber = mName = nsnull; } PRBool @@ -227,7 +227,7 @@ nsJSID::NewID(const char* str) NS_IMETHODIMP nsJSIID::QueryInterface(REFNSIID aIID, void** aInstancePtr) { - if (NULL == aInstancePtr) { + if (nsnull == aInstancePtr) { return NS_ERROR_NULL_POINTER; } if (aIID.Equals(NS_GET_IID(nsISupports)) || @@ -237,7 +237,7 @@ nsJSIID::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ADDREF_THIS(); return NS_OK; } - *aInstancePtr = NULL; + *aInstancePtr = nsnull; return NS_NOINTERFACE; } @@ -274,7 +274,7 @@ nsJSIID::resolveName() if(!mDetails.nameIsSet()) { nsIInterfaceInfoManager* iim; - if(NULL != (iim = nsXPConnect::GetInterfaceInfoManager())) + if(nsnull != (iim = nsXPConnect::GetInterfaceInfoManager())) { char* name; if(NS_SUCCEEDED(iim->GetNameForIID(mDetails.getID(), &name)) && name) @@ -313,7 +313,7 @@ nsJSIID::NewID(const char* str) else { nsIInterfaceInfoManager* iim; - if(NULL != (iim = nsXPConnect::GetInterfaceInfoManager())) + if(nsnull != (iim = nsXPConnect::GetInterfaceInfoManager())) { nsID* pid; if(NS_SUCCEEDED(iim->GetIIDForName(str, &pid)) && pid) @@ -433,10 +433,10 @@ CIDCreateInstance::Call(JSContext *cx, JSObject *obj, // Do the security check if necessary XPCContext* xpcc; - if(NULL != (xpcc = nsXPConnect::GetContext(cx))) + if(nsnull != (xpcc = nsXPConnect::GetContext(cx))) { nsIXPCSecurityManager* sm; - if(NULL != (sm = xpcc->GetSecurityManager()) && + if(nsnull != (sm = xpcc->GetSecurityManager()) && (xpcc->GetSecurityManagerFlags() & nsIXPCSecurityManager::HOOK_CREATE_INSTANCE) && NS_OK != sm->CanCreateInstance(cx, *cid)) @@ -451,13 +451,13 @@ CIDCreateInstance::Call(JSContext *cx, JSObject *obj, // If an IID was passed in then use it // XXX should it be JS error to pass something that is *not* and JSID? - const nsID* piid = NULL; + const nsID* piid = nsnull; if(argc) { JSObject* iidobj; jsval val = *argv; if(!JSVAL_IS_VOID(val) && !JSVAL_IS_NULL(val) && - JSVAL_IS_OBJECT(val) && NULL != (iidobj = JSVAL_TO_OBJECT(val))) + JSVAL_IS_OBJECT(val) && nsnull != (iidobj = JSVAL_TO_OBJECT(val))) { piid = xpc_JSObjectToID(cx, iidobj); } @@ -468,7 +468,7 @@ CIDCreateInstance::Call(JSContext *cx, JSObject *obj, nsISupports* inst; nsresult rv; - rv = nsComponentManager::CreateInstance(*cid, NULL, *piid, (void**) &inst); + rv = nsComponentManager::CreateInstance(*cid, nsnull, *piid, (void**) &inst); NS_ASSERTION(NS_FAILED(rv) || inst, "component manager returned success, but instance is null!"); nsAllocator::Free(cid); @@ -479,7 +479,7 @@ CIDCreateInstance::Call(JSContext *cx, JSObject *obj, return NS_OK; } - nsIXPConnectWrappedNative* instWrapper = NULL; + nsIXPConnectWrappedNative* instWrapper = nsnull; nsIXPConnect* xpc = nsXPConnect::GetXPConnect(); if(xpc) @@ -541,7 +541,7 @@ ServiceReleaser::~ServiceReleaser() {} NS_IMETHODIMP ServiceReleaser::AboutToRelease(nsISupports* aObj) { - return nsServiceManager::ReleaseService(mCID, aObj, NULL); + return nsServiceManager::ReleaseService(mCID, aObj, nsnull); } /*********************************************/ @@ -637,10 +637,10 @@ CIDGetService::Call(JSContext *cx, JSObject *obj, // Do the security check if necessary XPCContext* xpcc; - if(NULL != (xpcc = nsXPConnect::GetContext(cx))) + if(nsnull != (xpcc = nsXPConnect::GetContext(cx))) { nsIXPCSecurityManager* sm; - if(NULL != (sm = xpcc->GetSecurityManager()) && + if(nsnull != (sm = xpcc->GetSecurityManager()) && (xpcc->GetSecurityManagerFlags() & nsIXPCSecurityManager::HOOK_GET_SERVICE) && NS_OK != sm->CanGetService(cx, *cid)) @@ -655,13 +655,13 @@ CIDGetService::Call(JSContext *cx, JSObject *obj, // If an IID was passed in then use it // XXX should it be JS error to pass something that is *not* and JSID? - const nsID* piid = NULL; + const nsID* piid = nsnull; if(argc) { JSObject* iidobj; jsval val = *argv; if(!JSVAL_IS_VOID(val) && !JSVAL_IS_NULL(val) && - JSVAL_IS_OBJECT(val) && NULL != (iidobj = JSVAL_TO_OBJECT(val))) + JSVAL_IS_OBJECT(val) && nsnull != (iidobj = JSVAL_TO_OBJECT(val))) { piid = xpc_JSObjectToID(cx, iidobj); } @@ -672,7 +672,7 @@ CIDGetService::Call(JSContext *cx, JSObject *obj, nsISupports* srvc; nsresult rv; - rv = nsServiceManager::GetService(*cid, *piid, &srvc, NULL); + rv = nsServiceManager::GetService(*cid, *piid, &srvc, nsnull); NS_ASSERTION(NS_FAILED(rv) || srvc, "service manager returned success, but service is null!"); if(NS_FAILED(rv) || !srvc) @@ -682,7 +682,7 @@ CIDGetService::Call(JSContext *cx, JSObject *obj, return NS_OK; } - nsIXPConnectWrappedNative* srvcWrapper = NULL; + nsIXPConnectWrappedNative* srvcWrapper = nsnull; nsIXPConnect* xpc = nsXPConnect::GetXPConnect(); if(xpc) @@ -693,7 +693,7 @@ CIDGetService::Call(JSContext *cx, JSObject *obj, if(NS_FAILED(rv) || !srvcWrapper) { - nsServiceManager::ReleaseService(*cid, srvc, NULL); + nsServiceManager::ReleaseService(*cid, srvc, nsnull); nsAllocator::Free(cid); ThrowException(NS_ERROR_XPC_CANT_CREATE_WN, cx); *retval = JS_FALSE; @@ -733,7 +733,7 @@ CIDGetService::Call(JSContext *cx, JSObject *obj, NS_IMETHODIMP nsJSCID::QueryInterface(REFNSIID aIID, void** aInstancePtr) { - if (NULL == aInstancePtr) { + if (nsnull == aInstancePtr) { return NS_ERROR_NULL_POINTER; } if (aIID.Equals(NS_GET_IID(nsISupports)) || @@ -743,7 +743,7 @@ nsJSCID::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ADDREF_THIS(); return NS_OK; } - *aInstancePtr = NULL; + *aInstancePtr = nsnull; return NS_NOINTERFACE; } @@ -849,7 +849,7 @@ nsJSCID::GetGetService(nsISupports * *aGetService) JSObject * xpc_NewIDObject(JSContext *cx, const nsID& aID) { - JSObject *obj = NULL; + JSObject *obj = nsnull; char* idString = aID.ToString(); if(idString) @@ -881,9 +881,9 @@ xpc_NewIDObject(JSContext *cx, const nsID& aID) nsID* xpc_JSObjectToID(JSContext *cx, JSObject* obj) { - nsID* id = NULL; + nsID* id = nsnull; if(!cx || !obj) - return NULL; + return nsnull; // NOTE: this call does NOT addref nsXPCWrappedNative* wrapper = diff --git a/js/src/xpconnect/src/xpclog.cpp b/js/src/xpconnect/src/xpclog.cpp index a0c01fe892ba..e6fe16761e22 100644 --- a/js/src/xpconnect/src/xpclog.cpp +++ b/js/src/xpconnect/src/xpclog.cpp @@ -34,7 +34,7 @@ static char* g_Spaces; static int g_InitState = 0; static int g_Indent = 0; -static PRLogModuleInfo* g_LogMod = NULL; +static PRLogModuleInfo* g_LogMod = nsnull; static PRBool Init() { diff --git a/js/src/xpconnect/src/xpcmaps.cpp b/js/src/xpconnect/src/xpcmaps.cpp index 8142f892b706..ce451d65aaef 100644 --- a/js/src/xpconnect/src/xpcmaps.cpp +++ b/js/src/xpconnect/src/xpcmaps.cpp @@ -52,7 +52,7 @@ JSContext2XPCContextMap::newMap(int size) if(map && map->mHashtable) return map; delete map; - return NULL; + return nsnull; } @@ -60,7 +60,7 @@ JSContext2XPCContextMap::JSContext2XPCContextMap(int size) { mHashtable = JS_NewHashTable(size, hash_root, JS_CompareValues, JS_CompareValues, - NULL, NULL); + nsnull, nsnull); } JSContext2XPCContextMap::~JSContext2XPCContextMap() @@ -80,7 +80,7 @@ JSObject2WrappedJSMap::newMap(int size) if(map && map->mHashtable) return map; delete map; - return NULL; + return nsnull; } @@ -88,7 +88,7 @@ JSObject2WrappedJSMap::JSObject2WrappedJSMap(int size) { mHashtable = JS_NewHashTable(size, hash_root, JS_CompareValues, JS_CompareValues, - NULL, NULL); + nsnull, nsnull); } JSObject2WrappedJSMap::~JSObject2WrappedJSMap() @@ -108,14 +108,14 @@ Native2WrappedNativeMap::newMap(int size) if(map && map->mHashtable) return map; delete map; - return NULL; + return nsnull; } Native2WrappedNativeMap::Native2WrappedNativeMap(int size) { mHashtable = JS_NewHashTable(size, hash_root, JS_CompareValues, JS_CompareValues, - NULL, NULL); + nsnull, nsnull); } Native2WrappedNativeMap::~Native2WrappedNativeMap() @@ -135,14 +135,14 @@ IID2WrappedJSClassMap::newMap(int size) if(map && map->mHashtable) return map; delete map; - return NULL; + return nsnull; } IID2WrappedJSClassMap::IID2WrappedJSClassMap(int size) { mHashtable = JS_NewHashTable(size, hash_IID, compare_IIDs, JS_CompareValues, - NULL, NULL); + nsnull, nsnull); } IID2WrappedJSClassMap::~IID2WrappedJSClassMap() @@ -162,14 +162,14 @@ IID2WrappedNativeClassMap::newMap(int size) if(map && map->mHashtable) return map; delete map; - return NULL; + return nsnull; } IID2WrappedNativeClassMap::IID2WrappedNativeClassMap(int size) { mHashtable = JS_NewHashTable(size, hash_IID, compare_IIDs, JS_CompareValues, - NULL, NULL); + nsnull, nsnull); } IID2WrappedNativeClassMap::~IID2WrappedNativeClassMap() diff --git a/js/src/xpconnect/src/xpcmodule.cpp b/js/src/xpconnect/src/xpcmodule.cpp index 277214f72c38..e63422fe45d6 100644 --- a/js/src/xpconnect/src/xpcmodule.cpp +++ b/js/src/xpconnect/src/xpcmodule.cpp @@ -45,7 +45,7 @@ Construct_nsXPConnect(nsISupports *aOuter, REFNSIID aIID, void **aResult) rv = NS_ERROR_NULL_POINTER; goto done; } - *aResult = NULL; + *aResult = nsnull; if(aOuter) { rv = NS_ERROR_NO_AGGREGATION; @@ -78,7 +78,7 @@ Construct_nsXPCThreadJSContextStack(nsISupports *aOuter, REFNSIID aIID, void **a rv = NS_ERROR_NULL_POINTER; goto done; } - *aResult = NULL; + *aResult = nsnull; if(aOuter) { rv = NS_ERROR_NO_AGGREGATION; diff --git a/js/src/xpconnect/src/xpcprivate.h b/js/src/xpconnect/src/xpcprivate.h index e0055c8e3696..89957319ad9e 100644 --- a/js/src/xpconnect/src/xpcprivate.h +++ b/js/src/xpconnect/src/xpcprivate.h @@ -142,11 +142,11 @@ class nsXPConnect : public nsIXPConnect // non-interface implementation public: static nsXPConnect* GetXPConnect(); - static nsIInterfaceInfoManager* GetInterfaceInfoManager(nsXPConnect* xpc = NULL); - static XPCContext* GetContext(JSContext* cx, nsXPConnect* xpc = NULL); - static XPCJSThrower* GetJSThrower(nsXPConnect* xpc = NULL); + static nsIInterfaceInfoManager* GetInterfaceInfoManager(nsXPConnect* xpc = nsnull); + static XPCContext* GetContext(JSContext* cx, nsXPConnect* xpc = nsnull); + static XPCJSThrower* GetJSThrower(nsXPConnect* xpc = nsnull); static JSBool IsISupportsDescendent(nsIInterfaceInfo* info); - static nsIJSContextStack* GetContextStack(nsXPConnect* xpc = NULL); + static nsIJSContextStack* GetContextStack(nsXPConnect* xpc = nsnull); JSContext2XPCContextMap* GetContextMap() {return mContextMap;} nsIXPCScriptable* GetArbitraryScriptable() {return mArbitraryScriptable;} @@ -239,7 +239,7 @@ public: void SetSecurityManagerFlags(PRUint16 f) {mSecurityManagerFlags = f;} - JSBool Init(JSObject* aGlobalObj = NULL); + JSBool Init(JSObject* aGlobalObj = nsnull); void DebugDump(int depth); ~XPCContext(); @@ -359,7 +359,7 @@ private: nsIInterfaceInfo* aInfo); JSContext* GetJSContext() const - {return mXPCContext ? mXPCContext->GetJSContext() : NULL;} + {return mXPCContext ? mXPCContext->GetJSContext() : nsnull;} JSObject* CreateIIDJSObject(REFNSIID aIID); JSObject* NewOutObject(); @@ -512,11 +512,11 @@ public: nsIInterfaceInfo* GetInterfaceInfo() const {return mInfo;} XPCContext* GetXPCContext() const {return mXPCContext;} JSContext* GetJSContext() const - {return mXPCContext ? mXPCContext->GetJSContext() : NULL;} + {return mXPCContext ? mXPCContext->GetJSContext() : nsnull;} nsIXPCScriptable* GetArbitraryScriptable() const {return mXPCContext ? mXPCContext->GetXPConnect()->GetArbitraryScriptable() : - NULL;} + nsnull;} static JSBool InitForContext(XPCContext* xpcc); static JSBool OneTimeInit(); @@ -529,7 +529,7 @@ public: const XPCNativeMemberDescriptor* GetMemberDescriptor(uint16 i) const { NS_PRECONDITION(i < mMemberCount,"bad index"); - return mDescriptors ? &mDescriptors[i] : NULL; + return mDescriptors ? &mDescriptors[i] : nsnull; } const XPCNativeMemberDescriptor* LookupMemberByID(jsid id) const; @@ -552,7 +552,7 @@ public: const XPCNativeMemberDescriptor* desc, jsval* vp) { - return CallWrappedMethod(cx, wrapper, desc, CALL_GETTER, 0, NULL, vp); + return CallWrappedMethod(cx, wrapper, desc, CALL_GETTER, 0, nsnull, vp); } JSBool SetAttributeFromJSVal(JSContext* cx, @@ -560,7 +560,7 @@ public: const XPCNativeMemberDescriptor* desc, jsval* vp) { - return CallWrappedMethod(cx, wrapper, desc, CALL_SETTER, 1, vp, NULL); + return CallWrappedMethod(cx, wrapper, desc, CALL_SETTER, 1, vp, nsnull); } JSObject* GetInvokeFunObj(const XPCNativeMemberDescriptor* desc); diff --git a/js/src/xpconnect/src/xpcstack.cpp b/js/src/xpconnect/src/xpcstack.cpp index a4fba0c99a93..70adc965400e 100644 --- a/js/src/xpconnect/src/xpcstack.cpp +++ b/js/src/xpconnect/src/xpcstack.cpp @@ -98,16 +98,16 @@ nsIJSStackFrameLocation* XPCJSStack::CreateStack(JSContext* cx) { if(!cx) - return NULL; + return nsnull; if(!cx->fp) - return NULL; + return nsnull; XPCJSStack* self = new XPCJSStack(); if(!self) - return NULL; + return nsnull; if(!(self->mTopFrame = XPCJSStackFrame::CreateStack(cx, self, cx->fp))) - return NULL; + return nsnull; NS_ADDREF(self->mTopFrame); self->mRefCount = 1; diff --git a/js/src/xpconnect/src/xpcthreadcontext.cpp b/js/src/xpconnect/src/xpcthreadcontext.cpp index e7388bce8096..99831e9b5f0d 100644 --- a/js/src/xpconnect/src/xpcthreadcontext.cpp +++ b/js/src/xpconnect/src/xpcthreadcontext.cpp @@ -39,20 +39,20 @@ GetMyStack() if(PR_FAILURE == PR_NewThreadPrivateIndex(&index, xpc_StackDtorCB)) { NS_ASSERTION(0, "PR_NewThreadPrivateIndex failed!"); - return NULL; + return nsnull; } } myStack = (nsDeque*) PR_GetThreadPrivate(index); if(!myStack) { - if(NULL != (myStack = new nsDeque(nsnull))) + if(nsnull != (myStack = new nsDeque(nsnull))) { if(PR_FAILURE == PR_SetThreadPrivate(index, myStack)) { NS_ASSERTION(0, "PR_SetThreadPrivate failed!"); delete myStack; - myStack = NULL; + myStack = nsnull; } } else @@ -89,7 +89,7 @@ NS_IMPL_ISUPPORTS(nsXPCThreadJSContextStackImpl, knsXPCThreadJSContextStackImplI nsXPCThreadJSContextStackImpl* nsXPCThreadJSContextStackImpl::GetSingleton() { - static nsXPCThreadJSContextStackImpl* singleton = NULL; + static nsXPCThreadJSContextStackImpl* singleton = nsnull; if(!singleton) singleton = new nsXPCThreadJSContextStackImpl(); if(singleton) diff --git a/js/src/xpconnect/src/xpcthrower.cpp b/js/src/xpconnect/src/xpcthrower.cpp index 25a1fefa9a48..230f95ae1836 100644 --- a/js/src/xpconnect/src/xpcthrower.cpp +++ b/js/src/xpconnect/src/xpcthrower.cpp @@ -29,10 +29,10 @@ XPCJSThrower::~XPCJSThrower() {} char* XPCJSThrower::BuildCallerString(JSContext* cx) { - JSStackFrame* iter = NULL; + JSStackFrame* iter = nsnull; JSStackFrame* fp; - while(NULL != (fp = JS_FrameIterator(cx, &iter)) ) + while(nsnull != (fp = JS_FrameIterator(cx, &iter)) ) { JSScript* script = JS_GetFrameScript(cx, fp); jsbytecode* pc = JS_GetFramePC(cx, fp); @@ -45,7 +45,7 @@ XPCJSThrower::BuildCallerString(JSContext* cx) filename ? filename : "", JS_PCToLineNumber(cx, script, pc)); } - return NULL; + return nsnull; } #endif @@ -55,7 +55,7 @@ XPCJSThrower::Verbosify(JSContext* cx, const XPCNativeMemberDescriptor* desc, char** psz, PRBool own) { - char* sz = NULL; + char* sz = nsnull; if(clazz && desc) sz = JS_smprintf("%s [%s.%s]", @@ -80,7 +80,7 @@ XPCJSThrower::ThrowBadResultException(nsresult rv, char* sz; const char* format; const char* name; - JSString* str = NULL; + JSString* str = nsnull; /* * If there is a pending exception when the native call returns and @@ -136,7 +136,7 @@ XPCJSThrower::ThrowBadParamException(nsresult rv, { char* sz; const char* format; - JSString* str = NULL; + JSString* str = nsnull; if(!nsXPCException::NameAndFormatForNSResult(rv, nsnull, &format)) format = ""; @@ -160,7 +160,7 @@ XPCJSThrower::ThrowException(nsresult rv, { char* sz; const char* format; - JSString* str = NULL; + JSString* str = nsnull; if(!nsXPCException::NameAndFormatForNSResult(rv, nsnull, &format)) format = ""; diff --git a/js/src/xpconnect/src/xpcwrappedjs.cpp b/js/src/xpconnect/src/xpcwrappedjs.cpp index d65c4db90fde..f8c66d8c0609 100644 --- a/js/src/xpconnect/src/xpcwrappedjs.cpp +++ b/js/src/xpconnect/src/xpcwrappedjs.cpp @@ -25,7 +25,7 @@ NS_IMETHODIMP nsXPCWrappedJS::QueryInterface(REFNSIID aIID, void** aInstancePtr) { - if(NULL == aInstancePtr) + if(nsnull == aInstancePtr) { NS_PRECONDITION(0, "null pointer"); return NS_ERROR_NULL_POINTER; @@ -35,7 +35,7 @@ nsXPCWrappedJS::QueryInterface(REFNSIID aIID, void** aInstancePtr) { if(!mMethods && !(mMethods = new nsXPCWrappedJSMethods(this))) { - *aInstancePtr = NULL; + *aInstancePtr = nsnull; return NS_ERROR_OUT_OF_MEMORY; } // intentional second addref @@ -92,8 +92,8 @@ nsXPCWrappedJS::GetNewOrUsedWrapper(XPCContext* xpcc, JSObject2WrappedJSMap* map; JSObject* rootJSObj; nsXPCWrappedJS* root; - nsXPCWrappedJS* wrapper = NULL; - nsXPCWrappedJSClass* clazz = NULL; + nsXPCWrappedJS* wrapper = nsnull; + nsXPCWrappedJSClass* clazz = nsnull; NS_PRECONDITION(xpcc, "bad param"); NS_PRECONDITION(aJSObj, "bad param"); @@ -102,12 +102,12 @@ nsXPCWrappedJS::GetNewOrUsedWrapper(XPCContext* xpcc, if(!map) { NS_ASSERTION(map,"bad map"); - return NULL; + return nsnull; } clazz = nsXPCWrappedJSClass::GetNewOrUsedClass(xpcc, aIID); if(!clazz) - return NULL; + return nsnull; // from here on we need to return through 'return_wrapper' // always find the root JSObject @@ -132,7 +132,7 @@ nsXPCWrappedJS::GetNewOrUsedWrapper(XPCContext* xpcc, if(rootJSObj == aJSObj) { // the root will do double duty as the interface wrapper - wrapper = root = new nsXPCWrappedJS(aJSObj, clazz, NULL); + wrapper = root = new nsXPCWrappedJS(aJSObj, clazz, nsnull); if(root) map->Add(root); goto return_wrapper; @@ -146,7 +146,7 @@ nsXPCWrappedJS::GetNewOrUsedWrapper(XPCContext* xpcc, if(!rootClazz) goto return_wrapper; - root = new nsXPCWrappedJS(rootJSObj, rootClazz, NULL); + root = new nsXPCWrappedJS(rootJSObj, rootClazz, nsnull); NS_RELEASE(rootClazz); if(!root) @@ -184,9 +184,9 @@ nsXPCWrappedJS::nsXPCWrappedJS(JSObject* aJSObj, nsXPCWrappedJS* root) : mJSObj(aJSObj), mClass(aClass), - mMethods(NULL), + mMethods(nsnull), mRoot(root ? root : this), - mNext(NULL) + mNext(nsnull) { NS_INIT_REFCNT(); NS_ADDREF_THIS(); @@ -202,9 +202,9 @@ nsXPCWrappedJS::XPCContextBeingDestroyed() if(mJSObj) { XPCContext* xpcc; - if(mClass && NULL != (xpcc = mClass->GetXPCContext())) + if(mClass && nsnull != (xpcc = mClass->GetXPCContext())) JS_RemoveRoot(xpcc->GetJSContext(), &mJSObj); - mJSObj = NULL; + mJSObj = nsnull; } } @@ -214,12 +214,12 @@ nsXPCWrappedJS::~nsXPCWrappedJS() if(mClass) { XPCContext* xpcc; - if(NULL != (xpcc = mClass->GetXPCContext())) + if(nsnull != (xpcc = mClass->GetXPCContext())) { if(mRoot == this) { JSObject2WrappedJSMap* map; - if(NULL != (map = xpcc->GetWrappedJSMap())) + if(nsnull != (map = xpcc->GetWrappedJSMap())) map->Remove(this); } if(mJSObj) @@ -245,9 +245,9 @@ nsXPCWrappedJS::Find(REFNSIID aIID) if(aIID.Equals(cur->GetIID())) return cur; - } while(NULL != (cur = cur->mNext)); + } while(nsnull != (cur = cur->mNext)); - return NULL; + return nsnull; } NS_IMETHODIMP diff --git a/js/src/xpconnect/src/xpcwrappedjsclass.cpp b/js/src/xpconnect/src/xpcwrappedjsclass.cpp index 39ab31f54d68..12f729d74045 100644 --- a/js/src/xpconnect/src/xpcwrappedjsclass.cpp +++ b/js/src/xpconnect/src/xpcwrappedjsclass.cpp @@ -33,7 +33,7 @@ nsXPCWrappedJSClass::GetNewOrUsedClass(XPCContext* xpcc, REFNSIID aIID) { IID2WrappedJSClassMap* map; - nsXPCWrappedJSClass* clazz = NULL; + nsXPCWrappedJSClass* clazz = nsnull; NS_PRECONDITION(xpcc, "bad param"); @@ -48,7 +48,7 @@ nsXPCWrappedJSClass::GetNewOrUsedClass(XPCContext* xpcc, else { nsIInterfaceInfoManager* iimgr; - if(NULL != (iimgr = nsXPConnect::GetInterfaceInfoManager())) + if(nsnull != (iimgr = nsXPConnect::GetInterfaceInfoManager())) { nsIInterfaceInfo* info; if(NS_SUCCEEDED(iimgr->GetInfoForIID(&aIID, &info))) @@ -57,7 +57,7 @@ nsXPCWrappedJSClass::GetNewOrUsedClass(XPCContext* xpcc, { clazz = new nsXPCWrappedJSClass(xpcc, aIID, info); if(!clazz->mDescriptors) - NS_RELEASE(clazz); // sets clazz to NULL + NS_RELEASE(clazz); // sets clazz to nsnull } NS_RELEASE(info); } @@ -73,7 +73,7 @@ nsXPCWrappedJSClass::nsXPCWrappedJSClass(XPCContext* xpcc, REFNSIID aIID, mInfo(aInfo), mName(nsnull), mIID(aIID), - mDescriptors(NULL) + mDescriptors(nsnull) { NS_ADDREF(mInfo); @@ -88,7 +88,7 @@ nsXPCWrappedJSClass::nsXPCWrappedJSClass(XPCContext* xpcc, REFNSIID aIID, if(methodCount) { int wordCount = (methodCount/32)+1; - if(NULL != (mDescriptors = new uint32[wordCount])) + if(nsnull != (mDescriptors = new uint32[wordCount])) { int i; // init flags to 0; @@ -103,7 +103,7 @@ nsXPCWrappedJSClass::nsXPCWrappedJSClass(XPCContext* xpcc, REFNSIID aIID, else { delete [] mDescriptors; - mDescriptors = NULL; + mDescriptors = nsnull; break; } } @@ -137,7 +137,7 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSObject* jsobj, REFNSIID aIID JSBool success = JS_FALSE; if(!cx) - return NULL; + return nsnull; id = xpc_NewIDObject(cx, aIID); @@ -145,7 +145,7 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSObject* jsobj, REFNSIID aIID { jsval e; JSBool hadExpection = JS_GetPendingException(cx, &e); - JSErrorReporter older = JS_SetErrorReporter(cx, NULL); + JSErrorReporter older = JS_SetErrorReporter(cx, nsnull); jsval args[1] = {OBJECT_TO_JSVAL(id)}; success = JS_CallFunctionName(cx, jsobj, XPC_QUERY_INTERFACE_STR, 1, args, &retval); @@ -158,7 +158,7 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSObject* jsobj, REFNSIID aIID JS_ClearPendingException(cx); } - return success ? retObj : NULL; + return success ? retObj : nsnull; } /***************************************************************************/ @@ -183,7 +183,7 @@ public: static void* GetSingleton() { - static WrappedJSIdentity* singleton = NULL; + static WrappedJSIdentity* singleton = nsnull; if(!singleton) singleton = new WrappedJSIdentity(); return (void*) singleton; @@ -213,7 +213,7 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self, // This includes checking for nsISupports and the iid of self. // And it also checks for other wrappers that have been constructed // for this object. - if(NULL != (sibling = self->Find(aIID))) + if(nsnull != (sibling = self->Find(aIID))) { NS_ADDREF(sibling); *aInstancePtr = (void*) sibling; @@ -272,7 +272,7 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self, // else... // no can do - *aInstancePtr = NULL; + *aInstancePtr = nsnull; return NS_NOINTERFACE; } @@ -300,7 +300,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, nsXPTCMiniVariant* params) { jsval* stackbase; - jsval* sp = NULL; + jsval* sp = nsnull; uint8 i; uint8 argc=0; jsval result; @@ -310,7 +310,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, JSBool success; JSContext* cx = GetJSContext(); JSBool InConversionsDone = JS_FALSE; - nsID* conditional_iid = NULL; + nsID* conditional_iid = nsnull; JSBool iidIsOwned = JS_FALSE; JSObject* obj = wrapper->GetJSObject(); const char* name = info->GetName(); @@ -339,7 +339,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, // but is a good optimization compared to calling JS_AddRoot for each item. // setup stack - if(NULL == (stackbase = sp = js_AllocStack(cx, argc + 2, &mark))) + if(nsnull == (stackbase = sp = js_AllocStack(cx, argc + 2, &mark))) { retval = NS_ERROR_OUT_OF_MEMORY; goto pre_call_clean_up; @@ -402,7 +402,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, } if(!XPCConvert::NativeData2JS(cx, &val, &pv->val, type, - conditional_iid, NULL)) + conditional_iid, nsnull)) { goto pre_call_clean_up; } @@ -413,7 +413,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex, nsAllocator::Free((void*)conditional_iid); iidIsOwned = JS_FALSE; } - conditional_iid = NULL; + conditional_iid = nsnull; } } @@ -452,22 +452,22 @@ pre_call_clean_up: if(param.IsIn()) { nsISupports** pp; - if((NULL != (pp = (nsISupports**) params[i].val.p)) && - NULL != *pp) + if((nsnull != (pp = (nsISupports**) params[i].val.p)) && + nsnull != *pp) { (*pp)->Release(); - *pp = NULL; + *pp = nsnull; } } } else { void** pp; - if((NULL != (pp = (void**) params[i].val.p)) && NULL != *pp) + if((nsnull != (pp = (void**) params[i].val.p)) && nsnull != *pp) { if(param.IsIn()) nsAllocator::Free(*pp); - *pp = NULL; + *pp = nsnull; } } } @@ -479,7 +479,7 @@ pre_call_clean_up: nsAllocator::Free((void*)conditional_iid); iidIsOwned = JS_FALSE; } - conditional_iid = NULL; + conditional_iid = nsnull; } if(!InConversionsDone) @@ -592,7 +592,7 @@ pre_call_clean_up: useAllocator = JS_TRUE; if(!XPCConvert::JSData2Native(cx, &pv->val, val, type, - useAllocator, conditional_iid, NULL)) + useAllocator, conditional_iid, nsnull)) break; if(conditional_iid) @@ -602,7 +602,7 @@ pre_call_clean_up: nsAllocator::Free((void*)conditional_iid); iidIsOwned = JS_FALSE; } - conditional_iid = NULL; + conditional_iid = nsnull; } } } @@ -660,13 +660,13 @@ nsXPCWrappedJSClass::GetInterfaceName() JSObject* nsXPCWrappedJSClass::NewOutObject() { - return JS_NewObject(GetJSContext(), &WrappedJSOutArg_class, NULL, NULL); + return JS_NewObject(GetJSContext(), &WrappedJSOutArg_class, nsnull, nsnull); } void nsXPCWrappedJSClass::XPCContextBeingDestroyed() { - mXPCContext = NULL; + mXPCContext = nsnull; } NS_IMETHODIMP diff --git a/js/src/xpconnect/src/xpcwrappednative.cpp b/js/src/xpconnect/src/xpcwrappednative.cpp index 72c43f0b6720..4f69a7a57042 100644 --- a/js/src/xpconnect/src/xpcwrappednative.cpp +++ b/js/src/xpconnect/src/xpcwrappednative.cpp @@ -33,7 +33,7 @@ nsXPCWrappedNative::AddRef(void) if(1 == ++mRefCnt && mRoot != this) NS_ADDREF(mRoot); - else if(2 == mRefCnt && NULL != (xpcc = mClass->GetXPCContext())) + else if(2 == mRefCnt && nsnull != (xpcc = mClass->GetXPCContext())) JS_AddNamedRoot(xpcc->GetJSContext(), &mJSObj, "nsXPCWrappedNative::mJSObj"); return mRefCnt; @@ -53,7 +53,7 @@ nsXPCWrappedNative::Release(void) if(1 == mRefCnt) { XPCContext* xpcc; - if(NULL != (xpcc = mClass->GetXPCContext())) + if(nsnull != (xpcc = mClass->GetXPCContext())) JS_RemoveRoot(xpcc->GetJSContext(), &mJSObj); } return mRefCnt; @@ -64,13 +64,13 @@ nsXPCWrappedNative::JSObjectFinalized(JSContext *cx, JSObject *obj) { nsIXPCScriptable* ds; nsIXPCScriptable* as; - if(NULL != (ds = GetDynamicScriptable()) && - NULL != (as = GetArbitraryScriptable())) + if(nsnull != (ds = GetDynamicScriptable()) && + nsnull != (as = GetArbitraryScriptable())) ds->Finalize(cx, obj, this, as); // pass through to the real JSObject finalization code JS_FinalizeStub(cx, obj); - mJSObj = NULL; + mJSObj = nsnull; Release(); } @@ -81,11 +81,11 @@ nsXPCWrappedNative::GetNewOrUsedWrapper(XPCContext* xpcc, REFNSIID aIID) { Native2WrappedNativeMap* map; - nsISupports* rootObj = NULL; - nsISupports* realObj = NULL; + nsISupports* rootObj = nsnull; + nsISupports* realObj = nsnull; nsXPCWrappedNative* root; - nsXPCWrappedNative* wrapper = NULL; - nsXPCWrappedNativeClass* clazz = NULL; + nsXPCWrappedNative* wrapper = nsnull; + nsXPCWrappedNativeClass* clazz = nsnull; NS_PRECONDITION(xpcc, "bad param"); NS_PRECONDITION(aObj, "bad param"); @@ -94,7 +94,7 @@ nsXPCWrappedNative::GetNewOrUsedWrapper(XPCContext* xpcc, if(!map) { NS_ASSERTION(map,"bad map"); - return NULL; + return nsnull; } // always find the native root @@ -125,7 +125,7 @@ nsXPCWrappedNative::GetNewOrUsedWrapper(XPCContext* xpcc, // do the security check if necessary nsIXPCSecurityManager* sm; - if(NULL != (sm = xpcc->GetSecurityManager()) && + if(nsnull != (sm = xpcc->GetSecurityManager()) && (xpcc->GetSecurityManagerFlags() & nsIXPCSecurityManager::HOOK_CREATE_WRAPPER) && NS_OK != sm->CanCreateWrapper(xpcc->GetJSContext(), aIID, realObj)) @@ -147,12 +147,12 @@ nsXPCWrappedNative::GetNewOrUsedWrapper(XPCContext* xpcc, if(rootObj == realObj) { // the root will do double duty as the interface wrapper - wrapper = root = new nsXPCWrappedNative(realObj, clazz, NULL); + wrapper = root = new nsXPCWrappedNative(realObj, clazz, nsnull); if(!wrapper) goto return_wrapper; if(!wrapper->mJSObj) { - NS_RELEASE(wrapper); // sets wrapper to NULL + NS_RELEASE(wrapper); // sets wrapper to nsnull goto return_wrapper; } @@ -168,14 +168,14 @@ nsXPCWrappedNative::GetNewOrUsedWrapper(XPCContext* xpcc, if(!rootClazz) goto return_wrapper; - root = new nsXPCWrappedNative(rootObj, rootClazz, NULL); + root = new nsXPCWrappedNative(rootObj, rootClazz, nsnull); NS_RELEASE(rootClazz); if(!root) goto return_wrapper; if(!root->mJSObj) { - NS_RELEASE(root); // sets root to NULL + NS_RELEASE(root); // sets root to nsnull goto return_wrapper; } map->Add(root); @@ -193,7 +193,7 @@ nsXPCWrappedNative::GetNewOrUsedWrapper(XPCContext* xpcc, goto return_wrapper; if(!wrapper->mJSObj) { - NS_RELEASE(wrapper); // sets wrapper to NULL + NS_RELEASE(wrapper); // sets wrapper to nsnull goto return_wrapper; } } @@ -224,13 +224,13 @@ nsXPCWrappedNative::nsXPCWrappedNative(nsISupports* aObj, nsXPCWrappedNativeClass* aClass, nsXPCWrappedNative* root) : mObj(aObj), - mJSObj(NULL), + mJSObj(nsnull), mClass(aClass), - mDynamicScriptable(NULL), + mDynamicScriptable(nsnull), mDynamicScriptableFlags(0), mRoot(root ? root : this), - mNext(NULL), - mFinalizeListener(NULL) + mNext(nsnull), + mFinalizeListener(nsnull) { NS_PRECONDITION(mObj, "bad object to wrap"); NS_PRECONDITION(mClass, "bad class for wrapper"); @@ -259,9 +259,9 @@ nsXPCWrappedNative::nsXPCWrappedNative(nsISupports* aObj, nsIXPCScriptable* as; XPCContext* xpcc; - if(NULL != (ds = GetDynamicScriptable()) && - NULL != (as = GetArbitraryScriptable()) && - NULL != (xpcc = GetClass()->GetXPCContext())) + if(nsnull != (ds = GetDynamicScriptable()) && + nsnull != (as = GetArbitraryScriptable()) && + nsnull != (xpcc = GetClass()->GetXPCContext())) { ds->Create(xpcc->GetJSContext(), GetJSObject(), this, as); if(mRoot == this) @@ -275,7 +275,7 @@ void nsXPCWrappedNative::XPCContextBeingDestroyed() { XPCContext* xpcc; - if(mJSObj && mClass && NULL != (xpcc = mClass->GetXPCContext())) + if(mJSObj && mClass && nsnull != (xpcc = mClass->GetXPCContext())) JS_RemoveRoot(xpcc->GetJSContext(), &mJSObj); } @@ -308,9 +308,9 @@ nsXPCWrappedNative::~nsXPCWrappedNative() nsXPCWrappedNativeClass* clazz; XPCContext* xpcc; Native2WrappedNativeMap* map; - if(NULL != (clazz = GetClass()) && - NULL != (xpcc = clazz->GetXPCContext()) && - NULL != (map = xpcc->GetWrappedNativeMap())) + if(nsnull != (clazz = GetClass()) && + nsnull != (xpcc = clazz->GetXPCContext()) && + nsnull != (map = xpcc->GetWrappedNativeMap())) { map->Remove(this); } @@ -339,9 +339,9 @@ nsXPCWrappedNative::Find(REFNSIID aIID) if(aIID.Equals(cur->GetIID())) return cur; - } while(NULL != (cur = cur->mNext)); + } while(nsnull != (cur = cur->mNext)); - return NULL; + return nsnull; } /***************************************************************************/ @@ -358,7 +358,7 @@ nsXPCWrappedNative::GetArbitraryScriptable(nsIXPCScriptable** p) return NS_OK; } // else... - *p = NULL; + *p = nsnull; return NS_ERROR_NO_INTERFACE; } @@ -374,7 +374,7 @@ nsXPCWrappedNative::GetDynamicScriptable(nsIXPCScriptable** p) return NS_OK; } // else... - *p = NULL; + *p = nsnull; return NS_ERROR_NO_INTERFACE; } diff --git a/js/src/xpconnect/src/xpcwrappednativeclass.cpp b/js/src/xpconnect/src/xpcwrappednativeclass.cpp index 539cee8067d0..63e66a3f88b9 100644 --- a/js/src/xpconnect/src/xpcwrappednativeclass.cpp +++ b/js/src/xpconnect/src/xpcwrappednativeclass.cpp @@ -22,7 +22,7 @@ /***************************************************************************/ XPCNativeMemberDescriptor::XPCNativeMemberDescriptor() - : invokeFuncObj(NULL), id(0), index(0), index2(0), flags(0) {} + : invokeFuncObj(nsnull), id(0), index(0), index2(0), flags(0) {} /***************************************************************************/ const char XPC_VAL_STR[] = "value"; @@ -38,7 +38,7 @@ nsXPCWrappedNativeClass::GetNewOrUsedClass(XPCContext* xpcc, REFNSIID aIID) { IID2WrappedNativeClassMap* map; - nsXPCWrappedNativeClass* clazz = NULL; + nsXPCWrappedNativeClass* clazz = nsnull; NS_PRECONDITION(xpcc, "bad param"); @@ -53,7 +53,7 @@ nsXPCWrappedNativeClass::GetNewOrUsedClass(XPCContext* xpcc, else { nsIInterfaceInfoManager* iimgr; - if(NULL != (iimgr = nsXPConnect::GetInterfaceInfoManager())) + if(nsnull != (iimgr = nsXPConnect::GetInterfaceInfoManager())) { nsIInterfaceInfo* info; if(NS_SUCCEEDED(iimgr->GetInfoForIID(&aIID, &info))) @@ -65,7 +65,7 @@ nsXPCWrappedNativeClass::GetNewOrUsedClass(XPCContext* xpcc, { clazz = new nsXPCWrappedNativeClass(xpcc, aIID, info); if(-1 == clazz->mMemberCount) // -1 means 'failed to init' - NS_RELEASE(clazz); // NULLs out 'clazz' + NS_RELEASE(clazz); // nsnulls out 'clazz' } NS_RELEASE(info); } @@ -79,10 +79,10 @@ nsXPCWrappedNativeClass::nsXPCWrappedNativeClass(XPCContext* xpcc, REFNSIID aIID nsIInterfaceInfo* aInfo) : mXPCContext(xpcc), mIID(aIID), - mName(NULL), + mName(nsnull), mInfo(aInfo), mMemberCount(-1), - mDescriptors(NULL) + mDescriptors(nsnull) { NS_ADDREF(mInfo); @@ -210,7 +210,7 @@ void nsXPCWrappedNativeClass::XPCContextBeingDestroyed() { DestroyMemberDescriptors(); - mXPCContext = NULL; + mXPCContext = nsnull; } void @@ -219,12 +219,12 @@ nsXPCWrappedNativeClass::DestroyMemberDescriptors() if(!mDescriptors) return; JSContext* cx; - if(NULL != (cx = GetJSContext())) + if(nsnull != (cx = GetJSContext())) for(int i = 0; i < mMemberCount; i++) if(mDescriptors[i].invokeFuncObj) JS_RemoveRoot(cx, &mDescriptors[i].invokeFuncObj); delete [] mDescriptors; - mDescriptors = NULL; + mDescriptors = nsnull; } const XPCNativeMemberDescriptor* @@ -237,7 +237,7 @@ nsXPCWrappedNativeClass::LookupMemberByID(jsid id) const if(desc->id == id) return desc; } - return NULL; + return nsnull; } const char* @@ -255,7 +255,7 @@ nsXPCWrappedNativeClass::GetMemberName(const XPCNativeMemberDescriptor* desc) co if(NS_SUCCEEDED(mInfo->GetMethodInfo(desc->index, &info))) return info->GetName(); } - return NULL; + return nsnull; } const char* @@ -289,8 +289,8 @@ nsXPCWrappedNativeClass::GetConstantAsJSVal(JSContext *cx, v.type = constant->GetType(); memcpy(&v.val, &mv.val, sizeof(mv.val)); - // XXX if iid consts are supported, then coditionally fill it in here - return XPCConvert::NativeData2JS(cx, vp, &v.val, v.type, NULL, NULL); + // XXX if iid consts are supported, then conditionally fill it in here + return XPCConvert::NativeData2JS(cx, vp, &v.val, v.type, nsnull, nsnull); } JSBool @@ -305,7 +305,7 @@ nsXPCWrappedNativeClass::CallWrappedMethod(JSContext* cx, nsXPTCVariant paramBuffer[PARAM_BUFFER_COUNT]; JSBool retval = JS_FALSE; - nsXPTCVariant* dispatchParams = NULL; + nsXPTCVariant* dispatchParams = nsnull; uint8 i; const nsXPTMethodInfo* info; uint8 requiredArgs; @@ -314,7 +314,7 @@ nsXPCWrappedNativeClass::CallWrappedMethod(JSContext* cx, jsval src; uint8 vtblIndex; nsresult invokeResult; - nsID* conditional_iid = NULL; + nsID* conditional_iid = nsnull; uintN err; XPCContext* xpcc = nsXPConnect::GetContext(cx); nsIXPCSecurityManager* securityManager; @@ -424,7 +424,7 @@ nsXPCWrappedNativeClass::CallWrappedMethod(JSContext* cx, nsXPTCVariant* dp = &dispatchParams[i]; dp->type = type; dp->flags = 0; - dp->val.p = NULL; + dp->val.p = nsnull; dispatchParamsInitedCount++; if(type.TagPart() == nsXPTType::T_INTERFACE || @@ -486,7 +486,7 @@ nsXPCWrappedNativeClass::CallWrappedMethod(JSContext* cx, const nsXPTType& type = param.GetType(); if(!type.IsPointer() || type.TagPart() != nsXPTType::T_IID || !XPCConvert::JSData2Native(cx, &conditional_iid, argv[arg_num], - type, JS_TRUE, NULL, NULL)) + type, JS_TRUE, nsnull, nsnull)) { ThrowBadParamException(NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO, cx, desc, i); @@ -503,7 +503,7 @@ nsXPCWrappedNativeClass::CallWrappedMethod(JSContext* cx, if(conditional_iid) { nsAllocator::Free((void*)conditional_iid); - conditional_iid = NULL; + conditional_iid = nsnull; } } @@ -580,7 +580,7 @@ nsXPCWrappedNativeClass::CallWrappedMethod(JSContext* cx, if(conditional_iid) { nsAllocator::Free((void*)conditional_iid); - conditional_iid = NULL; + conditional_iid = nsnull; } } } @@ -621,7 +621,7 @@ nsXPCWrappedNativeClass::GetInvokeFunObj(const XPCNativeMemberDescriptor* desc) JSContext* cx = GetJSContext(); if(!cx) - return NULL; + return nsnull; const nsXPTMethodInfo* info; uint8 requiredArgs = 0; @@ -636,14 +636,14 @@ nsXPCWrappedNativeClass::GetInvokeFunObj(const XPCNativeMemberDescriptor* desc) JSFunction *fun = JS_NewFunction(cx, WrappedNative_CallMethod, (uintN) requiredArgs, - JSFUN_BOUND_METHOD, NULL, name); + JSFUN_BOUND_METHOD, nsnull, name); if(!fun) - return NULL; + return nsnull; XPCNativeMemberDescriptor* descRW = NS_CONST_CAST(XPCNativeMemberDescriptor*,desc); - if(NULL != (descRW->invokeFuncObj = JS_GetFunctionObject(fun))) + if(nsnull != (descRW->invokeFuncObj = JS_GetFunctionObject(fun))) JS_AddNamedRoot(cx, &descRW->invokeFuncObj, "XPCNativeMemberDescriptor::invokeFuncObj"); } @@ -669,7 +669,7 @@ nsXPCWrappedNativeClass::DynamicEnumerate(nsXPCWrappedNative* wrapper, switch(enum_op) { case JSENUMERATE_INIT: { - if(NULL != (holder = new EnumStateHolder())) + if(nsnull != (holder = new EnumStateHolder())) { jsid did; jsid sid; @@ -698,7 +698,7 @@ nsXPCWrappedNativeClass::DynamicEnumerate(nsXPCWrappedNative* wrapper, return JS_TRUE; } case JSENUMERATE_NEXT: - if(NULL != (holder = (EnumStateHolder*) JSVAL_TO_PRIVATE(*statep))) + if(nsnull != (holder = (EnumStateHolder*) JSVAL_TO_PRIVATE(*statep))) { if(holder->dstate != JSVAL_NULL) { @@ -720,7 +720,7 @@ nsXPCWrappedNativeClass::DynamicEnumerate(nsXPCWrappedNative* wrapper, /* Fall through ... */ case JSENUMERATE_DESTROY: - if(NULL != (holder = (EnumStateHolder*) JSVAL_TO_PRIVATE(*statep))) + if(nsnull != (holder = (EnumStateHolder*) JSVAL_TO_PRIVATE(*statep))) { JSBool retval; if(holder->dstate != JSVAL_NULL) @@ -799,13 +799,13 @@ nsXPCWrappedNativeClass::NewInstanceJSObject(nsXPCWrappedNative* self) { JSContext* cx = GetJSContext(); if(!cx) - return NULL; + return nsnull; JSClass* jsclazz = self->GetDynamicScriptable() ? &WrappedNativeWithCall_class : &WrappedNative_class; - JSObject* jsobj = JS_NewObject(cx, jsclazz, NULL, JS_GetGlobalObject(cx)); + JSObject* jsobj = JS_NewObject(cx, jsclazz, nsnull, JS_GetGlobalObject(cx)); if(!jsobj || !JS_SetPrivate(cx, jsobj, self)) - return NULL; + return nsnull; // wrapper is responsible for calling DynamicScriptable->Create return jsobj; } @@ -816,10 +816,10 @@ nsXPCWrappedNativeClass::GetWrappedNativeOfJSObject(JSContext* cx, JSObject* jsobj) { NS_PRECONDITION(jsobj, "bad param"); - if(jsobj && (JS_InstanceOf(cx, jsobj, &WrappedNative_class, NULL) || - JS_InstanceOf(cx, jsobj, &WrappedNativeWithCall_class, NULL))) + if(jsobj && (JS_InstanceOf(cx, jsobj, &WrappedNative_class, nsnull) || + JS_InstanceOf(cx, jsobj, &WrappedNativeWithCall_class, nsnull))) return (nsXPCWrappedNative*) JS_GetPrivate(cx, jsobj); - return NULL; + return nsnull; } @@ -879,7 +879,7 @@ nsXPCWrappedNativeClass::DebugDump(int depth) if (JS_IdToValue(GetJSContext(), desc.id, &idval) && JSVAL_IS_STRING(idval) && (name = JS_GetStringBytes( - JSVAL_TO_STRING(idval))) != NULL) + JSVAL_TO_STRING(idval))) != nsnull) { XPC_LOG_ALWAYS(("property name is %s", name)); }