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

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

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years 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_cid.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page.cpp » ('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 "ttgsubtable.h" 7 #include "ttgsubtable.h"
8 8
9 #include "core/include/fxge/fx_freetype.h" 9 #include "core/include/fxge/fx_freetype.h"
10 #include "core/include/fxge/fx_ge.h" 10 #include "core/include/fxge/fx_ge.h"
(...skipping 29 matching lines...) Expand all
40 buf[mid].value = value; 40 buf[mid].value = value;
41 return; 41 return;
42 } 42 }
43 } 43 }
44 m_Buffer.InsertBlock(low * sizeof(_IntPair), &pair, sizeof(_IntPair)); 44 m_Buffer.InsertBlock(low * sizeof(_IntPair), &pair, sizeof(_IntPair));
45 } 45 }
46 FX_BOOL CFX_GlyphMap::Lookup(int key, int& value) { 46 FX_BOOL CFX_GlyphMap::Lookup(int key, int& value) {
47 void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), 47 void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(),
48 m_Buffer.GetSize() / sizeof(_IntPair), 48 m_Buffer.GetSize() / sizeof(_IntPair),
49 sizeof(_IntPair), _CompareInt); 49 sizeof(_IntPair), _CompareInt);
50 if (pResult == NULL) { 50 if (!pResult) {
51 return FALSE; 51 return FALSE;
52 } 52 }
53 value = ((FX_DWORD*)pResult)[1]; 53 value = ((FX_DWORD*)pResult)[1];
54 return TRUE; 54 return TRUE;
55 } 55 }
56 bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub) { 56 bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub) {
57 header.Version = gsub[0] << 24 | gsub[1] << 16 | gsub[2] << 8 | gsub[3]; 57 header.Version = gsub[0] << 24 | gsub[1] << 16 | gsub[2] << 8 | gsub[3];
58 if (header.Version != 0x00010000) { 58 if (header.Version != 0x00010000) {
59 return false; 59 return false;
60 } 60 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 break; 152 break;
153 } 153 }
154 } 154 }
155 } 155 }
156 return false; 156 return false;
157 } 157 }
158 int CFX_CTTGSUBTable::GetCoverageIndex(struct TCoverageFormatBase* Coverage, 158 int CFX_CTTGSUBTable::GetCoverageIndex(struct TCoverageFormatBase* Coverage,
159 uint32_t g) { 159 uint32_t g) {
160 int i = 0; 160 int i = 0;
161 if (Coverage == NULL) { 161 if (!Coverage) {
162 return -1; 162 return -1;
163 } 163 }
164 switch (Coverage->CoverageFormat) { 164 switch (Coverage->CoverageFormat) {
165 case 1: { 165 case 1: {
166 TCoverageFormat1* c1 = (TCoverageFormat1*)Coverage; 166 TCoverageFormat1* c1 = (TCoverageFormat1*)Coverage;
167 for (i = 0; i < c1->GlyphCount; i++) { 167 for (i = 0; i < c1->GlyphCount; i++) {
168 if ((uint32_t)c1->GlyphArray[i] == g) { 168 if ((uint32_t)c1->GlyphArray[i] == g) {
169 return i; 169 return i;
170 } 170 }
171 } 171 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, 404 FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
405 pFont->GetSubData(), NULL); 405 pFont->GetSubData(), NULL);
406 if (!error && pFont->GetSubData()) { 406 if (!error && pFont->GetSubData()) {
407 nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); 407 nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable);
408 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) { 408 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) {
409 return pGsubTable.release(); 409 return pGsubTable.release();
410 } 410 }
411 } 411 }
412 return NULL; 412 return NULL;
413 } 413 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font_cid.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