summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfsave.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-14 14:23:57 -0700
committerLei Zhang <thestig@chromium.org>2015-08-14 14:23:57 -0700
commit0f6b51c0fdd14f5762bf3c7412ac59c825443cc3 (patch)
tree782b1fe38da61394477cabc08c712c11e57e50dd /fpdfsdk/src/fpdfsave.cpp
parentc2c3f7b5f0396409451a9d344f35ec1929a76e9f (diff)
downloadpdfium-0f6b51c0fdd14f5762bf3c7412ac59c825443cc3.tar.xz
Use override in more classes in fpdfsdk/
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1287193005 .
Diffstat (limited to 'fpdfsdk/src/fpdfsave.cpp')
-rw-r--r--fpdfsdk/src/fpdfsave.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp
index 54c9253d2e..36553092ee 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;
}