diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-12-28 13:19:47 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-01-09 13:21:40 +0100 |
commit | bbcc85a9f746c161b2e23c6057e69ec7b967252b (patch) | |
tree | 8ead60bd762cc0cbf945c002c769e74699594c0b /include | |
parent | e9667e7f8ab7c154d8932916a22c33cf2bad0445 (diff) | |
download | mupdf-bbcc85a9f746c161b2e23c6057e69ec7b967252b.tar.xz |
Add fz_terminate_buffer function.
Non-destructively zero terminate a fz_buffer for use as a C string.
Diffstat (limited to 'include')
-rw-r--r-- | include/mupdf/fitz/buffer.h | 8 |
1 files changed, 8 insertions, 0 deletions
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 @@ -138,6 +138,14 @@ size_t fz_buffer_vprintf(fz_context *ctx, fz_buffer *buffer, const char *fmt, va 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. */ void fz_md5_buffer(fz_context *ctx, fz_buffer *buffer, unsigned char digest[16]); |