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

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

Issue 1143663004: Add safe FX_Alloc2D() macro (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Drop one file, indent. Created 5 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
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 m_Status = 0; 247 m_Status = 0;
248 } else if (m_Status == 6) { 248 } else if (m_Status == 6) {
249 m_pCMap->m_bVertical = CMap_GetCode(word); 249 m_pCMap->m_bVertical = CMap_GetCode(word);
250 m_Status = 0; 250 m_Status = 0;
251 } else if (m_Status == 7) { 251 } else if (m_Status == 7) {
252 if (word == FX_BSTRC("endcodespacerange")) { 252 if (word == FX_BSTRC("endcodespacerange")) {
253 int nSegs = m_CodeRanges.GetSize(); 253 int nSegs = m_CodeRanges.GetSize();
254 if (nSegs > 1) { 254 if (nSegs > 1) {
255 m_pCMap->m_CodingScheme = CPDF_CMap::MixedFourBytes; 255 m_pCMap->m_CodingScheme = CPDF_CMap::MixedFourBytes;
256 m_pCMap->m_nCodeRanges = nSegs; 256 m_pCMap->m_nCodeRanges = nSegs;
257 m_pCMap->m_pLeadingBytes = FX_Alloc(FX_BYTE, nSegs * sizeof(_CMa p_CodeRange)); 257 m_pCMap->m_pLeadingBytes = FX_Alloc2D(FX_BYTE, nSegs, sizeof(_CM ap_CodeRange));
258 FXSYS_memcpy32(m_pCMap->m_pLeadingBytes, m_CodeRanges.GetData(), nSegs * sizeof(_CMap_CodeRange)); 258 FXSYS_memcpy32(m_pCMap->m_pLeadingBytes, m_CodeRanges.GetData(), nSegs * sizeof(_CMap_CodeRange));
259 } else if (nSegs == 1) { 259 } else if (nSegs == 1) {
260 m_pCMap->m_CodingScheme = (m_CodeRanges[0].m_CharSize == 2) ? CP DF_CMap::TwoBytes : CPDF_CMap::OneByte; 260 m_pCMap->m_CodingScheme = (m_CodeRanges[0].m_CharSize == 2) ? CP DF_CMap::TwoBytes : CPDF_CMap::OneByte;
261 } 261 }
262 m_Status = 0; 262 m_Status = 0;
263 } else { 263 } else {
264 if (word.GetLength() == 0 || word.GetAt(0) != '<') { 264 if (word.GetLength() == 0 || word.GetAt(0) != '<') {
265 return; 265 return;
266 } 266 }
267 if (m_CodeSeq % 2) { 267 if (m_CodeSeq % 2) {
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 if (middlecode > CID) { 1592 if (middlecode > CID) {
1593 end = middle - 1; 1593 end = middle - 1;
1594 } else if (middlecode < CID) { 1594 } else if (middlecode < CID) {
1595 begin = middle + 1; 1595 begin = middle + 1;
1596 } else { 1596 } else {
1597 return &Japan1_VertCIDs[middle].a; 1597 return &Japan1_VertCIDs[middle].a;
1598 } 1598 }
1599 } 1599 }
1600 return NULL; 1600 return NULL;
1601 } 1601 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698