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, |