summaryrefslogtreecommitdiff
path: root/userland/libc/stdio/open_memstream.c
diff options
context:
space:
mode:
Diffstat (limited to 'userland/libc/stdio/open_memstream.c')
-rw-r--r--userland/libc/stdio/open_memstream.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/userland/libc/stdio/open_memstream.c b/userland/libc/stdio/open_memstream.c
index 8f359b9..0d3df86 100644
--- a/userland/libc/stdio/open_memstream.c
+++ b/userland/libc/stdio/open_memstream.c
@@ -1,4 +1,5 @@
#include <assert.h>
+#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -34,7 +35,7 @@ size_t memstream_write(FILE *fp, const unsigned char *buf, size_t n) {
memcpy(c->buffer + fp->offset_in_file, buf, n);
fp->offset_in_file += n;
- if (fp->offset_in_file > c->buffer_usage)
+ if (fp->offset_in_file > (long)c->buffer_usage)
c->buffer_usage = fp->offset_in_file;
return n;
}