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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_func.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
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 "pageint.h" 7 #include "pageint.h"
8 8
9 #include <limits.h> 9 #include <limits.h>
10 10
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 200 }
201 } else { 201 } else {
202 int i = 0; 202 int i = 0;
203 while (_PDF_PSOpNames[i].name) { 203 while (_PDF_PSOpNames[i].name) {
204 if (word == CFX_ByteStringC(_PDF_PSOpNames[i].name)) { 204 if (word == CFX_ByteStringC(_PDF_PSOpNames[i].name)) {
205 m_Operators.Add((void*)_PDF_PSOpNames[i].op); 205 m_Operators.Add((void*)_PDF_PSOpNames[i].op);
206 break; 206 break;
207 } 207 }
208 i++; 208 i++;
209 } 209 }
210 if (_PDF_PSOpNames[i].name == NULL) { 210 if (!_PDF_PSOpNames[i].name) {
211 FX_FLOAT* pd = FX_Alloc(FX_FLOAT, 1); 211 FX_FLOAT* pd = FX_Alloc(FX_FLOAT, 1);
212 *pd = FX_atof(word); 212 *pd = FX_atof(word);
213 m_Operators.Add((void*)PSOP_CONST); 213 m_Operators.Add((void*)PSOP_CONST);
214 m_Operators.Add(pd); 214 m_Operators.Add(pd);
215 } 215 }
216 } 216 }
217 } 217 }
218 } 218 }
219 #define PI 3.1415926535897932384626433832795f 219 #define PI 3.1415926535897932384626433832795f
220 FX_BOOL CPDF_PSEngine::DoOperator(PDF_PSOP op) { 220 FX_BOOL CPDF_PSEngine::DoOperator(PDF_PSOP op) {
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 CPDF_ExpIntFunc::CPDF_ExpIntFunc() { 676 CPDF_ExpIntFunc::CPDF_ExpIntFunc() {
677 m_pBeginValues = NULL; 677 m_pBeginValues = NULL;
678 m_pEndValues = NULL; 678 m_pEndValues = NULL;
679 } 679 }
680 CPDF_ExpIntFunc::~CPDF_ExpIntFunc() { 680 CPDF_ExpIntFunc::~CPDF_ExpIntFunc() {
681 FX_Free(m_pBeginValues); 681 FX_Free(m_pBeginValues);
682 FX_Free(m_pEndValues); 682 FX_Free(m_pEndValues);
683 } 683 }
684 FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) { 684 FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) {
685 CPDF_Dictionary* pDict = pObj->GetDict(); 685 CPDF_Dictionary* pDict = pObj->GetDict();
686 if (pDict == NULL) { 686 if (!pDict) {
687 return FALSE; 687 return FALSE;
688 } 688 }
689 CPDF_Array* pArray0 = pDict->GetArray("C0"); 689 CPDF_Array* pArray0 = pDict->GetArray("C0");
690 if (m_nOutputs == 0) { 690 if (m_nOutputs == 0) {
691 m_nOutputs = 1; 691 m_nOutputs = 1;
692 if (pArray0) { 692 if (pArray0) {
693 m_nOutputs = pArray0->GetCount(); 693 m_nOutputs = pArray0->GetCount();
694 } 694 }
695 } 695 }
696 CPDF_Array* pArray1 = pDict->GetArray("C1"); 696 CPDF_Array* pArray1 = pDict->GetArray("C1");
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 } 806 }
807 return TRUE; 807 return TRUE;
808 } 808 }
809 FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const { 809 FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const {
810 FX_FLOAT input = inputs[0]; 810 FX_FLOAT input = inputs[0];
811 size_t i; 811 size_t i;
812 for (i = 0; i < m_pSubFunctions.size() - 1; i++) 812 for (i = 0; i < m_pSubFunctions.size() - 1; i++)
813 if (input < m_pBounds[i + 1]) { 813 if (input < m_pBounds[i + 1]) {
814 break; 814 break;
815 } 815 }
816 if (m_pSubFunctions[i] == NULL) { 816 if (!m_pSubFunctions[i]) {
817 return FALSE; 817 return FALSE;
818 } 818 }
819 input = PDF_Interpolate(input, m_pBounds[i], m_pBounds[i + 1], 819 input = PDF_Interpolate(input, m_pBounds[i], m_pBounds[i + 1],
820 m_pEncode[i * 2], m_pEncode[i * 2 + 1]); 820 m_pEncode[i * 2], m_pEncode[i * 2 + 1]);
821 int nresults; 821 int nresults;
822 m_pSubFunctions[i]->Call(&input, kRequiredNumInputs, outputs, nresults); 822 m_pSubFunctions[i]->Call(&input, kRequiredNumInputs, outputs, nresults);
823 return TRUE; 823 return TRUE;
824 } 824 }
825 CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) { 825 CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) {
826 if (pFuncObj == NULL) { 826 if (!pFuncObj) {
827 return NULL; 827 return NULL;
828 } 828 }
829 CPDF_Function* pFunc = NULL; 829 CPDF_Function* pFunc = NULL;
830 int type; 830 int type;
831 if (CPDF_Stream* pStream = pFuncObj->AsStream()) { 831 if (CPDF_Stream* pStream = pFuncObj->AsStream()) {
832 type = pStream->GetDict()->GetInteger("FunctionType"); 832 type = pStream->GetDict()->GetInteger("FunctionType");
833 } else if (CPDF_Dictionary* pDict = pFuncObj->AsDictionary()) { 833 } else if (CPDF_Dictionary* pDict = pFuncObj->AsDictionary()) {
834 type = pDict->GetInteger("FunctionType"); 834 type = pDict->GetInteger("FunctionType");
835 } else { 835 } else {
836 return NULL; 836 return NULL;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 for (int i = 0; i < m_nOutputs; i++) { 918 for (int i = 0; i < m_nOutputs; i++) {
919 if (results[i] < m_pRanges[i * 2]) { 919 if (results[i] < m_pRanges[i * 2]) {
920 results[i] = m_pRanges[i * 2]; 920 results[i] = m_pRanges[i * 2];
921 } else if (results[i] > m_pRanges[i * 2 + 1]) { 921 } else if (results[i] > m_pRanges[i * 2 + 1]) {
922 results[i] = m_pRanges[i * 2 + 1]; 922 results[i] = m_pRanges[i * 2 + 1];
923 } 923 }
924 } 924 }
925 } 925 }
926 return TRUE; 926 return TRUE;
927 } 927 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698