| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 return -1; | 54 return -1; |
| 55 } | 55 } |
| 56 CFX_ByteString str = pObj->GetString(); | 56 CFX_ByteString str = pObj->GetString(); |
| 57 if ((len = pFile->AppendString(PDF_NameEncode(str))) < 0) { | 57 if ((len = pFile->AppendString(PDF_NameEncode(str))) < 0) { |
| 58 return -1; | 58 return -1; |
| 59 } | 59 } |
| 60 offset += len + 1; | 60 offset += len + 1; |
| 61 break; | 61 break; |
| 62 } | 62 } |
| 63 case PDFOBJ_REFERENCE: { | 63 case PDFOBJ_REFERENCE: { |
| 64 if (pFile->AppendString(FX_BSTRC(" ")) < 0) { | 64 if (pFile->AppendString(FX_BSTRC(" ")) < 0) |
| 65 return -1; | 65 return -1; |
| 66 } | 66 if ((len = pFile->AppendDWord(pObj->AsReference()->GetRefObjNum())) < 0) |
| 67 CPDF_Reference* p = (CPDF_Reference*)pObj; | |
| 68 if ((len = pFile->AppendDWord(p->GetRefObjNum())) < 0) { | |
| 69 return -1; | 67 return -1; |
| 70 } | 68 if (pFile->AppendString(FX_BSTRC(" 0 R ")) < 0) |
| 71 if (pFile->AppendString(FX_BSTRC(" 0 R ")) < 0) { | |
| 72 return -1; | 69 return -1; |
| 73 } | |
| 74 offset += len + 6; | 70 offset += len + 6; |
| 75 break; | 71 break; |
| 76 } | 72 } |
| 77 case PDFOBJ_ARRAY: { | 73 case PDFOBJ_ARRAY: { |
| 78 if (pFile->AppendString(FX_BSTRC("[")) < 0) { | 74 if (pFile->AppendString(FX_BSTRC("[")) < 0) { |
| 79 return -1; | 75 return -1; |
| 80 } | 76 } |
| 81 offset += 1; | 77 offset += 1; |
| 82 const CPDF_Array* p = pObj->AsArray(); | 78 const CPDF_Array* p = pObj->AsArray(); |
| 83 for (FX_DWORD i = 0; i < p->GetCount(); i++) { | 79 for (FX_DWORD i = 0; i < p->GetCount(); i++) { |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 return -1; | 1157 return -1; |
| 1162 } | 1158 } |
| 1163 CFX_ByteString str = pObj->GetString(); | 1159 CFX_ByteString str = pObj->GetString(); |
| 1164 if ((len = m_File.AppendString(PDF_NameEncode(str))) < 0) { | 1160 if ((len = m_File.AppendString(PDF_NameEncode(str))) < 0) { |
| 1165 return -1; | 1161 return -1; |
| 1166 } | 1162 } |
| 1167 m_Offset += len + 1; | 1163 m_Offset += len + 1; |
| 1168 break; | 1164 break; |
| 1169 } | 1165 } |
| 1170 case PDFOBJ_REFERENCE: { | 1166 case PDFOBJ_REFERENCE: { |
| 1171 if (m_File.AppendString(FX_BSTRC(" ")) < 0) { | 1167 if (m_File.AppendString(FX_BSTRC(" ")) < 0) |
| 1172 return -1; | 1168 return -1; |
| 1173 } | 1169 if ((len = m_File.AppendDWord(pObj->AsReference()->GetRefObjNum())) < 0) |
| 1174 CPDF_Reference* p = (CPDF_Reference*)pObj; | |
| 1175 if ((len = m_File.AppendDWord(p->GetRefObjNum())) < 0) { | |
| 1176 return -1; | 1170 return -1; |
| 1177 } | 1171 if (m_File.AppendString(FX_BSTRC(" 0 R")) < 0) |
| 1178 if (m_File.AppendString(FX_BSTRC(" 0 R")) < 0) { | |
| 1179 return -1; | 1172 return -1; |
| 1180 } | |
| 1181 m_Offset += len + 5; | 1173 m_Offset += len + 5; |
| 1182 break; | 1174 break; |
| 1183 } | 1175 } |
| 1184 case PDFOBJ_ARRAY: { | 1176 case PDFOBJ_ARRAY: { |
| 1185 if (m_File.AppendString(FX_BSTRC("[")) < 0) { | 1177 if (m_File.AppendString(FX_BSTRC("[")) < 0) { |
| 1186 return -1; | 1178 return -1; |
| 1187 } | 1179 } |
| 1188 m_Offset += 1; | 1180 m_Offset += 1; |
| 1189 const CPDF_Array* p = pObj->AsArray(); | 1181 const CPDF_Array* p = pObj->AsArray(); |
| 1190 for (FX_DWORD i = 0; i < p->GetCount(); i++) { | 1182 for (FX_DWORD i = 0; i < p->GetCount(); i++) { |
| (...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 m_bNewCrypto = FALSE; | 2111 m_bNewCrypto = FALSE; |
| 2120 if (!m_bStandardSecurity) { | 2112 if (!m_bStandardSecurity) { |
| 2121 return; | 2113 return; |
| 2122 } | 2114 } |
| 2123 if (m_pEncryptDict) { | 2115 if (m_pEncryptDict) { |
| 2124 m_pEncryptDict->Release(); | 2116 m_pEncryptDict->Release(); |
| 2125 m_pEncryptDict = NULL; | 2117 m_pEncryptDict = NULL; |
| 2126 } | 2118 } |
| 2127 m_bStandardSecurity = FALSE; | 2119 m_bStandardSecurity = FALSE; |
| 2128 } | 2120 } |
| OLD | NEW |