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

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

Issue 1889003002: Avoid string allocs for CMap_GetString() return value. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Remove some calls where the result is not used. 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 | « no previous file | core/fpdfapi/fpdf_font/font_int.h » ('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 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_font/cpdf_cidfont.h" 7 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h"
8 8
9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" 9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h"
10 #include "core/fpdfapi/fpdf_font/font_int.h" 10 #include "core/fpdfapi/fpdf_font/font_int.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } else { 394 } else {
395 return FALSE; 395 return FALSE;
396 } 396 }
397 if (!m_pCMap) { 397 if (!m_pCMap) {
398 return FALSE; 398 return FALSE;
399 } 399 }
400 m_Charset = m_pCMap->m_Charset; 400 m_Charset = m_pCMap->m_Charset;
401 if (m_Charset == CIDSET_UNKNOWN) { 401 if (m_Charset == CIDSET_UNKNOWN) {
402 CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictBy("CIDSystemInfo"); 402 CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictBy("CIDSystemInfo");
403 if (pCIDInfo) { 403 if (pCIDInfo) {
404 m_Charset = CharsetFromOrdering(pCIDInfo->GetStringBy("Ordering")); 404 m_Charset =
405 CharsetFromOrdering(pCIDInfo->GetStringBy("Ordering").AsStringC());
405 } 406 }
406 } 407 }
407 if (m_Charset != CIDSET_UNKNOWN) 408 if (m_Charset != CIDSET_UNKNOWN)
408 m_pCID2UnicodeMap = 409 m_pCID2UnicodeMap =
409 CPDF_ModuleMgr::Get() 410 CPDF_ModuleMgr::Get()
410 ->GetPageModule() 411 ->GetPageModule()
411 ->GetFontGlobals() 412 ->GetFontGlobals()
412 ->m_CMapManager.GetCID2UnicodeMap( 413 ->m_CMapManager.GetCID2UnicodeMap(
413 m_Charset, 414 m_Charset,
414 !m_pFontFile && (m_pCMap->m_Coding == CIDCODING_CID || 415 !m_pFontFile && (m_pCMap->m_Coding == CIDCODING_CID ||
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 897
897 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { 898 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const {
898 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) 899 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile)
899 return nullptr; 900 return nullptr;
900 901
901 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( 902 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch(
902 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), 903 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs),
903 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); 904 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform);
904 return found ? &found->a : nullptr; 905 return found ? &found->a : nullptr;
905 } 906 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_font/font_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698