static OPJ_SIZE_T jp2_io_read(void *buf, OPJ_SIZE_T size, void *io) { ssize_t ret; ret = GP_IORead(io, buf, size); if (ret == 0) return -1; return ret; }
static boolean fill_input_buffer(struct jpeg_decompress_struct *cinfo) { int ret; struct my_source_mgr* src = (void*)cinfo->src; ret = GP_IORead(src->io, src->buffer, src->size); if (ret <= 0) { GP_WARN("Failed to fill buffer, IORead returned %i", ret); return FALSE; } src->mgr.next_input_byte = src->buffer; src->mgr.bytes_in_buffer = ret; return TRUE; }
static int gif_input_func(GifFileType* gif, GifByteType* bytes, int size) { GP_IO *io = gif->UserData; return GP_IORead(io, bytes, size); }