Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: core/fpdfapi/parser/cfdf_document.cpp

Issue 2475823002: Assert objnum non-zero in ReplaceIndirectObjectIfHigherGeneration() (Closed)
Patch Set: nit Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | core/fpdfapi/parser/cpdf_indirect_object_holder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cfdf_document.h" 7 #include "core/fpdfapi/parser/cfdf_document.h"
8 8
9 #include "core/fpdfapi/edit/cpdf_creator.h" 9 #include "core/fpdfapi/edit/cpdf_creator.h"
10 #include "core/fpdfapi/parser/cpdf_dictionary.h" 10 #include "core/fpdfapi/parser/cpdf_dictionary.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 void CFDF_Document::ParseStream(IFX_SeekableReadStream* pFile, bool bOwnFile) { 51 void CFDF_Document::ParseStream(IFX_SeekableReadStream* pFile, bool bOwnFile) {
52 m_pFile = pFile; 52 m_pFile = pFile;
53 m_bOwnFile = bOwnFile; 53 m_bOwnFile = bOwnFile;
54 CPDF_SyntaxParser parser; 54 CPDF_SyntaxParser parser;
55 parser.InitParser(m_pFile, 0); 55 parser.InitParser(m_pFile, 0);
56 while (1) { 56 while (1) {
57 bool bNumber; 57 bool bNumber;
58 CFX_ByteString word = parser.GetNextWord(&bNumber); 58 CFX_ByteString word = parser.GetNextWord(&bNumber);
59 if (bNumber) { 59 if (bNumber) {
60 uint32_t objnum = FXSYS_atoui(word.c_str()); 60 uint32_t objnum = FXSYS_atoui(word.c_str());
61 if (!objnum)
62 break;
63
61 word = parser.GetNextWord(&bNumber); 64 word = parser.GetNextWord(&bNumber);
62 if (!bNumber) 65 if (!bNumber)
63 break; 66 break;
64 67
65 word = parser.GetNextWord(nullptr); 68 word = parser.GetNextWord(nullptr);
66 if (word != "obj") 69 if (word != "obj")
67 break; 70 break;
68 71
69 CPDF_Object* pObj = parser.GetObject(this, objnum, 0, true); 72 CPDF_Object* pObj = parser.GetObject(this, objnum, 0, true);
70 if (!pObj) 73 if (!pObj)
(...skipping 23 matching lines...) Expand all
94 97
95 buf << "%FDF-1.2\r\n"; 98 buf << "%FDF-1.2\r\n";
96 for (const auto& pair : *this) 99 for (const auto& pair : *this)
97 buf << pair.first << " 0 obj\r\n" 100 buf << pair.first << " 0 obj\r\n"
98 << pair.second.get() << "\r\nendobj\r\n\r\n"; 101 << pair.second.get() << "\r\nendobj\r\n\r\n";
99 102
100 buf << "trailer\r\n<</Root " << m_pRootDict->GetObjNum() 103 buf << "trailer\r\n<</Root " << m_pRootDict->GetObjNum()
101 << " 0 R>>\r\n%%EOF\r\n"; 104 << " 0 R>>\r\n%%EOF\r\n";
102 return true; 105 return true;
103 } 106 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/parser/cpdf_indirect_object_holder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698