X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibc.so_src%2Fstdio.c;h=e25a6b608316f45f28d9ee6ad4014eaf3cf8f1ac;hb=bbf01510accedc5e224e7b8bd7dc087932bb6233;hp=17bdf49e6a5c0f722edde231d3be19952505f267;hpb=7f05e2b2f029c1e9709a9be14dbeae159bb2f1cc;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libc.so_src/stdio.c b/Usermode/Libraries/libc.so_src/stdio.c index 17bdf49e..e25a6b60 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);