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

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

Issue 911713002: Use printf("%s", str); to avoid glibc assertion (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | runtime/vm/log_test.cc » ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 "vm/log.h" 5 #include "vm/log.h"
6 6
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/thread.h" 8 #include "vm/thread.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 if (buffer_.is_empty()) { 53 if (buffer_.is_empty()) {
54 return; 54 return;
55 } 55 }
56 if (buffer_.length() <= cursor) { 56 if (buffer_.length() <= cursor) {
57 return; 57 return;
58 } 58 }
59 TerminateString(); 59 TerminateString();
60 const char* str = &buffer_[cursor]; 60 const char* str = &buffer_[cursor];
61 ASSERT(str != NULL); 61 ASSERT(str != NULL);
62 printer_(str); 62 printer_("%s", str);
63 buffer_.TruncateTo(cursor); 63 buffer_.TruncateTo(cursor);
64 } 64 }
65 65
66 66
67 void Log::Clear() { 67 void Log::Clear() {
68 if (this == NoOpLog()) { 68 if (this == NoOpLog()) {
69 return; 69 return;
70 } 70 }
71 buffer_.TruncateTo(0); 71 buffer_.TruncateTo(0);
72 } 72 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 118
119 LogBlock::LogBlock(Thread* thread) 119 LogBlock::LogBlock(Thread* thread)
120 : StackResource(thread->isolate()), 120 : StackResource(thread->isolate()),
121 log_(thread->isolate()->Log()), 121 log_(thread->isolate()->Log()),
122 cursor_(thread->isolate()->Log()->cursor()) { 122 cursor_(thread->isolate()->Log()->cursor()) {
123 CommonConstructor(); 123 CommonConstructor();
124 } 124 }
125 125
126 } // namespace dart 126 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/log_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698