diff options
author | John Abd-El-Malek <jabdelmalek@google.com> | 2014-05-23 17:28:10 -0700 |
---|---|---|
committer | John Abd-El-Malek <jabdelmalek@google.com> | 2014-05-23 17:41:56 -0700 |
commit | 3f3b45cc74b0499912409f766a595945dbbfc4c5 (patch) | |
tree | ec400b6965477b88ea7f0d335f7e5c52044c346c /fpdfsdk/src/fpdfsave.cpp | |
parent | 6fe4aed948337175f6f7f81bb03c37b9c7f535da (diff) | |
download | pdfium-3f3b45cc74b0499912409f766a595945dbbfc4c5.tar.xz |
Convert all line endings to LF.
Diffstat (limited to 'fpdfsdk/src/fpdfsave.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfsave.cpp | 182 |
1 files changed, 91 insertions, 91 deletions
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp index 8272eb0fee..0c7acc8c47 100644 --- a/fpdfsdk/src/fpdfsave.cpp +++ b/fpdfsdk/src/fpdfsave.cpp @@ -1,91 +1,91 @@ -// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../include/fsdk_define.h"
-#include "../include/fpdfsave.h"
-#include "../include/fpdfedit.h"
-#if _FX_OS_ == _FX_ANDROID_
-#include "time.h"
-#else
-#include <ctime>
-#endif
-
-class CFX_IFileWrite:public IFX_StreamWrite
-{
-
-public:
- CFX_IFileWrite();
- FX_BOOL Init( FPDF_FILEWRITE * pFileWriteStruct );
- virtual FX_BOOL WriteBlock(const void* pData, size_t size);
- virtual void Release(){};
-
-protected:
- FPDF_FILEWRITE* m_pFileWriteStruct;
-};
-
-CFX_IFileWrite::CFX_IFileWrite()
-{
- m_pFileWriteStruct = NULL;
-}
-
-FX_BOOL CFX_IFileWrite::Init( FPDF_FILEWRITE * pFileWriteStruct )
-{
- if (!pFileWriteStruct)
- return FALSE;
- else
- {
- 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;
-}
-
-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 < 1 || flags > 2 )
- {
- flags = 0;
- }
-
- CPDF_Creator FileMaker(pDoc);
- if(bSetVersion)
- FileMaker.SetFileVersion(fileVerion);
- 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_SaveWithVersion( FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
- FPDF_DWORD flags, int fileVersion)
-{
- return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE , fileVersion);
-}
+// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "../include/fsdk_define.h" +#include "../include/fpdfsave.h" +#include "../include/fpdfedit.h" +#if _FX_OS_ == _FX_ANDROID_ +#include "time.h" +#else +#include <ctime> +#endif + +class CFX_IFileWrite:public IFX_StreamWrite +{ + +public: + CFX_IFileWrite(); + FX_BOOL Init( FPDF_FILEWRITE * pFileWriteStruct ); + virtual FX_BOOL WriteBlock(const void* pData, size_t size); + virtual void Release(){}; + +protected: + FPDF_FILEWRITE* m_pFileWriteStruct; +}; + +CFX_IFileWrite::CFX_IFileWrite() +{ + m_pFileWriteStruct = NULL; +} + +FX_BOOL CFX_IFileWrite::Init( FPDF_FILEWRITE * pFileWriteStruct ) +{ + if (!pFileWriteStruct) + return FALSE; + else + { + 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; +} + +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 < 1 || flags > 2 ) + { + flags = 0; + } + + CPDF_Creator FileMaker(pDoc); + if(bSetVersion) + FileMaker.SetFileVersion(fileVerion); + 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_SaveWithVersion( FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite, + FPDF_DWORD flags, int fileVersion) +{ + return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE , fileVersion); +} |