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

Side by Side Diff: core/src/fxcrt/fx_basic_gcc.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/fxcrt/fx_basic_bstring.cpp ('k') | core/src/fxcrt/fx_basic_list.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 <limits> 7 #include <limits>
8 #include <cctype> 8 #include <cctype>
9 #include <cwctype> 9 #include <cwctype>
10 10
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 extern "C" { 113 extern "C" {
114 #endif 114 #endif
115 int FXSYS_GetACP() { 115 int FXSYS_GetACP() {
116 return 0; 116 return 0;
117 } 117 }
118 FX_DWORD FXSYS_GetFullPathName(const FX_CHAR* filename, 118 FX_DWORD FXSYS_GetFullPathName(const FX_CHAR* filename,
119 FX_DWORD buflen, 119 FX_DWORD buflen,
120 FX_CHAR* buf, 120 FX_CHAR* buf,
121 FX_CHAR** filepart) { 121 FX_CHAR** filepart) {
122 int srclen = FXSYS_strlen(filename); 122 int srclen = FXSYS_strlen(filename);
123 if (buf == NULL || (int)buflen < srclen + 1) { 123 if (!buf || (int)buflen < srclen + 1) {
124 return srclen + 1; 124 return srclen + 1;
125 } 125 }
126 FXSYS_strcpy(buf, filename); 126 FXSYS_strcpy(buf, filename);
127 return srclen; 127 return srclen;
128 } 128 }
129 FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize) { 129 FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize) {
130 return (FX_DWORD)-1; 130 return (FX_DWORD)-1;
131 } 131 }
132 #ifdef __cplusplus 132 #ifdef __cplusplus
133 } 133 }
134 #endif 134 #endif
135 #endif 135 #endif
136 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 136 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
137 #ifdef __cplusplus 137 #ifdef __cplusplus
138 extern "C" { 138 extern "C" {
139 #endif 139 #endif
140 FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode) { 140 FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode) {
141 return FXSYS_fopen(CFX_ByteString::FromUnicode(filename), 141 return FXSYS_fopen(CFX_ByteString::FromUnicode(filename),
142 CFX_ByteString::FromUnicode(mode)); 142 CFX_ByteString::FromUnicode(mode));
143 } 143 }
144 char* FXSYS_strlwr(char* str) { 144 char* FXSYS_strlwr(char* str) {
145 if (str == NULL) { 145 if (!str) {
146 return NULL; 146 return NULL;
147 } 147 }
148 char* s = str; 148 char* s = str;
149 while (*str) { 149 while (*str) {
150 *str = FXSYS_tolower(*str); 150 *str = FXSYS_tolower(*str);
151 str++; 151 str++;
152 } 152 }
153 return s; 153 return s;
154 } 154 }
155 char* FXSYS_strupr(char* str) { 155 char* FXSYS_strupr(char* str) {
156 if (str == NULL) { 156 if (!str) {
157 return NULL; 157 return NULL;
158 } 158 }
159 char* s = str; 159 char* s = str;
160 while (*str) { 160 while (*str) {
161 *str = FXSYS_toupper(*str); 161 *str = FXSYS_toupper(*str);
162 str++; 162 str++;
163 } 163 }
164 return s; 164 return s;
165 } 165 }
166 FX_WCHAR* FXSYS_wcslwr(FX_WCHAR* str) { 166 FX_WCHAR* FXSYS_wcslwr(FX_WCHAR* str) {
167 if (str == NULL) { 167 if (!str) {
168 return NULL; 168 return NULL;
169 } 169 }
170 FX_WCHAR* s = str; 170 FX_WCHAR* s = str;
171 while (*str) { 171 while (*str) {
172 *str = FXSYS_tolower(*str); 172 *str = FXSYS_tolower(*str);
173 str++; 173 str++;
174 } 174 }
175 return s; 175 return s;
176 } 176 }
177 FX_WCHAR* FXSYS_wcsupr(FX_WCHAR* str) { 177 FX_WCHAR* FXSYS_wcsupr(FX_WCHAR* str) {
178 if (str == NULL) { 178 if (!str) {
179 return NULL; 179 return NULL;
180 } 180 }
181 FX_WCHAR* s = str; 181 FX_WCHAR* s = str;
182 while (*str) { 182 while (*str) {
183 *str = FXSYS_toupper(*str); 183 *str = FXSYS_toupper(*str);
184 str++; 184 str++;
185 } 185 }
186 return s; 186 return s;
187 } 187 }
188 int FXSYS_stricmp(const char* dst, const char* src) { 188 int FXSYS_stricmp(const char* dst, const char* src) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 buf[wlen] = bstr[i]; 251 buf[wlen] = bstr[i];
252 } 252 }
253 wlen++; 253 wlen++;
254 } 254 }
255 return wlen; 255 return wlen;
256 } 256 }
257 #ifdef __cplusplus 257 #ifdef __cplusplus
258 } 258 }
259 #endif 259 #endif
260 #endif 260 #endif
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_bstring.cpp ('k') | core/src/fxcrt/fx_basic_list.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698