Compiler warnings: -Wformat-overflow

This commit is contained in:
Shahram Najm 2021-02-24 17:04:34 +00:00
parent d5f43831a7
commit aaf513ff55
2 changed files with 10 additions and 10 deletions

View File

@ -205,7 +205,7 @@ static int build_long_array(grib_context* c, grib_handle* h, int compressed,
}
else {
/* uncompressed */
char keystr[20] = {0,};
char keystr[32] = {0,};
size_t values_len = 0;
for (i = 0; i < numberOfSubsets; ++i) {
long lVal = 0;
@ -243,12 +243,12 @@ static int select_datetime(grib_accessor* a)
grib_iarray* subsets;
long* subsets_ar = 0;
size_t nsubsets = 0;
char yearstr[20] = "year";
char monthstr[20] = "month";
char daystr[20] = "day";
char hourstr[20] = "hour";
char minutestr[20] = "minute";
char secondstr[20] = "second";
char yearstr[32] = "year";
char monthstr[32] = "month";
char daystr[32] = "day";
char hourstr[32] = "hour";
char minutestr[32] = "minute";
char secondstr[32] = "second";
ret = grib_get_long(h, "compressedData", &compressed);
if (ret)

View File

@ -997,8 +997,8 @@ grib_index* grib_index_read(grib_context* c, const char* filename, int* err)
int grib_index_search_same(grib_index* index, grib_handle* h)
{
int err = 0;
char buf[1024] = {0,};
size_t buflen = 1024;
char buf[STRING_VALUE_LEN] = {0,};
size_t buflen = STRING_VALUE_LEN;
grib_index_key* keys;
long lval = 0;
double dval = 0.0;
@ -1016,7 +1016,7 @@ int grib_index_search_same(grib_index* index, grib_handle* h)
if (err)
keys->type = GRIB_TYPE_STRING;
}
buflen = 1024;
buflen = STRING_VALUE_LEN;
switch (keys->type) {
case GRIB_TYPE_STRING:
err = grib_get_string(h, keys->name, buf, &buflen);