| 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 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 uint8_t* chars = NULL; | 104 uint8_t* chars = NULL; |
| 105 Dart_Handle str = Dart_GetNativeArgument(args, 0); | 105 Dart_Handle str = Dart_GetNativeArgument(args, 0); |
| 106 Dart_Handle result = Dart_StringToUTF8(str, &chars, &length); | 106 Dart_Handle result = Dart_StringToUTF8(str, &chars, &length); |
| 107 if (Dart_IsError(result)) { | 107 if (Dart_IsError(result)) { |
| 108 // TODO(turnidge): Consider propagating some errors here. What if | 108 // TODO(turnidge): Consider propagating some errors here. What if |
| 109 // an isolate gets interrupted by the embedder in the middle of | 109 // an isolate gets interrupted by the embedder in the middle of |
| 110 // Dart_StringToUTF8? We need to make sure not to swallow the | 110 // Dart_StringToUTF8? We need to make sure not to swallow the |
| 111 // interrupt. | 111 // interrupt. |
| 112 Platform::PrintBlocking(stdout, "%s\n", Dart_GetError(result)); | 112 Platform::PrintBlocking(stdout, "%s\n", Dart_GetError(result)); |
| 113 } else { | 113 } else { |
| 114 Platform::PrintBlocking(stdout, "%.*s\n", length, chars); | 114 Platform::PrintBlocking(stdout, "%.*s\n", static_cast<int>(length), chars); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace bin | 118 } // namespace bin |
| 119 } // namespace dart | 119 } // namespace dart |
| OLD | NEW |