mirror of https://github.com/ecmwf/eccodes.git
Const correctness
This commit is contained in:
parent
86db8002ad
commit
9f565bed85
|
@ -92,7 +92,7 @@ static void init_class(grib_action_class* c)
|
|||
grib_action* grib_action_create_if(grib_context* context,
|
||||
grib_expression* expression,
|
||||
grib_action* block_true, grib_action* block_false, int transient,
|
||||
int lineno, char* file_being_parsed)
|
||||
int lineno, const char* file_being_parsed)
|
||||
{
|
||||
char name[1024];
|
||||
const size_t nameLen = sizeof(name);
|
||||
|
|
|
@ -174,7 +174,7 @@ static int execute(grib_action* act, grib_handle* h)
|
|||
}
|
||||
|
||||
if (h->gts_header) {
|
||||
char gts_trailer[4] = { '\x0D', '\x0D', '\x0A', '\x03' };
|
||||
const char gts_trailer[4] = { '\x0D', '\x0D', '\x0A', '\x03' };
|
||||
if (fwrite(gts_trailer, 1, 4, of->handle) != 4) {
|
||||
grib_context_log(act->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),
|
||||
"Error writing GTS trailer to %s", filename);
|
||||
|
|
|
@ -199,7 +199,7 @@ char* codes_bufr_keys_iterator_get_name(const bufr_keys_iterator* ckiter)
|
|||
bufr_keys_iterator* kiter = (bufr_keys_iterator*)ckiter;
|
||||
int* r = 0;
|
||||
char* ret = 0;
|
||||
grib_context* c = kiter->handle->context;
|
||||
const grib_context* c = kiter->handle->context;
|
||||
DEBUG_ASSERT(kiter->current);
|
||||
|
||||
if (kiter->prefix) {
|
||||
|
@ -236,7 +236,7 @@ grib_accessor* codes_bufr_keys_iterator_get_accessor(bufr_keys_iterator* kiter)
|
|||
int codes_bufr_keys_iterator_delete(bufr_keys_iterator* kiter)
|
||||
{
|
||||
if (kiter) {
|
||||
grib_context* c = kiter->handle->context;
|
||||
const grib_context* c = kiter->handle->context;
|
||||
kiter->key_name = NULL;
|
||||
if (kiter->seen)
|
||||
grib_trie_delete(kiter->seen);
|
||||
|
|
|
@ -18,7 +18,7 @@ int compute_bufr_key_rank(grib_handle* h, grib_string_list* keys, const char* ke
|
|||
grib_string_list* prev = keys;
|
||||
int theRank = 0;
|
||||
size_t size = 0;
|
||||
grib_context* c = h->context;
|
||||
const grib_context* c = h->context;
|
||||
DEBUG_ASSERT(h->product_kind == PRODUCT_BUFR);
|
||||
|
||||
while (next && next->value && strcmp(next->value, key)) {
|
||||
|
@ -1114,7 +1114,7 @@ int codes_bufr_header_get_string(codes_bufr_header* bh, const char* key, char* v
|
|||
// Returns 1 if the BUFR key is in the header and 0 if it is in the data section
|
||||
int codes_bufr_key_is_header(const grib_handle* h, const char* key, int* err)
|
||||
{
|
||||
grib_accessor* acc = grib_find_accessor(h, key);
|
||||
const grib_accessor* acc = grib_find_accessor(h, key);
|
||||
if (!acc) {
|
||||
*err = GRIB_NOT_FOUND;
|
||||
return 0;
|
||||
|
@ -1126,7 +1126,7 @@ int codes_bufr_key_is_header(const grib_handle* h, const char* key, int* err)
|
|||
// Returns 1 if the BUFR key is a coordinate descriptor
|
||||
int codes_bufr_key_is_coordinate(const grib_handle* h, const char* key, int* err)
|
||||
{
|
||||
grib_accessor* acc = grib_find_accessor(h, key);
|
||||
const grib_accessor* acc = grib_find_accessor(h, key);
|
||||
if (!acc) {
|
||||
*err = GRIB_NOT_FOUND;
|
||||
return 0;
|
||||
|
|
|
@ -133,7 +133,7 @@ char* codes_getenv(const char* name)
|
|||
|
||||
int codes_check_grib_ieee_packing_value(int value)
|
||||
{
|
||||
grib_context* c = grib_context_get_default();
|
||||
const grib_context* c = grib_context_get_default();
|
||||
if (value != 32 && value != 64) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Invalid value for ECCODES_GRIB_IEEE_PACKING: should be 32 or 64");
|
||||
return GRIB_INVALID_ARGUMENT;
|
||||
|
@ -146,7 +146,7 @@ int codes_flush_sync_close_file(FILE* f)
|
|||
{
|
||||
int err = 0;
|
||||
int fd = 0;
|
||||
grib_context* c = grib_context_get_default();
|
||||
const grib_context* c = grib_context_get_default();
|
||||
Assert(f);
|
||||
|
||||
fd = fileno(f);
|
||||
|
|
|
@ -20,7 +20,7 @@ grib_action* grib_action_create_alias(grib_context* context, const char* name, c
|
|||
grib_action* grib_action_create_gen(grib_context* context, const char* name, const char* op, const long len, grib_arguments* params, grib_arguments* default_value, int flags, const char* name_space, const char* set);
|
||||
|
||||
/* action_class_if.cc */
|
||||
grib_action* grib_action_create_if(grib_context* context, grib_expression* expression, grib_action* block_true, grib_action* block_false, int transient, int lineno, char* file_being_parsed);
|
||||
grib_action* grib_action_create_if(grib_context* context, grib_expression* expression, grib_action* block_true, grib_action* block_false, int transient, int lineno, const char* file_being_parsed);
|
||||
|
||||
/* action_class_switch.cc */
|
||||
grib_action* grib_action_create_switch(grib_context* context, grib_arguments* args, grib_case* Case, grib_action* Default);
|
||||
|
|
|
@ -193,7 +193,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
|
|||
long tlen = 0;
|
||||
long i = 0;
|
||||
int err = 0;
|
||||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
const grib_handle* hand = grib_handle_of_accessor(a);
|
||||
|
||||
err = grib_value_count(a, &tlen);
|
||||
if (err)
|
||||
|
|
|
@ -254,7 +254,7 @@ static size_t get_length(grib_accessor* a)
|
|||
grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a;
|
||||
size_t len = 0;
|
||||
|
||||
grib_handle* h = grib_handle_of_accessor(a);
|
||||
const grib_handle* h = grib_handle_of_accessor(a);
|
||||
|
||||
grib_get_size(h, self->bufrDataEncodedName, &len);
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
size_t size = 0;
|
||||
int ret = 0, i = 0;
|
||||
grib_accessor_scale_values* self = (grib_accessor_scale_values*)a;
|
||||
grib_context* c = a->context;
|
||||
const grib_context* c = a->context;
|
||||
grib_handle* h = grib_handle_of_accessor(a);
|
||||
|
||||
if (*val == 1)
|
||||
|
|
Loading…
Reference in New Issue