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

Unified Diff: vm/os.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/vm/vm.status ('k') | vm/os_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/os.h
===================================================================
--- vm/os.h (revision 9556)
+++ vm/os.h (working copy)
@@ -62,16 +62,21 @@
static void PrintErr(const char* format, ...);
static void VFPrint(FILE* stream, const char* format, va_list args);
// Print formatted output info a buffer.
+ //
// Does not write more than size characters (including the trailing '\0').
- // Returns the number of characters (excluding the trailing '\0') that would
- // been written if the buffer had been big enough.
- // If the return value is greater or equal than the given size then the output
- // has been truncated.
- // The buffer will always be terminated by a '\0', unless the buffer is of
- // size 0.
- // The buffer might be NULL if the size is 0.
- // This specification conforms to C99 standard which is implemented by
- // glibc 2.1+.
+ //
+ // Returns the number of characters (excluding the trailing '\0')
+ // that would been written if the buffer had been big enough. If
+ // the return value is greater or equal than the given size then the
+ // output has been truncated. The return value is never negative.
+ //
+ // The buffer will always be terminated by a '\0', unless the buffer
+ // is of size 0. The buffer might be NULL if the size is 0.
+ //
+ // This specification conforms to C99 standard which is implemented
+ // by glibc 2.1+ with one exception: the C99 standard allows a
+ // negative return value. We will terminate the vm rather than let
+ // that occur.
static int SNPrint(char* str, size_t size, const char* format, ...);
static int VSNPrint(char* str, size_t size,
const char* format,
« no previous file with comments | « tests/vm/vm.status ('k') | vm/os_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698