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

Side by Side Diff: core/fpdfapi/fpdf_font/fpdf_font.cpp

Issue 1972053003: Add CFX_ByteStringC::CharAt() to avoid c_str() and casts (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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_font/cpdf_font.cpp ('k') | core/fpdfapi/fpdf_parser/fpdf_parser_utility.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_font/font_int.h" 7 #include "core/fpdfapi/fpdf_font/font_int.h"
8 8
9 #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" 9 #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h"
10 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" 10 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 // Static. 133 // Static.
134 uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) { 134 uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) {
135 int len = str.GetLength(); 135 int len = str.GetLength();
136 if (len == 0) 136 if (len == 0)
137 return 0; 137 return 0;
138 138
139 int result = 0; 139 int result = 0;
140 if (str[0] == '<') { 140 if (str[0] == '<') {
141 for (int i = 1; i < len && std::isxdigit(str[i]); ++i) 141 for (int i = 1; i < len && std::isxdigit(str[i]); ++i)
142 result = result * 16 + FXSYS_toHexDigit(str[i]); 142 result = result * 16 + FXSYS_toHexDigit(str.CharAt(i));
143 return result; 143 return result;
144 } 144 }
145 145
146 for (int i = 0; i < len && std::isdigit(str[i]); ++i) 146 for (int i = 0; i < len && std::isdigit(str[i]); ++i)
147 result = result * 10 + FXSYS_toDecimalDigit(static_cast<FX_CHAR>(str[i])); 147 result = result * 10 + FXSYS_toDecimalDigit(str.CharAt(i));
148 148
149 return result; 149 return result;
150 } 150 }
151 151
152 static CFX_WideString StringDataAdd(CFX_WideString str) { 152 static CFX_WideString StringDataAdd(CFX_WideString str) {
153 CFX_WideString ret; 153 CFX_WideString ret;
154 int len = str.GetLength(); 154 int len = str.GetLength();
155 FX_WCHAR value = 1; 155 FX_WCHAR value = 1;
156 for (int i = len - 1; i >= 0; --i) { 156 for (int i = len - 1; i >= 0; --i) {
157 FX_WCHAR ch = str[i] + value; 157 FX_WCHAR ch = str[i] + value;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 if (cid_set) { 294 if (cid_set) {
295 m_pBaseMap = CPDF_ModuleMgr::Get() 295 m_pBaseMap = CPDF_ModuleMgr::Get()
296 ->GetPageModule() 296 ->GetPageModule()
297 ->GetFontGlobals() 297 ->GetFontGlobals()
298 ->m_CMapManager.GetCID2UnicodeMap(cid_set, FALSE); 298 ->m_CMapManager.GetCID2UnicodeMap(cid_set, FALSE);
299 } else { 299 } else {
300 m_pBaseMap = NULL; 300 m_pBaseMap = NULL;
301 } 301 }
302 } 302 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_font/cpdf_font.cpp ('k') | core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698