IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27145


Ignore:
Timestamp:
Mar 2, 2010, 3:39:54 PM (16 years ago)
Author:
Paul Price
Message:

Better error checking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/jpeg/psImageJpeg.c

    r24220 r27145  
    202202            if (isfinite(row[i])) {
    203203                pixel = PS_JPEG_SCALEVALUE(row[i],zero,scale);
    204                 outPix[0] = Rpix[pixel];
    205                 outPix[1] = Gpix[pixel];
    206                 outPix[2] = Bpix[pixel];
     204                outPix[0] = Rpix[pixel];
     205                outPix[1] = Gpix[pixel];
     206                outPix[2] = Bpix[pixel];
    207207            } else {
    208                 // XXX NAN value should be set per-color map
    209                 outPix[0] = 0xff;
    210                 outPix[1] = 0x00;
    211                 outPix[2] = 0xff;
    212             }
    213         }
    214         jpeg_write_scanlines(&cinfo, jpegLineList, 1);
     208                // XXX NAN value should be set per-color map
     209                outPix[0] = 0xff;
     210                outPix[1] = 0x00;
     211                outPix[2] = 0xff;
     212            }
     213        }
     214        if (jpeg_write_scanlines(&cinfo, jpegLineList, 1) == 0) {
     215            psError(PS_ERR_IO, true, "Unable to write line %d to JPEG", j);
     216            psFree(jpegLine);
     217            return false;
     218        }
    215219    }
    216220
    217221    jpeg_finish_compress(&cinfo);
    218     fclose(f);
     222    if (fclose(f) == EOF) {
     223        psError(PS_ERR_IO, true, "Failed to close %s", filename);
     224        psFree(jpegLine);
     225        return false;
     226    }
    219227    jpeg_destroy_compress(&cinfo);
    220228
Note: See TracChangeset for help on using the changeset viewer.