ECC-1382: C API: codes_fieldset_new_from_files: The 'keys' argument should be const

This commit is contained in:
Shahram Najm 2022-04-19 11:56:19 +01:00
parent 1693106cc4
commit 66fbbfcbfd
6 changed files with 10 additions and 10 deletions

View File

@ -69,7 +69,7 @@ void codes_check(const char* call, const char* file, int line, int e, const char
/* Fieldsets */
/******************************************************************************/
grib_fieldset* codes_fieldset_new_from_files(grib_context* c, char* filenames[], int nfiles, char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err)
grib_fieldset* codes_fieldset_new_from_files(grib_context* c, char* filenames[], int nfiles, const char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err)
{
return grib_fieldset_new_from_files(c, filenames, nfiles, keys, nkeys, where_string, order_by_string, err);
}

View File

@ -181,7 +181,7 @@ typedef struct grib_util_packing_spec codes_util_packing_spec;
typedef struct grib_util_grid_spec codes_util_grid_spec;
codes_fieldset* codes_fieldset_new_from_files(codes_context* c, char* filenames[], int nfiles, char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err);
codes_fieldset* codes_fieldset_new_from_files(codes_context* c, char* filenames[], int nfiles, const char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err);
void codes_fieldset_delete(codes_fieldset* set);
void codes_fieldset_rewind(codes_fieldset* set);

View File

@ -235,7 +235,7 @@ typedef struct bufr_descriptor bufr_descriptor;
typedef struct bufr_descriptors_array bufr_descriptors_array;
typedef struct bufr_descriptors_map_list bufr_descriptors_map_list;
grib_fieldset* grib_fieldset_new_from_files(grib_context* c, char* filenames[], int nfiles, char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err);
grib_fieldset* grib_fieldset_new_from_files(grib_context* c, char* filenames[], int nfiles, const char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err);
void grib_fieldset_delete(grib_fieldset* set);
void grib_fieldset_rewind(grib_fieldset* set);
int grib_fieldset_apply_order_by(grib_fieldset* set, const char* order_by_string);

View File

@ -987,7 +987,7 @@ long grib_date_to_julian(long ddate);
/* grib_fieldset.c */
int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type);
grib_fieldset* grib_fieldset_new_from_files(grib_context* c, char* filenames[], int nfiles, char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err);
grib_fieldset* grib_fieldset_new_from_files(grib_context* c, char* filenames[], int nfiles, const char** keys, int nkeys, const char* where_string, const char* order_by_string, int* err);
int grib_fieldset_apply_where(grib_fieldset* set, const char* where_string);
int grib_fieldset_apply_order_by(grib_fieldset* set, const char* order_by_string);
void grib_fieldset_delete_order_by(grib_context* c, grib_order_by* order_by);

View File

@ -38,7 +38,7 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
return (*a == 0 && *b == 0) ? 0 : 1;
}
static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, char** keys, int nkeys, int* err);
static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, const char** keys, int nkeys, int* err);
static grib_fieldset* grib_fieldset_create_from_order_by(grib_context* c, grib_order_by* ob,
int* err);
static int grib_fieldset_resize(grib_fieldset* set, size_t newsize);
@ -255,7 +255,7 @@ static int grib_fieldset_column_copy_from_handle(grib_handle* h, grib_fieldset*
/* --------------- grib_fieldset functions ------------------*/
grib_fieldset* grib_fieldset_new_from_files(grib_context* c, char* filenames[],
int nfiles, char** keys, int nkeys,
int nfiles, const char** keys, int nkeys,
const char* where_string, const char* order_by_string, int* err)
{
int i = 0;
@ -316,7 +316,7 @@ grib_fieldset* grib_fieldset_new_from_files(grib_context* c, char* filenames[],
return set;
}
static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, char** keys, int nkeys, int* err)
static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, const char** keys, int nkeys, int* err)
{
grib_fieldset* set = NULL;
size_t msize = 0, size = 0;
@ -384,7 +384,7 @@ static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, char** key
static grib_fieldset* grib_fieldset_create_from_order_by(grib_context* c, grib_order_by* ob, int* err)
{
char** keys = NULL;
const char** keys = NULL;
size_t nkeys = 0;
int i = 0;
grib_fieldset* set = NULL;
@ -395,7 +395,7 @@ static grib_fieldset* grib_fieldset_create_from_order_by(grib_context* c, grib_o
next = next->next;
}
keys = (char**)grib_context_malloc_clear(c, nkeys * sizeof(char*));
keys = (const char**)grib_context_malloc_clear(c, nkeys * sizeof(char*));
next = ob;
i = 0;

View File

@ -25,7 +25,7 @@ int main(int argc, char** argv)
long step;
char** filenames;
size_t nkeys, nfiles, i=0;
char* keys[] = { "step:i", "date", "paramId", "levelType" };
const char* keys[] = { "step:i", "date", "paramId", "levelType" };
grib_fieldset* set = NULL;
grib_handle* h = NULL;
char param[20] = {0,};