IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 29, 2015, 5:24:53 PM (11 years ago)
Author:
eugene
Message:

table compression is internally consistent (tables can be generated and compressed)

File:
1 edited

Legend:

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

    r38329 r38334  
    120120{
    121121    z_stream stream;
    122     int err;
     122    int i, err;
    123123
    124124    stream.next_in = (Bytef*)source;
     
    135135    stream.opaque = Z_NULL;
    136136
     137    if (0) {
     138      fprintf (stderr, "inp unc: ");
     139      for (i = 0; i < sourceLen; i++) {
     140        fprintf (stderr, "0x%02hhx ", source[i]);
     141      }
     142      fprintf (stderr, "\n");
     143    }
     144
    137145    // err = inflateInit2(&stream, -15);
    138146    err = inflateInit(&stream);
     147    if (0) fprintf (stderr, "inp buffers unc 0: %d => %d => %d\n", stream.avail_in, stream.avail_out, (int) stream.total_out);
     148
    139149    if (err != Z_OK) return err;
    140150
    141151    err = inflate(&stream, Z_FINISH);
     152    if (0) fprintf (stderr, "out buffers unc 1: %d => %d => %d\n", stream.avail_in, stream.avail_out, (int) stream.total_out);
    142153    if (err != Z_STREAM_END) {
    143154        inflateEnd(&stream);
    144         if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
    145             return Z_DATA_ERROR;
     155        if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) return Z_DATA_ERROR;
    146156        return err;
    147157    }
     158    if (0) fprintf (stderr, "out buffers unc 2: %d => %d => %d\n", stream.avail_in, stream.avail_out, (int) stream.total_out);
     159
     160    if (0) {
     161      fprintf (stderr, "out unc: ");
     162      for (i = 0; i < stream.total_out; i++) {
     163        fprintf (stderr, "0x%02hhx ", dest[i]);
     164      }
     165      fprintf (stderr, "\n");
     166    }
     167
    148168    assert (stream.total_out <= *destLen);
    149169    *destLen = stream.total_out;
     
    156176{
    157177  z_stream stream;
    158   int err;
     178  int i, err;
    159179 
    160180  stream.next_in = (Bytef*)source;
     
    172192  stream.opaque = Z_NULL;
    173193
     194  if (0) {
     195    fprintf (stderr, "inp cmp: ");
     196    for (i = 0; i < sourceLen; i++) {
     197      fprintf (stderr, "0x%02hhx ", source[i]);
     198    }
     199    fprintf (stderr, "\n");
     200  }
     201
    174202  // the '5' is the compression level: make this a user argument
    175203  err = deflateInit(&stream, 5);
     204  if (0) fprintf (stderr, "inp buffers cmp 0: %d => %d => %d\n", stream.avail_in, stream.avail_out, (int) stream.total_out);
     205
    176206  if (err != Z_OK) return err;
    177207
     
    179209  // the compression occur in a series of steps
    180210  err = deflate(&stream, Z_FINISH);
     211  if (0) fprintf (stderr, "out buffers cmp 1: %d => %d => %d\n", stream.avail_in, stream.avail_out, (int) stream.total_out);
     212
    181213  if (err != Z_STREAM_END) {
    182     deflateEnd(&stream);
    183     return err;
    184   }
     214    err = deflateEnd(&stream);
     215    return Z_BUF_ERROR;
     216  }
     217  if (0) fprintf (stderr, "out buffers cmp 2: %d => %d => %d\n", stream.avail_in, stream.avail_out, (int) stream.total_out);
     218
     219  if (0) {
     220    fprintf (stderr, "out cmp: ");
     221    for (i = 0; i < stream.total_out; i++) {
     222      fprintf (stderr, "0x%02hhx ", dest[i]);
     223    }
     224    fprintf (stderr, "\n");
     225  }
     226
    185227  assert (stream.total_out <= *destLen);
    186228  *destLen = stream.total_out;
Note: See TracChangeset for help on using the changeset viewer.