Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: runtime/bin/builtin_natives.cc

Issue 25401004: Use int for size when printing to stdout. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/standalone/io/print_sync_script.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/print_sync_script.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698