Skip to content

Commit

Permalink
Compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Dec 7, 2024
1 parent fcfe84b commit 12b17fe
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 20 deletions.
11 changes: 4 additions & 7 deletions src/expression/grib_arguments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void Arguments::print(grib_handle* f) const

const char* Arguments::get_name(grib_handle* h, int n) const
{
Expression* e = NULL;
const Expression* e = NULL;
const Arguments* args = this;
while (args && n-- > 0) {
args = args->next_;
Expand All @@ -68,7 +68,6 @@ const char* Arguments::get_name(grib_handle* h, int n) const

const char* Arguments::get_string(grib_handle* h, int n) const
{
Expression* e = NULL;
const Arguments* args = this;
int ret = 0;
while (args && n-- > 0) {
Expand All @@ -78,15 +77,14 @@ const char* Arguments::get_string(grib_handle* h, int n) const
if (!args)
return NULL;

e = args->expression_;
const Expression* e = args->expression_;
return e->evaluate_string(h, NULL, NULL, &ret);
}

long Arguments::get_long(grib_handle* h, int n) const
{
int ret = 0;
long lres = 0;
grib_expression* e = NULL;
const Arguments* args = this;
while (args && n-- > 0) {
args = args->next_;
Expand All @@ -95,7 +93,7 @@ long Arguments::get_long(grib_handle* h, int n) const
if (!args)
return 0;

e = args->expression_;
const grib_expression* e = args->expression_;
ret = e->evaluate_long(h, &lres);
(void)ret;
return lres;
Expand All @@ -106,7 +104,6 @@ double Arguments::get_double(grib_handle* h, int n) const
int ret = 0;
double dres = 0.0;

Expression* e = NULL;
const Arguments* args = this;
while (args && n-- > 0) {
args = args->next_;
Expand All @@ -115,7 +112,7 @@ double Arguments::get_double(grib_handle* h, int n) const
if (!args)
return 0;

e = args->expression_;
const Expression* e = args->expression_;
ret = e->evaluate_double(h, &dres);
(void)ret;
return dres;
Expand Down
1 change: 0 additions & 1 deletion src/expression/grib_expression_class_double.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Double : public Expression
public:
Double(grib_context*, double);

void destroy(grib_context*) override {}
void print(grib_context*, grib_handle*, FILE*) const override;
void add_dependency(grib_accessor*) override {}
int native_type(grib_handle*) const override;
Expand Down
13 changes: 8 additions & 5 deletions src/expression/grib_expression_class_functor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ int Functor::evaluate_long(grib_handle* h, long* lres) const
}

if (STR_EQUAL(name_, "abs")) {
grib_expression* exp = args_ ? args_->get_expression(h, 0) : nullptr;
long lval = 0;
int ret = exp->evaluate_long(h, &lval);
*lres = abs(lval);
return ret;
const grib_expression* exp = args_ ? args_->get_expression(h, 0) : nullptr;
if (exp) {
long lval = 0;
int ret = exp->evaluate_long(h, &lval);
*lres = abs(lval);
return ret;
}
return GRIB_INVALID_ARGUMENT;
}

if (STR_EQUAL(name_, "size")) {
Expand Down
5 changes: 0 additions & 5 deletions src/expression/grib_expression_class_long.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ void Long::print(grib_context* c, grib_handle* f, FILE* out) const
fprintf(out, "long(%ld)", value_);
}

void Long::destroy(grib_context* c)
{
/* grib_expression_long* e = (grib_expression_long*)g; */
}

void Long::add_dependency(grib_accessor* observer)
{
/* grib_expression_long* e = (grib_expression_long*)g; */
Expand Down
1 change: 0 additions & 1 deletion src/expression/grib_expression_class_long.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Long : public Expression {
public:
Long(long value) : value_(value) {}

void destroy(grib_context*) override;
void print(grib_context*, grib_handle*, FILE*) const override;
void add_dependency(grib_accessor*) override;
int native_type(grib_handle*) const override;
Expand Down
2 changes: 1 addition & 1 deletion src/expression/grib_expression_class_true.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace eccodes::expression {
class True : public Expression {
public:
True() = default;
void destroy(grib_context*) override {}

void print(grib_context*, grib_handle*, FILE*) const override;
void add_dependency(grib_accessor*) override {};
int native_type(grib_handle*) const override;
Expand Down

0 comments on commit 12b17fe

Please sign in to comment.