Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_EXT_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_EXT_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| 9 | 9 |
| 10 #include <cctype> | 10 #include <cctype> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 } | 53 } |
| 54 | 54 |
| 55 inline int FXSYS_toHexDigit(const FX_CHAR c) { | 55 inline int FXSYS_toHexDigit(const FX_CHAR c) { |
| 56 if (!std::isxdigit(c)) | 56 if (!std::isxdigit(c)) |
| 57 return 0; | 57 return 0; |
| 58 char upchar = std::toupper(c); | 58 char upchar = std::toupper(c); |
| 59 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; | 59 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; |
| 60 } | 60 } |
| 61 | 61 |
| 62 inline bool FXSYS_isDecimalDigit(const FX_CHAR c) { | 62 inline bool FXSYS_isDecimalDigit(const FX_CHAR c) { |
| 63 return std::isdigit(c); | 63 return std::isdigit(c) != 0; |
|
Tom Sepez
2016/03/11 00:30:28
nit: prefer !!std::isdigit(c)
also below.
Wei Li
2016/03/11 04:11:36
Done.
| |
| 64 } | 64 } |
| 65 | 65 |
| 66 inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) { | 66 inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) { |
| 67 return std::iswdigit(c); | 67 return std::iswdigit(c) != 0; |
| 68 } | 68 } |
| 69 | 69 |
| 70 inline int FXSYS_toDecimalDigit(const FX_CHAR c) { | 70 inline int FXSYS_toDecimalDigit(const FX_CHAR c) { |
| 71 if (!std::isdigit(c)) | 71 if (!std::isdigit(c)) |
|
Tom Sepez
2016/03/11 00:30:28
nit: as long as we're here, how about
return std::
Wei Li
2016/03/11 04:11:36
Done.
| |
| 72 return 0; | 72 return 0; |
| 73 return c - '0'; | 73 return c - '0'; |
| 74 } | 74 } |
| 75 | 75 |
| 76 inline int FXSYS_toDecimalDigit(const FX_WCHAR c) { | 76 inline int FXSYS_toDecimalDigit(const FX_WCHAR c) { |
| 77 if (!std::iswdigit(c)) | 77 if (!std::iswdigit(c)) |
| 78 return 0; | 78 return 0; |
| 79 return c - L'0'; | 79 return c - L'0'; |
| 80 } | 80 } |
| 81 | 81 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 j -= gap; | 129 j -= gap; |
| 130 } | 130 } |
| 131 pArray[j + gap] = v1; | 131 pArray[j + gap] = v1; |
| 132 } | 132 } |
| 133 gap >>= 1; | 133 gap >>= 1; |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ | 138 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| OLD | NEW |