ECC-995: C API: Review const-ness of arguments (part 2)

This commit is contained in:
Shahram Najm 2019-10-03 15:18:28 +01:00
parent 4d5abcb7db
commit 06c22655cf
7 changed files with 102 additions and 101 deletions

View File

@ -82,7 +82,7 @@ int codes_bufr_keys_iterator_rewind(bufr_keys_iterator* ki)
return GRIB_SUCCESS;
}
static int is_ident_key(bufr_keys_iterator* kiter)
static int is_ident_key(const bufr_keys_iterator* kiter)
{
if (kiter->current->sub_section)
return 0;
@ -200,8 +200,9 @@ int codes_bufr_keys_iterator_next(bufr_keys_iterator* kiter)
/* The return value is constructed so we allocate memory for it. */
/* We free in codes_bufr_keys_iterator_delete() */
char* codes_bufr_keys_iterator_get_name(bufr_keys_iterator* kiter)
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;

View File

@ -57,7 +57,7 @@ const char* codes_get_type_name(int type)
{
return grib_get_type_name(type);
}
int codes_get_native_type(grib_handle* h, const char* name,int* type)
int codes_get_native_type(const grib_handle* h, const char* name,int* type)
{
return grib_get_native_type(h,name,type);
}
@ -309,11 +309,11 @@ int codes_grib_nearest_delete(grib_nearest *nearest)
/* get/set keys */
/******************************************************************************/
int codes_is_missing(grib_handle* h, const char* key, int* err)
int codes_is_missing(const grib_handle* h, const char* key, int* err)
{
return grib_is_missing(h,key,err);
}
int codes_is_defined(grib_handle* h, const char* key)
int codes_is_defined(const grib_handle* h, const char* key)
{
return grib_is_defined(h,key);
}
@ -329,39 +329,39 @@ int codes_get_length(const grib_handle* h, const char* key,size_t *length)
{
return grib_get_length(h,key,length);
}
int codes_get_long(grib_handle* h, const char* key, long* value)
int codes_get_long(const grib_handle* h, const char* key, long* value)
{
return grib_get_long(h,key,value);
}
int codes_get_double(grib_handle* h, const char* key, double* value)
int codes_get_double(const grib_handle* h, const char* key, double* value)
{
return grib_get_double(h,key,value);
}
int codes_get_double_element(grib_handle* h, const char* key, int i, double* value)
int codes_get_double_element(const grib_handle* h, const char* key, int i, double* value)
{
return grib_get_double_element(h,key,i,value);
}
int codes_get_double_elements(grib_handle* h, const char* key, int* i, long size,double* value)
int codes_get_double_elements(const grib_handle* h, const char* key, int* i, long size,double* value)
{
return grib_get_double_elements(h,key,i,size,value);
}
int codes_get_string(grib_handle* h, const char* key, char* mesg, size_t *length)
int codes_get_string(const grib_handle* h, const char* key, char* mesg, size_t *length)
{
return grib_get_string(h,key,mesg,length);
}
int codes_get_string_array(grib_handle* h, const char* key, char** vals, size_t *length)
int codes_get_string_array(const grib_handle* h, const char* key, char** vals, size_t *length)
{
return grib_get_string_array(h,key,vals,length);
}
int codes_get_bytes(grib_handle* h, const char* key, unsigned char* bytes, size_t *length)
int codes_get_bytes(const grib_handle* h, const char* key, unsigned char* bytes, size_t *length)
{
return grib_get_bytes(h,key,bytes,length);
}
int codes_get_double_array(grib_handle* h, const char* key, double* vals, size_t *length)
int codes_get_double_array(const grib_handle* h, const char* key, double* vals, size_t *length)
{
return grib_get_double_array(h,key,vals,length);
}
int codes_get_long_array(grib_handle* h, const char* key, long* vals, size_t *length)
int codes_get_long_array(const grib_handle* h, const char* key, long* vals, size_t *length)
{
return grib_get_long_array(h,key,vals,length);
}
@ -448,7 +448,7 @@ int codes_keys_iterator_next(grib_keys_iterator *kiter)
{
return grib_keys_iterator_next(kiter);
}
const char* codes_keys_iterator_get_name(grib_keys_iterator *kiter)
const char* codes_keys_iterator_get_name(const grib_keys_iterator *kiter)
{
return grib_keys_iterator_get_name(kiter);
}
@ -464,19 +464,19 @@ int codes_keys_iterator_set_flags(grib_keys_iterator *kiter,unsigned long flags)
{
return grib_keys_iterator_set_flags(kiter,flags);
}
int codes_keys_iterator_get_long(grib_keys_iterator *kiter, long *v, size_t *len)
int codes_keys_iterator_get_long(const grib_keys_iterator *kiter, long *v, size_t *len)
{
return grib_keys_iterator_get_long(kiter,v,len);
}
int codes_keys_iterator_get_double(grib_keys_iterator *kiter, double *v, size_t *len)
int codes_keys_iterator_get_double(const grib_keys_iterator *kiter, double *v, size_t *len)
{
return grib_keys_iterator_get_double(kiter,v,len);
}
int codes_keys_iterator_get_string(grib_keys_iterator *kiter, char *v, size_t *len)
int codes_keys_iterator_get_string(const grib_keys_iterator *kiter, char *v, size_t *len)
{
return grib_keys_iterator_get_string(kiter,v,len);
}
int codes_keys_iterator_get_bytes(grib_keys_iterator *kiter, unsigned char *v, size_t *len)
int codes_keys_iterator_get_bytes(const grib_keys_iterator *kiter, unsigned char *v, size_t *len)
{
return grib_keys_iterator_get_bytes(kiter,v,len);
}

View File

@ -754,7 +754,7 @@ int codes_get_length(const codes_handle* h, const char* key, size_t *length);
* @param value : the address of a long where the data will be retrieved
* @return 0 if OK, integer value on error
*/
int codes_get_long(codes_handle* h, const char* key, long* value);
int codes_get_long(const codes_handle* h, const char* key, long* value);
/**
* Get a double value from a key, if several keys of the same name are present, the last one is returned
@ -765,7 +765,7 @@ int codes_get_long(codes_handle* h, const char* key, long* value);
* @param value : the address of a double where the data will be retrieved
* @return 0 if OK, integer value on error
*/
int codes_get_double(codes_handle* h, const char* key, double* value);
int codes_get_double(const codes_handle* h, const char* key, double* value);
/**
* Get as double the i-th element of the "key" array
@ -776,7 +776,7 @@ int codes_get_double(codes_handle* h, const char* key, double* value);
* @param value : the address of a double where the data will be retrieved
* @return 0 if OK, integer value on error
*/
int codes_get_double_element(codes_handle* h, const char* key, int i, double* value);
int codes_get_double_element(const codes_handle* h, const char* key, int i, double* value);
/**
* Get as double array the elements of the "key" array whose indexes are listed in the input array i
@ -788,7 +788,7 @@ int codes_get_double_element(codes_handle* h, const char* key, int i, double* va
* @param value : the double array for the data values
* @return 0 if OK, integer value on error
*/
int codes_get_double_elements(codes_handle* h, const char* key, int* i, long size, double* value);
int codes_get_double_elements(const codes_handle* h, const char* key, int* i, 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
@ -800,7 +800,7 @@ int codes_get_double_elements(codes_handle* h, const char* key, int* i, long siz
* @param length : the address of a size_t that contains allocated length of the string on input, and that contains the actual length of the string on output
* @return 0 if OK, integer value on error
*/
int codes_get_string(codes_handle* h, const char* key, char* mesg, size_t *length);
int codes_get_string(const codes_handle* h, const char* key, char* mesg, size_t *length);
/**
* Get string array values from a key. If several keys of the same name are present, the last one is returned
@ -812,7 +812,7 @@ int codes_get_string(codes_handle* h, const char* key, char* mesg, size_t *lengt
* @param length : the address of a size_t that contains allocated length of the array on input, and that contains the actual length of the array on output
* @return 0 if OK, integer value on error
*/
int codes_get_string_array(codes_handle* h, const char* key, char** vals, size_t *length);
int codes_get_string_array(const codes_handle* h, const char* key, char** vals, size_t *length);
/**
* Get raw bytes values from a key. If several keys of the same name are present, the last one is returned
@ -824,7 +824,7 @@ int codes_get_string_array(codes_handle* h, const char* key, char** vals, size_t
* @param length : the address of a size_t that contains allocated length of the byte array on input, and that contains the actual length of the byte array on output
* @return 0 if OK, integer value on error
*/
int codes_get_bytes(codes_handle* h, const char* key, unsigned char* bytes, size_t *length);
int codes_get_bytes(const codes_handle* h, const char* key, unsigned char* bytes, size_t *length);
/**
* Get double array values from a key. If several keys of the same name are present, the last one is returned
@ -836,7 +836,7 @@ int codes_get_bytes(codes_handle* h, const char* key, unsigned char* bytes, size
* @param length : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output
* @return 0 if OK, integer value on error
*/
int codes_get_double_array(codes_handle* h, const char* key, double* vals, size_t *length);
int codes_get_double_array(const codes_handle* h, const char* key, double* vals, size_t *length);
/**
* Get long array values from a key. If several keys of the same name are present, the last one is returned
@ -848,7 +848,7 @@ int codes_get_double_array(codes_handle* h, const char* key, double* vals, size_
* @param length : the address of a size_t that contains allocated length of the long array on input, and that contains the actual length of the long array on output
* @return 0 if OK, integer value on error
*/
int codes_get_long_array(codes_handle* h, const char* key, long* vals, size_t *length);
int codes_get_long_array(const codes_handle* h, const char* key, long* vals, size_t *length);
/* setting data */
@ -1155,7 +1155,7 @@ int codes_keys_iterator_next(codes_keys_iterator *kiter);
* @param kiter : valid codes_keys_iterator
* @return key name
*/
const char* codes_keys_iterator_get_name(codes_keys_iterator *kiter);
const char* codes_keys_iterator_get_name(const codes_keys_iterator *kiter);
/*! Delete the keys iterator.
* @param kiter : valid codes_keys_iterator
@ -1171,10 +1171,10 @@ int codes_keys_iterator_rewind(codes_keys_iterator* kiter);
int codes_keys_iterator_set_flags(codes_keys_iterator *kiter, unsigned long flags);
int codes_keys_iterator_get_long(codes_keys_iterator *kiter, long *v, size_t *len);
int codes_keys_iterator_get_double(codes_keys_iterator *kiter, double *v, size_t *len);
int codes_keys_iterator_get_string(codes_keys_iterator *kiter, char *v, size_t *len);
int codes_keys_iterator_get_bytes(codes_keys_iterator *kiter, unsigned char *v, size_t *len);
int codes_keys_iterator_get_long(const codes_keys_iterator *kiter, long *v, size_t *len);
int codes_keys_iterator_get_double(const codes_keys_iterator *kiter, double *v, size_t *len);
int codes_keys_iterator_get_string(const codes_keys_iterator *kiter, char *v, size_t *len);
int codes_keys_iterator_get_bytes(const codes_keys_iterator *kiter, unsigned char *v, size_t *len);
/* @} */
@ -1189,7 +1189,7 @@ void codes_update_sections_lengths(codes_handle* h);
const char* codes_get_error_message(int code);
const char* codes_get_type_name(int type);
int codes_get_native_type(codes_handle* h, const char* name, int* type);
int codes_get_native_type(const codes_handle* h, const char* name, int* type);
void codes_check(const char* call, const char* file, int line, int e, const char* msg);
#define CODES_CHECK(a, msg) GRIB_CHECK(a, msg)
@ -1199,8 +1199,8 @@ void codes_check(const char* call, const char* file, int line, int e, const char
int codes_set_values(codes_handle* h, codes_values* codes_values, size_t arg_count);
codes_handle* codes_handle_new_from_partial_message_copy(codes_context* c, const void* data, size_t size);
codes_handle* codes_handle_new_from_partial_message(codes_context* c, const void* data, size_t buflen);
int codes_is_missing(codes_handle* h, const char* key, int* err);
int codes_is_defined(codes_handle* h, const char* key);
int codes_is_missing(const codes_handle* h, const char* key, int* err);
int codes_is_defined(const codes_handle* h, const char* key);
int codes_set_missing(codes_handle* h, const char* key);
/* The truncation is the Gaussian number (or order) */
int codes_get_gaussian_latitudes(long truncation, double* latitudes);

View File

@ -767,7 +767,7 @@ int grib_get_length(const grib_handle* h, const char* key,size_t *length);
* @param value : the address of a long where the data will be retrieved
* @return 0 if OK, integer value on error
*/
int grib_get_long(grib_handle* h, const char* key, long* value);
int grib_get_long(const grib_handle* h, const char* key, long* value);
/**
* Get a double value from a key, if several keys of the same name are present, the last one is returned
@ -778,7 +778,7 @@ int grib_get_long(grib_handle* h, const char* key, long* value);
* @param value : the address of a double where the data will be retrieved
* @return 0 if OK, integer value on error
*/
int grib_get_double(grib_handle* h, const char* key, double* value);
int grib_get_double(const grib_handle* h, const char* key, double* value);
/**
* Get as double the i-th element of the "key" array
@ -789,7 +789,7 @@ int grib_get_double(grib_handle* h, const char* key, double* value);
* @param value : the address of a double where the data will be retrieved
* @return 0 if OK, integer value on error
*/
int grib_get_double_element(grib_handle* h, const char* key, int i, double* value);
int grib_get_double_element(const grib_handle* h, const char* key, int i, double* value);
/**
* Get as double array the elements of the "key" array whose indexes are listed in the input array i
@ -801,7 +801,7 @@ int grib_get_double_element(grib_handle* h, const char* key, int i, double* valu
* @param value : the double array for the data values
* @return 0 if OK, integer value on error
*/
int grib_get_double_elements(grib_handle* h, const char* key, int* i, long size, double* value);
int grib_get_double_elements(const grib_handle* h, const char* key, int* i, 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
@ -813,7 +813,7 @@ int grib_get_double_elements(grib_handle* h, const char* key, int* i, long size,
* @param length : the address of a size_t that contains allocated length of the string on input, and that contains the actual length of the string on output
* @return 0 if OK, integer value on error
*/
int grib_get_string(grib_handle* h, const char* key, char* mesg, size_t *length);
int grib_get_string(const grib_handle* h, const char* key, char* mesg, size_t *length);
/**
* Get string array values from a key. If several keys of the same name are present, the last one is returned
@ -825,7 +825,7 @@ int grib_get_string(grib_handle* h, const char* key, char* mesg, size_t *length)
* @param length : the address of a size_t that contains allocated length of the array on input, and that contains the actual length of the array on output
* @return 0 if OK, integer value on error
*/
int grib_get_string_array(grib_handle* h, const char* key, char** vals, size_t *length);
int grib_get_string_array(const grib_handle* h, const char* key, char** vals, size_t *length);
/**
* Get raw bytes values from a key. If several keys of the same name are present, the last one is returned
@ -837,7 +837,7 @@ int grib_get_string_array(grib_handle* h, const char* key, char** vals, size_t *
* @param length : the address of a size_t that contains allocated length of the byte array on input, and that contains the actual length of the byte array on output
* @return 0 if OK, integer value on error
*/
int grib_get_bytes(grib_handle* h, const char* key, unsigned char* bytes, size_t *length);
int grib_get_bytes(const grib_handle* h, const char* key, unsigned char* bytes, size_t *length);
/**
* Get double array values from a key. If several keys of the same name are present, the last one is returned
* @see grib_set_double_array
@ -848,7 +848,7 @@ int grib_get_bytes(grib_handle* h, const char* key, unsigned char* bytes, size_
* @param length : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output
* @return 0 if OK, integer value on error
*/
int grib_get_double_array(grib_handle* h, const char* key, double* vals, size_t *length);
int grib_get_double_array(const grib_handle* h, const char* key, double* vals, size_t *length);
/**
* Get long array values from a key. If several keys of the same name are present, the last one is returned
@ -860,7 +860,7 @@ int grib_get_double_array(grib_handle* h, const char* key, double* vals, size_t
* @param length : the address of a size_t that contains allocated length of the long array on input, and that contains the actual length of the long array on output
* @return 0 if OK, integer value on error
*/
int grib_get_long_array(grib_handle* h, const char* key, long* vals, size_t *length);
int grib_get_long_array(const grib_handle* h, const char* key, long* vals, size_t *length);
/* setting data */
@ -1288,8 +1288,8 @@ int codes_bufr_keys_iterator_next(bufr_keys_iterator* kiter);
* @param kiter : valid grib_keys_iterator
* @return key name
*/
const char* grib_keys_iterator_get_name(grib_keys_iterator *kiter);
char* codes_bufr_keys_iterator_get_name(bufr_keys_iterator* kiter);
const char* grib_keys_iterator_get_name(const grib_keys_iterator *kiter);
char* codes_bufr_keys_iterator_get_name(const bufr_keys_iterator* kiter);
/*! Delete the iterator.
* @param kiter : valid grib_keys_iterator
@ -1307,10 +1307,10 @@ int codes_bufr_keys_iterator_rewind(bufr_keys_iterator* kiter);
int grib_keys_iterator_set_flags(grib_keys_iterator *kiter,unsigned long flags);
int grib_keys_iterator_get_long(grib_keys_iterator *kiter, long *v, size_t *len);
int grib_keys_iterator_get_double(grib_keys_iterator *kiter, double *v, size_t *len);
int grib_keys_iterator_get_string(grib_keys_iterator *kiter, char *v, size_t *len);
int grib_keys_iterator_get_bytes(grib_keys_iterator *kiter, unsigned char *v, size_t *len);
int grib_keys_iterator_get_long(const grib_keys_iterator *kiter, long *v, size_t *len);
int grib_keys_iterator_get_double(const grib_keys_iterator *kiter, double *v, size_t *len);
int grib_keys_iterator_get_string(const grib_keys_iterator *kiter, char *v, size_t *len);
int grib_keys_iterator_get_bytes(const grib_keys_iterator *kiter, unsigned char *v, size_t *len);
int codes_copy_key(grib_handle* h1,grib_handle* h2,const char* key,int type);
/* @} */
@ -1326,7 +1326,7 @@ void grib_update_sections_lengths(grib_handle* h);
const char* grib_get_error_message(int code);
const char* grib_get_type_name(int type);
int grib_get_native_type(grib_handle* h, const char* name,int* type);
int grib_get_native_type(const grib_handle* h, const char* name,int* type);
void grib_check(const char* call,const char* file,int line,int e,const char* msg);
#define GRIB_CHECK(a,msg) grib_check(#a,__FILE__,__LINE__,a,msg)
@ -1336,8 +1336,8 @@ void grib_check(const char* call,const char* file,int line,int e,const char* ms
int grib_set_values(grib_handle* h,grib_values* grib_values , size_t arg_count);
grib_handle* grib_handle_new_from_partial_message_copy(grib_context* c, const void* data, size_t size);
grib_handle* grib_handle_new_from_partial_message(grib_context* c, const void* data, size_t buflen);
int grib_is_missing(grib_handle* h, const char* key, int* err);
int grib_is_defined(grib_handle* h, const char* key);
int grib_is_missing(const grib_handle* h, const char* key, int* err);
int grib_is_defined(const grib_handle* h, const char* key);
int grib_set_missing(grib_handle* h, const char* key);
/* The truncation is the Gaussian number (or order) */
int grib_get_gaussian_latitudes(long truncation,double* latitudes);

View File

@ -1183,21 +1183,21 @@ grib_keys_iterator *grib_keys_iterator_new(grib_handle *h, unsigned long filter_
int grib_keys_iterator_set_flags(grib_keys_iterator *ki, unsigned long flags);
int grib_keys_iterator_rewind(grib_keys_iterator *ki);
int grib_keys_iterator_next(grib_keys_iterator *kiter);
const char *grib_keys_iterator_get_name(grib_keys_iterator *kiter);
const char *grib_keys_iterator_get_name(const grib_keys_iterator *kiter);
grib_accessor *grib_keys_iterator_get_accessor(grib_keys_iterator *kiter);
int grib_keys_iterator_delete(grib_keys_iterator *kiter);
int grib_keys_iterator_get_long(grib_keys_iterator *kiter, long *v, size_t *len);
int grib_keys_iterator_get_double(grib_keys_iterator *kiter, double *v, size_t *len);
int grib_keys_iterator_get_string(grib_keys_iterator *kiter, char *v, size_t *len);
int grib_keys_iterator_get_bytes(grib_keys_iterator *kiter, unsigned char *v, size_t *len);
int grib_keys_iterator_get_native_type(grib_keys_iterator *kiter);
int grib_keys_iterator_get_long(const grib_keys_iterator *kiter, long *v, size_t *len);
int grib_keys_iterator_get_double(const grib_keys_iterator *kiter, double *v, size_t *len);
int grib_keys_iterator_get_string(const grib_keys_iterator *kiter, char *v, size_t *len);
int grib_keys_iterator_get_bytes(const grib_keys_iterator *kiter, unsigned char *v, size_t *len);
int grib_keys_iterator_get_native_type(const grib_keys_iterator *kiter);
/* bufr_keys_iterator.c */
bufr_keys_iterator *codes_bufr_keys_iterator_new(grib_handle *h, unsigned long filter_flags);
bufr_keys_iterator *codes_bufr_data_section_keys_iterator_new(grib_handle *h);
int codes_bufr_keys_iterator_rewind(bufr_keys_iterator *ki);
int codes_bufr_keys_iterator_next(bufr_keys_iterator *kiter);
char *codes_bufr_keys_iterator_get_name(bufr_keys_iterator *kiter);
char *codes_bufr_keys_iterator_get_name(const bufr_keys_iterator *kiter);
grib_accessor *codes_bufr_keys_iterator_get_accessor(bufr_keys_iterator *kiter);
int codes_bufr_keys_iterator_delete(bufr_keys_iterator *kiter);
@ -1267,8 +1267,8 @@ int grib_is_missing_long(grib_accessor *a, long x);
int grib_is_missing_double(grib_accessor *a, double x);
int grib_is_missing_string(grib_accessor *a, unsigned char *x, size_t len);
int grib_accessor_is_missing(grib_accessor *a, int *err);
int grib_is_missing(grib_handle *h, const char *name, int *err);
int grib_is_defined(grib_handle *h, const char *name);
int grib_is_missing(const grib_handle *h, const char *name, int *err);
int grib_is_defined(const grib_handle *h, const char *name);
int grib_set_flag(grib_handle *h, const char *name, unsigned long flag);
int grib_set_double_array_internal(grib_handle *h, const char *name, const double *val, size_t length);
int grib_set_force_double_array(grib_handle *h, const char *name, const double *val, size_t length);
@ -1278,22 +1278,22 @@ int grib_set_long_array(grib_handle *h, const char *name, const long *val, size_
int grib_get_long_internal(grib_handle *h, const char *name, long *val);
int grib_is_in_dump(grib_handle *h, const char *name);
int grib_attributes_count(grib_accessor *a, size_t *size);
int grib_get_long(grib_handle *h, const char *name, long *val);
int grib_get_long(const grib_handle *h, const char *name, long *val);
int grib_get_double_internal(grib_handle *h, const char *name, double *val);
int grib_get_double(grib_handle *h, const char *name, double *val);
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(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(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, 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(grib_handle *h, const char *name, char *val, size_t *length);
int grib_get_bytes_internal(grib_handle *h, const char *name, unsigned char *val, size_t *length);
int grib_get_bytes(grib_handle *h, const char *name, unsigned char *val, size_t *length);
int grib_get_native_type(grib_handle *h, const char *name, int *type);
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);
int grib_get_bytes(const grib_handle *h, const char *name, unsigned char *val, size_t *length);
int grib_get_native_type(const grib_handle *h, const char *name, int *type);
const char *grib_get_accessor_class_name(grib_handle *h, const char *name);
int _grib_get_double_array_internal(grib_handle *h, grib_accessor *a, double *val, size_t buffer_len, size_t *decoded_length);
int grib_get_double_array_internal(grib_handle *h, const char *name, double *val, size_t *length);
int grib_get_double_array(grib_handle *h, const char *name, double *val, size_t *length);
int _grib_get_double_array_internal(const grib_handle *h, grib_accessor *a, double *val, size_t buffer_len, size_t *decoded_length);
int grib_get_double_array_internal(const grib_handle *h, const char *name, double *val, size_t *length);
int grib_get_double_array(const grib_handle *h, const char *name, double *val, size_t *length);
int _grib_get_string_length(grib_accessor *a, size_t *size);
int grib_get_string_length(const grib_handle *h, const char *name, size_t *size);
int _grib_get_size(const grib_handle *h, grib_accessor *a, size_t *size);
@ -1301,11 +1301,11 @@ int grib_get_size(const grib_handle *h, const char *name, size_t *size);
int grib_get_length(const grib_handle *h, const char *name, size_t *length);
int grib_get_count(grib_handle *h, const char *name, size_t *size);
int grib_get_offset(const grib_handle *h, const char *key, size_t *val);
int _grib_get_string_array_internal(grib_handle *h, grib_accessor *a, char **val, size_t buffer_len, size_t *decoded_length);
int grib_get_string_array(grib_handle *h, const char *name, char **val, size_t *length);
int _grib_get_long_array_internal(grib_handle *h, grib_accessor *a, long *val, size_t buffer_len, size_t *decoded_length);
int _grib_get_string_array_internal(const grib_handle *h, grib_accessor *a, char **val, size_t buffer_len, size_t *decoded_length);
int grib_get_string_array(const grib_handle *h, const char *name, char **val, size_t *length);
int _grib_get_long_array_internal(const grib_handle *h, grib_accessor *a, long *val, size_t buffer_len, size_t *decoded_length);
int grib_get_long_array_internal(grib_handle *h, const char *name, long *val, size_t *length);
int grib_get_long_array(grib_handle *h, const char *name, long *val, size_t *length);
int grib_get_long_array(const grib_handle *h, const char *name, long *val, size_t *length);
grib_key_value_list *grib_key_value_list_clone(grib_context *c, grib_key_value_list *list);
void grib_key_value_list_delete(grib_context *c, grib_key_value_list *kvl);
int grib_get_key_value_list(grib_handle *h, grib_key_value_list *list);

View File

@ -168,7 +168,7 @@ int grib_keys_iterator_next(grib_keys_iterator* kiter)
return kiter->current != NULL;
}
const char* grib_keys_iterator_get_name(grib_keys_iterator* kiter)
const char* grib_keys_iterator_get_name(const grib_keys_iterator* kiter)
{
/* if(kiter->name_space) */
Assert(kiter->current);
@ -192,27 +192,27 @@ int grib_keys_iterator_delete( grib_keys_iterator* kiter)
return 0;
}
int grib_keys_iterator_get_long(grib_keys_iterator* kiter,long* v,size_t* len)
int grib_keys_iterator_get_long(const grib_keys_iterator* kiter, long* v, size_t* len)
{
return grib_unpack_long( kiter->current,v,len);
}
int grib_keys_iterator_get_double(grib_keys_iterator* kiter,double* v,size_t* len)
int grib_keys_iterator_get_double(const grib_keys_iterator* kiter,double* v,size_t* len)
{
return grib_unpack_double( kiter->current,v,len);
}
int grib_keys_iterator_get_string(grib_keys_iterator* kiter,char* v,size_t* len)
int grib_keys_iterator_get_string(const grib_keys_iterator* kiter,char* v,size_t* len)
{
return grib_unpack_string( kiter->current,v,len);
}
int grib_keys_iterator_get_bytes(grib_keys_iterator* kiter,unsigned char* v,size_t* len)
int grib_keys_iterator_get_bytes(const grib_keys_iterator* kiter,unsigned char* v,size_t* len)
{
return grib_unpack_bytes( kiter->current,v,len);
}
int grib_keys_iterator_get_native_type(grib_keys_iterator* kiter)
int grib_keys_iterator_get_native_type(const grib_keys_iterator* kiter)
{
return grib_accessor_get_native_type(kiter->current);
}

View File

@ -586,14 +586,14 @@ int grib_accessor_is_missing(grib_accessor* a,int* err)
}
}
int grib_is_missing(grib_handle* h, const char* name,int* err)
int grib_is_missing(const grib_handle* h, const char* name,int* err)
{
grib_accessor* a = grib_find_accessor(h, name);
return grib_accessor_is_missing(a,err);
}
/* Return true if the given key exists (is defined) in our grib message */
int grib_is_defined(grib_handle* h, const char* name)
int grib_is_defined(const grib_handle* h, const char* name)
{
grib_accessor* a = grib_find_accessor(h, name);
return (a ? 1 : 0);
@ -868,7 +868,7 @@ int grib_attributes_count(grib_accessor* a, size_t* size)
return GRIB_NOT_FOUND;
}
int grib_get_long(grib_handle* h, const char* name, long* val)
int grib_get_long(const grib_handle* h, const char* name, long* val)
{
size_t length = 1;
grib_accessor* a = NULL;
@ -900,7 +900,7 @@ int grib_get_double_internal(grib_handle* h, const char* name, double* val)
return ret;
}
int grib_get_double(grib_handle* h, const char* name, double* val)
int grib_get_double(const grib_handle* h, const char* name, double* val)
{
size_t length = 1;
grib_accessor* a = NULL;
@ -932,7 +932,7 @@ int grib_get_double_element_internal(grib_handle* h, const char* name, int i,dou
return ret;
}
int grib_get_double_element(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)
{
grib_accessor* act = grib_find_accessor(h, name);
@ -957,7 +957,7 @@ int grib_points_get_values(grib_handle* h, grib_points* points, double* val)
return GRIB_SUCCESS;
}
int grib_get_double_elements(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, int* index_array, long len, double* val_array)
{
double* values=0;
int err=0;
@ -1016,7 +1016,7 @@ int grib_get_string_internal(grib_handle* h, const char* name, char* val, size_t
return ret;
}
int grib_get_string(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)
{
grib_accessor* a = NULL;
grib_accessors_list* al=NULL;
@ -1035,7 +1035,7 @@ int grib_get_string(grib_handle* h, const char* name, char* val, size_t *length)
}
}
int grib_get_bytes_internal(grib_handle* h, const char* name, unsigned char* val, size_t *length)
int grib_get_bytes_internal(const grib_handle* h, const char* name, unsigned char* val, size_t *length)
{
int ret = grib_get_bytes(h,name,val,length);
@ -1047,7 +1047,7 @@ int grib_get_bytes_internal(grib_handle* h, const char* name, unsigned char* val
return ret;
}
int grib_get_bytes(grib_handle* h, const char* name, unsigned char* val, size_t *length)
int grib_get_bytes(const grib_handle* h, const char* name, unsigned char* val, size_t *length)
{
int err=0;
grib_accessor* act = grib_find_accessor(h, name);
@ -1057,7 +1057,7 @@ int grib_get_bytes(grib_handle* h, const char* name, unsigned char* val, size_t
return err;
}
int grib_get_native_type(grib_handle* h, const char* name,int* type)
int grib_get_native_type(const grib_handle* h, const char* name,int* type)
{
grib_accessors_list* al=NULL;
grib_accessor* a =NULL;
@ -1085,7 +1085,7 @@ const char* grib_get_accessor_class_name(grib_handle* h, const char* name)
return act?act->cclass->name:NULL;
}
int _grib_get_double_array_internal(grib_handle* h,grib_accessor* a,double* val, size_t buffer_len,size_t *decoded_length)
int _grib_get_double_array_internal(const grib_handle* h,grib_accessor* a,double* val, size_t buffer_len,size_t *decoded_length)
{
if(a) {
int err = _grib_get_double_array_internal(h,a->same,val,buffer_len,decoded_length);
@ -1104,7 +1104,7 @@ int _grib_get_double_array_internal(grib_handle* h,grib_accessor* a,double* val,
}
}
int grib_get_double_array_internal(grib_handle* h, const char* name, double* val, size_t *length)
int grib_get_double_array_internal(const grib_handle* h, const char* name, double* val, size_t *length)
{
int ret = grib_get_double_array(h,name,val,length);
@ -1116,7 +1116,7 @@ int grib_get_double_array_internal(grib_handle* h, const char* name, double* val
return ret;
}
int grib_get_double_array(grib_handle* h, const char* name, double* val, size_t *length)
int grib_get_double_array(const grib_handle* h, const char* name, double* val, size_t *length)
{
size_t len = *length;
grib_accessor* a = NULL;
@ -1250,7 +1250,7 @@ int grib_get_offset(const grib_handle* ch, const char* key,size_t* val)
return GRIB_NOT_FOUND;
}
int _grib_get_string_array_internal(grib_handle* h,grib_accessor* a,char** val, size_t buffer_len,size_t *decoded_length)
int _grib_get_string_array_internal(const grib_handle* h,grib_accessor* a,char** val, size_t buffer_len,size_t *decoded_length)
{
if(a) {
int err = _grib_get_string_array_internal(h,a->same,val,buffer_len,decoded_length);
@ -1269,7 +1269,7 @@ int _grib_get_string_array_internal(grib_handle* h,grib_accessor* a,char** val,
}
}
int grib_get_string_array(grib_handle* h, const char* name, char** val, size_t *length)
int grib_get_string_array(const grib_handle* h, const char* name, char** val, size_t *length)
{
size_t len = *length;
grib_accessor* a = NULL;
@ -1294,7 +1294,7 @@ int grib_get_string_array(grib_handle* h, const char* name, char** val, size_t *
}
}
int _grib_get_long_array_internal(grib_handle* h,grib_accessor* a,long* val, size_t buffer_len,size_t *decoded_length)
int _grib_get_long_array_internal(const grib_handle* h,grib_accessor* a,long* val, size_t buffer_len,size_t *decoded_length)
{
if(a) {
int err = _grib_get_long_array_internal(h,a->same,val,buffer_len,decoded_length);
@ -1325,7 +1325,7 @@ int grib_get_long_array_internal(grib_handle* h, const char* name, long* val, si
return ret;
}
int grib_get_long_array(grib_handle* h, const char* name, long* val, size_t *length)
int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_t *length)
{
size_t len = *length;
grib_accessor* a = NULL;