From bbc8d4790ee1e3bb867fcbd483274683f2c6a5de Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sun, 18 Feb 2024 14:35:19 +0000 Subject: [PATCH] Const correctness --- src/action_class_concept.cc | 6 +++--- src/action_class_set_sarray.cc | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/action_class_concept.cc b/src/action_class_concept.cc index 74fb25588..3f42fb9e5 100644 --- a/src/action_class_concept.cc +++ b/src/action_class_concept.cc @@ -128,7 +128,7 @@ grib_concept_value* action_concept_get_concept(grib_accessor* a) int action_concept_get_nofail(grib_accessor* a) { - grib_action_concept* self = (grib_action_concept*)a->creator; + const grib_action_concept* self = (grib_action_concept*)a->creator; return self->nofail; } @@ -397,9 +397,9 @@ int get_concept_condition_string(grib_handle* h, const char* key, const char* va grib_concept_condition* concept_condition = concept_value->conditions; if (strcmp(pValue, concept_value->name) == 0) { while (concept_condition) { - grib_expression* expression = concept_condition->expression; + //grib_expression* expression = concept_condition->expression; const char* condition_name = concept_condition->name; - Assert(expression); + //Assert(expression); if (concept_condition_expression_true(h, concept_condition, exprVal) && strcmp(condition_name, "one") != 0) { length += snprintf(result + length, 2048, "%s%s=%s", (length == 0 ? "" : ","), condition_name, exprVal); diff --git a/src/action_class_set_sarray.cc b/src/action_class_set_sarray.cc index 3b670aa87..bc51c2475 100644 --- a/src/action_class_set_sarray.cc +++ b/src/action_class_set_sarray.cc @@ -72,9 +72,7 @@ static void init_class(grib_action_class* c) } /* END_CLASS_IMP */ -grib_action* grib_action_create_set_sarray(grib_context* context, - const char* name, - grib_sarray* sarray) +grib_action* grib_action_create_set_sarray(grib_context* context, const char* name, grib_sarray* sarray) { char buf[1024]; @@ -100,14 +98,13 @@ grib_action* grib_action_create_set_sarray(grib_context* context, static int execute(grib_action* a, grib_handle* h) { grib_action_set_sarray* self = (grib_action_set_sarray*)a; - return grib_set_string_array(h, self->name, (const char**)self->sarray->v, self->sarray->n); } static void dump(grib_action* act, FILE* f, int lvl) { - int i = 0; - grib_action_set_sarray* self = (grib_action_set_sarray*)act; + int i = 0; + const grib_action_set_sarray* self = (grib_action_set_sarray*)act; for (i = 0; i < lvl; i++) grib_context_print(act->context, f, " "); grib_context_print(act->context, f, self->name);