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

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

Issue 1757283002: Combine StrToInt methods. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | core/src/fpdfapi/fpdf_font/fpdf_font_cid.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_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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch); 46 return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch);
47 } 47 }
48 48
49 inline int FXSYS_toHexDigit(const FX_CHAR c) { 49 inline int FXSYS_toHexDigit(const FX_CHAR c) {
50 if (!std::isxdigit(c)) 50 if (!std::isxdigit(c))
51 return 0; 51 return 0;
52 char upchar = std::toupper(c); 52 char upchar = std::toupper(c);
53 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; 53 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0';
54 } 54 }
55 55
56 inline bool FXSYS_isDecimalDigit(const FX_CHAR c) {
57 return std::isdigit(c);
58 }
59
60 inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) {
61 return std::iswdigit(c);
62 }
63
56 inline int FXSYS_toDecimalDigit(const FX_CHAR c) { 64 inline int FXSYS_toDecimalDigit(const FX_CHAR c) {
57 if (!std::isdigit(c)) 65 if (!std::isdigit(c))
58 return 0; 66 return 0;
59 return c - '0'; 67 return c - '0';
60 } 68 }
61 69
62 inline int FXSYS_toDecimalDigitWide(const FX_WCHAR c) { 70 inline int FXSYS_toDecimalDigit(const FX_WCHAR c) {
63 if (!std::iswdigit(c)) 71 if (!std::iswdigit(c))
64 return 0; 72 return 0;
65 return c - L'0'; 73 return c - L'0';
66 } 74 }
67 75
68 FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, 76 FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr,
69 int32_t iLength, 77 int32_t iLength,
70 FX_BOOL bIgnoreCase = FALSE); 78 FX_BOOL bIgnoreCase = FALSE);
71 FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, 79 FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr,
72 int32_t iLength, 80 int32_t iLength,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 j -= gap; 123 j -= gap;
116 } 124 }
117 pArray[j + gap] = v1; 125 pArray[j + gap] = v1;
118 } 126 }
119 gap >>= 1; 127 gap >>= 1;
120 } 128 }
121 } 129 }
122 }; 130 };
123 131
124 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ 132 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698