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

Side by Side Diff: core/src/fxcrt/fx_basic_gcc.cpp

Issue 1258093002: FX Bool considered harmful, part 3 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « core/src/fxcrt/fx_basic_coords.cpp ('k') | core/src/fxcrt/fx_basic_maps.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 8
9 #include "../../include/fxcrt/fx_ext.h" 9 #include "../../include/fxcrt/fx_ext.h"
10 #include "../../include/fxcrt/fx_string.h" 10 #include "../../include/fxcrt/fx_string.h"
11 11
12 template <class T, class STR_T> 12 template <class T, class STR_T>
13 T FXSYS_StrToInt(STR_T str) 13 T FXSYS_StrToInt(STR_T str)
14 { 14 {
15 FX_BOOL neg = FALSE; 15 bool neg = false;
16 if (str == NULL) { 16 if (str == NULL) {
17 return 0; 17 return 0;
18 } 18 }
19 if (*str == '-') { 19 if (*str == '-') {
20 neg = TRUE; 20 neg = true;
21 str ++; 21 str ++;
22 } 22 }
23 T num = 0; 23 T num = 0;
24 while (*str) { 24 while (*str) {
25 if ((*str) < '0' || (*str) > '9') { 25 if ((*str) < '0' || (*str) > '9') {
26 break; 26 break;
27 } 27 }
28 if (num > (std::numeric_limits<T>::max() - 9) / 10) { 28 if (num > (std::numeric_limits<T>::max() - 9) / 10) {
29 break; 29 break;
30 } 30 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 buf[wlen] = bstr[i]; 230 buf[wlen] = bstr[i];
231 } 231 }
232 wlen ++; 232 wlen ++;
233 } 233 }
234 return wlen; 234 return wlen;
235 } 235 }
236 #ifdef __cplusplus 236 #ifdef __cplusplus
237 } 237 }
238 #endif 238 #endif
239 #endif 239 #endif
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_coords.cpp ('k') | core/src/fxcrt/fx_basic_maps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698