From 86f5e6ef16f3747c6430e6d7ad7d188717625555 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 9 Mar 2022 19:33:52 +0000 Subject: [PATCH] ECC-1367: C API: codes_get_double_elements: The 'index_array' argument should be 'const' --- src/eccodes.c | 4 ++-- src/eccodes.h | 4 ++-- src/grib_api.h | 4 ++-- src/grib_api_prototypes.h | 2 +- src/grib_value.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/eccodes.c b/src/eccodes.c index 7b6a8016d..0a60f4b2e 100644 --- a/src/eccodes.c +++ b/src/eccodes.c @@ -341,9 +341,9 @@ int codes_get_double_element(const grib_handle* h, const char* key, int i, doubl { return grib_get_double_element(h, key, i, value); } -int codes_get_double_elements(const grib_handle* h, const char* key, int* i, long size, double* value) +int codes_get_double_elements(const grib_handle* h, const char* key, const int* index_array, long size, double* value) { - return grib_get_double_elements(h, key, i, size, value); + return grib_get_double_elements(h, key, index_array, size, value); } int codes_get_string(const grib_handle* h, const char* key, char* mesg, size_t* length) { diff --git a/src/eccodes.h b/src/eccodes.h index 1b3363dd3..f6fe66b88 100644 --- a/src/eccodes.h +++ b/src/eccodes.h @@ -783,12 +783,12 @@ int codes_get_double_element(const codes_handle* h, const char* key, int i, doub * * @param h : the handle to get the data from * @param key : the key to be searched -* @param i : zero-based array of indexes +* @param index_array : zero-based array of indexes * @param size : size of the i and value arrays * @param value : the double array for the data values * @return 0 if OK, integer value on error */ -int codes_get_double_elements(const codes_handle* h, const char* key, int* i, long size, double* value); +int codes_get_double_elements(const codes_handle* h, const char* key, const int* index_array, long size, double* value); /** * Get a string value from a key, if several keys of the same name are present, the last one is returned diff --git a/src/grib_api.h b/src/grib_api.h index 232763c4a..cc6f3eb2f 100644 --- a/src/grib_api.h +++ b/src/grib_api.h @@ -809,12 +809,12 @@ int grib_get_double_element(const grib_handle* h, const char* key, int i, double * * @param h : the handle to get the data from * @param key : the key to be searched -* @param i : zero-based array of indexes +* @param index_array : zero-based array of indexes * @param size : size of the i and value arrays * @param value : the double array for the data values * @return 0 if OK, integer value on error */ -int grib_get_double_elements(const grib_handle* h, const char* key, int* i, long size, double* value); +int grib_get_double_elements(const grib_handle* h, const char* key, const int* index_array, long size, double* value); /** * Get a string value from a key, if several keys of the same name are present, the last one is returned diff --git a/src/grib_api_prototypes.h b/src/grib_api_prototypes.h index c2cb06220..74530c6d6 100644 --- a/src/grib_api_prototypes.h +++ b/src/grib_api_prototypes.h @@ -1239,7 +1239,7 @@ int grib_get_double(const grib_handle* h, const char* name, double* val); int grib_get_double_element_internal(grib_handle* h, const char* name, int i, double* val); int grib_get_double_element(const grib_handle* h, const char* name, int i, double* val); int grib_points_get_values(grib_handle* h, grib_points* points, double* val); -int grib_get_double_elements(const grib_handle* h, const char* name, int* index_array, long len, double* val_array); +int grib_get_double_elements(const grib_handle* h, const char* name, const int* index_array, long len, double* val_array); int grib_get_string_internal(grib_handle* h, const char* name, char* val, size_t* length); int grib_get_string(const grib_handle* h, const char* name, char* val, size_t* length); int grib_get_bytes_internal(const grib_handle* h, const char* name, unsigned char* val, size_t* length); diff --git a/src/grib_value.c b/src/grib_value.c index eeae905fa..287d86f71 100644 --- a/src/grib_value.c +++ b/src/grib_value.c @@ -1040,7 +1040,7 @@ int grib_points_get_values(grib_handle* h, grib_points* points, double* val) return GRIB_SUCCESS; } -int grib_get_double_elements(const grib_handle* h, const char* name, int* index_array, long len, double* val_array) +int grib_get_double_elements(const grib_handle* h, const char* name, const int* index_array, long len, double* val_array) { double* values = 0; int err = 0;