Fix logging format strings

This commit is contained in:
Shahram Najm 2020-10-13 13:52:59 +01:00
parent a86668a608
commit c59a4badb0
7 changed files with 25 additions and 25 deletions

View File

@ -407,7 +407,7 @@ bufr_descriptor* accessor_bufr_elements_table_get_descriptor(grib_accessor* a, i
v = (bufr_descriptor*)grib_context_malloc_clear(c, sizeof(bufr_descriptor));
if (!v) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_bufr_descriptor_new unable to allocate %d bytes\n", sizeof(bufr_descriptor));
"grib_bufr_descriptor_new unable to allocate %ld bytes\n", sizeof(bufr_descriptor));
*err = GRIB_OUT_OF_MEMORY;
return NULL;
}

View File

@ -461,7 +461,7 @@ static int grib_load_codetable(grib_context* c, const char* filename,
}
if (code < 0 || code >= size) {
grib_context_log(c, GRIB_LOG_WARNING, "code_table_entry: invalid code in %s: %d (table size=%d)", filename, code, size);
grib_context_log(c, GRIB_LOG_WARNING, "code_table_entry: invalid code in %s: %d (table size=%ld)", filename, code, size);
continue;
}
@ -502,7 +502,7 @@ static int grib_load_codetable(grib_context* c, const char* filename,
Assert(*title);
if (t->entries[code].abbreviation != NULL) {
grib_context_log(c, GRIB_LOG_WARNING, "code_table_entry: duplicate code in %s: %d (table size=%d)", filename, code, size);
grib_context_log(c, GRIB_LOG_WARNING, "code_table_entry: duplicate code in %s: %d (table size=%ld)", filename, code, size);
continue;
}

View File

@ -165,7 +165,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
ar = (long*)grib_context_malloc_clear(c, size * sizeof(long));
if (!ar) {
grib_context_log(c, GRIB_LOG_ERROR, "unable to allocate %d bytes", size * sizeof(long));
grib_context_log(c, GRIB_LOG_ERROR, "unable to allocate %ld bytes", size * sizeof(long));
return GRIB_OUT_OF_MEMORY;
}
@ -198,7 +198,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
ar = (long*)grib_context_malloc_clear(c, size * sizeof(long));
if (!ar) {
grib_context_log(c, GRIB_LOG_ERROR, "unable to allocate %d bytes", size * sizeof(long));
grib_context_log(c, GRIB_LOG_ERROR, "unable to allocate %ld bytes", size * sizeof(long));
return GRIB_OUT_OF_MEMORY;
}

View File

@ -237,7 +237,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
lats = (double*)grib_context_malloc(c, sizeof(double) * N * 2);
if (!lats) {
grib_context_log(c, GRIB_LOG_ERROR,
"global_gaussian unpack_long: Memory allocation error: %d bytes", sizeof(double) * N * 2);
"global_gaussian unpack_long: Memory allocation error: %ld bytes", sizeof(double) * N * 2);
return GRIB_OUT_OF_MEMORY;
}
if ((ret = grib_get_gaussian_latitudes(N, lats)) != GRIB_SUCCESS)
@ -323,7 +323,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
lats = (double*)grib_context_malloc(c, sizeof(double) * N * 2);
if (!lats) {
grib_context_log(c, GRIB_LOG_FATAL,
"global_gaussian pack_long: Memory allocation error: %d bytes", sizeof(double) * N * 2);
"global_gaussian pack_long: Memory allocation error: %ld bytes", sizeof(double) * N * 2);
return GRIB_OUT_OF_MEMORY;
}
if ((ret = grib_get_gaussian_latitudes(N, lats)) != GRIB_SUCCESS)

View File

