diff --git a/src/eccodes.c b/src/eccodes.c index 0a60f4b2e..67c4512ef 100644 --- a/src/eccodes.c +++ b/src/eccodes.c @@ -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); } diff --git a/src/eccodes.h b/src/eccodes.h index 932ac6cd7..2cb496176 100644 --- a/src/eccodes.h +++ b/src/eccodes.h @@ -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); diff --git a/src/grib_api.h b/src/grib_api.h index d8d8b3385..19b4d72b9 100644 --- a/src/grib_api.h +++ b/src/grib_api.h @@ -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); diff --git a/src/grib_api_prototypes.h b/src/grib_api_prototypes.h index f0752939d..9254b9f6d 100644 --- a/src/grib_api_prototypes.h +++ b/src/grib_api_prototypes.h @@ -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); diff --git a/src/grib_fieldset.c b/src/grib_fieldset.c index 84b2ad400..54538b7c2 100644 --- a/src/grib_fieldset.c +++ b/src/grib_fieldset.c @@ -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; diff --git a/tests/grib_fieldset.c b/tests/grib_fieldset.c index 56e17b8ff..ff476ab45 100644 --- a/tests/grib_fieldset.c +++ b/tests/grib_fieldset.c @@ -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,};