X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibc.so_src%2Fstdio.c;h=39d37a4b0e17e358ce8ae6d79fe373df8f99ba84;hb=0ab008276f88801b5a5a2ed8e96c285e524ead2c;hp=17bdf49e6a5c0f722edde231d3be19952505f267;hpb=375362e388e5bc180ee867cb7dde21a9430c14cf;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libc.so_src/stdio.c b/Usermode/Libraries/libc.so_src/stdio.c index 17bdf49e..39d37a4b 100644 --- a/Usermode/Libraries/libc.so_src/stdio.c +++ b/Usermode/Libraries/libc.so_src/stdio.c @@ -458,7 +458,7 @@ EXPORT int vsprintf(char * __s, const char *__format, va_list __args) return vsnprintf(__s, 0x7FFFFFFF, __format, __args); } -//sprintfv + /** * \fn EXPORT void vsnprintf(char *buf, const char *format, va_list args) * \brief Prints a formatted string to a buffer @@ -476,11 +476,11 @@ EXPORT int vsnprintf(char *buf, size_t __maxlen, const char *format, va_list arg uint64_t arg; int bLongLong, bPadLeft; - void _addchar(char ch) - { - if(buf && pos < __maxlen) buf[pos] = ch; - pos ++; - } + #define _addchar(ch) do { \ + if(buf && pos < __maxlen) buf[pos] = (ch); \ + else (void)(ch); \ + pos ++; \ + } while(0) tmp[32] = '\0'; @@ -643,6 +643,7 @@ EXPORT int vsnprintf(char *buf, size_t __maxlen, const char *format, va_list arg } _addchar('\0'); pos --; + #undef _addchar //_SysDebug("vsnprintf: buf = '%s'", buf); @@ -714,7 +715,7 @@ EXPORT int printf(const char *format, ...) va_end(args); // Send to stdout - _SysWrite(_stdout, buf, size+1); + _SysWrite(_stdout, buf, size); // Free buffer free(buf);