Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applied clang-tidy readability-non-const-parameter warning fixes auto… #429

Merged
merged 3 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hl/test/test_file_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
*-------------------------------------------------------------------------
*/
static int
test_file_image(size_t open_images, size_t nflags, unsigned *flags)
test_file_image(size_t open_images, size_t nflags, const unsigned *flags)
{
hid_t * file_id, *dset_id, file_space, plist; /* HDF5 ids */
hsize_t dims1[RANK] = {2, 3}; /* original dimension of datasets */
Expand Down
4 changes: 2 additions & 2 deletions hl/test/test_ld.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static herr_t test_LD_elmts_invalid(const char *file);
static herr_t test_LD_elmts_one(const char *file, const char *dname, const char *fields);
static herr_t test_LD_elmts_two(const char *file, const char *dname, const char *fields);

static herr_t verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf);
static herr_t verify_elmts_two(int type, const hsize_t *ext_dims, const hsize_t *prev_dims, void *_ldbuf, void *_buf);

/* data structures for compound data type */
typedef struct sub22_t {
Expand Down Expand Up @@ -1135,7 +1135,7 @@ test_LD_elmts_one(const char *file, const char *dname, const char *fields)
**************************************************************************************
*/
static herr_t
verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf)
verify_elmts_two(int type, const hsize_t *ext_dims, const hsize_t *prev_dims, void *_ldbuf, void *_buf)
{
int k, m; /* Local index variable */

Expand Down
6 changes: 3 additions & 3 deletions hl/tools/gif2h5/gif.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ int ReadGifApplication(GIFAPPLICATION *, GIFBYTE **);
int ReadGifComment(GIFCOMMENT *, GIFBYTE **);

/* HDFGIFWR.C */
int hdfWriteGIF(FILE *fp, GIFBYTE *pic, int ptype, int w, int h, GIFBYTE *rmap, GIFBYTE *gmap, GIFBYTE *bmap,
GIFBYTE *pc2ncmap, int numcols, int colorstyle, int BitsPerPixel);
int hdfWriteGIF(FILE *fp, GIFBYTE *pic, int ptype, int w, int h, const GIFBYTE *rmap, const GIFBYTE *gmap, const GIFBYTE *bmap,
const GIFBYTE *pc2ncmap, int numcols, int colorstyle, int BitsPerPixel);

/* WRITEHDF.C */
int WriteHDF(GIFTOMEM, GIFCHAR *);
Expand All @@ -176,7 +176,7 @@ int ReadHDF(GIFBYTE **data, GIFBYTE palette[256][3], hsize_t *image_size, GIFCHA
GIFCHAR *dset_name, GIFCHAR *pal_name);

GIFBYTE *Decompress(GIFIMAGEDESC *, GIFHEAD *);
GIFBYTE GetByte(GIFBYTE *);
GIFBYTE GetByte(const GIFBYTE *);
GIFWORD GetWord(GIFBYTE *);

void cleanup(GIFBYTE *);
Expand Down
2 changes: 1 addition & 1 deletion hl/tools/gif2h5/gifread.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ GetWord(GIFBYTE *MemGif)
}

GIFBYTE
GetByte(GIFBYTE *MemGif) { return *MemGif; }
GetByte(const GIFBYTE *MemGif) { return *MemGif; }

