Cppcheck warnings

This commit is contained in:
Shahram Najm 2021-12-04 14:01:44 +00:00
parent 64ab857895
commit eadba0575b
5 changed files with 17 additions and 17 deletions

View File

@ -140,7 +140,7 @@ double grib_op_le_d(double a, double b)
if (proc == a) { \
return "&" #a; \
}
const char* grib_binop_long_proc_name(grib_binop_long_proc proc)
const char* grib_binop_long_proc_name(const grib_binop_long_proc proc)
{
if (!proc)
return "NULL";
@ -165,7 +165,7 @@ const char* grib_binop_long_proc_name(grib_binop_long_proc proc)
return NULL;
}
const char* grib_binop_double_proc_name(grib_binop_double_proc proc)
const char* grib_binop_double_proc_name(const grib_binop_double_proc proc)
{
if (!proc)
return "NULL";
@ -184,7 +184,7 @@ const char* grib_binop_double_proc_name(grib_binop_double_proc proc)
return NULL;
}
const char* grib_unop_long_proc_name(grib_unop_long_proc proc)
const char* grib_unop_long_proc_name(const grib_unop_long_proc proc)
{
if (!proc)
return "NULL";
@ -195,7 +195,7 @@ const char* grib_unop_long_proc_name(grib_unop_long_proc proc)
return NULL;
}
const char* grib_unop_double_proc_name(grib_unop_double_proc proc)
const char* grib_unop_double_proc_name(const grib_unop_double_proc proc)
{
if (!proc)
return "NULL";

View File

@ -698,7 +698,7 @@ int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper);
/* grib_openjpeg_encoding.c */
int grib_openjpeg_encode(grib_context* c, j2k_encode_helper* helper);
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* val, size_t* n_vals);
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* val, const size_t* n_vals);
/* action_class_set_missing.c */
grib_action* grib_action_create_set_missing(grib_context* context, const char* name);
@ -1535,10 +1535,10 @@ double grib_op_lt_d(double a, double b);
double grib_op_gt_d(double a, double b);
double grib_op_ge_d(double a, double b);
double grib_op_le_d(double a, double b);
const char* grib_binop_long_proc_name(grib_binop_long_proc proc);
const char* grib_binop_double_proc_name(grib_binop_double_proc proc);
const char* grib_unop_long_proc_name(grib_unop_long_proc proc);
const char* grib_unop_double_proc_name(grib_unop_double_proc proc);
const char* grib_binop_long_proc_name(const grib_binop_long_proc proc);
const char* grib_binop_double_proc_name(const grib_binop_double_proc proc);
const char* grib_unop_long_proc_name(const grib_unop_long_proc proc);
const char* grib_unop_double_proc_name(const grib_unop_double_proc proc);
/* codes_memfs.c */
FILE* codes_fopen(const char* name, const char* mode);

View File

@ -128,7 +128,7 @@ static size_t count_subarea_points(grib_handle* h, get_reduced_row_proc get_redu
}
/* Search for 'x' in the array 'xx' (the index of last element being 'n') and return index in 'j' */
static void binary_search(double xx[], const unsigned long n, double x, long* j)
static void binary_search(const double xx[], const unsigned long n, double x, long* j)
{
/*This routine works only on descending ordered arrays*/
#define EPSILON 1e-3
@ -164,8 +164,8 @@ static int iterate_reduced_gaussian_subarea_legacy(grib_iterator* iter, grib_han
double d = 0;
long ilon_first, ilon_last, i;
grib_iterator_gaussian_reduced* self = (grib_iterator_gaussian_reduced*)iter;
get_reduced_row_proc get_reduced_row = &grib_get_reduced_row;
get_reduced_row = &grib_get_reduced_row_legacy; /* legacy algorithm */
/*get_reduced_row_proc get_reduced_row = &grib_get_reduced_row;*/
get_reduced_row_proc get_reduced_row = &grib_get_reduced_row_legacy; /* legacy algorithm */
if (h->context->debug) {
const size_t np = count_subarea_points(h, get_reduced_row, pl, plsize, lon_first, lon_last);

View File

@ -133,7 +133,7 @@ cleanup:
return err;
}
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* val, size_t* n_vals)
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* val, const size_t* n_vals)
{
int err = GRIB_SUCCESS;
int i;
@ -448,7 +448,7 @@ cleanup:
return err;
}
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* val, size_t* n_vals)
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* val, const size_t* n_vals)
{
int err = GRIB_SUCCESS;
int i;
@ -545,7 +545,7 @@ cleanup:
#else /* No OpenJPEG */
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* val, size_t* n_vals)
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* val, size_t* n_vals)
{
grib_context_log(c, GRIB_LOG_ERROR, "grib_openjpeg_encoding.c: OpenJPEG JPEG support not enabled.");
return GRIB_FUNCTIONALITY_NOT_ENABLED;

View File

@ -23,7 +23,7 @@ static double epsilon()
return e;
}
static int range()
static int vrange()
{
return (int)(log(DBL_MAX) / log(10)) - 1;
}
@ -71,7 +71,7 @@ int grib_optimize_decimal_factor(grib_accessor* a, const char* reference_value,
int inumax, inutil;
long jdec, ie;
int irep;
int RANGE = range();
int RANGE = vrange();
double EPSILON = epsilon();
double pa = pmax - pmin;