mirror of https://github.com/ecmwf/eccodes.git
Compiler warning re strncpy
This commit is contained in:
parent
36b4da6fc3
commit
f6a7672e59
|
@ -2148,9 +2148,9 @@ int grib_f_print(int* gid, char* key, int len){
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int grib_f_get_error_string_(int* err, char* buf, int len){
|
int grib_f_get_error_string_(int* err, char* buf, int len){
|
||||||
const char* err_msg = grib_get_error_message(*err);
|
const char* err_msg = grib_get_error_message(*err);
|
||||||
size_t erlen = strlen(err_msg);
|
const size_t erlen = strlen(err_msg);
|
||||||
if( len < erlen) return GRIB_ARRAY_TOO_SMALL;
|
if( len < erlen) return GRIB_ARRAY_TOO_SMALL;
|
||||||
strncpy(buf, err_msg,(size_t)erlen);
|
strncpy(buf, err_msg,(size_t)len);
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
int grib_f_get_error_string__(int* err, char* buf, int len){
|
int grib_f_get_error_string__(int* err, char* buf, int len){
|
||||||
|
|
Loading…
Reference in New Issue