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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 10539133: - Remove trailing '\n' when getting the API error message. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | no next file » | 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 Isolate* isolate = Isolate::Current(); 291 Isolate* isolate = Isolate::Current();
292 DARTSCOPE(isolate); 292 DARTSCOPE(isolate);
293 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); 293 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle));
294 if (obj.IsError()) { 294 if (obj.IsError()) {
295 Error& error = Error::Handle(isolate); 295 Error& error = Error::Handle(isolate);
296 error ^= obj.raw(); 296 error ^= obj.raw();
297 const char* str = error.ToErrorCString(); 297 const char* str = error.ToErrorCString();
298 intptr_t len = strlen(str) + 1; 298 intptr_t len = strlen(str) + 1;
299 char* str_copy = reinterpret_cast<char*>(Api::Allocate(isolate, len)); 299 char* str_copy = reinterpret_cast<char*>(Api::Allocate(isolate, len));
300 strncpy(str_copy, str, len); 300 strncpy(str_copy, str, len);
301 // Strip a possible trailing '\n'.
302 if ((len > 1) && (str_copy[len - 2] == '\n')) {
303 str_copy[len - 2] = '\0';
304 }
301 return str_copy; 305 return str_copy;
302 } else { 306 } else {
303 return ""; 307 return "";
304 } 308 }
305 } 309 }
306 310
307 311
308 DART_EXPORT bool Dart_ErrorHasException(Dart_Handle handle) { 312 DART_EXPORT bool Dart_ErrorHasException(Dart_Handle handle) {
309 Isolate* isolate = Isolate::Current(); 313 Isolate* isolate = Isolate::Current();
310 DARTSCOPE(isolate); 314 DARTSCOPE(isolate);
(...skipping 3321 matching lines...) Expand 10 before | Expand all | Expand 10 after
3632 *buffer_size = 0; 3636 *buffer_size = 0;
3633 } 3637 }
3634 } 3638 }
3635 3639
3636 3640
3637 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) { 3641 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) {
3638 Dart::set_flow_graph_writer(function); 3642 Dart::set_flow_graph_writer(function);
3639 } 3643 }
3640 3644
3641 } // namespace dart 3645 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698