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

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

Issue 1857713003: Rename GetCStr and GetPtr to match CFX_ByteString (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master 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
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp ('k') | core/fpdfdoc/doc_basic.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/fpdf_parser/fpdf_parser_utility.h" 7 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return -1; 81 return -1;
82 } 82 }
83 83
84 int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteStringC& key) { 84 int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteStringC& key) {
85 CPDF_Number* pObj = ToNumber(pDict->GetObjectBy(key)); 85 CPDF_Number* pObj = ToNumber(pDict->GetObjectBy(key));
86 return pObj ? pObj->GetInteger() : 0; 86 return pObj ? pObj->GetInteger() : 0;
87 } 87 }
88 88
89 CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) { 89 CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
90 int size = bstr.GetLength(); 90 int size = bstr.GetLength();
91 const FX_CHAR* pSrc = bstr.GetCStr(); 91 const FX_CHAR* pSrc = bstr.c_str();
92 if (!FXSYS_memchr(pSrc, '#', size)) { 92 if (!FXSYS_memchr(pSrc, '#', size)) {
93 return bstr; 93 return bstr;
94 } 94 }
95 CFX_ByteString result; 95 CFX_ByteString result;
96 FX_CHAR* pDestStart = result.GetBuffer(size); 96 FX_CHAR* pDestStart = result.GetBuffer(size);
97 FX_CHAR* pDest = pDestStart; 97 FX_CHAR* pDest = pDestStart;
98 for (int i = 0; i < size; i++) { 98 for (int i = 0; i < size; i++) {
99 if (pSrc[i] == '#' && i < size - 2) { 99 if (pSrc[i] == '#' && i < size - 2) {
100 *pDest++ = 100 *pDest++ =
101 FXSYS_toHexDigit(pSrc[i + 1]) * 16 + FXSYS_toHexDigit(pSrc[i + 2]); 101 FXSYS_toHexDigit(pSrc[i + 1]) * 16 + FXSYS_toHexDigit(pSrc[i + 2]);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 buf.AppendBlock(acc.GetData(), acc.GetSize()); 214 buf.AppendBlock(acc.GetData(), acc.GetSize());
215 buf << "\r\nendstream"; 215 buf << "\r\nendstream";
216 break; 216 break;
217 } 217 }
218 default: 218 default:
219 ASSERT(FALSE); 219 ASSERT(FALSE);
220 break; 220 break;
221 } 221 }
222 return buf; 222 return buf;
223 } 223 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp ('k') | core/fpdfdoc/doc_basic.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698