Bug 784739 - Switch from NULL to nullptr in remaining directories; r=ehsan

--HG--
extra : rebase_source : 1ff19b2c8fd0e77fa8e822f5007a9fa3a6b6d474
This commit is contained in:
Birunthan Mohanathas 2014-01-06 10:06:04 -05:00
parent 0601122357
commit c293ca84b8
26 changed files with 56 additions and 55 deletions

View File

@ -724,7 +724,7 @@ class NotifyOffThreadScriptLoadCompletedRunnable : public nsRunnable
public:
NotifyOffThreadScriptLoadCompletedRunnable(nsScriptLoadRequest* aRequest,
nsScriptLoader* aLoader)
: mRequest(aRequest), mLoader(aLoader), mToken(NULL)
: mRequest(aRequest), mLoader(aLoader), mToken(nullptr)
{}
void SetToken(void* aToken) {

View File

@ -36,7 +36,7 @@ MFTDecoder::Create(const GUID& aMFTClsID)
// Create the IMFTransform to do the decoding.
HRESULT hr;
hr = CoCreateInstance(aMFTClsID,
NULL,
nullptr,
CLSCTX_INPROC_SERVER,
IID_IMFTransform,
reinterpret_cast<void**>(static_cast<IMFTransform**>(byRef(mDecoder))));

View File

@ -245,7 +245,7 @@ WMFVideoDecoder::CreateBasicVideoFrame(IMFSample* aSample,
hr = twoDBuffer->Lock2D(&data, &stride);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
} else {
hr = buffer->Lock(&data, NULL, NULL);
hr = buffer->Lock(&data, nullptr, nullptr);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
stride = mVideoStride;
}

View File

@ -426,7 +426,7 @@ DroidSocketImpl::ReadMsg(int aFd, void *aBuffer, size_t aLength)
// Extract client fd from message header
for (struct cmsghdr *cmsgptr = CMSG_FIRSTHDR(&msg);
cmsgptr != NULL; cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) {
cmsgptr != nullptr; cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) {
if (cmsgptr->cmsg_level != SOL_SOCKET) {
continue;
}

View File

@ -189,7 +189,7 @@ struct EffectSolidColor : public Effect
struct EffectChain
{
EffectChain() : mLayerRef(NULL) {}
EffectChain() : mLayerRef(nullptr) {}
explicit EffectChain(void* aLayerRef) : mLayerRef(aLayerRef) {}
RefPtr<Effect> mPrimaryEffect;

View File

@ -6,7 +6,7 @@
#ifndef MOZILLA_GFX_IMAGEHOST_H
#define MOZILLA_GFX_IMAGEHOST_H
#include <stdio.h> // for FILE, NULL
#include <stdio.h> // for FILE
#include "CompositableHost.h" // for CompositableHost
#include "mozilla/Attributes.h" // for MOZ_OVERRIDE
#include "mozilla/RefPtr.h" // for RefPtr
@ -70,9 +70,9 @@ public:
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
#ifdef MOZ_DUMP_PAINTING
virtual void Dump(FILE* aFile=NULL,
const char* aPrefix="",
bool aDumpHtml=false) MOZ_OVERRIDE;
virtual void Dump(FILE* aFile = nullptr,
const char* aPrefix = "",
bool aDumpHtml = false) MOZ_OVERRIDE;
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
#endif

View File

@ -98,7 +98,7 @@ CompositorD3D9::CreateRenderTarget(const gfx::IntRect &aRect,
HRESULT hr = device()->CreateTexture(aRect.width, aRect.height, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, byRef(texture),
NULL);
nullptr);
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("CompositorD3D9::CreateRenderTarget: Failed to create texture"),
hr);
@ -124,7 +124,7 @@ CompositorD3D9::CreateRenderTargetFromSource(const gfx::IntRect &aRect,
HRESULT hr = device()->CreateTexture(aRect.width, aRect.height, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, byRef(texture),
NULL);
nullptr);
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("CompositorD3D9::CreateRenderTargetFromSource: Failed to create texture"),
hr);
@ -409,7 +409,7 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
// Restore defaults
d3d9Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
d3d9Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
d3d9Device->SetTexture(1, NULL);
d3d9Device->SetTexture(1, nullptr);
}
return;
default:
@ -570,7 +570,7 @@ CompositorD3D9::BeginFrame(const nsIntRegion& aInvalidRegion,
EnsureSize();
device()->Clear(0, NULL, D3DCLEAR_TARGET, 0x00000000, 0, 0);
device()->Clear(0, nullptr, D3DCLEAR_TARGET, 0x00000000, 0, 0);
device()->BeginScene();
if (aClipRectOut) {
@ -687,12 +687,12 @@ CompositorD3D9::PaintToTarget()
device()->CreateOffscreenPlainSurface(desc.Width, desc.Height,
D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(destSurf), NULL);
getter_AddRefs(destSurf), nullptr);
device()->GetRenderTargetData(backBuff, destSurf);
D3DLOCKED_RECT rect;
destSurf->LockRect(&rect, NULL, D3DLOCK_READONLY);
destSurf->LockRect(&rect, nullptr, D3DLOCK_READONLY);
RefPtr<DataSourceSurface> sourceSurface =
Factory::CreateWrappingDataSourceSurface((uint8_t*)rect.pBits,
rect.Pitch,

View File

@ -159,7 +159,7 @@ private:
nsIWidget *mWidget;
/*
* Context target, NULL when drawing directly to our swap chain.
* Context target, nullptr when drawing directly to our swap chain.
*/
RefPtr<gfx::DrawTarget> mTarget;

View File

@ -155,7 +155,7 @@ SwapChainD3D9::Present(const nsIntRect &aRect)
void
SwapChainD3D9::Present()
{
mSwapChain->Present(NULL, NULL, 0, 0, 0);
mSwapChain->Present(nullptr, nullptr, 0, 0, 0);
}
void

View File

@ -184,7 +184,7 @@ TextureSourceD3D9::InitTextures(DeviceManagerD3D9* aDeviceManager,
}
tmpTexture->GetSurfaceLevel(0, byRef(aSurface));
aSurface->LockRect(&aLockedRect, NULL, 0);
aSurface->LockRect(&aLockedRect, nullptr, 0);
if (!aLockedRect.pBits) {
NS_WARNING("Could not lock surface");
return nullptr;
@ -208,7 +208,8 @@ FinishTextures(DeviceManagerD3D9* aDeviceManager,
aSurface->UnlockRect();
nsRefPtr<IDirect3DSurface9> dstSurface;
aTexture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
aDeviceManager->device()->UpdateSurface(aSurface, NULL, dstSurface, NULL);
aDeviceManager->device()->UpdateSurface(aSurface, nullptr, dstSurface,
nullptr);
}
TemporaryRef<IDirect3DTexture9>

View File

@ -266,7 +266,7 @@ private:
// pixman needs to distinguish between an empty region and a region
// with one rect so that it can return a different number of rectangles.
// Empty rect: data = empty_box
// 1 rect: data = NULL
// 1 rect: data = null
// >1 rect: data = rects
if (aRect.IsEmpty()) {
pixman_region32_clear(&mImpl);

View File

@ -876,7 +876,7 @@ gfxASurface::WriteAsPNG_internal(FILE* aFile, bool aBinary)
return;
}
// base 64, result will be NULL terminated
// base 64, result will be null-terminated
nsCString encodedImg;
rv = Base64Encode(Substring(imgData, imgSize), encodedImg);
moz_free(imgData);

View File

@ -78,7 +78,7 @@ struct Int32x4 {
static const char *laneNames[] = {"lane 0", "lane 1", "lane 2", "lane3"}; \
CallArgs args = CallArgsFromVp(argc, vp); \
if(!args.thisv().isObject() || !IsTypedDatum(args.thisv().toObject())) { \
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, \
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO, \
X4Type::class_.name, laneNames[lane], \
InformalValueTypeName(args.thisv())); \
return false; \
@ -86,7 +86,7 @@ struct Int32x4 {
TypedDatum &datum = AsTypedDatum(args.thisv().toObject()); \
TypeRepresentation *typeRepr = datum.datumTypeRepresentation(); \
if (typeRepr->kind() != TypeRepresentation::X4 || typeRepr->asX4()->type() != Type32x4::type) { \
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, \
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO, \
X4Type::class_.name, laneNames[lane], \
InformalValueTypeName(args.thisv())); \
return false; \
@ -109,7 +109,7 @@ struct Int32x4 {
bool Type32x4##SignMask(JSContext *cx, unsigned argc, Value *vp) { \
CallArgs args = CallArgsFromVp(argc, vp); \
if(!args.thisv().isObject() || !IsTypedDatum(args.thisv().toObject())) { \
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, \
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO, \
X4Type::class_.name, "signMask", \
InformalValueTypeName(args.thisv())); \
return false; \
@ -117,7 +117,7 @@ struct Int32x4 {
TypedDatum &datum = AsTypedDatum(args.thisv().toObject()); \
TypeRepresentation *typeRepr = datum.datumTypeRepresentation(); \
if (typeRepr->kind() != TypeRepresentation::X4 || typeRepr->asX4()->type() != Type32x4::type) { \
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, \
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO, \
X4Type::class_.name, "signMask", \
InformalValueTypeName(args.thisv())); \
return false; \

View File

@ -781,7 +781,7 @@ SizedArrayTypeRepresentation::appendStringSizedArray(JSContext *cx, StringBuffer
contents.append(".array(");
SizedArrayTypeRepresentation *arrayType = this;
while (arrayType != NULL) {
while (arrayType != nullptr) {
if (!NumberValueToStringBuffer(cx, NumberValue(length()), contents))
return false;

View File

@ -2078,7 +2078,7 @@ class FunctionCompiler
MDefinition *constantFloat(float f)
{
if (!curBlock_)
return NULL;
return nullptr;
MConstant *constant = MConstant::NewAsmJS(alloc(), DoubleValue(double(f)), MIRType_Float32);
curBlock_->add(constant);
@ -3042,7 +3042,7 @@ static bool
CheckGlobalVariableInitFloat32(ModuleCompiler &m, PropertyName *varName, ParseNode *initNode,
bool isConst)
{
ParseNode *arg = NULL;
ParseNode *arg = nullptr;
if (!CheckFloat32Coercion(m, initNode, &arg, "call must be of the form fround(x)"))
return false;
@ -3305,7 +3305,7 @@ CheckVariable(FunctionCompiler &f, ParseNode *var)
return f.failName(var, "var '%s' needs explicit type declaration via an initial value", name);
if (initNode->isKind(PNK_CALL)) {
ParseNode *coercedVar = NULL;
ParseNode *coercedVar = nullptr;
if (!CheckFloat32Coercion(f.m(), initNode, &coercedVar, "caller in var initializer can only be fround"))
return false;
@ -3986,7 +3986,7 @@ static bool CheckCall(FunctionCompiler &f, ParseNode *call, RetType retType, MDe
static bool
CheckFRoundArg(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type *type, const char* error)
{
ParseNode *arg = NULL;
ParseNode *arg = nullptr;
if (!CheckFloat32Coercion(f.m(), expr, &arg, error))
return false;

View File

@ -2430,7 +2430,7 @@ JS_SetPrototype(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<JSObject*>
return false;
if (!succeeded) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_SETPROTOTYPEOF_FAIL);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL);
return false;
}

View File

@ -354,7 +354,7 @@ BaseProxyHandler::setPrototypeOf(JSContext *cx, HandleObject, HandleObject, bool
// Disallow sets of protos on proxies with lazy protos, but no hook.
// This keeps us away from the footgun of having the first proto set opt
// you out of having dynamic protos altogether.
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_SETPROTOTYPEOF_FAIL);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL);
return false;
}

View File

@ -848,7 +848,7 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
/* see BytecodeEmitter::tellDebuggerAboutCompiledScript */
CallNewScriptHook(cx, script, fun);
if (!fun) {
RootedGlobalObject global(cx, script->compileAndGo() ? &script->global() : NULL);
RootedGlobalObject global(cx, script->compileAndGo() ? &script->global() : nullptr);
Debugger::onNewScript(cx, script, global);
}
}

View File

@ -665,7 +665,7 @@ bool
SecurityWrapper<Base>::setPrototypeOf(JSContext *cx, HandleObject wrapper,
HandleObject proto, bool *bp)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_UNWRAP_DENIED);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
return false;
}

View File

@ -153,7 +153,7 @@ ProtoSetterImpl(JSContext *cx, CallArgs args)
return false;
if (!success) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_SETPROTOTYPEOF_FAIL);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL);
return false;
}

View File

@ -1013,12 +1013,12 @@ public:
dnsUUID.Assign(Substring(nsDependentCString(uuid), 1, NSID_LENGTH - 3));
// Create events for A and SRV resolvers
events[0] = CreateEvent(NULL, TRUE, FALSE, TEXT("FinishedA"));
events[0] = CreateEvent(nullptr, TRUE, FALSE, TEXT("FinishedA"));
if (!events[0]) {
goto library_cleanup;
}
events[1] = CreateEvent(NULL, TRUE, FALSE, TEXT("FinishedSRV"));
events[1] = CreateEvent(nullptr, TRUE, FALSE, TEXT("FinishedSRV"));
if (!events[1]) {
goto aevent_cleanup;
}

View File

@ -164,7 +164,7 @@ AndroidBridge::Init(JNIEnv *jEnv)
mJNIEnv = nullptr;
mThread = -1;
mGLControllerObj = NULL;
mGLControllerObj = nullptr;
mOpenedGraphicsLibraries = false;
mHasNativeBitmapAccess = false;
mHasNativeWindowAccess = false;
@ -269,11 +269,11 @@ extern "C" {
__attribute__ ((visibility("default")))
JNIEnv * GetJNIForThread()
{
JNIEnv *jEnv = NULL;
JNIEnv *jEnv = nullptr;
JavaVM *jVm = mozilla::AndroidBridge::GetVM();
if (!jVm) {
__android_log_print(ANDROID_LOG_INFO, "GetJNIForThread", "Returned a null VM");
return NULL;
return nullptr;
}
jEnv = static_cast<JNIEnv*>(PR_GetThreadPrivate(sJavaEnvThreadIndex));
@ -283,10 +283,10 @@ extern "C" {
int status = jVm->GetEnv((void**) &jEnv, JNI_VERSION_1_2);
if (status) {
status = jVm->AttachCurrentThread(&jEnv, NULL);
status = jVm->AttachCurrentThread(&jEnv, nullptr);
if (status) {
__android_log_print(ANDROID_LOG_INFO, "GetJNIForThread", "Could not attach");
return NULL;
return nullptr;
}
PR_SetThreadPrivate(sJavaEnvThreadIndex, jEnv);
@ -304,7 +304,7 @@ void AutoGlobalWrappedJavaObject::Dispose() {
}
GetJNIForThread()->DeleteGlobalRef(wrapped_obj);
wrapped_obj = NULL;
wrapped_obj = nullptr;
}
AutoGlobalWrappedJavaObject::~AutoGlobalWrappedJavaObject() {
@ -694,7 +694,7 @@ AndroidBridge::SetLayerClient(JNIEnv* env, jobject jobj)
void
AndroidBridge::RegisterCompositor(JNIEnv *env)
{
if (mGLControllerObj != NULL && !mGLControllerObj->isNull()) {
if (mGLControllerObj != nullptr && !mGLControllerObj->isNull()) {
// we already have this set up, no need to do it again
return;
}

View File

@ -911,7 +911,7 @@ Java_org_mozilla_gecko_gfx_NativePanZoomController_destroy(JNIEnv* env, jobject
return;
}
NativePanZoomController* oldRef = AndroidBridge::Bridge()->SetNativePanZoomController(NULL);
NativePanZoomController* oldRef = AndroidBridge::Bridge()->SetNativePanZoomController(nullptr);
if (!oldRef || oldRef->isNull()) {
MOZ_ASSERT(false, "Clearing a non-existent NPZC");
} else {

View File

@ -67,10 +67,10 @@ private:
class WrappedJavaObject {
public:
WrappedJavaObject() :
wrapped_obj(NULL)
wrapped_obj(nullptr)
{ }
WrappedJavaObject(jobject jobj) : wrapped_obj(NULL) {
WrappedJavaObject(jobject jobj) : wrapped_obj(nullptr) {
Init(jobj);
}
@ -79,7 +79,7 @@ public:
}
bool isNull() const {
return wrapped_obj == NULL;
return wrapped_obj == nullptr;
}
jobject wrappedObject() const {
@ -93,10 +93,10 @@ protected:
class AutoGlobalWrappedJavaObject : protected WrappedJavaObject{
public:
AutoGlobalWrappedJavaObject() :
wrapped_obj(NULL)
wrapped_obj(nullptr)
{ }
AutoGlobalWrappedJavaObject(jobject jobj, JNIEnv* env) : wrapped_obj(NULL) {
AutoGlobalWrappedJavaObject(jobject jobj, JNIEnv* env) : wrapped_obj(nullptr) {
Init(jobj, env);
}
@ -111,7 +111,7 @@ public:
}
bool isNull() const {
return wrapped_obj == NULL;
return wrapped_obj == nullptr;
}
jobject wrappedObject() const {

View File

@ -504,7 +504,7 @@ class nsIWidget : public nsISupports {
/**
* Create and initialize a widget.
*
* All the arguments can be NULL in which case a top level window
* All the arguments can be null in which case a top level window
* with size 0 is created. The event callback function has to be
* provided only if the caller wants to deal with the events this
* widget receives. The event callback is basically a preprocess

View File

@ -212,7 +212,7 @@ GetKinfoVmentrySelf(int64_t* prss, uint64_t* maxreg)
{
int cnt;
struct kinfo_vmentry *vmmap, *kve;
if ((vmmap = kinfo_getvmmap(getpid(), &cnt)) == NULL)
if ((vmmap = kinfo_getvmmap(getpid(), &cnt)) == nullptr)
return NS_ERROR_FAILURE;
if (prss)
@ -238,7 +238,7 @@ static nsresult
PrivateDistinguishedAmount(int64_t* aN)
{
int64_t priv;
nsresult rv = GetKinfoVmentrySelf(&priv, NULL);
nsresult rv = GetKinfoVmentrySelf(&priv, nullptr);
NS_ENSURE_SUCCESS(rv, rv);
*aN = priv * getpagesize();
return NS_OK;
@ -249,7 +249,7 @@ static nsresult
VsizeMaxContiguousDistinguishedAmount(int64_t* aN)
{
uint64_t biggestRegion;
nsresult rv = GetKinfoVmentrySelf(NULL, &biggestRegion);
nsresult rv = GetKinfoVmentrySelf(nullptr, &biggestRegion);
if (NS_SUCCEEDED(rv))
*aN = biggestRegion;