IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 11, 2016, 10:23:42 PM (10 years ago)
Author:
eugene
Message:

modify to pass with extremely pedantic build; force consistency for signed vs unsigned and int sizes; various relastro updates

Location:
trunk/Ohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/libfits/matrix/F_compress_data.c

    r38986 r39457  
    22# include <gfitsio.h>
    33# include <zlib.h>
    4 
    5 /* functions defined in ricecomp.c */
    6 int fits_rcomp(int a[], int nx, unsigned char *c, int clen, int nblock);
    7 int fits_rcomp_short(short a[], int nx, unsigned char *c, int clen, int nblock);
    8 int fits_rcomp_byte(char a[], int nx, unsigned char *c, int clen, int nblock);
    9 int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx, int nblock);
    10 int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx, int nblock);
    11 int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx, int nblock);
    12 
    13 /* functions defined in fits_hcompress.c */
    14 # define LONGLONG long long
    15 int fits_hcompress(int *a, int ny, int nx, int scale, char *output, long *nbytes, int *status);
    16 int fits_hcompress64(LONGLONG *a, int ny, int nx, int scale, char *output, long *nbytes, int *status);
    17 
    18 /* functions defined in fits_hdeccompress.c */
    19 int fits_hdecompress(unsigned char *input, int smooth, int *a, int *ny, int *nx, int *scale, int *status);
    20 int fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *ny, int *nx, int *scale, int *status);
    21 
    22 /* functions defined in pliocomp.c */
    23 int pl_p2li (int *pxsrc, int xs, short *lldst, int npix);
    24 int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix);
    25 
    26 /* functions defined in gzip.c */
    27 int gfits_gz_stripheader (unsigned char *data, int *ndata);
    28 int gfits_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
    29 int gfits_compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
     4# include <gfits_compress.h>
    305
    316# define ESCAPE(RET) { fprintf (stderr, "gzip error in %s @ %s:%d\n", __func__, __FILE__, __LINE__); return (RET); }
     
    338// XXX I'm putting Nx and Ny on the argument list -- only used by hcompress
    349// with a little work, these could go on the option list
    35 int gfits_compress_data (char *zdata, int *Nzdata, char *cmptype,
    36                          char **optname, char **optvalue, int Nopt,
    37                          char *rawdata, int Nrawpix, int rawpix_size,
    38                          int Nx, int Ny) {
     10int gfits_compress_data (char *zdata, unsigned long int *Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *rawdata, unsigned long int Nrawpix, int rawpix_size, int Nx, int Ny) {
    3911
    40   int Nout;
    4112  int status;
    4213
     
    6839
    6940  if (!strcasecmp(cmptype, "RICE_1") || !strcasecmp(cmptype, "RICE_ONE")) {
     41    long int Nout;
    7042    int i, blocksize;
    7143    // look for the BLOCKSIZE
     
    8557    // fprintf (stderr, "%d comp bytes; %d uncomp 'pixels', totals: %d %d\n", Nzdata, Npix, Ninsum, Noutsum);
    8658
    87     int k;
    88 
    8959    switch (rawpix_size) {
    9060      case 4:
     
    9868
    9969        if (0) {
    100           fprintf (stderr, "Nout: %d, Nrawpix: %d\n", Nout, Nrawpix);
     70          long int k;
     71          fprintf (stderr, "Nout: %lu, Nrawpix: %lu\n", Nout, Nrawpix);
    10172          fprintf (stderr, "cmp inp: ");
    10273          for (k = 0; k < Nout; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 2) fprintf (stderr, " "); }
     
    11990      return (FALSE);
    12091    }
    121     if (Nout > *Nzdata) {
    122       fprintf (stderr, "buffer overrun! %d out, %d available\n", Nout, *Nzdata);
     92    if (Nout > (long int) *Nzdata) {
     93      fprintf (stderr, "buffer overrun! %ld out, %lu available\n", Nout, *Nzdata);
    12394      return FALSE;
    12495    }
    125     *Nzdata = Nout;
     96    *Nzdata = (unsigned long int) Nout;
    12697    return TRUE;
    12798  }
     
    129100  if (!strcasecmp(cmptype, "PLIO_1")) {
    130101    // note the fortan starting point: zdata is decremented at start
    131     Nout = pl_p2li ((int *) rawdata, 1, (short *) zdata, Nrawpix);
     102    int Nout = pl_p2li ((int *) rawdata, 1, (short *) zdata, Nrawpix);
    132103    *Nzdata = Nout;
    133104    if (!Nout) return (FALSE);
Note: See TracChangeset for help on using the changeset viewer.