summaryrefslogtreecommitdiff
path: root/source/fitz/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/fitz/buffer.c')
-rw-r--r--source/fitz/buffer.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/fitz/buffer.c b/source/fitz/buffer.c
index 8212f782..96aa36a6 100644
--- a/source/fitz/buffer.c
+++ b/source/fitz/buffer.c
@@ -251,6 +251,22 @@ fz_append_rune(fz_context *ctx, fz_buffer *buf, int c)
}
void
+fz_append_int32_be(fz_context *ctx, fz_buffer *buf, int x)
+{
+ fz_append_byte(ctx, buf, (x >> 24) & 0xFF);
+ fz_append_byte(ctx, buf, (x >> 16) & 0xFF);
+ fz_append_byte(ctx, buf, (x >> 8) & 0xFF);
+ fz_append_byte(ctx, buf, (x) & 0xFF);
+}
+
+void
+fz_append_int16_be(fz_context *ctx, fz_buffer *buf, int x)
+{
+ fz_append_byte(ctx, buf, (x >> 8) & 0xFF);
+ fz_append_byte(ctx, buf, (x) & 0xFF);
+}
+
+void
fz_append_int32_le(fz_context *ctx, fz_buffer *buf, int x)
{
fz_append_byte(ctx, buf, (x)&0xFF);
@@ -435,7 +451,8 @@ fz_md5_buffer(fz_context *ctx, fz_buffer *buffer, unsigned char digest[16])
{
fz_md5 state;
fz_md5_init(&state);
- fz_md5_update(&state, buffer->data, buffer->len);
+ if (buffer)
+ fz_md5_update(&state, buffer->data, buffer->len);
fz_md5_final(&state, digest);
}