IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38339


Ignore:
Timestamp:
May 30, 2015, 1:49:15 PM (11 years ago)
Author:
eugene
Message:

error handling

Location:
branches/eam_branches/ohana.20150429/src/libfits
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/libfits/extern/gzip.c

    r38334 r38339  
    200200  }
    201201
    202   // the '5' is the compression level: make this a user argument
    203   err = deflateInit(&stream, 5);
     202  // the '1' is the compression level: make this a user argument
     203  // NOTE: cfitsio uses a fixed value of 1
     204  err = deflateInit(&stream, 1);
    204205  if (0) fprintf (stderr, "inp buffers cmp 0: %d => %d => %d\n", stream.avail_in, stream.avail_out, (int) stream.total_out);
    205206
  • branches/eam_branches/ohana.20150429/src/libfits/matrix/F_compress_utils.c

    r38329 r38339  
    166166  int i, Nbyte;
    167167
    168   if (!strcasecmp(cmptype, "GZIP_1")) {
     168  if (!strcasecmp(cmptype, "GZIP_1") || !strcasecmp(cmptype, "NONE")) {
    169169    if (out_bitpix == 8)  return (1);
    170170    if (out_bitpix == 16) return (2);
  • branches/eam_branches/ohana.20150429/src/libfits/matrix/F_uncompress_M.c

    r38334 r38339  
    261261
    262262    zdata = gfits_varlength_column_pointer (ftable, &zdef, row, &Nzdata);
    263     if (!zdata) return (FALSE);
     263    if (!zdata) ESCAPE;
    264264
    265265    // XXX not certain this is the correct place to do the swap (or if zdata_pixsize is
     
    267267
    268268    if (strcasecmp(cmptype, "GZIP_1")) {
    269       if (!gfits_byteswap_zdata (zdata, Nzdata, zdata_pixsize)) return (FALSE);
     269      if (!gfits_byteswap_zdata (zdata, Nzdata, zdata_pixsize)) ESCAPE;
    270270    }
    271271
    272272    // gfits_uncompress_data uncompresses from zdata to the temporary output buffer which must be allocated
    273273    // XXX the tile must not be > 2GB
    274     if (!gfits_uncompress_data ((char *)zdata, Nzdata, cmptype, optname, optvalue, Noptions, out, &Nout, odata_pixsize)) return (FALSE);
     274    if (!gfits_uncompress_data ((char *)zdata, Nzdata, cmptype, optname, optvalue, Noptions, out, &Nout, odata_pixsize)) ESCAPE;
    275275
    276276    // copy the uncompressed pixels into their correct locations           
    277     if (!gfits_distribute_data (matrix, odata_pixsize, out, Nout, otile, oblank, ztile, zblank, zscale, zzero)) return (FALSE);
     277    if (!gfits_distribute_data (matrix, odata_pixsize, out, Nout, otile, oblank, ztile, zblank, zscale, zzero)) ESCAPE;
    278278
    279279    // update the tile counters, carrying to the next dimension if needed
     
    287287    }
    288288  }
     289
     290  FREE (ztile);
     291  if (optname != NULL) {
     292    for (j = 0; j < Noptions; j++) {
     293      FREE (optname[j]);
     294      FREE (optvalue[j]);
     295    }
     296    FREE (optname);
     297    FREE (optvalue);
     298  }
     299  FREE (out);
     300  FREE (otile);
     301  FREE (ntile);
    289302  return (TRUE);
    290303}
  • branches/eam_branches/ohana.20150429/src/libfits/test/compress.sh

    r38329 r38339  
    11
    2 macro go
     2macro test1
    33 mcreate z 500 500
    44 set x = xramp(z)
     
    88 set d = x - b
    99 stat d
     10 exec fpack -g -S test.raw.fits > test.fpk.fits
    1011 exec funpack -S test.cmp.fits > test.fun.fits
    1112end
    1213
    13 macro ttest
     14macro test2
     15 mcreate z 500 500
     16 set x = xramp(z)
     17 wd x test.raw.fits -bitpix -32 -bzero 0 -bscale 1
     18 wd x test.cmp.fits -bitpix -32 -bzero 0 -bscale 1 -compress -compress-mode NONE
     19 rd b test.cmp.fits -x 0
     20 set d = x - b
     21 stat d
     22 # exec funpack -S test.cmp.fits > test.fun.fits
     23end
     24
     25macro test3
    1426
    1527 create x 0 100
Note: See TracChangeset for help on using the changeset viewer.