зеркало из https://github.com/mozilla/gecko-dev.git
Bug 784739 - Switch from NULL to nullptr in toolkit/components/ (2/2); r=ehsan
This commit is contained in:
Родитель
72f11bcb4b
Коммит
9deb678652
|
@ -102,7 +102,7 @@ NS_IMETHODIMP nsAlertsService::ShowAlertNotification(const nsAString & aImageUrl
|
|||
if (!ShouldShowAlert()) {
|
||||
// Do not display the alert. Instead call alertfinished and get out.
|
||||
if (aAlertListener)
|
||||
aAlertListener->Observe(NULL, "alertfinished", PromiseFlatString(aAlertCookie).get());
|
||||
aAlertListener->Observe(nullptr, "alertfinished", PromiseFlatString(aAlertCookie).get());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1727,15 +1727,15 @@ NS_DEFINE_NAMED_CID(NS_AUTOCOMPLETECONTROLLER_CID);
|
|||
NS_DEFINE_NAMED_CID(NS_AUTOCOMPLETESIMPLERESULT_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kAutoCompleteCIDs[] = {
|
||||
{ &kNS_AUTOCOMPLETECONTROLLER_CID, false, NULL, nsAutoCompleteControllerConstructor },
|
||||
{ &kNS_AUTOCOMPLETESIMPLERESULT_CID, false, NULL, nsAutoCompleteSimpleResultConstructor },
|
||||
{ NULL }
|
||||
{ &kNS_AUTOCOMPLETECONTROLLER_CID, false, nullptr, nsAutoCompleteControllerConstructor },
|
||||
{ &kNS_AUTOCOMPLETESIMPLERESULT_CID, false, nullptr, nsAutoCompleteSimpleResultConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kAutoCompleteContracts[] = {
|
||||
{ NS_AUTOCOMPLETECONTROLLER_CONTRACTID, &kNS_AUTOCOMPLETECONTROLLER_CID },
|
||||
{ NS_AUTOCOMPLETESIMPLERESULT_CONTRACTID, &kNS_AUTOCOMPLETESIMPLERESULT_CID },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module kAutoCompleteModule = {
|
||||
|
|
|
@ -70,7 +70,7 @@ nsUrlClassifierDBServiceConstructor(nsISupports *aOuter, REFNSIID aIID,
|
|||
NS_ENSURE_NO_AGGREGATION(aOuter);
|
||||
|
||||
nsUrlClassifierDBService *inst = nsUrlClassifierDBService::GetInstance(&rv);
|
||||
if (NULL == inst) {
|
||||
if (nullptr == inst) {
|
||||
return rv;
|
||||
}
|
||||
/* NS_ADDREF(inst); */
|
||||
|
@ -111,30 +111,30 @@ NS_DEFINE_NAMED_CID(NS_UPDATEPROCESSOR_CID);
|
|||
#endif
|
||||
|
||||
static const mozilla::Module::CIDEntry kToolkitCIDs[] = {
|
||||
{ &kNS_TOOLKIT_APPSTARTUP_CID, false, NULL, nsAppStartupConstructor },
|
||||
{ &kNS_USERINFO_CID, false, NULL, nsUserInfoConstructor },
|
||||
{ &kNS_ALERTSSERVICE_CID, false, NULL, nsAlertsServiceConstructor },
|
||||
{ &kNS_TOOLKIT_APPSTARTUP_CID, false, nullptr, nsAppStartupConstructor },
|
||||
{ &kNS_USERINFO_CID, false, nullptr, nsUserInfoConstructor },
|
||||
{ &kNS_ALERTSSERVICE_CID, false, nullptr, nsAlertsServiceConstructor },
|
||||
#if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
|
||||
{ &kNS_PARENTALCONTROLSSERVICE_CID, false, NULL, nsParentalControlsServiceWinConstructor },
|
||||
{ &kNS_PARENTALCONTROLSSERVICE_CID, false, nullptr, nsParentalControlsServiceWinConstructor },
|
||||
#endif
|
||||
{ &kNS_DOWNLOADMANAGER_CID, false, NULL, nsDownloadManagerConstructor },
|
||||
{ &kNS_DOWNLOADPLATFORM_CID, false, NULL, DownloadPlatformConstructor },
|
||||
{ &kNS_DOWNLOAD_CID, false, NULL, nsDownloadProxyConstructor },
|
||||
{ &kNS_FIND_SERVICE_CID, false, NULL, nsFindServiceConstructor },
|
||||
{ &kNS_TYPEAHEADFIND_CID, false, NULL, nsTypeAheadFindConstructor },
|
||||
{ &kNS_DOWNLOADMANAGER_CID, false, nullptr, nsDownloadManagerConstructor },
|
||||
{ &kNS_DOWNLOADPLATFORM_CID, false, nullptr, DownloadPlatformConstructor },
|
||||
{ &kNS_DOWNLOAD_CID, false, nullptr, nsDownloadProxyConstructor },
|
||||
{ &kNS_FIND_SERVICE_CID, false, nullptr, nsFindServiceConstructor },
|
||||
{ &kNS_TYPEAHEADFIND_CID, false, nullptr, nsTypeAheadFindConstructor },
|
||||
#ifdef MOZ_URL_CLASSIFIER
|
||||
{ &kNS_APPLICATION_REPUTATION_SERVICE_CID, false, NULL, ApplicationReputationServiceConstructor },
|
||||
{ &kNS_URLCLASSIFIERPREFIXSET_CID, false, NULL, nsUrlClassifierPrefixSetConstructor },
|
||||
{ &kNS_URLCLASSIFIERDBSERVICE_CID, false, NULL, nsUrlClassifierDBServiceConstructor },
|
||||
{ &kNS_URLCLASSIFIERSTREAMUPDATER_CID, false, NULL, nsUrlClassifierStreamUpdaterConstructor },
|
||||
{ &kNS_URLCLASSIFIERUTILS_CID, false, NULL, nsUrlClassifierUtilsConstructor },
|
||||
{ &kNS_APPLICATION_REPUTATION_SERVICE_CID, false, nullptr, ApplicationReputationServiceConstructor },
|
||||
{ &kNS_URLCLASSIFIERPREFIXSET_CID, false, nullptr, nsUrlClassifierPrefixSetConstructor },
|
||||
{ &kNS_URLCLASSIFIERDBSERVICE_CID, false, nullptr, nsUrlClassifierDBServiceConstructor },
|
||||
{ &kNS_URLCLASSIFIERSTREAMUPDATER_CID, false, nullptr, nsUrlClassifierStreamUpdaterConstructor },
|
||||
{ &kNS_URLCLASSIFIERUTILS_CID, false, nullptr, nsUrlClassifierUtilsConstructor },
|
||||
#endif
|
||||
{ &kNS_BROWSERSTATUSFILTER_CID, false, NULL, nsBrowserStatusFilterConstructor },
|
||||
{ &kNS_CHARSETMENU_CID, false, NULL, NS_NewCharsetMenu },
|
||||
{ &kNS_BROWSERSTATUSFILTER_CID, false, nullptr, nsBrowserStatusFilterConstructor },
|
||||
{ &kNS_CHARSETMENU_CID, false, nullptr, NS_NewCharsetMenu },
|
||||
#if defined(USE_MOZ_UPDATER)
|
||||
{ &kNS_UPDATEPROCESSOR_CID, false, NULL, nsUpdateProcessorConstructor },
|
||||
{ &kNS_UPDATEPROCESSOR_CID, false, nullptr, nsUpdateProcessorConstructor },
|
||||
#endif
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kToolkitContracts[] = {
|
||||
|
@ -162,7 +162,7 @@ static const mozilla::Module::ContractIDEntry kToolkitContracts[] = {
|
|||
#if defined(USE_MOZ_UPDATER)
|
||||
{ NS_UPDATEPROCESSOR_CONTRACTID, &kNS_UPDATEPROCESSOR_CID },
|
||||
#endif
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module kToolkitModule = {
|
||||
|
|
|
@ -84,7 +84,7 @@ nsCommandLine::nsCommandLine() :
|
|||
}
|
||||
|
||||
|
||||
NS_IMPL_CLASSINFO(nsCommandLine, NULL, 0, NS_COMMANDLINE_CID)
|
||||
NS_IMPL_CLASSINFO(nsCommandLine, nullptr, 0, NS_COMMANDLINE_CID)
|
||||
NS_IMPL_ISUPPORTS2_CI(nsCommandLine,
|
||||
nsICommandLine,
|
||||
nsICommandLineRunner)
|
||||
|
@ -267,7 +267,7 @@ nsCommandLine::ResolveFile(const nsAString& aArgument, nsIFile* *aResult)
|
|||
NS_CopyUnicodeToNative(aArgument, path);
|
||||
|
||||
CFURLRef newurl =
|
||||
CFURLCreateFromFileSystemRepresentationRelativeToBase(NULL, (const UInt8*) path.get(),
|
||||
CFURLCreateFromFileSystemRepresentationRelativeToBase(nullptr, (const UInt8*) path.get(),
|
||||
path.Length(),
|
||||
true, baseurl);
|
||||
|
||||
|
@ -668,13 +668,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsCommandLine)
|
|||
NS_DEFINE_NAMED_CID(NS_COMMANDLINE_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kCommandLineCIDs[] = {
|
||||
{ &kNS_COMMANDLINE_CID, false, NULL, nsCommandLineConstructor },
|
||||
{ NULL }
|
||||
{ &kNS_COMMANDLINE_CID, false, nullptr, nsCommandLineConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kCommandLineContracts[] = {
|
||||
{ "@mozilla.org/toolkit/command-line;1", &kNS_COMMANDLINE_CID },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module kCommandLineModule = {
|
||||
|
|
|
@ -31,12 +31,12 @@ UnicodeToNative(JSContext *cx, const jschar *source, size_t slen)
|
|||
nsresult rv = NS_CopyUnicodeToNative(unicode, native);
|
||||
if (NS_FAILED(rv)) {
|
||||
JS_ReportError(cx, "could not convert string to native charset");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
char* result = static_cast<char*>(JS_malloc(cx, native.Length() + 1));
|
||||
if (!result)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
memcpy(result, native.get(), native.Length() + 1);
|
||||
return result;
|
||||
|
@ -134,13 +134,13 @@ Module::Call(nsIXPConnectWrappedNative* wrapper,
|
|||
NS_DEFINE_NAMED_CID(JSCTYPES_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kCTypesCIDs[] = {
|
||||
{ &kJSCTYPES_CID, false, NULL, mozilla::ctypes::ModuleConstructor },
|
||||
{ NULL }
|
||||
{ &kJSCTYPES_CID, false, nullptr, mozilla::ctypes::ModuleConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kCTypesContracts[] = {
|
||||
{ JSCTYPES_CONTRACTID, &kJSCTYPES_CID },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module kCTypesModule = {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#define FAIL \
|
||||
{ \
|
||||
fprintf(stderr, "Assertion failed at line %i\n", __LINE__); \
|
||||
(*(int*)NULL)++; \
|
||||
(*(int*)nullptr)++; \
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
* - 1: acquired
|
||||
* - < 0: error, resource has been released several times.
|
||||
*/
|
||||
int *gFinalizerTestResources = NULL;
|
||||
char **gFinalizerTestNames = NULL;
|
||||
int *gFinalizerTestResources = nullptr;
|
||||
char **gFinalizerTestNames = nullptr;
|
||||
size_t gFinalizerTestSize;
|
||||
|
||||
void
|
||||
|
@ -31,7 +31,7 @@ test_finalizer_start(size_t size)
|
|||
gFinalizerTestSize = size;
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
gFinalizerTestResources[i] = 0;
|
||||
gFinalizerTestNames[i] = NULL;
|
||||
gFinalizerTestNames[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,21 +197,21 @@ test_finalizer_cmp_int32_ptr_t(int32_t *a, int32_t *b)
|
|||
return a==b;
|
||||
}
|
||||
|
||||
// Resource type: NULL
|
||||
// Resource type: nullptr
|
||||
|
||||
// Acquire resource i
|
||||
void*
|
||||
test_finalizer_acq_null_t(size_t i)
|
||||
{
|
||||
gFinalizerTestResources[0] = 1;//Always index 0
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Release resource i
|
||||
void
|
||||
test_finalizer_rel_null_t(void *i)
|
||||
{
|
||||
if (i != NULL) {
|
||||
if (i != nullptr) {
|
||||
MOZ_CRASH("Assertion failed");
|
||||
}
|
||||
gFinalizerTestResources[0] --;
|
||||
|
@ -306,10 +306,10 @@ test_finalizer_cmp_struct_t(RECT a, RECT b)
|
|||
return a.top == b.top;
|
||||
}
|
||||
|
||||
// Support for checking that we reject NULL finalizer
|
||||
// Support for checking that we reject nullptr finalizer
|
||||
afun* test_finalizer_rel_null_function()
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -63,8 +63,8 @@ Base64urlEncode(const uint8_t* aBytes,
|
|||
uint32_t aNumBytes,
|
||||
nsCString& _result)
|
||||
{
|
||||
// SetLength does not set aside space for NULL termination. PL_Base64Encode
|
||||
// will not NULL terminate, however, nsCStrings must be NULL terminated. As a
|
||||
// SetLength does not set aside space for null termination. PL_Base64Encode
|
||||
// will not null terminate, however, nsCStrings must be null terminated. As a
|
||||
// result, we set the capacity to be one greater than what we need, and the
|
||||
// length to our desired length.
|
||||
uint32_t length = (aNumBytes + 2) / 3 * 4; // +2 due to integer math.
|
||||
|
|
|
@ -2552,7 +2552,7 @@ nsDownloadManager::ConfirmCancelDownloads(int32_t aCount,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// nsDownload
|
||||
|
||||
NS_IMPL_CLASSINFO(nsDownload, NULL, 0, NS_DOWNLOAD_CID)
|
||||
NS_IMPL_CLASSINFO(nsDownload, nullptr, 0, NS_DOWNLOAD_CID)
|
||||
NS_IMPL_ISUPPORTS4_CI(
|
||||
nsDownload
|
||||
, nsIDownload
|
||||
|
@ -2590,8 +2590,8 @@ NS_IMETHODIMP nsDownload::SetSha256Hash(const nsACString& aHash) {
|
|||
#ifdef MOZ_ENABLE_GIO
|
||||
static void gio_set_metadata_done(GObject *source_obj, GAsyncResult *res, gpointer user_data)
|
||||
{
|
||||
GError *err = NULL;
|
||||
g_file_set_attributes_finish(G_FILE(source_obj), res, NULL, &err);
|
||||
GError *err = nullptr;
|
||||
g_file_set_attributes_finish(G_FILE(source_obj), res, nullptr, &err);
|
||||
if (err) {
|
||||
#ifdef DEBUG
|
||||
NS_DebugBreak(NS_DEBUG_WARNING, "Set file metadata failed: ", err->message, __FILE__, __LINE__);
|
||||
|
@ -2733,7 +2733,7 @@ nsDownload::SetState(DownloadState aState)
|
|||
GtkRecentManager* manager = gtk_recent_manager_get_default();
|
||||
|
||||
gchar* uri = g_filename_to_uri(NS_ConvertUTF16toUTF8(path).get(),
|
||||
NULL, NULL);
|
||||
nullptr, nullptr);
|
||||
if (uri) {
|
||||
gtk_recent_manager_add_item(manager, uri);
|
||||
g_free(uri);
|
||||
|
@ -2751,7 +2751,7 @@ nsDownload::SetState(DownloadState aState)
|
|||
file_info,
|
||||
G_FILE_QUERY_INFO_NONE,
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL, gio_set_metadata_done, NULL);
|
||||
nullptr, gio_set_metadata_done, nullptr);
|
||||
g_object_unref(file_info);
|
||||
g_object_unref(gio_file);
|
||||
#endif
|
||||
|
@ -2764,7 +2764,7 @@ nsDownload::SetState(DownloadState aState)
|
|||
kCFStringEncodingUTF8);
|
||||
CFNotificationCenterRef center = ::CFNotificationCenterGetDistributedCenter();
|
||||
::CFNotificationCenterPostNotification(center, CFSTR("com.apple.DownloadFileFinished"),
|
||||
observedObject, NULL, TRUE);
|
||||
observedObject, nullptr, TRUE);
|
||||
::CFRelease(observedObject);
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
|
|
|
@ -161,7 +161,7 @@ nsDownloadScanner::Init()
|
|||
// This CoInitialize/CoUninitialize pattern seems to be common in the Mozilla
|
||||
// codebase. All other COM calls/objects are made on different threads.
|
||||
nsresult rv = NS_OK;
|
||||
CoInitialize(NULL);
|
||||
CoInitialize(nullptr);
|
||||
|
||||
if (!IsAESAvailable()) {
|
||||
CoUninitialize();
|
||||
|
@ -192,7 +192,7 @@ nsDownloadScanner::IsAESAvailable()
|
|||
// Try to instantiate IAE to see if it's available.
|
||||
nsRefPtr<IAttachmentExecute> ae;
|
||||
HRESULT hr;
|
||||
hr = CoCreateInstance(CLSID_AttachmentServices, NULL, CLSCTX_INPROC,
|
||||
hr = CoCreateInstance(CLSID_AttachmentServices, nullptr, CLSCTX_INPROC,
|
||||
IID_IAttachmentExecute, getter_AddRefs(ae));
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("Could not instantiate attachment execution service\n");
|
||||
|
@ -238,7 +238,7 @@ nsDownloadScanner::CheckPolicy(nsIURI *aSource, nsIURI *aTarget)
|
|||
|
||||
nsRefPtr<IAttachmentExecute> ae;
|
||||
HRESULT hr;
|
||||
hr = CoCreateInstance(CLSID_AttachmentServices, NULL, CLSCTX_INPROC,
|
||||
hr = CoCreateInstance(CLSID_AttachmentServices, nullptr, CLSCTX_INPROC,
|
||||
IID_IAttachmentExecute, getter_AddRefs(ae));
|
||||
if (FAILED(hr))
|
||||
return AVPOLICY_DOWNLOAD;
|
||||
|
@ -305,7 +305,7 @@ nsresult ReleaseDispatcher::Run() {
|
|||
}
|
||||
|
||||
nsDownloadScanner::Scan::Scan(nsDownloadScanner *scanner, nsDownload *download)
|
||||
: mDLScanner(scanner), mThread(NULL),
|
||||
: mDLScanner(scanner), mThread(nullptr),
|
||||
mDownload(download), mStatus(AVSCAN_NOTSTARTED),
|
||||
mSkipSource(false)
|
||||
{
|
||||
|
@ -321,8 +321,8 @@ nsDownloadScanner::Scan::Start()
|
|||
{
|
||||
mStartTime = PR_Now();
|
||||
|
||||
mThread = (HANDLE)_beginthreadex(NULL, 0, ScannerThreadFunction,
|
||||
this, CREATE_SUSPENDED, NULL);
|
||||
mThread = (HANDLE)_beginthreadex(nullptr, 0, ScannerThreadFunction,
|
||||
this, CREATE_SUSPENDED, nullptr);
|
||||
if (!mThread)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -446,7 +446,7 @@ nsDownloadScanner::Scan::DoScanAES()
|
|||
HRESULT hr;
|
||||
nsRefPtr<IAttachmentExecute> ae;
|
||||
MOZ_SEH_TRY {
|
||||
hr = CoCreateInstance(CLSID_AttachmentServices, NULL, CLSCTX_ALL,
|
||||
hr = CoCreateInstance(CLSID_AttachmentServices, nullptr, CLSCTX_ALL,
|
||||
IID_IAttachmentExecute, getter_AddRefs(ae));
|
||||
} MOZ_SEH_EXCEPT(ExceptionFilterFunction(GetExceptionCode())) {
|
||||
return CheckAndSetState(AVSCAN_NOTSTARTED,AVSCAN_FAILED);
|
||||
|
@ -471,7 +471,7 @@ nsDownloadScanner::Scan::DoScanAES()
|
|||
}
|
||||
|
||||
MOZ_SEH_TRY {
|
||||
ae = NULL;
|
||||
ae = nullptr;
|
||||
} MOZ_SEH_EXCEPT(ExceptionFilterFunction(GetExceptionCode())) {
|
||||
gotException = true;
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ nsDownloadScanner::Scan::DoScanAES()
|
|||
void
|
||||
nsDownloadScanner::Scan::DoScan()
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
CoInitialize(nullptr);
|
||||
|
||||
if (DoScanAES()) {
|
||||
// We need to do a few more things on the main thread
|
||||
|
@ -588,7 +588,7 @@ nsDownloadScanner::ScanDownload(nsDownload *download)
|
|||
}
|
||||
|
||||
nsDownloadScannerWatchdog::nsDownloadScannerWatchdog()
|
||||
: mNewItemEvent(NULL), mQuitEvent(NULL) {
|
||||
: mNewItemEvent(nullptr), mQuitEvent(nullptr) {
|
||||
InitializeCriticalSection(&mQueueSync);
|
||||
}
|
||||
nsDownloadScannerWatchdog::~nsDownloadScannerWatchdog() {
|
||||
|
@ -598,10 +598,10 @@ nsDownloadScannerWatchdog::~nsDownloadScannerWatchdog() {
|
|||
nsresult
|
||||
nsDownloadScannerWatchdog::Init() {
|
||||
// Both events are auto-reset
|
||||
mNewItemEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
mNewItemEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
|
||||
if (INVALID_HANDLE_VALUE == mNewItemEvent)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
mQuitEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
mQuitEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
|
||||
if (INVALID_HANDLE_VALUE == mQuitEvent) {
|
||||
(void)CloseHandle(mNewItemEvent);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -609,8 +609,8 @@ nsDownloadScannerWatchdog::Init() {
|
|||
|
||||
// This thread is always running, however it will be asleep
|
||||
// for most of the dlmgr's lifetime
|
||||
mThread = (HANDLE)_beginthreadex(NULL, 0, WatchdogThread,
|
||||
this, 0, NULL);
|
||||
mThread = (HANDLE)_beginthreadex(nullptr, 0, WatchdogThread,
|
||||
this, 0, nullptr);
|
||||
if (!mThread) {
|
||||
(void)CloseHandle(mNewItemEvent);
|
||||
(void)CloseHandle(mQuitEvent);
|
||||
|
@ -667,7 +667,7 @@ nsDownloadScannerWatchdog::WatchdogThread(void *p) {
|
|||
(waitStatus =
|
||||
WaitForMultipleObjects(2, waitHandles, FALSE, INFINITE)) &&
|
||||
waitStatus != WAIT_FAILED) {
|
||||
Scan *scan = NULL;
|
||||
Scan *scan = nullptr;
|
||||
PRTime startTime, expectedEndTime, now;
|
||||
DWORD waitTime;
|
||||
|
||||
|
|
|
@ -253,15 +253,15 @@ NS_DEFINE_NAMED_CID(NS_FILECOMPLETE_CID);
|
|||
NS_DEFINE_NAMED_CID(NS_FILEVIEW_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kFileViewCIDs[] = {
|
||||
{ &kNS_FILECOMPLETE_CID, false, NULL, nsFileCompleteConstructor },
|
||||
{ &kNS_FILEVIEW_CID, false, NULL, nsFileViewConstructor },
|
||||
{ NULL }
|
||||
{ &kNS_FILECOMPLETE_CID, false, nullptr, nsFileCompleteConstructor },
|
||||
{ &kNS_FILEVIEW_CID, false, nullptr, nsFileViewConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kFileViewContracts[] = {
|
||||
{ NS_FILECOMPLETE_CONTRACTID, &kNS_FILECOMPLETE_CID },
|
||||
{ NS_FILEVIEW_CONTRACTID, &kNS_FILEVIEW_CID },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module kFileViewModule = {
|
||||
|
|
|
@ -446,24 +446,24 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCharsetMenu)
|
|||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRDFDataSource)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsIRDFDataSource * nsCharsetMenu::mInner = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserAutodetMenuRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserCharsetMenuRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMoreCharsetMenuRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMore1CharsetMenuRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMore2CharsetMenuRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMore3CharsetMenuRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMore4CharsetMenuRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMore5CharsetMenuRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_MaileditCharsetMenuRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_MailviewCharsetMenuRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_ComposerCharsetMenuRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_DecodersRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_EncodersRoot = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_Name = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_CharsetDetector = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BookmarkSeparator = NULL;
|
||||
nsIRDFResource * nsCharsetMenu::kRDF_type = NULL;
|
||||
nsIRDFDataSource * nsCharsetMenu::mInner = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserAutodetMenuRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserCharsetMenuRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMoreCharsetMenuRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMore1CharsetMenuRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMore2CharsetMenuRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMore3CharsetMenuRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMore4CharsetMenuRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BrowserMore5CharsetMenuRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_MaileditCharsetMenuRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_MailviewCharsetMenuRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_ComposerCharsetMenuRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_DecodersRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_EncodersRoot = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_Name = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_CharsetDetector = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kNC_BookmarkSeparator = nullptr;
|
||||
nsIRDFResource * nsCharsetMenu::kRDF_type = nullptr;
|
||||
|
||||
nsCharsetMenu::nsCharsetMenu()
|
||||
: mInitialized(false),
|
||||
|
@ -629,7 +629,7 @@ nsresult nsCharsetMenu::RefreshMaileditMenu()
|
|||
SetArrayFromEnumerator(encoders, encs);
|
||||
|
||||
// add menu items from pref
|
||||
res = AddFromPrefsToMenu(NULL, container, kMaileditPrefKey, encs, NULL);
|
||||
res = AddFromPrefsToMenu(nullptr, container, kMaileditPrefKey, encs, nullptr);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailedit charset menu from prefs");
|
||||
|
||||
return res;
|
||||
|
@ -714,35 +714,35 @@ nsresult nsCharsetMenu::Init()
|
|||
&kNC_BookmarkSeparator);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_type), &kRDF_type);
|
||||
|
||||
nsIRDFContainerUtils * rdfUtil = NULL;
|
||||
nsIRDFContainerUtils * rdfUtil = nullptr;
|
||||
res = CallGetService(kRDFContainerUtilsCID, &rdfUtil);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserAutodetMenuRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserAutodetMenuRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserCharsetMenuRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserCharsetMenuRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMoreCharsetMenuRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMoreCharsetMenuRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore1CharsetMenuRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore1CharsetMenuRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore2CharsetMenuRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore2CharsetMenuRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore3CharsetMenuRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore3CharsetMenuRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore4CharsetMenuRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore4CharsetMenuRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore5CharsetMenuRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore5CharsetMenuRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_MaileditCharsetMenuRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_MaileditCharsetMenuRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_MailviewCharsetMenuRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_MailviewCharsetMenuRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_ComposerCharsetMenuRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_ComposerCharsetMenuRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_DecodersRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_DecodersRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_EncodersRoot, NULL);
|
||||
res = rdfUtil->MakeSeq(mInner, kNC_EncodersRoot, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
|
||||
done:
|
||||
|
@ -793,9 +793,9 @@ nsresult nsCharsetMenu::FreeResources()
|
|||
/* nsIObserverService has to have released nsCharsetMenu already */
|
||||
}
|
||||
|
||||
mRDFService = NULL;
|
||||
mCCManager = NULL;
|
||||
mPrefs = NULL;
|
||||
mRDFService = nullptr;
|
||||
mCCManager = nullptr;
|
||||
mPrefs = nullptr;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -864,7 +864,8 @@ nsresult nsCharsetMenu::InitMaileditMenu()
|
|||
nsTArray<nsCString> maileditEncoderList;
|
||||
SetArrayFromEnumerator(encoders, maileditEncoderList);
|
||||
|
||||
res = AddFromPrefsToMenu(NULL, container, kMaileditPrefKey, maileditEncoderList, NULL);
|
||||
res = AddFromPrefsToMenu(nullptr, container, kMaileditPrefKey,
|
||||
maileditEncoderList, nullptr);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailedit charset menu from prefs");
|
||||
|
||||
// register prefs callback
|
||||
|
@ -1098,7 +1099,7 @@ nsresult nsCharsetMenu::InitMoreMenu(nsTArray<nsCString>& aDecs,
|
|||
res = ReorderMenuItemArray(&moreMenu);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
|
||||
res = AddMenuItemArrayToContainer(container, &moreMenu, NULL);
|
||||
res = AddMenuItemArrayToContainer(container, &moreMenu, nullptr);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
|
||||
done:
|
||||
|
@ -1127,27 +1128,27 @@ nsresult nsCharsetMenu::InitMoreSubmenus(nsTArray<nsCString>& aDecs)
|
|||
res = NewRDFContainer(mInner, kNC_BrowserMore1CharsetMenuRoot,
|
||||
getter_AddRefs(container1));
|
||||
if (NS_FAILED(res)) return res;
|
||||
AddFromNolocPrefsToMenu(NULL, container1, key1, aDecs, NULL);
|
||||
AddFromNolocPrefsToMenu(nullptr, container1, key1, aDecs, nullptr);
|
||||
|
||||
res = NewRDFContainer(mInner, kNC_BrowserMore2CharsetMenuRoot,
|
||||
getter_AddRefs(container2));
|
||||
if (NS_FAILED(res)) return res;
|
||||
AddFromNolocPrefsToMenu(NULL, container2, key2, aDecs, NULL);
|
||||
AddFromNolocPrefsToMenu(nullptr, container2, key2, aDecs, nullptr);
|
||||
|
||||
res = NewRDFContainer(mInner, kNC_BrowserMore3CharsetMenuRoot,
|
||||
getter_AddRefs(container3));
|
||||
if (NS_FAILED(res)) return res;
|
||||
AddFromNolocPrefsToMenu(NULL, container3, key3, aDecs, NULL);
|
||||
AddFromNolocPrefsToMenu(nullptr, container3, key3, aDecs, nullptr);
|
||||
|
||||
res = NewRDFContainer(mInner, kNC_BrowserMore4CharsetMenuRoot,
|
||||
getter_AddRefs(container4));
|
||||
if (NS_FAILED(res)) return res;
|
||||
AddFromNolocPrefsToMenu(NULL, container4, key4, aDecs, NULL);
|
||||
AddFromNolocPrefsToMenu(nullptr, container4, key4, aDecs, nullptr);
|
||||
|
||||
res = NewRDFContainer(mInner, kNC_BrowserMore5CharsetMenuRoot,
|
||||
getter_AddRefs(container5));
|
||||
if (NS_FAILED(res)) return res;
|
||||
AddFromNolocPrefsToMenu(NULL, container5, key5, aDecs, NULL);
|
||||
AddFromNolocPrefsToMenu(nullptr, container5, key5, aDecs, nullptr);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -1158,12 +1159,12 @@ nsresult nsCharsetMenu::AddCharsetToItemArray(nsTArray<nsMenuEntry*> *aArray,
|
|||
int32_t aPlace)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
nsMenuEntry * item = NULL;
|
||||
nsMenuEntry * item = nullptr;
|
||||
|
||||
if (aResult != NULL) *aResult = NULL;
|
||||
if (aResult != nullptr) *aResult = nullptr;
|
||||
|
||||
item = new nsMenuEntry();
|
||||
if (item == NULL) {
|
||||
if (item == nullptr) {
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
|
@ -1174,7 +1175,7 @@ nsresult nsCharsetMenu::AddCharsetToItemArray(nsTArray<nsMenuEntry*> *aArray,
|
|||
item->mTitle.AssignWithConversion(aCharset.get());
|
||||
}
|
||||
|
||||
if (aArray != NULL) {
|
||||
if (aArray != nullptr) {
|
||||
if (aPlace < 0) {
|
||||
aArray->AppendElement(item);
|
||||
} else {
|
||||
|
@ -1182,13 +1183,13 @@ nsresult nsCharsetMenu::AddCharsetToItemArray(nsTArray<nsMenuEntry*> *aArray,
|
|||
}
|
||||
}
|
||||
|
||||
if (aResult != NULL) *aResult = item;
|
||||
if (aResult != nullptr) *aResult = item;
|
||||
|
||||
// if we have made another reference to "item", do not delete it
|
||||
if ((aArray != NULL) || (aResult != NULL)) item = NULL;
|
||||
if ((aArray != nullptr) || (aResult != nullptr)) item = nullptr;
|
||||
|
||||
done:
|
||||
if (item != NULL) delete item;
|
||||
if (item != nullptr) delete item;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -1202,7 +1203,7 @@ nsCharsetMenu::AddCharsetArrayToItemArray(nsTArray<nsMenuEntry*>& aArray,
|
|||
for (uint32_t i = 0; i < count; i++) {
|
||||
|
||||
const nsCString& str = aCharsets[i];
|
||||
nsresult res = AddCharsetToItemArray(&aArray, str, NULL, -1);
|
||||
nsresult res = AddCharsetToItemArray(&aArray, str, nullptr, -1);
|
||||
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
@ -1224,7 +1225,7 @@ nsresult nsCharsetMenu::AddMenuItemToContainer(
|
|||
nsCOMPtr<nsIRDFResource> node;
|
||||
|
||||
nsAutoCString id;
|
||||
if (aIDPrefix != NULL) id.Assign(aIDPrefix);
|
||||
if (aIDPrefix != nullptr) id.Assign(aIDPrefix);
|
||||
id.Append(aItem->mCharset);
|
||||
|
||||
// Make up a unique ID and create the RDF NODE
|
||||
|
@ -1246,7 +1247,7 @@ nsresult nsCharsetMenu::AddMenuItemToContainer(
|
|||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
if (aType != NULL) {
|
||||
if (aType != nullptr) {
|
||||
if (aPlace < -1) {
|
||||
res = Unassert(node, kRDF_type, aType);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -1281,9 +1282,9 @@ nsresult nsCharsetMenu::AddMenuItemArrayToContainer(
|
|||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
nsMenuEntry * item = aArray->ElementAt(i);
|
||||
if (item == NULL) return NS_ERROR_UNEXPECTED;
|
||||
if (item == nullptr) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
res = AddMenuItemToContainer(aContainer, item, aType, NULL, -1);
|
||||
res = AddMenuItemToContainer(aContainer, item, aType, nullptr, -1);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
|
@ -1298,20 +1299,20 @@ nsresult nsCharsetMenu::AddCharsetToContainer(nsTArray<nsMenuEntry*> *aArray,
|
|||
int32_t aRDFPlace)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
nsMenuEntry * item = NULL;
|
||||
nsMenuEntry * item = nullptr;
|
||||
|
||||
res = AddCharsetToItemArray(aArray, aCharset, &item, aPlace);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
|
||||
res = AddMenuItemToContainer(aContainer, item, NULL, aIDPrefix,
|
||||
res = AddMenuItemToContainer(aContainer, item, nullptr, aIDPrefix,
|
||||
aPlace + aRDFPlace);
|
||||
if (NS_FAILED(res)) goto done;
|
||||
|
||||
// if we have made another reference to "item", do not delete it
|
||||
if (aArray != NULL) item = NULL;
|
||||
if (aArray != nullptr) item = nullptr;
|
||||
|
||||
done:
|
||||
if (item != NULL) delete item;
|
||||
if (item != nullptr) delete item;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -1350,11 +1351,11 @@ nsCharsetMenu::AddFromNolocPrefsToMenu(nsTArray<nsMenuEntry*> * aArray,
|
|||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
char * value = NULL;
|
||||
char * value = nullptr;
|
||||
res = mPrefs->GetCharPref(aKey, &value);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if (value != NULL) {
|
||||
if (value != nullptr) {
|
||||
res = AddFromStringToMenu(value, aArray, aContainer, aDecs, aIDPrefix);
|
||||
nsMemory::Free(value);
|
||||
}
|
||||
|
@ -1414,7 +1415,7 @@ nsresult nsCharsetMenu::AddSeparatorToContainer(nsIRDFContainer * aContainer)
|
|||
item.mTitle.AssignWithConversion(str.get());
|
||||
|
||||
return AddMenuItemToContainer(aContainer, &item, kNC_BookmarkSeparator,
|
||||
NULL, -1);
|
||||
nullptr, -1);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1428,7 +1429,7 @@ nsCharsetMenu::AddCharsetToCache(const nsAFlatCString& aCharset,
|
|||
int32_t i;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
i = FindMenuItemInArray(aArray, aCharset, NULL);
|
||||
i = FindMenuItemInArray(aArray, aCharset, nullptr);
|
||||
if (i >= 0) return res;
|
||||
|
||||
nsCOMPtr<nsIRDFContainer> container;
|
||||
|
@ -1460,7 +1461,7 @@ nsresult nsCharsetMenu::WriteCacheToPrefs(nsTArray<nsMenuEntry*> * aArray,
|
|||
|
||||
for (uint32_t i = aCacheStart; i < count; i++) {
|
||||
nsMenuEntry * item = aArray->ElementAt(i);
|
||||
if (item != NULL) {
|
||||
if (item != nullptr) {
|
||||
cache.Append(item->mCharset);
|
||||
if (i < count - 1) {
|
||||
cache.Append(sep);
|
||||
|
@ -1517,8 +1518,8 @@ nsresult nsCharsetMenu::ClearMenu(nsIRDFContainer * aContainer,
|
|||
uint32_t count = aArray->Length();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
nsMenuEntry * item = aArray->ElementAt(i);
|
||||
if (item != NULL) {
|
||||
res = AddMenuItemToContainer(aContainer, item, NULL, "charset.", -2);
|
||||
if (item != nullptr) {
|
||||
res = AddMenuItemToContainer(aContainer, item, nullptr, "charset.", -2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
}
|
||||
|
@ -1537,8 +1538,8 @@ nsresult nsCharsetMenu::RemoveLastMenuItem(nsIRDFContainer * aContainer,
|
|||
int32_t last = aArray->Length() - 1;
|
||||
if (last >= 0) {
|
||||
nsMenuEntry * item = aArray->ElementAt(last);
|
||||
if (item != NULL) {
|
||||
res = AddMenuItemToContainer(aContainer, item, NULL, "charset.", -2);
|
||||
if (item != nullptr) {
|
||||
res = AddMenuItemToContainer(aContainer, item, nullptr, "charset.", -2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
aArray->RemoveElementAt(last);
|
||||
|
@ -1590,7 +1591,7 @@ void nsCharsetMenu::FreeMenuItemArray(nsTArray<nsMenuEntry*> * aArray)
|
|||
uint32_t count = aArray->Length();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
nsMenuEntry * item = aArray->ElementAt(i);
|
||||
if (item != NULL) {
|
||||
if (item != nullptr) {
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
@ -1606,12 +1607,12 @@ int32_t nsCharsetMenu::FindMenuItemInArray(const nsTArray<nsMenuEntry*>* aArray,
|
|||
for (uint32_t i=0; i < count; i++) {
|
||||
nsMenuEntry * item = aArray->ElementAt(i);
|
||||
if (item->mCharset == aCharset) {
|
||||
if (aResult != NULL) *aResult = item;
|
||||
if (aResult != nullptr) *aResult = item;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
if (aResult != NULL) *aResult = NULL;
|
||||
if (aResult != nullptr) *aResult = nullptr;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ DownloadPlatform* DownloadPlatform::GetDownloadPlatform()
|
|||
#ifdef MOZ_ENABLE_GIO
|
||||
static void gio_set_metadata_done(GObject *source_obj, GAsyncResult *res, gpointer user_data)
|
||||
{
|
||||
GError *err = NULL;
|
||||
g_file_set_attributes_finish(G_FILE(source_obj), res, NULL, &err);
|
||||
GError *err = nullptr;
|
||||
g_file_set_attributes_finish(G_FILE(source_obj), res, nullptr, &err);
|
||||
if (err) {
|
||||
#ifdef DEBUG
|
||||
NS_DebugBreak(NS_DEBUG_WARNING, "Set file metadata failed: ", err->message, __FILE__, __LINE__);
|
||||
|
@ -82,7 +82,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIFile* aTarget,
|
|||
GtkRecentManager* manager = gtk_recent_manager_get_default();
|
||||
|
||||
gchar* uri = g_filename_to_uri(NS_ConvertUTF16toUTF8(path).get(),
|
||||
NULL, NULL);
|
||||
nullptr, nullptr);
|
||||
if (uri) {
|
||||
gtk_recent_manager_add_item(manager, uri);
|
||||
g_free(uri);
|
||||
|
@ -100,7 +100,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIFile* aTarget,
|
|||
file_info,
|
||||
G_FILE_QUERY_INFO_NONE,
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL, gio_set_metadata_done, NULL);
|
||||
nullptr, gio_set_metadata_done, nullptr);
|
||||
g_object_unref(file_info);
|
||||
g_object_unref(gio_file);
|
||||
#endif
|
||||
|
@ -113,7 +113,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIFile* aTarget,
|
|||
kCFStringEncodingUTF8);
|
||||
CFNotificationCenterRef center = ::CFNotificationCenterGetDistributedCenter();
|
||||
::CFNotificationCenterPostNotification(center, CFSTR("com.apple.DownloadFileFinished"),
|
||||
observedObject, NULL, TRUE);
|
||||
observedObject, nullptr, TRUE);
|
||||
::CFRelease(observedObject);
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
|
|
|
@ -28,10 +28,10 @@ DWORD
|
|||
CheckCertificateForPEFile(LPCWSTR filePath,
|
||||
CertificateCheckInfo &infoToMatch)
|
||||
{
|
||||
HCERTSTORE certStore = NULL;
|
||||
HCRYPTMSG cryptMsg = NULL;
|
||||
PCCERT_CONTEXT certContext = NULL;
|
||||
PCMSG_SIGNER_INFO signerInfo = NULL;
|
||||
HCERTSTORE certStore = nullptr;
|
||||
HCRYPTMSG cryptMsg = nullptr;
|
||||
PCCERT_CONTEXT certContext = nullptr;
|
||||
PCMSG_SIGNER_INFO signerInfo = nullptr;
|
||||
DWORD lastError = ERROR_SUCCESS;
|
||||
|
||||
// Get the HCERTSTORE and HCRYPTMSG from the signed file.
|
||||
|
@ -41,17 +41,17 @@ CheckCertificateForPEFile(LPCWSTR filePath,
|
|||
CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED,
|
||||
CERT_QUERY_CONTENT_FLAG_ALL,
|
||||
0, &encoding, &contentType,
|
||||
&formatType, &certStore, &cryptMsg, NULL);
|
||||
&formatType, &certStore, &cryptMsg, nullptr);
|
||||
if (!result) {
|
||||
lastError = GetLastError();
|
||||
LOG_WARN(("CryptQueryObject failed. (%d)", lastError));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Pass in NULL to get the needed signer information size.
|
||||
// Pass in nullptr to get the needed signer information size.
|
||||
DWORD signerInfoSize;
|
||||
result = CryptMsgGetParam(cryptMsg, CMSG_SIGNER_INFO_PARAM, 0,
|
||||
NULL, &signerInfoSize);
|
||||
nullptr, &signerInfoSize);
|
||||
if (!result) {
|
||||
lastError = GetLastError();
|
||||
LOG_WARN(("CryptMsgGetParam failed. (%d)", lastError));
|
||||
|
@ -82,7 +82,7 @@ CheckCertificateForPEFile(LPCWSTR filePath,
|
|||
certInfo.SerialNumber = signerInfo->SerialNumber;
|
||||
certContext = CertFindCertificateInStore(certStore, ENCODING, 0,
|
||||
CERT_FIND_SUBJECT_CERT,
|
||||
(PVOID)&certInfo, NULL);
|
||||
(PVOID)&certInfo, nullptr);
|
||||
if (!certContext) {
|
||||
lastError = GetLastError();
|
||||
LOG_WARN(("CertFindCertificateInStore failed. (%d)", lastError));
|
||||
|
@ -123,14 +123,14 @@ DoCertificateAttributesMatch(PCCERT_CONTEXT certContext,
|
|||
CertificateCheckInfo &infoToMatch)
|
||||
{
|
||||
DWORD dwData;
|
||||
LPTSTR szName = NULL;
|
||||
LPTSTR szName = nullptr;
|
||||
|
||||
if (infoToMatch.issuer) {
|
||||
// Pass in NULL to get the needed size of the issuer buffer.
|
||||
// Pass in nullptr to get the needed size of the issuer buffer.
|
||||
dwData = CertGetNameString(certContext,
|
||||
CERT_NAME_SIMPLE_DISPLAY_TYPE,
|
||||
CERT_NAME_ISSUER_FLAG, NULL,
|
||||
NULL, 0);
|
||||
CERT_NAME_ISSUER_FLAG, nullptr,
|
||||
nullptr, 0);
|
||||
|
||||
if (!dwData) {
|
||||
LOG_WARN(("CertGetNameString failed. (%d)", GetLastError()));
|
||||
|
@ -147,7 +147,7 @@ DoCertificateAttributesMatch(PCCERT_CONTEXT certContext,
|
|||
|
||||
// Get Issuer name.
|
||||
if (!CertGetNameString(certContext, CERT_NAME_SIMPLE_DISPLAY_TYPE,
|
||||
CERT_NAME_ISSUER_FLAG, NULL, szName, dwData)) {
|
||||
CERT_NAME_ISSUER_FLAG, nullptr, szName, dwData)) {
|
||||
LOG_WARN(("CertGetNameString failed. (%d)", GetLastError()));
|
||||
LocalFree(szName);
|
||||
return FALSE;
|
||||
|
@ -161,13 +161,13 @@ DoCertificateAttributesMatch(PCCERT_CONTEXT certContext,
|
|||
}
|
||||
|
||||
LocalFree(szName);
|
||||
szName = NULL;
|
||||
szName = nullptr;
|
||||
}
|
||||
|
||||
if (infoToMatch.name) {
|
||||
// Pass in NULL to get the needed size of the name buffer.
|
||||
// Pass in nullptr to get the needed size of the name buffer.
|
||||
dwData = CertGetNameString(certContext, CERT_NAME_SIMPLE_DISPLAY_TYPE,
|
||||
0, NULL, NULL, 0);
|
||||
0, nullptr, nullptr, 0);
|
||||
if (!dwData) {
|
||||
LOG_WARN(("CertGetNameString failed. (%d)", GetLastError()));
|
||||
return FALSE;
|
||||
|
@ -183,7 +183,7 @@ DoCertificateAttributesMatch(PCCERT_CONTEXT certContext,
|
|||
|
||||
// Obtain the name.
|
||||
if (!(CertGetNameString(certContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0,
|
||||
NULL, szName, dwData))) {
|
||||
nullptr, szName, dwData))) {
|
||||
LOG_WARN(("CertGetNameString failed. (%d)", GetLastError()));
|
||||
LocalFree(szName);
|
||||
return FALSE;
|
||||
|
@ -240,21 +240,21 @@ VerifyCertificateTrustForFile(LPCWSTR filePath)
|
|||
WINTRUST_DATA trustData;
|
||||
ZeroMemory(&trustData, sizeof(trustData));
|
||||
trustData.cbStruct = sizeof(trustData);
|
||||
trustData.pPolicyCallbackData = NULL;
|
||||
trustData.pSIPClientData = NULL;
|
||||
trustData.pPolicyCallbackData = nullptr;
|
||||
trustData.pSIPClientData = nullptr;
|
||||
trustData.dwUIChoice = WTD_UI_NONE;
|
||||
trustData.fdwRevocationChecks = WTD_REVOKE_NONE;
|
||||
trustData.dwUnionChoice = WTD_CHOICE_FILE;
|
||||
trustData.dwStateAction = 0;
|
||||
trustData.hWVTStateData = NULL;
|
||||
trustData.pwszURLReference = NULL;
|
||||
trustData.hWVTStateData = nullptr;
|
||||
trustData.pwszURLReference = nullptr;
|
||||
// no UI
|
||||
trustData.dwUIContext = 0;
|
||||
trustData.pFile = &fileToCheck;
|
||||
|
||||
GUID policyGUID = WINTRUST_ACTION_GENERIC_VERIFY_V2;
|
||||
// Check if the file is signed by something that is trusted.
|
||||
LONG ret = WinVerifyTrust(NULL, &policyGUID, &trustData);
|
||||
LONG ret = WinVerifyTrust(nullptr, &policyGUID, &trustData);
|
||||
if (ERROR_SUCCESS == ret) {
|
||||
// The hash that represents the subject is trusted and there were no
|
||||
// verification errors. No publisher nor time stamp chain errors.
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
#include "updatehelper.h"
|
||||
|
||||
SERVICE_STATUS gSvcStatus = { 0 };
|
||||
SERVICE_STATUS_HANDLE gSvcStatusHandle = NULL;
|
||||
HANDLE gWorkDoneEvent = NULL;
|
||||
HANDLE gThread = NULL;
|
||||
SERVICE_STATUS_HANDLE gSvcStatusHandle = nullptr;
|
||||
HANDLE gWorkDoneEvent = nullptr;
|
||||
HANDLE gThread = nullptr;
|
||||
bool gServiceControlStopping = false;
|
||||
|
||||
// logs are pretty small, about 20 lines, so 10 seems reasonable.
|
||||
|
@ -100,7 +100,7 @@ wmain(int argc, WCHAR **argv)
|
|||
|
||||
SERVICE_TABLE_ENTRYW DispatchTable[] = {
|
||||
{ SVC_NAME, (LPSERVICE_MAIN_FUNCTIONW) SvcMain },
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
// This call returns when the service has stopped.
|
||||
|
@ -121,7 +121,7 @@ wmain(int argc, WCHAR **argv)
|
|||
BOOL
|
||||
GetLogDirectoryPath(WCHAR *path)
|
||||
{
|
||||
HRESULT hr = SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL,
|
||||
HRESULT hr = SHGetFolderPathW(nullptr, CSIDL_COMMON_APPDATA, nullptr,
|
||||
SHGFP_TYPE_CURRENT, path);
|
||||
if (FAILED(hr)) {
|
||||
return FALSE;
|
||||
|
@ -132,12 +132,12 @@ GetLogDirectoryPath(WCHAR *path)
|
|||
}
|
||||
// The directory should already be created from the installer, but
|
||||
// just to be safe in case someone deletes.
|
||||
CreateDirectoryW(path, NULL);
|
||||
CreateDirectoryW(path, nullptr);
|
||||
|
||||
if (!PathAppendSafe(path, L"logs")) {
|
||||
return FALSE;
|
||||
}
|
||||
CreateDirectoryW(path, NULL);
|
||||
CreateDirectoryW(path, nullptr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -222,8 +222,8 @@ StartTerminationThread()
|
|||
{
|
||||
// If the process does not self terminate like it should, this thread
|
||||
// will terminate the process after 5 seconds.
|
||||
HANDLE thread = CreateThread(NULL, 0, EnsureProcessTerminatedThread,
|
||||
NULL, 0, NULL);
|
||||
HANDLE thread = CreateThread(nullptr, 0, EnsureProcessTerminatedThread,
|
||||
nullptr, 0, nullptr);
|
||||
if (thread) {
|
||||
CloseHandle(thread);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ SvcMain(DWORD argc, LPWSTR *argv)
|
|||
|
||||
// Disable every privilege we don't need. Processes started using
|
||||
// CreateProcess will use the same token as this process.
|
||||
UACHelper::DisablePrivileges(NULL);
|
||||
UACHelper::DisablePrivileges(nullptr);
|
||||
|
||||
// Register the handler function for the service
|
||||
gSvcStatusHandle = RegisterServiceCtrlHandlerW(SVC_NAME, SvcCtrlHandler);
|
||||
|
@ -264,7 +264,7 @@ SvcMain(DWORD argc, LPWSTR *argv)
|
|||
|
||||
// This event will be used to tell the SvcCtrlHandler when the work is
|
||||
// done for when a stop comamnd is manually issued.
|
||||
gWorkDoneEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
gWorkDoneEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
|
||||
if (!gWorkDoneEvent) {
|
||||
ReportSvcStatus(SERVICE_STOPPED, 1, 0);
|
||||
StartTerminationThread();
|
||||
|
@ -340,7 +340,7 @@ StopServiceAndWaitForCommandThread(LPVOID)
|
|||
ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, 1000);
|
||||
} while(WaitForSingleObject(gWorkDoneEvent, 100) == WAIT_TIMEOUT);
|
||||
CloseHandle(gWorkDoneEvent);
|
||||
gWorkDoneEvent = NULL;
|
||||
gWorkDoneEvent = nullptr;
|
||||
ReportSvcStatus(SERVICE_STOPPED, NO_ERROR, 0);
|
||||
StartTerminationThread();
|
||||
return 0;
|
||||
|
@ -368,15 +368,16 @@ SvcCtrlHandler(DWORD dwCtrl)
|
|||
|
||||
// The SvcCtrlHandler thread should not spend more than 30 seconds in
|
||||
// shutdown so we spawn a new thread for stopping the service
|
||||
HANDLE thread = CreateThread(NULL, 0, StopServiceAndWaitForCommandThread,
|
||||
NULL, 0, NULL);
|
||||
HANDLE thread = CreateThread(nullptr, 0,
|
||||
StopServiceAndWaitForCommandThread,
|
||||
nullptr, 0, nullptr);
|
||||
if (thread) {
|
||||
CloseHandle(thread);
|
||||
} else {
|
||||
// Couldn't start the thread so just call the stop ourselves.
|
||||
// If it happens to take longer than 30 seconds the caller will
|
||||
// get an error.
|
||||
StopServiceAndWaitForCommandThread(NULL);
|
||||
StopServiceAndWaitForCommandThread(nullptr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -55,8 +55,9 @@ DoesBinaryMatchAllowedCertificates(LPCWSTR basePathForUpdate, LPCWSTR filePath)
|
|||
|
||||
// Get the number of subkeys.
|
||||
DWORD subkeyCount = 0;
|
||||
retCode = RegQueryInfoKeyW(baseKey, NULL, NULL, NULL, &subkeyCount, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
retCode = RegQueryInfoKeyW(baseKey, nullptr, nullptr, nullptr, &subkeyCount,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr);
|
||||
if (retCode != ERROR_SUCCESS) {
|
||||
LOG_WARN(("Could not query info key. (%d)", retCode));
|
||||
return FALSE;
|
||||
|
@ -67,8 +68,8 @@ DoesBinaryMatchAllowedCertificates(LPCWSTR basePathForUpdate, LPCWSTR filePath)
|
|||
WCHAR subkeyBuffer[MAX_KEY_LENGTH];
|
||||
DWORD subkeyBufferCount = MAX_KEY_LENGTH;
|
||||
retCode = RegEnumKeyExW(baseKey, i, subkeyBuffer,
|
||||
&subkeyBufferCount, NULL,
|
||||
NULL, NULL, NULL);
|
||||
&subkeyBufferCount, nullptr,
|
||||
nullptr, nullptr, nullptr);
|
||||
if (retCode != ERROR_SUCCESS) {
|
||||
LOG_WARN(("Could not enum certs. (%d)", retCode));
|
||||
return FALSE;
|
||||
|
@ -93,7 +94,7 @@ DoesBinaryMatchAllowedCertificates(LPCWSTR basePathForUpdate, LPCWSTR filePath)
|
|||
WCHAR issuer[MAX_CHAR_COUNT] = { L'\0' };
|
||||
|
||||
// Get the name from the registry
|
||||
retCode = RegQueryValueExW(subKey, L"name", 0, NULL,
|
||||
retCode = RegQueryValueExW(subKey, L"name", 0, nullptr,
|
||||
(LPBYTE)name, &valueBufSize);
|
||||
if (retCode != ERROR_SUCCESS) {
|
||||
LOG_WARN(("Could not obtain name from registry. (%d)", retCode));
|
||||
|
@ -102,7 +103,7 @@ DoesBinaryMatchAllowedCertificates(LPCWSTR basePathForUpdate, LPCWSTR filePath)
|
|||
|
||||
// Get the issuer from the registry
|
||||
valueBufSize = MAX_CHAR_COUNT * sizeof(WCHAR);
|
||||
retCode = RegQueryValueExW(subKey, L"issuer", 0, NULL,
|
||||
retCode = RegQueryValueExW(subKey, L"issuer", 0, nullptr,
|
||||
(LPBYTE)issuer, &valueBufSize);
|
||||
if (retCode != ERROR_SUCCESS) {
|
||||
LOG_WARN(("Could not obtain issuer from registry. (%d)", retCode));
|
||||
|
|
|
@ -21,18 +21,18 @@ VerifySameFiles(LPCWSTR file1Path, LPCWSTR file2Path, BOOL &sameContent)
|
|||
{
|
||||
sameContent = FALSE;
|
||||
nsAutoHandle file1(CreateFileW(file1Path, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, 0, NULL));
|
||||
nullptr, OPEN_EXISTING, 0, nullptr));
|
||||
if (INVALID_HANDLE_VALUE == file1) {
|
||||
return FALSE;
|
||||
}
|
||||
nsAutoHandle file2(CreateFileW(file2Path, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, 0, NULL));
|
||||
nullptr, OPEN_EXISTING, 0, nullptr));
|
||||
if (INVALID_HANDLE_VALUE == file2) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DWORD fileSize1 = GetFileSize(file1, NULL);
|
||||
DWORD fileSize2 = GetFileSize(file2, NULL);
|
||||
DWORD fileSize1 = GetFileSize(file1, nullptr);
|
||||
DWORD fileSize2 = GetFileSize(file2, nullptr);
|
||||
if (INVALID_FILE_SIZE == fileSize1 || INVALID_FILE_SIZE == fileSize2) {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -48,12 +48,12 @@ VerifySameFiles(LPCWSTR file1Path, LPCWSTR file2Path, BOOL &sameContent)
|
|||
DWORD leftOver = fileSize1 % COMPARE_BLOCKSIZE;
|
||||
DWORD readAmount;
|
||||
for (DWORD i = 0; i < numBlocks; i++) {
|
||||
if (!ReadFile(file1, buf1, COMPARE_BLOCKSIZE, &readAmount, NULL) ||
|
||||
if (!ReadFile(file1, buf1, COMPARE_BLOCKSIZE, &readAmount, nullptr) ||
|
||||
readAmount != COMPARE_BLOCKSIZE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!ReadFile(file2, buf2, COMPARE_BLOCKSIZE, &readAmount, NULL) ||
|
||||
if (!ReadFile(file2, buf2, COMPARE_BLOCKSIZE, &readAmount, nullptr) ||
|
||||
readAmount != COMPARE_BLOCKSIZE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -65,12 +65,12 @@ VerifySameFiles(LPCWSTR file1Path, LPCWSTR file2Path, BOOL &sameContent)
|
|||
}
|
||||
|
||||
if (leftOver) {
|
||||
if (!ReadFile(file1, buf1, leftOver, &readAmount, NULL) ||
|
||||
if (!ReadFile(file1, buf1, leftOver, &readAmount, nullptr) ||
|
||||
readAmount != leftOver) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!ReadFile(file2, buf2, leftOver, &readAmount, NULL) ||
|
||||
if (!ReadFile(file2, buf2, leftOver, &readAmount, nullptr) ||
|
||||
readAmount != leftOver) {
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ BOOL
|
|||
UpdateServiceDescription(SC_HANDLE serviceHandle)
|
||||
{
|
||||
WCHAR updaterINIPath[MAX_PATH + 1];
|
||||
if (!GetModuleFileNameW(NULL, updaterINIPath,
|
||||
if (!GetModuleFileNameW(nullptr, updaterINIPath,
|
||||
sizeof(updaterINIPath) /
|
||||
sizeof(updaterINIPath[0]))) {
|
||||
LOG_WARN(("Could not obtain module filename when attempting to "
|
||||
|
@ -213,8 +213,8 @@ FixServicePath(SC_HANDLE service,
|
|||
|
||||
|
||||
if (!ChangeServiceConfigW(service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE,
|
||||
SERVICE_NO_CHANGE, fixedPath, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL)) {
|
||||
SERVICE_NO_CHANGE, fixedPath, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr)) {
|
||||
LOG_WARN(("Could not fix service path. (%d)", GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ BOOL
|
|||
SvcInstall(SvcInstallAction action)
|
||||
{
|
||||
// Get a handle to the local computer SCM database with full access rights.
|
||||
nsAutoServiceHandle schSCManager(OpenSCManager(NULL, NULL,
|
||||
nsAutoServiceHandle schSCManager(OpenSCManager(nullptr, nullptr,
|
||||
SC_MANAGER_ALL_ACCESS));
|
||||
if (!schSCManager) {
|
||||
LOG_WARN(("Could not open service manager. (%d)", GetLastError()));
|
||||
|
@ -243,7 +243,7 @@ SvcInstall(SvcInstallAction action)
|
|||
}
|
||||
|
||||
WCHAR newServiceBinaryPath[MAX_PATH + 1];
|
||||
if (!GetModuleFileNameW(NULL, newServiceBinaryPath,
|
||||
if (!GetModuleFileNameW(nullptr, newServiceBinaryPath,
|
||||
sizeof(newServiceBinaryPath) /
|
||||
sizeof(newServiceBinaryPath[0]))) {
|
||||
LOG_WARN(("Could not obtain module filename when attempting to "
|
||||
|
@ -276,7 +276,7 @@ SvcInstall(SvcInstallAction action)
|
|||
|
||||
// The service exists and we opened it
|
||||
DWORD bytesNeeded;
|
||||
if (!QueryServiceConfigW(schService, NULL, 0, &bytesNeeded) &&
|
||||
if (!QueryServiceConfigW(schService, nullptr, 0, &bytesNeeded) &&
|
||||
GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
|
||||
LOG_WARN(("Could not determine buffer size for query service config. (%d)",
|
||||
GetLastError()));
|
||||
|
@ -439,7 +439,8 @@ SvcInstall(SvcInstallAction action)
|
|||
// We made a copy of ourselves to the existing location.
|
||||
// The tmp file (the process of which we are executing right now) will be
|
||||
// left over. Attempt to delete the file on the next reboot.
|
||||
if (MoveFileExW(newServiceBinaryPath, NULL, MOVEFILE_DELAY_UNTIL_REBOOT)) {
|
||||
if (MoveFileExW(newServiceBinaryPath, nullptr,
|
||||
MOVEFILE_DELAY_UNTIL_REBOOT)) {
|
||||
LOG(("Deleting the old file path on the next reboot: %ls.",
|
||||
newServiceBinaryPath));
|
||||
} else {
|
||||
|
@ -453,7 +454,7 @@ SvcInstall(SvcInstallAction action)
|
|||
// We don't need to copy ourselves to the existing location.
|
||||
// The tmp file (the process of which we are executing right now) will be
|
||||
// left over. Attempt to delete the file on the next reboot.
|
||||
MoveFileExW(newServiceBinaryPath, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
|
||||
MoveFileExW(newServiceBinaryPath, nullptr, MOVEFILE_DELAY_UNTIL_REBOOT);
|
||||
|
||||
// nothing to do, we already have a newer service installed
|
||||
return TRUE;
|
||||
|
@ -471,8 +472,8 @@ SvcInstall(SvcInstallAction action)
|
|||
schService.own(CreateServiceW(schSCManager, SVC_NAME, SVC_DISPLAY_NAME,
|
||||
SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
|
||||
SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL,
|
||||
newServiceBinaryPath, NULL, NULL, NULL,
|
||||
NULL, NULL));
|
||||
newServiceBinaryPath, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr));
|
||||
if (!schService) {
|
||||
LOG_WARN(("Could not create Windows service. "
|
||||
"This error should never happen since a service install "
|
||||
|
@ -501,7 +502,7 @@ BOOL
|
|||
StopService()
|
||||
{
|
||||
// Get a handle to the local computer SCM database with full access rights.
|
||||
nsAutoServiceHandle schSCManager(OpenSCManager(NULL, NULL,
|
||||
nsAutoServiceHandle schSCManager(OpenSCManager(nullptr, nullptr,
|
||||
SC_MANAGER_ALL_ACCESS));
|
||||
if (!schSCManager) {
|
||||
LOG_WARN(("Could not open service manager. (%d)", GetLastError()));
|
||||
|
@ -547,7 +548,7 @@ BOOL
|
|||
SvcUninstall()
|
||||
{
|
||||
// Get a handle to the local computer SCM database with full access rights.
|
||||
nsAutoServiceHandle schSCManager(OpenSCManager(NULL, NULL,
|
||||
nsAutoServiceHandle schSCManager(OpenSCManager(nullptr, nullptr,
|
||||
SC_MANAGER_ALL_ACCESS));
|
||||
if (!schSCManager) {
|
||||
LOG_WARN(("Could not open service manager. (%d)", GetLastError()));
|
||||
|
@ -597,8 +598,8 @@ SvcUninstall()
|
|||
BOOL
|
||||
SetUserAccessServiceDACL(SC_HANDLE hService)
|
||||
{
|
||||
PACL pNewAcl = NULL;
|
||||
PSECURITY_DESCRIPTOR psd = NULL;
|
||||
PACL pNewAcl = nullptr;
|
||||
PSECURITY_DESCRIPTOR psd = nullptr;
|
||||
DWORD lastError = SetUserAccessServiceDACL(hService, pNewAcl, psd);
|
||||
if (pNewAcl) {
|
||||
LocalFree((HLOCAL)pNewAcl);
|
||||
|
@ -649,7 +650,7 @@ SetUserAccessServiceDACL(SC_HANDLE hService, PACL &pNewAcl,
|
|||
}
|
||||
|
||||
// Get the current DACL from the security descriptor.
|
||||
PACL pacl = NULL;
|
||||
PACL pacl = nullptr;
|
||||
BOOL bDaclPresent = FALSE;
|
||||
BOOL bDaclDefaulted = FALSE;
|
||||
if ( !GetSecurityDescriptorDacl(psd, &bDaclPresent, &pacl,
|
||||
|
@ -666,7 +667,7 @@ SetUserAccessServiceDACL(SC_HANDLE hService, PACL &pNewAcl,
|
|||
return GetLastError();
|
||||
}
|
||||
|
||||
if (!CreateWellKnownSid(WinBuiltinUsersSid, NULL, sid, &SIDSize)) {
|
||||
if (!CreateWellKnownSid(WinBuiltinUsersSid, nullptr, sid, &SIDSize)) {
|
||||
DWORD lastError = GetLastError();
|
||||
LOG_WARN(("Could not create well known SID. (%d)", lastError));
|
||||
LocalFree(sid);
|
||||
|
@ -681,7 +682,7 @@ SetUserAccessServiceDACL(SC_HANDLE hService, PACL &pNewAcl,
|
|||
WCHAR domainName[DNLEN + 1] = { L'\0' };
|
||||
DWORD accountNameSize = UNLEN + 1;
|
||||
DWORD domainNameSize = DNLEN + 1;
|
||||
if (!LookupAccountSidW(NULL, sid, accountName,
|
||||
if (!LookupAccountSidW(nullptr, sid, accountName,
|
||||
&accountNameSize,
|
||||
domainName, &domainNameSize, &accountType)) {
|
||||
LOG_WARN(("Could not lookup account Sid, will try Users. (%d)",
|
||||
|
@ -691,7 +692,7 @@ SetUserAccessServiceDACL(SC_HANDLE hService, PACL &pNewAcl,
|
|||
|
||||
// We already have the group name so we can get rid of the SID
|
||||
FreeSid(sid);
|
||||
sid = NULL;
|
||||
sid = nullptr;
|
||||
|
||||
// Build the ACE, BuildExplicitAccessWithName cannot fail so it is not logged.
|
||||
EXPLICIT_ACCESS ea;
|
||||
|
|
Загрузка…
Ссылка в новой задаче