IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 17, 2007, 4:33:48 PM (19 years ago)
Author:
jhoblitt
Message:

psFitsSetCompression() error handling cleanups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFits.c

    r14872 r14876  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-09-17 23:01:00 $
     9 *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-09-18 02:33:48 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    594594    }
    595595
    596     int status = false;
    597     fits_set_compression_type(fits->fd, comptype, &status);
    598     if (!status) {
    599         goto ERROR;
     596    int status = 0;
     597    if (fits_set_compression_type(fits->fd, comptype, &status)) {
     598        char fitsErr[MAX_STRING_LENGTH];
     599        fits_get_errstatus(status, fitsErr);
     600        psError(PS_ERR_BAD_FITS, true,
     601            "Error while configuring compression. CFITSIO error: %s", fitsErr);
     602        return false;
    600603    }
    601604
     
    612615    }
    613616    // status check belongs to fits_set_tile_dim() call
    614     if (!status) {
    615         goto ERROR;
    616     }
    617 
    618     fits_set_noise_bits(fits->fd, noisebits, &status);
    619     if (!status) {
    620         goto ERROR;
    621     }
     617    if (status) {
     618        fits_set_compression_type(fits->fd, 0x0, &status);
     619        char fitsErr[MAX_STRING_LENGTH];
     620        fits_get_errstatus(status, fitsErr);
     621        psError(PS_ERR_BAD_FITS, true,
     622            "Error while configuring compression. CFITSIO error: %s", fitsErr);
     623        return false;
     624    }
     625
     626    if (fits_set_noise_bits(fits->fd, noisebits, &status)) {
     627        fits_set_compression_type(fits->fd, 0x0, &status);
     628        char fitsErr[MAX_STRING_LENGTH];
     629        fits_get_errstatus(status, fitsErr);
     630        psError(PS_ERR_BAD_FITS, true,
     631            "Error while configuring compression. CFITSIO error: %s", fitsErr);
     632        return false;
     633    }
     634
    622635#if FITS_HCOMP
    623     fits_set_hcomp_scale(fits->fd, scale, &status);
    624     if (!status) {
    625         goto ERROR;
    626     }
    627     fits_set_hcomp_smooth(fits->fd, smooth, &status);
    628     if (!status) {
    629         goto ERROR;
     636    if (fits_set_hcomp_scale(fits->fd, scale, &status)) {
     637        fits_set_compression_type(fits->fd, 0x0, &status);
     638        char fitsErr[MAX_STRING_LENGTH];
     639        fits_get_errstatus(status, fitsErr);
     640        psError(PS_ERR_BAD_FITS, true,
     641            "Error while configuring compression. CFITSIO error: %s", fitsErr);
     642        return false;
     643    }
     644    if (fits_set_hcomp_smooth(fits->fd, smooth, &status)) {
     645        fits_set_compression_type(fits->fd, 0x0, &status);
     646        char fitsErr[MAX_STRING_LENGTH];
     647        fits_get_errstatus(status, fitsErr);
     648        psError(PS_ERR_BAD_FITS, true,
     649            "Error while configuring compression. CFITSIO error: %s", fitsErr);
     650        return false;
    630651    }
    631652#endif // FITS_HCOMP
    632653
    633 ERROR:
    634     fits_set_compression_type(fits->fd, 0x0, &status);
    635     char fitsErr[MAX_STRING_LENGTH];
    636     fits_get_errstatus(status, fitsErr);
    637     psError(PS_ERR_BAD_FITS, true,
    638         "Error while configuring compression. CFITSIO error: %s", fitsErr);
    639     return false;
     654    return true;
    640655}
    641656
Note: See TracChangeset for help on using the changeset viewer.