Cppcheck warnings: Const correctness

This commit is contained in:
Shahram Najm 2021-11-06 14:18:48 +00:00
parent adbb4e5f58
commit 6b2c1348b3
2 changed files with 6 additions and 6 deletions

View File

@ -59,7 +59,7 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
return (*a == 0 && *b == 0) ? 0 : 1;
}
typedef double (*compare_double_proc)(double*, double*, double*);
typedef double (*compare_double_proc)(const double*, const double*, const double*);
typedef struct grib_error grib_error;
struct grib_error
@ -136,7 +136,7 @@ static void release_keys_list()
}
}
GRIB_INLINE static double compare_double_absolute(double* a, double* b, double* err)
GRIB_INLINE static double compare_double_absolute(const double* a, const double* b, const double* err)
{
double ret = 0;
double d = fabs(*a - *b);
@ -183,7 +183,7 @@ static void write_messages(grib_handle* handle1, grib_handle* handle2)
write_message(handle2, "error2");
}
static double compare_double_relative(double* a, double* b, double* err)
static double compare_double_relative(const double* a, const double* b, const double* err)
{
double relativeError;

View File

@ -46,7 +46,7 @@ const char* tool_description =
const char* tool_name = "grib_compare";
const char* tool_usage = "[options] grib_file1 grib_file2";
typedef double (*compare_double_proc)(double*, double*, double);
typedef double (*compare_double_proc)(const double*, const double*, double);
static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_options* options);
typedef struct grib_error grib_error;
@ -124,7 +124,7 @@ GRIB_INLINE static int grib_inline_rstrcmp(const char* a, const char* b)
}
/* Returns 0 when the values are considered the same */
static double compare_double_absolute(double* a, double* b, double tolerance)
static double compare_double_absolute(const double* a, const double* b, double tolerance)
{
double ret = 0;
double d = fabs(*a - *b);
@ -136,7 +136,7 @@ static double compare_double_absolute(double* a, double* b, double tolerance)
}
/* Returns 0 when the values are considered the same */
static double compare_double_relative(double* a, double* b, double tolerance)
static double compare_double_relative(const double* a, const double* b, double tolerance)
{
double relativeError;