From 12a2484c13ede467c17b0986fc795f51fcb295cf Mon Sep 17 00:00:00 2001 From: shahramn Date: Mon, 4 Mar 2024 10:25:35 +0000 Subject: [PATCH] Const correctness and cppcheck warnings --- src/eccodes_prototypes.h | 2 +- src/grib_accessor_classes_hash.cc | 2 +- src/grib_context.cc | 2 +- src/grib_hash_keys.cc | 2 +- src/make_accessor_class_hash.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/eccodes_prototypes.h b/src/eccodes_prototypes.h index 73f47e3a3..2ac2f9e13 100644 --- a/src/eccodes_prototypes.h +++ b/src/eccodes_prototypes.h @@ -1104,7 +1104,7 @@ long grib_get_binary_scale_fact(double max, double min, long bpval, int* error); grib_handle* codes_external_sample(grib_context* c, ProductKind product_kind, const char* name); char* get_external_sample_path(grib_context* c, const char* name); -/* grib_dependency.cc*/ +/* grib_dependency.cc */ grib_handle* grib_handle_of_accessor(const grib_accessor* a); void grib_dependency_add(grib_accessor* observer, grib_accessor* observed); void grib_dependency_remove_observed(grib_accessor* observed); diff --git a/src/grib_accessor_classes_hash.cc b/src/grib_accessor_classes_hash.cc index 2643a32fb..5617c9456 100644 --- a/src/grib_accessor_classes_hash.cc +++ b/src/grib_accessor_classes_hash.cc @@ -35,7 +35,7 @@ #include "grib_accessor_class.h" #line 6 "accessor_class_list.gperf" -struct accessor_class_hash { char *name; grib_accessor_class **cclass;}; +struct accessor_class_hash { const char *name; grib_accessor_class **cclass;}; #define TOTAL_KEYWORDS 205 #define MIN_WORD_LENGTH 1 diff --git a/src/grib_context.cc b/src/grib_context.cc index 446481c4a..a22fcc654 100644 --- a/src/grib_context.cc +++ b/src/grib_context.cc @@ -453,7 +453,7 @@ grib_context* grib_context_get_default() #ifdef ECCODES_SAMPLES_PATH if (!default_grib_context.grib_samples_path) - default_grib_context.grib_samples_path = ECCODES_SAMPLES_PATH; + default_grib_context.grib_samples_path = (char*)ECCODES_SAMPLES_PATH; #endif default_grib_context.grib_definition_files_path = codes_getenv("ECCODES_DEFINITION_PATH"); diff --git a/src/grib_hash_keys.cc b/src/grib_hash_keys.cc index a71738e88..ba26dbe03 100644 --- a/src/grib_hash_keys.cc +++ b/src/grib_hash_keys.cc @@ -31,7 +31,7 @@ #include "grib_api_internal.h" -struct grib_keys_hash { char* name; int id;}; +struct grib_keys_hash { const char* name; int id;}; #include #define TOTAL_KEYWORDS 2535 diff --git a/src/make_accessor_class_hash.sh b/src/make_accessor_class_hash.sh index 8a3f26f79..72955ae4a 100755 --- a/src/make_accessor_class_hash.sh +++ b/src/make_accessor_class_hash.sh @@ -6,7 +6,7 @@ cat > accessor_class_list.gperf <