diff --git a/browser/app/winlauncher/ErrorHandler.cpp b/browser/app/winlauncher/ErrorHandler.cpp index 43a1692d5442..1286e0f90f69 100644 --- a/browser/app/winlauncher/ErrorHandler.cpp +++ b/browser/app/winlauncher/ErrorHandler.cpp @@ -152,7 +152,7 @@ class TempFileWriter final : public mozilla::JSONWriteFunc { explicit operator bool() const { return !mFailed; } - void Write(const mozilla::Span& aStr) override { + void Write(const mozilla::Span& aStr) final { if (mFailed) { return; } diff --git a/memory/replace/dmd/test/SmokeDMD.cpp b/memory/replace/dmd/test/SmokeDMD.cpp index e36ae57d5048..cf54d4d4f388 100644 --- a/memory/replace/dmd/test/SmokeDMD.cpp +++ b/memory/replace/dmd/test/SmokeDMD.cpp @@ -32,7 +32,7 @@ using namespace mozilla::dmd; DMDFuncs::Singleton DMDFuncs::sSingleton; -class FpWriteFunc : public mozilla::JSONWriteFunc { +class FpWriteFunc final : public mozilla::JSONWriteFunc { public: explicit FpWriteFunc(const char* aFilename) { mFp = fopen(aFilename, "w"); @@ -45,7 +45,7 @@ class FpWriteFunc : public mozilla::JSONWriteFunc { ~FpWriteFunc() { fclose(mFp); } - void Write(const mozilla::Span& aStr) override { + void Write(const mozilla::Span& aStr) final { for (const char c : aStr) { fputc(c, mFp); } diff --git a/mfbt/tests/TestJSONWriter.cpp b/mfbt/tests/TestJSONWriter.cpp index 52454a5e23a5..a90732396f28 100644 --- a/mfbt/tests/TestJSONWriter.cpp +++ b/mfbt/tests/TestJSONWriter.cpp @@ -18,10 +18,10 @@ using mozilla::MakeUnique; using mozilla::Span; // This writes all the output into a big buffer. -struct StringWriteFunc : public JSONWriteFunc { +struct StringWriteFunc final : public JSONWriteFunc { std::string mString; - void Write(const mozilla::Span& aStr) override { + void Write(const mozilla::Span& aStr) final { mString.append(aStr.data(), aStr.size()); } }; diff --git a/mozglue/baseprofiler/public/BaseProfileJSONWriter.h b/mozglue/baseprofiler/public/BaseProfileJSONWriter.h index c6b996a4f658..50b21db75cba 100644 --- a/mozglue/baseprofiler/public/BaseProfileJSONWriter.h +++ b/mozglue/baseprofiler/public/BaseProfileJSONWriter.h @@ -52,7 +52,7 @@ class ChunkedJSONWriteFunc final : public JSONWriteFunc { return totalLen; } - void Write(const Span& aStr) override { + void Write(const Span& aStr) final { MOZ_ASSERT(mChunkPtr >= mChunkList.back().get() && mChunkPtr <= mChunkEnd); MOZ_ASSERT(mChunkEnd >= mChunkList.back().get() + mChunkLengths.back()); MOZ_ASSERT(*mChunkPtr == '\0'); @@ -151,7 +151,7 @@ class ChunkedJSONWriteFunc final : public JSONWriteFunc { struct OStreamJSONWriteFunc final : public JSONWriteFunc { explicit OStreamJSONWriteFunc(std::ostream& aStream) : mStream(aStream) {} - void Write(const Span& aStr) override { + void Write(const Span& aStr) final { std::string_view sv(aStr.data(), aStr.size()); mStream << sv; } diff --git a/mozglue/tests/TestBaseProfiler.cpp b/mozglue/tests/TestBaseProfiler.cpp index b347e123e29a..2fa2e161c8e2 100644 --- a/mozglue/tests/TestBaseProfiler.cpp +++ b/mozglue/tests/TestBaseProfiler.cpp @@ -1146,10 +1146,10 @@ void TestLEB128() { printf("TestLEB128 done\n"); } -struct StringWriteFunc : public JSONWriteFunc { +struct StringWriteFunc final : public JSONWriteFunc { std::string mString; - void Write(const mozilla::Span& aStr) override { + void Write(const mozilla::Span& aStr) final { mString.append(aStr.data(), aStr.size()); } }; diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index bae8d2c4d2a1..adec2675f1cc 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -3094,11 +3094,11 @@ static nsresult SelectProfile(nsToolkitProfileService* aProfileSvc, } #ifdef MOZ_BLOCK_PROFILE_DOWNGRADE -struct FileWriteFunc : public JSONWriteFunc { +struct FileWriteFunc final : public JSONWriteFunc { FILE* mFile; explicit FileWriteFunc(FILE* aFile) : mFile(aFile) {} - void Write(const Span& aStr) override { + void Write(const Span& aStr) final { fprintf(mFile, "%.*s", int(aStr.size()), aStr.data()); } }; diff --git a/xpcom/base/JSONStringWriteFuncs.h b/xpcom/base/JSONStringWriteFuncs.h index 5db4fab30969..65b688788cbf 100644 --- a/xpcom/base/JSONStringWriteFuncs.h +++ b/xpcom/base/JSONStringWriteFuncs.h @@ -24,7 +24,7 @@ class JSONStringWriteFunc final : public JSONWriteFunc { public: JSONStringWriteFunc() = default; - void Write(const Span& aStr) override { mString.Append(aStr); } + void Write(const Span& aStr) final { mString.Append(aStr); } const StringType& StringCRef() const { return mString; } @@ -39,7 +39,7 @@ class JSONStringRefWriteFunc final : public JSONWriteFunc { public: MOZ_IMPLICIT JSONStringRefWriteFunc(nsACString& aString) : mString(aString) {} - void Write(const Span& aStr) override { mString.Append(aStr); } + void Write(const Span& aStr) final { mString.Append(aStr); } const nsACString& StringCRef() const { return mString; } diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 1c15e301a99e..28af408178e4 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -385,11 +385,11 @@ static void MakeFilename(const char* aPrefix, const nsAString& aIdentifier, // the following two problems: // - It provides a JSONWriterFunc::Write() that calls nsGZFileWriter::Write(). // - It can be stored as a UniquePtr, whereas nsGZFileWriter is refcounted. -class GZWriterWrapper : public JSONWriteFunc { +class GZWriterWrapper final : public JSONWriteFunc { public: explicit GZWriterWrapper(nsGZFileWriter* aGZWriter) : mGZWriter(aGZWriter) {} - void Write(const Span& aStr) override { + void Write(const Span& aStr) final { // Ignore any failure because JSONWriteFunc doesn't have a mechanism for // handling errors. Unused << mGZWriter->Write(aStr.data(), aStr.size());