X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=display.c;h=0fbfbf5e85749b7330fc6e90215855c0e4f393f0;hb=05eb5ecfb1611ebd0930c3195a5e55f929571cbd;hp=b6488a52df7b85098e2a4ff4266930b363986102;hpb=4185a67f55fb99f34f013b939a8ef9e13454c1e5;p=dcpu16 diff --git a/display.c b/display.c index b6488a5..0fbfbf5 100644 --- a/display.c +++ b/display.c @@ -44,9 +44,9 @@ /* cells are rendered from cell map, which is bitmap of two words, defining four eight-bit columns */ struct pixel_ { - char r; - char g; - char b; + unsigned char r; + unsigned char g; + unsigned char b; }; /* buf will hold image file in memory */ @@ -115,7 +115,13 @@ void memstream_cookie_fini_(struct memstream_cookie_ *c) { } static -int memstream_write_fn_(void *c, const char *buf, int size) { +/* of course these can't be the same */ +#ifdef HAVE_FOPENCOOKIE +ssize_t memstream_write_fn_(void *c, const char *buf, size_t size) +#else /* HAVE_FOPENCOOKIE */ +int memstream_write_fn_(void *c, const char *buf, int size) +#endif /* HAVE_FOPENCOOKIE */ +{ struct memstream_cookie_ *cookie = c; while ((size_t)size + cookie->offset > cookie->allocated) { @@ -227,7 +233,7 @@ void display_png_write_(struct dcpu16_display_ *d) { #ifdef HAVE_FOPENCOOKIE /* linux-style memory stream */ - struct cookie_io_functions_t cookie_io_functions = { + cookie_io_functions_t cookie_io_functions = { .read = NULL, .write = memstream_write_fn_, .seek = NULL,