IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2015, 7:58:50 PM (11 years ago)
Author:
eugene
Message:

handle zzero,zscale = 0,1 specially to avoid bitlevel errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/libfits/test/zlib.c

    r38334 r38399  
    4141    }
    4242
     43# ifdef VERBOSE
    4344    char *rawdata = (char *) srcbuf;
    4445    fprintf (stderr, "inp: ");
     
    4748    }
    4849    fprintf (stderr, "\n");
     50# endif
    4951
    5052    // the '5' is the compression level: make this a user argument
    5153    err = deflateInit(&zdn, 5);
    52     fprintf (stderr, "inp buffers cmp 0: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
     54    // fprintf (stderr, "inp buffers cmp 0: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
    5355    if (err != Z_OK) { fprintf (stderr, "error 1: %d vs %d\n", err, Z_OK); exit (1); }
    5456 
    5557    err = deflate(&zdn, Z_FINISH);
    56     fprintf (stderr, "out buffers cmp 1: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
     58    // fprintf (stderr, "out buffers cmp 1: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
    5759    if (err != Z_STREAM_END) { fprintf (stderr, "error 2: %d vs %d\n", err, Z_STREAM_END); exit (2); }
    58     fprintf (stderr, "out buffers cmp 2: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
     60    // fprintf (stderr, "out buffers cmp 2: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
    5961
    6062    // dump out the data which failed to uncompress (and the input data)
     63# ifdef VERBOSE
    6164    char *cmpdata = (char *) tgtbuf;
    6265    fprintf (stderr, "out: ");
     
    6568    }
    6669    fprintf (stderr, "\n");
     70# endif
    6771
    6872    assert (zdn.total_out <= NTGT*sizeof(double));
    6973
    70     fprintf (stderr, "result: %d bytes\n", (int) zdn.total_out);
     74    // fprintf (stderr, "result: %d bytes\n", (int) zdn.total_out);
    7175    // for (i = 0; i < zdn.total_out / sizeof(double); i++) {
    7276    //   fprintf (stderr, "%d : 0x%02hhx\n", i, tgtbuf[i]);
     
    8791    // the '5' is the compression level: make this a user argument
    8892    err = inflateInit(&zup);
    89     fprintf (stderr, "out buffers unc 0: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
     93    // fprintf (stderr, "out buffers unc 0: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
    9094    if (err != Z_OK) { fprintf (stderr, "error 1: %d vs %d\n", err, Z_OK); exit (1); }
    9195 
    9296    err = inflate(&zup, Z_FINISH);
    93     fprintf (stderr, "out buffers unc 1: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
     97    // fprintf (stderr, "out buffers unc 1: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
    9498    if (err != Z_STREAM_END) { fprintf (stderr, "error 2: %d vs %d\n", err, Z_STREAM_END); exit (2); }
    95     fprintf (stderr, "out buffers unc 2: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
     99    // fprintf (stderr, "out buffers unc 2: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
    96100
     101# ifdef VERBOSE
    97102    char *outdata = (char *) outbuf;
    98103    fprintf (stderr, "unc: ");
     
    101106    }
    102107    fprintf (stderr, "\n");
     108# endif
    103109
    104110    assert (zup.total_out <= NTGT*sizeof(double));
    105111
    106     fprintf (stderr, "result: %d bytes\n", (int) zup.total_out);
     112    // fprintf (stderr, "result: %d bytes\n", (int) zup.total_out);
    107113    for (i = 0; 0 && i < zup.total_out / sizeof(double); i++) {
    108       fprintf (stderr, "%d : %f : %f\n", i, outbuf[i], srcbuf[i]);
     114      // fprintf (stderr, "%d : %f : %f\n", i, outbuf[i], srcbuf[i]);
    109115      assert (outbuf[i] == srcbuf[i]);
    110116    }
    111117  }
    112 
    113   exit (0);
     118  return exit_status();
    114119}
    115120
     
    175180    }
    176181  }
    177 
    178   exit (0);
     182  return exit_status();
    179183}
Note: See TracChangeset for help on using the changeset viewer.