Bug 784739 - Switch from NULL to nullptr in dom/plugins/base/; r=ehsan

--HG--
extra : rebase_source : 827cf2bb75601a723a64593fca5c0cf6632c959c
This commit is contained in:
Birunthan Mohanathas 2013-10-23 16:34:30 -04:00
parent 3560f05e45
commit 51af5283ca
23 changed files with 168 additions and 158 deletions

View File

@ -136,7 +136,7 @@ AudioRunnable::Run()
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;
@ -205,13 +205,13 @@ anp_audio_newTrack(uint32_t sampleRate, // sampling rate in Hz
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;
@ -262,10 +262,10 @@ anp_audio_newTrack(uint32_t sampleRate, // sampling rate in Hz
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);
@ -273,7 +273,7 @@ anp_audio_newTrack(uint32_t sampleRate, // sampling rate in Hz
if (autoFrame.CheckForException() || state == STATE_UNINITIALIZED) {
jenv->DeleteGlobalRef(s->at_class);
free(s);
return NULL;
return nullptr;
}
s->output_unit = jenv->NewGlobalRef(obj);
@ -283,7 +283,7 @@ anp_audio_newTrack(uint32_t sampleRate, // sampling rate in Hz
void
anp_audio_deleteTrack(ANPAudioTrack* s)
{
if (s == NULL) {
if (s == nullptr) {
return;
}
@ -298,7 +298,7 @@ anp_audio_deleteTrack(ANPAudioTrack* s)
void
anp_audio_start(ANPAudioTrack* s)
{
if (s == NULL || s->output_unit == NULL) {
if (s == nullptr || s->output_unit == nullptr) {
return;
}
@ -333,7 +333,7 @@ anp_audio_start(ANPAudioTrack* s)
void
anp_audio_pause(ANPAudioTrack* s)
{
if (s == NULL || s->output_unit == NULL) {
if (s == nullptr || s->output_unit == nullptr) {
return;
}
@ -348,7 +348,7 @@ anp_audio_pause(ANPAudioTrack* s)
void
anp_audio_stop(ANPAudioTrack* s)
{
if (s == NULL || s->output_unit == NULL) {
if (s == nullptr || s->output_unit == nullptr) {
return;
}

View File

@ -25,7 +25,7 @@ static ANPEGLContext anp_opengl_acquireContext(NPP instance) {
GLContext* context = pinst->GLContext();
if (!context)
return NULL;
return nullptr;
context->MakeCurrent();
return context->GetNativeData(GLContext::NativeGLContext);

View File

@ -58,7 +58,7 @@ static struct ANPSurfaceFunctions {
static inline void* getSurface(JNIEnv* env, jobject view) {
if (!env || !view) {
return NULL;
return nullptr;
}
if (!gSurfaceJavaGlue.initialized) {
@ -93,14 +93,14 @@ static inline void* getSurface(JNIEnv* env, jobject view) {
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);
@ -182,7 +182,7 @@ static bool anp_surface_lock(JNIEnv* env, jobject surfaceView, ANPBitmap* bitmap
return false;
}
void* region = NULL;
void* region = nullptr;
if (dirtyRect) {
region = malloc(ANDROID_REGION_SIZE);
gSurfaceFunctions.regionConstructor(region);
@ -227,7 +227,7 @@ static bool anp_surface_lock(JNIEnv* env, jobject surfaceView, ANPBitmap* bitmap
if (info.w > 0 && info.h > 0) {
bitmap->baseAddr = info.bits;
} else {
bitmap->baseAddr = NULL;
bitmap->baseAddr = nullptr;
return false;
}

View File

@ -19,8 +19,8 @@
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;

View File

@ -154,7 +154,7 @@ typedef struct _NPStream
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,

View File

@ -137,13 +137,13 @@ void NPN_ReleaseVariantValue(NPVariant *variant);
#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) \
@ -216,7 +216,7 @@ typedef void *NPIdentifier;
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.
*/
@ -283,9 +283,9 @@ typedef bool (*NPConstructFunctionPtr)(NPObject *npobj,
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

View File

@ -1076,15 +1076,15 @@ GetNPObjectWrapper(JSContext *cx, JSObject *aObj, bool wrapResult = true)
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 *
@ -1620,13 +1620,13 @@ NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::
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"
@ -1731,7 +1731,7 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
JS::Rooted<JSObject*> obj(cx, ((nsJSObjWrapper *)npobj)->mJSObj);
if (!JS_WrapObject(cx, &obj)) {
return NULL;
return nullptr;
}
return obj;
}
@ -1768,7 +1768,7 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
// 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;
}

View File

@ -167,8 +167,8 @@ static NPNetscapeFuncs sBrowserFuncs = {
_unscheduletimer,
_popupcontextmenu,
_convertpoint,
NULL, // handleevent, unimplemented
NULL, // unfocusinstance, unimplemented
nullptr, // handleevent, unimplemented
nullptr, // unfocusinstance, unimplemented
_urlredirectresponse,
_initasyncsurface,
_finalizeasyncsurface,
@ -497,7 +497,7 @@ 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;
@ -560,13 +560,15 @@ MakeNewNPAPIStreamInternal(NPP npp, const char *relativeURL, const char *target,
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;
}
@ -687,7 +689,7 @@ doGetIdentifier(JSContext *cx, const NPUTF8* name)
utf16name.Length());
if (!str)
return NULL;
return nullptr;
return StringToNPIdentifier(cx, str);
}
@ -698,7 +700,7 @@ 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;
@ -1261,7 +1263,7 @@ _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"));
@ -1286,7 +1288,7 @@ _getstringidentifiers(const NPUTF8** names, int32_t nameCount,
identifiers[i] = doGetIdentifier(cx, names[i]);
} else {
NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS, ("NPN_getstringidentifiers: passed null name"));
identifiers[i] = NULL;
identifiers[i] = nullptr;
}
}
}
@ -1307,7 +1309,7 @@ _utf8fromidentifier(NPIdentifier id)
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;
@ -2501,7 +2503,7 @@ void* NP_CALLBACK /* OJI type: JRIEnv* */
_getJavaEnv()
{
NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetJavaEnv\n"));
return NULL;
return nullptr;
}
const char * NP_CALLBACK
@ -2542,7 +2544,7 @@ 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
@ -2552,7 +2554,7 @@ _pushpopupsenabledstate(NPP npp, NPBool enabled)
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;
@ -2566,7 +2568,7 @@ _poppopupsenabledstate(NPP npp)
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;

View File

@ -46,7 +46,7 @@ public:
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);

View File

@ -193,7 +193,7 @@ nsNPAPIPluginInstance::nsNPAPIPluginInstance()
#endif
, mHaveJavaC2PJSObjectQuirk(false)
{
mNPP.pdata = NULL;
mNPP.pdata = nullptr;
mNPP.ndata = this;
PLUGIN_LOG(PLUGIN_LOG_BASIC, ("nsNPAPIPluginInstance ctor: this=%p\n",this));
@ -536,7 +536,9 @@ nsNPAPIPluginInstance::Start()
// 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,
@ -554,7 +556,7 @@ nsNPAPIPluginInstance::Start()
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;
@ -1439,7 +1441,7 @@ PluginTimerCallback(nsITimer *aTimer, void *aClosure)
// 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
@ -1476,7 +1478,7 @@ nsNPAPIPluginInstance::ScheduleTimer(uint32_t interval, NPBool repeat, void (*ti
// 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;
@ -1599,7 +1601,7 @@ nsNPAPIPluginInstance::GetJSContext(JSContext* *outContext)
nsRefPtr<nsPluginInstanceOwner> deathGrip(mOwner);
*outContext = NULL;
*outContext = nullptr;
nsCOMPtr<nsIDocument> document;
nsresult rv = mOwner->GetDocument(getter_AddRefs(document));

View File

@ -93,11 +93,11 @@ CopyVersion(verBlock *ver1, verBlock *ver2)
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) {
@ -116,10 +116,10 @@ TranslateVersionStr(const WCHAR* szVersion, verBlock *vbVersion)
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;

View File

@ -1267,7 +1267,7 @@ static nsresult CreateNPAPIPlugin(nsPluginTag *aPluginTag,
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;
@ -1297,7 +1297,7 @@ nsresult nsPluginHost::EnsurePluginLoaded(nsPluginTag* aPluginTag)
nsresult nsPluginHost::GetPlugin(const char *aMimeType, nsNPAPIPlugin** aPlugin)
{
nsresult rv = NS_ERROR_FAILURE;
*aPlugin = NULL;
*aPlugin = nullptr;
if (!aMimeType)
return NS_ERROR_ILLEGAL_VALUE;
@ -1510,7 +1510,7 @@ nsPluginHost::ClearSiteData(nsIPluginTag* plugin, const nsACString& domain,
// 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.
@ -2108,8 +2108,8 @@ nsresult nsPluginHost::FindPlugins(bool aCreatePluginList, bool * aPluginsChange
invalidPlugins = invalidPlugin->mNext;
invalidPlugin->mPrev = NULL;
invalidPlugin->mNext = NULL;
invalidPlugin->mPrev = nullptr;
invalidPlugin->mNext = nullptr;
}
else {
invalidPlugins->mSeen = false;
@ -2534,7 +2534,7 @@ nsPluginHost::ReadPluginInfo()
file->GetNativeLeafName(derivedFileName);
filename = derivedFileName.get();
} else {
filename = NULL;
filename = nullptr;
}
// skip the next line, useless in this version

View File

@ -134,13 +134,13 @@ public:
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,
@ -189,7 +189,7 @@ public:
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);

View File

@ -166,7 +166,7 @@ nsPluginInstanceOwner::GetImageContainer()
// 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();
@ -1354,8 +1354,8 @@ NPEventModel nsPluginInstanceOwner::GetEventModel()
#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) {
@ -1412,7 +1412,7 @@ void nsPluginInstanceOwner::AddToCARefreshTimer() {
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);
}
}
@ -1428,10 +1428,10 @@ void nsPluginInstanceOwner::RemoveFromCARefreshTimer() {
if (sCATimer) {
(*sCATimer)->Cancel();
delete sCATimer;
sCATimer = NULL;
sCATimer = nullptr;
}
delete sCARefreshListeners;
sCARefreshListeners = NULL;
sCARefreshListeners = nullptr;
}
}
@ -1477,7 +1477,7 @@ void nsPluginInstanceOwner::RenderCoreAnimation(CGContextRef aCGContext,
}
if (mCARenderer->isInit() == false) {
void *caLayer = NULL;
void *caLayer = nullptr;
nsresult rv = mInstance->GetValueFromPlugin(NPPVpluginCoreAnimationLayer, &caLayer);
if (NS_FAILED(rv) || !caLayer) {
return;
@ -1494,12 +1494,12 @@ void nsPluginInstanceOwner::RenderCoreAnimation(CGContextRef aCGContext,
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);
@ -2989,7 +2989,7 @@ 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))
@ -3081,7 +3081,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
}
if (mObjectFrame) {
// NULL widget is fine, will result in windowless setup.
// nullptr widget is fine, will result in windowless setup.
mObjectFrame->PrepForDrawing(mWidget);
}

View File

@ -165,7 +165,7 @@ public:
const char* GetPluginName()
{
if (mInstance && mPluginHost) {
const char* name = NULL;
const char* name = nullptr;
if (NS_SUCCEEDED(mPluginHost->GetPluginName(mInstance, &name)) && name)
return name;
}

View File

@ -11,13 +11,13 @@ 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 = {

View File

@ -175,15 +175,15 @@ nsresult nsPluginNativeWindowGtk2::CreateXEmbedWindow(bool aEnableXtFocus) {
// 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);
@ -197,7 +197,7 @@ nsresult nsPluginNativeWindowGtk2::CreateXEmbedWindow(bool aEnableXtFocus) {
// 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
@ -262,11 +262,11 @@ nsresult nsPluginNativeWindowGtk2::CreateXtWindow() {
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.

View File

@ -59,7 +59,7 @@ public:
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
@ -78,7 +78,7 @@ PluginWindowEvent::PluginWindowEvent()
void PluginWindowEvent::Clear()
{
mWnd = NULL;
mWnd = nullptr;
mMsg = 0;
mWParam = 0;
mLParam = 0;
@ -87,8 +87,8 @@ void PluginWindowEvent::Clear()
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;
@ -351,7 +351,7 @@ nsPluginNativeWindowOS2::nsPluginNativeWindowOS2() : nsPluginNativeWindow()
width = 0;
height = 0;
mPluginWinProc = NULL;
mPluginWinProc = nullptr;
mPluginType = nsPluginType_Unknown;
// once the atom has been added, it won't be deleted

View File

@ -56,7 +56,7 @@ public:
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
@ -75,7 +75,7 @@ PluginWindowEvent::PluginWindowEvent()
void PluginWindowEvent::Clear()
{
mWnd = NULL;
mWnd = nullptr;
mMsg = 0;
mWParam = 0;
mLParam = 0;
@ -84,8 +84,8 @@ void PluginWindowEvent::Clear()
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;
@ -375,8 +375,8 @@ 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,
@ -386,8 +386,8 @@ 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,
@ -498,11 +498,11 @@ nsPluginNativeWindowWin::nsPluginNativeWindowWin() : nsPluginNativeWindow()
width = 0;
height = 0;
mPrevWinProc = NULL;
mPluginWinProc = NULL;
mPrevWinProc = nullptr;
mPluginWinProc = nullptr;
mPluginType = nsPluginType_Unknown;
mParentWnd = NULL;
mParentWnd = nullptr;
mParentProc = 0;
if (!sWM_FLASHBOUNCEMSG) {
@ -720,7 +720,7 @@ nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow()
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;
@ -729,7 +729,7 @@ nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow()
if (mPluginType == nsPluginType_PDF && mParentWnd) {
::SetWindowLongPtr(mParentWnd, GWLP_WNDPROC, mParentProc);
mParentWnd = NULL;
mParentWnd = nullptr;
mParentProc = 0;
}

View File

@ -44,12 +44,15 @@ typedef NS_NPAPIPLUGIN_CALLBACK(OSErr, BP_GETSUPPORTEDMIMETYPES) (BPSupportedMIM
*/
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);
@ -144,57 +147,57 @@ 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));
@ -301,11 +304,14 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
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) {
@ -356,7 +362,7 @@ static char* GetNextPluginStringFromHandle(Handle h, short *index)
static bool IsCompatibleArch(nsIFile *file)
{
CFURLRef pluginURL = NULL;
CFURLRef pluginURL = nullptr;
if (NS_FAILED(toCFURLRef(file, pluginURL)))
return false;
@ -483,7 +489,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
}
// 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) {

View File

@ -63,7 +63,7 @@ static char *LoadRCDATAVersion(HMODULE hMod, ULONG resid)
// 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)

View File

@ -93,7 +93,7 @@ static bool LoadExtraSharedLib(const char *name, char **soname, bool tryToGetSon
if (tryToGetSoname) {
SearchForSoname(name, soname);
if (*soname) {
ret = LoadExtraSharedLib((const char *) *soname, NULL, false);
ret = LoadExtraSharedLib((const char *) *soname, nullptr, false);
}
}
}
@ -120,7 +120,7 @@ static void LoadExtraSharedLibs()
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) {
@ -171,7 +171,7 @@ static void LoadExtraSharedLibs()
} 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];
@ -220,7 +220,7 @@ bool nsPluginsDir::IsPluginFile(nsIFile* file)
// '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
@ -364,8 +364,8 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
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);
}
@ -373,8 +373,8 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
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);
}

View File

@ -72,7 +72,7 @@ static char* GetKeyValue(void* verbuf, const WCHAR* key,
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,
@ -135,11 +135,11 @@ static char** MakeStringArray(uint32_t variants, char* data)
// 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;
@ -172,7 +172,7 @@ static void FreeStringArray(uint32_t variants, char ** array)
for (uint32_t i = 0; i < variants; i++) {
if (array[i]) {
PL_strfree(array[i]);
array[i] = NULL;
array[i] = nullptr;
}
}
PR_Free(array);
@ -184,14 +184,14 @@ static bool CanLoadPlugin(const PRUnichar* aBinaryPath)
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) {
@ -300,12 +300,12 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
}
if (protectCurrentDirectory) {
SetDllDirectory(NULL);
SetDllDirectory(nullptr);
}
nsresult rv = mPlugin->Load(outLibrary);
if (NS_FAILED(rv))
*outLibrary = NULL;
*outLibrary = nullptr;
if (protectCurrentDirectory) {
SetDllDirectory(L"");