|
@@ -132,17 +132,20 @@ evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap) |
|
|
size_t space; |
|
|
size_t space; |
|
|
size_t oldoff = buf->off; |
|
|
size_t oldoff = buf->off; |
|
|
int sz; |
|
|
int sz; |
|
|
|
|
|
va_list aq; |
|
|
|
|
|
|
|
|
for (;;) { |
|
|
for (;;) { |
|
|
buffer = buf->buffer + buf->off; |
|
|
buffer = buf->buffer + buf->off; |
|
|
space = buf->totallen - buf->misalign - buf->off; |
|
|
space = buf->totallen - buf->misalign - buf->off; |
|
|
|
|
|
|
|
|
|
|
|
va_copy(aq, ap); |
|
|
#ifdef WIN32 |
|
|
#ifdef WIN32 |
|
|
sz = vsnprintf(buffer, space - 1, fmt, ap); |
|
|
|
|
|
|
|
|
sz = vsnprintf(buffer, space - 1, fmt, aq); |
|
|
buffer[space - 1] = '\0'; |
|
|
buffer[space - 1] = '\0'; |
|
|
#else |
|
|
#else |
|
|
sz = vsnprintf(buffer, space, fmt, ap); |
|
|
|
|
|
|
|
|
sz = vsnprintf(buffer, space, fmt, aq); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
va_end(aq); |
|
|
if (sz == -1) |
|
|
if (sz == -1) |
|
|
return (-1); |
|
|
return (-1); |
|
|
if (sz < space) { |
|
|
if (sz < space) { |
|
|