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_MACOS_H_ | 5 #ifndef PLATFORM_UTILS_MACOS_H_ |
6 #define PLATFORM_UTILS_MACOS_H_ | 6 #define PLATFORM_UTILS_MACOS_H_ |
7 | 7 |
8 #include <libkern/OSByteOrder.h> // NOLINT | 8 #include <libkern/OSByteOrder.h> // NOLINT |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 inline uint32_t Utils::HostToLittleEndian32(uint32_t value) { | 54 inline uint32_t Utils::HostToLittleEndian32(uint32_t value) { |
55 return OSSwapHostToLittleInt32(value); | 55 return OSSwapHostToLittleInt32(value); |
56 } | 56 } |
57 | 57 |
58 | 58 |
59 inline uint64_t Utils::HostToLittleEndian64(uint64_t value) { | 59 inline uint64_t Utils::HostToLittleEndian64(uint64_t value) { |
60 return OSSwapHostToLittleInt64(value); | 60 return OSSwapHostToLittleInt64(value); |
61 } | 61 } |
62 | 62 |
| 63 inline char* Utils::StrError(int err, char* buffer, size_t bufsize) { |
| 64 if (strerror_r(err, buffer, bufsize) != 0) { |
| 65 snprintf(buffer, bufsize, "%s", "strerror_r failed"); |
| 66 } |
| 67 return buffer; |
| 68 } |
| 69 |
63 } // namespace dart | 70 } // namespace dart |
64 | 71 |
65 #endif // PLATFORM_UTILS_MACOS_H_ | 72 #endif // PLATFORM_UTILS_MACOS_H_ |
OLD | NEW |