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

This commit is contained in:
Birunthan Mohanathas 2013-10-28 10:05:51 -04:00
parent 145d3ff4f2
commit 28ba747e91
13 changed files with 59 additions and 55 deletions

View File

@ -83,7 +83,7 @@ using namespace mozilla::services;
using namespace mozilla::widget;
bool gDrawRequest = false;
static nsAppShell *gAppShell = NULL;
static nsAppShell *gAppShell = nullptr;
static int epollfd = 0;
static int signalfds[2] = {0};
static bool sDevInputAudioJack;
@ -145,7 +145,7 @@ struct UserInputData {
static void
sendMouseEvent(uint32_t msg, uint64_t timeMs, int x, int y, bool forwardToChildren)
{
WidgetMouseEvent event(true, msg, NULL,
WidgetMouseEvent event(true, msg, nullptr,
WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
event.refPoint.x = x;
@ -198,7 +198,7 @@ sendTouchEvent(UserInputData& data, bool* captured)
break;
}
WidgetTouchEvent event(true, msg, NULL);
WidgetTouchEvent event(true, msg, nullptr);
event.time = data.timeMs;
@ -221,7 +221,7 @@ sendKeyEventWithMsg(uint32_t keyCode,
uint32_t msg,
uint64_t timeMs)
{
WidgetKeyboardEvent event(true, msg, NULL);
WidgetKeyboardEvent event(true, msg, nullptr);
event.keyCode = keyCode;
event.mKeyNameIndex = keyNameIndex;
event.location = nsIDOMKeyEvent::DOM_KEY_LOCATION_MOBILE;
@ -393,7 +393,7 @@ deviceId)
virtual void notifyInputDevicesChanged(const android::Vector<InputDeviceInfo>& inputDevices) {};
virtual sp<KeyCharacterMap> getKeyboardLayoutOverlay(const String8& inputDeviceDescriptor)
{
return NULL;
return nullptr;
};
virtual String8 getDeviceAlias(const InputDeviceIdentifier& identifier)
{
@ -707,7 +707,7 @@ nsAppShell::~nsAppShell()
if (result)
LOG("Could not stop reader thread - %d", result);
}
gAppShell = NULL;
gAppShell = nullptr;
}
nsresult

View File

@ -71,15 +71,15 @@ ScreenManagerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
}
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
{ &kNS_WINDOW_CID, false, NULL, nsWindowConstructor },
{ &kNS_CHILD_CID, false, NULL, nsWindowConstructor },
{ &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor },
{ &kNS_SCREENMANAGER_CID, false, NULL, ScreenManagerConstructor },
{ &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor },
{ &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceGonkConstructor },
{ &kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor },
{ &kNS_GFXINFO_CID, false, NULL, mozilla::widget::GfxInfoConstructor },
{ NULL }
{ &kNS_WINDOW_CID, false, nullptr, nsWindowConstructor },
{ &kNS_CHILD_CID, false, nullptr, nsWindowConstructor },
{ &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor },
{ &kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor },
{ &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor },
{ &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceGonkConstructor },
{ &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor },
{ &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
@ -91,7 +91,7 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
{ "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID },
{ "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID },
{ NULL }
{ nullptr }
};
static void
@ -105,8 +105,8 @@ static const mozilla::Module kWidgetModule = {
mozilla::Module::kVersion,
kWidgetCIDs,
kWidgetContracts,
NULL,
NULL,
nullptr,
nullptr,
nsAppShellInit,
nsWidgetGonkModuleDtor
};

View File

@ -289,7 +289,7 @@ struct ParamTraits<mozilla::WidgetKeyboardEvent>
ReadParam(aMsg, aIter, &aResult->mUniqueId))
{
aResult->mKeyNameIndex = static_cast<mozilla::KeyNameIndex>(keyNameIndex);
aResult->mNativeKeyEvent = NULL;
aResult->mNativeKeyEvent = nullptr;
return true;
}
return false;

View File

@ -41,11 +41,11 @@ public:
* @param aUnshiftedCharCode CharCode for aKeyCode without Shift key.
* This may be zero if aKeyCode key doesn't input
* a Latin character.
* Note that must not be NULL.
* Note that must not be nullptr.
* @param aShiftedCharCode CharCode for aKeyCOde with Shift key.
* This is always 0 when aKeyCode isn't
* NS_VK_[A-Z].
* Note that must not be NULL.
* Note that must not be nullptr.
*/
static void GetLatinCharCodeForKeyCode(uint32_t aKeyCode,
bool aIsCapsLock,

View File

@ -141,7 +141,7 @@ public:
fail("Failed to dispatch check runnable");
}
if (NS_FAILED(NS_ProcessPendingEvents(NULL))) {
if (NS_FAILED(NS_ProcessPendingEvents(nullptr))) {
fail("Failed to process all pending events");
}
@ -239,7 +239,7 @@ public:
{
if (sWindowUtils) {
nsCOMPtr<nsIDOMWindowUtils> utils = dont_AddRef(sWindowUtils);
sWindowUtils = NULL;
sWindowUtils = nullptr;
if (gStableStateEventHasRun) {
fail("StableStateRunnable ran at wrong time");
@ -258,7 +258,7 @@ public:
return;
}
KillTimer(NULL, idEvent);
KillTimer(nullptr, idEvent);
nsCOMPtr<nsIAppShell> appShell = dont_AddRef(sAppShell);
@ -280,7 +280,7 @@ public:
ScheduleTimer(nsIDOMWindowUtils* aWindowUtils)
{
#ifdef XP_WIN
UINT_PTR timerId = SetTimer(NULL, 0, 1000, (TIMERPROC)TimerCallback);
UINT_PTR timerId = SetTimer(nullptr, 0, 1000, (TIMERPROC)TimerCallback);
if (!timerId) {
fail("SetTimer failed!");
return false;
@ -299,8 +299,8 @@ public:
}
};
nsIDOMWindowUtils* EventListener::sWindowUtils = NULL;
nsIAppShell* EventListener::sAppShell = NULL;
nsIDOMWindowUtils* EventListener::sWindowUtils = nullptr;
nsIAppShell* EventListener::sAppShell = nullptr;
NS_IMPL_ISUPPORTS1(EventListener, nsIDOMEventListener)
@ -399,7 +399,7 @@ Test4Internal(nsIAppShell* aAppShell)
}
nsCOMPtr<nsIURI> uri;
if (NS_FAILED(NS_NewURI(getter_AddRefs(uri), "about:", NULL))) {
if (NS_FAILED(NS_NewURI(getter_AddRefs(uri), "about:", nullptr))) {
fail("Failed to create new uri");
return false;
}
@ -407,7 +407,7 @@ Test4Internal(nsIAppShell* aAppShell)
uint32_t flags = nsIWebBrowserChrome::CHROME_DEFAULT;
nsCOMPtr<nsIXULWindow> xulWindow;
if (NS_FAILED(appService->CreateTopLevelWindow(NULL, uri, flags, 100, 100,
if (NS_FAILED(appService->CreateTopLevelWindow(nullptr, uri, flags, 100, 100,
getter_AddRefs(xulWindow)))) {
fail("Failed to create new window");
return false;

View File

@ -234,7 +234,7 @@ public: // IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void** ppUnk)
{
*ppUnk = NULL;
*ppUnk = nullptr;
if (IID_IUnknown == riid || IID_ITfRange == riid || IID_ITfRangeACP == riid)
*ppUnk = static_cast<ITfRangeACP*>(this);
if (*ppUnk)
@ -446,7 +446,7 @@ public: // IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void** ppUnk)
{
*ppUnk = NULL;
*ppUnk = nullptr;
if (IID_IUnknown == riid || IID_IEnumTfRanges == riid)
*ppUnk = static_cast<IEnumTfRanges*>(this);
if (*ppUnk)
@ -538,7 +538,7 @@ public: // IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void** ppUnk)
{
*ppUnk = NULL;
*ppUnk = nullptr;
if (IID_IUnknown == riid || IID_ITfDisplayAttributeInfo == riid)
*ppUnk = static_cast<ITfDisplayAttributeInfo*>(this);
if (*ppUnk)
@ -617,7 +617,7 @@ public: // IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void** ppUnk)
{
*ppUnk = NULL;
*ppUnk = nullptr;
if (IID_IUnknown == riid || IID_ITfProperty == riid ||
IID_ITfReadOnlyProperty == riid)
*ppUnk = static_cast<ITfProperty*>(this);
@ -777,7 +777,7 @@ public: // IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void** ppUnk)
{
*ppUnk = NULL;
*ppUnk = nullptr;
if (IID_IUnknown == riid || IID_ITfContext == riid)
*ppUnk = static_cast<ITfContext*>(this);
else if (IID_ITextStoreACPSink == riid)
@ -1005,7 +1005,7 @@ public: // IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void** ppUnk)
{
*ppUnk = NULL;
*ppUnk = nullptr;
if (IID_IUnknown == riid || IID_ITfDocumentMgr == riid)
*ppUnk = static_cast<ITfDocumentMgr*>(this);
if (*ppUnk)
@ -1033,7 +1033,7 @@ public: // ITfDocumentMgr
mStore->AdviseSink(IID_ITextStoreACPSink,
static_cast<ITextStoreACPSink*>(context.get()),
TS_AS_ALL_SINKS);
if (FAILED(hr)) mStore = NULL;
if (FAILED(hr)) mStore = nullptr;
NS_ENSURE_TRUE(SUCCEEDED(hr), E_FAIL);
(*ppic) = context;
(*ppic)->AddRef();
@ -1067,7 +1067,7 @@ public: // ITfDocumentMgr
if (dwFlags == TF_POPF_ALL) {
NS_ENSURE_TRUE(mContextBase, E_FAIL);
mStore->UnadviseSink(static_cast<ITextStoreACPSink*>(mContextBase.get()));
mStore = NULL;
mStore = nullptr;
mContextBase = nullptr;
mContextTop = nullptr;
return S_OK;
@ -1136,7 +1136,7 @@ public: // IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void** ppUnk)
{
*ppUnk = NULL;
*ppUnk = nullptr;
if (IID_IUnknown == riid || IID_ITfThreadMgr == riid)
*ppUnk = static_cast<ITfThreadMgr*>(this);
else if (IID_ITfDisplayAttributeMgr == riid)
@ -1485,7 +1485,7 @@ TestApp::Init(void)
if (*threadMgr) {
(*threadMgr)->Deactivate();
(*threadMgr)->Release();
(*threadMgr) = NULL;
(*threadMgr) = nullptr;
} else {
// This is only for information. The test does not need TSF to run.
printf("TSF not initialized properly (TSF is not enabled/installed?)\n");
@ -1495,13 +1495,13 @@ TestApp::Init(void)
widget->GetNativeData(NS_NATIVE_TSF_CATEGORY_MGR));
if (*catMgr) {
(*catMgr)->Release();
(*catMgr) = NULL;
(*catMgr) = nullptr;
}
ITfDisplayAttributeMgr **daMgr = reinterpret_cast<ITfDisplayAttributeMgr**>(
widget->GetNativeData(NS_NATIVE_TSF_DISPLAY_ATTR_MGR));
if (*daMgr) {
(*daMgr)->Release();
(*daMgr) = NULL;
(*daMgr) = nullptr;
}
mMgr = new TSFMgrImpl(this);
@ -2393,7 +2393,8 @@ TestApp::TestComposition(void)
hr = mMgr->GetFocusedStore()->InsertTextAtSelection(TF_IAS_NOQUERY,
insertString1.get(),
insertString1.Length(),
NULL, NULL, &textChange);
nullptr, nullptr,
&textChange);
if (!(SUCCEEDED(hr) &&
sel.acpEnd == textChange.acpStart &&
sel.acpEnd == textChange.acpOldEnd &&
@ -2578,7 +2579,7 @@ TestApp::TestNotificationTextChange(nsIWidget* aWidget,
LONG aNewEnd)
{
MSG msg;
if (::PeekMessageW(&msg, NULL, WM_USER_TSF_TEXTCHANGE,
if (::PeekMessageW(&msg, nullptr, WM_USER_TSF_TEXTCHANGE,
WM_USER_TSF_TEXTCHANGE, PM_REMOVE))
::DispatchMessageW(&msg);
if (!mMgr->GetFocusedContext()) {
@ -2588,7 +2589,7 @@ TestApp::TestNotificationTextChange(nsIWidget* aWidget,
mMgr->GetFocusedContext()->mTextChanged = false;
nsresult nsr = aWidget->SynthesizeNativeKeyEvent(0, aCode, 0,
aCharacter, aCharacter);
if (::PeekMessageW(&msg, NULL, WM_USER_TSF_TEXTCHANGE,
if (::PeekMessageW(&msg, nullptr, WM_USER_TSF_TEXTCHANGE,
WM_USER_TSF_TEXTCHANGE, PM_REMOVE))
::DispatchMessageW(&msg);
return NS_SUCCEEDED(nsr) &&

View File

@ -1755,7 +1755,7 @@ nsTextStore::GetText(LONG acpStart,
return TS_E_INVALIDPOS;
}
// Making sure to NULL-terminate string just to be on the safe side
// Making sure to null-terminate string just to be on the safe side
*pcchPlainOut = 0;
if (pchPlain && cchPlainReq) *pchPlain = 0;
if (pulRunInfoOut) *pulRunInfoOut = 0;

View File

@ -390,7 +390,8 @@ BlacklistEntryToDriverInfo(nsIDOMNode* aBlacklistEntry,
if (BlacklistNodeGetChildByName(element, NS_LITERAL_STRING("osversion"),
getter_AddRefs(dataNode))) {
BlacklistNodeToTextValue(dataNode, dataValue);
aDriverInfo.mOperatingSystemVersion = strtoul(NS_LossyConvertUTF16toASCII(dataValue).get(), NULL, 10);
aDriverInfo.mOperatingSystemVersion = strtoul(NS_LossyConvertUTF16toASCII(dataValue).get(),
nullptr, 10);
}
// <vendor>0x8086</vendor>

View File

@ -18,7 +18,8 @@ InfoObject::DefineProperty(const char *name, int value)
if (!mOk)
return;
mOk = JS_DefineProperty(mCx, mObj, name, INT_TO_JSVAL(value), NULL, NULL, JSPROP_ENUMERATE);
mOk = JS_DefineProperty(mCx, mObj, name, INT_TO_JSVAL(value),
nullptr, nullptr, JSPROP_ENUMERATE);
}
void
@ -35,7 +36,8 @@ InfoObject::DefineProperty(const char *name, nsAString &value)
if (!mOk)
return;
mOk = JS_DefineProperty(mCx, mObj, name, STRING_TO_JSVAL(string), NULL, NULL, JSPROP_ENUMERATE);
mOk = JS_DefineProperty(mCx, mObj, name, STRING_TO_JSVAL(string),
nullptr, nullptr, JSPROP_ENUMERATE);
}
void
@ -47,7 +49,7 @@ InfoObject::DefineProperty(const char *name, const char *value)
InfoObject::InfoObject(JSContext *aCx) : mCx(aCx), mObj(aCx), mOk(true)
{
mObj = JS_NewObject(mCx, NULL, NULL, NULL);
mObj = JS_NewObject(mCx, nullptr, nullptr, nullptr);
if (!mObj)
mOk = false;
}

View File

@ -90,7 +90,7 @@ nsClipboardPrivacyHandler::Observe(nsISupports *aSubject, char const *aTopic, PR
// 32-bit/64-bit boundaries, which could lead Explorer to crash.
// We work around the problem by clearing the clipboard using
// the usual Win32 API.
NS_ENSURE_TRUE(SUCCEEDED(::OleSetClipboard(NULL)), NS_ERROR_FAILURE);
NS_ENSURE_TRUE(SUCCEEDED(::OleSetClipboard(nullptr)), NS_ERROR_FAILURE);
#else
// Empty the native clipboard by copying an empty transferable
nsCOMPtr<nsITransferable> nullData =

View File

@ -45,7 +45,7 @@ using namespace mozilla;
#define SECONDS_PER_DAY 86400
#ifdef PR_LOGGING
static PRLogModuleInfo *sLog = NULL;
static PRLogModuleInfo *sLog = nullptr;
#endif
// Use this to find previously added observers in our array:
@ -392,7 +392,7 @@ nsIdleService::nsIdleService() : mCurrentlySetToTimeoutAt(TimeStamp()),
mLastUserInteraction(TimeStamp::Now())
{
#ifdef PR_LOGGING
if (sLog == NULL)
if (sLog == nullptr)
sLog = PR_NewLogModule("idleService");
#endif
MOZ_ASSERT(!gIdleService);

View File

@ -97,7 +97,7 @@ NS_IMETHODIMP nsPrintSettings::GetPrintSession(nsIPrintSession **aPrintSession)
}
NS_IMETHODIMP nsPrintSettings::SetPrintSession(nsIPrintSession *aPrintSession)
{
// Clearing it by passing NULL is not allowed. That's why we
// Clearing it by passing nullptr is not allowed. That's why we
// use a weak ref so that it doesn't have to be cleared.
NS_ENSURE_ARG(aPrintSession);

View File

@ -51,7 +51,7 @@
#define ARRAY_LENGTH(array_) (sizeof(array_)/sizeof(array_[0]))
static PRLogModuleInfo *sRemoteLm = NULL;
static PRLogModuleInfo *sRemoteLm = nullptr;
static int (*sOldHandler)(Display *, XErrorEvent *);
static bool sGotBadWindow;
@ -403,7 +403,7 @@ XRemoteClient::GetLock(Window aWindow, bool *aDestroyed)
// add the x event queue to the select set
FD_SET(ConnectionNumber(mDisplay), &select_set);
select_retval = select(ConnectionNumber(mDisplay) + 1,
&select_set, NULL, NULL, &delay);
&select_set, nullptr, nullptr, &delay);
// did we time out?
if (select_retval == 0) {
PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("timed out waiting for window\n"));