diff --git a/xpcom/base/CodeAddressService.h b/xpcom/base/CodeAddressService.h index a4572d33510..38943c7f407 100644 --- a/xpcom/base/CodeAddressService.h +++ b/xpcom/base/CodeAddressService.h @@ -154,7 +154,8 @@ public: } const char* library = mLibraryStrings.Intern(details.library); - entry.Replace(aPc, details.function, library, details.loffset, details.filename, details.lineno); + entry.Replace(aPc, details.function, library, details.loffset, + details.filename, details.lineno); } else { mNumCacheHits++; diff --git a/xpcom/base/CycleCollectedJSRuntime.h b/xpcom/base/CycleCollectedJSRuntime.h index c364d79e840..5ae7bf6f9d0 100644 --- a/xpcom/base/CycleCollectedJSRuntime.h +++ b/xpcom/base/CycleCollectedJSRuntime.h @@ -121,22 +121,13 @@ protected: size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; void UnmarkSkippableJSHolders(); - virtual void TraverseAdditionalNativeRoots(nsCycleCollectionNoteRootCallback& aCb) - { - } - virtual void TraceAdditionalNativeGrayRoots(JSTracer* aTracer) - { - } + virtual void + TraverseAdditionalNativeRoots(nsCycleCollectionNoteRootCallback& aCb) {} + virtual void TraceAdditionalNativeGrayRoots(JSTracer* aTracer) {} - virtual void CustomGCCallback(JSGCStatus aStatus) - { - } - virtual void CustomOutOfMemoryCallback() - { - } - virtual void CustomLargeAllocationFailureCallback() - { - } + virtual void CustomGCCallback(JSGCStatus aStatus) {} + virtual void CustomOutOfMemoryCallback() {} + virtual void CustomLargeAllocationFailureCallback() {} virtual bool CustomContextCallback(JSContext* aCx, unsigned aOperation) { return true; // Don't block context creation. @@ -191,8 +182,8 @@ private: static void TraceBlackJS(JSTracer* aTracer, void* aData); static void TraceGrayJS(JSTracer* aTracer, void* aData); static void GCCallback(JSRuntime* aRuntime, JSGCStatus aStatus, void* aData); - static void OutOfMemoryCallback(JSContext *aContext, void *aData); - static void LargeAllocationFailureCallback(void *aData); + static void OutOfMemoryCallback(JSContext* aContext, void* aData); + static void LargeAllocationFailureCallback(void* aData); static bool ContextCallback(JSContext* aCx, unsigned aOperation, void* aData); @@ -240,7 +231,7 @@ public: MOZ_END_NESTED_ENUM_CLASS(OOMState) private: - void AnnotateAndSetOutOfMemory(OOMState *aStatePtr, OOMState aNewState); + void AnnotateAndSetOutOfMemory(OOMState* aStatePtr, OOMState aNewState); void OnGC(JSGCStatus aStatus); void OnOutOfMemory(); void OnLargeAllocationFailure(); diff --git a/xpcom/base/StaticPtr.h b/xpcom/base/StaticPtr.h index a0c315e35dc..05a1351cf5b 100644 --- a/xpcom/base/StaticPtr.h +++ b/xpcom/base/StaticPtr.h @@ -54,15 +54,9 @@ public: return *this; } - T* get() const - { - return mRawPtr; - } + T* get() const { return mRawPtr; } - operator T*() const - { - return get(); - } + operator T*() const { return get(); } T* operator->() const { @@ -70,10 +64,7 @@ public: return get(); } - T& operator*() const - { - return *get(); - } + T& operator*() const { return *get(); } private: // Disallow copy constructor, but only in debug mode. We only define @@ -120,15 +111,9 @@ public: return (this = aRhs.mRawPtr); } - T* get() const - { - return mRawPtr; - } + T* get() const { return mRawPtr; } - operator T*() const - { - return get(); - } + operator T*() const { return get(); } T* operator->() const { @@ -136,10 +121,7 @@ public: return get(); } - T& operator*() const - { - return *get(); - } + T& operator*() const { return *get(); } private: void AssignWithAddref(T* aNewPtr) diff --git a/xpcom/base/nsConsoleService.h b/xpcom/base/nsConsoleService.h index d3c362fb6c9..f5ce999fbe8 100644 --- a/xpcom/base/nsConsoleService.h +++ b/xpcom/base/nsConsoleService.h @@ -53,8 +53,10 @@ public: virtual nsresult LogMessageWithMode(nsIConsoleMessage* aMessage, OutputMode aOutputMode); - typedef nsInterfaceHashtable ListenerHash; - void EnumerateListeners(ListenerHash::EnumReadFunction aFunction, void* aClosure); + typedef nsInterfaceHashtable ListenerHash; + void EnumerateListeners(ListenerHash::EnumReadFunction aFunction, + void* aClosure); private: ~nsConsoleService(); diff --git a/xpcom/base/nsSetDllDirectory.h b/xpcom/base/nsSetDllDirectory.h index 54ddc2247cf..0920d5936f7 100644 --- a/xpcom/base/nsSetDllDirectory.h +++ b/xpcom/base/nsSetDllDirectory.h @@ -23,7 +23,8 @@ SanitizeEnvironmentVariables() DWORD bufferSize = GetEnvironmentVariableW(L"PATH", nullptr, 0); if (bufferSize) { wchar_t* originalPath = new wchar_t[bufferSize]; - if (bufferSize - 1 == GetEnvironmentVariableW(L"PATH", originalPath, bufferSize)) { + if (bufferSize - 1 == GetEnvironmentVariableW(L"PATH", originalPath, + bufferSize)) { bufferSize = ExpandEnvironmentStringsW(originalPath, nullptr, 0); if (bufferSize) { wchar_t* newPath = new wchar_t[bufferSize]; diff --git a/xpcom/ds/nsExpirationTracker.h b/xpcom/ds/nsExpirationTracker.h index 7b7d26f32f3..7e3b920f6d5 100644 --- a/xpcom/ds/nsExpirationTracker.h +++ b/xpcom/ds/nsExpirationTracker.h @@ -109,7 +109,8 @@ public: nsresult AddObject(T* aObj) { nsExpirationState* state = aObj->GetExpirationState(); - NS_ASSERTION(!state->IsTracked(), "Tried to add an object that's already tracked"); + NS_ASSERTION(!state->IsTracked(), + "Tried to add an object that's already tracked"); nsTArray& generation = mGenerations[mNewestGeneration]; uint32_t index = generation.Length(); if (index > nsExpirationState::MAX_INDEX_IN_GENERATION) { diff --git a/xpcom/ds/nsProperties.h b/xpcom/ds/nsProperties.h index aef99acd4b0..acf5426b795 100644 --- a/xpcom/ds/nsProperties.h +++ b/xpcom/ds/nsProperties.h @@ -20,8 +20,8 @@ {0x93, 0xb6, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \ } -typedef nsInterfaceHashtable - nsProperties_HashBase; +typedef nsInterfaceHashtable nsProperties_HashBase; class nsProperties MOZ_FINAL : public nsIProperties diff --git a/xpcom/glue/DeadlockDetector.h b/xpcom/glue/DeadlockDetector.h index e16443935ee..6a6fd802bb8 100644 --- a/xpcom/glue/DeadlockDetector.h +++ b/xpcom/glue/DeadlockDetector.h @@ -296,7 +296,7 @@ public: index_type i = 0; size_type len = aStart->mOrderedLT.Length(); - for (const OrderingEntry* const* it = aStart->mOrderedLT.Elements(); i < len; ++i, ++it) { + for (auto it = aStart->mOrderedLT.Elements(); i < len; ++i, ++it) { if (InTransitiveClosure(*it, aTarget)) { return true; } @@ -347,7 +347,7 @@ public: index_type i = 0; size_type len = aStart->mOrderedLT.Length(); - for (const OrderingEntry* const* it = aStart->mOrderedLT.Elements(); i < len; ++i, ++it) { + for (auto it = aStart->mOrderedLT.Elements(); i < len; ++i, ++it) { aChain->AppendElement((*it)->mResource); if (GetDeductionChain_Helper(*it, aTarget, aChain)) { return true; diff --git a/xpcom/glue/nsBaseHashtable.h b/xpcom/glue/nsBaseHashtable.h index c727fcb2baa..8fd22e0f54b 100644 --- a/xpcom/glue/nsBaseHashtable.h +++ b/xpcom/glue/nsBaseHashtable.h @@ -129,7 +129,8 @@ public: } NS_WARN_UNUSED_RESULT bool Put(KeyType aKey, const UserDataType& aData, - const fallible_t&) { + const fallible_t&) + { EntryType* ent = this->PutEntry(aKey); if (!ent) { return false; @@ -223,7 +224,7 @@ public: */ typedef size_t (*SizeOfEntryExcludingThisFun)(KeyType aKey, - const DataType &aData, + const DataType& aData, mozilla::MallocSizeOf aMallocSizeOf, void* aUserArg); diff --git a/xpcom/glue/nsComponentManagerUtils.h b/xpcom/glue/nsComponentManagerUtils.h index aa1772d26f0..59616325526 100644 --- a/xpcom/glue/nsComponentManagerUtils.h +++ b/xpcom/glue/nsComponentManagerUtils.h @@ -31,7 +31,8 @@ NS_COM_GLUE nsresult CallGetClassObject(const char* aContractID, class NS_COM_GLUE nsCreateInstanceByCID : public nsCOMPtr_helper { public: - nsCreateInstanceByCID(const nsCID& aCID, nsISupports* aOuter, nsresult* aErrorPtr) + nsCreateInstanceByCID(const nsCID& aCID, nsISupports* aOuter, + nsresult* aErrorPtr) : mCID(aCID) , mOuter(aOuter) , mErrorPtr(aErrorPtr) diff --git a/xpcom/glue/nsProxyRelease.h b/xpcom/glue/nsProxyRelease.h index 4feb0cece1d..a365e1ae4a7 100644 --- a/xpcom/glue/nsProxyRelease.h +++ b/xpcom/glue/nsProxyRelease.h @@ -177,7 +177,10 @@ class nsMainThreadPtrHandle public: nsMainThreadPtrHandle() : mPtr(nullptr) {} - explicit nsMainThreadPtrHandle(nsMainThreadPtrHolder* aHolder) : mPtr(aHolder) {} + explicit nsMainThreadPtrHandle(nsMainThreadPtrHolder* aHolder) + : mPtr(aHolder) + { + } nsMainThreadPtrHandle(const nsMainThreadPtrHandle& aOther) : mPtr(aOther.mPtr) { diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index 74111b2e0f5..22fdc21c106 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -473,7 +473,7 @@ public: } // Invoke the copy-constructor in place. template - static inline void Construct(E* aE, A &&aArg) + static inline void Construct(E* aE, A&& aArg) { typedef typename mozilla::RemoveCV::Type E_NoCV; typedef typename mozilla::RemoveCV::Type A_NoCV; @@ -1103,8 +1103,9 @@ public: { // Adjust memory allocation up-front to catch errors. if (!Alloc::Successful(this->EnsureCapacity(Length() + aArrayLen - aCount, - sizeof(elem_type)))) + sizeof(elem_type)))) { return nullptr; + } DestructRange(aStart, aCount); this->ShiftData(aStart, aCount, aArrayLen, sizeof(elem_type), MOZ_ALIGNOF(elem_type)); @@ -1164,8 +1165,9 @@ public: elem_type* InsertElementAt(index_type aIndex) { if (!Alloc::Successful(this->EnsureCapacity(Length() + 1, - sizeof(elem_type)))) + sizeof(elem_type)))) { return nullptr; + } this->ShiftData(aIndex, 0, 1, sizeof(elem_type), MOZ_ALIGNOF(elem_type)); elem_type* elem = Elements() + aIndex; elem_traits::Construct(elem); @@ -1177,11 +1179,13 @@ public: elem_type* InsertElementAt(index_type aIndex, elem_type&& aItem) { if (!Alloc::Successful(this->EnsureCapacity(Length() + 1, - sizeof(elem_type)))) + sizeof(elem_type)))) { return nullptr; + } this->ShiftData(aIndex, 0, 1, sizeof(elem_type), MOZ_ALIGNOF(elem_type)); elem_type* elem = Elements() + aIndex; - nsTArrayElementTraits::Construct(elem, mozilla::Forward(aItem)); + nsTArrayElementTraits::Construct(elem, + mozilla::Forward(aItem)); return elem; } @@ -1257,8 +1261,9 @@ public: elem_type* AppendElements(const Item* aArray, size_type aArrayLen) { if (!Alloc::Successful(this->EnsureCapacity(Length() + aArrayLen, - sizeof(elem_type)))) + sizeof(elem_type)))) { return nullptr; + } index_type len = Length(); AssignRange(len, aArrayLen, aArray); this->IncrementLength(aArrayLen); @@ -1283,11 +1288,13 @@ public: elem_type* AppendElement(elem_type&& aItem) { if (!Alloc::Successful(this->EnsureCapacity(Length() + 1, - sizeof(elem_type)))) + sizeof(elem_type)))) { return nullptr; + } index_type len = Length(); elem_type* iter = Elements() + len; - nsTArrayElementTraits::Construct(iter, mozilla::Forward(aItem)); + nsTArrayElementTraits::Construct(iter, + mozilla::Forward(aItem)); this->IncrementLength(1); return iter; } @@ -1299,8 +1306,9 @@ public: elem_type* AppendElements(size_type aCount) { if (!Alloc::Successful(this->EnsureCapacity(Length() + aCount, - sizeof(elem_type)))) + sizeof(elem_type)))) { return nullptr; + } elem_type* elems = Elements() + Length(); size_type i; for (i = 0; i < aCount; ++i) { @@ -1325,8 +1333,9 @@ public: index_type len = Length(); index_type otherLen = aArray.Length(); if (!Alloc::Successful(this->EnsureCapacity(len + otherLen, - sizeof(elem_type)))) + sizeof(elem_type)))) { return nullptr; + } copy_type::CopyElements(Elements() + len, aArray.Elements(), otherLen, sizeof(elem_type)); this->IncrementLength(otherLen); @@ -1433,7 +1442,7 @@ public: // removes elements from the array (see also RemoveElementsAt). // @param aNewLen The desired length of this array. // @return True if the operation succeeded; false otherwise. - // See also TruncateLength if the new length is guaranteed to be smaller than + // See also TruncateLength if the new length is guaranteed to be smaller than // the old. typename Alloc::ResultType SetLength(size_type aNewLen) { diff --git a/xpcom/glue/nsThreadUtils.h b/xpcom/glue/nsThreadUtils.h index 02923d809c6..bf2c9718942 100644 --- a/xpcom/glue/nsThreadUtils.h +++ b/xpcom/glue/nsThreadUtils.h @@ -294,7 +294,11 @@ template struct nsRunnableMethodReceiver { ClassType* mObj; - explicit nsRunnableMethodReceiver(ClassType* aObj) : mObj(aObj) { NS_IF_ADDREF(mObj); } + explicit nsRunnableMethodReceiver(ClassType* aObj) + : mObj(aObj) + { + NS_IF_ADDREF(mObj); + } ~nsRunnableMethodReceiver() { Revoke(); } void Revoke() { NS_IF_RELEASE(mObj); } }; diff --git a/xpcom/glue/nsVersionComparator.h b/xpcom/glue/nsVersionComparator.h index 299653ca7d3..08a1db18e46 100644 --- a/xpcom/glue/nsVersionComparator.h +++ b/xpcom/glue/nsVersionComparator.h @@ -46,7 +46,8 @@ namespace mozilla { int32_t NS_COM_GLUE CompareVersions(const char* aStrA, const char* aStrB); #ifdef XP_WIN -int32_t NS_COM_GLUE CompareVersions(const char16_t* aStrA, const char16_t* aStrB); +int32_t NS_COM_GLUE CompareVersions(const char16_t* aStrA, + const char16_t* aStrB); #endif struct NS_COM_GLUE Version diff --git a/xpcom/glue/standalone/nsXPCOMGlue.h b/xpcom/glue/standalone/nsXPCOMGlue.h index 7d221e21187..f9e8704192d 100644 --- a/xpcom/glue/standalone/nsXPCOMGlue.h +++ b/xpcom/glue/standalone/nsXPCOMGlue.h @@ -18,22 +18,20 @@ /** * Enabled preloading of dynamically loaded libraries */ -extern "C" NS_HIDDEN_(void) -XPCOMGlueEnablePreload(); +extern "C" NS_HIDDEN_(void) XPCOMGlueEnablePreload(); /** * Initialize the XPCOM glue by dynamically linking against the XPCOM * shared library indicated by xpcomFile. */ -extern "C" NS_HIDDEN_(nsresult) -XPCOMGlueStartup(const char* xpcomFile); +extern "C" NS_HIDDEN_(nsresult) XPCOMGlueStartup(const char* xpcomFile); typedef void (*NSFuncPtr)(); struct nsDynamicFunctionLoad { - const char *functionName; - NSFuncPtr *function; + const char* functionName; + NSFuncPtr* function; }; /** @@ -45,7 +43,7 @@ struct nsDynamicFunctionLoad * functions were found. */ extern "C" NS_HIDDEN_(nsresult) -XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad *symbols); +XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad* symbols); #endif // XPCOM_GLUE #endif // nsXPCOMGlue_h__ diff --git a/xpcom/io/FileUtilsWin.h b/xpcom/io/FileUtilsWin.h index d14a57ff585..c0b008b13da 100644 --- a/xpcom/io/FileUtilsWin.h +++ b/xpcom/io/FileUtilsWin.h @@ -35,7 +35,8 @@ NtPathToDosPath(const nsAString& aNtPath, nsAString& aDosPath) nsAutoString logicalDrives; DWORD len = 0; while (true) { - len = GetLogicalDriveStringsW(len, reinterpret_cast(logicalDrives.BeginWriting())); + len = GetLogicalDriveStringsW( + len, reinterpret_cast(logicalDrives.BeginWriting())); if (!len) { return false; } else if (len > logicalDrives.Length()) { diff --git a/xpcom/io/nsDirectoryService.h b/xpcom/io/nsDirectoryService.h index ebd3e548f90..3ca94816b76 100644 --- a/xpcom/io/nsDirectoryService.h +++ b/xpcom/io/nsDirectoryService.h @@ -24,8 +24,6 @@ class nsDirectoryService MOZ_FINAL , public nsIDirectoryServiceProvider2 { public: - - // nsISupports interface NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROPERTIES diff --git a/xpcom/io/nsDirectoryServiceUtils.h b/xpcom/io/nsDirectoryServiceUtils.h index 4a672f73159..6100e756526 100644 --- a/xpcom/io/nsDirectoryServiceUtils.h +++ b/xpcom/io/nsDirectoryServiceUtils.h @@ -18,7 +18,8 @@ inline nsresult NS_GetSpecialDirectory(const char* aSpecialDirName, nsIFile** aResult) { nsresult rv; - nsCOMPtr serv(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); + nsCOMPtr serv(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, + &rv)); if (NS_FAILED(rv)) { return rv; } diff --git a/xpcom/string/nsStringIterator.h b/xpcom/string/nsStringIterator.h index d853cca505e..26c86c56e3b 100644 --- a/xpcom/string/nsStringIterator.h +++ b/xpcom/string/nsStringIterator.h @@ -122,13 +122,15 @@ public: if (aN > 0) { difference_type step = XPCOM_MIN(aN, size_forward()); - NS_ASSERTION(step > 0, "can't advance a reading iterator beyond the end of a string"); + NS_ASSERTION(step > 0, + "can't advance a reading iterator beyond the end of a string"); mPosition += step; } else if (aN < 0) { difference_type step = XPCOM_MAX(aN, -size_backward()); - NS_ASSERTION(step < 0, "can't advance (backward) a reading iterator beyond the end of a string"); + NS_ASSERTION(step < 0, + "can't advance (backward) a reading iterator beyond the end of a string"); mPosition += step; } @@ -248,13 +250,15 @@ public: if (aN > 0) { difference_type step = XPCOM_MIN(aN, size_forward()); - NS_ASSERTION(step > 0, "can't advance a writing iterator beyond the end of a string"); + NS_ASSERTION(step > 0, + "can't advance a writing iterator beyond the end of a string"); mPosition += step; } else if (aN < 0) { difference_type step = XPCOM_MAX(aN, -size_backward()); - NS_ASSERTION(step < 0, "can't advance (backward) a writing iterator beyond the end of a string"); + NS_ASSERTION(step < 0, + "can't advance (backward) a writing iterator beyond the end of a string"); mPosition += step; } @@ -263,7 +267,8 @@ public: void write(const value_type* aS, uint32_t aN) { - NS_ASSERTION(size_forward() > 0, "You can't |write| into an |nsWritingIterator| with no space!"); + NS_ASSERTION(size_forward() > 0, + "You can't |write| into an |nsWritingIterator| with no space!"); nsCharTraits::move(mPosition, aS, aN); advance(difference_type(aN)); diff --git a/xpcom/string/nsTSubstring.h b/xpcom/string/nsTSubstring.h index 581828e551a..9ef9561a608 100644 --- a/xpcom/string/nsTSubstring.h +++ b/xpcom/string/nsTSubstring.h @@ -768,7 +768,8 @@ public: size_type GetMutableData(wchar_t** aData, size_type aNewLen, const fallible_t&) { - return GetMutableData(reinterpret_cast(aData), aNewLen, fallible_t()); + return GetMutableData(reinterpret_cast(aData), aNewLen, + fallible_t()); } #endif @@ -958,8 +959,7 @@ protected: { aCutLength = XPCOM_MIN(aCutLength, mLength - aCutStart); uint32_t newTotalLen = mLength - aCutLength + aNewLength; - if (aCutStart == mLength && Capacity() > newTotalLen) - { + if (aCutStart == mLength && Capacity() > newTotalLen) { mFlags &= ~F_VOIDED; mData[newTotalLen] = char_type(0); mLength = newTotalLen; diff --git a/xpcom/threads/HangMonitor.h b/xpcom/threads/HangMonitor.h index c0c9fd748e6..fd0e6ff8390 100644 --- a/xpcom/threads/HangMonitor.h +++ b/xpcom/threads/HangMonitor.h @@ -40,7 +40,7 @@ void Shutdown(); /** * Notify the hang monitor of activity which will reset its internal timer. - * + * * @param activityType The type of activity being reported. * @see ActivityType */ diff --git a/xpcom/threads/nsTimerImpl.h b/xpcom/threads/nsTimerImpl.h index d8cc07c37df..97628a94bcc 100644 --- a/xpcom/threads/nsTimerImpl.h +++ b/xpcom/threads/nsTimerImpl.h @@ -62,7 +62,7 @@ public: void Fire(); // If a failure is encountered, the reference is returned to the caller static already_AddRefed PostTimerEvent( - already_AddRefed aTimerRef); + already_AddRefed aTimerRef); void SetDelayInternal(uint32_t aDelay); NS_DECL_THREADSAFE_ISUPPORTS