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 #include <limits> | 7 #include <limits> |
8 #include "../../include/fxcrt/fx_ext.h" | 8 #include "../../include/fxcrt/fx_ext.h" |
9 template <class T, class STR_T> | 9 template <class T, class STR_T> |
10 T FXSYS_StrToInt(STR_T str) | 10 T FXSYS_StrToInt(STR_T str) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 for (int d = digits - 1; d > -1; d--) { | 51 for (int d = digits - 1; d > -1; d--) { |
52 string[d + i] = "0123456789abcdef"[value % 10]; | 52 string[d + i] = "0123456789abcdef"[value % 10]; |
53 value /= 10; | 53 value /= 10; |
54 } | 54 } |
55 string[digits + i] = 0; | 55 string[digits + i] = 0; |
56 return string; | 56 return string; |
57 } | 57 } |
58 #ifdef __cplusplus | 58 #ifdef __cplusplus |
59 extern "C" { | 59 extern "C" { |
60 #endif | 60 #endif |
61 FX_INT32 FXSYS_atoi(FX_LPCSTR str) | 61 int32_t FXSYS_atoi(FX_LPCSTR str) |
62 { | 62 { |
63 return FXSYS_StrToInt<FX_INT32, FX_LPCSTR>(str); | 63 return FXSYS_StrToInt<int32_t, FX_LPCSTR>(str); |
64 } | 64 } |
65 FX_INT32 FXSYS_wtoi(FX_LPCWSTR str) | 65 int32_t FXSYS_wtoi(FX_LPCWSTR str) |
66 { | 66 { |
67 return FXSYS_StrToInt<FX_INT32, FX_LPCWSTR>(str); | 67 return FXSYS_StrToInt<int32_t, FX_LPCWSTR>(str); |
68 } | 68 } |
69 FX_INT64 FXSYS_atoi64(FX_LPCSTR str) | 69 int64_t FXSYS_atoi64(FX_LPCSTR str) |
70 { | 70 { |
71 return FXSYS_StrToInt<FX_INT64, FX_LPCSTR>(str); | 71 return FXSYS_StrToInt<int64_t, FX_LPCSTR>(str); |
72 } | 72 } |
73 FX_INT64 FXSYS_wtoi64(FX_LPCWSTR str) | 73 int64_t FXSYS_wtoi64(FX_LPCWSTR str) |
74 { | 74 { |
75 return FXSYS_StrToInt<FX_INT64, FX_LPCWSTR>(str); | 75 return FXSYS_StrToInt<int64_t, FX_LPCWSTR>(str); |
76 } | 76 } |
77 FX_LPCSTR FXSYS_i64toa(FX_INT64 value, FX_LPSTR str, int radix) | 77 FX_LPCSTR FXSYS_i64toa(int64_t value, FX_LPSTR str, int radix) |
78 { | 78 { |
79 return FXSYS_IntToStr<FX_INT64, FX_LPSTR>(value, str, radix); | 79 return FXSYS_IntToStr<int64_t, FX_LPSTR>(value, str, radix); |
80 } | 80 } |
81 FX_LPCWSTR FXSYS_i64tow(FX_INT64 value, FX_LPWSTR str, int radix) | 81 FX_LPCWSTR FXSYS_i64tow(int64_t value, FX_LPWSTR str, int radix) |
82 { | 82 { |
83 return FXSYS_IntToStr<FX_INT64, FX_LPWSTR>(value, str, radix); | 83 return FXSYS_IntToStr<int64_t, FX_LPWSTR>(value, str, radix); |
84 } | 84 } |
85 #ifdef __cplusplus | 85 #ifdef __cplusplus |
86 } | 86 } |
87 #endif | 87 #endif |
88 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 88 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
89 #ifdef __cplusplus | 89 #ifdef __cplusplus |
90 extern "C" { | 90 extern "C" { |
91 #endif | 91 #endif |
92 int FXSYS_GetACP() | 92 int FXSYS_GetACP() |
93 { | 93 { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 f -= ('A' - 'a'); | 187 f -= ('A' - 'a'); |
188 } | 188 } |
189 if ( ((l = (FX_WCHAR)(*(src++))) >= 'A') && (l <= 'Z') ) { | 189 if ( ((l = (FX_WCHAR)(*(src++))) >= 'A') && (l <= 'Z') ) { |
190 l -= ('A' - 'a'); | 190 l -= ('A' - 'a'); |
191 } | 191 } |
192 } while ( f && (f == l) ); | 192 } while ( f && (f == l) ); |
193 return(f - l); | 193 return(f - l); |
194 } | 194 } |
195 char* FXSYS_itoa(int value, char* string, int radix) | 195 char* FXSYS_itoa(int value, char* string, int radix) |
196 { | 196 { |
197 return FXSYS_IntToStr<FX_INT32, FX_LPSTR>(value, string, radix); | 197 return FXSYS_IntToStr<int32_t, FX_LPSTR>(value, string, radix); |
198 } | 198 } |
199 #ifdef __cplusplus | 199 #ifdef __cplusplus |
200 } | 200 } |
201 #endif | 201 #endif |
202 #endif | 202 #endif |
203 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 203 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
204 #ifdef __cplusplus | 204 #ifdef __cplusplus |
205 extern "C" { | 205 extern "C" { |
206 #endif | 206 #endif |
207 int FXSYS_WideCharToMultiByte(FX_DWORD codepage, FX_DWORD dwFlags, FX_LPCWSTR ws
tr, int wlen, | 207 int FXSYS_WideCharToMultiByte(FX_DWORD codepage, FX_DWORD dwFlags, FX_LPCWSTR ws
tr, int wlen, |
(...skipping 19 matching lines...) Expand all Loading... |
227 buf[wlen] = bstr[i]; | 227 buf[wlen] = bstr[i]; |
228 } | 228 } |
229 wlen ++; | 229 wlen ++; |
230 } | 230 } |
231 return wlen; | 231 return wlen; |
232 } | 232 } |
233 #ifdef __cplusplus | 233 #ifdef __cplusplus |
234 } | 234 } |
235 #endif | 235 #endif |
236 #endif | 236 #endif |
OLD | NEW |