OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef PLATFORM_UTILS_H_ | 5 #ifndef PLATFORM_UTILS_H_ |
6 #define PLATFORM_UTILS_H_ | 6 #define PLATFORM_UTILS_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 | 10 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 static bool IsJavascriptInt64(int64_t value) { | 207 static bool IsJavascriptInt64(int64_t value) { |
208 return ((-0x20000000000000LL <= value) && (value <= 0x20000000000000LL)); | 208 return ((-0x20000000000000LL <= value) && (value <= 0x20000000000000LL)); |
209 } | 209 } |
210 static bool IsJavascriptInt(intptr_t value) { | 210 static bool IsJavascriptInt(intptr_t value) { |
211 #if defined(ARCH_IS_64BIT) | 211 #if defined(ARCH_IS_64BIT) |
212 return ((-0x20000000000000LL <= value) && (value <= 0x20000000000000LL)); | 212 return ((-0x20000000000000LL <= value) && (value <= 0x20000000000000LL)); |
213 #else | 213 #else |
214 return true; | 214 return true; |
215 #endif | 215 #endif |
216 } | 216 } |
217 | |
218 #if !defined(TARGET_OS_WINDOWS) | |
Ivan Posva
2015/11/18 05:00:49
A better way to solve this would be to move the im
| |
219 static char* StrError(int err, char* buffer, size_t bufsize) { | |
220 #if !defined(__GLIBC__) || \ | |
221 ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) | |
222 // Use the standard version | |
223 if (strerror_r(err, buffer, bufsize) != 0) { | |
224 snprintf(buffer, bufsize, "%s", "strerror_r failed"); | |
225 } | |
226 return buffer; | |
227 #else | |
228 // Use the gnu specific version | |
229 return strerror_r(err, buffer, bufsize); | |
230 #endif | |
231 } | |
232 #endif | |
217 }; | 233 }; |
218 | 234 |
219 } // namespace dart | 235 } // namespace dart |
220 | 236 |
221 #if defined(TARGET_OS_ANDROID) | 237 #if defined(TARGET_OS_ANDROID) |
222 #include "platform/utils_android.h" | 238 #include "platform/utils_android.h" |
223 #elif defined(TARGET_OS_LINUX) | 239 #elif defined(TARGET_OS_LINUX) |
224 #include "platform/utils_linux.h" | 240 #include "platform/utils_linux.h" |
225 #elif defined(TARGET_OS_MACOS) | 241 #elif defined(TARGET_OS_MACOS) |
226 #include "platform/utils_macos.h" | 242 #include "platform/utils_macos.h" |
227 #elif defined(TARGET_OS_WINDOWS) | 243 #elif defined(TARGET_OS_WINDOWS) |
228 #include "platform/utils_win.h" | 244 #include "platform/utils_win.h" |
229 #else | 245 #else |
230 #error Unknown target os. | 246 #error Unknown target os. |
231 #endif | 247 #endif |
232 | 248 |
233 #endif // PLATFORM_UTILS_H_ | 249 #endif // PLATFORM_UTILS_H_ |
OLD | NEW |