/*
* Read a GIF image GIFBYTE Header.
Expand Down
2 changes: 1 addition & 1 deletion hl/tools/gif2h5/hdfgifwr.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static int EOFCode;

/*************************************************************/
int
hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap, byte *gmap, byte *bmap, byte *pc2ncmap,
hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, const byte *rmap, const byte *gmap, const byte *bmap, const byte *pc2ncmap,
int numcols, int colorstyle, int BitsPerPixel)
{
int InitCodeSize;
Expand Down
4 changes: 2 additions & 2 deletions hl/tools/h5watch/h5watch.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static unsigned g_retry = DEFAULT_RETRY; /* # of times to try opening the file
static hbool_t g_display_hex = FALSE; /* display data in hexadecimal format : LATER */
static hbool_t g_user_interrupt = FALSE; /* Flag to indicate that user interrupted execution */

static herr_t doprint(hid_t did, hsize_t *start, hsize_t *block, int rank);
static herr_t doprint(hid_t did, const hsize_t *start, const hsize_t *block, int rank);
static herr_t slicendump(hid_t did, hsize_t *prev_dims, hsize_t *cur_dims, hsize_t *start, hsize_t *block,
int rank, int subrank);
static herr_t monitor_dataset(hid_t fid, char *dsetname);
Expand Down Expand Up @@ -95,7 +95,7 @@ static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no
*-------------------------------------------------------------------------
*/
static herr_t
doprint(hid_t did, hsize_t *start, hsize_t *block, int rank)
doprint(hid_t did, const hsize_t *start, const hsize_t *block, int rank)
{
h5tools_context_t ctx; /* print context */
h5tool_format_t info; /* Format info for the tools library */
Expand Down
2 changes: 1 addition & 1 deletion src/H5Dchunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -4258,7 +4258,7 @@ H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes)
*-------------------------------------------------------------------------
*/
herr_t
H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[])
H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const hsize_t old_dim[])
{
const H5D_t * dset = io_info->dset; /* the dataset pointer */
H5D_chk_idx_info_t idx_info; /* Chunked index info */
Expand Down
2 changes: 1 addition & 1 deletion src/H5Dpkg.h
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage);
H5_DLL hbool_t H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset);
H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata);
H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes);
H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]);
H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const hsize_t old_dim[]);
H5_DLL herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk,
H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled);
H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]);
Expand Down
2 changes: 1 addition & 1 deletion src/H5Tbit.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value)
*-------------------------------------------------------------------------
*/
ssize_t
H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value)
H5T__bit_find(const uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value)
{
ssize_t base = (ssize_t)offset;
ssize_t idx, i;
Expand Down
2 changes: 1 addition & 1 deletion src/H5Tpkg.h
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ H5_DLL herr_t H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset,
H5_DLL void H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value);
H5_DLL uint64_t H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size);
H5_DLL void H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val);
H5_DLL ssize_t H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value);
H5_DLL ssize_t H5T__bit_find(const uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value);
H5_DLL hbool_t H5T__bit_inc(uint8_t *buf, size_t start, size_t size);
H5_DLL hbool_t H5T__bit_dec(uint8_t *buf, size_t start, size_t size);
H5_DLL void H5T__bit_neg(uint8_t *buf, size_t start, size_t size);
Expand Down
16 changes: 8 additions & 8 deletions src/H5Znbit.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ static herr_t H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_ind

static void H5Z__nbit_next_byte(size_t *j, size_t *buf_len);
static void H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k,
unsigned begin_i, unsigned end_i, unsigned char *buffer, size_t *j,
unsigned begin_i, unsigned end_i, const unsigned char *buffer, size_t *j,
size_t *buf_len, const parms_atomic *p, size_t datatype_len);
static void H5Z__nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i,
static void H5Z__nbit_compress_one_byte(const unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i,
unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len,
const parms_atomic *p, size_t datatype_len);
static void H5Z__nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer,
static void H5Z__nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, const unsigned char *buffer,
size_t *j, size_t *buf_len, unsigned size);
static void H5Z__nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned char *buffer,
size_t *j, size_t *buf_len, const parms_atomic *p);
Expand All @@ -71,7 +71,7 @@ static herr_t H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data
const unsigned parms[], unsigned *parms_index);
static herr_t H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer,
const unsigned parms[]);
static void H5Z__nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer,
static void H5Z__nbit_compress_one_nooptype(const unsigned char *data, size_t data_offset, unsigned char *buffer,
size_t *j, size_t *buf_len, unsigned size);
static void H5Z__nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned char *buffer,
size_t *j, size_t *buf_len, const unsigned parms[],
Expand Down Expand Up @@ -1026,7 +1026,7 @@ H5Z__nbit_next_byte(size_t *j, size_t *buf_len)

