author | Birunthan Mohanathas <birunthan@mohanathas.com> |
Wed, 23 Oct 2013 16:34:30 -0400 (2013-10-23) | |
changeset 151900 | 3656e6195ed26ec8d0a4697ca2eb90254a3a1000 |
parent 151899 | b8c97df0418de30a4f189a65793898cc0393b967 |
child 151901 | 298d6746f0afbafa3d33b812d839199b85269979 |
push id | 25512 |
push user | cbook@mozilla.com |
push date | Thu, 24 Oct 2013 05:06:01 +0000 (2013-10-24) |
treeherder | mozilla-central@19fd3388c372 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ehsan |
bugs | 784739 |
milestone | 27.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/plugins/base/android/ANPAudio.cpp +++ b/dom/plugins/base/android/ANPAudio.cpp @@ -131,17 +131,17 @@ AudioRunnable::Run() mozilla::AutoLocalJNIFrame autoFrame(jenv, 2); jbyteArray bytearray = jenv->NewByteArray(mTrack->bufferSize); if (!bytearray) { LOG("AudioRunnable:: Run. Could not create bytearray"); return NS_ERROR_FAILURE; } - jbyte *byte = jenv->GetByteArrayElements(bytearray, NULL); + jbyte *byte = jenv->GetByteArrayElements(bytearray, nullptr); if (!byte) { LOG("AudioRunnable:: Run. Could not create bytearray"); return NS_ERROR_FAILURE; } ANPAudioBuffer buffer; buffer.channelCount = mTrack->channels; buffer.format = mTrack->format; @@ -200,23 +200,23 @@ AudioRunnable::Run() ANPAudioTrack* anp_audio_newTrack(uint32_t sampleRate, // sampling rate in Hz ANPSampleFormat format, int channelCount, // MONO=1, STEREO=2 ANPAudioCallbackProc proc, void* user) { ANPAudioTrack *s = new ANPAudioTrack(); - if (s == NULL) { - return NULL; + if (s == nullptr) { + return nullptr; } JNIEnv *jenv = GetJNIForThread(); if (!jenv) - return NULL; + return nullptr; s->at_class = init_jni_bindings(jenv); s->rate = sampleRate; s->channels = channelCount; s->bufferSize = s->rate * s->channels; s->isStopped = true; s->keepGoing = false; s->user = user; @@ -257,53 +257,53 @@ anp_audio_newTrack(uint32_t sampleRate, at.constructor, STREAM_MUSIC, s->rate, jChannels, jformat, s->bufferSize, MODE_STREAM); - if (autoFrame.CheckForException() || obj == NULL) { + if (autoFrame.CheckForException() || obj == nullptr) { jenv->DeleteGlobalRef(s->at_class); free(s); - return NULL; + return nullptr; } jint state = jenv->CallIntMethod(obj, at.getstate); if (autoFrame.CheckForException() || state == STATE_UNINITIALIZED) { jenv->DeleteGlobalRef(s->at_class); free(s); - return NULL; + return nullptr; } s->output_unit = jenv->NewGlobalRef(obj); return s; } void anp_audio_deleteTrack(ANPAudioTrack* s) { - if (s == NULL) { + if (s == nullptr) { return; } mozilla::MutexAutoLock lock(s->lock); s->keepGoing = false; // deallocation happens in the AudioThread. There is a // potential leak if anp_audio_start is never called, but // we do not see that from flash. } void anp_audio_start(ANPAudioTrack* s) { - if (s == NULL || s->output_unit == NULL) { + if (s == nullptr || s->output_unit == nullptr) { return; } if (s->keepGoing) { // we are already playing. Ignore. return; } @@ -328,32 +328,32 @@ anp_audio_start(ANPAudioTrack* s) nsCOMPtr<nsIThread> thread; NS_NewThread(getter_AddRefs(thread), runnable); } void anp_audio_pause(ANPAudioTrack* s) { - if (s == NULL || s->output_unit == NULL) { + if (s == nullptr || s->output_unit == nullptr) { return; } JNIEnv *jenv = GetJNIForThread(); if (!jenv) return; mozilla::AutoLocalJNIFrame autoFrame(jenv, 0); jenv->CallVoidMethod(s->output_unit, at.pause); } void anp_audio_stop(ANPAudioTrack* s) { - if (s == NULL || s->output_unit == NULL) { + if (s == nullptr || s->output_unit == nullptr) { return; } s->isStopped = true; JNIEnv *jenv = GetJNIForThread(); if (!jenv) return;
--- a/dom/plugins/base/android/ANPOpenGL.cpp +++ b/dom/plugins/base/android/ANPOpenGL.cpp @@ -20,17 +20,17 @@ using namespace mozilla::gl; typedef nsNPAPIPluginInstance::TextureInfo TextureInfo; static ANPEGLContext anp_opengl_acquireContext(NPP instance) { nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata); GLContext* context = pinst->GLContext(); if (!context) - return NULL; + return nullptr; context->MakeCurrent(); return context->GetNativeData(GLContext::NativeGLContext); } static ANPTextureInfo anp_opengl_lockTexture(NPP instance) { nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
--- a/dom/plugins/base/android/ANPSurface.cpp +++ b/dom/plugins/base/android/ANPSurface.cpp @@ -53,17 +53,17 @@ static struct ANPSurfaceFunctions { void* (* regionConstructor)(void*); void (* setRegion)(void*, ARect const&); } gSurfaceFunctions; static inline void* getSurface(JNIEnv* env, jobject view) { if (!env || !view) { - return NULL; + return nullptr; } if (!gSurfaceJavaGlue.initialized) { jclass surfaceViewClass = env->FindClass("android/view/SurfaceView"); gSurfaceJavaGlue.getSurfaceHolder = env->GetMethodID(surfaceViewClass, "getHolder", "()Landroid/view/SurfaceHolder;"); jclass surfaceHolderClass = env->FindClass("android/view/SurfaceHolder"); @@ -88,24 +88,24 @@ static inline void* getSurface(JNIEnv* e "mNativeSurface", "I"); CLEAR_EXCEPTION(env); } } if (!gSurfaceJavaGlue.surfacePointer) { LOG("Failed to acquire surface pointer"); - return NULL; + return nullptr; } env->DeleteLocalRef(surfaceClass); env->DeleteLocalRef(surfaceViewClass); env->DeleteLocalRef(surfaceHolderClass); - gSurfaceJavaGlue.initialized = (gSurfaceJavaGlue.surfacePointer != NULL); + gSurfaceJavaGlue.initialized = (gSurfaceJavaGlue.surfacePointer != nullptr); } jobject holder = env->CallObjectMethod(view, gSurfaceJavaGlue.getSurfaceHolder); jobject surface = env->CallObjectMethod(holder, gSurfaceJavaGlue.getSurface); jint surfacePointer = env->GetIntField(surface, gSurfaceJavaGlue.surfacePointer); env->DeleteLocalRef(holder); env->DeleteLocalRef(surface); @@ -177,17 +177,17 @@ static bool anp_surface_lock(JNIEnv* env if (!bitmap || !surface) { return false; } if (!init()) { return false; } - void* region = NULL; + void* region = nullptr; if (dirtyRect) { region = malloc(ANDROID_REGION_SIZE); gSurfaceFunctions.regionConstructor(region); ARect rect; rect.left = dirtyRect->left; rect.top = dirtyRect->top; rect.right = dirtyRect->right; @@ -222,17 +222,17 @@ static bool anp_surface_lock(JNIEnv* env bitmap->format = convertPixelFormat(info.format); bitmap->width = info.w; bitmap->height = info.h; bitmap->rowBytes = bpr; if (info.w > 0 && info.h > 0) { bitmap->baseAddr = info.bits; } else { - bitmap->baseAddr = NULL; + bitmap->baseAddr = nullptr; return false; } return true; } static void anp_surface_unlock(JNIEnv* env, jobject surfaceView) { if (!surfaceView) {
--- a/dom/plugins/base/android/ANPSystem.cpp +++ b/dom/plugins/base/android/ANPSystem.cpp @@ -14,18 +14,18 @@ #include "PluginPRLibrary.h" #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args) #define ASSIGN(obj, name) (obj)->name = anp_system_##name const char* anp_system_getApplicationDataDirectory(NPP instance) { - static const char *dir = NULL; - static const char *privateDir = NULL; + static const char *dir = nullptr; + static const char *privateDir = nullptr; bool isPrivate = false; if (!dir) { dir = getenv("ANDROID_PLUGIN_DATADIR"); } if (!privateDir) {
--- a/dom/plugins/base/npapi.h +++ b/dom/plugins/base/npapi.h @@ -149,17 +149,17 @@ typedef struct _NPStream void* pdata; /* plug-in private data */ void* ndata; /* netscape private data */ const char* url; uint32_t end; uint32_t lastmodified; void* notifyData; const char* headers; /* Response headers from host. * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS. - * Used for HTTP only; NULL for non-HTTP. + * Used for HTTP only; nullptr for non-HTTP. * Available from NPP_NewStream onwards. * Plugin should copy this data before storing it. * Includes HTTP status line and all headers, * preferably verbatim as received from server, * headers formatted as in HTTP ("Header: Value"), * and newlines (\n, NOT \r\n) separating lines. * Terminated by \n\0 (NOT \n\n\0). */ } NPStream;
--- a/dom/plugins/base/npruntime.h +++ b/dom/plugins/base/npruntime.h @@ -132,23 +132,23 @@ void NPN_ReleaseVariantValue(NPVariant * #define NPVARIANT_TO_INT32(_v) ((_v).value.intValue) #define NPVARIANT_TO_DOUBLE(_v) ((_v).value.doubleValue) #define NPVARIANT_TO_STRING(_v) ((_v).value.stringValue) #define NPVARIANT_TO_OBJECT(_v) ((_v).value.objectValue) #define VOID_TO_NPVARIANT(_v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Void; \ - (_v).value.objectValue = NULL; \ + (_v).value.objectValue = nullptr; \ NP_END_MACRO #define NULL_TO_NPVARIANT(_v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Null; \ - (_v).value.objectValue = NULL; \ + (_v).value.objectValue = nullptr; \ NP_END_MACRO #define BOOLEAN_TO_NPVARIANT(_val, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Bool; \ (_v).value.boolValue = !!(_val); \ NP_END_MACRO @@ -211,17 +211,17 @@ typedef void *NPIdentifier; /* NPObjects have methods and properties. Methods and properties are identified with NPIdentifiers. These identifiers may be reflected in script. NPIdentifiers can be either strings or integers, IOW, methods and properties can be identified by either strings or integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be compared using ==. In case of any errors, the requested - NPIdentifier(s) will be NULL. NPIdentifier lifetime is controlled + NPIdentifier(s) will be nullptr. NPIdentifier lifetime is controlled by the browser. Plugins do not need to worry about memory management with regards to NPIdentifiers. */ NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name); void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers); NPIdentifier NPN_GetIntIdentifier(int32_t intid); bool NPN_IdentifierIsString(NPIdentifier identifier); @@ -278,19 +278,19 @@ typedef bool (*NPConstructFunctionPtr)(N NPInvokeFunctionPtr function may return 0 to indicate a void result. NPInvalidateFunctionPtr is called by the scripting environment when the native code is shutdown. Any attempt to message a NPObject instance after the invalidate callback has been called will result in undefined behavior, even if the native code is still retaining those NPObject instances. (The runtime - will typically return immediately, with 0 or NULL, from an attempt - to dispatch to a NPObject, but this behavior should not be - depended upon.) + will typically return immediately, with 0 or nullptr, from an + attempt to dispatch to a NPObject, but this behavior should not + be depended upon.) The NPEnumerationFunctionPtr function may pass an array of NPIdentifiers back to the caller. The callee allocs the memory of the array using NPN_MemAlloc(), and it's the caller's responsibility to release it using NPN_MemFree(). */ struct NPClass {
--- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -1071,25 +1071,25 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JS // substantial with it. static JSObject * GetNPObjectWrapper(JSContext *cx, JSObject *aObj, bool wrapResult = true) { JS::Rooted<JSObject*> obj(cx, aObj); while (obj && (obj = js::CheckedUnwrap(obj))) { if (JS_GetClass(obj) == &sNPObjectJSWrapperClass) { if (wrapResult && !JS_WrapObject(cx, &obj)) { - return NULL; + return nullptr; } return obj; } if (!::JS_GetPrototype(cx, obj, &obj)) { - return NULL; + return nullptr; } } - return NULL; + return nullptr; } static NPObject * GetNPObject(JSContext *cx, JSObject *obj) { obj = GetNPObjectWrapper(cx, obj, /* wrapResult = */ false); if (!obj) { return nullptr; @@ -1615,23 +1615,23 @@ NPObjWrapper_Convert(JSContext *cx, JS:: // methods, none of which are nullary, so the JS-reflected method will behave // poorly when called with no arguments. We work around this problem by // giving plugins a [[DefaultValue]] which uses only toString and not valueOf. JS::Rooted<JS::Value> v(cx, JSVAL_VOID); if (!JS_GetProperty(cx, obj, "toString", &v)) return false; if (!JSVAL_IS_PRIMITIVE(v) && JS_ObjectIsCallable(cx, JSVAL_TO_OBJECT(v))) { - if (!JS_CallFunctionValue(cx, obj, v, 0, NULL, vp.address())) + if (!JS_CallFunctionValue(cx, obj, v, 0, nullptr, vp.address())) return false; if (JSVAL_IS_PRIMITIVE(vp)) return true; } - JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CONVERT_TO, + JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO, JS_GetClass(obj)->name, hint == JSTYPE_VOID ? "primitive type" : hint == JSTYPE_NUMBER ? "number" : "string"); return false; } @@ -1726,17 +1726,17 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JS return nullptr; } if (npobj->_class == &nsJSObjWrapper::sJSObjWrapperNPClass) { // npobj is one of our own, return its existing JSObject. JS::Rooted<JSObject*> obj(cx, ((nsJSObjWrapper *)npobj)->mJSObj); if (!JS_WrapObject(cx, &obj)) { - return NULL; + return nullptr; } return obj; } if (!npp) { NS_ERROR("No npp passed to nsNPObjWrapper::GetNewOrUsed()!"); return nullptr; @@ -1763,17 +1763,17 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JS return nullptr; } if (PL_DHASH_ENTRY_IS_BUSY(entry) && entry->mJSObj) { // Found a live NPObject wrapper. It may not be in the same compartment // as cx, so we need to wrap it before returning it. JS::Rooted<JSObject*> obj(cx, entry->mJSObj); if (!JS_WrapObject(cx, &obj)) { - return NULL; + return nullptr; } return obj; } entry->mNPObj = npobj; entry->mNpp = npp; uint32_t generation = sNPObjWrappers.generation;
--- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -162,18 +162,18 @@ static NPNetscapeFuncs sBrowserFuncs = { _construct, _getvalueforurl, _setvalueforurl, _getauthenticationinfo, _scheduletimer, _unscheduletimer, _popupcontextmenu, _convertpoint, - NULL, // handleevent, unimplemented - NULL, // unfocusinstance, unimplemented + nullptr, // handleevent, unimplemented + nullptr, // unfocusinstance, unimplemented _urlredirectresponse, _initasyncsurface, _finalizeasyncsurface, _setcurrentasyncsurface }; static Mutex *sPluginThreadAsyncCallLock = nullptr; static PRCList sPendingAsyncCalls = PR_INIT_STATIC_CLIST(&sPendingAsyncCalls); @@ -492,17 +492,17 @@ nsNPAPIPlugin::Shutdown() } nsresult nsNPAPIPlugin::RetainStream(NPStream *pstream, nsISupports **aRetainedPeer) { if (!aRetainedPeer) return NS_ERROR_NULL_POINTER; - *aRetainedPeer = NULL; + *aRetainedPeer = nullptr; if (!pstream || !pstream->ndata) return NS_ERROR_NULL_POINTER; nsNPAPIStreamWrapper* streamWrapper = static_cast<nsNPAPIStreamWrapper*>(pstream->ndata); nsNPAPIPluginStreamListener* listener = streamWrapper->GetStreamListener(); if (!listener) { return NS_ERROR_NULL_POINTER; @@ -555,23 +555,25 @@ MakeNewNPAPIStreamInternal(NPP npp, cons listener->SetCallNotify(false); } } switch (type) { case eNPPStreamTypeInternal_Get: { if (NS_FAILED(pluginHost->GetURL(inst, relativeURL, target, listener, - NULL, NULL, false))) + nullptr, nullptr, false))) return NPERR_GENERIC_ERROR; break; } case eNPPStreamTypeInternal_Post: { - if (NS_FAILED(pluginHost->PostURL(inst, relativeURL, len, buf, file, target, listener, NULL, NULL, false, 0, NULL))) + if (NS_FAILED(pluginHost->PostURL(inst, relativeURL, len, buf, file, + target, listener, nullptr, nullptr, + false, 0, nullptr))) return NPERR_GENERIC_ERROR; break; } default: NS_ERROR("how'd I get here"); } if (listener) { @@ -682,28 +684,28 @@ static NPIdentifier doGetIdentifier(JSContext *cx, const NPUTF8* name) { NS_ConvertUTF8toUTF16 utf16name(name); JSString *str = ::JS_InternUCStringN(cx, (jschar *)utf16name.get(), utf16name.Length()); if (!str) - return NULL; + return nullptr; return StringToNPIdentifier(cx, str); } #if defined(MOZ_MEMORY_WINDOWS) BOOL InHeap(HANDLE hHeap, LPVOID lpMem) { BOOL success = FALSE; PROCESS_HEAP_ENTRY he; - he.lpData = NULL; + he.lpData = nullptr; while (HeapWalk(hHeap, &he) != 0) { if (he.lpData == lpMem) { success = TRUE; break; } } HeapUnlock(hHeap); return success; @@ -1256,17 +1258,17 @@ NPObject* NP_CALLBACK return nsJSObjWrapper::GetNewOrUsed(npp, cx, obj); } NPIdentifier NP_CALLBACK _getstringidentifier(const NPUTF8* name) { if (!name) { NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS, ("NPN_getstringidentifier: passed null name")); - return NULL; + return nullptr; } if (!NS_IsMainThread()) { NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getstringidentifier called from the wrong thread\n")); } AutoSafeJSContext cx; return doGetIdentifier(cx, name); } @@ -1281,17 +1283,17 @@ void NP_CALLBACK AutoSafeJSContext cx; for (int32_t i = 0; i < nameCount; ++i) { if (names[i]) { identifiers[i] = doGetIdentifier(cx, names[i]); } else { NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS, ("NPN_getstringidentifiers: passed null name")); - identifiers[i] = NULL; + identifiers[i] = nullptr; } } } NPIdentifier NP_CALLBACK _getintidentifier(int32_t intid) { if (!NS_IsMainThread()) { @@ -1302,17 +1304,17 @@ NPIdentifier NP_CALLBACK NPUTF8* NP_CALLBACK _utf8fromidentifier(NPIdentifier id) { if (!NS_IsMainThread()) { NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_utf8fromidentifier called from the wrong thread\n")); } if (!id) - return NULL; + return nullptr; if (!NPIdentifierIsString(id)) { return nullptr; } JSString *str = NPIdentifierToString(id); return @@ -2496,17 +2498,17 @@ NPError NP_CALLBACK return NPERR_NO_ERROR; } // Deprecated, only stubbed out void* NP_CALLBACK /* OJI type: JRIEnv* */ _getJavaEnv() { NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetJavaEnv\n")); - return NULL; + return nullptr; } const char * NP_CALLBACK _useragent(NPP npp) { if (!NS_IsMainThread()) { NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_useragent called from the wrong thread\n")); return nullptr; @@ -2537,41 +2539,41 @@ void * NP_CALLBACK return nsMemory::Alloc(size); } // Deprecated, only stubbed out void* NP_CALLBACK /* OJI type: jref */ _getJavaPeer(NPP npp) { NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetJavaPeer: npp=%p\n", (void*)npp)); - return NULL; + return nullptr; } void NP_CALLBACK _pushpopupsenabledstate(NPP npp, NPBool enabled) { if (!NS_IsMainThread()) { NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_pushpopupsenabledstate called from the wrong thread\n")); return; } - nsNPAPIPluginInstance *inst = npp ? (nsNPAPIPluginInstance *)npp->ndata : NULL; + nsNPAPIPluginInstance *inst = npp ? (nsNPAPIPluginInstance *)npp->ndata : nullptr; if (!inst) return; inst->PushPopupsEnabledState(enabled); } void NP_CALLBACK _poppopupsenabledstate(NPP npp) { if (!NS_IsMainThread()) { NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_poppopupsenabledstate called from the wrong thread\n")); return; } - nsNPAPIPluginInstance *inst = npp ? (nsNPAPIPluginInstance *)npp->ndata : NULL; + nsNPAPIPluginInstance *inst = npp ? (nsNPAPIPluginInstance *)npp->ndata : nullptr; if (!inst) return; inst->PopPopupsEnabledState(); } void NP_CALLBACK _pluginthreadasynccall(NPP instance, PluginThreadCallback func, void *userData)
--- a/dom/plugins/base/nsNPAPIPlugin.h +++ b/dom/plugins/base/nsNPAPIPlugin.h @@ -41,17 +41,17 @@ private: typedef mozilla::PluginLibrary PluginLibrary; public: nsNPAPIPlugin(); virtual ~nsNPAPIPlugin(); NS_DECL_ISUPPORTS - // Constructs and initializes an nsNPAPIPlugin object. A NULL file path + // Constructs and initializes an nsNPAPIPlugin object. A nullptr file path // will prevent this from calling NP_Initialize. static nsresult CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult); PluginLibrary* GetLibrary(); // PluginFuncs() can't fail but results are only valid if GetLibrary() succeeds NPPluginFuncs* PluginFuncs(); #if defined(XP_MACOSX) && !defined(__LP64__)
--- a/dom/plugins/base/nsNPAPIPluginInstance.cpp +++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp @@ -188,17 +188,17 @@ nsNPAPIPluginInstance::nsNPAPIPluginInst mMIMEType(nullptr), mOwner(nullptr), mCurrentPluginEvent(nullptr) #ifdef MOZ_WIDGET_ANDROID , mOnScreen(true) #endif , mHaveJavaC2PJSObjectQuirk(false) { - mNPP.pdata = NULL; + mNPP.pdata = nullptr; mNPP.ndata = this; PLUGIN_LOG(PLUGIN_LOG_BASIC, ("nsNPAPIPluginInstance ctor: this=%p\n",this)); #ifdef MOZ_WIDGET_ANDROID sPluginNPPMap[&mNPP] = this; #endif } @@ -531,17 +531,19 @@ nsNPAPIPluginInstance::Start() if (!library) return NS_ERROR_FAILURE; // Mark this instance as running before calling NPP_New because the plugin may // call other NPAPI functions, like NPN_GetURLNotify, that assume this is set // before returning. If the plugin returns failure, we'll clear it out below. mRunning = RUNNING; - nsresult newResult = library->NPP_New((char*)mimetype, &mNPP, (uint16_t)mode, count, (char**)names, (char**)values, NULL, &error); + nsresult newResult = library->NPP_New((char*)mimetype, &mNPP, (uint16_t)mode, + count, (char**)names, (char**)values, + nullptr, &error); mInPluginInitCall = oldVal; NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPP New called: this=%p, npp=%p, mime=%s, mode=%d, argc=%d, return=%d\n", this, &mNPP, mimetype, mode, count, error)); if (NS_FAILED(newResult) || error != NPERR_NO_ERROR) { mRunning = DESTROYED; @@ -549,17 +551,17 @@ nsNPAPIPluginInstance::Start() return NS_ERROR_FAILURE; } return NS_OK; } nsresult nsNPAPIPluginInstance::SetWindow(NPWindow* window) { - // NPAPI plugins don't want a SetWindow(NULL). + // NPAPI plugins don't want a SetWindow(nullptr). if (!window || RUNNING != mRunning) return NS_OK; #if (MOZ_WIDGET_GTK == 2) // bug 108347, flash plugin on linux doesn't like window->width <= // 0, but Java needs wants this call. if (!nsPluginHost::IsJavaMIMEType(mMIMEType) && window->type == NPWindowTypeWindow && (window->width <= 0 || window->height <= 0)) { @@ -1434,17 +1436,17 @@ PluginTimerCallback(nsITimer *aTimer, vo // from this callback. t->inCallback = true; (*(t->callback))(npp, id); t->inCallback = false; // Make sure we still have an instance and the timer is still alive // after the callback. nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance*)npp->ndata; - if (!inst || !inst->TimerWithID(id, NULL)) + if (!inst || !inst->TimerWithID(id, nullptr)) return; // use UnscheduleTimer to clean up if this is a one-shot timer uint32_t timerType; t->timer->GetType(&timerType); if (t->needUnschedule || timerType == nsITimer::TYPE_ONE_SHOT) inst->UnscheduleTimer(id); } @@ -1471,17 +1473,17 @@ nsNPAPIPluginInstance::ScheduleTimer(uin nsNPAPITimer *newTimer = new nsNPAPITimer(); newTimer->inCallback = newTimer->needUnschedule = false; newTimer->npp = &mNPP; // generate ID that is unique to this instance uint32_t uniqueID = mTimers.Length(); - while ((uniqueID == 0) || TimerWithID(uniqueID, NULL)) + while ((uniqueID == 0) || TimerWithID(uniqueID, nullptr)) uniqueID++; newTimer->id = uniqueID; // create new xpcom timer, scheduled correctly nsresult rv; nsCOMPtr<nsITimer> xpcomTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv); if (NS_FAILED(rv)) { delete newTimer; @@ -1594,17 +1596,17 @@ nsNPAPIPluginInstance::GetMIMEType(const nsresult nsNPAPIPluginInstance::GetJSContext(JSContext* *outContext) { if (!mOwner) return NS_ERROR_FAILURE; nsRefPtr<nsPluginInstanceOwner> deathGrip(mOwner); - *outContext = NULL; + *outContext = nullptr; nsCOMPtr<nsIDocument> document; nsresult rv = mOwner->GetDocument(getter_AddRefs(document)); if (NS_SUCCEEDED(rv) && document) { nsCOMPtr<nsIScriptGlobalObject> global = do_QueryInterface(document->GetWindow());
--- a/dom/plugins/base/nsPluginDirServiceProvider.cpp +++ b/dom/plugins/base/nsPluginDirServiceProvider.cpp @@ -88,21 +88,21 @@ CopyVersion(verBlock *ver1, verBlock *ve ver1->wRelease = ver2->wRelease; ver1->wBuild = ver2->wBuild; } // Convert a string version to a version struct static void TranslateVersionStr(const WCHAR* szVersion, verBlock *vbVersion) { - WCHAR* szNum1 = NULL; - WCHAR* szNum2 = NULL; - WCHAR* szNum3 = NULL; - WCHAR* szNum4 = NULL; - WCHAR* szJavaBuild = NULL; + WCHAR* szNum1 = nullptr; + WCHAR* szNum2 = nullptr; + WCHAR* szNum3 = nullptr; + WCHAR* szNum4 = nullptr; + WCHAR* szJavaBuild = nullptr; WCHAR *strVer = nullptr; if (szVersion) { strVer = wcsdup(szVersion); } if (!strVer) { // Out of memory @@ -111,20 +111,20 @@ TranslateVersionStr(const WCHAR* szVersi } // Java may be using an underscore instead of a dot for the build ID szJavaBuild = wcschr(strVer, '_'); if (szJavaBuild) { szJavaBuild[0] = '.'; } - szNum1 = wcstok(strVer, L"."); - szNum2 = wcstok(NULL, L"."); - szNum3 = wcstok(NULL, L"."); - szNum4 = wcstok(NULL, L"."); + szNum1 = wcstok(strVer, L"."); + szNum2 = wcstok(nullptr, L"."); + szNum3 = wcstok(nullptr, L"."); + szNum4 = wcstok(nullptr, L"."); vbVersion->wMajor = szNum1 ? (WORD) _wtoi(szNum1) : 0; vbVersion->wMinor = szNum2 ? (WORD) _wtoi(szNum2) : 0; vbVersion->wRelease = szNum3 ? (WORD) _wtoi(szNum3) : 0; vbVersion->wBuild = szNum4 ? (WORD) _wtoi(szNum4) : 0; free(strVer); }
--- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -1262,17 +1262,17 @@ static nsresult CreateNPAPIPlugin(nsPlug { // If this is an in-process plugin we'll need to load it here if we haven't already. if (!nsNPAPIPlugin::RunPluginOOP(aPluginTag)) { if (aPluginTag->mFullPath.IsEmpty()) return NS_ERROR_FAILURE; nsCOMPtr<nsIFile> file = do_CreateInstance("@mozilla.org/file/local;1"); file->InitWithPath(NS_ConvertUTF8toUTF16(aPluginTag->mFullPath)); nsPluginFile pluginFile(file); - PRLibrary* pluginLibrary = NULL; + PRLibrary* pluginLibrary = nullptr; if (NS_FAILED(pluginFile.LoadPlugin(&pluginLibrary)) || !pluginLibrary) return NS_ERROR_FAILURE; aPluginTag->mLibrary = pluginLibrary; } nsresult rv; @@ -1292,17 +1292,17 @@ nsresult nsPluginHost::EnsurePluginLoade aPluginTag->mPlugin = plugin; } return NS_OK; } nsresult nsPluginHost::GetPlugin(const char *aMimeType, nsNPAPIPlugin** aPlugin) { nsresult rv = NS_ERROR_FAILURE; - *aPlugin = NULL; + *aPlugin = nullptr; if (!aMimeType) return NS_ERROR_ILLEGAL_VALUE; // If plugins haven't been scanned yet, do so now LoadPlugins(); nsPluginTag* pluginTag = FindPluginForType(aMimeType, true); @@ -1505,17 +1505,17 @@ nsPluginHost::ClearSiteData(nsIPluginTag if (NS_FAILED(rv)) { return rv; } PluginLibrary* library = tag->mPlugin->GetLibrary(); // If 'domain' is the null string, clear everything. if (domain.IsVoid()) { - return library->NPP_ClearSiteData(NULL, flags, maxAge); + return library->NPP_ClearSiteData(nullptr, flags, maxAge); } // Get the list of sites from the plugin. InfallibleTArray<nsCString> sites; rv = library->NPP_GetSitesWithData(sites); NS_ENSURE_SUCCESS(rv, rv); // Enumerate the sites and build a list of matches. @@ -2103,18 +2103,18 @@ nsresult nsPluginHost::FindPlugins(bool mInvalidPlugins = invalidPlugin->mNext; } if (invalidPlugin->mNext) { invalidPlugin->mNext->mPrev = invalidPlugin->mPrev; } invalidPlugins = invalidPlugin->mNext; - invalidPlugin->mPrev = NULL; - invalidPlugin->mNext = NULL; + invalidPlugin->mPrev = nullptr; + invalidPlugin->mNext = nullptr; } else { invalidPlugins->mSeen = false; invalidPlugins = invalidPlugins->mNext; } } // if we are not creating the list, there is no need to proceed @@ -2529,17 +2529,17 @@ nsPluginHost::ReadPluginInfo() return rv; // try to derive a file name from the full path if (fullpath) { nsCOMPtr<nsIFile> file = do_CreateInstance("@mozilla.org/file/local;1"); file->InitWithNativePath(nsDependentCString(fullpath)); file->GetNativeLeafName(derivedFileName); filename = derivedFileName.get(); } else { - filename = NULL; + filename = nullptr; } // skip the next line, useless in this version if (!reader.NextLine()) return rv; } else { filename = reader.LinePtr(); if (!reader.NextLine())
--- a/dom/plugins/base/nsPluginHost.h +++ b/dom/plugins/base/nsPluginHost.h @@ -129,23 +129,23 @@ public: nsNPAPIPluginStreamListener *aListener, nsIInputStream *aPostStream = nullptr, const char *aHeadersData = nullptr, uint32_t aHeadersDataLen = 0); nsresult GetURLWithHeaders(nsNPAPIPluginInstance *pluginInst, const char* url, - const char* target = NULL, - nsNPAPIPluginStreamListener* streamListener = NULL, - const char* altHost = NULL, - const char* referrer = NULL, + const char* target = nullptr, + nsNPAPIPluginStreamListener* streamListener = nullptr, + const char* altHost = nullptr, + const char* referrer = nullptr, bool forceJSEnabled = false, uint32_t getHeadersLength = 0, - const char* getHeaders = NULL); + const char* getHeaders = nullptr); nsresult DoURLLoadSecurityCheck(nsNPAPIPluginInstance *aInstance, const char* aURL); nsresult AddHeadersToChannel(const char *aHeadersData, uint32_t aHeadersDataLen, nsIChannel *aGenericChannel); @@ -184,17 +184,17 @@ public: nsPluginTag* FindTagForLibrary(PRLibrary* aLibrary); // The last argument should be false if we already have an in-flight stream // and don't need to set up a new stream. nsresult InstantiatePluginInstance(const char *aMimeType, nsIURI* aURL, nsObjectLoadingContent *aContent, nsPluginInstanceOwner** aOwner); - // Does not accept NULL and should never fail. + // Does not accept nullptr and should never fail. nsPluginTag* TagForPlugin(nsNPAPIPlugin* aPlugin); nsresult GetPlugin(const char *aMimeType, nsNPAPIPlugin** aPlugin); nsresult NewPluginStreamListener(nsIURI* aURL, nsNPAPIPluginInstance* aInstance, nsIStreamListener **aStreamListener);
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -161,17 +161,17 @@ nsPluginInstanceOwner::GetImageContainer return nullptr; nsRefPtr<ImageContainer> container; #if MOZ_WIDGET_ANDROID // Right now we only draw with Gecko layers on Honeycomb and higher. See Paint() // for what we do on other versions. if (AndroidBridge::Bridge()->GetAPIVersion() < 11) - return NULL; + return nullptr; container = LayerManager::CreateImageContainer(); ImageFormat format = ImageFormat::SHARED_TEXTURE; nsRefPtr<Image> img = container->CreateImage(&format, 1); SharedTextureImage::Data data; data.mHandle = mInstance->CreateSharedHandle(); @@ -1349,18 +1349,18 @@ nsresult nsPluginInstanceOwner::Contents NPEventModel nsPluginInstanceOwner::GetEventModel() { return mEventModel; } #define DEFAULT_REFRESH_RATE 20 // 50 FPS -nsCOMPtr<nsITimer> *nsPluginInstanceOwner::sCATimer = NULL; -nsTArray<nsPluginInstanceOwner*> *nsPluginInstanceOwner::sCARefreshListeners = NULL; +nsCOMPtr<nsITimer> *nsPluginInstanceOwner::sCATimer = nullptr; +nsTArray<nsPluginInstanceOwner*> *nsPluginInstanceOwner::sCARefreshListeners = nullptr; void nsPluginInstanceOwner::CARefresh(nsITimer *aTimer, void *aClosure) { if (!sCARefreshListeners) { return; } for (size_t i = 0; i < sCARefreshListeners->Length(); i++) { nsPluginInstanceOwner* instanceOwner = (*sCARefreshListeners)[i]; NPWindow *window; @@ -1407,36 +1407,36 @@ void nsPluginInstanceOwner::AddToCARefre sCATimer = new nsCOMPtr<nsITimer>(); if (!sCATimer) { return; } } if (sCARefreshListeners->Length() == 1) { *sCATimer = do_CreateInstance("@mozilla.org/timer;1"); - (*sCATimer)->InitWithFuncCallback(CARefresh, NULL, + (*sCATimer)->InitWithFuncCallback(CARefresh, nullptr, DEFAULT_REFRESH_RATE, nsITimer::TYPE_REPEATING_SLACK); } } void nsPluginInstanceOwner::RemoveFromCARefreshTimer() { if (!sCARefreshListeners || sCARefreshListeners->Contains(this) == false) { return; } sCARefreshListeners->RemoveElement(this); if (sCARefreshListeners->Length() == 0) { if (sCATimer) { (*sCATimer)->Cancel(); delete sCATimer; - sCATimer = NULL; + sCATimer = nullptr; } delete sCARefreshListeners; - sCARefreshListeners = NULL; + sCARefreshListeners = nullptr; } } void nsPluginInstanceOwner::RenderCoreAnimation(CGContextRef aCGContext, int aWidth, int aHeight) { if (aWidth == 0 || aHeight == 0) return; @@ -1472,39 +1472,39 @@ void nsPluginInstanceOwner::RenderCoreAn } } if (!mColorProfile) { mColorProfile = CreateSystemColorSpace(); } if (mCARenderer->isInit() == false) { - void *caLayer = NULL; + void *caLayer = nullptr; nsresult rv = mInstance->GetValueFromPlugin(NPPVpluginCoreAnimationLayer, &caLayer); if (NS_FAILED(rv) || !caLayer) { return; } // We don't run Flash in-process so we can unconditionally disallow // the offliner renderer. mCARenderer->SetupRenderer(caLayer, aWidth, aHeight, scaleFactor, DISALLOW_OFFLINE_RENDERER); // Setting up the CALayer requires resetting the painting otherwise we // get garbage for the first few frames. FixUpPluginWindow(ePluginPaintDisable); FixUpPluginWindow(ePluginPaintEnable); } - CGImageRef caImage = NULL; + CGImageRef caImage = nullptr; nsresult rt = mCARenderer->Render(aWidth, aHeight, scaleFactor, &caImage); if (rt == NS_OK && mIOSurface && mColorProfile) { nsCARenderer::DrawSurfaceToCGContext(aCGContext, mIOSurface, mColorProfile, 0, 0, aWidth, aHeight); - } else if (rt == NS_OK && caImage != NULL) { + } else if (rt == NS_OK && caImage != nullptr) { // Significant speed up by resetting the scaling ::CGContextSetInterpolationQuality(aCGContext, kCGInterpolationNone ); ::CGContextTranslateCTM(aCGContext, 0, (double) aHeight * scaleFactor); ::CGContextScaleCTM(aCGContext, scaleFactor, -scaleFactor); ::CGContextDrawImage(aCGContext, CGRectMake(0,0,aWidth,aHeight), caImage); } else { NS_NOTREACHED("nsCARenderer::Render failure"); @@ -2984,17 +2984,17 @@ nsresult nsPluginInstanceOwner::Init(nsI return NS_OK; } void* nsPluginInstanceOwner::GetPluginPortFromWidget() { //!!! Port must be released for windowless plugins on Windows, because it is HDC !!! - void* result = NULL; + void* result = nullptr; if (mWidget) { #ifdef XP_WIN if (mPluginWindow && (mPluginWindow->type == NPWindowTypeDrawable)) result = mWidget->GetNativeData(NS_NATIVE_GRAPHIC); else #endif #ifdef XP_MACOSX if (GetDrawingModel() == NPDrawingModelCoreGraphics || @@ -3076,17 +3076,17 @@ NS_IMETHODIMP nsPluginInstanceOwner::Cre if (GetDrawingModel() == NPDrawingModelCoreAnimation) { AddToCARefreshTimer(); } #endif } if (mObjectFrame) { - // NULL widget is fine, will result in windowless setup. + // nullptr widget is fine, will result in windowless setup. mObjectFrame->PrepForDrawing(mWidget); } if (windowless) { mPluginWindow->type = NPWindowTypeDrawable; // this needs to be a HDC according to the spec, but I do // not see the right way to release it so let's postpone
--- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -160,17 +160,17 @@ public: if (currentLevel < mLastEventloopNestingLevel) { mLastEventloopNestingLevel = currentLevel; } } const char* GetPluginName() { if (mInstance && mPluginHost) { - const char* name = NULL; + const char* name = nullptr; if (NS_SUCCEEDED(mPluginHost->GetPluginName(mInstance, &name)) && name) return name; } return ""; } #ifdef MOZ_X11 void GetPluginDescription(nsACString& aDescription)
--- a/dom/plugins/base/nsPluginModule.cpp +++ b/dom/plugins/base/nsPluginModule.cpp @@ -6,23 +6,23 @@ #include "mozilla/ModuleUtils.h" #include "nsPluginHost.h" #include "nsPluginsCID.h" NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPluginHost, nsPluginHost::GetInst) NS_DEFINE_NAMED_CID(NS_PLUGIN_HOST_CID); static const mozilla::Module::CIDEntry kPluginCIDs[] = { - { &kNS_PLUGIN_HOST_CID, false, NULL, nsPluginHostConstructor }, - { NULL } + { &kNS_PLUGIN_HOST_CID, false, nullptr, nsPluginHostConstructor }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kPluginContracts[] = { { MOZ_PLUGIN_HOST_CONTRACTID, &kNS_PLUGIN_HOST_CID }, - { NULL } + { nullptr } }; static const mozilla::Module kPluginModule = { mozilla::Module::kVersion, kPluginCIDs, kPluginContracts };
--- a/dom/plugins/base/nsPluginNativeWindowGtk2.cpp +++ b/dom/plugins/base/nsPluginNativeWindowGtk2.cpp @@ -170,39 +170,39 @@ nsresult nsPluginNativeWindowGtk2::Creat // see plugin_window_filter_func() for details g_object_set_data(G_OBJECT(mSocketWidget), "enable-xt-focus", (void *)aEnableXtFocus); // Make sure to handle the plug_removed signal. If we don't the // socket will automatically be destroyed when the plug is // removed, which means we're destroying it more than once. // SYNTAX ERROR. g_signal_connect(mSocketWidget, "plug_removed", - G_CALLBACK(plug_removed_cb), NULL); + G_CALLBACK(plug_removed_cb), nullptr); g_signal_connect(mSocketWidget, "unrealize", - G_CALLBACK(socket_unrealize_cb), NULL); + G_CALLBACK(socket_unrealize_cb), nullptr); g_signal_connect(mSocketWidget, "destroy", G_CALLBACK(gtk_widget_destroyed), &mSocketWidget); - gpointer user_data = NULL; + gpointer user_data = nullptr; gdk_window_get_user_data(parent_win, &user_data); GtkContainer *container = GTK_CONTAINER(user_data); gtk_container_add(container, mSocketWidget); gtk_widget_realize(mSocketWidget); // The GtkSocket has a visible window, but the plugin's XEmbed plug will // cover this window. Normally GtkSockets let the X server paint their // background and this would happen immediately (before the plug is // created). Setting the background to None prevents the server from // painting this window, avoiding flicker. // TODO GTK3 #if (MOZ_WIDGET_GTK == 2) - gdk_window_set_back_pixmap(gtk_widget_get_window(mSocketWidget), NULL, FALSE); + gdk_window_set_back_pixmap(gtk_widget_get_window(mSocketWidget), nullptr, FALSE); #endif // Resize before we show SetAllocation(); gtk_widget_show(mSocketWidget); gdk_flush(); @@ -257,21 +257,21 @@ nsresult nsPluginNativeWindowGtk2::Creat return NS_ERROR_FAILURE; g_signal_connect(mSocketWidget, "destroy", G_CALLBACK(gtk_widget_destroyed), &mSocketWidget); gtk_widget_set_size_request(mSocketWidget, width, height); #ifdef DEBUG - printf("About to show xtbin(%p)...\n", (void*)mSocketWidget); fflush(NULL); + printf("About to show xtbin(%p)...\n", (void*)mSocketWidget); fflush(nullptr); #endif gtk_widget_show(mSocketWidget); #ifdef DEBUG - printf("completed gtk_widget_show(%p)\n", (void*)mSocketWidget); fflush(NULL); + printf("completed gtk_widget_show(%p)\n", (void*)mSocketWidget); fflush(nullptr); #endif // Fill out the ws_info structure. GtkXtBin* xtbin = GTK_XTBIN(mSocketWidget); // The xtbin has its own Display structure. mWsInfo.display = xtbin->xtdisplay; mWsInfo.colormap = xtbin->xtclient.xtcolormap; mWsInfo.visual = xtbin->xtclient.xtvisual;
--- a/dom/plugins/base/nsPluginNativeWindowOS2.cpp +++ b/dom/plugins/base/nsPluginNativeWindowOS2.cpp @@ -54,17 +54,17 @@ class PluginWindowEvent : public nsRunna public: PluginWindowEvent(); void Init(const PluginWindowWeakRef &ref, HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); void Clear(); HWND GetWnd() { return mWnd; }; ULONG GetMsg() { return mMsg; }; MPARAM GetWParam() { return mWParam; }; MPARAM GetLParam() { return mLParam; }; - bool InUse() { return (mWnd!=NULL); }; + bool InUse() { return mWnd != nullptr; }; NS_DECL_NSIRUNNABLE protected: PluginWindowWeakRef mPluginWindowRef; HWND mWnd; ULONG mMsg; MPARAM mWParam; @@ -73,27 +73,27 @@ protected: PluginWindowEvent::PluginWindowEvent() { Clear(); } void PluginWindowEvent::Clear() { - mWnd = NULL; + mWnd = nullptr; mMsg = 0; mWParam = 0; mLParam = 0; } void PluginWindowEvent::Init(const PluginWindowWeakRef &ref, HWND aWnd, ULONG aMsg, MPARAM mp1, MPARAM mp2) { - NS_ASSERTION(aWnd != NULL, "invalid plugin event value"); - NS_ASSERTION(mWnd == NULL, "event already in use"); + NS_ASSERTION(aWnd != nullptr, "invalid plugin event value"); + NS_ASSERTION(mWnd == nullptr, "event already in use"); mPluginWindowRef = ref; mWnd = aWnd; mMsg = aMsg; mWParam = mp1; mLParam = mp2; } /*****************************************************************************/ @@ -346,17 +346,17 @@ nsPluginNativeWindowOS2::nsPluginNativeW { // initialize the struct fields window = nullptr; x = 0; y = 0; width = 0; height = 0; - mPluginWinProc = NULL; + mPluginWinProc = nullptr; mPluginType = nsPluginType_Unknown; // once the atom has been added, it won't be deleted if (!sWM_FLASHBOUNCEMSG) { sWM_FLASHBOUNCEMSG = ::WinFindAtom(WinQuerySystemAtomTable(), NS_PLUGIN_CUSTOM_MSG_ID); if (!sWM_FLASHBOUNCEMSG) sWM_FLASHBOUNCEMSG = ::WinAddAtom(WinQuerySystemAtomTable(),
--- a/dom/plugins/base/nsPluginNativeWindowWin.cpp +++ b/dom/plugins/base/nsPluginNativeWindowWin.cpp @@ -51,17 +51,17 @@ public: PluginWindowEvent(); void Init(const PluginWindowWeakRef &ref, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); void Clear(); HWND GetWnd() { return mWnd; }; UINT GetMsg() { return mMsg; }; WPARAM GetWParam() { return mWParam; }; LPARAM GetLParam() { return mLParam; }; - bool InUse() { return (mWnd!=NULL); }; + bool InUse() { return mWnd != nullptr; }; NS_DECL_NSIRUNNABLE protected: PluginWindowWeakRef mPluginWindowRef; HWND mWnd; UINT mMsg; WPARAM mWParam; @@ -70,27 +70,27 @@ protected: PluginWindowEvent::PluginWindowEvent() { Clear(); } void PluginWindowEvent::Clear() { - mWnd = NULL; + mWnd = nullptr; mMsg = 0; mWParam = 0; mLParam = 0; } void PluginWindowEvent::Init(const PluginWindowWeakRef &ref, HWND aWnd, UINT aMsg, WPARAM aWParam, LPARAM aLParam) { - NS_ASSERTION(aWnd != NULL, "invalid plugin event value"); - NS_ASSERTION(mWnd == NULL, "event already in use"); + NS_ASSERTION(aWnd != nullptr, "invalid plugin event value"); + NS_ASSERTION(mWnd == nullptr, "event already in use"); mPluginWindowRef = ref; mWnd = aWnd; mMsg = aMsg; mWParam = aWParam; mLParam = aLParam; } /** @@ -370,29 +370,29 @@ static WindowsDllInterceptor sUser32Inte typedef LONG_PTR (WINAPI *User32SetWindowLongPtrA)(HWND hWnd, int nIndex, LONG_PTR dwNewLong); typedef LONG_PTR (WINAPI *User32SetWindowLongPtrW)(HWND hWnd, int nIndex, LONG_PTR dwNewLong); -static User32SetWindowLongPtrA sUser32SetWindowLongAHookStub = NULL; -static User32SetWindowLongPtrW sUser32SetWindowLongWHookStub = NULL; +static User32SetWindowLongPtrA sUser32SetWindowLongAHookStub = nullptr; +static User32SetWindowLongPtrW sUser32SetWindowLongWHookStub = nullptr; #else typedef LONG (WINAPI *User32SetWindowLongA)(HWND hWnd, int nIndex, LONG dwNewLong); typedef LONG (WINAPI *User32SetWindowLongW)(HWND hWnd, int nIndex, LONG dwNewLong); -static User32SetWindowLongA sUser32SetWindowLongAHookStub = NULL; -static User32SetWindowLongW sUser32SetWindowLongWHookStub = NULL; +static User32SetWindowLongA sUser32SetWindowLongAHookStub = nullptr; +static User32SetWindowLongW sUser32SetWindowLongWHookStub = nullptr; #endif static inline bool SetWindowLongHookCheck(HWND hWnd, int nIndex, LONG_PTR newLong) { nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); @@ -493,21 +493,21 @@ nsPluginNativeWindowWin::nsPluginNativeW { // initialize the struct fields window = nullptr; x = 0; y = 0; width = 0; height = 0; - mPrevWinProc = NULL; - mPluginWinProc = NULL; + mPrevWinProc = nullptr; + mPluginWinProc = nullptr; mPluginType = nsPluginType_Unknown; - mParentWnd = NULL; + mParentWnd = nullptr; mParentProc = 0; if (!sWM_FLASHBOUNCEMSG) { sWM_FLASHBOUNCEMSG = ::RegisterWindowMessage(NS_PLUGIN_CUSTOM_MSG_ID); } } nsPluginNativeWindowWin::~nsPluginNativeWindowWin() @@ -715,26 +715,26 @@ nsresult nsPluginNativeWindowWin::UndoSu ::RemoveProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); // restore the original win proc // but only do this if this were us last time if (mPluginWinProc) { WNDPROC currentWndProc = (WNDPROC)::GetWindowLongPtr(hWnd, GWLP_WNDPROC); if (currentWndProc == PluginWndProc) SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)mPluginWinProc); - mPluginWinProc = NULL; + mPluginWinProc = nullptr; LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE); style &= ~WS_CLIPCHILDREN; SetWindowLongPtr(hWnd, GWL_STYLE, style); } if (mPluginType == nsPluginType_PDF && mParentWnd) { ::SetWindowLongPtr(mParentWnd, GWLP_WNDPROC, mParentProc); - mParentWnd = NULL; + mParentWnd = nullptr; mParentProc = 0; } return NS_OK; } nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow) {
--- a/dom/plugins/base/nsPluginsDirDarwin.cpp +++ b/dom/plugins/base/nsPluginsDirDarwin.cpp @@ -39,22 +39,25 @@ typedef NS_NPAPIPLUGIN_CALLBACK(OSErr, B /* ** Returns a CFBundleRef if the path refers to a Mac OS X bundle directory. ** The caller is responsible for calling CFRelease() to deallocate. */ static CFBundleRef getPluginBundle(const char* path) { - CFBundleRef bundle = NULL; - CFStringRef pathRef = ::CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8); + CFBundleRef bundle = nullptr; + CFStringRef pathRef = ::CFStringCreateWithCString(nullptr, path, + kCFStringEncodingUTF8); if (pathRef) { - CFURLRef bundleURL = ::CFURLCreateWithFileSystemPath(NULL, pathRef, kCFURLPOSIXPathStyle, true); + CFURLRef bundleURL = ::CFURLCreateWithFileSystemPath(nullptr, pathRef, + kCFURLPOSIXPathStyle, + true); if (bundleURL) { - bundle = ::CFBundleCreate(NULL, bundleURL); + bundle = ::CFBundleCreate(nullptr, bundleURL); ::CFRelease(bundleURL); } ::CFRelease(pathRef); } return bundle; } static nsresult toCFURLRef(nsIFile* file, CFURLRef& outURL) @@ -139,67 +142,67 @@ static Boolean MimeTypeEnabled(CFDiction } return true; } static CFDictionaryRef ParsePlistForMIMETypesFilename(CFBundleRef bundle) { CFTypeRef mimeFileName = ::CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("WebPluginMIMETypesFilename")); if (!mimeFileName || ::CFGetTypeID(mimeFileName) != ::CFStringGetTypeID()) { - return NULL; + return nullptr; } FSRef homeDir; if (::FSFindFolder(kUserDomain, kCurrentUserFolderType, kDontCreateFolder, &homeDir) != noErr) { - return NULL; + return nullptr; } CFURLRef userDirURL = ::CFURLCreateFromFSRef(kCFAllocatorDefault, &homeDir); if (!userDirURL) { - return NULL; + return nullptr; } AutoCFTypeObject userDirURLAutorelease(userDirURL); - CFStringRef mimeFilePath = ::CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("Library/Preferences/%@"), static_cast<CFStringRef>(mimeFileName)); + CFStringRef mimeFilePath = ::CFStringCreateWithFormat(kCFAllocatorDefault, nullptr, CFSTR("Library/Preferences/%@"), static_cast<CFStringRef>(mimeFileName)); if (!mimeFilePath) { - return NULL; + return nullptr; } AutoCFTypeObject mimeFilePathAutorelease(mimeFilePath); CFURLRef mimeFileURL = ::CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorDefault, mimeFilePath, kCFURLPOSIXPathStyle, false, userDirURL); if (!mimeFileURL) { - return NULL; + return nullptr; } AutoCFTypeObject mimeFileURLAutorelease(mimeFileURL); SInt32 errorCode = 0; - CFDataRef mimeFileData = NULL; - Boolean result = ::CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, mimeFileURL, &mimeFileData, NULL, NULL, &errorCode); + CFDataRef mimeFileData = nullptr; + Boolean result = ::CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, mimeFileURL, &mimeFileData, nullptr, nullptr, &errorCode); if (!result) { - return NULL; + return nullptr; } AutoCFTypeObject mimeFileDataAutorelease(mimeFileData); if (errorCode != 0) { - return NULL; + return nullptr; } - CFPropertyListRef propertyList = ::CFPropertyListCreateFromXMLData(kCFAllocatorDefault, mimeFileData, kCFPropertyListImmutable, NULL); + CFPropertyListRef propertyList = ::CFPropertyListCreateFromXMLData(kCFAllocatorDefault, mimeFileData, kCFPropertyListImmutable, nullptr); if (!propertyList) { - return NULL; + return nullptr; } AutoCFTypeObject propertyListAutorelease(propertyList); if (::CFGetTypeID(propertyList) != ::CFDictionaryGetTypeID()) { - return NULL; + return nullptr; } CFTypeRef mimeTypes = ::CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList), CFSTR("WebPluginMIMETypes")); if (!mimeTypes || ::CFGetTypeID(mimeTypes) != ::CFDictionaryGetTypeID() || ::CFDictionaryGetCount(static_cast<CFDictionaryRef>(mimeTypes)) == 0) { - return NULL; + return nullptr; } return static_cast<CFDictionaryRef>(::CFRetain(mimeTypes)); } static void ParsePlistPluginInfo(nsPluginInfo& info, CFBundleRef bundle) { CFDictionaryRef mimeDict = ParsePlistForMIMETypesFilename(bundle); @@ -296,21 +299,24 @@ nsresult nsPluginFile::LoadPlugin(PRLibr // NSPR's dyld loading mechanisms here (NSAddImage() or dlopen()) can cause // a bundle's initialization code to run earlier than expected, and lead to // crashes. See bug 577967. #ifdef __LP64__ char executablePath[PATH_MAX]; executablePath[0] = '\0'; nsAutoCString bundlePath; mPlugin->GetNativePath(bundlePath); - CFStringRef pathRef = ::CFStringCreateWithCString(NULL, bundlePath.get(), kCFStringEncodingUTF8); + CFStringRef pathRef = ::CFStringCreateWithCString(nullptr, bundlePath.get(), + kCFStringEncodingUTF8); if (pathRef) { - CFURLRef bundleURL = ::CFURLCreateWithFileSystemPath(NULL, pathRef, kCFURLPOSIXPathStyle, true); + CFURLRef bundleURL = ::CFURLCreateWithFileSystemPath(nullptr, pathRef, + kCFURLPOSIXPathStyle, + true); if (bundleURL) { - CFBundleRef bundle = ::CFBundleCreate(NULL, bundleURL); + CFBundleRef bundle = ::CFBundleCreate(nullptr, bundleURL); if (bundle) { CFURLRef executableURL = ::CFBundleCopyExecutableURL(bundle); if (executableURL) { if (!::CFURLGetFileSystemRepresentation(executableURL, true, (UInt8*)&executablePath, PATH_MAX)) executablePath[0] = '\0'; ::CFRelease(executableURL); } ::CFRelease(bundle); @@ -351,17 +357,17 @@ static char* GetNextPluginStringFromHand { char *ret = p2cstrdup((unsigned char*)(*h + *index)); *index += (ret ? strlen(ret) : 0) + 1; return ret; } static bool IsCompatibleArch(nsIFile *file) { - CFURLRef pluginURL = NULL; + CFURLRef pluginURL = nullptr; if (NS_FAILED(toCFURLRef(file, pluginURL))) return false; bool isPluginFile = false; CFBundleRef pluginBundle = ::CFBundleCreate(kCFAllocatorDefault, pluginURL); if (pluginBundle) { UInt32 packageType, packageCreator; @@ -478,17 +484,17 @@ nsresult nsPluginFile::GetPluginInfo(nsP NP_GETMIMEDESCRIPTION pfnGetMimeDesc = (NP_GETMIMEDESCRIPTION)PR_FindFunctionSymbol(pLibrary, NP_GETMIMEDESCRIPTION_NAME); if (pfnGetMimeDesc) ParsePluginMimeDescription(pfnGetMimeDesc(), info); if (info.fVariantCount) return NS_OK; } // We'll fill this in using BP_GetSupportedMIMETypes and/or resource fork data - BPSupportedMIMETypes mi = {kBPSupportedMIMETypesStructVers_1, NULL, NULL}; + BPSupportedMIMETypes mi = {kBPSupportedMIMETypesStructVers_1, nullptr, nullptr}; // Try to get data from BP_GetSupportedMIMETypes if (pLibrary) { BP_GETSUPPORTEDMIMETYPES pfnMime = (BP_GETSUPPORTEDMIMETYPES)PR_FindFunctionSymbol(pLibrary, "BP_GetSupportedMIMETypes"); if (pfnMime && noErr == pfnMime(&mi, 0) && mi.typeStrings) { info.fVariantCount = (**(short**)mi.typeStrings) / 2; ::HLock(mi.typeStrings); if (mi.infoStrings) // it's possible some plugins have infoStrings missing
--- a/dom/plugins/base/nsPluginsDirOS2.cpp +++ b/dom/plugins/base/nsPluginsDirOS2.cpp @@ -58,17 +58,17 @@ static char *LoadRCDATAVersion(HMODULE h ULONG ulSize = 0; char *string = 0; rc = DosQueryResourceSize(hMod, RT_RCDATA, resid, &ulSize); // version info is should be 8 chars if (rc == NO_ERROR && ulSize == 8) { - char *version = NULL; + char *version = nullptr; rc = DosGetResource(hMod, RT_RCDATA, resid, (void**) &version); if (rc == NO_ERROR) { string = PR_smprintf("%d.%d.%d.%d\n", version[0], version[2], version[4], version[6]); DosFreeResource(version);
--- a/dom/plugins/base/nsPluginsDirUnix.cpp +++ b/dom/plugins/base/nsPluginsDirUnix.cpp @@ -88,17 +88,17 @@ static bool LoadExtraSharedLib(const cha tempSpec.value.pathname = name; handle = PR_LoadLibraryWithFlags(tempSpec, PR_LD_NOW|PR_LD_GLOBAL); if (!handle) { ret = false; DisplayPR_LoadLibraryErrorMessage(name); if (tryToGetSoname) { SearchForSoname(name, soname); if (*soname) { - ret = LoadExtraSharedLib((const char *) *soname, NULL, false); + ret = LoadExtraSharedLib((const char *) *soname, nullptr, false); } } } return ret; } #define PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS 32 #define PREF_PLUGINS_SONAME "plugin.soname.list" @@ -115,17 +115,17 @@ static bool LoadExtraSharedLib(const cha */ static void LoadExtraSharedLibs() { // check out if user's prefs.js has libs name nsresult res; nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &res)); if (NS_SUCCEEDED(res) && (prefs != nullptr)) { - char *sonameList = NULL; + char *sonameList = nullptr; bool prefSonameListIsSet = true; res = prefs->GetCharPref(PREF_PLUGINS_SONAME, &sonameList); if (!sonameList) { // pref is not set, lets use hardcoded list prefSonameListIsSet = false; sonameList = PL_strdup(DEFAULT_EXTRA_LIBS_LIST); } if (sonameList) { @@ -166,17 +166,17 @@ static void LoadExtraSharedLibs() //assuming it's real name, try to stat it struct stat st; if (stat((const char*) arrayOfLibs[i], &st)) { //get just a file name arrayOfLibs[i] = PL_strrchr(arrayOfLibs[i], '/') + 1; } else tryToGetSoname = false; } - char *soname = NULL; + char *soname = nullptr; if (LoadExtraSharedLib(arrayOfLibs[i], &soname, tryToGetSoname)) { //construct soname's list to save in prefs p = soname ? soname : arrayOfLibs[i]; int n = PLUGIN_MAX_LEN_OF_TMP_ARR - (strlen(sonameListToSave) + strlen(p)); if (n > 0) { PL_strcat(sonameListToSave, p); PL_strcat(sonameListToSave,":"); @@ -215,17 +215,17 @@ bool nsPluginsDir::IsPluginFile(nsIFile* return false; #ifdef ANDROID // It appears that if you load // 'libstagefright_honeycomb.so' on froyo, or // 'libstagefright_froyo.so' on honeycomb, we will abort. // Since these are just helper libs, we can ignore. const char *cFile = filename.get(); - if (strstr(cFile, "libstagefright") != NULL) + if (strstr(cFile, "libstagefright") != nullptr) return false; #endif NS_NAMED_LITERAL_CSTRING(dllSuffix, LOCAL_PLUGIN_DLL_SUFFIX); if (filename.Length() > dllSuffix.Length() && StringEndsWith(filename, dllSuffix)) return true; @@ -359,27 +359,27 @@ nsresult nsPluginFile::GetPluginInfo(nsP return rv; info.fFileName = PL_strdup(fileName.get()); NP_GetValueFunc npGetValue = (NP_GetValueFunc)PR_FindFunctionSymbol(pLibrary, "NP_GetValue"); if (!npGetValue) { return NS_ERROR_FAILURE; } - const char *name = NULL; - npGetValue(NULL, NPPVpluginNameString, &name); + const char *name = nullptr; + npGetValue(nullptr, NPPVpluginNameString, &name); if (name) { info.fName = PL_strdup(name); } else { info.fName = PL_strdup(fileName.get()); } - const char *description = NULL; - npGetValue(NULL, NPPVpluginDescriptionString, &description); + const char *description = nullptr; + npGetValue(nullptr, NPPVpluginDescriptionString, &description); if (description) { info.fDescription = PL_strdup(description); } else { info.fDescription = PL_strdup(""); } return NS_OK;
--- a/dom/plugins/base/nsPluginsDirWin.cpp +++ b/dom/plugins/base/nsPluginsDirWin.cpp @@ -67,17 +67,17 @@ using namespace mozilla; /* Local helper functions */ static char* GetKeyValue(void* verbuf, const WCHAR* key, UINT language, UINT codepage) { WCHAR keybuf[64]; // plenty for the template below, with the longest key // we use (currently "FileDescription") const WCHAR keyFormat[] = L"\\StringFileInfo\\%04X%04X\\%s"; - WCHAR *buf = NULL; + WCHAR *buf = nullptr; UINT blen; if (_snwprintf_s(keybuf, ArrayLength(keybuf), _TRUNCATE, keyFormat, language, codepage, key) < 0) { NS_NOTREACHED("plugin info key too long for buffer!"); return nullptr; } @@ -130,21 +130,21 @@ static char** MakeStringArray(uint32_t v { // The number of variants has been calculated based on the mime // type array. Plugins are not explicitely required to match // this number in two other arrays: file extention array and mime // description array, and some of them actually don't. // We should handle such situations gracefully if ((variants <= 0) || !data) - return NULL; + return nullptr; char ** array = (char **)PR_Calloc(variants, sizeof(char *)); if (!array) - return NULL; + return nullptr; char * start = data; for (uint32_t i = 0; i < variants; i++) { char * p = PL_strchr(start, '|'); if (p) *p = 0; @@ -167,36 +167,36 @@ static char** MakeStringArray(uint32_t v static void FreeStringArray(uint32_t variants, char ** array) { if ((variants == 0) || !array) return; for (uint32_t i = 0; i < variants; i++) { if (array[i]) { PL_strfree(array[i]); - array[i] = NULL; + array[i] = nullptr; } } PR_Free(array); } static bool CanLoadPlugin(const PRUnichar* aBinaryPath) { #if defined(_M_IX86) || defined(_M_X64) || defined(_M_IA64) bool canLoad = false; HANDLE file = CreateFileW(aBinaryPath, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (file != INVALID_HANDLE_VALUE) { - HANDLE map = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, - GetFileSize(file, NULL), NULL); - if (map != NULL) { + HANDLE map = CreateFileMappingW(file, nullptr, PAGE_READONLY, 0, + GetFileSize(file, nullptr), nullptr); + if (map != nullptr) { LPVOID mapView = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0); - if (mapView != NULL) { + if (mapView != nullptr) { if (((IMAGE_DOS_HEADER*)mapView)->e_magic == IMAGE_DOS_SIGNATURE) { long peImageHeaderStart = (((IMAGE_DOS_HEADER*)mapView)->e_lfanew); if (peImageHeaderStart != 0L) { DWORD arch = (((IMAGE_NT_HEADERS*)((LPBYTE)mapView + peImageHeaderStart))->FileHeader.Machine); #ifdef _M_IX86 canLoad = (arch == IMAGE_FILE_MACHINE_I386); #elif defined(_M_X64) canLoad = (arch == IMAGE_FILE_MACHINE_AMD64); @@ -295,22 +295,22 @@ nsresult nsPluginFile::LoadPlugin(PRLibr NS_ASSERTION(dwCheck <= MAX_PATH + 1, "Error in Loading plugin"); if (dwCheck <= MAX_PATH + 1) { restoreOrigDir = SetCurrentDirectoryW(pluginFolderPath.get()); NS_ASSERTION(restoreOrigDir, "Error in Loading plugin"); } if (protectCurrentDirectory) { - SetDllDirectory(NULL); + SetDllDirectory(nullptr); } nsresult rv = mPlugin->Load(outLibrary); if (NS_FAILED(rv)) - *outLibrary = NULL; + *outLibrary = nullptr; if (protectCurrentDirectory) { SetDllDirectory(L""); } if (restoreOrigDir) { DebugOnly<BOOL> bCheck = SetCurrentDirectoryW(aOrigDir); NS_ASSERTION(bCheck, "Error in Loading plugin");