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

Side by Side Diff: vm/os_macos.cc

Issue 10696165: Don't allow OS::SNPrint or OS::VSNPrint to return negative values. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « vm/os_linux.cc ('k') | vm/os_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) 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 "vm/os.h" 5 #include "vm/os.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <limits.h> 8 #include <limits.h>
9 #include <mach/mach.h> 9 #include <mach/mach.h>
10 #include <mach/clock.h> 10 #include <mach/clock.h>
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 int OS::SNPrint(char* str, size_t size, const char* format, ...) { 121 int OS::SNPrint(char* str, size_t size, const char* format, ...) {
122 va_list args; 122 va_list args;
123 va_start(args, format); 123 va_start(args, format);
124 int retval = VSNPrint(str, size, format, args); 124 int retval = VSNPrint(str, size, format, args);
125 va_end(args); 125 va_end(args);
126 return retval; 126 return retval;
127 } 127 }
128 128
129 129
130 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { 130 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) {
131 return vsnprintf(str, size, format, args); 131 int retval = vsnprintf(str, size, format, args);
132 if (retval < 0) {
133 FATAL1("Fatal error in OS::VSNPrint with format '%s'", format);
134 }
135 return retval;
132 } 136 }
133 137
134 138
135 void OS::PrintErr(const char* format, ...) { 139 void OS::PrintErr(const char* format, ...) {
136 va_list args; 140 va_list args;
137 va_start(args, format); 141 va_start(args, format);
138 VFPrint(stderr, format, args); 142 VFPrint(stderr, format, args);
139 va_end(args); 143 va_end(args);
140 } 144 }
141 145
(...skipping 15 matching lines...) Expand all
157 void OS::Abort() { 161 void OS::Abort() {
158 abort(); 162 abort();
159 } 163 }
160 164
161 165
162 void OS::Exit(int code) { 166 void OS::Exit(int code) {
163 exit(code); 167 exit(code);
164 } 168 }
165 169
166 } // namespace dart 170 } // namespace dart
OLDNEW
« no previous file with comments | « vm/os_linux.cc ('k') | vm/os_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698