| 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 "core/fpdfapi/parser/fpdf_parser_utility.h" | 7 #include "core/fpdfapi/parser/fpdf_parser_utility.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/parser/cpdf_array.h" | 9 #include "core/fpdfapi/parser/cpdf_array.h" |
| 10 #include "core/fpdfapi/parser/cpdf_boolean.h" |
| 10 #include "core/fpdfapi/parser/cpdf_dictionary.h" | 11 #include "core/fpdfapi/parser/cpdf_dictionary.h" |
| 11 #include "core/fpdfapi/parser/cpdf_number.h" | 12 #include "core/fpdfapi/parser/cpdf_number.h" |
| 12 #include "core/fpdfapi/parser/cpdf_reference.h" | 13 #include "core/fpdfapi/parser/cpdf_reference.h" |
| 13 #include "core/fpdfapi/parser/cpdf_stream.h" | 14 #include "core/fpdfapi/parser/cpdf_stream.h" |
| 14 #include "core/fpdfapi/parser/cpdf_stream_acc.h" | 15 #include "core/fpdfapi/parser/cpdf_stream_acc.h" |
| 15 #include "core/fpdfapi/parser/cpdf_string.h" | 16 #include "core/fpdfapi/parser/cpdf_string.h" |
| 16 #include "core/fpdfapi/parser/fpdf_parser_decode.h" | 17 #include "core/fpdfapi/parser/fpdf_parser_decode.h" |
| 17 #include "core/fxcrt/fx_ext.h" | 18 #include "core/fxcrt/fx_ext.h" |
| 18 | 19 |
| 19 // Indexed by 8-bit character code, contains either: | 20 // Indexed by 8-bit character code, contains either: |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 187 } |
| 187 } | 188 } |
| 188 buf << "]"; | 189 buf << "]"; |
| 189 break; | 190 break; |
| 190 } | 191 } |
| 191 case CPDF_Object::DICTIONARY: { | 192 case CPDF_Object::DICTIONARY: { |
| 192 const CPDF_Dictionary* p = pObj->AsDictionary(); | 193 const CPDF_Dictionary* p = pObj->AsDictionary(); |
| 193 buf << "<<"; | 194 buf << "<<"; |
| 194 for (const auto& it : *p) { | 195 for (const auto& it : *p) { |
| 195 const CFX_ByteString& key = it.first; | 196 const CFX_ByteString& key = it.first; |
| 196 CPDF_Object* pValue = it.second; | 197 CPDF_Object* pValue = it.second.get(); |
| 197 buf << "/" << PDF_NameEncode(key); | 198 buf << "/" << PDF_NameEncode(key); |
| 198 if (pValue && !pValue->IsInline()) { | 199 if (pValue && !pValue->IsInline()) { |
| 199 buf << " " << pValue->GetObjNum() << " 0 R "; | 200 buf << " " << pValue->GetObjNum() << " 0 R "; |
| 200 } else { | 201 } else { |
| 201 buf << pValue; | 202 buf << pValue; |
| 202 } | 203 } |
| 203 } | 204 } |
| 204 buf << ">>"; | 205 buf << ">>"; |
| 205 break; | 206 break; |
| 206 } | 207 } |
| 207 case CPDF_Object::STREAM: { | 208 case CPDF_Object::STREAM: { |
| 208 const CPDF_Stream* p = pObj->AsStream(); | 209 const CPDF_Stream* p = pObj->AsStream(); |
| 209 buf << p->GetDict() << "stream\r\n"; | 210 buf << p->GetDict() << "stream\r\n"; |
| 210 CPDF_StreamAcc acc; | 211 CPDF_StreamAcc acc; |
| 211 acc.LoadAllData(p, true); | 212 acc.LoadAllData(p, true); |
| 212 buf.AppendBlock(acc.GetData(), acc.GetSize()); | 213 buf.AppendBlock(acc.GetData(), acc.GetSize()); |
| 213 buf << "\r\nendstream"; | 214 buf << "\r\nendstream"; |
| 214 break; | 215 break; |
| 215 } | 216 } |
| 216 default: | 217 default: |
| 217 ASSERT(false); | 218 ASSERT(false); |
| 218 break; | 219 break; |
| 219 } | 220 } |
| 220 return buf; | 221 return buf; |
| 221 } | 222 } |
| OLD | NEW |