From bbcc85a9f746c161b2e23c6057e69ec7b967252b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 28 Dec 2016 13:19:47 +0100 Subject: Add fz_terminate_buffer function. Non-destructively zero terminate a fz_buffer for use as a C string. --- include/mupdf/fitz/buffer.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/mupdf/fitz/buffer.h b/include/mupdf/fitz/buffer.h index 06aa53eb..914a6aa7 100644 --- a/include/mupdf/fitz/buffer.h +++ b/include/mupdf/fitz/buffer.h @@ -137,6 +137,14 @@ size_t fz_buffer_printf(fz_context *ctx, fz_buffer *buffer, const char *fmt, ... size_t fz_buffer_vprintf(fz_context *ctx, fz_buffer *buffer, const char *fmt, va_list args); void fz_buffer_print_pdf_string(fz_context *ctx, fz_buffer *buffer, const char *text); +/* + fz_terminate_buffer: zero-terminate buffer in order to use as a C string. + + This byte is invisible and does not affect the length of the buffer as returned by fz_buffer_storage. + The zero byte is written *after* the data, and subsequent writes will overwrite the terminating byte. +*/ +void fz_terminate_buffer(fz_context *ctx, fz_buffer *buf); + /* fz_md5_buffer: create MD5 digest of buffer contents. */ -- cgit v1.2.3