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

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

Issue 2340513002: Remove more strcmp/memcmp usage. (Closed)
Patch Set: Nit Created 4 years, 3 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_cmaps/cmap_int.h ('k') | 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 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_cmaps/cmap_int.h" 7 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h"
8 8
9 #include "core/fpdfapi/fpdf_font/font_int.h" 9 #include "core/fpdfapi/fpdf_font/font_int.h"
10 #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" 10 #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 uint32_t value = ((*(uint16_t*)p2) << 16) | ((uint16_t*)p2)[1]; 46 uint32_t value = ((*(uint16_t*)p2) << 16) | ((uint16_t*)p2)[1];
47 if (key < value) 47 if (key < value)
48 return -1; 48 return -1;
49 if (key > value) 49 if (key > value)
50 return 1; 50 return 1;
51 return 0; 51 return 0;
52 } 52 }
53 53
54 }; // extern "C" 54 }; // extern "C"
55 55
56 void FPDFAPI_FindEmbeddedCMap(const char* name, 56 void FPDFAPI_FindEmbeddedCMap(const CFX_ByteString& bsName,
57 int charset, 57 int charset,
58 int coding, 58 int coding,
59 const FXCMAP_CMap*& pMap) { 59 const FXCMAP_CMap*& pMap) {
60 pMap = nullptr; 60 pMap = nullptr;
61 CPDF_FontGlobals* pFontGlobals = 61 CPDF_FontGlobals* pFontGlobals =
62 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); 62 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
63 const FXCMAP_CMap* pCMaps = 63 const FXCMAP_CMap* pCMaps =
64 pFontGlobals->m_EmbeddedCharsets[charset].m_pMapList; 64 pFontGlobals->m_EmbeddedCharsets[charset].m_pMapList;
65 for (uint32_t i = 0; i < pFontGlobals->m_EmbeddedCharsets[charset].m_Count; 65 for (uint32_t i = 0; i < pFontGlobals->m_EmbeddedCharsets[charset].m_Count;
66 i++) { 66 i++) {
67 if (FXSYS_strcmp(name, pCMaps[i].m_Name)) 67 if (bsName == pCMaps[i].m_Name) {
68 continue; 68 pMap = &pCMaps[i];
69 pMap = &pCMaps[i]; 69 break;
70 break; 70 }
71 } 71 }
72 } 72 }
73 73
74 uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) { 74 uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) {
75 if (charcode >> 16) { 75 if (charcode >> 16) {
76 while (1) { 76 while (1) {
77 if (pMap->m_DWordMapType == FXCMAP_CMap::Range) { 77 if (pMap->m_DWordMapType == FXCMAP_CMap::Range) {
78 uint16_t* found = static_cast<uint16_t*>( 78 uint16_t* found = static_cast<uint16_t*>(
79 FXSYS_bsearch(&charcode, pMap->m_pDWordMap, pMap->m_DWordCount, 8, 79 FXSYS_bsearch(&charcode, pMap->m_pDWordMap, pMap->m_DWordCount, 8,
80 compareDWordRange)); 80 compareDWordRange));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 pCur += 3; 146 pCur += 3;
147 } 147 }
148 } 148 }
149 if (pMap->m_UseOffset == 0) 149 if (pMap->m_UseOffset == 0)
150 return 0; 150 return 0;
151 151
152 pMap = pMap + pMap->m_UseOffset; 152 pMap = pMap + pMap->m_UseOffset;
153 } 153 }
154 } 154 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_cmaps/cmap_int.h ('k') | core/fpdfapi/fpdf_font/font_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698