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

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

Issue 656463006: Fix off-by-one in sizing of m_EmbeddedToUnicodes. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: g_Charset explicitly sized. Created 6 years, 2 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/src/fpdfapi/fpdf_font/font_int.h ('k') | no next file » | 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 "../../../include/fpdfapi/fpdf_module.h" 7 #include "../../../include/fpdfapi/fpdf_module.h"
8 #include "../../../include/fpdfapi/fpdf_page.h" 8 #include "../../../include/fpdfapi/fpdf_page.h"
9 #include "font_int.h" 9 #include "font_int.h"
10 #include "../fpdf_cmaps/cmap_int.h" 10 #include "../fpdf_cmaps/cmap_int.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, FX_B OOL bPromptCJK) 69 CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, FX_B OOL bPromptCJK)
70 { 70 {
71 CPDF_CMap* pCMap = FX_NEW CPDF_CMap; 71 CPDF_CMap* pCMap = FX_NEW CPDF_CMap;
72 FX_LPCSTR pname = name; 72 FX_LPCSTR pname = name;
73 if (*pname == '/') { 73 if (*pname == '/') {
74 pname ++; 74 pname ++;
75 } 75 }
76 pCMap->LoadPredefined(this, pname, bPromptCJK); 76 pCMap->LoadPredefined(this, pname, bPromptCJK);
77 return pCMap; 77 return pCMap;
78 } 78 }
79 const FX_LPCSTR g_CharsetNames[] = {NULL, "GB1", "CNS1", "Japan1", "Korea1", "UC S", NULL}; 79 static const FX_LPCSTR g_CharsetNames[NUMBER_OF_CIDSETS] = {NULL, "GB1", "CNS1", "Japan1", "Korea1", "UCS" };
80 const int g_CharsetCPs[] = {0, 936, 950, 932, 949, 1200, 0}; 80 static const int g_CharsetCPs[NUMBER_OF_CIDSETS] = {0, 936, 950, 932, 949, 1200 };
81 int _CharsetFromOrdering(const CFX_ByteString& Ordering) 81 int _CharsetFromOrdering(const CFX_ByteString& Ordering)
82 { 82 {
83 int charset = 1; 83 » for (int charset = 1; charset < NUMBER_OF_CIDSETS; charset++) {
84 while (g_CharsetNames[charset] && Ordering != CFX_ByteStringC(g_CharsetNames [charset])) { 84 » » if (Ordering == CFX_ByteStringC(g_CharsetNames[charset]))
85 charset ++; 85 » » » return charset;
86 } 86 » }
87 if (g_CharsetNames[charset] == NULL) { 87 » return CIDSET_UNKNOWN;
88 return CIDSET_UNKNOWN;
89 }
90 return charset;
91 } 88 }
92 void CPDF_CMapManager::ReloadAll() 89 void CPDF_CMapManager::ReloadAll()
93 { 90 {
94 DropAll(TRUE); 91 DropAll(TRUE);
95 } 92 }
96 void CPDF_CMapManager::DropAll(FX_BOOL bReload) 93 void CPDF_CMapManager::DropAll(FX_BOOL bReload)
97 { 94 {
98 FX_POSITION pos = m_CMaps.GetStartPosition(); 95 FX_POSITION pos = m_CMaps.GetStartPosition();
99 while (pos) { 96 while (pos) {
100 CFX_ByteString name; 97 CFX_ByteString name;
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 if (middlecode > CID) { 1699 if (middlecode > CID) {
1703 end = middle - 1; 1700 end = middle - 1;
1704 } else if (middlecode < CID) { 1701 } else if (middlecode < CID) {
1705 begin = middle + 1; 1702 begin = middle + 1;
1706 } else { 1703 } else {
1707 return &Japan1_VertCIDs[middle].a; 1704 return &Japan1_VertCIDs[middle].a;
1708 } 1705 }
1709 } 1706 }
1710 return NULL; 1707 return NULL;
1711 } 1708 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_font/font_int.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698