void mem_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
{
struct jpeg_source_mgr* mgr = cinfo->src;
- printf("skip %d +%d\n", size - mgr->bytes_in_buffer, num_bytes);
+ printf("skip %d +%ld\n", size - mgr->bytes_in_buffer, num_bytes);
if(num_bytes<=0)
return;
mgr->next_input_byte += num_bytes;
int width = *_width = cinfo.output_width;
int height = *_height = cinfo.output_height;
- *dest = malloc(width*height*4);
+ *dest = (unsigned char*)malloc(width*height*4);
int y;
for (y=0;y<height;y++) {
int x;
U8 *js = scanline;
- RGBA*line = (RGBA*)&(*dest)[y*width];
+ RGBA*line = &((RGBA*)(*dest))[y*width];
jpeg_read_scanlines(&cinfo, &js, 1);
if (cinfo.out_color_space == JCS_GRAYSCALE) {
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
+ fclose(fi);
return 1;
}