--- xzgv-0.8-patched/src/readjpeg.c Tue Mar 21 12:16:07 2006 +++ xzgv/src/readjpeg.c Wed Sep 21 21:15:01 2005 @@ -179,11 +179,13 @@ static int have_image; static int width,height; static unsigned char *image; +static int cmyk; unsigned char *ptr,*ptr2; int chkw,chkh; int f,rec; static int greyscale; /* static to satisfy gcc -Wall */ +cmyk=0; greyscale=0; lineptrs=NULL; @@ -225,6 +227,15 @@ greyscale=1; } +if(cinfo.jpeg_color_space==JCS_CMYK) + cmyk=1; + +if(cinfo.jpeg_color_space==JCS_YCCK) + { + cmyk=1; + cinfo.out_color_space=JCS_CMYK; + } + *wp=width=cinfo.image_width; *hp=height=cinfo.image_height; @@ -266,7 +277,7 @@ /* this one shouldn't hurt */ cinfo.do_block_smoothing=FALSE; -if(WH_BAD(width,height) || (*imagep=image=malloc(width*height*3))==NULL) +if(WH_BAD(width,height) || (*imagep=image=malloc(width*(height+cmyk)*3))==NULL) longjmp(jerr.setjmp_buffer,1); jpeg_start_decompress(&cinfo); @@ -279,12 +290,33 @@ for(f=0;frec?rec:f); + rec=cinfo.rec_outbuf_height; + while(cinfo.output_scanlinerec?rec:f); + } + } +else /* cmyk output */ + { + int tmp; + + ptr=image; + while(cinfo.output_scanline