Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Unified Diff: fpdfsdk/src/fpdfsave.cpp

Issue 1287193005: Use override in more classes in fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits, rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/fpdf_sysfontinfo.cpp ('k') | fpdfsdk/src/fpdfview.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfsave.cpp
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp
index 54c9253d2e4ed20e4b4efb97cc6f18445d2903ce..36553092eeae05e6402fb60a1da513695d7361bc 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -18,10 +18,12 @@ class CFX_IFileWrite final : public IFX_StreamWrite {
public:
CFX_IFileWrite();
FX_BOOL Init(FPDF_FILEWRITE* pFileWriteStruct);
- virtual FX_BOOL WriteBlock(const void* pData, size_t size) override;
- virtual void Release() override {}
+ FX_BOOL WriteBlock(const void* pData, size_t size) override;
+ void Release() override;
protected:
+ ~CFX_IFileWrite() override {}
+
FPDF_FILEWRITE* m_pFileWriteStruct;
};
@@ -45,6 +47,10 @@ FX_BOOL CFX_IFileWrite::WriteBlock(const void* pData, size_t size) {
return TRUE;
}
+void CFX_IFileWrite::Release() {
+ delete this;
+}
+
FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,
FPDF_FILEWRITE* pFileWrite,
FPDF_DWORD flags,
@@ -70,7 +76,7 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,
pStreamWrite = new CFX_IFileWrite;
pStreamWrite->Init(pFileWrite);
bRet = FileMaker.Create(pStreamWrite, flags);
- delete pStreamWrite;
+ pStreamWrite->Release();
return bRet;
}
« no previous file with comments | « fpdfsdk/src/fpdf_sysfontinfo.cpp ('k') | fpdfsdk/src/fpdfview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698