diff options
Diffstat (limited to 'fitz/stm_buffer.c')
-rw-r--r-- | fitz/stm_buffer.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fitz/stm_buffer.c b/fitz/stm_buffer.c index 58539bf8..d14b738f 100644 --- a/fitz/stm_buffer.c +++ b/fitz/stm_buffer.c @@ -159,3 +159,18 @@ void fz_write_buffer_pad(fz_context *ctx, fz_buffer *buf) { buf->unused_bits = 0; } + +void +fz_buffer_printf(fz_context *ctx, fz_buffer *buffer, char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + + /* Caller guarantees not to generate more than 256 bytes per call */ + while(buffer->cap - buffer->len < 256) + fz_grow_buffer(ctx, buffer); + + buffer->len += vsprintf(buffer->data + buffer->len, fmt, args); + + va_end(args); +} |