- Timestamp:
- May 29, 2015, 5:24:53 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/libfits/matrix/F_compress_data.c
r38329 r38334 27 27 int gfits_compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); 28 28 29 static int pass = 0;30 31 29 int gfits_compress_data (char *zdata, int *Nzdata, char *cmptype, 32 30 char **optname, char **optvalue, int Nopt, … … 34 32 35 33 int status; 34 35 // do not actually compress : this is used for testing 36 if (!strcasecmp(cmptype, "NONE")) { 37 unsigned long Nbytes = Nrawpix * rawpix_size; 38 39 memcpy (zdata, rawdata, Nbytes); 40 *Nzdata = Nbytes; 41 return (TRUE); 42 } 36 43 37 44 if (!strcasecmp(cmptype, "GZIP_1")) { … … 49 56 fprintf (stderr, "error in compress (GZIP)\n"); 50 57 return (FALSE); 51 }52 53 // test of deflate (vs I/O)54 {55 char *srcbuf, *tgtbuf;56 ALLOCATE (srcbuf, char, destLen);57 memcpy (srcbuf, zdata, destLen);58 59 ALLOCATE (tgtbuf, char, Nbytes);60 61 uLongf Ndeflate = Nbytes;62 status = gfits_uncompress ((Bytef *) tgtbuf, &Ndeflate, (Bytef *) zdata, destLen);63 if (status != Z_OK) {64 fprintf (stderr, "error in uncompress (GZIP) : %d vs %d\n", status, Z_OK);65 return (FALSE);66 }67 68 myAssert (Ndeflate == Nbytes, "invalid output size?");69 70 int i;71 for (i = 0; i < Ndeflate; i++) {72 myAssert (rawdata[i] == tgtbuf[i], "data mismatch?");73 }74 75 }76 77 if (pass == 0) {78 int i;79 for (i = 0; i < 32; i++) {80 fprintf (stderr, "0x%02hhx ", zdata[i]);81 }82 fprintf (stderr, "\n");83 pass = 1;84 58 } 85 59 return (TRUE);
Note:
See TracChangeset
for help on using the changeset viewer.
