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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp

Issue 1558083002: Change CPDF_SyntaxParser::GetNextWord() to not pass by non-const ref. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 11 months 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 | « core/include/fpdfapi/fpdf_parser.h ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.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/include/fpdfapi/fpdf_serial.h" 7 #include "core/include/fpdfapi/fpdf_serial.h"
8 8
9 CFDF_Document::CFDF_Document() : CPDF_IndirectObjects(NULL) { 9 CFDF_Document::CFDF_Document() : CPDF_IndirectObjects(NULL) {
10 m_pRootDict = NULL; 10 m_pRootDict = NULL;
(...skipping 28 matching lines...) Expand all
39 CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, FX_DWORD size) { 39 CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, FX_DWORD size) {
40 return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size), 40 return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size),
41 TRUE); 41 TRUE);
42 } 42 }
43 void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) { 43 void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
44 m_pFile = pFile; 44 m_pFile = pFile;
45 m_bOwnFile = bOwnFile; 45 m_bOwnFile = bOwnFile;
46 CPDF_SyntaxParser parser; 46 CPDF_SyntaxParser parser;
47 parser.InitParser(m_pFile, 0); 47 parser.InitParser(m_pFile, 0);
48 while (1) { 48 while (1) {
49 FX_BOOL bNumber; 49 bool bNumber;
50 CFX_ByteString word = parser.GetNextWord(bNumber); 50 CFX_ByteString word = parser.GetNextWord(&bNumber);
51 if (bNumber) { 51 if (bNumber) {
52 FX_DWORD objnum = FXSYS_atoi(word); 52 FX_DWORD objnum = FXSYS_atoi(word);
53 word = parser.GetNextWord(bNumber); 53 word = parser.GetNextWord(&bNumber);
54 if (!bNumber) { 54 if (!bNumber) {
55 break; 55 break;
56 } 56 }
57 word = parser.GetNextWord(bNumber); 57 word = parser.GetNextWord(nullptr);
58 if (word != "obj") { 58 if (word != "obj") {
59 break; 59 break;
60 } 60 }
61 CPDF_Object* pObj = parser.GetObject(this, objnum, 0, nullptr, true); 61 CPDF_Object* pObj = parser.GetObject(this, objnum, 0, nullptr, true);
62 if (!pObj) { 62 if (!pObj) {
63 break; 63 break;
64 } 64 }
65 InsertIndirectObject(objnum, pObj); 65 InsertIndirectObject(objnum, pObj);
66 word = parser.GetNextWord(bNumber); 66 word = parser.GetNextWord(nullptr);
67 if (word != "endobj") { 67 if (word != "endobj") {
68 break; 68 break;
69 } 69 }
70 } else { 70 } else {
71 if (word != "trailer") { 71 if (word != "trailer") {
72 break; 72 break;
73 } 73 }
74 if (CPDF_Dictionary* pMainDict = 74 if (CPDF_Dictionary* pMainDict =
75 ToDictionary(parser.GetObject(this, 0, 0, nullptr, true))) { 75 ToDictionary(parser.GetObject(this, 0, 0, nullptr, true))) {
76 m_pRootDict = pMainDict->GetDict("Root"); 76 m_pRootDict = pMainDict->GetDict("Root");
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 result += wsFileName[1]; 170 result += wsFileName[1];
171 result += ':'; 171 result += ':';
172 result += ChangeSlash(wsFileName.c_str() + 2); 172 result += ChangeSlash(wsFileName.c_str() + 2);
173 return result; 173 return result;
174 } 174 }
175 CFX_WideString result; 175 CFX_WideString result;
176 result += '\\'; 176 result += '\\';
177 result += ChangeSlash(wsFileName.c_str()); 177 result += ChangeSlash(wsFileName.c_str());
178 return result; 178 return result;
179 } 179 }
OLDNEW
« no previous file with comments | « core/include/fpdfapi/fpdf_parser.h ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698