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 BIN_UTILS_H_ | 5 #ifndef BIN_UTILS_H_ |
6 #define BIN_UTILS_H_ | 6 #define BIN_UTILS_H_ |
7 | 7 |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
11 #include "include/dart_api.h" | 11 #include "include/dart_api.h" |
12 #include "platform/globals.h" | 12 #include "platform/globals.h" |
13 | 13 |
14 class OSError { | 14 class OSError { |
15 public: | 15 public: |
16 enum SubSystem { | 16 enum SubSystem { |
17 kSystem, | 17 kSystem, |
18 kGetAddressInfo, | 18 kGetAddressInfo, |
| 19 kNSS, |
19 kUnknown = -1 | 20 kUnknown = -1 |
20 }; | 21 }; |
21 | 22 |
22 OSError(); | 23 OSError(); |
23 OSError(int code, const char* message, SubSystem sub_system) { | 24 OSError(int code, const char* message, SubSystem sub_system) { |
24 sub_system_ = sub_system; | 25 sub_system_ = sub_system; |
25 code_ = code; | 26 code_ = code; |
26 message_ = NULL; // SetMessage will free existing message. | 27 message_ = NULL; // SetMessage will free existing message. |
27 SetMessage(message); | 28 SetMessage(message); |
28 } | 29 } |
(...skipping 29 matching lines...) Expand all Loading... |
58 // conversions are only needed on Windows. If the methods returns a | 59 // conversions are only needed on Windows. If the methods returns a |
59 // pointer that is different from the input pointer the returned | 60 // pointer that is different from the input pointer the returned |
60 // pointer is allocated with malloc and should be freed using free. | 61 // pointer is allocated with malloc and should be freed using free. |
61 static const char* SystemStringToUtf8(const char* str); | 62 static const char* SystemStringToUtf8(const char* str); |
62 static char* SystemStringToUtf8(char* str); | 63 static char* SystemStringToUtf8(char* str); |
63 static const char* Utf8ToSystemString(const char* utf8); | 64 static const char* Utf8ToSystemString(const char* utf8); |
64 static char* Utf8ToSystemString(char* utf8); | 65 static char* Utf8ToSystemString(char* utf8); |
65 }; | 66 }; |
66 | 67 |
67 #endif // BIN_UTILS_H_ | 68 #endif // BIN_UTILS_H_ |
OLD | NEW |