summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfsave.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-08-04 12:19:10 -0700
committerNico Weber <thakis@chromium.org>2015-08-04 12:19:10 -0700
commitb048f791a15f2da781a01eba5b09eb9d389f9c11 (patch)
tree6850a73c18bbc41eaf4b1fdc6b3c96646d45587b /fpdfsdk/src/fpdfsave.cpp
parentc8eeed31f217d99a706b0cbf5e4ce0bcc12beb64 (diff)
downloadpdfium-b048f791a15f2da781a01eba5b09eb9d389f9c11.tar.xz
clang-format all pdfium code.
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163' | \ xargs ../../buildtools/mac/clang-format -i See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1265503005 .
Diffstat (limited to 'fpdfsdk/src/fpdfsave.cpp')
-rw-r--r--fpdfsdk/src/fpdfsave.cpp119
1 files changed, 57 insertions, 62 deletions
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp
index ddd6f6e90e..54c9253d2e 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -14,80 +14,75 @@
#include <ctime>
#endif
-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 {}
-
-protected:
- FPDF_FILEWRITE* m_pFileWriteStruct;
+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 {}
+
+ protected:
+ FPDF_FILEWRITE* m_pFileWriteStruct;
};
-CFX_IFileWrite::CFX_IFileWrite()
-{
- m_pFileWriteStruct = NULL;
+CFX_IFileWrite::CFX_IFileWrite() {
+ m_pFileWriteStruct = NULL;
}
-FX_BOOL CFX_IFileWrite::Init( FPDF_FILEWRITE * pFileWriteStruct )
-{
- if (!pFileWriteStruct)
- return FALSE;
+FX_BOOL CFX_IFileWrite::Init(FPDF_FILEWRITE* pFileWriteStruct) {
+ if (!pFileWriteStruct)
+ return FALSE;
- m_pFileWriteStruct = pFileWriteStruct;
- return TRUE;
+ m_pFileWriteStruct = pFileWriteStruct;
+ return TRUE;
}
-FX_BOOL CFX_IFileWrite::WriteBlock(const void* pData, size_t size)
-{
- if (!m_pFileWriteStruct)
- return FALSE;
+FX_BOOL CFX_IFileWrite::WriteBlock(const void* pData, size_t size) {
+ if (!m_pFileWriteStruct)
+ return FALSE;
- m_pFileWriteStruct->WriteBlock( m_pFileWriteStruct, pData, size );
- return TRUE;
+ m_pFileWriteStruct->WriteBlock(m_pFileWriteStruct, pData, size);
+ return TRUE;
}
-FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,FPDF_DWORD flags, FPDF_BOOL bSetVersion,
- int fileVerion)
-{
- CPDF_Document* pDoc = (CPDF_Document*)document;
- if (!pDoc)
- return 0;
-
- if ( flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY )
- {
- flags = 0;
- }
-
- CPDF_Creator FileMaker(pDoc);
- if(bSetVersion)
- FileMaker.SetFileVersion(fileVerion);
- if(flags == FPDF_REMOVE_SECURITY)
- {
- flags = 0;
- FileMaker.RemoveSecurity();
- }
- CFX_IFileWrite* pStreamWrite = NULL;
- FX_BOOL bRet;
- pStreamWrite = new CFX_IFileWrite;
- pStreamWrite->Init( pFileWrite );
- bRet = FileMaker.Create(pStreamWrite, flags);
- delete pStreamWrite;
- return bRet;
+FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,
+ FPDF_FILEWRITE* pFileWrite,
+ FPDF_DWORD flags,
+ FPDF_BOOL bSetVersion,
+ int fileVerion) {
+ CPDF_Document* pDoc = (CPDF_Document*)document;
+ if (!pDoc)
+ return 0;
+
+ if (flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY) {
+ flags = 0;
+ }
+
+ CPDF_Creator FileMaker(pDoc);
+ if (bSetVersion)
+ FileMaker.SetFileVersion(fileVerion);
+ if (flags == FPDF_REMOVE_SECURITY) {
+ flags = 0;
+ FileMaker.RemoveSecurity();
+ }
+ CFX_IFileWrite* pStreamWrite = NULL;
+ FX_BOOL bRet;
+ pStreamWrite = new CFX_IFileWrite;
+ pStreamWrite->Init(pFileWrite);
+ bRet = FileMaker.Create(pStreamWrite, flags);
+ delete pStreamWrite;
+ return bRet;
}
-DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy( FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
- FPDF_DWORD flags )
-{
- return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE , 0);
+DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document,
+ FPDF_FILEWRITE* pFileWrite,
+ FPDF_DWORD flags) {
+ return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0);
}
-
-DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion( FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
- FPDF_DWORD flags, int fileVersion)
-{
- return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE , fileVersion);
+DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,
+ FPDF_FILEWRITE* pFileWrite,
+ FPDF_DWORD flags,
+ int fileVersion) {
+ return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion);
}