Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index bedc5ba2aec7e32c14ac35294fad6f6e7cac37f1..842c6e87e6be48e09c9835c19d14a757d8c4673b 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -3936,7 +3936,7 @@ static intptr_t ConstructFunctionFullyQualifiedCString(const Function& function, |
| ASSERT(chars != NULL); |
| *chars = Isolate::Current()->current_zone()->Alloc<char>(reserve_len + 1); |
| written = OS::SNPrint( |
| - *chars, reserve_len, lib_class_format, library_name, class_name); |
| + *chars, reserve_len + 1, lib_class_format, library_name, class_name); |
| } else { |
| written = ConstructFunctionFullyQualifiedCString(parent, |
| chars, |
| @@ -6933,13 +6933,13 @@ const char* DeoptInfo::ToCString() const { |
| return "No DeoptInfo"; |
| } |
| // First compute the buffer size required. |
| - intptr_t len = 0; |
| + intptr_t len = 1; |
|
srdjan
2012/08/06 16:07:19
Add comment: // Trailing '\0'.
Kevin Millikin (Google)
2012/08/07 10:07:59
Done.
|
| for (intptr_t i = 0; i < Length(); i++) { |
| len += OS::SNPrint(NULL, 0, "[%d(%d):%d]", |
| - Instruction(i), FromIndex(i), i); |
| + Instruction(i), FromIndex(i), i); |
| } |
| // Allocate the buffer. |
| - char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
| + char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len); |
| // Layout the fields in the buffer. |
| intptr_t index = 0; |
| for (intptr_t i = 0; i < Length(); i++) { |
| @@ -7219,7 +7219,7 @@ uword Code::GetDeoptPcAtNodeId(intptr_t node_id) const { |
| const char* Code::ToCString() const { |
| const char* kFormat = "Code entry:0x%d"; |
| - intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()); |
| + intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; |
| char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| OS::SNPrint(chars, len, kFormat, EntryPoint()); |
| return chars; |