Chromium Code Reviews| 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_save.h" | 7 #include "public/fpdf_save.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/include/fsdk_define.h" | 9 #include "fpdfsdk/include/fsdk_define.h" |
| 10 #include "public/fpdf_edit.h" | 10 #include "public/fpdf_edit.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 | 50 |
| 51 void CFX_IFileWrite::Release() { | 51 void CFX_IFileWrite::Release() { |
| 52 delete this; | 52 delete this; |
| 53 } | 53 } |
| 54 | 54 |
| 55 FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, | 55 FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, |
| 56 FPDF_FILEWRITE* pFileWrite, | 56 FPDF_FILEWRITE* pFileWrite, |
| 57 FPDF_DWORD flags, | 57 FPDF_DWORD flags, |
| 58 FPDF_BOOL bSetVersion, | 58 FPDF_BOOL bSetVersion, |
| 59 int fileVerion) { | 59 int fileVerion) { |
| 60 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 60 CPDF_Document* pPDFDoc = CPDFDocumentFromFPDFDocument(document); |
|
Lei Zhang
2015/11/25 22:34:42
UnderlyingDocumentType?
Tom Sepez
2015/11/25 22:50:24
No, because CPDF_Creator::CPDF_Creator() takes a C
| |
| 61 if (!pDoc) | 61 if (!pPDFDoc) |
| 62 return 0; | 62 return 0; |
| 63 | 63 |
| 64 if (flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY) { | 64 if (flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY) { |
| 65 flags = 0; | 65 flags = 0; |
| 66 } | 66 } |
| 67 | 67 |
| 68 CPDF_Creator FileMaker(pDoc); | 68 CPDF_Creator FileMaker(pPDFDoc); |
| 69 if (bSetVersion) | 69 if (bSetVersion) |
| 70 FileMaker.SetFileVersion(fileVerion); | 70 FileMaker.SetFileVersion(fileVerion); |
| 71 if (flags == FPDF_REMOVE_SECURITY) { | 71 if (flags == FPDF_REMOVE_SECURITY) { |
| 72 flags = 0; | 72 flags = 0; |
| 73 FileMaker.RemoveSecurity(); | 73 FileMaker.RemoveSecurity(); |
| 74 } | 74 } |
| 75 | |
| 75 CFX_IFileWrite* pStreamWrite = NULL; | 76 CFX_IFileWrite* pStreamWrite = NULL; |
| 76 FX_BOOL bRet; | 77 FX_BOOL bRet; |
| 77 pStreamWrite = new CFX_IFileWrite; | 78 pStreamWrite = new CFX_IFileWrite; |
| 78 pStreamWrite->Init(pFileWrite); | 79 pStreamWrite->Init(pFileWrite); |
| 79 bRet = FileMaker.Create(pStreamWrite, flags); | 80 bRet = FileMaker.Create(pStreamWrite, flags); |
| 80 pStreamWrite->Release(); | 81 pStreamWrite->Release(); |
| 81 return bRet; | 82 return bRet; |
| 82 } | 83 } |
| 83 | 84 |
| 84 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document, | 85 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document, |
| 85 FPDF_FILEWRITE* pFileWrite, | 86 FPDF_FILEWRITE* pFileWrite, |
| 86 FPDF_DWORD flags) { | 87 FPDF_DWORD flags) { |
| 87 return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0); | 88 return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0); |
| 88 } | 89 } |
| 89 | 90 |
| 90 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, | 91 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, |
| 91 FPDF_FILEWRITE* pFileWrite, | 92 FPDF_FILEWRITE* pFileWrite, |
| 92 FPDF_DWORD flags, | 93 FPDF_DWORD flags, |
| 93 int fileVersion) { | 94 int fileVersion) { |
| 94 return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion); | 95 return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion); |
| 95 } | 96 } |
| OLD | NEW |