@ -78,7 +78,7 @@ int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type)
sizeof(long) * GRIB_START_ARRAY_SIZE);
if (!set->columns[id].long_values) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_fieldset_new_column : Cannot malloc %d bytes",
"grib_fieldset_new_column : Cannot malloc %ld bytes",
sizeof(long) * GRIB_START_ARRAY_SIZE);
err = GRIB_OUT_OF_MEMORY;
return err;
@ -89,7 +89,7 @@ int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type)
sizeof(double) * GRIB_START_ARRAY_SIZE);
if (!set->columns[id].double_values) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_fieldset_new_column : Cannot malloc %d bytes",
"grib_fieldset_new_column : Cannot malloc %ld bytes",
sizeof(double) * GRIB_START_ARRAY_SIZE);
err = GRIB_OUT_OF_MEMORY;
return err;
@ -100,7 +100,7 @@ int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type)
sizeof(char*) * GRIB_START_ARRAY_SIZE);
if (!set->columns[id].string_values) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_fieldset_new_column : Cannot malloc %d bytes",
"grib_fieldset_new_column : Cannot malloc %ld bytes",
sizeof(char*) * GRIB_START_ARRAY_SIZE);
err = GRIB_OUT_OF_MEMORY;
return err;
@ -178,7 +178,7 @@ static int grib_fieldset_columns_resize(grib_fieldset* set, size_t newsize)
newsize * sizeof(long));
if (!newlongs) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_fieldset_columns_resize : Cannot malloc %d bytes", newsize - set->columns[i].values_array_size);
"grib_fieldset_columns_resize : Cannot malloc %ld bytes", newsize - set->columns[i].values_array_size);
return GRIB_OUT_OF_MEMORY;
}
else
@ -189,7 +189,7 @@ static int grib_fieldset_columns_resize(grib_fieldset* set, size_t newsize)
newsize * sizeof(double));
if (!newdoubles) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_fieldset_columns_resize : Cannot malloc %d bytes", newsize - set->columns[i].values_array_size);
"grib_fieldset_columns_resize : Cannot malloc %ld bytes", newsize - set->columns[i].values_array_size);
return GRIB_OUT_OF_MEMORY;
}
else
@ -200,7 +200,7 @@ static int grib_fieldset_columns_resize(grib_fieldset* set, size_t newsize)
newsize * sizeof(char*));
if (!newstrings) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_fieldset_columns_resize : Cannot malloc %d bytes", newsize - set->columns[i].values_array_size);
"grib_fieldset_columns_resize : Cannot malloc %ld bytes", newsize - set->columns[i].values_array_size);
return GRIB_OUT_OF_MEMORY;
}
else
@ -210,8 +210,8 @@ static int grib_fieldset_columns_resize(grib_fieldset* set, size_t newsize)
newerrors = (int*)grib_context_realloc(c, set->columns[i].errors, newsize * sizeof(int));
if (!newerrors) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_fieldset_columns_resize : Cannot malloc %d bytes",
set->columns[i].errors, newsize * sizeof(int));
"grib_fieldset_columns_resize : Cannot malloc %ld bytes",
newsize * sizeof(int));
return GRIB_OUT_OF_MEMORY;
}
else
@ -333,7 +333,7 @@ static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, char** key
set = (grib_fieldset*)grib_context_malloc_clear(c, msize);
if (!set) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_fieldset_create : Cannot malloc %d bytes", msize);
"grib_fieldset_create : Cannot malloc %ld bytes", msize);
return NULL;
}
@ -785,7 +785,7 @@ static grib_int_array* grib_fieldset_create_int_array(grib_context* c, size_t si
if (!a) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_fieldset_create_int_array : Cannot malloc %d bytes",
"grib_fieldset_create_int_array : Cannot malloc %ld bytes",
sizeof(grib_int_array));
return NULL;
}
@ -793,7 +793,7 @@ static grib_int_array* grib_fieldset_create_int_array(grib_context* c, size_t si
a->el = (int*)grib_context_malloc_clear(c, sizeof(int) * size);
if (!a->el) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_fieldset_create_int_array : Cannot malloc %d bytes",
"grib_fieldset_create_int_array : Cannot malloc %ld bytes",
sizeof(int) * size);
return NULL;
}

View File

@ -249,7 +249,7 @@ static grib_index_key* grib_index_new_key(grib_context* c, grib_index_key* keys,
next = (grib_index_key*)grib_context_malloc_clear(c, sizeof(grib_index_key));
if (!next) {
grib_context_log(c, GRIB_LOG_ERROR,
"unable to allocate %d bytes",
"unable to allocate %ld bytes",
sizeof(grib_index_key));
*err = GRIB_OUT_OF_MEMORY;
return NULL;
@ -257,7 +257,7 @@ static grib_index_key* grib_index_new_key(grib_context* c, grib_index_key* keys,
values = (grib_string_list*)grib_context_malloc_clear(c, sizeof(grib_string_list));
if (!values) {
grib_context_log(c, GRIB_LOG_ERROR,
"unable to allocate %d bytes",
"unable to allocate %ld bytes",
sizeof(grib_string_list));
*err = GRIB_OUT_OF_MEMORY;
return NULL;

View File

@ -117,7 +117,7 @@ static int find(grib_nearest* nearest, grib_handle* h,
values = (double*)grib_context_malloc_clear(h->context, sizeof(double) * size);
if (!values) {
grib_context_log(h->context, GRIB_LOG_ERROR,
"nearest_sh: Error allocating %d bytes",
"nearest_sh: Error allocating %ld bytes",
sizeof(double) * size);
return GRIB_OUT_OF_MEMORY;
}
@ -259,14 +259,14 @@ static int grib_invtrans(grib_context* context, int L, double latdeg, double lon
c = (double*)grib_context_malloc_clear(context, sizeof(double) * Lp1);
if (!c) {
grib_context_log(context, GRIB_LOG_ERROR,
"nearest_sh: Error allocating %d bytes", sizeof(double) * Lp1);
"nearest_sh: Error allocating %ld bytes", sizeof(double) * Lp1);
return GRIB_OUT_OF_MEMORY;
}
s = (double*)grib_context_malloc_clear(context, sizeof(double) * Lp1);
if (!s) {
grib_context_log(context, GRIB_LOG_ERROR,
"nearest_sh: Error allocating %d bytes", sizeof(double) * Lp1);
"nearest_sh: Error allocating %ld bytes", sizeof(double) * Lp1);
return GRIB_OUT_OF_MEMORY;
}
@ -275,13 +275,13 @@ static int grib_invtrans(grib_context* context, int L, double latdeg, double lon
TR = (double*)grib_context_malloc_clear(context, sizeof(double) * Lp1);
if (!TR) {
grib_context_log(context, GRIB_LOG_ERROR,
"nearest_sh: Error allocating %d bytes", sizeof(double) * Lp1);
"nearest_sh: Error allocating %ld bytes", sizeof(double) * Lp1);
return GRIB_OUT_OF_MEMORY;
}
TI = (double*)grib_context_malloc_clear(context, sizeof(double) * Lp1);
if (!TI) {
grib_context_log(context, GRIB_LOG_ERROR,
"nearest_sh: Error allocating %d bytes", sizeof(double) * Lp1);
"nearest_sh: Error allocating %ld bytes", sizeof(double) * Lp1);
return GRIB_OUT_OF_MEMORY;
}