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

Side by Side Diff: core/include/fxcrt/fx_basic.h

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/include/fpdfapi/fpdf_resource.h ('k') | core/src/fdrm/crypto/fx_crypt_sha.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 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_
8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_
9 9
10 #include "fx_memory.h" 10 #include "fx_memory.h"
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 m_pObject->m_RefCount--; 877 m_pObject->m_RefCount--;
878 if (m_pObject->m_RefCount <= 0) { 878 if (m_pObject->m_RefCount <= 0) {
879 delete m_pObject; 879 delete m_pObject;
880 } 880 }
881 } 881 }
882 m_pObject = ref.m_pObject; 882 m_pObject = ref.m_pObject;
883 } 883 }
884 884
885 void operator=(void* p) { 885 void operator=(void* p) {
886 FXSYS_assert(p == 0); 886 FXSYS_assert(p == 0);
887 if (m_pObject == NULL) { 887 if (!m_pObject) {
888 return; 888 return;
889 } 889 }
890 m_pObject->m_RefCount--; 890 m_pObject->m_RefCount--;
891 if (m_pObject->m_RefCount <= 0) { 891 if (m_pObject->m_RefCount <= 0) {
892 delete m_pObject; 892 delete m_pObject;
893 } 893 }
894 m_pObject = NULL; 894 m_pObject = NULL;
895 } 895 }
896 896
897 const ObjClass* GetObject() const { return m_pObject; } 897 const ObjClass* GetObject() const { return m_pObject; }
898 898
899 operator const ObjClass*() const { return m_pObject; } 899 operator const ObjClass*() const { return m_pObject; }
900 900
901 FX_BOOL IsNull() const { return m_pObject == NULL; } 901 FX_BOOL IsNull() const { return !m_pObject; }
902 902
903 FX_BOOL NotNull() const { return m_pObject != NULL; } 903 FX_BOOL NotNull() const { return !IsNull(); }
904 904
905 ObjClass* GetModify() { 905 ObjClass* GetModify() {
906 if (m_pObject == NULL) { 906 if (!m_pObject) {
907 m_pObject = new CountedObj; 907 m_pObject = new CountedObj;
908 m_pObject->m_RefCount = 1; 908 m_pObject->m_RefCount = 1;
909 } else if (m_pObject->m_RefCount > 1) { 909 } else if (m_pObject->m_RefCount > 1) {
910 m_pObject->m_RefCount--; 910 m_pObject->m_RefCount--;
911 CountedObj* pOldObject = m_pObject; 911 CountedObj* pOldObject = m_pObject;
912 m_pObject = new CountedObj(*pOldObject); 912 m_pObject = new CountedObj(*pOldObject);
913 m_pObject->m_RefCount = 1; 913 m_pObject->m_RefCount = 1;
914 } 914 }
915 return m_pObject; 915 return m_pObject;
916 } 916 }
917 917
918 void SetNull() { 918 void SetNull() {
919 if (m_pObject == NULL) { 919 if (!m_pObject) {
920 return; 920 return;
921 } 921 }
922 m_pObject->m_RefCount--; 922 m_pObject->m_RefCount--;
923 if (m_pObject->m_RefCount <= 0) { 923 if (m_pObject->m_RefCount <= 0) {
924 delete m_pObject; 924 delete m_pObject;
925 } 925 }
926 m_pObject = NULL; 926 m_pObject = NULL;
927 } 927 }
928 928
929 FX_BOOL operator==(const Ref& ref) const { 929 FX_BOOL operator==(const Ref& ref) const {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 FX_FLOAT c; 1141 FX_FLOAT c;
1142 FX_FLOAT d; 1142 FX_FLOAT d;
1143 FX_FLOAT e; 1143 FX_FLOAT e;
1144 FX_FLOAT f; 1144 FX_FLOAT f;
1145 FX_FLOAT g; 1145 FX_FLOAT g;
1146 FX_FLOAT h; 1146 FX_FLOAT h;
1147 FX_FLOAT i; 1147 FX_FLOAT i;
1148 }; 1148 };
1149 1149
1150 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ 1150 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_
OLDNEW
« no previous file with comments | « core/include/fpdfapi/fpdf_resource.h ('k') | core/src/fdrm/crypto/fx_crypt_sha.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698