]> granicus.if.org Git - libjpeg-turbo/commitdiff
Fix compile error when JCS_EXTENSIONS!=1
authorDRC <dcommander@users.sourceforge.net>
Wed, 7 Sep 2011 05:03:18 +0000 (05:03 +0000)
committerDRC <dcommander@users.sourceforge.net>
Wed, 7 Sep 2011 05:03:18 +0000 (05:03 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@697 632fc199-4ca6-4c93-a231-07263d6284db

turbojpeg.c

index 5f097a9e3bd1627bc4ebea3f0b84a361e95f9f2c..a41f85d6a33653dbe48cb1491176fb0bc3ee6bed 100644 (file)
@@ -132,9 +132,11 @@ static int getPixelFormat(int pixelSize, int flags)
        return -1;
 }
 
-static void setCompDefaults(struct jpeg_compress_struct *cinfo,
+static int setCompDefaults(struct jpeg_compress_struct *cinfo,
        int pixelFormat, int subsamp, int jpegQual)
 {
+       int retval=0;
+
        switch(pixelFormat)
        {
                case TJPF_GRAY:
@@ -182,11 +184,18 @@ static void setCompDefaults(struct jpeg_compress_struct *cinfo,
        cinfo->comp_info[0].v_samp_factor=tjMCUHeight[subsamp]/8;
        cinfo->comp_info[1].v_samp_factor=1;
        cinfo->comp_info[2].v_samp_factor=1;
+
+       #if JCS_EXTENSIONS!=1
+       bailout:
+       #endif
+       return retval;
 }
 
-static void setDecompDefaults(struct jpeg_decompress_struct *dinfo,
+static int setDecompDefaults(struct jpeg_decompress_struct *dinfo,
        int pixelFormat)
 {
+       int retval=0;
+
        switch(pixelFormat)
        {
                case TJPF_GRAY:
@@ -214,6 +223,11 @@ static void setDecompDefaults(struct jpeg_decompress_struct *dinfo,
                        _throw("Unsupported pixel format");
                #endif
        }
+
+       #if JCS_EXTENSIONS!=1
+       bailout:
+       #endif
+       return retval;
 }
 
 
@@ -416,7 +430,8 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf,
                alloc=0;  *jpegSize=tjBufSize(width, height, jpegSubsamp);
        }
        jpeg_mem_dest_tj(cinfo, jpegBuf, jpegSize, alloc);
-       setCompDefaults(cinfo, pixelFormat, jpegSubsamp, jpegQual);
+       if(setCompDefaults(cinfo, pixelFormat, jpegSubsamp, jpegQual)==-1)
+               return -1;
 
        jpeg_start_compress(cinfo, TRUE);
        if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL)
@@ -507,7 +522,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV2(tjhandle handle, unsigned char *srcBuf,
 
        yuvsize=tjBufSizeYUV(width, height, subsamp);
        jpeg_mem_dest_tj(cinfo, &dstBuf, &yuvsize, 0);
-       setCompDefaults(cinfo, pixelFormat, subsamp, -1);
+       if(setCompDefaults(cinfo, pixelFormat, subsamp, -1)==-1) return -1;
 
        jpeg_start_compress(cinfo, TRUE);
        pw=PAD(width, cinfo->max_h_samp_factor);
@@ -729,7 +744,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf,
 
        jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize);
        jpeg_read_header(dinfo, TRUE);
-       setDecompDefaults(dinfo, pixelFormat);
+       if(setDecompDefaults(dinfo, pixelFormat)==-1) return -1;
 
        if(flags&TJFLAG_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE;