diff --git a/xpcom/base/AvailableMemoryTracker.cpp b/xpcom/base/AvailableMemoryTracker.cpp index 9fca531604f..da96467185d 100644 --- a/xpcom/base/AvailableMemoryTracker.cpp +++ b/xpcom/base/AvailableMemoryTracker.cpp @@ -149,18 +149,16 @@ volatile PRIntervalTime sLastLowMemoryNotificationTime; // These are function pointers to the functions we wrap in Init(). -void* (WINAPI* sVirtualAllocOrig) - (LPVOID aAddress, SIZE_T aSize, DWORD aAllocationType, DWORD aProtect); +void* (WINAPI* sVirtualAllocOrig)(LPVOID aAddress, SIZE_T aSize, + DWORD aAllocationType, DWORD aProtect); -void* (WINAPI* sMapViewOfFileOrig) - (HANDLE aFileMappingObject, DWORD aDesiredAccess, - DWORD aFileOffsetHigh, DWORD aFileOffsetLow, - SIZE_T aNumBytesToMap); +void* (WINAPI* sMapViewOfFileOrig)(HANDLE aFileMappingObject, + DWORD aDesiredAccess, DWORD aFileOffsetHigh, + DWORD aFileOffsetLow, SIZE_T aNumBytesToMap); -HBITMAP (WINAPI* sCreateDIBSectionOrig) - (HDC aDC, const BITMAPINFO* aBitmapInfo, - UINT aUsage, VOID** aBits, - HANDLE aSection, DWORD aOffset); +HBITMAP(WINAPI* sCreateDIBSectionOrig)(HDC aDC, const BITMAPINFO* aBitmapInfo, + UINT aUsage, VOID** aBits, + HANDLE aSection, DWORD aOffset); /** * Fire a memory pressure event if it's been long enough since the last one we diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index 3b205485c4f..d656afd60c5 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -157,7 +157,8 @@ TraceWeakMappingChild(JSTracer* aTrc, void** aThingp, JSGCTraceKind aKind) } if (AddToCCKind(aKind)) { - tracer->mCb.NoteWeakMapping(tracer->mMap, tracer->mKey, tracer->mKeyDelegate, thing); + tracer->mCb.NoteWeakMapping(tracer->mMap, tracer->mKey, + tracer->mKeyDelegate, thing); tracer->mTracedAny = true; } else { JS_TraceChildren(aTrc, thing, aKind); @@ -305,7 +306,8 @@ struct Closure }; static void -CheckParticipatesInCycleCollection(void* aThing, const char* aName, void* aClosure) +CheckParticipatesInCycleCollection(void* aThing, const char* aName, + void* aClosure) { Closure* closure = static_cast(aClosure); @@ -346,9 +348,9 @@ NS_IMETHODIMP JSGCThingParticipant::Traverse(void* aPtr, nsCycleCollectionTraversalCallback& aCb) { - CycleCollectedJSRuntime* runtime = reinterpret_cast - (reinterpret_cast(this) - - offsetof(CycleCollectedJSRuntime, mGCThingCycleCollectorGlobal)); + auto runtime = reinterpret_cast( + reinterpret_cast(this) - offsetof(CycleCollectedJSRuntime, + mGCThingCycleCollectorGlobal)); runtime->TraverseGCThing(CycleCollectedJSRuntime::TRAVERSE_FULL, aPtr, js::GCThingTraceKind(aPtr), aCb); @@ -362,9 +364,9 @@ static JSGCThingParticipant sGCThingCycleCollectorGlobal; NS_IMETHODIMP JSZoneParticipant::Traverse(void* aPtr, nsCycleCollectionTraversalCallback& aCb) { - CycleCollectedJSRuntime* runtime = reinterpret_cast - (reinterpret_cast(this) - - offsetof(CycleCollectedJSRuntime, mJSZoneCycleCollectorGlobal)); + auto runtime = reinterpret_cast( + reinterpret_cast(this) - offsetof(CycleCollectedJSRuntime, + mJSZoneCycleCollectorGlobal)); MOZ_ASSERT(!aCb.WantAllTraces()); JS::Zone* zone = static_cast(aPtr); @@ -489,7 +491,8 @@ CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSRuntime* aParentRuntime, JS_SetGrayGCRootsTracer(mJSRuntime, TraceGrayJS, this); JS_SetGCCallback(mJSRuntime, GCCallback, this); JS::SetOutOfMemoryCallback(mJSRuntime, OutOfMemoryCallback, this); - JS::SetLargeAllocationFailureCallback(mJSRuntime, LargeAllocationFailureCallback, this); + JS::SetLargeAllocationFailureCallback(mJSRuntime, + LargeAllocationFailureCallback, this); JS_SetContextCallback(mJSRuntime, ContextCallback, this); JS_SetDestroyZoneCallback(mJSRuntime, XPCStringConvert::FreeZoneCache); JS_SetSweepZoneCallback(mJSRuntime, XPCStringConvert::ClearZoneCache); @@ -612,7 +615,8 @@ CycleCollectedJSRuntime::NoteGCThingJSChildren(void* aThing, } void -CycleCollectedJSRuntime::NoteGCThingXPCOMChildren(const js::Class* aClasp, JSObject* aObj, +CycleCollectedJSRuntime::NoteGCThingXPCOMChildren(const js::Class* aClasp, + JSObject* aObj, nsCycleCollectionTraversalCallback& aCb) const { MOZ_ASSERT(aClasp); @@ -765,7 +769,7 @@ CycleCollectedJSRuntime::GCCallback(JSRuntime* aRuntime, } /* static */ void -CycleCollectedJSRuntime::OutOfMemoryCallback(JSContext *aContext, +CycleCollectedJSRuntime::OutOfMemoryCallback(JSContext* aContext, void* aData) { CycleCollectedJSRuntime* self = static_cast(aData); @@ -1101,7 +1105,8 @@ IncrementalFinalizeRunnable::IncrementalFinalizeRunnable(CycleCollectedJSRuntime , mFinalizeFunctionToRun(0) { this->mSupports.SwapElements(aSupports); - DeferredFinalizeFunctionHolder* function = mDeferredFinalizeFunctions.AppendElement(); + DeferredFinalizeFunctionHolder* function = + mDeferredFinalizeFunctions.AppendElement(); function->run = ReleaseSliceNow; function->data = &this->mSupports; @@ -1201,8 +1206,9 @@ CycleCollectedJSRuntime::FinalizeDeferredThings(DeferredFinalizeType aType) } } -void -CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState *aStatePtr, OOMState aNewState) +void +CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState* aStatePtr, + OOMState aNewState) { *aStatePtr = aNewState; #ifdef MOZ_CRASHREPORTER diff --git a/xpcom/base/SystemMemoryReporter.cpp b/xpcom/base/SystemMemoryReporter.cpp index 84e966ad075..3ce44995dcd 100644 --- a/xpcom/base/SystemMemoryReporter.cpp +++ b/xpcom/base/SystemMemoryReporter.cpp @@ -163,8 +163,9 @@ public: { // There is lots of privacy-sensitive data in /proc. Just skip this // reporter entirely when anonymization is required. - if (aAnonymize) + if (aAnonymize) { return NS_OK; + } if (!Preferences::GetBool("memory.system_memory_reporter")) { return NS_OK; @@ -213,12 +214,12 @@ private: class ProcessSizes { public: - void Add(const nsACString &aKey, size_t aSize) + void Add(const nsACString& aKey, size_t aSize) { mTagged.Put(aKey, mTagged.Get(aKey) + aSize); } - void Report(nsIHandleReportCallback *aHandleReport, nsISupports *aData) + void Report(nsIHandleReportCallback* aHandleReport, nsISupports* aData) { EnumArgs env = { aHandleReport, aData }; mTagged.EnumerateRead(ReportSizes, &env); @@ -227,16 +228,17 @@ private: private: nsDataHashtable mTagged; - struct EnumArgs { + struct EnumArgs + { nsIHandleReportCallback* mHandleReport; nsISupports* mData; }; static PLDHashOperator ReportSizes(nsCStringHashKey::KeyType aKey, size_t aAmount, - void *aUserArg) + void* aUserArg) { - const EnumArgs *envp = reinterpret_cast(aUserArg); + const EnumArgs* envp = reinterpret_cast(aUserArg); nsAutoCString path("processes/"); path.Append(aKey); @@ -335,8 +337,8 @@ private: // Report the open file descriptors for this process. nsPrintfCString procFdPath("/proc/%s/fd", pidStr); - rv = CollectOpenFileReports( - aHandleReport, aData, procFdPath, processName); + rv = CollectOpenFileReports(aHandleReport, aData, procFdPath, + processName); if (NS_FAILED(rv)) { break; } @@ -947,12 +949,12 @@ private: #undef CHECK_PREFIX const nsCString processName(aProcessName); - nsPrintfCString entryPath( - "open-fds/%s/%s%s/%s", processName.get(), category, linkPath, fd); - nsPrintfCString entryDescription( - "%s file descriptor opened by the process", descriptionPrefix); - REPORT_WITH_CLEANUP( - entryPath, UNITS_COUNT, 1, entryDescription, closedir(d)); + nsPrintfCString entryPath("open-fds/%s/%s%s/%s", + processName.get(), category, linkPath, fd); + nsPrintfCString entryDescription("%s file descriptor opened by the process", + descriptionPrefix); + REPORT_WITH_CLEANUP(entryPath, UNITS_COUNT, 1, entryDescription, + closedir(d)); } } @@ -973,8 +975,8 @@ private: // For simplicity numbers will be uint64_t, strings 63 chars max. const char* const kScanFormat = - "%" SCNx64 " %" SCNx64 " %" SCNu64 " %" SCNu64 - " %63s %63s %63s %" SCNu64; + "%" SCNx64 " %" SCNx64 " %" SCNu64 " %" SCNu64 + " %63s %63s %63s %" SCNu64; const int kNumFields = 8; const size_t kStringSize = 64; diff --git a/xpcom/base/VisualEventTracer.cpp b/xpcom/base/VisualEventTracer.cpp index f6b7d401a74..4a775383c6c 100644 --- a/xpcom/base/VisualEventTracer.cpp +++ b/xpcom/base/VisualEventTracer.cpp @@ -439,7 +439,8 @@ Init() gEventFilter = EventFilter::Build(logEvents); } - PRStatus status = PR_NewThreadPrivateIndex(&gThreadPrivateIndex, &RecordBatch::Close); + PRStatus status = PR_NewThreadPrivateIndex(&gThreadPrivateIndex, + &RecordBatch::Close); if (status != PR_SUCCESS) { return; } @@ -497,8 +498,8 @@ Mark(uint32_t aType, void* aItem, const char* aText, const char* aText2) return; } - RecordBatch* threadLogPrivate = static_cast( - PR_GetThreadPrivate(gThreadPrivateIndex)); + RecordBatch* threadLogPrivate = + static_cast(PR_GetThreadPrivate(gThreadPrivateIndex)); if (!threadLogPrivate) { threadLogPrivate = RecordBatch::Register(); if (!threadLogPrivate) { diff --git a/xpcom/base/nsConsoleService.cpp b/xpcom/base/nsConsoleService.cpp index df028a4d2f0..8fdbedbc6c3 100644 --- a/xpcom/base/nsConsoleService.cpp +++ b/xpcom/base/nsConsoleService.cpp @@ -34,7 +34,9 @@ using namespace mozilla; NS_IMPL_ADDREF(nsConsoleService) NS_IMPL_RELEASE(nsConsoleService) -NS_IMPL_CLASSINFO(nsConsoleService, nullptr, nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON, NS_CONSOLESERVICE_CID) +NS_IMPL_CLASSINFO(nsConsoleService, nullptr, + nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON, + NS_CONSOLESERVICE_CID) NS_IMPL_QUERY_INTERFACE_CI(nsConsoleService, nsIConsoleService) NS_IMPL_CI_INTERFACE_GETTER(nsConsoleService, nsIConsoleService) @@ -57,7 +59,7 @@ nsConsoleService::nsConsoleService() nsConsoleService::~nsConsoleService() { uint32_t i = 0; - while (i < mBufferSize && mMessages[i] != nullptr) { + while (i < mBufferSize && mMessages[i]) { NS_RELEASE(mMessages[i]); i++; } @@ -266,7 +268,8 @@ nsConsoleService::LogStringMessage(const char16_t* aMessage) } NS_IMETHODIMP -nsConsoleService::GetMessageArray(uint32_t* aCount, nsIConsoleMessage*** aMessages) +nsConsoleService::GetMessageArray(uint32_t* aCount, + nsIConsoleMessage*** aMessages) { nsIConsoleMessage** messageArray; diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index d0e8cdc18b5..9ddd8fe9008 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -383,7 +383,8 @@ public: private: struct Block; - union PtrInfoOrBlock { + union PtrInfoOrBlock + { // Use a union to avoid reinterpret_cast and the ensuing // potential aliasing bugs. PtrInfo* ptrInfo; @@ -430,15 +431,9 @@ public: class Iterator { public: - Iterator() : mPointer(nullptr) - { - } - explicit Iterator(PtrInfoOrBlock* aPointer) : mPointer(aPointer) - { - } - Iterator(const Iterator& aOther) : mPointer(aOther.mPointer) - { - } + Iterator() : mPointer(nullptr) {} + explicit Iterator(PtrInfoOrBlock* aPointer) : mPointer(aPointer) {} + Iterator(const Iterator& aOther) : mPointer(aOther.mPointer) {} Iterator& operator++() { @@ -963,7 +958,8 @@ CanonicalizeParticipant(void** aParti, nsCycleCollectionParticipant** aCp) struct nsPurpleBufferEntry { - union { + union + { void* mObject; // when low bit unset nsPurpleBufferEntry* mNextInFreeList; // when low bit set }; @@ -998,7 +994,7 @@ private: ); } - template + template void VisitEntries(nsPurpleBuffer& aBuffer, PurpleVisitor& aVisitor) { nsPurpleBufferEntry* eEnd = ArrayEnd(mEntries); @@ -1027,7 +1023,7 @@ public: FreeBlocks(); } - template + template void VisitEntries(PurpleVisitor& aVisitor) { for (Block* b = &mFirstBlock; b; b = b->mNext) { @@ -1218,14 +1214,16 @@ nsPurpleBuffer::SelectPointers(CCGraphBuilder& aBuilder) } } -enum ccPhase { +enum ccPhase +{ IdlePhase, GraphBuildingPhase, ScanAndCollectWhitePhase, CleanupPhase }; -enum ccType { +enum ccType +{ SliceCC, /* If a CC is in progress, continue it. Otherwise, start a new one. */ ManualCC, /* Explicitly triggered. */ ShutdownCC /* Shutdown CC, used for finding leaks. */ @@ -1355,7 +1353,7 @@ NS_IMPL_ISUPPORTS(nsCycleCollector, nsIMemoryReporter) * bool ShouldVisitNode(PtrInfo const *pi); * void VisitNode(PtrInfo *pi); */ -template +template class GraphWalker { private: @@ -1428,7 +1426,7 @@ ToParticipant(nsISupports* aPtr, nsXPCOMCycleCollectionParticipant** aCp) CallQueryInterface(aPtr, aCp); } -template +template MOZ_NEVER_INLINE void GraphWalker::Walk(PtrInfo* aPi) { @@ -1437,7 +1435,7 @@ GraphWalker::Walk(PtrInfo* aPi) DoWalk(queue); } -template +template MOZ_NEVER_INLINE void GraphWalker::WalkFromRoots(CCGraph& aGraph) { @@ -1449,7 +1447,7 @@ GraphWalker::WalkFromRoots(CCGraph& aGraph) DoWalk(queue); } -template +template MOZ_NEVER_INLINE void GraphWalker::DoWalk(nsDeque& aQueue) { @@ -1476,7 +1474,8 @@ struct CCGraphDescriber : public LinkedListElement { } - enum Type { + enum Type + { eRefCountedObject, eGCedObject, eGCMarkedObject, @@ -1590,7 +1589,8 @@ private: } } - struct FileInfo { + struct FileInfo + { const char* const mPrefix; nsCOMPtr mFile; FILE* mStream; @@ -1627,9 +1627,7 @@ private: // aFilename under a memory-reporting-specific folder // (/data/local/tmp/memory-reports). Otherwise, it will open a // file named aFilename under "NS_OS_TEMP_DIR". - nsresult rv = nsDumpUtils::OpenTempFile( - filename, - &logFile, + nsresult rv = nsDumpUtils::OpenTempFile(filename, &logFile, NS_LITERAL_CSTRING("memory-reports")); if (NS_FAILED(rv)) { NS_IF_RELEASE(logFile); @@ -1651,13 +1649,15 @@ private: incomplete += aLog->mPrefix; MOZ_ASSERT(!aLog->mFile); aLog->mFile = CreateTempFile(incomplete.get()); - if (NS_WARN_IF(!aLog->mFile)) + if (NS_WARN_IF(!aLog->mFile)) { return NS_ERROR_UNEXPECTED; + } MOZ_ASSERT(!aLog->mStream); aLog->mFile->OpenANSIFileDesc("w", &aLog->mStream); - if (NS_WARN_IF(!aLog->mStream)) + if (NS_WARN_IF(!aLog->mStream)) { return NS_ERROR_UNEXPECTED; + } MozillaRegisterDebugFILE(aLog->mStream); return NS_OK; } @@ -1674,13 +1674,15 @@ private: // Strip off "incomplete-". nsCOMPtr logFileFinalDestination = CreateTempFile(aLog->mPrefix); - if (NS_WARN_IF(!logFileFinalDestination)) + if (NS_WARN_IF(!logFileFinalDestination)) { return NS_ERROR_UNEXPECTED; + } nsAutoString logFileFinalDestinationName; logFileFinalDestination->GetLeafName(logFileFinalDestinationName); - if (NS_WARN_IF(logFileFinalDestinationName.IsEmpty())) + if (NS_WARN_IF(logFileFinalDestinationName.IsEmpty())) { return NS_ERROR_UNEXPECTED; + } aLog->mFile->MoveTo(/* directory */ nullptr, logFileFinalDestinationName); @@ -1695,8 +1697,8 @@ private: nsAutoString logPath; logFileFinalDestination->GetPath(logPath); - nsString msg = aCollectorKind - + NS_LITERAL_STRING(" Collector log dumped to ") + logPath; + nsString msg = aCollectorKind + + NS_LITERAL_STRING(" Collector log dumped to ") + logPath; cs->LogStringMessage(msg.get()); } return NS_OK; @@ -1844,7 +1846,7 @@ public: mCurrentAddress.AssignLiteral("0x"); mCurrentAddress.AppendInt(aAddress, 16); d->mType = aMarked ? CCGraphDescriber::eGCMarkedObject : - CCGraphDescriber::eGCedObject; + CCGraphDescriber::eGCedObject; d->mAddress = mCurrentAddress; d->mName.Append(aObjectDescription); if (aCompartmentAddress) { @@ -2356,7 +2358,8 @@ CCGraphBuilder::AddWeakMapNode(void* aNode) } NS_IMETHODIMP_(void) -CCGraphBuilder::NoteWeakMapping(void* aMap, void* aKey, void* aKdelegate, void* aVal) +CCGraphBuilder::NoteWeakMapping(void* aMap, void* aKey, void* aKdelegate, + void* aVal) { // Don't try to optimize away the entry here, as we've already attempted to // do that in TraceWeakMapping in nsXPConnect. @@ -2650,7 +2653,7 @@ public: if (val.isMarkable()) { void* thing = val.toGCThing(); if (thing && xpc_GCThingIsGrayCCThing(thing)) { - MOZ_ASSERT(!js::gc::IsInsideNursery((js::gc::Cell *)thing)); + MOZ_ASSERT(!js::gc::IsInsideNursery((js::gc::Cell*)thing)); mCollector->GetJSPurpleBuffer()->mValues.AppendElement(val); } } @@ -2661,7 +2664,7 @@ public: { } - void AppendJSObjectToPurpleBuffer(JSObject *obj) const + void AppendJSObjectToPurpleBuffer(JSObject* obj) const { if (obj && xpc_GCThingIsGrayCCThing(obj)) { MOZ_ASSERT(!js::gc::IsInsideNursery(JS::AsCell(obj))); @@ -2902,9 +2905,10 @@ private: static void FloodBlackNode(uint32_t& aWhiteNodeCount, bool& aFailed, PtrInfo* aPi) { - GraphWalker(ScanBlackVisitor(aWhiteNodeCount, aFailed)).Walk(aPi); - MOZ_ASSERT(aPi->mColor == black || !aPi->WasTraversed(), - "FloodBlackNode should make aPi black"); + GraphWalker(ScanBlackVisitor(aWhiteNodeCount, + aFailed)).Walk(aPi); + MOZ_ASSERT(aPi->mColor == black || !aPi->WasTraversed(), + "FloodBlackNode should make aPi black"); } // Iterate over the WeakMaps. If we mark anything while iterating @@ -3011,13 +3015,16 @@ nsCycleCollector::ScanIncrementalRoots() // buffer here, so these objects will be suspected and freed in the next CC // if they are garbage. bool failed = false; - PurpleScanBlackVisitor purpleScanBlackVisitor(mGraph, mListener, mWhiteNodeCount, failed); + PurpleScanBlackVisitor purpleScanBlackVisitor(mGraph, mListener, + mWhiteNodeCount, failed); mPurpleBuf.VisitEntries(purpleScanBlackVisitor); timeLog.Checkpoint("ScanIncrementalRoots::fix purple"); bool hasJSRuntime = !!mJSRuntime; - nsCycleCollectionParticipant* jsParticipant = hasJSRuntime ? mJSRuntime->GCThingParticipant() : nullptr; - nsCycleCollectionParticipant* zoneParticipant = hasJSRuntime ? mJSRuntime->ZoneParticipant() : nullptr; + nsCycleCollectionParticipant* jsParticipant = + hasJSRuntime ? mJSRuntime->GCThingParticipant() : nullptr; + nsCycleCollectionParticipant* zoneParticipant = + hasJSRuntime ? mJSRuntime->ZoneParticipant() : nullptr; bool hasListener = !!mListener; NodePool::Enumerator etor(mGraph.mNodes); @@ -3263,7 +3270,8 @@ nsCycleCollector::CollectWhite() for (uint32_t i = 0; i < count; ++i) { PtrInfo* pinfo = whiteNodes.ElementAt(i); - MOZ_ASSERT(pinfo->mParticipant, "Unlink shouldn't see objects removed from graph."); + MOZ_ASSERT(pinfo->mParticipant, + "Unlink shouldn't see objects removed from graph."); pinfo->mParticipant->Unlink(pinfo->mPointer); #ifdef DEBUG if (mJSRuntime) { @@ -3275,7 +3283,8 @@ nsCycleCollector::CollectWhite() for (uint32_t i = 0; i < count; ++i) { PtrInfo* pinfo = whiteNodes.ElementAt(i); - MOZ_ASSERT(pinfo->mParticipant, "Unroot shouldn't see objects removed from graph."); + MOZ_ASSERT(pinfo->mParticipant, + "Unroot shouldn't see objects removed from graph."); pinfo->mParticipant->Unroot(pinfo->mPointer); } timeLog.Checkpoint("CollectWhite::Unroot"); @@ -3476,8 +3485,8 @@ nsCycleCollector::FixGrayBits(bool aForceGC) } TimeLog timeLog; - mJSRuntime->GarbageCollect(aForceGC ? JS::gcreason::SHUTDOWN_CC - : JS::gcreason::CC_FORCED); + mJSRuntime->GarbageCollect(aForceGC ? JS::gcreason::SHUTDOWN_CC : + JS::gcreason::CC_FORCED); timeLog.Checkpoint("GC()"); } @@ -3743,7 +3752,8 @@ nsCycleCollector::BeginCollection(ccType aCCType, mResults.mMergedZones = mergeZones; MOZ_ASSERT(!mBuilder, "Forgot to clear mBuilder"); - mBuilder = new CCGraphBuilder(mGraph, mResults, mJSRuntime, mListener, mergeZones); + mBuilder = new CCGraphBuilder(mGraph, mResults, mJSRuntime, mListener, + mergeZones); if (mJSRuntime) { mJSRuntime->TraverseRoots(*mBuilder); @@ -4105,7 +4115,7 @@ nsCycleCollector_forgetSkippable(bool aRemoveChildlessNodes, MOZ_ASSERT(data->mCollector); PROFILER_LABEL("nsCycleCollector", "forgetSkippable", - js::ProfileEntry::Category::CC); + js::ProfileEntry::Category::CC); TimeLog timeLog; data->mCollector->ForgetSkippable(aRemoveChildlessNodes, @@ -4155,7 +4165,7 @@ nsCycleCollector_collect(nsICycleCollectorListener* aManualListener) MOZ_ASSERT(data->mCollector); PROFILER_LABEL("nsCycleCollector", "collect", - js::ProfileEntry::Category::CC); + js::ProfileEntry::Category::CC); SliceBudget unlimitedBudget; data->mCollector->Collect(ManualCC, unlimitedBudget, aManualListener); @@ -4171,7 +4181,7 @@ nsCycleCollector_collectSlice(int64_t aSliceTime) MOZ_ASSERT(data->mCollector); PROFILER_LABEL("nsCycleCollector", "collectSlice", - js::ProfileEntry::Category::CC); + js::ProfileEntry::Category::CC); SliceBudget budget; if (aSliceTime >= 0) { @@ -4190,7 +4200,7 @@ nsCycleCollector_collectSliceWork(int64_t aSliceWork) MOZ_ASSERT(data->mCollector); PROFILER_LABEL("nsCycleCollector", "collectSliceWork", - js::ProfileEntry::Category::CC); + js::ProfileEntry::Category::CC); SliceBudget budget; if (aSliceWork >= 0) { @@ -4235,7 +4245,7 @@ nsCycleCollector_shutdown() if (data) { MOZ_ASSERT(data->mCollector); PROFILER_LABEL("nsCycleCollector", "shutdown", - js::ProfileEntry::Category::CC); + js::ProfileEntry::Category::CC); data->mCollector->Shutdown(); data->mCollector = nullptr; diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp index 640d8b945f1..ec08c0d3a0c 100644 --- a/xpcom/base/nsDebugImpl.cpp +++ b/xpcom/base/nsDebugImpl.cpp @@ -236,7 +236,8 @@ InitLog() } } -enum nsAssertBehavior { +enum nsAssertBehavior +{ NS_ASSERT_UNINITIALIZED, NS_ASSERT_WARN, NS_ASSERT_SUSPEND, @@ -511,7 +512,8 @@ Break(const char* aMsg) static int ignoreDebugger; if (!ignoreDebugger) { const char* shouldIgnoreDebugger = getenv("XPCOM_DEBUG_DLG"); - ignoreDebugger = 1 + (shouldIgnoreDebugger && !strcmp(shouldIgnoreDebugger, "1")); + ignoreDebugger = + 1 + (shouldIgnoreDebugger && !strcmp(shouldIgnoreDebugger, "1")); } if ((ignoreDebugger == 2) || !::IsDebuggerPresent()) { DWORD code = IDRETRY; @@ -587,8 +589,7 @@ nsDebugImpl::Create(nsISupports* aOuter, const nsIID& aIID, void** aInstancePtr) return NS_ERROR_NO_AGGREGATION; } - return const_cast(&kImpl)-> - QueryInterface(aIID, aInstancePtr); + return const_cast(&kImpl)->QueryInterface(aIID, aInstancePtr); } //////////////////////////////////////////////////////////////////////////////// diff --git a/xpcom/base/nsDumpUtils.cpp b/xpcom/base/nsDumpUtils.cpp index a34a494172a..ac3b0d55cb4 100644 --- a/xpcom/base/nsDumpUtils.cpp +++ b/xpcom/base/nsDumpUtils.cpp @@ -475,8 +475,7 @@ nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile, return rv; } - while (chmod(dirPath.get(), 0777) == -1 && errno == EINTR) - { + while (chmod(dirPath.get(), 0777) == -1 && errno == EINTR) { } } #endif @@ -503,8 +502,7 @@ nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile, return rv; } - while (chmod(path.get(), 0666) == -1 && errno == EINTR) - { + while (chmod(path.get(), 0666) == -1 && errno == EINTR) { } #endif diff --git a/xpcom/base/nsErrorService.cpp b/xpcom/base/nsErrorService.cpp index dd4a131f33f..5ee93c31bc3 100644 --- a/xpcom/base/nsErrorService.cpp +++ b/xpcom/base/nsErrorService.cpp @@ -11,7 +11,8 @@ NS_IMPL_ISUPPORTS(nsErrorService, nsIErrorService) nsresult -nsErrorService::Create(nsISupports* aOuter, const nsIID& aIID, void** aInstancePtr) +nsErrorService::Create(nsISupports* aOuter, const nsIID& aIID, + void** aInstancePtr) { if (NS_WARN_IF(aOuter)) { return NS_ERROR_NO_AGGREGATION; @@ -21,7 +22,8 @@ nsErrorService::Create(nsISupports* aOuter, const nsIID& aIID, void** aInstanceP } NS_IMETHODIMP -nsErrorService::RegisterErrorStringBundle(int16_t aErrorModule, const char* aStringBundleURL) +nsErrorService::RegisterErrorStringBundle(int16_t aErrorModule, + const char* aStringBundleURL) { mErrorStringBundleURLMap.Put(aErrorModule, new nsCString(aStringBundleURL)); return NS_OK; diff --git a/xpcom/base/nsMacUtilsImpl.cpp b/xpcom/base/nsMacUtilsImpl.cpp index ee8249f6978..37c9099b6f7 100644 --- a/xpcom/base/nsMacUtilsImpl.cpp +++ b/xpcom/base/nsMacUtilsImpl.cpp @@ -37,7 +37,8 @@ nsMacUtilsImpl::GetArchString(nsAString& aArchString) CFIndex archCount = ::CFArrayGetCount(archList); for (CFIndex i = 0; i < archCount; i++) { - CFNumberRef arch = static_cast(::CFArrayGetValueAtIndex(archList, i)); + CFNumberRef arch = + static_cast(::CFArrayGetValueAtIndex(archList, i)); int archInt = 0; if (!::CFNumberGetValue(arch, kCFNumberIntType, &archInt)) { diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 8b87396408f..8f45efd56b1 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -124,7 +124,8 @@ private: const bool mDumpChildProcesses; }; -NS_IMPL_ISUPPORTS_INHERITED(GCAndCCLogDumpRunnable, nsRunnable, nsIDumpGCAndCCLogsCallback) +NS_IMPL_ISUPPORTS_INHERITED(GCAndCCLogDumpRunnable, nsRunnable, + nsIDumpGCAndCCLogsCallback) } // anonymous namespace @@ -178,10 +179,9 @@ void doGCCCDump(const uint8_t aRecvSig) LOG("SignalWatcher(sig %d) dispatching GC/CC log runnable.", aRecvSig); // Dump GC and CC logs (from the main thread). nsRefPtr runnable = - new GCAndCCLogDumpRunnable( - /* identifier = */ EmptyString(), - /* allTraces = */ true, - /* dumpChildProcesses = */ true); + new GCAndCCLogDumpRunnable(/* identifier = */ EmptyString(), + /* allTraces = */ true, + /* dumpChildProcesses = */ true); NS_DispatchToMainThread(runnable); } @@ -195,7 +195,8 @@ void doMemoryReport(const nsCString& aInputStr) { bool minimize = aInputStr.EqualsLiteral("minimize memory report"); - LOG("FifoWatcher(command:%s) dispatching memory report runnable.", aInputStr.get()); + LOG("FifoWatcher(command:%s) dispatching memory report runnable.", + aInputStr.get()); nsRefPtr runnable = new DumpMemoryInfoToTempDirRunnable(/* identifier = */ EmptyString(), /* anonymize = */ false, @@ -314,7 +315,8 @@ EnsureNonEmptyIdentifier(nsAString& aIdentifier) // Use XPCOM refcounting to fire |onFinish| when all reference-holders // (remote dump actors or the |DumpGCAndCCLogsToFile| activation itself) // have gone away. -class nsDumpGCAndCCLogsCallbackHolder MOZ_FINAL : public nsIDumpGCAndCCLogsCallback +class nsDumpGCAndCCLogsCallbackHolder MOZ_FINAL + : public nsIDumpGCAndCCLogsCallback { public: NS_DECL_ISUPPORTS diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index 5547b567240..8d92b674b4f 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -1173,7 +1173,8 @@ nsMemoryReporterManager::GetReportsExtended( } if (aMinimize) { - rv = MinimizeMemoryUsage(NS_NewRunnableMethod(this, &nsMemoryReporterManager::StartGettingReports)); + rv = MinimizeMemoryUsage(NS_NewRunnableMethod( + this, &nsMemoryReporterManager::StartGettingReports)); } else { rv = StartGettingReports(); } @@ -1186,7 +1187,7 @@ nsMemoryReporterManager::StartGettingReports() GetReportsState* s = mGetReportsState; // Get reports for this process. - FILE *parentDMDFile = nullptr; + FILE* parentDMDFile = nullptr; #ifdef MOZ_DMD nsresult rv = nsMemoryInfoDumper::OpenDMDFile(s->mDMDDumpIdent, getpid(), &parentDMDFile); @@ -1200,9 +1201,8 @@ nsMemoryReporterManager::StartGettingReports() s->mParentDone = true; // If there are no remaining child processes, we can finish up immediately. - return (s->mNumChildProcessesCompleted >= s->mNumChildProcesses) - ? FinishReporting() - : NS_OK; + return (s->mNumChildProcessesCompleted >= s->mNumChildProcesses) ? + FinishReporting() : NS_OK; } typedef nsCOMArray MemoryReporterArray; diff --git a/xpcom/base/nsStackWalk.cpp b/xpcom/base/nsStackWalk.cpp index d5d904ffc60..bd9a26858e8 100644 --- a/xpcom/base/nsStackWalk.cpp +++ b/xpcom/base/nsStackWalk.cpp @@ -255,7 +255,7 @@ PrintError(const char* aPrefix) nullptr, lastErr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPSTR) &lpMsgBuf, + (LPSTR)&lpMsgBuf, 0, nullptr ); @@ -286,9 +286,8 @@ EnsureWalkThreadReady() } unsigned int threadID; - stackWalkThread = (HANDLE) - _beginthreadex(nullptr, 0, WalkStackThread, (void*)readyEvent, - 0, &threadID); + stackWalkThread = (HANDLE)_beginthreadex(nullptr, 0, WalkStackThread, + (void*)readyEvent, 0, &threadID); if (!stackWalkThread) { PrintError("CreateThread"); ::CloseHandle(readyEvent); @@ -455,7 +454,7 @@ WalkStackThread(void* aData) HANDLE readyEvent = (HANDLE)aData; ::SetEvent(readyEvent); - while ((msgRet = ::GetMessage(&msg, (HWND) - 1, 0, 0)) != 0) { + while ((msgRet = ::GetMessage(&msg, (HWND)-1, 0, 0)) != 0) { if (msgRet == -1) { PrintError("GetMessage"); } else { @@ -972,7 +971,7 @@ static void myinit() { - if (! initialized) { + if (!initialized) { #ifndef __GNUC__ void *handle; const char *libdem = "libdemangle.so.1"; diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp index fa02293c51f..12f033d6195 100644 --- a/xpcom/base/nsSystemInfo.cpp +++ b/xpcom/base/nsSystemInfo.cpp @@ -202,7 +202,8 @@ nsSystemInfo::Init() versionDouble >= 6.2); NS_ENSURE_SUCCESS(rv, rv); #else - rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16("hasWindowsTouchInterface"), false); + rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16("hasWindowsTouchInterface"), + false); NS_ENSURE_SUCCESS(rv, rv); #endif @@ -235,7 +236,8 @@ nsSystemInfo::Init() if (NS_FAILED(GetProfileHDDInfo())) { // We might have been called before profile-do-change. We'll observe that // event so that we can fill this in later. - nsCOMPtr obsService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + nsCOMPtr obsService = + do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -263,7 +265,8 @@ nsSystemInfo::Init() #if defined(MOZ_WIDGET_GTK) // This must be done here because NSPR can only separate OS's when compiled, not libraries. - char* gtkver = PR_smprintf("GTK %u.%u.%u", gtk_major_version, gtk_minor_version, gtk_micro_version); + char* gtkver = PR_smprintf("GTK %u.%u.%u", gtk_major_version, + gtk_minor_version, gtk_micro_version); if (gtkver) { rv = SetPropertyAsACString(NS_LITERAL_STRING("secondaryLibrary"), nsDependentCString(gtkver)); @@ -396,8 +399,8 @@ nsSystemInfo::Observe(nsISupports* aSubject, const char* aTopic, { if (!strcmp(aTopic, "profile-do-change")) { nsresult rv; - nsCOMPtr obsService = do_GetService( - NS_OBSERVERSERVICE_CONTRACTID, &rv); + nsCOMPtr obsService = + do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) { return rv; } diff --git a/xpcom/base/nsTraceRefcnt.cpp b/xpcom/base/nsTraceRefcnt.cpp index e14b9bc945e..b89cb88ae3f 100644 --- a/xpcom/base/nsTraceRefcnt.cpp +++ b/xpcom/base/nsTraceRefcnt.cpp @@ -425,7 +425,8 @@ public: (aStats->mCreates != aStats->mDestroys)); } - bool PrintDumpHeader(FILE* aOut, const char* aMsg, nsTraceRefcnt::StatisticsType aType) + bool PrintDumpHeader(FILE* aOut, const char* aMsg, + nsTraceRefcnt::StatisticsType aType) { fprintf(aOut, "\n== BloatView: %s, %s process %d\n", aMsg, XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid()); @@ -447,7 +448,8 @@ public: void Dump(int aIndex, FILE* aOut, nsTraceRefcnt::StatisticsType aType) { - nsTraceRefcntStats* stats = (aType == nsTraceRefcnt::NEW_STATS) ? &mNewStats : &mAllStats; + nsTraceRefcntStats* stats = + (aType == nsTraceRefcnt::NEW_STATS) ? &mNewStats : &mAllStats; if (gLogLeaksOnly && !HaveLeaks(stats)) { return; } @@ -573,7 +575,7 @@ DumpSerialNumbers(PLHashEntry* aHashEntry, int aIndex, void* aClosure) } -template <> +template<> class nsDefaultComparator { public: @@ -677,7 +679,9 @@ LogThisType(const char* aTypeName) static intptr_t GetSerialNumber(void* aPtr, bool aCreate) { - PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr); + PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, + PLHashNumber(NS_PTR_TO_INT32(aPtr)), + aPtr); if (hep && *hep) { return reinterpret_cast((*hep)->value)->serialNumber; } else if (aCreate) { @@ -685,7 +689,8 @@ GetSerialNumber(void* aPtr, bool aCreate) record->serialNumber = ++gNextSerialNumber; record->refCount = 0; record->COMPtrCount = 0; - PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr, reinterpret_cast(record)); + PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(NS_PTR_TO_INT32(aPtr)), + aPtr, reinterpret_cast(record)); return gNextSerialNumber; } return 0; @@ -694,7 +699,9 @@ GetSerialNumber(void* aPtr, bool aCreate) static int32_t* GetRefCount(void* aPtr) { - PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr); + PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, + PLHashNumber(NS_PTR_TO_INT32(aPtr)), + aPtr); if (hep && *hep) { return &((reinterpret_cast((*hep)->value))->refCount); } else { @@ -706,7 +713,9 @@ GetRefCount(void* aPtr) static int32_t* GetCOMPtrCount(void* aPtr) { - PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr); + PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, + PLHashNumber(NS_PTR_TO_INT32(aPtr)), + aPtr); if (hep && *hep) { return &((reinterpret_cast((*hep)->value))->COMPtrCount); } @@ -959,7 +968,7 @@ PrintStackFrame(void* aPC, void* aSP, void* aClosure) static void PrintStackFrameCached(void* aPC, void* aSP, void* aClosure) { - CodeAddressServiceWriter *writer = static_cast(aClosure); + auto writer = static_cast(aClosure); gCodeAddressService->WriteLocation(*writer, aPC); } #endif @@ -983,8 +992,8 @@ nsTraceRefcnt::WalkTheStackCached(FILE* aStream) gCodeAddressService = new WalkTheStackCodeAddressService(); } CodeAddressServiceWriter writer(aStream); - NS_StackWalk(PrintStackFrameCached, /* skipFrames */ 2, /* maxFrames */ 0, &writer, - 0, nullptr); + NS_StackWalk(PrintStackFrameCached, /* skipFrames */ 2, /* maxFrames */ 0, + &writer, 0, nullptr); #endif } @@ -1092,7 +1101,7 @@ LogTerm() EXPORT_XPCOM_API(void) NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt, - const char* aClazz, uint32_t aClassSize) + const char* aClass, uint32_t aClassSize) { #ifdef NS_IMPL_REFCNT_LOGGING ASSERT_ACTIVITY_IS_LEGAL; @@ -1103,7 +1112,7 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt, LOCK_TRACELOG(); if (gBloatLog) { - BloatEntry* entry = GetBloatEntry(aClazz, aClassSize); + BloatEntry* entry = GetBloatEntry(aClass, aClassSize); if (entry) { entry->AddRef(aRefcnt); } @@ -1112,7 +1121,7 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt, // Here's the case where MOZ_COUNT_CTOR was not used, // yet we still want to see creation information: - bool loggingThisType = (!gTypesToLog || LogThisType(aClazz)); + bool loggingThisType = (!gTypesToLog || LogThisType(aClass)); intptr_t serialno = 0; if (gSerialNumbers && loggingThisType) { serialno = GetSerialNumber(aPtr, aRefcnt == 1); @@ -1129,14 +1138,15 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt, bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno)); if (aRefcnt == 1 && gAllocLog && loggingThisType && loggingThisObject) { fprintf(gAllocLog, "\n<%s> 0x%08X %" PRIdPTR " Create\n", - aClazz, NS_PTR_TO_INT32(aPtr), serialno); + aClass, NS_PTR_TO_INT32(aPtr), serialno); nsTraceRefcnt::WalkTheStackCached(gAllocLog); } if (gRefcntsLog && loggingThisType && loggingThisObject) { // Can't use PR_LOG(), b/c it truncates the line fprintf(gRefcntsLog, - "\n<%s> 0x%08X %" PRIuPTR " AddRef %" PRIuPTR "\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt); + "\n<%s> 0x%08X %" PRIuPTR " AddRef %" PRIuPTR "\n", + aClass, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt); nsTraceRefcnt::WalkTheStackCached(gRefcntsLog); fflush(gRefcntsLog); } @@ -1146,7 +1156,7 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt, } EXPORT_XPCOM_API(void) -NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz) +NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClass) { #ifdef NS_IMPL_REFCNT_LOGGING ASSERT_ACTIVITY_IS_LEGAL; @@ -1157,13 +1167,13 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz) LOCK_TRACELOG(); if (gBloatLog) { - BloatEntry* entry = GetBloatEntry(aClazz, 0); + BloatEntry* entry = GetBloatEntry(aClass, 0); if (entry) { entry->Release(aRefcnt); } } - bool loggingThisType = (!gTypesToLog || LogThisType(aClazz)); + bool loggingThisType = (!gTypesToLog || LogThisType(aClass)); intptr_t serialno = 0; if (gSerialNumbers && loggingThisType) { serialno = GetSerialNumber(aPtr, false); @@ -1181,7 +1191,8 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz) if (gRefcntsLog && loggingThisType && loggingThisObject) { // Can't use PR_LOG(), b/c it truncates the line fprintf(gRefcntsLog, - "\n<%s> 0x%08X %" PRIuPTR " Release %" PRIuPTR "\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt); + "\n<%s> 0x%08X %" PRIuPTR " Release %" PRIuPTR "\n", aClass, + NS_PTR_TO_INT32(aPtr), serialno, aRefcnt); nsTraceRefcnt::WalkTheStackCached(gRefcntsLog); fflush(gRefcntsLog); } @@ -1192,7 +1203,7 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz) if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) { fprintf(gAllocLog, "\n<%s> 0x%08X %" PRIdPTR " Destroy\n", - aClazz, NS_PTR_TO_INT32(aPtr), serialno); + aClass, NS_PTR_TO_INT32(aPtr), serialno); nsTraceRefcnt::WalkTheStackCached(gAllocLog); } diff --git a/xpcom/base/nsUUIDGenerator.cpp b/xpcom/base/nsUUIDGenerator.cpp index 516210ed61f..2419a8273de 100644 --- a/xpcom/base/nsUUIDGenerator.cpp +++ b/xpcom/base/nsUUIDGenerator.cpp @@ -17,7 +17,7 @@ #include "nsUUIDGenerator.h" #ifdef ANDROID -extern "C" NS_EXPORT void arc4random_buf(void *, size_t); +extern "C" NS_EXPORT void arc4random_buf(void*, size_t); #endif using namespace mozilla; diff --git a/xpcom/base/nsVersionComparatorImpl.cpp b/xpcom/base/nsVersionComparatorImpl.cpp index 39e98f2a995..8a37d8b1ac2 100644 --- a/xpcom/base/nsVersionComparatorImpl.cpp +++ b/xpcom/base/nsVersionComparatorImpl.cpp @@ -11,7 +11,8 @@ NS_IMPL_ISUPPORTS(nsVersionComparatorImpl, nsIVersionComparator) NS_IMETHODIMP -nsVersionComparatorImpl::Compare(const nsACString& aStr1, const nsACString& aStr2, +nsVersionComparatorImpl::Compare(const nsACString& aStr1, + const nsACString& aStr2, int32_t* aResult) { *aResult = mozilla::CompareVersions(PromiseFlatCString(aStr1).get(), diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp index 426dd8c144c..34321284565 100644 --- a/xpcom/build/nsXPComInit.cpp +++ b/xpcom/build/nsXPComInit.cpp @@ -447,8 +447,9 @@ CountingAllocatorBase::sAmount(0); #endif /* MOZ_VPX */ #ifdef MOZ_WEBM -class NesteggReporter MOZ_FINAL : public nsIMemoryReporter - , public CountingAllocatorBase +class NesteggReporter MOZ_FINAL + : public nsIMemoryReporter + , public CountingAllocatorBase { public: NS_DECL_ISUPPORTS @@ -817,7 +818,7 @@ ShutdownXPCOM(nsIServiceManager* aServMgr) nsRefPtr observerService; CallGetService("@mozilla.org/observer-service;1", - (nsObserverService**) getter_AddRefs(observerService)); + (nsObserverService**)getter_AddRefs(observerService)); if (observerService) { observerService->NotifyObservers(nullptr, diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp index 53bcf1e730e..11637069d49 100644 --- a/xpcom/components/ManifestParser.cpp +++ b/xpcom/components/ManifestParser.cpp @@ -225,7 +225,7 @@ LogMessageWithContext(FileLocation& aFile, // This can happen early in component registration. Fall back to a // generic console message. LogMessage("Warning: in '%s', line %i: %s", file.get(), - aLineNumber, (char*) formatted); + aLineNumber, (char*)formatted); return; } diff --git a/xpcom/components/nsCategoryManager.cpp b/xpcom/components/nsCategoryManager.cpp index 546694a4b34..49674f3ee5e 100644 --- a/xpcom/components/nsCategoryManager.cpp +++ b/xpcom/components/nsCategoryManager.cpp @@ -213,12 +213,7 @@ EntryEnumerator::Create(nsTHashtable& aTable) CategoryNode* CategoryNode::Create(PLArenaPool* aArena) { - CategoryNode* node = new(aArena) CategoryNode(); - if (!node) { - return nullptr; - } - - return node; + return new (aArena) CategoryNode(); } CategoryNode::~CategoryNode() diff --git a/xpcom/glue/BlockingResourceBase.cpp b/xpcom/glue/BlockingResourceBase.cpp index 44cc2ef376c..d4351483f84 100644 --- a/xpcom/glue/BlockingResourceBase.cpp +++ b/xpcom/glue/BlockingResourceBase.cpp @@ -35,8 +35,7 @@ namespace mozilla { // // static members -const char* const BlockingResourceBase::kResourceTypeName[] = -{ +const char* const BlockingResourceBase::kResourceTypeName[] = { // needs to be kept in sync with BlockingResourceType "Mutex", "ReentrantMonitor", "CondVar" }; @@ -88,7 +87,8 @@ BlockingResourceBase::GetStackTrace(AcquisitionState& aState) * some info is written into |aOut| */ bool -PrintCycle(const BlockingResourceBase::DDT::ResourceAcquisitionArray* aCycle, nsACString& aOut) +PrintCycle(const BlockingResourceBase::DDT::ResourceAcquisitionArray* aCycle, + nsACString& aOut) { NS_ASSERTION(aCycle->Length() > 1, "need > 1 element for cycle!"); @@ -97,12 +97,15 @@ PrintCycle(const BlockingResourceBase::DDT::ResourceAcquisitionArray* aCycle, ns fputs("=== Cyclical dependency starts at\n", stderr); aOut += "Cyclical dependency starts at\n"; - const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type res = aCycle->ElementAt(0); + const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type res = + aCycle->ElementAt(0); maybeImminent &= res->Print(aOut); BlockingResourceBase::DDT::ResourceAcquisitionArray::index_type i; - BlockingResourceBase::DDT::ResourceAcquisitionArray::size_type len = aCycle->Length(); - const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type* it = 1 + aCycle->Elements(); + BlockingResourceBase::DDT::ResourceAcquisitionArray::size_type len = + aCycle->Length(); + const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type* it = + 1 + aCycle->Elements(); for (i = 1; i < len - 1; ++i, ++it) { fputs("\n--- Next dependency:\n", stderr); aOut += "\nNext dependency:\n"; diff --git a/xpcom/glue/FileUtils.cpp b/xpcom/glue/FileUtils.cpp index a1c2feb0276..6e86af7685a 100644 --- a/xpcom/glue/FileUtils.cpp +++ b/xpcom/glue/FileUtils.cpp @@ -142,8 +142,8 @@ mozilla::ReadSysFile( ssize_t bytesRead; size_t offset = 0; do { - bytesRead = MOZ_TEMP_FAILURE_RETRY( - read(fd, aBuf + offset, aBufSize - offset)); + bytesRead = MOZ_TEMP_FAILURE_RETRY(read(fd, aBuf + offset, + aBufSize - offset)); if (bytesRead == -1) { return false; } diff --git a/xpcom/glue/nsCOMPtr.cpp b/xpcom/glue/nsCOMPtr.cpp index 7471446028d..ec92068db16 100644 --- a/xpcom/glue/nsCOMPtr.cpp +++ b/xpcom/glue/nsCOMPtr.cpp @@ -16,8 +16,9 @@ nsQueryInterface::operator()(const nsIID& aIID, void** aAnswer) const NS_ASSERTION(NS_SUCCEEDED(status), "interface not found---were you expecting that?"); #endif - } else + } else { status = NS_ERROR_NULL_POINTER; + } return status; } @@ -32,8 +33,9 @@ nsQueryInterfaceWithError::operator()(const nsIID& aIID, void** aAnswer) const NS_ASSERTION(NS_SUCCEEDED(status), "interface not found---were you expecting that?"); #endif - } else + } else { status = NS_ERROR_NULL_POINTER; + } if (mErrorPtr) { *mErrorPtr = status; diff --git a/xpcom/glue/nsDeque.cpp b/xpcom/glue/nsDeque.cpp index aba612b9eb8..41d9337c481 100644 --- a/xpcom/glue/nsDeque.cpp +++ b/xpcom/glue/nsDeque.cpp @@ -69,7 +69,7 @@ nsDeque::~nsDeque() printf("Capacity: %i\n", mCapacity); static int mCaps[15] = {0}; - switch(mCapacity) { + switch (mCapacity) { case 4: mCaps[0]++; break; case 8: mCaps[1]++; break; case 16: mCaps[2]++; break; @@ -366,7 +366,8 @@ nsDeque::RemoveObjectAt(int32_t aIndex) // "Shuffle down" all elements in the array by 1, overwritting the element // being removed. for (int32_t i = aIndex; i < mSize; ++i) { - mData[modulus(mOrigin + i, mCapacity)] = mData[modulus(mOrigin + i + 1, mCapacity)]; + mData[modulus(mOrigin + i, mCapacity)] = + mData[modulus(mOrigin + i + 1, mCapacity)]; } mSize--; diff --git a/xpcom/glue/nsEnumeratorUtils.cpp b/xpcom/glue/nsEnumeratorUtils.cpp index 9f7d220beb7..df7d61e4262 100644 --- a/xpcom/glue/nsEnumeratorUtils.cpp +++ b/xpcom/glue/nsEnumeratorUtils.cpp @@ -227,7 +227,7 @@ nsUnionEnumerator::HasMoreElements(bool* aResult) return NS_OK; } - if (! mAtSecond) { + if (!mAtSecond) { rv = mFirstEnumerator->HasMoreElements(aResult); if (NS_FAILED(rv)) { return rv; @@ -266,7 +266,7 @@ nsUnionEnumerator::GetNext(nsISupports** aResult) return NS_ERROR_UNEXPECTED; } - if (! mAtSecond) { + if (!mAtSecond) { return mFirstEnumerator->GetNext(aResult); } @@ -279,9 +279,9 @@ NS_NewUnionEnumerator(nsISimpleEnumerator** aResult, nsISimpleEnumerator* aSecondEnumerator) { *aResult = nullptr; - if (! aFirstEnumerator) { + if (!aFirstEnumerator) { *aResult = aSecondEnumerator; - } else if (! aSecondEnumerator) { + } else if (!aSecondEnumerator) { *aResult = aFirstEnumerator; } else { nsUnionEnumerator* enumer = new nsUnionEnumerator(aFirstEnumerator, diff --git a/xpcom/glue/pldhash.cpp b/xpcom/glue/pldhash.cpp index 98451f1610a..3a96faaaecf 100644 --- a/xpcom/glue/pldhash.cpp +++ b/xpcom/glue/pldhash.cpp @@ -258,8 +258,9 @@ PL_DHashTableInit(PLDHashTable* aTable, const PLDHashTableOps* aOps, aTable->entryCount = aTable->removedCount = 0; aTable->generation = 0; uint32_t nbytes; - if (!SizeOfEntryStore(capacity, aEntrySize, &nbytes)) - return false; // overflowed + if (!SizeOfEntryStore(capacity, aEntrySize, &nbytes)) { + return false; // overflowed + } aTable->entryStore = (char*)aOps->allocTable(aTable, nbytes); if (!aTable->entryStore) { diff --git a/xpcom/io/Base64.cpp b/xpcom/io/Base64.cpp index fb705d7fe16..34e69bf3e81 100644 --- a/xpcom/io/Base64.cpp +++ b/xpcom/io/Base64.cpp @@ -19,7 +19,7 @@ const unsigned char* base = "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; -template +template static void Encode3to4(const unsigned char* aSrc, T* aDest) { @@ -37,7 +37,7 @@ Encode3to4(const unsigned char* aSrc, T* aDest) } } -template +template static void Encode2to4(const unsigned char* aSrc, T* aDest) { @@ -47,7 +47,7 @@ Encode2to4(const unsigned char* aSrc, T* aDest) aDest[3] = (unsigned char)'='; } -template +template static void Encode1to4(const unsigned char* aSrc, T* aDest) { @@ -57,7 +57,7 @@ Encode1to4(const unsigned char* aSrc, T* aDest) aDest[3] = (unsigned char)'='; } -template +template static void Encode(const unsigned char* aSrc, uint32_t aSrcLen, T* aDest) { @@ -84,7 +84,7 @@ Encode(const unsigned char* aSrc, uint32_t aSrcLen, T* aDest) // END base64 encode code copied and modified from NSPR. -template +template struct EncodeInputStream_State { unsigned char c[3]; @@ -92,7 +92,7 @@ struct EncodeInputStream_State typename T::char_type* buffer; }; -template +template NS_METHOD EncodeInputStream_Encoder(nsIInputStream* aStream, void* aClosure, @@ -152,7 +152,7 @@ EncodeInputStream_Encoder(nsIInputStream* aStream, return NS_OK; } -template +template nsresult EncodeInputStream(nsIInputStream* aInputStream, T& aDest, diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocationProvider.cpp index 4048ff29461..df2c6c50494 100644 --- a/xpcom/io/nsAppFileLocationProvider.cpp +++ b/xpcom/io/nsAppFileLocationProvider.cpp @@ -153,14 +153,16 @@ nsAppFileLocationProvider::GetFile(const char* aProp, bool* aPersistent, } #ifdef MOZ_WIDGET_COCOA else if (nsCRT::strcmp(aProp, NS_MACOSX_USER_PLUGIN_DIR) == 0) { - if (::FSFindFolder(kUserDomain, kInternetPlugInFolderType, false, &fileRef) == noErr) { + if (::FSFindFolder(kUserDomain, kInternetPlugInFolderType, false, + &fileRef) == noErr) { rv = NS_NewLocalFileWithFSRef(&fileRef, true, getter_AddRefs(macFile)); if (NS_SUCCEEDED(rv)) { localFile = macFile; } } } else if (nsCRT::strcmp(aProp, NS_MACOSX_LOCAL_PLUGIN_DIR) == 0) { - if (::FSFindFolder(kLocalDomain, kInternetPlugInFolderType, false, &fileRef) == noErr) { + if (::FSFindFolder(kLocalDomain, kInternetPlugInFolderType, false, + &fileRef) == noErr) { rv = NS_NewLocalFileWithFSRef(&fileRef, true, getter_AddRefs(macFile)); if (NS_SUCCEEDED(rv)) { localFile = macFile; @@ -169,7 +171,8 @@ nsAppFileLocationProvider::GetFile(const char* aProp, bool* aPersistent, } else if (nsCRT::strcmp(aProp, NS_MACOSX_JAVA2_PLUGIN_DIR) == 0) { static const char* const java2PluginDirPath = "/System/Library/Java/Support/Deploy.bundle/Contents/Resources/"; - rv = NS_NewNativeLocalFile(nsDependentCString(java2PluginDirPath), true, getter_AddRefs(localFile)); + rv = NS_NewNativeLocalFile(nsDependentCString(java2PluginDirPath), true, + getter_AddRefs(localFile)); } #else else if (nsCRT::strcmp(aProp, NS_ENV_PLUGINS_DIR) == 0) { @@ -294,7 +297,8 @@ nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile, #if defined(MOZ_WIDGET_COCOA) FSRef fsRef; - OSType folderType = aLocal ? (OSType) kCachedDataFolderType : (OSType) kDomainLibraryFolderType; + OSType folderType = aLocal ? (OSType)kCachedDataFolderType : + (OSType)kDomainLibraryFolderType; OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef); if (err) { return NS_ERROR_FAILURE; @@ -320,7 +324,8 @@ nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile, return rv; } #elif defined(XP_UNIX) - rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true, getter_AddRefs(localDir)); + rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true, + getter_AddRefs(localDir)); if (NS_FAILED(rv)) { return rv; } diff --git a/xpcom/io/nsBinaryStream.cpp b/xpcom/io/nsBinaryStream.cpp index b407b357504..372bec6ba24 100644 --- a/xpcom/io/nsBinaryStream.cpp +++ b/xpcom/io/nsBinaryStream.cpp @@ -826,7 +826,7 @@ nsBinaryInputStream::ReadByteArray(uint32_t aLength, uint8_t** aResult) NS_IMETHODIMP nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength, JS::Handle aBuffer, - JSContext* aCx, uint32_t *rLength) + JSContext* aCx, uint32_t* aReadLength) { if (!aBuffer.isObject()) { return NS_ERROR_FAILURE; @@ -850,7 +850,7 @@ nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength, UniquePtr buf = MakeUnique(bufSize); uint32_t remaining = aLength; - *rLength = 0; + *aReadLength = 0; do { // Read data into temporary buffer. uint32_t bytesRead; @@ -870,7 +870,7 @@ nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength, return NS_ERROR_FAILURE; } - *rLength += bytesRead; + *aReadLength += bytesRead; PodCopy(data, buf.get(), bytesRead); remaining -= bytesRead; diff --git a/xpcom/io/nsDirectoryService.cpp b/xpcom/io/nsDirectoryService.cpp index 23e713beac5..c1e231d51df 100644 --- a/xpcom/io/nsDirectoryService.cpp +++ b/xpcom/io/nsDirectoryService.cpp @@ -77,7 +77,8 @@ nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile) if (dirService) { nsCOMPtr aLocalFile; - dirService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(aLocalFile)); + dirService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), + getter_AddRefs(aLocalFile)); if (aLocalFile) { *aFile = aLocalFile; NS_ADDREF(*aFile); @@ -86,8 +87,9 @@ nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile) } nsLocalFile* localFile = new nsLocalFile; - if (localFile == nullptr) + if (!localFile) { return NS_ERROR_OUT_OF_MEMORY; + } NS_ADDREF(localFile); #ifdef XP_WIN @@ -474,7 +476,8 @@ nsDirectoryService::RegisterCategoryProviders() strings->GetNext(entry); nsXPIDLCString contractID; - catman->GetCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY, entry.get(), getter_Copies(contractID)); + catman->GetCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY, entry.get(), + getter_Copies(contractID)); if (contractID) { nsCOMPtr provider = do_GetService(contractID.get()); diff --git a/xpcom/io/nsLinebreakConverter.cpp b/xpcom/io/nsLinebreakConverter.cpp index 1ee9bfa664f..dc86c0a8397 100644 --- a/xpcom/io/nsLinebreakConverter.cpp +++ b/xpcom/io/nsLinebreakConverter.cpp @@ -289,7 +289,8 @@ nsLinebreakConverter::ConvertLineBreaks(const char* aSrc, char* resultString; if (aSrcBreaks == eLinebreakAny) { - resultString = ConvertUnknownBreaks(aSrc, sourceLen, GetLinebreakString(aDestBreaks)); + resultString = ConvertUnknownBreaks(aSrc, sourceLen, + GetLinebreakString(aDestBreaks)); } else resultString = ConvertBreaks(aSrc, sourceLen, GetLinebreakString(aSrcBreaks), @@ -376,7 +377,8 @@ nsLinebreakConverter::ConvertUnicharLineBreaks(const char16_t* aSrc, char16_t* resultString; if (aSrcBreaks == eLinebreakAny) { - resultString = ConvertUnknownBreaks(aSrc, bufLen, GetLinebreakString(aDestBreaks)); + resultString = ConvertUnknownBreaks(aSrc, bufLen, + GetLinebreakString(aDestBreaks)); } else resultString = ConvertBreaks(aSrc, bufLen, GetLinebreakString(aSrcBreaks), GetLinebreakString(aDestBreaks)); diff --git a/xpcom/io/nsLocalFileCommon.cpp b/xpcom/io/nsLocalFileCommon.cpp index 43923321d31..5317db4d347 100644 --- a/xpcom/io/nsLocalFileCommon.cpp +++ b/xpcom/io/nsLocalFileCommon.cpp @@ -241,9 +241,11 @@ nsLocalFile::GetRelativeDescriptor(nsIFile* aFromFile, nsACString& aResult) return NS_ERROR_FAILURE; } - for (nodeIndex = 0; nodeIndex < thisNodeCnt && nodeIndex < fromNodeCnt; ++nodeIndex) { + for (nodeIndex = 0; nodeIndex < thisNodeCnt && + nodeIndex < fromNodeCnt; ++nodeIndex) { #ifdef XP_WIN - if (_wcsicmp(char16ptr_t(thisNodes[nodeIndex]), char16ptr_t(fromNodes[nodeIndex]))) { + if (_wcsicmp(char16ptr_t(thisNodes[nodeIndex]), + char16ptr_t(fromNodes[nodeIndex]))) { break; } #else diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index 7d50c7f431a..42b8f94dc92 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -129,7 +129,8 @@ nsDirEnumeratorUnix::~nsDirEnumeratorUnix() Close(); } -NS_IMPL_ISUPPORTS(nsDirEnumeratorUnix, nsISimpleEnumerator, nsIDirectoryEnumerator) +NS_IMPL_ISUPPORTS(nsDirEnumeratorUnix, nsISimpleEnumerator, + nsIDirectoryEnumerator) NS_IMETHODIMP nsDirEnumeratorUnix::Init(nsLocalFile* aParent, @@ -394,7 +395,7 @@ nsLocalFile::OpenNSPRFileDesc(int32_t aFlags, int32_t aMode, PRFileDesc** aResult) { *aResult = PR_Open(mPath.get(), aFlags, aMode); - if (! *aResult) { + if (!*aResult) { return NS_ErrorAccordingToNSPR(); } @@ -415,7 +416,7 @@ NS_IMETHODIMP nsLocalFile::OpenANSIFileDesc(const char* aMode, FILE** aResult) { *aResult = fopen(mPath.get(), aMode); - if (! *aResult) { + if (!*aResult) { return NS_ERROR_FAILURE; } @@ -1407,7 +1408,8 @@ nsLocalFile::GetDiskSpaceAvailable(int64_t* aDiskSpaceAvailable) && dq.dqb_bhardlimit) { int64_t QuotaSpaceAvailable = 0; if (dq.dqb_bhardlimit > dq.dqb_curspace) { - QuotaSpaceAvailable = int64_t(fs_buf.F_BSIZE * (dq.dqb_bhardlimit - dq.dqb_curspace)); + QuotaSpaceAvailable = + int64_t(fs_buf.F_BSIZE * (dq.dqb_bhardlimit - dq.dqb_curspace)); } if (QuotaSpaceAvailable < *aDiskSpaceAvailable) { *aDiskSpaceAvailable = QuotaSpaceAvailable; @@ -1949,7 +1951,8 @@ nsLocalFile::SetPersistentDescriptor(const nsACString& aPersistentDescriptor) Boolean changed; FSRef resolvedFSRef; - OSErr err = ::FSResolveAlias(nullptr, (AliasHandle)newHandle, &resolvedFSRef, &changed); + OSErr err = ::FSResolveAlias(nullptr, (AliasHandle)newHandle, &resolvedFSRef, + &changed); rv = MacErrorMapper(err); DisposeHandle(newHandle); @@ -1968,7 +1971,8 @@ nsLocalFile::Reveal() { #ifdef MOZ_WIDGET_GTK nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); - nsCOMPtr gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); + nsCOMPtr gnomevfs = + do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); if (!giovfs && !gnomevfs) { return NS_ERROR_FAILURE; } @@ -1986,7 +1990,8 @@ nsLocalFile::Reveal() { return gnomevfs->ShowURIForInput(mPath); } - } else if (giovfs && NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) { + } else if (giovfs && + NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) { return NS_OK; } else { nsCOMPtr parentDir; @@ -2022,7 +2027,8 @@ nsLocalFile::Launch() { #ifdef MOZ_WIDGET_GTK nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); - nsCOMPtr gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); + nsCOMPtr gnomevfs = + do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); if (giovfs) { return giovfs->ShowURIForInput(mPath); } else if (gnomevfs) { @@ -2403,7 +2409,8 @@ nsLocalFile::GetFSSpec(FSSpec* aResult) FSRef fsRef; nsresult rv = GetFSRef(&fsRef); if (NS_SUCCEEDED(rv)) { - OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNone, nullptr, nullptr, aResult, nullptr); + OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNone, nullptr, nullptr, + aResult, nullptr); return MacErrorMapper(err); } @@ -2430,7 +2437,8 @@ nsLocalFile::GetFileSizeWithResFork(int64_t* aFileSizeWithResFork) return MacErrorMapper(err); } - *aFileSizeWithResFork = catalogInfo.dataLogicalSize + catalogInfo.rsrcLogicalSize; + *aFileSizeWithResFork = + catalogInfo.dataLogicalSize + catalogInfo.rsrcLogicalSize; return NS_OK; } diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index b12e9a41d58..777b4fc4ed7 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -409,10 +409,10 @@ ShortcutResolver::SetShortcut(bool aUpdateExisting, // Since we reuse our IPersistFile, we have to clear out any values that // may be left over from previous calls to SetShortcut. - if (FAILED(mShellLink->SetWorkingDirectory(L"")) - || FAILED(mShellLink->SetArguments(L"")) - || FAILED(mShellLink->SetDescription(L"")) - || FAILED(mShellLink->SetIconLocation(L"", 0))) { + if (FAILED(mShellLink->SetWorkingDirectory(L"")) || + FAILED(mShellLink->SetArguments(L"")) || + FAILED(mShellLink->SetDescription(L"")) || + FAILED(mShellLink->SetIconLocation(L"", 0))) { return NS_ERROR_FAILURE; } } @@ -569,7 +569,8 @@ IsShortcutPath(const nsAString& aPath) // workaround last beyond the switch, |PRFilePrivate| and |_MDFileDesc| // need to be changed to match the definitions for WinNT. //----------------------------------------------------------------------------- -typedef enum { +typedef enum +{ _PR_TRI_TRUE = 1, _PR_TRI_FALSE = 0, _PR_TRI_UNKNOWN = -1 @@ -1006,8 +1007,9 @@ nsLocalFile::nsLocalFileConstructor(nsISupports* aOuter, const nsIID& aIID, } nsLocalFile* inst = new nsLocalFile(); - if (inst == nullptr) + if (!inst) { return NS_ERROR_OUT_OF_MEMORY; + } nsresult rv = inst->QueryInterface(aIID, aInstancePtr); if (NS_FAILED(rv)) { @@ -1417,9 +1419,9 @@ nsLocalFile::AppendInternal(const nsAFlatString& aNode, } // check the relative path for validity - if (aNode.First() == L'\\' // can't start with an '\' - || aNode.FindChar(L'/') != kNotFound // can't contain / - || aNode.EqualsASCII("..")) { // can't be .. + if (aNode.First() == L'\\' || // can't start with an '\' + aNode.FindChar(L'/') != kNotFound || // can't contain / + aNode.EqualsASCII("..")) { // can't be .. return NS_ERROR_FILE_UNRECOGNIZED_PATH; } @@ -1696,8 +1698,8 @@ nsLocalFile::GetVersionInfoField(const char* aField, nsAString& aResult) rv = NS_ERROR_FAILURE; - const WCHAR* path = mFollowSymlinks ? mResolvedPath.get() - : mWorkingPath.get(); + const WCHAR* path = + mFollowSymlinks ? mResolvedPath.get() : mWorkingPath.get(); DWORD dummy; DWORD size = ::GetFileVersionInfoSizeW(path, &dummy); @@ -1720,8 +1722,7 @@ nsLocalFile::GetVersionInfoField(const char* aField, nsAString& aResult) wchar_t subBlock[MAX_PATH]; _snwprintf(subBlock, MAX_PATH, L"\\StringFileInfo\\%04x%04x\\%s", - (i == 0 ? translate[0].wLanguage - : ::GetUserDefaultLangID()), + (i == 0 ? translate[0].wLanguage : ::GetUserDefaultLangID()), translate[0].wCodePage, NS_ConvertASCIItoUTF16( nsDependentCString(aField)).get()); @@ -1995,8 +1996,9 @@ nsLocalFile::CopyMove(nsIFile* aParentDir, const nsAString& aNewName, newParentDir->GetTarget(target); nsCOMPtr realDest = new nsLocalFile(); - if (realDest == nullptr) + if (!realDest) { return NS_ERROR_OUT_OF_MEMORY; + } rv = realDest->InitWithPath(target); @@ -2268,7 +2270,7 @@ nsLocalFile::Load(PRLibrary** aResult) return rv; } - if (! isFile) { + if (!isFile) { return NS_ERROR_FILE_IS_DIRECTORY; } @@ -2755,7 +2757,8 @@ nsLocalFile::GetParent(nsIFile** aParent) } nsCOMPtr localFile; - nsresult rv = NS_NewLocalFile(parentPath, mFollowSymlinks, getter_AddRefs(localFile)); + nsresult rv = NS_NewLocalFile(parentPath, mFollowSymlinks, + getter_AddRefs(localFile)); if (NS_FAILED(rv)) { return rv; @@ -3340,8 +3343,9 @@ nsresult NS_NewLocalFile(const nsAString& aPath, bool aFollowLinks, nsIFile** aResult) { nsLocalFile* file = new nsLocalFile(); - if (file == nullptr) + if (!file) { return NS_ERROR_OUT_OF_MEMORY; + } NS_ADDREF(file); file->SetFollowLinks(aFollowLinks); diff --git a/xpcom/io/nsMultiplexInputStream.cpp b/xpcom/io/nsMultiplexInputStream.cpp index 2cc46010165..7bfc6b1a4a9 100644 --- a/xpcom/io/nsMultiplexInputStream.cpp +++ b/xpcom/io/nsMultiplexInputStream.cpp @@ -150,7 +150,8 @@ SeekableStreamAtBeginning(nsIInputStream* aStream) NS_IMETHODIMP nsMultiplexInputStream::AppendStream(nsIInputStream* aStream) { - NS_ASSERTION(SeekableStreamAtBeginning(aStream), "Appended stream not at beginning."); + NS_ASSERTION(SeekableStreamAtBeginning(aStream), + "Appended stream not at beginning."); return mStreams.AppendElement(aStream) ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } @@ -158,7 +159,8 @@ nsMultiplexInputStream::AppendStream(nsIInputStream* aStream) NS_IMETHODIMP nsMultiplexInputStream::InsertStream(nsIInputStream* aStream, uint32_t aIndex) { - NS_ASSERTION(SeekableStreamAtBeginning(aStream), "Inserted stream not at beginning."); + NS_ASSERTION(SeekableStreamAtBeginning(aStream), + "Inserted stream not at beginning."); mStreams.InsertElementAt(aIndex, aStream); if (mCurrentStream > aIndex || (mCurrentStream == aIndex && mStartedReadingCurrent)) { diff --git a/xpcom/io/nsScriptableInputStream.cpp b/xpcom/io/nsScriptableInputStream.cpp index a7ca6d45fb7..08bc938f985 100644 --- a/xpcom/io/nsScriptableInputStream.cpp +++ b/xpcom/io/nsScriptableInputStream.cpp @@ -56,7 +56,8 @@ nsScriptableInputStream::Read(uint32_t aCount, char** aResult) } // bug716556 - Ensure count+1 doesn't overflow - uint32_t count = XPCOM_MIN((uint32_t)XPCOM_MIN(count64, aCount), UINT32_MAX - 1); + uint32_t count = + XPCOM_MIN((uint32_t)XPCOM_MIN(count64, aCount), UINT32_MAX - 1); buffer = (char*)moz_malloc(count + 1); // make room for '\0' if (!buffer) { return NS_ERROR_OUT_OF_MEMORY; diff --git a/xpcom/io/nsStorageStream.cpp b/xpcom/io/nsStorageStream.cpp index 7b511a0d62d..1c34640a35f 100644 --- a/xpcom/io/nsStorageStream.cpp +++ b/xpcom/io/nsStorageStream.cpp @@ -479,7 +479,7 @@ nsStorageInputStream::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure, count = XPCOM_MIN(availableInSegment, remainingCapacity); rv = aWriter(this, aClosure, cur + mReadCursor, aCount - remainingCapacity, - count, &bytesConsumed); + count, &bytesConsumed); if (NS_FAILED(rv) || (bytesConsumed == 0)) { break; } @@ -609,7 +609,8 @@ nsStorageInputStream::Serialize(InputStreamParams& aParams, FileDescriptorArray& } bool -nsStorageInputStream::Deserialize(const InputStreamParams& aParams, const FileDescriptorArray&) +nsStorageInputStream::Deserialize(const InputStreamParams& aParams, + const FileDescriptorArray&) { NS_NOTREACHED("We should never attempt to deserialize a storage input stream."); return false; diff --git a/xpcom/io/nsStreamUtils.cpp b/xpcom/io/nsStreamUtils.cpp index 19598dcf663..98b7b0de649 100644 --- a/xpcom/io/nsStreamUtils.cpp +++ b/xpcom/io/nsStreamUtils.cpp @@ -616,8 +616,7 @@ NS_AsyncCopy(nsIInputStream* aSource, aCloseSource, aCloseSink, aProgressCallback); if (aCopierCtx) { - *aCopierCtx = static_cast( - static_cast(copier)); + *aCopierCtx = static_cast(static_cast(copier)); NS_ADDREF(*aCopierCtx); } NS_RELEASE(copier); @@ -630,15 +629,16 @@ NS_AsyncCopy(nsIInputStream* aSource, nsresult NS_CancelAsyncCopy(nsISupports* aCopierCtx, nsresult aReason) { - nsAStreamCopier* copier = static_cast( - static_cast(aCopierCtx)); + nsAStreamCopier* copier = + static_cast(static_cast(aCopierCtx)); return copier->Cancel(aReason); } //----------------------------------------------------------------------------- nsresult -NS_ConsumeStream(nsIInputStream* aStream, uint32_t aMaxCount, nsACString& aResult) +NS_ConsumeStream(nsIInputStream* aStream, uint32_t aMaxCount, + nsACString& aResult) { nsresult rv = NS_OK; aResult.Truncate(); @@ -712,8 +712,7 @@ NS_InputStreamIsBuffered(nsIInputStream* aStream) bool result = false; uint32_t n; - nsresult rv = aStream->ReadSegments(TestInputStream, - &result, 1, &n); + nsresult rv = aStream->ReadSegments(TestInputStream, &result, 1, &n); return result || NS_SUCCEEDED(rv); } diff --git a/xpcom/io/nsStringStream.cpp b/xpcom/io/nsStringStream.cpp index 5ce4e15c15d..0075cb4d52b 100644 --- a/xpcom/io/nsStringStream.cpp +++ b/xpcom/io/nsStringStream.cpp @@ -231,7 +231,8 @@ nsStringInputStream::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure, if (aCount > maxCount) { aCount = maxCount; } - nsresult rv = aWriter(this, aClosure, mData.BeginReading() + mOffset, 0, aCount, aResult); + nsresult rv = aWriter(this, aClosure, mData.BeginReading() + mOffset, 0, + aCount, aResult); if (NS_SUCCEEDED(rv)) { NS_ASSERTION(*aResult <= aCount, "writer should not write more than we asked it to write"); @@ -344,7 +345,7 @@ NS_NewByteInputStream(nsIInputStream** aStreamResult, NS_PRECONDITION(aStreamResult, "null out ptr"); nsStringInputStream* stream = new nsStringInputStream(); - if (! stream) { + if (!stream) { return NS_ERROR_OUT_OF_MEMORY; } @@ -390,7 +391,7 @@ NS_NewCStringInputStream(nsIInputStream** aStreamResult, NS_PRECONDITION(aStreamResult, "null out ptr"); nsStringInputStream* stream = new nsStringInputStream(); - if (! stream) { + if (!stream) { return NS_ERROR_OUT_OF_MEMORY; } @@ -404,7 +405,8 @@ NS_NewCStringInputStream(nsIInputStream** aStreamResult, // factory method for constructing a nsStringInputStream object nsresult -nsStringInputStreamConstructor(nsISupports* aOuter, REFNSIID aIID, void** aResult) +nsStringInputStreamConstructor(nsISupports* aOuter, REFNSIID aIID, + void** aResult) { *aResult = nullptr; diff --git a/xpcom/io/nsUnicharInputStream.cpp b/xpcom/io/nsUnicharInputStream.cpp index ee302948945..59c4456f19a 100644 --- a/xpcom/io/nsUnicharInputStream.cpp +++ b/xpcom/io/nsUnicharInputStream.cpp @@ -422,8 +422,9 @@ nsSimpleUnicharStreamFactory::CreateInstanceFromString(const nsAString& aString, } NS_IMETHODIMP -nsSimpleUnicharStreamFactory::CreateInstanceFromUTF8Stream(nsIInputStream* aStreamToWrap, - nsIUnicharInputStream** aResult) +nsSimpleUnicharStreamFactory::CreateInstanceFromUTF8Stream( + nsIInputStream* aStreamToWrap, + nsIUnicharInputStream** aResult) { *aResult = nullptr; diff --git a/xpcom/string/nsReadableUtils.cpp b/xpcom/string/nsReadableUtils.cpp index 27e34427b07..7cdb8e86c05 100644 --- a/xpcom/string/nsReadableUtils.cpp +++ b/xpcom/string/nsReadableUtils.cpp @@ -87,7 +87,8 @@ LossyAppendUTF16toASCII(const nsAString& aSource, nsACString& aDest) // right now, this won't work on multi-fragment destinations LossyConvertEncoding16to8 converter(dest.get()); - copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter); + copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), + converter); } void @@ -103,7 +104,8 @@ AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest, const mozilla::fallible_t&) { uint32_t old_dest_length = aDest.Length(); - if (!aDest.SetLength(old_dest_length + aSource.Length(), mozilla::fallible_t())) { + if (!aDest.SetLength(old_dest_length + aSource.Length(), + mozilla::fallible_t())) { return false; } @@ -117,7 +119,8 @@ AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest, // right now, this won't work on multi-fragment destinations LossyConvertEncoding8to16 converter(dest.get()); - copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter); + copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), + converter); return true; } @@ -254,7 +257,8 @@ inline ToCharT* AllocateStringCopy(const FromStringT& aSource, ToCharT*) { - return static_cast(nsMemory::Alloc((aSource.Length() + 1) * sizeof(ToCharT))); + return static_cast(nsMemory::Alloc( + (aSource.Length() + 1) * sizeof(ToCharT))); } @@ -311,7 +315,8 @@ ToNewCString(const nsACString& aSource) nsACString::const_iterator fromBegin, fromEnd; char* toBegin = result; - *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char(0); + *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), + toBegin) = char(0); return result; } @@ -327,7 +332,8 @@ ToNewUnicode(const nsAString& aSource) nsAString::const_iterator fromBegin, fromEnd; char16_t* toBegin = result; - *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char16_t(0); + *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), + toBegin) = char16_t(0); return result; } @@ -643,7 +649,8 @@ ToUpperCase(const nsACString& aSource, nsACString& aDest) aDest.SetLength(aSource.Length()); CopyToUpperCase converter(aDest.BeginWriting(toBegin)); - copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter); + copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), + converter); } /** @@ -723,7 +730,8 @@ ToLowerCase(const nsACString& aSource, nsACString& aDest) aDest.SetLength(aSource.Length()); CopyToLowerCase converter(aDest.BeginWriting(toBegin)); - copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter); + copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), + converter); } bool diff --git a/xpcom/string/nsTString.cpp b/xpcom/string/nsTString.cpp index f35f9a33e10..72a5e230b8d 100644 --- a/xpcom/string/nsTString.cpp +++ b/xpcom/string/nsTString.cpp @@ -23,7 +23,7 @@ nsTAdoptingString_CharT::operator=(const self_type& str) SetDataFlags(F_TERMINATED | F_OWNED); // Make str forget the buffer we just took ownership of. - new(mutable_str) self_type(); + new (mutable_str) self_type(); } else { Assign(str); diff --git a/xpcom/string/nsTSubstringTuple.cpp b/xpcom/string/nsTSubstringTuple.cpp index 7bdaf73dae7..75c3c9728c9 100644 --- a/xpcom/string/nsTSubstringTuple.cpp +++ b/xpcom/string/nsTSubstringTuple.cpp @@ -76,17 +76,18 @@ nsTSubstringTuple_CharT::WriteTo(char_type* aBuf, uint32_t aBufLen) const */ bool -nsTSubstringTuple_CharT::IsDependentOn(const char_type* start, const char_type* end) const +nsTSubstringTuple_CharT::IsDependentOn(const char_type* aStart, + const char_type* aEnd) const { - // we start with the right-most fragment since it is faster to check. + // we aStart with the right-most fragment since it is faster to check. - if (TO_SUBSTRING(mFragB).IsDependentOn(start, end)) { + if (TO_SUBSTRING(mFragB).IsDependentOn(aStart, aEnd)) { return true; } if (mHead) { - return mHead->IsDependentOn(start, end); + return mHead->IsDependentOn(aStart, aEnd); } - return TO_SUBSTRING(mFragA).IsDependentOn(start, end); + return TO_SUBSTRING(mFragA).IsDependentOn(aStart, aEnd); } diff --git a/xpcom/string/nsUTF8UtilsSSE2.cpp b/xpcom/string/nsUTF8UtilsSSE2.cpp index 1cd9beb41cf..daf2c56b0f1 100644 --- a/xpcom/string/nsUTF8UtilsSSE2.cpp +++ b/xpcom/string/nsUTF8UtilsSSE2.cpp @@ -18,7 +18,8 @@ LossyConvertEncoding16to8::write_sse2(const char16_t* aSource, // Align source to a 16-byte boundary. uint32_t i = 0; uint32_t alignLen = - XPCOM_MIN(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(char16_t)); + XPCOM_MIN(aSourceLength, + uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(char16_t)); for (; i < alignLen; ++i) { dest[i] = static_cast(aSource[i]); } @@ -71,7 +72,8 @@ LossyConvertEncoding8to16::write_sse2(const char* aSource, // to wait for a load to complete, but you can keep on moving after issuing a // store. uint32_t i = 0; - uint32_t alignLen = XPCOM_MIN(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf)); + uint32_t alignLen = XPCOM_MIN(aSourceLength, + uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf)); for (; i < alignLen; ++i) { dest[i] = static_cast(aSource[i]); } diff --git a/xpcom/threads/ThreadStackHelper.cpp b/xpcom/threads/ThreadStackHelper.cpp index a8b57569c4b..8a95346413b 100644 --- a/xpcom/threads/ThreadStackHelper.cpp +++ b/xpcom/threads/ThreadStackHelper.cpp @@ -187,8 +187,7 @@ void ThreadStackHelper::GetThreadStackBase() #elif defined(XP_WIN) ::MEMORY_BASIC_INFORMATION meminfo = {}; - NS_ENSURE_TRUE_VOID(::VirtualQuery( - &meminfo, &meminfo, sizeof(meminfo))); + NS_ENSURE_TRUE_VOID(::VirtualQuery(&meminfo, &meminfo, sizeof(meminfo))); #ifdef MOZ_THREADSTACKHELPER_STACK_GROWS_DOWN mThreadStackBase = intptr_t(meminfo.BaseAddress) + meminfo.RegionSize; #else @@ -206,7 +205,7 @@ void ThreadStackHelper::GetThreadStackBase() #endif // MOZ_THREADSTACKHELPER_NATIVE namespace { -template +template class ScopedSetPtr { private: @@ -278,7 +277,8 @@ ThreadStackHelper::GetStack(Stack& aStack) #ifdef MOZ_THREADSTACKHELPER_NATIVE class ThreadStackHelper::CodeModulesProvider - : public google_breakpad::CodeModules { + : public google_breakpad::CodeModules +{ private: typedef google_breakpad::CodeModule CodeModule; typedef google_breakpad::BasicCodeModule BasicCodeModule; @@ -290,24 +290,29 @@ public: CodeModulesProvider() : mLibs(SharedLibraryInfo::GetInfoForSelf()) {} virtual ~CodeModulesProvider() {} - virtual unsigned int module_count() const { + virtual unsigned int module_count() const + { return mLibs.GetSize(); } - virtual const CodeModule* GetModuleForAddress(uint64_t address) const { + virtual const CodeModule* GetModuleForAddress(uint64_t aAddress) const + { MOZ_CRASH("Not implemented"); } - virtual const CodeModule* GetMainModule() const { + virtual const CodeModule* GetMainModule() const + { return nullptr; } - virtual const CodeModule* GetModuleAtSequence(unsigned int sequence) const { + virtual const CodeModule* GetModuleAtSequence(unsigned int aSequence) const + { MOZ_CRASH("Not implemented"); } - virtual const CodeModule* GetModuleAtIndex(unsigned int index) const { - const SharedLibrary& lib = mLibs.GetEntry(index); + virtual const CodeModule* GetModuleAtIndex(unsigned int aIndex) const + { + const SharedLibrary& lib = mLibs.GetEntry(aIndex); mModule = new BasicCodeModule(lib.GetStart(), lib.GetEnd() - lib.GetStart(), lib.GetName(), lib.GetBreakpadId(), lib.GetName(), lib.GetBreakpadId(), ""); @@ -315,13 +320,15 @@ public: return mModule; } - virtual const CodeModules* Copy() const { + virtual const CodeModules* Copy() const + { MOZ_CRASH("Not implemented"); } }; class ThreadStackHelper::ThreadContext - : public google_breakpad::MemoryRegion { + : public google_breakpad::MemoryRegion +{ public: #if defined(MOZ_THREADSTACKHELPER_X86) typedef MDRawContextX86 Context; @@ -347,39 +354,41 @@ public: // End of stack area const void* mStackEnd; - ThreadContext() : mValid(false) - , mStackBase(0) - , mStackSize(0) - , mStackEnd(nullptr) {} + ThreadContext() + : mValid(false) + , mStackBase(0) + , mStackSize(0) + , mStackEnd(nullptr) {} virtual ~ThreadContext() {} - virtual uint64_t GetBase() const { - return uint64_t(mStackBase); + virtual uint64_t GetBase() const { return uint64_t(mStackBase); } + virtual uint32_t GetSize() const { return mStackSize; } + virtual bool GetMemoryAtAddress(uint64_t aAddress, uint8_t* aValue) const + { + return GetMemoryAtAddressInternal(aAddress, aValue); } - virtual uint32_t GetSize() const { - return mStackSize; + virtual bool GetMemoryAtAddress(uint64_t aAddress, uint16_t* aValue) const + { + return GetMemoryAtAddressInternal(aAddress, aValue); } - virtual bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const { - return GetMemoryAtAddressInternal(address, value); + virtual bool GetMemoryAtAddress(uint64_t aAddress, uint32_t* aValue) const + { + return GetMemoryAtAddressInternal(aAddress, aValue); } - virtual bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const { - return GetMemoryAtAddressInternal(address, value); - } - virtual bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const { - return GetMemoryAtAddressInternal(address, value); - } - virtual bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const { - return GetMemoryAtAddressInternal(address, value); + virtual bool GetMemoryAtAddress(uint64_t aAddress, uint64_t* aValue) const + { + return GetMemoryAtAddressInternal(aAddress, aValue); } private: - template - bool GetMemoryAtAddressInternal(uint64_t address, T* value) const { - const intptr_t offset = intptr_t(address) - intptr_t(GetBase()); + template + bool GetMemoryAtAddressInternal(uint64_t aAddress, T* aValue) const + { + const intptr_t offset = intptr_t(aAddress) - intptr_t(GetBase()); if (offset < 0 || uintptr_t(offset) > (GetSize() - sizeof(T))) { return false; } - *value = *reinterpret_cast(&mStack[offset]); + *aValue = *reinterpret_cast(&mStack[offset]); return true; } }; diff --git a/xpcom/threads/nsEventQueue.cpp b/xpcom/threads/nsEventQueue.cpp index 45ba390312d..4e5f9fa631c 100644 --- a/xpcom/threads/nsEventQueue.cpp +++ b/xpcom/threads/nsEventQueue.cpp @@ -85,10 +85,10 @@ nsEventQueue::GetEvent(bool aMayWait, nsIRunnable** aResult) } void -nsEventQueue::PutEvent(nsIRunnable *runnable) +nsEventQueue::PutEvent(nsIRunnable* aRunnable) { // Avoid calling AddRef+Release while holding our monitor. - nsRefPtr event(runnable); + nsRefPtr event(aRunnable); if (ChaosMode::isActive()) { // With probability 0.5, yield so other threads have a chance to @@ -108,7 +108,7 @@ nsEventQueue::PutEvent(nsIRunnable *runnable) mOffsetHead = 0; mOffsetTail = 0; } else if (mOffsetTail == EVENTS_PER_PAGE) { - Page *page = NewPage(); + Page* page = NewPage(); MOZ_ASSERT(page); mTail->mNext = page; @@ -118,6 +118,6 @@ nsEventQueue::PutEvent(nsIRunnable *runnable) event.swap(mTail->mEvents[mOffsetTail]); ++mOffsetTail; - LOG(("EVENTQ(%p): notify\n", this)); + LOG(("EVENTQ(%p): notify\n", this)); mon.NotifyAll(); } diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index a5e28d8db57..d96114e1fcb 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -214,9 +214,7 @@ public: // This method needs to be public to support older compilers (xlC_r on AIX). // It should be called directly as this class type is reference counted. - virtual ~nsThreadStartupEvent() - { - } + virtual ~nsThreadStartupEvent() {} private: NS_IMETHOD Run() @@ -688,7 +686,8 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult) LOG(("THRD(%p) ProcessNextEvent [%u %u]\n", this, aMayWait, mRunningEvent)); // If we're on the main thread, we shouldn't be dispatching CPOWs. - MOZ_RELEASE_ASSERT(mIsMainThread != MAIN_THREAD || !ipc::ProcessingUrgentMessages()); + MOZ_RELEASE_ASSERT(mIsMainThread != MAIN_THREAD || + !ipc::ProcessingUrgentMessages()); if (NS_WARN_IF(PR_GetCurrentThread() != mThread)) { return NS_ERROR_NOT_SAME_THREAD; diff --git a/xpcom/threads/nsTimerImpl.cpp b/xpcom/threads/nsTimerImpl.cpp index fd54a856069..b51e6cc2bb9 100644 --- a/xpcom/threads/nsTimerImpl.cpp +++ b/xpcom/threads/nsTimerImpl.cpp @@ -557,7 +557,7 @@ nsTimerImpl::Fire() } PROFILER_LABEL("Timer", "Fire", - js::ProfileEntry::Category::OTHER); + js::ProfileEntry::Category::OTHER); #ifdef MOZ_TASK_TRACER mozilla::tasktracer::AutoRunFakeTracedTask runTracedTask(mTracedTask);