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 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 static char* ConsoleStringToUtf8(char* str, | 77 static char* ConsoleStringToUtf8(char* str, |
78 intptr_t len = -1, | 78 intptr_t len = -1, |
79 intptr_t* result_len = NULL); | 79 intptr_t* result_len = NULL); |
80 static const char* Utf8ToConsoleString(const char* utf8, | 80 static const char* Utf8ToConsoleString(const char* utf8, |
81 intptr_t len = -1, | 81 intptr_t len = -1, |
82 intptr_t* result_len = NULL); | 82 intptr_t* result_len = NULL); |
83 static char* Utf8ToConsoleString(char* utf8, | 83 static char* Utf8ToConsoleString(char* utf8, |
84 intptr_t len = -1, | 84 intptr_t len = -1, |
85 intptr_t* result_len = NULL); | 85 intptr_t* result_len = NULL); |
86 | 86 |
| 87 // Not all platforms support strndup. |
| 88 static char* StrNDup(const char* s, intptr_t n); |
| 89 |
87 private: | 90 private: |
88 DISALLOW_ALLOCATION(); | 91 DISALLOW_ALLOCATION(); |
89 DISALLOW_IMPLICIT_CONSTRUCTORS(StringUtils); | 92 DISALLOW_IMPLICIT_CONSTRUCTORS(StringUtils); |
90 }; | 93 }; |
91 | 94 |
92 | 95 |
93 class ShellUtils { | 96 class ShellUtils { |
94 public: | 97 public: |
95 // Convert all the arguments to UTF8. On Windows, the arguments are | 98 // Convert all the arguments to UTF8. On Windows, the arguments are |
96 // encoded in the current code page and not UTF8. | 99 // encoded in the current code page and not UTF8. |
(...skipping 17 matching lines...) Expand all Loading... |
114 | 117 |
115 private: | 118 private: |
116 DISALLOW_ALLOCATION(); | 119 DISALLOW_ALLOCATION(); |
117 DISALLOW_IMPLICIT_CONSTRUCTORS(TimerUtils); | 120 DISALLOW_IMPLICIT_CONSTRUCTORS(TimerUtils); |
118 }; | 121 }; |
119 | 122 |
120 } // namespace bin | 123 } // namespace bin |
121 } // namespace dart | 124 } // namespace dart |
122 | 125 |
123 #endif // BIN_UTILS_H_ | 126 #endif // BIN_UTILS_H_ |
OLD | NEW |