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

Unified Diff: fpdfsdk/src/fpdfsave.cpp

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 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/fpdfppo.cpp ('k') | fpdfsdk/src/fsdk_annothandler.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 4b9d7acecff417d976cb81df3e01462d5eaf14bb..ddd6f6e90ebf2039ee118936a3b2b8640206887e 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -18,80 +18,76 @@ 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 {}
+ 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;
+ FPDF_FILEWRITE* m_pFileWriteStruct;
};
CFX_IFileWrite::CFX_IFileWrite()
{
- m_pFileWriteStruct = NULL;
+ m_pFileWriteStruct = NULL;
}
FX_BOOL CFX_IFileWrite::Init( FPDF_FILEWRITE * pFileWriteStruct )
{
- if (!pFileWriteStruct)
- return FALSE;
- else
- {
- m_pFileWriteStruct = pFileWriteStruct;
- }
- return TRUE;
+ if (!pFileWriteStruct)
+ return FALSE;
+
+ m_pFileWriteStruct = pFileWriteStruct;
+ return TRUE;
}
FX_BOOL CFX_IFileWrite::WriteBlock(const void* pData, size_t size)
{
- if (m_pFileWriteStruct)
- {
- m_pFileWriteStruct->WriteBlock( m_pFileWriteStruct, pData, size );
- return TRUE;
- }
- else
- return FALSE;
+ if (!m_pFileWriteStruct)
+ return FALSE;
+
+ 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)
+ 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;
+ 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 )
+DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy( FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
+ FPDF_DWORD flags )
{
- return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE , 0);
+ 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)
+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);
+ return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE , fileVersion);
}
« no previous file with comments | « fpdfsdk/src/fpdfppo.cpp ('k') | fpdfsdk/src/fsdk_annothandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698