diff options
author | Magnus Lundborg <lundborg.magnus@gmail.com> | 2014-12-04 16:05:42 (GMT) |
---|---|---|
committer | Magnus Lundborg <lundborg.magnus@gmail.com> | 2014-12-08 13:35:27 (GMT) |
commit | b6c0fbcbb224c894eb90cc920c6ecb8e8d48e66a (patch) | |
tree | 945db6cb55f72e09c56e2846eaa355f8c6bc472d /src/compression | |
parent | db972bad9178b95ee16110de186074476579bf89 (diff) |
Made function arguments const where relevant.
Change-Id: I5b196b57976c8c718b079336a805188ccb03ef4b
Diffstat (limited to 'src/compression')
-rw-r--r-- | src/compression/bwlzh.c | 26 | ||||
-rw-r--r-- | src/compression/bwt.c | 18 | ||||
-rw-r--r-- | src/compression/coder.c | 28 | ||||
-rw-r--r-- | src/compression/dict.c | 2 | ||||
-rw-r--r-- | src/compression/fixpoint.c | 8 | ||||
-rw-r--r-- | src/compression/huffman.c | 16 | ||||
-rw-r--r-- | src/compression/huffmem.c | 10 | ||||
-rw-r--r-- | src/compression/lz77.c | 12 | ||||
-rw-r--r-- | src/compression/merge_sort.c | 6 | ||||
-rw-r--r-- | src/compression/mtf.c | 20 | ||||
-rw-r--r-- | src/compression/rle.c | 12 | ||||
-rw-r--r-- | src/compression/tng_compress.c | 166 | ||||
-rw-r--r-- | src/compression/vals16.c | 8 | ||||
-rw-r--r-- | src/compression/warnmalloc.c | 4 | ||||
-rw-r--r-- | src/compression/widemuldiv.c | 2 | ||||
-rw-r--r-- | src/compression/xtc2.c | 8 | ||||
-rw-r--r-- | src/compression/xtc3.c | 46 |
17 files changed, 196 insertions, 196 deletions
diff --git a/src/compression/bwlzh.c b/src/compression/bwlzh.c index de009d9..f4c0c28 100644 --- a/src/compression/bwlzh.c +++ b/src/compression/bwlzh.c @@ -40,13 +40,13 @@ #define PARTIAL_MTF #endif -int bwlzh_get_buflen(int nvals) +int bwlzh_get_buflen(const int nvals) { return 132000+nvals*8+12*((nvals+MAX_VALS_PER_BLOCK)/MAX_VALS_PER_BLOCK); } #ifdef SHOWIT -static void printvals(char *name, unsigned int *vals, int nvals) +static void printvals(const char *name, unsigned int *vals, const int nvals) { int i; int nvalsmax=nvals; @@ -69,10 +69,10 @@ static void printvals(char *name, unsigned int *vals, int nvals) #endif -static void bwlzh_compress_gen(unsigned int *vals, int nvals, +static void bwlzh_compress_gen(unsigned int *vals, const int nvals, unsigned char *output, int *output_len, - int enable_lz77, - int verbose) + const int enable_lz77, + const int verbose) { unsigned int *vals16; int nvals16; @@ -460,35 +460,35 @@ static void bwlzh_compress_gen(unsigned int *vals, int nvals, } -void DECLSPECDLLEXPORT bwlzh_compress(unsigned int *vals, int nvals, +void DECLSPECDLLEXPORT bwlzh_compress(unsigned int *vals, const int nvals, unsigned char *output, int *output_len) { bwlzh_compress_gen(vals,nvals,output,output_len,1,0); } -void DECLSPECDLLEXPORT bwlzh_compress_verbose(unsigned int *vals, int nvals, +void DECLSPECDLLEXPORT bwlzh_compress_verbose(unsigned int *vals, const int nvals, unsigned char *output, int *output_len) { bwlzh_compress_gen(vals,nvals,output,output_len,1,1); } -void DECLSPECDLLEXPORT bwlzh_compress_no_lz77(unsigned int *vals, int nvals, +void DECLSPECDLLEXPORT bwlzh_compress_no_lz77(unsigned int *vals, const int nvals, unsigned char *output, int *output_len) { bwlzh_compress_gen(vals,nvals,output,output_len,0,0); } -void DECLSPECDLLEXPORT bwlzh_compress_no_lz77_verbose(unsigned int *vals, int nvals, +void DECLSPECDLLEXPORT bwlzh_compress_no_lz77_verbose(unsigned int *vals, const int nvals, unsigned char *output, int *output_len) { bwlzh_compress_gen(vals,nvals,output,output_len,0,1); } -static void bwlzh_decompress_gen(unsigned char *input, int nvals, +static void bwlzh_decompress_gen(unsigned char *input, const int nvals, unsigned int *vals, - int verbose) + const int verbose) { unsigned int *vals16; int nvals16; @@ -785,13 +785,13 @@ static void bwlzh_decompress_gen(unsigned char *input, int nvals, } -void DECLSPECDLLEXPORT bwlzh_decompress(unsigned char *input, int nvals, +void DECLSPECDLLEXPORT bwlzh_decompress(unsigned char *input, const int nvals, unsigned int *vals) { bwlzh_decompress_gen(input,nvals,vals,0); } -void DECLSPECDLLEXPORT bwlzh_decompress_verbose(unsigned char *input, int nvals, +void DECLSPECDLLEXPORT bwlzh_decompress_verbose(unsigned char *input, const int nvals, unsigned int *vals) { bwlzh_decompress_gen(input,nvals,vals,1); diff --git a/src/compression/bwt.c b/src/compression/bwt.c index 681d66b..c5c46df 100644 --- a/src/compression/bwt.c +++ b/src/compression/bwt.c @@ -22,7 +22,7 @@ #define SHOWIT2 #endif -static int compare_index(int i1,int i2,int nvals,unsigned int *vals,unsigned int *nrepeat) +static int compare_index(int i1,int i2, const int nvals, unsigned int *vals, unsigned int *nrepeat) { int i,j; for (i=0; i<nvals; i++) @@ -75,10 +75,10 @@ static int compare_index(int i1,int i2,int nvals,unsigned int *vals,unsigned int return 0; } -void Ptngc_bwt_merge_sort_inner(int *indices, int nvals,unsigned int *vals, - int start, int end, - unsigned int *nrepeat, - int *workarray) +void Ptngc_bwt_merge_sort_inner(int *indices, const int nvals,unsigned int *vals, + const int start, const int end, + unsigned int *nrepeat, + int *workarray) { int middle; if ((end-start)>1) @@ -140,8 +140,8 @@ void Ptngc_bwt_merge_sort_inner(int *indices, int nvals,unsigned int *vals, } /* Burrows-Wheeler transform. */ -void Ptngc_comp_to_bwt(unsigned int *vals, int nvals, - unsigned int *output, int *index) +void Ptngc_comp_to_bwt(unsigned int *vals, const int nvals, + unsigned int *output, int *index) { int i; int *indices=warnmalloc(2*nvals*sizeof *indices); @@ -305,8 +305,8 @@ void Ptngc_comp_to_bwt(unsigned int *vals, int nvals, } /* Burrows-Wheeler inverse transform. */ -void Ptngc_comp_from_bwt(unsigned int *input, int nvals, int index, - unsigned int *vals) +void Ptngc_comp_from_bwt(unsigned int *input, const int nvals, int index, + unsigned int *vals) { /* Straightforward from the Burrows-Wheeler paper (page 13). */ int i; diff --git a/src/compression/coder.c b/src/compression/coder.c index d51e8cd..d0a0d99 100644 --- a/src/compression/coder.c +++ b/src/compression/coder.c @@ -78,7 +78,7 @@ void DECLSPECDLLEXPORT Ptngc_write_pattern(struct coder *coder_inst, unsigned in /* Write up to 24 bits */ TNG_INLINE void DECLSPECDLLEXPORT Ptngc_writebits(struct coder *coder_inst, - unsigned int value, int nbits, + unsigned int value, const int nbits, unsigned char **output_ptr) { /* Make room for the bits. */ @@ -89,7 +89,7 @@ TNG_INLINE void DECLSPECDLLEXPORT Ptngc_writebits(struct coder *coder_inst, } /* Write up to 32 bits */ -void DECLSPECDLLEXPORT Ptngc_write32bits(struct coder *coder_inst,unsigned int value, +void DECLSPECDLLEXPORT Ptngc_write32bits(struct coder *coder_inst, unsigned int value, int nbits, unsigned char **output_ptr) { unsigned int mask; @@ -165,8 +165,8 @@ static int write_stop_bit_code(struct coder *coder_inst, unsigned int s, return 0; } -static int pack_stopbits_item(struct coder *coder_inst,int item, - unsigned char **output, int coding_parameter) +static int pack_stopbits_item(struct coder *coder_inst, const int item, + unsigned char **output, const int coding_parameter) { /* Find this symbol in table. */ int s=0; @@ -178,8 +178,8 @@ static int pack_stopbits_item(struct coder *coder_inst,int item, } static int pack_triplet(struct coder *coder_inst, unsigned int *s, - unsigned char **output, int coding_parameter, - unsigned int max_base, int maxbits) + unsigned char **output, const int coding_parameter, + const unsigned int max_base, const int maxbits) { /* Determine base for this triplet. */ unsigned int min_base=1U<<coding_parameter; @@ -211,7 +211,7 @@ static int pack_triplet(struct coder *coder_inst, unsigned int *s, return 0; } -void DECLSPECDLLEXPORT Ptngc_pack_flush(struct coder *coder_inst,unsigned char **output) +void DECLSPECDLLEXPORT Ptngc_pack_flush(struct coder *coder_inst, unsigned char **output) { /* Zero-fill just enough. */ if (coder_inst->pack_temporary_bits>0) @@ -219,8 +219,8 @@ void DECLSPECDLLEXPORT Ptngc_pack_flush(struct coder *coder_inst,unsigned char * } unsigned char DECLSPECDLLEXPORT *Ptngc_pack_array(struct coder *coder_inst, - int *input, int *length, int coding, - int coding_parameter, int natoms, int speed) + int *input, int *length, const int coding, + const int coding_parameter, const int natoms, const int speed) { if ((coding==TNG_COMPRESS_ALGO_BWLZH1) || (coding==TNG_COMPRESS_ALGO_BWLZH2)) { @@ -337,7 +337,7 @@ unsigned char DECLSPECDLLEXPORT *Ptngc_pack_array(struct coder *coder_inst, static int unpack_array_stop_bits(struct coder *coder_inst, unsigned char *packed,int *output, - int length, int coding_parameter) + const int length, const int coding_parameter) { int i,j; unsigned int extract_mask=0x80; @@ -392,7 +392,7 @@ static int unpack_array_stop_bits(struct coder *coder_inst, static int unpack_array_triplet(struct coder *coder_inst, unsigned char *packed, int *output, - int length, int coding_parameter) + int length, const int coding_parameter) { int i,j; unsigned int extract_mask=0x80; @@ -466,7 +466,7 @@ static int unpack_array_triplet(struct coder *coder_inst, static int unpack_array_bwlzh(struct coder *coder_inst, unsigned char *packed, int *output, - int length, int natoms) + const int length, const int natoms) { int i,j,k,n=length; unsigned int *pval=warnmalloc(n*sizeof *pval); @@ -491,8 +491,8 @@ static int unpack_array_bwlzh(struct coder *coder_inst, int DECLSPECDLLEXPORT Ptngc_unpack_array(struct coder *coder_inst, unsigned char *packed, int *output, - int length, int coding, int coding_parameter, - int natoms) + const int length, const int coding, const int coding_parameter, + const int natoms) { if ((coding==TNG_COMPRESS_ALGO_STOPBIT) || (coding==TNG_COMPRESS_ALGO_VEL_STOPBIT_INTER)) diff --git a/src/compression/dict.c b/src/compression/dict.c index fdfe7a0..7c32d74 100644 --- a/src/compression/dict.c +++ b/src/compression/dict.c @@ -21,7 +21,7 @@ void Ptngc_comp_canonical_dict(unsigned int *dict, int *ndict) *ndict=0x20004; } -void Ptngc_comp_make_dict_hist(unsigned int *vals, int nvals, +void Ptngc_comp_make_dict_hist(unsigned int *vals, const int nvals, unsigned int *dict, int *ndict, unsigned int *hist) { diff --git a/src/compression/fixpoint.c b/src/compression/fixpoint.c index 17fe6e8..f769a43 100644 --- a/src/compression/fixpoint.c +++ b/src/compression/fixpoint.c @@ -19,7 +19,7 @@ /* Conversion routines from / to double precision */ /* Positive double to 32 bit fixed point value */ -fix_t Ptngc_ud_to_fix_t(double d,double max) +fix_t Ptngc_ud_to_fix_t(double d, const double max) { fix_t val; if (d<0.) @@ -33,7 +33,7 @@ fix_t Ptngc_ud_to_fix_t(double d,double max) } /* double to signed 32 bit fixed point value */ -fix_t Ptngc_d_to_fix_t(double d,double max) +fix_t Ptngc_d_to_fix_t(double d, const double max) { fix_t val; int sign=0; @@ -54,13 +54,13 @@ fix_t Ptngc_d_to_fix_t(double d,double max) /* 32 bit fixed point value to positive double */ -double Ptngc_fix_t_to_ud(fix_t f, double max) +double Ptngc_fix_t_to_ud(fix_t f, const double max) { return (double)f*(max/MAX32BIT); } /* signed 32 bit fixed point value to double */ -double Ptngc_fix_t_to_d(fix_t f, double max) +double Ptngc_fix_t_to_d(fix_t f, const double max) { int sign=0; double d; diff --git a/src/compression/huffman.c b/src/compression/huffman.c index 2abcbcf..f2a2933 100644 --- a/src/compression/huffman.c +++ b/src/compression/huffman.c @@ -70,7 +70,7 @@ static void assign_codes(union htree_nodeleaf *htree, struct codelength *codelength, unsigned int code, int length, - int top) + const int top) { #if 0 printf("Assign codes called with code %d length %d\n",code,length); @@ -131,7 +131,7 @@ static void flush_8bits(unsigned int *combine, unsigned char **output, int *bitp } } -static void writebits(unsigned int value,int length, unsigned char **output, int *bitptr) +static void writebits(unsigned int value, int length, unsigned char **output, int *bitptr) { unsigned int mask; unsigned int combine=(unsigned int)**output; @@ -216,8 +216,8 @@ static int comp_codes_value(const void *codeptr1, const void *codeptr2, const vo /* The huffman_dict array should be 131077 (0x20005) long. The huffman_dict_unpacked array should be 131077 long (note five longer than 0x20000) */ -void Ptngc_comp_conv_to_huffman(unsigned int *vals, int nvals, - unsigned int *dict, int ndict, +void Ptngc_comp_conv_to_huffman(unsigned int *vals, const int nvals, + unsigned int *dict, const int ndict, unsigned int *prob, unsigned char *huffman, int *huffman_len, @@ -463,12 +463,12 @@ void Ptngc_comp_conv_to_huffman(unsigned int *vals, int nvals, } void Ptngc_comp_conv_from_huffman(unsigned char *huffman, - unsigned int *vals, int nvals, - int ndict, + unsigned int *vals, const int nvals, + const int ndict, unsigned char *huffman_dict, - int huffman_dictlen, + const int huffman_dictlen, unsigned int *huffman_dict_unpacked, - int huffman_dict_unpackedlen) + const int huffman_dict_unpackedlen) { struct codelength *codelength=warnmalloc(ndict*sizeof *codelength); int i,j; diff --git a/src/compression/huffmem.c b/src/compression/huffmem.c index 183eff1..3898115 100644 --- a/src/compression/huffmem.c +++ b/src/compression/huffmem.c @@ -19,7 +19,7 @@ #include "../../include/compression/rle.h" #include "../../include/compression/vals16.h" -int Ptngc_comp_huff_buflen(int nvals) +int Ptngc_comp_huff_buflen(const int nvals) { return 132000+nvals*8; } @@ -29,7 +29,7 @@ void Ptngc_comp_huff_compress_verbose(unsigned int *vals, int nvals, unsigned char *huffman, int *huffman_len, int *huffdatalen, int *huffman_lengths,int *chosen_algo, - int isvals16) + const int isvals16) { unsigned int *dict=warnmalloc(0x20005*sizeof *dict); unsigned int *hist=warnmalloc(0x20005*sizeof *hist); @@ -227,7 +227,7 @@ void Ptngc_comp_huff_compress_verbose(unsigned int *vals, int nvals, free(dict); } -void Ptngc_comp_huff_compress(unsigned int *vals, int nvals, +void Ptngc_comp_huff_compress(unsigned int *vals, const int nvals, unsigned char *huffman, int *huffman_len) { int huffman_lengths[N_HUFFMAN_ALGO]; @@ -237,7 +237,7 @@ void Ptngc_comp_huff_compress(unsigned int *vals, int nvals, huffman_lengths,&algo,0); } -void Ptngc_comp_huff_decompress(unsigned char *huffman, int huffman_len, +void Ptngc_comp_huff_decompress(unsigned char *huffman, const int huffman_len, unsigned int *vals) { int isvals16=(int)huffman[0]; @@ -346,7 +346,7 @@ static char *huff_algo_names[N_HUFFMAN_ALGO]= "Huffman (dict=RLE+Huffman)" }; -char *Ptngc_comp_get_huff_algo_name(int algo) +char *Ptngc_comp_get_huff_algo_name(const int algo) { if (algo<0) return NULL; diff --git a/src/compression/lz77.c b/src/compression/lz77.c index 17b147c..d8bfecb 100644 --- a/src/compression/lz77.c +++ b/src/compression/lz77.c @@ -147,7 +147,7 @@ static void sort_strings(unsigned int *vals, int nvals, #define MAX_OFFSET 0xFFFF #define MAX_STRING_SEARCH 8 -static void add_circular(int *previous,int v, int i) +static void add_circular(int *previous, const int v, const int i) { if (previous[(NUM_PREVIOUS+3)*v+2]!=i-1) { @@ -162,7 +162,7 @@ static void add_circular(int *previous,int v, int i) previous[(NUM_PREVIOUS+3)*v+2]=i; } -void Ptngc_comp_to_lz77(unsigned int *vals, int nvals, +void Ptngc_comp_to_lz77(unsigned int *vals, const int nvals, unsigned int *data, int *ndata, unsigned int *len, int *nlens, unsigned int *offsets, int *noffsets) @@ -306,10 +306,10 @@ void Ptngc_comp_to_lz77(unsigned int *vals, int nvals, free(previous); } -void Ptngc_comp_from_lz77(unsigned int *data, int ndata, - unsigned int *len, int nlens, - unsigned int *offsets, int noffsets, - unsigned int *vals, int nvals) +void Ptngc_comp_from_lz77(unsigned int *data, const int ndata, + unsigned int *len, const int nlens, + unsigned int *offsets, const int noffsets, + unsigned int *vals, const int nvals) { int i=0; int joff=0; diff --git a/src/compression/merge_sort.c b/src/compression/merge_sort.c index 7cb9837..63622cc 100644 --- a/src/compression/merge_sort.c +++ b/src/compression/merge_sort.c @@ -15,8 +15,8 @@ #include "../../include/compression/warnmalloc.h" #include "../../include/compression/merge_sort.h" -static void ms_inner(void *base, size_t size, - size_t start, size_t end, +static void ms_inner(void *base, const size_t size, + const size_t start, const size_t end, int (*compar)(const void *v1,const void *v2,const void *private), const void *private, char *workarray) @@ -80,7 +80,7 @@ static void ms_inner(void *base, size_t size, } -void Ptngc_merge_sort(void *base, size_t nmemb, size_t size, +void Ptngc_merge_sort(void *base, const size_t nmemb, const size_t size, int (*compar)(const void *v1,const void *v2,const void *private), void *private) { diff --git a/src/compression/mtf.c b/src/compression/mtf.c index bfb0e19..5219413 100644 --- a/src/compression/mtf.c +++ b/src/compression/mtf.c @@ -17,7 +17,7 @@ /* "Partial" MTF. Byte based. */ /* Move to front coding. Acceptable inputs are max 8 bits (0-0xFF) */ -static void comp_conv_to_mtf_byte(unsigned char *vals, int nvals, +static void comp_conv_to_mtf_byte(unsigned char *vals, const int nvals, unsigned char *valsmtf) { int i; @@ -59,7 +59,7 @@ static void comp_conv_to_mtf_byte(unsigned char *vals, int nvals, } } -void Ptngc_comp_conv_to_mtf_partial(unsigned int *vals, int nvals, +void Ptngc_comp_conv_to_mtf_partial(unsigned int *vals, const int nvals, unsigned int *valsmtf) { unsigned char *tmp=warnmalloc(nvals*2); @@ -78,7 +78,7 @@ void Ptngc_comp_conv_to_mtf_partial(unsigned int *vals, int nvals, free(tmp); } -void Ptngc_comp_conv_to_mtf_partial3(unsigned int *vals, int nvals, +void Ptngc_comp_conv_to_mtf_partial3(unsigned int *vals, const int nvals, unsigned char *valsmtf) { unsigned char *tmp=warnmalloc(nvals); @@ -93,7 +93,7 @@ void Ptngc_comp_conv_to_mtf_partial3(unsigned int *vals, int nvals, } /* Move to front decoding */ -static void comp_conv_from_mtf_byte(unsigned char *valsmtf, int nvals, +static void comp_conv_from_mtf_byte(unsigned char *valsmtf, const int nvals, unsigned char *vals) { int i; @@ -135,7 +135,7 @@ static void comp_conv_from_mtf_byte(unsigned char *valsmtf, int nvals, } } -void Ptngc_comp_conv_from_mtf_partial(unsigned int *valsmtf, int nvals, +void Ptngc_comp_conv_from_mtf_partial(unsigned int *valsmtf, const int nvals, unsigned int *vals) { unsigned char *tmp=warnmalloc(nvals*2); @@ -154,7 +154,7 @@ void Ptngc_comp_conv_from_mtf_partial(unsigned int *valsmtf, int nvals, free(tmp); } -void Ptngc_comp_conv_from_mtf_partial3(unsigned char *valsmtf, int nvals, +void Ptngc_comp_conv_from_mtf_partial3(unsigned char *valsmtf, const int nvals, unsigned int *vals) { unsigned char *tmp=warnmalloc(nvals); @@ -173,8 +173,8 @@ void Ptngc_comp_conv_from_mtf_partial3(unsigned char *valsmtf, int nvals, /* Move to front coding. Acceptable inputs are max 24 bits (0-0xFFFFFF) */ -void Ptngc_comp_conv_to_mtf(unsigned int *vals, int nvals, - unsigned int *dict, int ndict, +void Ptngc_comp_conv_to_mtf(unsigned int *vals, const int nvals, + unsigned int *dict, const int ndict, unsigned int *valsmtf) { int i; @@ -215,8 +215,8 @@ void Ptngc_comp_conv_to_mtf(unsigned int *vals, int nvals, } /* Move to front decoding */ -void Ptngc_comp_conv_from_mtf(unsigned int *valsmtf, int nvals, - unsigned int *dict, int ndict, +void Ptngc_comp_conv_from_mtf(unsigned int *valsmtf, const int nvals, + unsigned int *dict, const int ndict, unsigned int *vals) { int i; diff --git a/src/compression/rle.c b/src/compression/rle.c index adaee65..1273dd8 100644 --- a/src/compression/rle.c +++ b/src/compression/rle.c @@ -12,8 +12,8 @@ #include "../../include/compression/rle.h" static void add_rle(unsigned int *rle, - int v,int nsim, - int *j,int min_rle) + const int v, int nsim, + int *j, const int min_rle) { if (nsim>min_rle) { @@ -36,9 +36,9 @@ static void add_rle(unsigned int *rle, /* Run length encoding. Acceptable inputs are about 16 bits (0-0xFFFF) If input is 0-N output will be be values of 0-(N+2) */ -void Ptngc_comp_conv_to_rle(unsigned int *vals, int nvals, - unsigned int *rle, int *nrle, - int min_rle) +void Ptngc_comp_conv_to_rle(unsigned int *vals, const int nvals, + unsigned int *rle, int *nrle, + const int min_rle) { int i; int j=0; @@ -69,7 +69,7 @@ void Ptngc_comp_conv_to_rle(unsigned int *vals, int nvals, } void Ptngc_comp_conv_from_rle(unsigned int *rle, - unsigned int *vals, int nvals) + unsigned int *vals, const int nvals) { int i=0; int j=0; diff --git a/src/compression/tng_compress.c b/src/compression/tng_compress.c index b39d722..d6497d5 100644 --- a/src/compression/tng_compress.c +++ b/src/compression/tng_compress.c @@ -28,7 +28,7 @@ #define MAX_FVAL 2147483647. -static int verify_input_data(double *x, int natoms, int nframes, double precision) +static int verify_input_data(double *x, const int natoms, const int nframes, const double precision) { int iframe, i, j; for (iframe=0; iframe<nframes; iframe++) @@ -48,7 +48,7 @@ static int verify_input_data(double *x, int natoms, int nframes, double precisio return 1; } -static int verify_input_data_float(float *x, int natoms, int nframes, float precision) +static int verify_input_data_float(float *x, const int natoms, const int nframes, const float precision) { int iframe, i, j; for (iframe=0; iframe<nframes; iframe++) @@ -68,9 +68,9 @@ static int verify_input_data_float(float *x, int natoms, int nframes, float prec return 1; } -static int quantize(double *x, int natoms, int nframes, - double precision, - int *quant) +static int quantize(double *x, const int natoms, const int nframes, + const double precision, + int *quant) { int iframe, i, j; for (iframe=0; iframe<nframes; iframe++) @@ -80,9 +80,9 @@ static int quantize(double *x, int natoms, int nframes, return verify_input_data(x,natoms,nframes,precision); } -static int quantize_float(float *x, int natoms, int nframes, - float precision, - int *quant) +static int quantize_float(float *x, int natoms, const int nframes, + const float precision, + int *quant) { int iframe, i, j; for (iframe=0; iframe<nframes; iframe++) @@ -92,7 +92,7 @@ static int quantize_float(float *x, int natoms, int nframes, return verify_input_data_float(x,natoms,nframes,precision); } -static void quant_inter_differences(int *quant, int natoms, int nframes, +static void quant_inter_differences(int *quant, const int natoms, const int nframes, int *quant_inter) { int iframe, i, j; @@ -107,7 +107,7 @@ static void quant_inter_differences(int *quant, int natoms, int nframes, quant_inter[iframe*natoms*3+i*3+j]=quant[iframe*natoms*3+i*3+j]-quant[(iframe-1)*natoms*3+i*3+j]; } -static void quant_intra_differences(int *quant, int natoms, int nframes, +static void quant_intra_differences(int *quant, const int natoms, const int nframes, int *quant_intra) { int iframe, i, j; @@ -123,8 +123,8 @@ static void quant_intra_differences(int *quant, int natoms, int nframes, } } -static void unquantize(double *x, int natoms, int nframes, - double precision, +static void unquantize(double *x, int natoms, const int nframes, + const double precision, int *quant) { int iframe, i, j; @@ -134,8 +134,8 @@ static void unquantize(double *x, int natoms, int nframes, x[iframe*natoms*3+i*3+j]=(double)quant[iframe*natoms*3+i*3+j]*precision; } -static void unquantize_float(float *x, int natoms, int nframes, - float precision, +static void unquantize_float(float *x, const int natoms, const int nframes, + const float precision, int *quant) { int iframe, i, j; @@ -145,8 +145,8 @@ static void unquantize_float(float *x, int natoms, int nframes, x[iframe*natoms*3+i*3+j]=(float)quant[iframe*natoms*3+i*3+j]*precision; } -static void unquantize_inter_differences(double *x, int natoms, int nframes, - double precision, +static void unquantize_inter_differences(double *x, int natoms, const int nframes, + const double precision, int *quant) { int iframe, i, j; @@ -163,8 +163,8 @@ static void unquantize_inter_differences(double *x, int natoms, int nframes, } } -static void unquantize_inter_differences_float(float *x, int natoms, int nframes, - float precision, +static void unquantize_inter_differences_float(float *x, const int natoms, const int nframes, + const float precision, int *quant) { int iframe, i, j; @@ -181,7 +181,7 @@ static void unquantize_inter_differences_float(float *x, int natoms, int nframes } } -static void unquantize_inter_differences_int(int *x, int natoms, int nframes, +static void unquantize_inter_differences_int(int *x, const int natoms, const int nframes, int *quant) { int iframe, i, j; @@ -200,7 +200,7 @@ static void unquantize_inter_differences_int(int *x, int natoms, int nframes, /* In frame update required for the initial frame if intra-frame compression was used. */ -static void unquant_intra_differences_first_frame(int *quant, int natoms) +static void unquant_intra_differences_first_frame(int *quant, const int natoms) { int i,j; for (j=0; j<3; j++) @@ -221,8 +221,8 @@ static void unquant_intra_differences_first_frame(int *quant, int natoms) #endif } -static void unquantize_intra_differences(double *x, int natoms, int nframes, - double precision, +static void unquantize_intra_differences(double *x, const int natoms, const int nframes, + const double precision, int *quant) { int iframe, i, j; @@ -242,8 +242,8 @@ static void unquantize_intra_differences(double *x, int natoms, int nframes, } } -static void unquantize_intra_differences_float(float *x, int natoms, int nframes, - float precision, +static void unquantize_intra_differences_float(float *x, const int natoms, const int nframes, + const float precision, int *quant) { int iframe, i, j; @@ -260,7 +260,7 @@ static void unquantize_intra_differences_float(float *x, int natoms, int nframes } } -static void unquantize_intra_differences_int(int *x, int natoms, int nframes, +static void unquantize_intra_differences_int(int *x, const int natoms, const int nframes, int *quant) { int iframe, i, j; @@ -308,11 +308,11 @@ static fix_t readbufferfix(unsigned char *buf, int num) /* Perform position compression from the quantized data. */ static void compress_quantized_pos(int *quant, int *quant_inter, int *quant_intra, - int natoms, int nframes, - int speed, - int initial_coding, int initial_coding_parameter, - int coding, int coding_parameter, - fix_t prec_hi, fix_t prec_lo, + const int natoms, const int nframes, + const int speed, + const int initial_coding, const int initial_coding_parameter, + const int coding, const int coding_parameter, + const fix_t prec_hi, const fix_t prec_lo, int *nitems, char *data) { @@ -436,11 +436,11 @@ static void compress_quantized_pos(int *quant, int *quant_inter, int *quant_intr /* Perform velocity compression from vel into the data block */ static void compress_quantized_vel(int *quant, int *quant_inter, - int natoms, int nframes, - int speed, - int initial_coding, int initial_coding_parameter, - int coding, int coding_parameter, - fix_t prec_hi, fix_t prec_lo, + const int natoms, const int nframes, + const int speed, + const int initial_coding, const int initial_coding_parameter, + const int coding, const int coding_parameter, + const fix_t prec_hi, const fix_t prec_lo, int *nitems, char *data) { @@ -544,7 +544,7 @@ static void compress_quantized_vel(int *quant, int *quant_inter, } static int determine_best_coding_stop_bits(struct coder *coder,int *input, int *length, - int *coding_parameter, int natoms) + int *coding_parameter, const int natoms) { int bits; unsigned char *packed; @@ -575,7 +575,7 @@ static int determine_best_coding_stop_bits(struct coder *coder,int *input, int * } static int determine_best_coding_triple(struct coder *coder,int *input, int *length, - int *coding_parameter, int natoms) + int *coding_parameter, const int natoms) { int bits; unsigned char *packed; @@ -605,8 +605,8 @@ static int determine_best_coding_triple(struct coder *coder,int *input, int *len return 0; } -static void determine_best_pos_initial_coding(int *quant, int *quant_intra, int natoms, int speed, - fix_t prec_hi, fix_t prec_lo, +static void determine_best_pos_initial_coding(int *quant, int *quant_intra, const int natoms, const int speed, + const fix_t prec_hi, const fix_t prec_lo, int *initial_coding, int *initial_coding_parameter) { if (*initial_coding==-1) @@ -718,8 +718,8 @@ static void determine_best_pos_initial_coding(int *quant, int *quant_intra, int } } -static void determine_best_pos_coding(int *quant, int *quant_inter, int *quant_intra, int natoms, int nframes, int speed, - fix_t prec_hi, fix_t prec_lo, +static void determine_best_pos_coding(int *quant, int *quant_inter, int *quant_intra, const int natoms, const int nframes, const int speed, + const fix_t prec_hi, const fix_t prec_lo, int *coding, int *coding_parameter) { if (*coding==-1) @@ -896,8 +896,8 @@ static void determine_best_pos_coding(int *quant, int *quant_inter, int *quant_i } } -static void determine_best_vel_initial_coding(int *quant, int natoms, int speed, - fix_t prec_hi, fix_t prec_lo, +static void determine_best_vel_initial_coding(int *quant, const int natoms, const int speed, + const fix_t prec_hi, const fix_t prec_lo, int *initial_coding, int *initial_coding_parameter) { if (*initial_coding==-1) @@ -979,8 +979,8 @@ static void determine_best_vel_initial_coding(int *quant, int natoms, int speed, } } -static void determine_best_vel_coding(int *quant, int *quant_inter, int natoms, int nframes, int speed, - fix_t prec_hi, fix_t prec_lo, +static void determine_best_vel_coding(int *quant, int *quant_inter, const int natoms, const int nframes, const int speed, + const fix_t prec_hi, const fix_t prec_lo, int *coding, int *coding_parameter) { if (*coding==-1) @@ -1137,8 +1137,8 @@ static void determine_best_vel_coding(int *quant, int *quant_inter, int natoms, } } -char DECLSPECDLLEXPORT *tng_compress_pos_int(int *pos, int natoms, int nframes, - unsigned long prec_hi, unsigned long prec_lo, +char DECLSPECDLLEXPORT *tng_compress_pos_int(int *pos, const int natoms, const int nframes, + const unsigned long prec_hi, const unsigned long prec_lo, int speed,int *algo, int *nitems) { @@ -1217,9 +1217,9 @@ char DECLSPECDLLEXPORT *tng_compress_pos_int(int *pos, int natoms, int nframes, return data; } -char DECLSPECDLLEXPORT *tng_compress_pos(double *pos, int natoms, int nframes, - double desired_precision, - int speed,int *algo, +char DECLSPECDLLEXPORT *tng_compress_pos(double *pos, const int natoms, const int nframes, + const double desired_precision, + const int speed,int *algo, int *nitems) { int *quant=malloc(natoms*nframes*3*sizeof *quant); @@ -1235,9 +1235,9 @@ char DECLSPECDLLEXPORT *tng_compress_pos(double *pos, int natoms, int nframes, return data; } -char DECLSPECDLLEXPORT *tng_compress_pos_float(float *pos, int natoms, int nframes, - float desired_precision, - int speed,int *algo, +char DECLSPECDLLEXPORT *tng_compress_pos_float(float *pos, const int natoms, const int nframes, + const float desired_precision, + const int speed, int *algo, int *nitems) { int *quant=malloc(natoms*nframes*3*sizeof *quant); @@ -1253,9 +1253,9 @@ char DECLSPECDLLEXPORT *tng_compress_pos_float(float *pos, int natoms, int nfram return data; } -char DECLSPECDLLEXPORT *tng_compress_pos_find_algo(double *pos, int natoms, int nframes, - double desired_precision, - int speed, +char DECLSPECDLLEXPORT *tng_compress_pos_find_algo(double *pos, const int natoms, const int nframes, + const double desired_precision, + const int speed, int *algo, int *nitems) { @@ -1266,9 +1266,9 @@ char DECLSPECDLLEXPORT *tng_compress_pos_find_algo(double *pos, int natoms, int return tng_compress_pos(pos,natoms,nframes,desired_precision,speed,algo,nitems); } -char DECLSPECDLLEXPORT *tng_compress_pos_float_find_algo(float *pos, int natoms, int nframes, - float desired_precision, - int speed, +char DECLSPECDLLEXPORT *tng_compress_pos_float_find_algo(float *pos, const int natoms, const int nframes, + const float desired_precision, + const int speed, int *algo, int *nitems) { @@ -1279,9 +1279,9 @@ char DECLSPECDLLEXPORT *tng_compress_pos_float_find_algo(float *pos, int natoms, return tng_compress_pos_float(pos,natoms,nframes,desired_precision,speed,algo,nitems); } -char DECLSPECDLLEXPORT *tng_compress_pos_int_find_algo(int *pos, int natoms, int nframes, - unsigned long prec_hi, unsigned long prec_lo, - int speed,int *algo, +char DECLSPECDLLEXPORT *tng_compress_pos_int_find_algo(int *pos, const int natoms, const int nframes, + const unsigned long prec_hi, const unsigned long prec_lo, + const int speed, int *algo, int *nitems) { algo[0]=-1; @@ -1303,8 +1303,8 @@ int DECLSPECDLLEXPORT tng_compress_nalgo(void) 4) One parameter to the algorithm for the remaining frames (the coding parameter). */ } -char DECLSPECDLLEXPORT *tng_compress_vel_int(int *vel, int natoms, int nframes, - unsigned long prec_hi, unsigned long prec_lo, +char DECLSPECDLLEXPORT *tng_compress_vel_int(int *vel, const int natoms, const int nframes, + const unsigned long prec_hi, const unsigned long prec_lo, int speed, int *algo, int *nitems) { @@ -1380,9 +1380,9 @@ char DECLSPECDLLEXPORT *tng_compress_vel_int(int *vel, int natoms, int nframes, return data; } -char DECLSPECDLLEXPORT *tng_compress_vel(double *vel, int natoms, int nframes, - double desired_precision, - int speed, int *algo, +char DECLSPECDLLEXPORT *tng_compress_vel(double *vel, const int natoms, const int nframes, + const double desired_precision, + const int speed, int *algo, int *nitems) { int *quant=malloc(natoms*nframes*3*sizeof *quant); @@ -1397,9 +1397,9 @@ char DECLSPECDLLEXPORT *tng_compress_vel(double *vel, int natoms, int nframes, return data; } -char DECLSPECDLLEXPORT *tng_compress_vel_float(float *vel, int natoms, int nframes, - float desired_precision, - int speed, int *algo, +char DECLSPECDLLEXPORT *tng_compress_vel_float(float *vel, const int natoms, const int nframes, + const float desired_precision, + const int speed, int *algo, int *nitems) { int *quant=malloc(natoms*nframes*3*sizeof *quant); @@ -1414,9 +1414,9 @@ char DECLSPECDLLEXPORT *tng_compress_vel_float(float *vel, int natoms, int nfram return data; } -char DECLSPECDLLEXPORT *tng_compress_vel_find_algo(double *vel, int natoms, int nframes, - double desired_precision, - int speed, +char DECLSPECDLLEXPORT *tng_compress_vel_find_algo(double *vel, const int natoms, const int nframes, + const double desired_precision, + const int speed, int *algo, int *nitems) { @@ -1427,9 +1427,9 @@ char DECLSPECDLLEXPORT *tng_compress_vel_find_algo(double *vel, int natoms, int return tng_compress_vel(vel,natoms,nframes,desired_precision,speed,algo,nitems); } -char DECLSPECDLLEXPORT *tng_compress_vel_float_find_algo(float *vel, int natoms, int nframes, - float desired_precision, - int speed, +char DECLSPECDLLEXPORT *tng_compress_vel_float_find_algo(float *vel, const int natoms, const int nframes, + const float desired_precision, + const int speed, int *algo, int *nitems) { @@ -1440,9 +1440,9 @@ char DECLSPECDLLEXPORT *tng_compress_vel_float_find_algo(float *vel, int natoms, return tng_compress_vel_float(vel,natoms,nframes,desired_precision,speed,algo,nitems); } -char DECLSPECDLLEXPORT *tng_compress_vel_int_find_algo(int *vel, int natoms, int nframes, - unsigned long prec_hi, unsigned long prec_lo, - int speed, +char DECLSPECDLLEXPORT *tng_compress_vel_int_find_algo(int *vel, const int natoms, const int nframes, + const unsigned long prec_hi, const unsigned long prec_lo, + const int speed, int *algo, int *nitems) { @@ -1811,15 +1811,15 @@ int DECLSPECDLLEXPORT tng_compress_uncompress_int(char *data,int *posvel, unsign return 1; } -void DECLSPECDLLEXPORT tng_compress_int_to_double(int *posvel_int,unsigned long prec_hi, unsigned long prec_lo, - int natoms,int nframes, +void DECLSPECDLLEXPORT tng_compress_int_to_double(int *posvel_int, const unsigned long prec_hi, const unsigned long prec_lo, + const int natoms, const int nframes, double *posvel_double) { unquantize(posvel_double,natoms,nframes,PRECISION(prec_hi,prec_lo),posvel_int); } -void DECLSPECDLLEXPORT tng_compress_int_to_float(int *posvel_int,unsigned long prec_hi, unsigned long prec_lo, - int natoms,int nframes, +void DECLSPECDLLEXPORT tng_compress_int_to_float(int *posvel_int, const unsigned long prec_hi, const unsigned long prec_lo, + const int natoms, const int nframes, float *posvel_float) { unquantize_float(posvel_float,natoms,nframes,(float)PRECISION(prec_hi,prec_lo),posvel_int); diff --git a/src/compression/vals16.c b/src/compression/vals16.c index c4ed635..48186f6 100644 --- a/src/compression/vals16.c +++ b/src/compression/vals16.c @@ -13,8 +13,8 @@ /* Coding 32 bit ints in sequences of 16 bit ints. Worst case the output is 3*nvals long. */ -void Ptngc_comp_conv_to_vals16(unsigned int *vals,int nvals, - unsigned int *vals16, int *nvals16) +void Ptngc_comp_conv_to_vals16(unsigned int *vals, const int nvals, + unsigned int *vals16, int *nvals16) { int i; int j=0; @@ -45,8 +45,8 @@ void Ptngc_comp_conv_to_vals16(unsigned int *vals,int nvals, *nvals16=j; } -void Ptngc_comp_conv_from_vals16(unsigned int *vals16,int nvals16, - unsigned int *vals, int *nvals) +void Ptngc_comp_conv_from_vals16(unsigned int *vals16, const int nvals16, + unsigned int *vals, int *nvals) { int i=0; int j=0; diff --git a/src/compression/warnmalloc.c b/src/compression/warnmalloc.c index 36f0d9f..55bdaf7 100644 --- a/src/compression/warnmalloc.c +++ b/src/compression/warnmalloc.c @@ -14,7 +14,7 @@ #include "../../include/compression/tng_compress.h" #include "../../include/compression/warnmalloc.h" -void DECLSPECDLLEXPORT *Ptngc_warnmalloc_x(size_t size, char *file, int line) +void DECLSPECDLLEXPORT *Ptngc_warnmalloc_x(const size_t size, char *file, const int line) { void *mem=malloc(size); if (!mem) @@ -25,7 +25,7 @@ void DECLSPECDLLEXPORT *Ptngc_warnmalloc_x(size_t size, char *file, int line) return mem; } -void DECLSPECDLLEXPORT *Ptngc_warnrealloc_x(void *old, size_t size, char *file, int line) +void DECLSPECDLLEXPORT *Ptngc_warnrealloc_x(void *old, const size_t size, char *file, const int line) { void *mem=realloc(old,size); if (!mem) diff --git a/src/compression/widemuldiv.c b/src/compression/widemuldiv.c index 46cb039..c469238 100644 --- a/src/compression/widemuldiv.c +++ b/src/compression/widemuldiv.c @@ -106,7 +106,7 @@ static TNG_INLINE void Ptngc_widemul(unsigned int i1, unsigned int i2, unsigned /* Divide a 64 bit unsigned value in hi:lo with the 32 bit value i and return the result in result and the remainder in remainder */ -static TNG_INLINE void Ptngc_widediv(unsigned int hi, unsigned int lo, unsigned int i, unsigned int *result, unsigned int *remainder) +static TNG_INLINE void Ptngc_widediv(unsigned int hi, unsigned int lo, const unsigned int i, unsigned int *result, unsigned int *remainder) { #if defined(TRAJNG_X86_GCC_INLINE_MULDIV) __asm__ __volatile__ ("divl %%ecx\n\t" diff --git a/src/compression/xtc2.c b/src/compression/xtc2.c index 888ff8d..7332f5f 100644 --- a/src/compression/xtc2.c +++ b/src/compression/xtc2.c @@ -171,7 +171,7 @@ static const double iflipgaincheck=0.89089871814033927; /* 1./(2**(1./6)) */ #define TNG_INLINE inline #endif -int Ptngc_magic(unsigned int i) +int Ptngc_magic(const unsigned int i) { return magic[i]; } @@ -262,7 +262,7 @@ static const int seq_instr[MAXINSTR][2]= more efficiently coded with two large instructions. */ }; -static void write_instruction(struct coder *coder,int instr,unsigned char **output_ptr) +static void write_instruction(struct coder *coder, const int instr, unsigned char **output_ptr) { Ptngc_writebits(coder,seq_instr[instr][0],seq_instr[instr][1],output_ptr); #ifdef SHOWIT @@ -388,7 +388,7 @@ static void swap_is_better(int *input, int *minint, int *sum_normal, int *sum_sw *sum_swapped=swapped_max; } -static void swapdecide(struct coder *coder, int *input,int *swapatoms, int *large_index, int *minint, unsigned char **output_ptr) +static void swapdecide(struct coder *coder, int *input, int *swapatoms, int *large_index, int *minint, unsigned char **output_ptr) { int didswap=0; int normal,swapped; @@ -1299,7 +1299,7 @@ unsigned char *Ptngc_pack_array_xtc2(struct coder *coder,int *input, int *length } -int Ptngc_unpack_array_xtc2(struct coder *coder,unsigned char *packed,int *output, int length) +int Ptngc_unpack_array_xtc2(struct coder *coder, unsigned char *packed, int *output, const int length) { unsigned char *ptr=packed; int bitptr=0; diff --git a/src/compression/xtc3.c b/src/compression/xtc3.c index 7b493ab..5cdebdf 100644 --- a/src/compression/xtc3.c +++ b/src/compression/xtc3.c @@ -70,7 +70,7 @@ static const double iflipgaincheck=0.89089871814033927; /* 1./(2**(1./6)) */ int Ptngc_magic(unsigned int i); int Ptngc_find_magic_index(const unsigned int maxval); -static TNG_INLINE unsigned int positive_int(int item) +static TNG_INLINE unsigned int positive_int(const int item) { int s=0; if (item>0) @@ -80,7 +80,7 @@ static TNG_INLINE unsigned int positive_int(int item) return s; } -static TNG_INLINE int unpositive_int(int val) +static TNG_INLINE int unpositive_int(const int val) { int s=(val+1)/2; if ((val%2)==0) @@ -159,14 +159,14 @@ static void free_xtc3_context(struct xtc3_context *xtc3_context) } /* Modifies three integer values for better compression of water */ -static void swap_ints(int *in, int *out) +static void swap_ints(const int *in, int *out) { out[0]=in[0]+in[1]; out[1]=-in[1]; out[2]=in[1]+in[2]; } -static void swap_is_better(int *input, int *minint, int *sum_normal, int *sum_swapped) +static void swap_is_better(const int *input, const int *minint, int *sum_normal, int *sum_swapped) { int normal_max=0; int swapped_max=0; @@ -206,7 +206,7 @@ static void allocate_enough_memory(unsigned int **ptr, int *nele, int *nele_allo } static void insert_value_in_array(unsigned int **ptr, int *nele, int *nele_alloc, - unsigned int value, + const unsigned int value, char *arrayname) { #ifndef SHOWIT @@ -272,7 +272,7 @@ static void swapdecide(struct xtc3_context *xtc3_context, int *input,int *swapat /* It is "large" if we have to increase the small index quite a bit. Not so much to be rejected by the not very large check later. */ -static int is_quite_large(int *input, int small_index, int max_large_index) +static int is_quite_large(const int *input, const int small_index, const int max_large_index) { int is=0; int i; @@ -295,7 +295,7 @@ int nbits_sum; int nvalues_sum; #endif -static void insert_batch(int *input_ptr, int ntriplets_left, int *prevcoord, int *encode_ints, int startenc, int *nenc) +static void insert_batch(const int *input_ptr, const int ntriplets_left, const int *prevcoord, int *encode_ints, const int startenc, int *nenc) { int nencode=startenc*3; int tmp_prevcoord[3]; @@ -353,7 +353,7 @@ static void insert_batch(int *input_ptr, int ntriplets_left, int *prevcoord, int *nenc=nencode; } -static void large_instruction_change(struct xtc3_context *xtc3_context, int i) +static void large_instruction_change(struct xtc3_context *xtc3_context, const int i) { /* If the first large is of a different kind than the currently used we must emit an "instruction" to change the large type. */ @@ -375,7 +375,7 @@ static void large_instruction_change(struct xtc3_context *xtc3_context, int i) } static void write_three_large(struct xtc3_context *xtc3_context, - int i) + const int i) { int m; if (xtc3_context->current_large_type==0) @@ -405,7 +405,7 @@ static void write_three_large(struct xtc3_context *xtc3_context, } static void flush_large(struct xtc3_context *xtc3_context, - int n) /* How many to flush. */ + const int n) /* How many to flush. */ { int i; i=0; @@ -470,8 +470,8 @@ static double compute_intlen(unsigned int *ints) return (double)m; } -static void buffer_large(struct xtc3_context *xtc3_context, int *input, int inpdata, - int natoms, int intradelta_ok) +static void buffer_large(struct xtc3_context *xtc3_context, int *input, const int inpdata, + const int natoms, const int intradelta_ok) { unsigned int direct[3], intradelta[3]={0,}, interdelta[3]={0,}; double minlen; @@ -542,7 +542,7 @@ static void buffer_large(struct xtc3_context *xtc3_context, int *input, int inpd xtc3_context->has_large++; } -static void output_int(unsigned char *output,int *outdata, unsigned int n) +static void output_int(unsigned char *output,int *outdata, const unsigned int n) { output[(*outdata)++]=((unsigned int)n)&0xFFU; output[(*outdata)++]=(((unsigned int)n)>>8)&0xFFU; @@ -574,7 +574,7 @@ static void printarray(unsigned int *a, int n, char *name) #define BASEINTERVAL 8 /* How many bytes are needed to store n values in base base */ -static int base_bytes(unsigned int base, int n) +static int base_bytes(const unsigned int base, const int n) { int i,j; unsigned int largeint[MAXMAXBASEVALS+1]; @@ -600,7 +600,7 @@ static int base_bytes(unsigned int base, int n) return numbytes; } -static void base_compress(unsigned int *data, int len, unsigned char *output, int *outlen) +static void base_compress(unsigned int *data, const int len, unsigned char *output, int *outlen) { unsigned int largeint[MAXBASEVALS+1]; unsigned int largeint_tmp[MAXBASEVALS+1]; @@ -707,7 +707,7 @@ static void base_compress(unsigned int *data, int len, unsigned char *output, in *outlen=nwrittenout; } -static void base_decompress(unsigned char *input, int len, unsigned int *output) +static void base_decompress(unsigned char *input, const int len, unsigned int *output) { unsigned int largeint[MAXMAXBASEVALS+1]; unsigned int largeint_tmp[MAXMAXBASEVALS+1]; @@ -795,7 +795,7 @@ static void base_decompress(unsigned char *input, int len, unsigned int *output) } /* If a large proportion of the integers are large (More than 10\% are >14 bits) we return 0, otherwise 1 */ -static int heuristic_bwlzh(unsigned int *ints, int nints) +static int heuristic_bwlzh(unsigned int *ints, const int nints) { int i,num; num=0; @@ -814,7 +814,7 @@ static int heuristic_bwlzh(unsigned int *ints, int nints) Speed 5 enables the LZ77 component of BWLZH. Speed 6 always tests if BWLZH is better and if it is uses it. This can be very slow. */ -unsigned char *Ptngc_pack_array_xtc3(int *input, int *length, int natoms, int speed) +unsigned char *Ptngc_pack_array_xtc3(int *input, int *length, const int natoms, int speed) { unsigned char *output=NULL; int i,ienc,j; @@ -1669,7 +1669,7 @@ unsigned char *Ptngc_pack_array_xtc3(int *input, int *length, int natoms, int sp } static void decompress_bwlzh_block(unsigned char **ptr, - int nvals, + const int nvals, unsigned int **vals) { int bwlzh_buf_len=(int)(((unsigned int)(*ptr)[0]) | @@ -1683,7 +1683,7 @@ static void decompress_bwlzh_block(unsigned char **ptr, } static void decompress_base_block(unsigned char **ptr, - int nvals, + const int nvals, unsigned int **vals) { int base_buf_len=(int)(((unsigned int)(*ptr)[0]) | @@ -1700,8 +1700,8 @@ static void unpack_one_large(struct xtc3_context *xtc3_context, int *ilargedir, int *ilargeintra, int *ilargeinter, int *prevcoord, int *minint, int *output, - int outdata, int didswap, - int natoms, int current_large_type) + const int outdata, const int didswap, + const int natoms, const int current_large_type) { int large_ints[3]={0,0,0}; if (current_large_type==0 && xtc3_context->large_direct) @@ -1738,7 +1738,7 @@ static void unpack_one_large(struct xtc3_context *xtc3_context, } -int Ptngc_unpack_array_xtc3(unsigned char *packed,int *output, int length, int natoms) +int Ptngc_unpack_array_xtc3(unsigned char *packed,int *output, const int length, const int natoms) { int i; int minint[3]; |