From 7c471813eaa8276b1edcff3aee2aaa3cdf67ad6f Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 3 Jun 2022 13:02:32 +0100 Subject: [PATCH] cppcheck: Const correctness --- src/eccodes_prototypes.h | 4 ++-- src/grib_nearest.c | 2 +- src/grib_query.c | 2 +- src/grib_util.c | 2 +- src/grib_value.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/eccodes_prototypes.h b/src/eccodes_prototypes.h index ce934f6ee..f44a6b40c 100644 --- a/src/eccodes_prototypes.h +++ b/src/eccodes_prototypes.h @@ -1219,7 +1219,7 @@ int grib_set_missing_internal(grib_handle* h, const char* name); int grib_set_missing(grib_handle* h, const char* name); int grib_is_missing_long(grib_accessor* a, long x); int grib_is_missing_double(grib_accessor* a, double x); -int grib_is_missing_string(grib_accessor* a, unsigned char* x, size_t len); +int grib_is_missing_string(grib_accessor* a, const unsigned char* x, size_t len); int grib_accessor_is_missing(grib_accessor* a, int* err); int grib_is_missing(const grib_handle* h, const char* name, int* err); int grib_is_defined(const grib_handle* h, const char* name); @@ -1337,7 +1337,7 @@ int grib_nearest_find(grib_nearest* nearest, const grib_handle* h, double inlat, int grib_nearest_init(grib_nearest* i, grib_handle* h, grib_arguments* args); int grib_nearest_delete(grib_nearest* i); int grib_nearest_get_radius(grib_handle* h, double* radiusInKm); -void grib_binary_search(double xx[], const unsigned long n, double x, int* ju, int* jl); +void grib_binary_search(const double xx[], const unsigned long n, double x, int* ju, int* jl); int grib_nearest_find_multiple(const grib_handle* h, int is_lsm, const double* inlats, const double* inlons, long npoints, double* outlats, double* outlons, double* values, double* distances, int* indexes); int grib_nearest_find_generic(grib_nearest* nearest, grib_handle* h, double inlat, double inlon, unsigned long flags, const char* values_keyname, const char* Ni_keyname, const char* Nj_keyname, diff --git a/src/grib_nearest.c b/src/grib_nearest.c index 5d62c8340..8a2487118 100644 --- a/src/grib_nearest.c +++ b/src/grib_nearest.c @@ -128,7 +128,7 @@ int grib_nearest_get_radius(grib_handle* h, double* radiusInKm) return GRIB_SUCCESS; } -void grib_binary_search(double xx[], const unsigned long n, double x, +void grib_binary_search(const double xx[], const unsigned long n, double x, int* ju, int* jl) { size_t jm = 0; diff --git a/src/grib_query.c b/src/grib_query.c index 662e75c41..df9aca973 100644 --- a/src/grib_query.c +++ b/src/grib_query.c @@ -364,7 +364,7 @@ static int condition_true(grib_accessor* a, codes_condition* condition) return ret; } -static void search_from_accessors_list(grib_accessors_list* al, grib_accessors_list* end, const char* name, grib_accessors_list* result) +static void search_from_accessors_list(grib_accessors_list* al, const grib_accessors_list* end, const char* name, grib_accessors_list* result) { char attribute_name[200] = {0,}; grib_accessor* accessor_result = 0; diff --git a/src/grib_util.c b/src/grib_util.c index ecd9862e9..45500b599 100644 --- a/src/grib_util.c +++ b/src/grib_util.c @@ -19,7 +19,7 @@ typedef enum eROUND_ANGLE_DOWN } RoundingPolicy; -static void set_total_length(unsigned char* buffer, long* section_length, long* section_offset, int edition, size_t totalLength) +static void set_total_length(unsigned char* buffer, long* section_length, const long* section_offset, int edition, size_t totalLength) { long off; switch (edition) { diff --git a/src/grib_value.c b/src/grib_value.c index 36cecbc72..658e2bd62 100644 --- a/src/grib_value.c +++ b/src/grib_value.c @@ -604,7 +604,7 @@ int grib_is_missing_double(grib_accessor* a, double x) return ret; } -int grib_is_missing_string(grib_accessor* a, unsigned char* x, size_t len) +int grib_is_missing_string(grib_accessor* a, const unsigned char* x, size_t len) { /* For a string value to be missing, every character has to be */ /* all 1's (i.e. 0xFF) */