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 "../../../include/fxcrt/fx_ext.h" | 7 #include "../../../include/fxcrt/fx_ext.h" |
8 #include "../../../include/fpdfapi/fpdf_serial.h" | 8 #include "../../../include/fpdfapi/fpdf_serial.h" |
9 #include "editint.h" | 9 #include "editint.h" |
10 | 10 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 ::FlateEncode(pBuffer, size, 12, 1, 8, 7, m_pData, m_dwSize); | 396 ::FlateEncode(pBuffer, size, 12, 1, 8, 7, m_pData, m_dwSize); |
397 } else { | 397 } else { |
398 ::FlateEncode(pBuffer, size, m_pData, m_dwSize); | 398 ::FlateEncode(pBuffer, size, m_pData, m_dwSize); |
399 } | 399 } |
400 return TRUE; | 400 return TRUE; |
401 } | 401 } |
402 CPDF_FlateEncoder::~CPDF_FlateEncoder() { | 402 CPDF_FlateEncoder::~CPDF_FlateEncoder() { |
403 if (m_bCloned && m_pDict) { | 403 if (m_bCloned && m_pDict) { |
404 m_pDict->Release(); | 404 m_pDict->Release(); |
405 } | 405 } |
406 if (m_bNewData && m_pData) { | 406 if (m_bNewData) { |
407 FX_Free(m_pData); | 407 FX_Free(m_pData); |
408 } | 408 } |
409 } | 409 } |
410 class CPDF_Encryptor { | 410 class CPDF_Encryptor { |
411 public: | 411 public: |
412 CPDF_Encryptor(); | 412 CPDF_Encryptor(); |
413 ~CPDF_Encryptor(); | 413 ~CPDF_Encryptor(); |
414 FX_BOOL Initialize(CPDF_CryptoHandler* pHandler, | 414 FX_BOOL Initialize(CPDF_CryptoHandler* pHandler, |
415 int objnum, | 415 int objnum, |
416 uint8_t* src_data, | 416 uint8_t* src_data, |
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 m_pIDArray = CPDF_Array::Create(); | 2047 m_pIDArray = CPDF_Array::Create(); |
2048 CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetElement(0) : NULL; | 2048 CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetElement(0) : NULL; |
2049 if (pID1) { | 2049 if (pID1) { |
2050 m_pIDArray->Add(pID1->Clone()); | 2050 m_pIDArray->Add(pID1->Clone()); |
2051 } else { | 2051 } else { |
2052 pBuffer = FX_Alloc(FX_DWORD, 4); | 2052 pBuffer = FX_Alloc(FX_DWORD, 4); |
2053 PDF_GenerateFileID((FX_DWORD)(uintptr_t) this, m_dwLastObjNum, pBuffer); | 2053 PDF_GenerateFileID((FX_DWORD)(uintptr_t) this, m_dwLastObjNum, pBuffer); |
2054 CFX_ByteStringC bsBuffer((const uint8_t*)pBuffer, 4 * sizeof(FX_DWORD)); | 2054 CFX_ByteStringC bsBuffer((const uint8_t*)pBuffer, 4 * sizeof(FX_DWORD)); |
2055 m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument); | 2055 m_pIDArray->Add(CPDF_String::Create(bsBuffer, TRUE), m_pDocument); |
2056 } | 2056 } |
2057 if (pBuffer) { | 2057 FX_Free(pBuffer); |
2058 FX_Free(pBuffer); | |
2059 } | |
2060 } | 2058 } |
2061 if (!bDefault) { | 2059 if (!bDefault) { |
2062 return; | 2060 return; |
2063 } | 2061 } |
2064 if (pOldIDArray) { | 2062 if (pOldIDArray) { |
2065 CPDF_Object* pID2 = pOldIDArray->GetElement(1); | 2063 CPDF_Object* pID2 = pOldIDArray->GetElement(1); |
2066 if ((m_dwFlags & FPDFCREATE_INCREMENTAL) && m_pEncryptDict && pID2) { | 2064 if ((m_dwFlags & FPDFCREATE_INCREMENTAL) && m_pEncryptDict && pID2) { |
2067 m_pIDArray->Add(pID2->Clone()); | 2065 m_pIDArray->Add(pID2->Clone()); |
2068 return; | 2066 return; |
2069 } | 2067 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 m_bNewCrypto = FALSE; | 2137 m_bNewCrypto = FALSE; |
2140 if (!m_bStandardSecurity) { | 2138 if (!m_bStandardSecurity) { |
2141 return; | 2139 return; |
2142 } | 2140 } |
2143 if (m_pEncryptDict) { | 2141 if (m_pEncryptDict) { |
2144 m_pEncryptDict->Release(); | 2142 m_pEncryptDict->Release(); |
2145 m_pEncryptDict = NULL; | 2143 m_pEncryptDict = NULL; |
2146 } | 2144 } |
2147 m_bStandardSecurity = FALSE; | 2145 m_bStandardSecurity = FALSE; |
2148 } | 2146 } |
OLD | NEW |