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

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

Issue 1853233002: Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix CPDF_Name::GetConstString() 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_edit/fpdf_edit_doc.cpp ('k') | core/fpdfapi/fpdf_font/fpdf_font_cid.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/include/cpdf_form.h" 9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
10 #include "core/fpdfapi/fpdf_page/pageint.h" 10 #include "core/fpdfapi/fpdf_page/pageint.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 } 227 }
228 } else if (word == "beginbfrange") { 228 } else if (word == "beginbfrange") {
229 while (1) { 229 while (1) {
230 CFX_ByteString low, high; 230 CFX_ByteString low, high;
231 low = parser.GetWord(); 231 low = parser.GetWord();
232 if (low.IsEmpty() || low == "endbfrange") { 232 if (low.IsEmpty() || low == "endbfrange") {
233 break; 233 break;
234 } 234 }
235 high = parser.GetWord(); 235 high = parser.GetWord();
236 uint32_t lowcode = StringToCode(low); 236 uint32_t lowcode = StringToCode(low.AsByteStringC());
237 uint32_t highcode = 237 uint32_t highcode = (lowcode & 0xffffff00) |
238 (lowcode & 0xffffff00) | (StringToCode(high) & 0xff); 238 (StringToCode(high.AsByteStringC()) & 0xff);
239 if (highcode == (uint32_t)-1) { 239 if (highcode == (uint32_t)-1) {
240 break; 240 break;
241 } 241 }
242 CFX_ByteString start = parser.GetWord(); 242 CFX_ByteString start = parser.GetWord();
243 if (start == "[") { 243 if (start == "[") {
244 for (uint32_t code = lowcode; code <= highcode; code++) { 244 for (uint32_t code = lowcode; code <= highcode; code++) {
245 CFX_ByteString dest = parser.GetWord(); 245 CFX_ByteString dest = parser.GetWord();
246 CFX_WideString destcode = StringToWideString(dest); 246 CFX_WideString destcode = StringToWideString(dest.AsByteStringC());
247 int len = destcode.GetLength(); 247 int len = destcode.GetLength();
248 if (len == 0) { 248 if (len == 0) {
249 continue; 249 continue;
250 } 250 }
251 if (len == 1) { 251 if (len == 1) {
252 m_Map[code] = destcode.GetAt(0); 252 m_Map[code] = destcode.GetAt(0);
253 } else { 253 } else {
254 m_Map[code] = m_MultiCharBuf.GetLength() * 0x10000 + 0xffff; 254 m_Map[code] = m_MultiCharBuf.GetLength() * 0x10000 + 0xffff;
255 m_MultiCharBuf.AppendChar(destcode.GetLength()); 255 m_MultiCharBuf.AppendChar(destcode.GetLength());
256 m_MultiCharBuf << destcode; 256 m_MultiCharBuf << destcode;
257 } 257 }
258 } 258 }
259 parser.GetWord(); 259 parser.GetWord();
260 } else { 260 } else {
261 CFX_WideString destcode = StringToWideString(start); 261 CFX_WideString destcode = StringToWideString(start.AsByteStringC());
262 int len = destcode.GetLength(); 262 int len = destcode.GetLength();
263 uint32_t value = 0; 263 uint32_t value = 0;
264 if (len == 1) { 264 if (len == 1) {
265 value = StringToCode(start); 265 value = StringToCode(start.AsByteStringC());
266 for (uint32_t code = lowcode; code <= highcode; code++) { 266 for (uint32_t code = lowcode; code <= highcode; code++) {
267 m_Map[code] = value++; 267 m_Map[code] = value++;
268 } 268 }
269 } else { 269 } else {
270 for (uint32_t code = lowcode; code <= highcode; code++) { 270 for (uint32_t code = lowcode; code <= highcode; code++) {
271 CFX_WideString retcode; 271 CFX_WideString retcode;
272 if (code == lowcode) { 272 if (code == lowcode) {
273 retcode = destcode; 273 retcode = destcode;
274 } else { 274 } else {
275 retcode = StringDataAdd(destcode); 275 retcode = StringDataAdd(destcode);
(...skipping 18 matching lines...) Expand all
294 } 294 }
295 if (cid_set) { 295 if (cid_set) {
296 m_pBaseMap = CPDF_ModuleMgr::Get() 296 m_pBaseMap = CPDF_ModuleMgr::Get()
297 ->GetPageModule() 297 ->GetPageModule()
298 ->GetFontGlobals() 298 ->GetFontGlobals()
299 ->m_CMapManager.GetCID2UnicodeMap(cid_set, FALSE); 299 ->m_CMapManager.GetCID2UnicodeMap(cid_set, FALSE);
300 } else { 300 } else {
301 m_pBaseMap = NULL; 301 m_pBaseMap = NULL;
302 } 302 }
303 } 303 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp ('k') | core/fpdfapi/fpdf_font/fpdf_font_cid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698