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

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

Issue 1192743004: Cleanup: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 6 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/fpdf_font.cpp ('k') | core/src/fpdfapi/fpdf_font/ttgsubtable.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 "../../../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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 { 293 {
294 if (m_pMapping) { 294 if (m_pMapping) {
295 FX_Free(m_pMapping); 295 FX_Free(m_pMapping);
296 } 296 }
297 if (m_pAddMapping) { 297 if (m_pAddMapping) {
298 FX_Free(m_pAddMapping); 298 FX_Free(m_pAddMapping);
299 } 299 }
300 if (m_pLeadingBytes) { 300 if (m_pLeadingBytes) {
301 FX_Free(m_pLeadingBytes); 301 FX_Free(m_pLeadingBytes);
302 } 302 }
303 if (m_pUseMap) { 303 delete m_pUseMap;
304 delete m_pUseMap;
305 }
306 } 304 }
307 void CPDF_CMap::Release() 305 void CPDF_CMap::Release()
308 { 306 {
309 if (m_PredefinedCMap.IsEmpty()) { 307 if (m_PredefinedCMap.IsEmpty()) {
310 delete this; 308 delete this;
311 } 309 }
312 } 310 }
313 const CPDF_PredefinedCMap g_PredefinedCMaps[] = { 311 const CPDF_PredefinedCMap g_PredefinedCMaps[] = {
314 { "GB-EUC", CIDSET_GB1, CIDCODING_GB, CPDF_CMap::MixedTwoBytes, 1, {0xa1, 0x fe} }, 312 { "GB-EUC", CIDSET_GB1, CIDCODING_GB, CPDF_CMap::MixedTwoBytes, 1, {0xa1, 0x fe} },
315 { "GBpc-EUC", CIDSET_GB1, CIDCODING_GB, CPDF_CMap::MixedTwoBytes, 1, {0xa1, 0xfc} }, 313 { "GBpc-EUC", CIDSET_GB1, CIDCODING_GB, CPDF_CMap::MixedTwoBytes, 1, {0xa1, 0xfc} },
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 m_bCIDIsGID = FALSE; 701 m_bCIDIsGID = FALSE;
704 m_bAdobeCourierStd = FALSE; 702 m_bAdobeCourierStd = FALSE;
705 m_pTTGSUBTable = NULL; 703 m_pTTGSUBTable = NULL;
706 FXSYS_memset(m_CharBBox, 0xff, 256 * sizeof(FX_SMALL_RECT)); 704 FXSYS_memset(m_CharBBox, 0xff, 256 * sizeof(FX_SMALL_RECT));
707 } 705 }
708 CPDF_CIDFont::~CPDF_CIDFont() 706 CPDF_CIDFont::~CPDF_CIDFont()
709 { 707 {
710 if (m_pAnsiWidths) { 708 if (m_pAnsiWidths) {
711 FX_Free(m_pAnsiWidths); 709 FX_Free(m_pAnsiWidths);
712 } 710 }
713 if (m_pAllocatedCMap) { 711 delete m_pAllocatedCMap;
714 delete m_pAllocatedCMap; 712 delete m_pCIDToGIDMap;
715 } 713 delete m_pTTGSUBTable;
716 if (m_pCIDToGIDMap) {
717 delete m_pCIDToGIDMap;
718 }
719 if (m_pTTGSUBTable) {
720 delete m_pTTGSUBTable;
721 }
722 } 714 }
723 FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const 715 FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const
724 { 716 {
725 if (m_pCMap == NULL) { 717 if (m_pCMap == NULL) {
726 return (FX_WORD)charcode; 718 return (FX_WORD)charcode;
727 } 719 }
728 return m_pCMap->CIDFromCharCode(charcode); 720 return m_pCMap->CIDFromCharCode(charcode);
729 } 721 }
730 FX_BOOL CPDF_CIDFont::IsVertWriting() const 722 FX_BOOL CPDF_CIDFont::IsVertWriting() const
731 { 723 {
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 if (middlecode > CID) { 1584 if (middlecode > CID) {
1593 end = middle - 1; 1585 end = middle - 1;
1594 } else if (middlecode < CID) { 1586 } else if (middlecode < CID) {
1595 begin = middle + 1; 1587 begin = middle + 1;
1596 } else { 1588 } else {
1597 return &Japan1_VertCIDs[middle].a; 1589 return &Japan1_VertCIDs[middle].a;
1598 } 1590 }
1599 } 1591 }
1600 return NULL; 1592 return NULL;
1601 } 1593 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | core/src/fpdfapi/fpdf_font/ttgsubtable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698