OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../public/fpdf_edit.h" | 7 #include "../../public/fpdf_edit.h" |
8 #include "../../public/fpdf_save.h" | 8 #include "../../public/fpdf_save.h" |
9 #include "../include/fsdk_define.h" | 9 #include "../include/fsdk_define.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 CFX_IFileWrite::CFX_IFileWrite() | 30 CFX_IFileWrite::CFX_IFileWrite() |
31 { | 31 { |
32 m_pFileWriteStruct = NULL; | 32 m_pFileWriteStruct = NULL; |
33 } | 33 } |
34 | 34 |
35 FX_BOOL CFX_IFileWrite::Init( FPDF_FILEWRITE * pFileWriteStruct ) | 35 FX_BOOL CFX_IFileWrite::Init( FPDF_FILEWRITE * pFileWriteStruct ) |
36 { | 36 { |
37 if (!pFileWriteStruct) | 37 if (!pFileWriteStruct) |
38 return FALSE; | 38 return FALSE; |
39 » else | 39 |
40 » { | 40 m_pFileWriteStruct = pFileWriteStruct; |
41 » » m_pFileWriteStruct = pFileWriteStruct; | |
42 » } | |
43 return TRUE; | 41 return TRUE; |
44 } | 42 } |
45 | 43 |
46 FX_BOOL CFX_IFileWrite::WriteBlock(const void* pData, size_t size) | 44 FX_BOOL CFX_IFileWrite::WriteBlock(const void* pData, size_t size) |
47 { | 45 { |
48 » if (m_pFileWriteStruct) | 46 » if (!m_pFileWriteStruct) |
49 » { | |
50 » » m_pFileWriteStruct->WriteBlock( m_pFileWriteStruct, pData, size
); | |
51 » » return TRUE; | |
52 » } | |
53 » else | |
54 return FALSE; | 47 return FALSE; |
| 48 |
| 49 m_pFileWriteStruct->WriteBlock( m_pFileWriteStruct, pData, size ); |
| 50 return TRUE; |
55 } | 51 } |
56 | 52 |
57 FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,FPDF
_DWORD flags, FPDF_BOOL bSetVersion, | 53 FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,FPDF
_DWORD flags, FPDF_BOOL bSetVersion, |
58 int fileVerion) | 54 int fileVerion) |
59 { | 55 { |
60 CPDF_Document* pDoc = (CPDF_Document*)document; | 56 CPDF_Document* pDoc = (CPDF_Document*)document; |
61 if (!pDoc) | 57 if (!pDoc) |
62 return 0; | 58 return 0; |
63 | 59 |
64 if ( flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY ) | 60 if ( flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY ) |
(...skipping 23 matching lines...) Expand all Loading... |
88 { | 84 { |
89 return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE , 0); | 85 return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE , 0); |
90 } | 86 } |
91 | 87 |
92 | 88 |
93 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion( FPDF_DOCUMENT document,F
PDF_FILEWRITE * pFileWrite, | 89 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion( FPDF_DOCUMENT document,F
PDF_FILEWRITE * pFileWrite, |
94 FPDF_DWORD flags, int fileVersion) | 90 FPDF_DWORD flags, int fileVersion) |
95 { | 91 { |
96 return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE , fileVersion); | 92 return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE , fileVersion); |
97 } | 93 } |
OLD | NEW |