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

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

Issue 361553002: Remove "this==NULL" and adjust corresponding callers (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix if check warning Created 6 years, 5 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_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fpdfapi/fpdf_pageobj.h" 9 #include "../../../include/fpdfapi/fpdf_pageobj.h"
10 #include "font_int.h" 10 #include "font_int.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 void CPDF_FontGlobals::Clear(void* key) 71 void CPDF_FontGlobals::Clear(void* key)
72 { 72 {
73 void* value = NULL; 73 void* value = NULL;
74 if (!m_pStockMap.Lookup(key, value)) { 74 if (!m_pStockMap.Lookup(key, value)) {
75 return; 75 return;
76 } 76 }
77 if (value) { 77 if (value) {
78 CFX_StockFontArray* pStockFonts = (CFX_StockFontArray*)value; 78 CFX_StockFontArray* pStockFonts = (CFX_StockFontArray*)value;
79 for (int i = 0; i < 14; i ++) { 79 for (int i = 0; i < 14; i ++) {
80 if (pStockFonts->m_pStockFonts[i]) { 80 if (pStockFonts->m_pStockFonts[i]) {
81 pStockFonts->m_pStockFonts[i]->GetFontDict()->Release(); 81 CPDF_Dictionary* pFontDict = pStockFonts->m_pStockFonts[i]->GetF ontDict();
82 if (pFontDict)
83 pFontDict->Release();
82 delete pStockFonts->m_pStockFonts[i]; 84 delete pStockFonts->m_pStockFonts[i];
83 } 85 }
84 } 86 }
85 delete pStockFonts; 87 delete pStockFonts;
86 } 88 }
87 m_pStockMap.RemoveKey(key); 89 m_pStockMap.RemoveKey(key);
88 } 90 }
89 void CPDF_FontGlobals::ClearAll() 91 void CPDF_FontGlobals::ClearAll()
90 { 92 {
91 FX_POSITION pos = m_pStockMap.GetStartPosition(); 93 FX_POSITION pos = m_pStockMap.GetStartPosition();
92 while (pos) { 94 while (pos) {
93 void *key = NULL; 95 void *key = NULL;
94 void* value = NULL; 96 void* value = NULL;
95 m_pStockMap.GetNextAssoc(pos, key, value); 97 m_pStockMap.GetNextAssoc(pos, key, value);
96 if (value) { 98 if (value) {
97 CFX_StockFontArray* pStockFonts = (CFX_StockFontArray*)value; 99 CFX_StockFontArray* pStockFonts = (CFX_StockFontArray*)value;
98 for (int i = 0; i < 14; i ++) { 100 for (int i = 0; i < 14; i ++) {
99 if (pStockFonts->m_pStockFonts[i]) { 101 if (pStockFonts->m_pStockFonts[i]) {
100 pStockFonts->m_pStockFonts[i]->GetFontDict()->Release(); 102 CPDF_Dictionary* pFontDict = pStockFonts->m_pStockFonts[i]-> GetFontDict();
103 if (pFontDict)
104 pFontDict->Release();
101 delete pStockFonts->m_pStockFonts[i]; 105 delete pStockFonts->m_pStockFonts[i];
102 } 106 }
103 } 107 }
104 delete pStockFonts; 108 delete pStockFonts;
105 } 109 }
106 m_pStockMap.RemoveKey(key); 110 m_pStockMap.RemoveKey(key);
107 } 111 }
108 } 112 }
109 CPDF_Font::CPDF_Font() 113 CPDF_Font::CPDF_Font()
110 { 114 {
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 delete pChar; 1695 delete pChar;
1692 m_CacheMap.RemoveKey((FX_LPVOID)(FX_UINTPTR)charcode); 1696 m_CacheMap.RemoveKey((FX_LPVOID)(FX_UINTPTR)charcode);
1693 return LoadChar(charcode, level + 1); 1697 return LoadChar(charcode, level + 1);
1694 } 1698 }
1695 return pChar; 1699 return pChar;
1696 } 1700 }
1697 FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); 1701 FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
1698 if (name == NULL) { 1702 if (name == NULL) {
1699 return NULL; 1703 return NULL;
1700 } 1704 }
1701 CPDF_Stream* pStream = (CPDF_Stream*)m_pCharProcs->GetElementValue(name); 1705 CPDF_Stream* pStream = (CPDF_Stream*)(m_pCharProcs ? m_pCharProcs->GetElemen tValue(name) : NULL);
1702 if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) { 1706 if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) {
1703 return NULL; 1707 return NULL;
1704 } 1708 }
1705 pChar = FX_NEW CPDF_Type3Char; 1709 pChar = FX_NEW CPDF_Type3Char;
1706 pChar->m_pForm = FX_NEW CPDF_Form(m_pDocument, m_pFontResources ? m_pFontRes ources : m_pPageResources, pStream, NULL); 1710 pChar->m_pForm = FX_NEW CPDF_Form(m_pDocument, m_pFontResources ? m_pFontRes ources : m_pPageResources, pStream, NULL);
1707 pChar->m_pForm->ParseContent(NULL, NULL, pChar, NULL, level + 1); 1711 pChar->m_pForm->ParseContent(NULL, NULL, pChar, NULL, level + 1);
1708 FX_FLOAT scale = m_FontMatrix.GetXUnit(); 1712 FX_FLOAT scale = m_FontMatrix.GetXUnit();
1709 pChar->m_Width = (FX_INT32)(pChar->m_Width * scale + 0.5f); 1713 pChar->m_Width = (FX_INT32)(pChar->m_Width * scale + 0.5f);
1710 FX_RECT &rcBBox = pChar->m_BBox; 1714 FX_RECT &rcBBox = pChar->m_BBox;
1711 CFX_FloatRect char_rect((FX_FLOAT)rcBBox.left / 1000.0f, (FX_FLOAT)rcBBox.bo ttom / 1000.0f, 1715 CFX_FloatRect char_rect((FX_FLOAT)rcBBox.left / 1000.0f, (FX_FLOAT)rcBBox.bo ttom / 1000.0f,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 } 1761 }
1758 CPDF_Type3Char::~CPDF_Type3Char() 1762 CPDF_Type3Char::~CPDF_Type3Char()
1759 { 1763 {
1760 if (m_pForm) { 1764 if (m_pForm) {
1761 delete m_pForm; 1765 delete m_pForm;
1762 } 1766 }
1763 if (m_pBitmap) { 1767 if (m_pBitmap) {
1764 delete m_pBitmap; 1768 delete m_pBitmap;
1765 } 1769 }
1766 } 1770 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698