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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp

Issue 1886263003: Rename CFX_ByteTextBuf::GetByteString() to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/fpdf_parser/cpdf_syntax_parser.h" 7 #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 CFX_ByteTextBuf buf; 212 CFX_ByteTextBuf buf;
213 int32_t parlevel = 0; 213 int32_t parlevel = 0;
214 int32_t status = 0; 214 int32_t status = 0;
215 int32_t iEscCode = 0; 215 int32_t iEscCode = 0;
216 while (1) { 216 while (1) {
217 switch (status) { 217 switch (status) {
218 case 0: 218 case 0:
219 if (ch == ')') { 219 if (ch == ')') {
220 if (parlevel == 0) { 220 if (parlevel == 0) {
221 return buf.GetByteString(); 221 return buf.AsStringC();
222 } 222 }
223 parlevel--; 223 parlevel--;
224 buf.AppendChar(')'); 224 buf.AppendChar(')');
225 } else if (ch == '(') { 225 } else if (ch == '(') {
226 parlevel++; 226 parlevel++;
227 buf.AppendChar('('); 227 buf.AppendChar('(');
228 } else if (ch == '\\') { 228 } else if (ch == '\\') {
229 status = 1; 229 status = 1;
230 } else { 230 } else {
231 buf.AppendChar(ch); 231 buf.AppendChar(ch);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 if (ch != '\n') 284 if (ch != '\n')
285 continue; 285 continue;
286 break; 286 break;
287 } 287 }
288 288
289 if (!GetNextChar(ch)) 289 if (!GetNextChar(ch))
290 break; 290 break;
291 } 291 }
292 292
293 GetNextChar(ch); 293 GetNextChar(ch);
294 return buf.GetByteString(); 294 return buf.AsStringC();
295 } 295 }
296 296
297 CFX_ByteString CPDF_SyntaxParser::ReadHexString() { 297 CFX_ByteString CPDF_SyntaxParser::ReadHexString() {
298 uint8_t ch; 298 uint8_t ch;
299 if (!GetNextChar(ch)) 299 if (!GetNextChar(ch))
300 return CFX_ByteString(); 300 return CFX_ByteString();
301 301
302 CFX_ByteTextBuf buf; 302 CFX_ByteTextBuf buf;
303 bool bFirst = true; 303 bool bFirst = true;
304 uint8_t code = 0; 304 uint8_t code = 0;
(...skipping 11 matching lines...) Expand all
316 } 316 }
317 bFirst = !bFirst; 317 bFirst = !bFirst;
318 } 318 }
319 319
320 if (!GetNextChar(ch)) 320 if (!GetNextChar(ch))
321 break; 321 break;
322 } 322 }
323 if (!bFirst) 323 if (!bFirst)
324 buf.AppendByte(code); 324 buf.AppendByte(code);
325 325
326 return buf.GetByteString(); 326 return buf.AsStringC();
327 } 327 }
328 328
329 void CPDF_SyntaxParser::ToNextLine() { 329 void CPDF_SyntaxParser::ToNextLine() {
330 uint8_t ch; 330 uint8_t ch;
331 while (GetNextChar(ch)) { 331 while (GetNextChar(ch)) {
332 if (ch == '\n') 332 if (ch == '\n')
333 break; 333 break;
334 334
335 if (ch == '\r') { 335 if (ch == '\r') {
336 GetNextChar(ch); 336 GetNextChar(ch);
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 if (limit && m_Pos == limit) 981 if (limit && m_Pos == limit)
982 return -1; 982 return -1;
983 } 983 }
984 return -1; 984 return -1;
985 } 985 }
986 986
987 void CPDF_SyntaxParser::SetEncrypt( 987 void CPDF_SyntaxParser::SetEncrypt(
988 std::unique_ptr<IPDF_CryptoHandler> pCryptoHandler) { 988 std::unique_ptr<IPDF_CryptoHandler> pCryptoHandler) {
989 m_pCryptoHandler = std::move(pCryptoHandler); 989 m_pCryptoHandler = std::move(pCryptoHandler);
990 } 990 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698