| 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 "../../../include/fpdfapi/fpdf_parser.h" | 9 #include "../../../include/fpdfapi/fpdf_parser.h" |
| 10 #include "editint.h" | 10 #include "editint.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 if (pFile->AppendString(FX_BSTRC(" ")) < 0) { | 35 if (pFile->AppendString(FX_BSTRC(" ")) < 0) { |
| 36 return -1; | 36 return -1; |
| 37 } | 37 } |
| 38 if ((len = pFile->AppendString(pObj->GetString())) < 0) { | 38 if ((len = pFile->AppendString(pObj->GetString())) < 0) { |
| 39 return -1; | 39 return -1; |
| 40 } | 40 } |
| 41 offset += len + 1; | 41 offset += len + 1; |
| 42 break; | 42 break; |
| 43 case PDFOBJ_STRING: { | 43 case PDFOBJ_STRING: { |
| 44 CFX_ByteString str = pObj->GetString(); | 44 CFX_ByteString str = pObj->GetString(); |
| 45 FX_BOOL bHex = ((CPDF_String*)pObj)->IsHex(); | 45 FX_BOOL bHex = pObj->AsString()->IsHex(); |
| 46 if ((len = pFile->AppendString(PDF_EncodeString(str, bHex))) < 0) { | 46 if ((len = pFile->AppendString(PDF_EncodeString(str, bHex))) < 0) { |
| 47 return -1; | 47 return -1; |
| 48 } | 48 } |
| 49 offset += len; | 49 offset += len; |
| 50 break; | 50 break; |
| 51 } | 51 } |
| 52 case PDFOBJ_NAME: { | 52 case PDFOBJ_NAME: { |
| 53 if (pFile->AppendString(FX_BSTRC("/")) < 0) { | 53 if (pFile->AppendString(FX_BSTRC("/")) < 0) { |
| 54 return -1; | 54 return -1; |
| 55 } | 55 } |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 if (m_File.AppendString(FX_BSTRC(" ")) < 0) { | 1109 if (m_File.AppendString(FX_BSTRC(" ")) < 0) { |
| 1110 return -1; | 1110 return -1; |
| 1111 } | 1111 } |
| 1112 if ((len = m_File.AppendString(pObj->GetString())) < 0) { | 1112 if ((len = m_File.AppendString(pObj->GetString())) < 0) { |
| 1113 return -1; | 1113 return -1; |
| 1114 } | 1114 } |
| 1115 m_Offset += len + 1; | 1115 m_Offset += len + 1; |
| 1116 break; | 1116 break; |
| 1117 case PDFOBJ_STRING: { | 1117 case PDFOBJ_STRING: { |
| 1118 CFX_ByteString str = pObj->GetString(); | 1118 CFX_ByteString str = pObj->GetString(); |
| 1119 FX_BOOL bHex = ((CPDF_String*)pObj)->IsHex(); | 1119 FX_BOOL bHex = pObj->AsString()->IsHex(); |
| 1120 if (m_pCryptoHandler == NULL || !bEncrypt) { | 1120 if (m_pCryptoHandler == NULL || !bEncrypt) { |
| 1121 CFX_ByteString content = PDF_EncodeString(str, bHex); | 1121 CFX_ByteString content = PDF_EncodeString(str, bHex); |
| 1122 if ((len = m_File.AppendString(content)) < 0) { | 1122 if ((len = m_File.AppendString(content)) < 0) { |
| 1123 return -1; | 1123 return -1; |
| 1124 } | 1124 } |
| 1125 m_Offset += len; | 1125 m_Offset += len; |
| 1126 break; | 1126 break; |
| 1127 } | 1127 } |
| 1128 CPDF_Encryptor encryptor; | 1128 CPDF_Encryptor encryptor; |
| 1129 encryptor.Initialize(m_pCryptoHandler, objnum, (uint8_t*)str.c_str(), | 1129 encryptor.Initialize(m_pCryptoHandler, objnum, (uint8_t*)str.c_str(), |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 m_bNewCrypto = FALSE; | 2128 m_bNewCrypto = FALSE; |
| 2129 if (!m_bStandardSecurity) { | 2129 if (!m_bStandardSecurity) { |
| 2130 return; | 2130 return; |
| 2131 } | 2131 } |
| 2132 if (m_pEncryptDict) { | 2132 if (m_pEncryptDict) { |
| 2133 m_pEncryptDict->Release(); | 2133 m_pEncryptDict->Release(); |
| 2134 m_pEncryptDict = NULL; | 2134 m_pEncryptDict = NULL; |
| 2135 } | 2135 } |
| 2136 m_bStandardSecurity = FALSE; | 2136 m_bStandardSecurity = FALSE; |
| 2137 } | 2137 } |
| OLD | NEW |