Const correctness

This commit is contained in:
Shahram Najm 2024-02-18 14:35:19 +00:00
parent 2925ec7c91
commit bbc8d4790e
2 changed files with 6 additions and 9 deletions

View File

@ -128,7 +128,7 @@ grib_concept_value* action_concept_get_concept(grib_accessor* a)
int action_concept_get_nofail(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; 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; grib_concept_condition* concept_condition = concept_value->conditions;
if (strcmp(pValue, concept_value->name) == 0) { if (strcmp(pValue, concept_value->name) == 0) {
while (concept_condition) { while (concept_condition) {
grib_expression* expression = concept_condition->expression; //grib_expression* expression = concept_condition->expression;
const char* condition_name = concept_condition->name; 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) { if (concept_condition_expression_true(h, concept_condition, exprVal) && strcmp(condition_name, "one") != 0) {
length += snprintf(result + length, 2048, "%s%s=%s", length += snprintf(result + length, 2048, "%s%s=%s",
(length == 0 ? "" : ","), condition_name, exprVal); (length == 0 ? "" : ","), condition_name, exprVal);

View File

@ -72,9 +72,7 @@ static void init_class(grib_action_class* c)
} }
/* END_CLASS_IMP */ /* END_CLASS_IMP */
grib_action* grib_action_create_set_sarray(grib_context* context, grib_action* grib_action_create_set_sarray(grib_context* context, const char* name, grib_sarray* sarray)
const char* name,
grib_sarray* sarray)
{ {
char buf[1024]; 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) static int execute(grib_action* a, grib_handle* h)
{ {
grib_action_set_sarray* self = (grib_action_set_sarray*)a; 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); 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) static void dump(grib_action* act, FILE* f, int lvl)
{ {
int i = 0; int i = 0;
grib_action_set_sarray* self = (grib_action_set_sarray*)act; const grib_action_set_sarray* self = (grib_action_set_sarray*)act;
for (i = 0; i < lvl; i++) for (i = 0; i < lvl; i++)
grib_context_print(act->context, f, " "); grib_context_print(act->context, f, " ");
grib_context_print(act->context, f, self->name); grib_context_print(act->context, f, self->name);