static void
H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i,
unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len,
unsigned end_i, const unsigned char *buffer, size_t *j, size_t *buf_len,
const parms_atomic *p, size_t datatype_len)
{
size_t dat_len; /* dat_len is the number of bits to be copied in each data byte */
Expand Down Expand Up @@ -1075,7 +1075,7 @@ H5Z__nbit_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned
}

static void
H5Z__nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j,
H5Z__nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset, const unsigned char *buffer, size_t *j,
size_t *buf_len, unsigned size)
{
unsigned i; /* index */
Expand Down Expand Up @@ -1341,7 +1341,7 @@ H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buff
}

static void
H5Z__nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i,
H5Z__nbit_compress_one_byte(const unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i,
unsigned end_i, unsigned char *buffer, size_t *j, size_t *buf_len,
const parms_atomic *p, size_t datatype_len)
{
Expand Down Expand Up @@ -1383,7 +1383,7 @@ H5Z__nbit_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k,
}

static void
H5Z__nbit_compress_one_nooptype(unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j,
H5Z__nbit_compress_one_nooptype(const unsigned char *data, size_t data_offset, unsigned char *buffer, size_t *j,
size_t *buf_len, unsigned size)
{
unsigned i; /* index */
Expand Down
8 changes: 4 additions & 4 deletions src/H5Zscaleoffset.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ static herr_t H5Z__scaleoffset_postdecompress_fd(void *data, unsigned d_nelmts,
uint32_t minbits, unsigned long long minval, double D_val);
static void H5Z__scaleoffset_next_byte(size_t *j, unsigned *buf_len);
static void H5Z__scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k,
unsigned begin_i, unsigned char *buffer, size_t *j,
unsigned begin_i, const unsigned char *buffer, size_t *j,
unsigned *buf_len, parms_atomic p, unsigned dtype_len);
static void H5Z__scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k,
static void H5Z__scaleoffset_compress_one_byte(const unsigned char *data, size_t data_offset, unsigned k,
unsigned begin_i, unsigned char *buffer, size_t *j,
unsigned *buf_len, parms_atomic p, unsigned dtype_len);
static void H5Z__scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset,
Expand Down Expand Up @@ -1608,7 +1608,7 @@ H5Z__scaleoffset_next_byte(size_t *j, unsigned *buf_len)

static void
H5Z__scaleoffset_decompress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i,
unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p,
const unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p,
unsigned dtype_len)
{
unsigned dat_len; /* dat_len is the number of bits to be copied in each data byte */
Expand Down Expand Up @@ -1694,7 +1694,7 @@ H5Z__scaleoffset_decompress(unsigned char *data, unsigned d_nelmts, unsigned cha
}

static void
H5Z__scaleoffset_compress_one_byte(unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i,
H5Z__scaleoffset_compress_one_byte(const unsigned char *data, size_t data_offset, unsigned k, unsigned begin_i,
unsigned char *buffer, size_t *j, unsigned *buf_len, parms_atomic p,
unsigned dtype_len)
{
Expand Down
2 changes: 1 addition & 1 deletion src/H5Ztrans.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static void H5Z__do_op(H5Z_node *tree);
static hbool_t H5Z__op_is_numbs(H5Z_node *_tree);
static hbool_t H5Z__op_is_numbs2(H5Z_node *_tree);
static hid_t H5Z__xform_find_type(const H5T_t *type);
static herr_t H5Z__xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_type,
static herr_t H5Z__xform_eval_full(H5Z_node *tree, size_t array_size, hid_t array_type,
H5Z_result *res);
static void H5Z__xform_destroy_parse_tree(H5Z_node *tree);
static void * H5Z__xform_parse(const char *expression, H5Z_datval_ptrs *dat_val_pointers);
Expand Down
8 changes: 4 additions & 4 deletions test/chunk_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size);
static int verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type,
hsize_t exp_num_chunks);
static int verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size,
hsize_t *exp_offset, unsigned exp_flt_msk);
const hsize_t *exp_offset, unsigned exp_flt_msk);
static int verify_get_chunk_info_by_coord(hid_t dset, hsize_t *offset, hsize_t exp_chk_size,
unsigned exp_flt_msk);
static int verify_empty_chunk_info(hid_t dset, hsize_t *offset);
Expand Down Expand Up @@ -169,7 +169,7 @@ reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size)
*-------------------------------------------------------------------------
*/
static int
verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, hsize_t *exp_offset,
verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, const hsize_t *exp_offset,
unsigned exp_flt_msk)
{
unsigned read_flt_msk = 0; /* Read filter mask */
Expand Down Expand Up @@ -302,7 +302,7 @@ index_type_str(H5D_chunk_index_t idx_type)
*-------------------------------------------------------------------------
*/
static int
verify_selected_chunks(hid_t dset, hid_t plist, hsize_t *start, hsize_t *end)
verify_selected_chunks(hid_t dset, hid_t plist, const hsize_t *start, const hsize_t *end)
{
int read_buf[CHUNK_NX][CHUNK_NY];
int expected_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Expected data */
Expand Down Expand Up @@ -364,7 +364,7 @@ verify_selected_chunks(hid_t dset, hid_t plist, hsize_t *start, hsize_t *end)
*-------------------------------------------------------------------------
*/
static int
write_selected_chunks(hid_t dset, hid_t plist, hsize_t *start, hsize_t *end, unsigned flt_msk)
write_selected_chunks(hid_t dset, hid_t plist, const hsize_t *start, const hsize_t *end, unsigned flt_msk)
{
int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Data in chunks */
hsize_t offset[2]; /* Offset coordinates of a chunk */
Expand Down
4 changes: 2 additions & 2 deletions test/dt_arith.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ static int without_hardware_g = 0;
void some_dummy_func(float x);
static hbool_t overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits);
static int my_isnan(dtype_t type, void *val);
static int my_isinf(int endian, unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos,
static int my_isinf(int endian, const unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos,
size_t esize);

/*-------------------------------------------------------------------------
Expand Down Expand Up @@ -2853,7 +2853,7 @@ my_isnan(dtype_t type, void *val)
*-------------------------------------------------------------------------
*/
static int
my_isinf(int endian, unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, size_t esize)
my_isinf(int endian, const unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, size_t esize)
{
unsigned char *bits;
int retval = 0;
Expand Down
8 changes: 4 additions & 4 deletions test/dtransform.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
#define FLOAT_TOL 0.0001F

static int init_test(hid_t file_id);
static int test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_copy);
static int test_trivial(const hid_t dxpl_id_simple);
static int test_poly(const hid_t dxpl_id_polynomial);
static int test_copy(hid_t dxpl_id_c_to_f_copy, hid_t dxpl_id_polynomial_copy);
static int test_trivial(hid_t dxpl_id_simple);
static int test_poly(hid_t dxpl_id_polynomial);
static int test_specials(hid_t file);
static int test_set(void);
static int test_getset(const hid_t dxpl_id_simple);
static int test_getset(hid_t dxpl_id_simple);

/* These are needed for multiple tests, so are declared here globally and are init'ed in init_test */
hid_t dset_id_int = -1;
Expand Down
2 changes: 1 addition & 1 deletion test/fillval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ test_extend_release_cmpd_vl(void *_elmt)
*-------------------------------------------------------------------------
*/
static int
test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, hsize_t *ch_size, hsize_t *start_size,
test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, const hsize_t *ch_size, hsize_t *start_size,
hsize_t *max_size, hid_t dtype, void *fillval)
{
hid_t fspace = -1, mspace = -1; /* File & memory dataspaces */
Expand Down
2 changes: 1 addition & 1 deletion test/tselect.c
Original file line number Diff line number Diff line change
Expand Up @@ -2561,7 +2561,7 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist)
static void
test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, unsigned tgt_n_cube_rank,
unsigned edge_size, unsigned checker_edge_size,
unsigned sel_rank, hsize_t sel_start[])
unsigned sel_rank, const hsize_t sel_start[])
{
hbool_t first_selection = TRUE;
unsigned n_cube_offset;
Expand Down
Loading