mirror of https://github.com/ecmwf/eccodes.git
Compiler warnings: use '%zu' in the format string for size_t
This commit is contained in:
parent
4af2d942dd
commit
0644fdc346
|
@ -178,7 +178,7 @@ int main(int argc, char* argv[])
|
|||
realloc_and_fill(&tdVal, sizews, -999999999.0);
|
||||
}
|
||||
/* Print the values */
|
||||
printf("Ob: %7d %s %ld %ld %7.3f %7.3f %7.1f %7.1f %4ld %5lu\n",
|
||||
printf("Ob: %7d %s %ld %ld %7.3f %7.3f %7.1f %7.1f %4ld %5zu\n",
|
||||
count, statid, ymd, hms, lat[0], lon[0], htg, htp, sondeType, sizews);
|
||||
if (status_rsno == CODES_SUCCESS) {
|
||||
printf("RS number/software/balloonwt: %s %s %7.3f\n", rsnumber, rssoftware, balloonwt);
|
||||
|
@ -190,7 +190,7 @@ int main(int argc, char* argv[])
|
|||
for (i = 0; i < sizews; ++i) {
|
||||
long iflag = vssVal[i];
|
||||
if (!llstdonly || BTEST(iflag, 16)) {
|
||||
printf("%5lu %6ld %7.3f %7.3f %9.1f %8.1f %8.2f %8.2f %8.2f %8.2f %8ld\n",
|
||||
printf("%5zu %6ld %7.3f %7.3f %9.1f %8.1f %8.2f %8.2f %8.2f %8.2f %8ld\n",
|
||||
i + 1, timeVal[i],
|
||||
dlatVal[i], dlonVal[i],
|
||||
presVal[i], zVal[i], tVal[i], tdVal[i],
|
||||
|
|
|
@ -111,7 +111,7 @@ static int read_the_rest(reader* r, size_t message_length, unsigned char* tmp, i
|
|||
if ((r->read(r->read_data, buffer + already_read, rest, &err) != rest) || err) {
|
||||
/*fprintf(stderr, "read_the_rest: r->read failed: %s\n", grib_get_error_message(err));*/
|
||||
if (c->debug)
|
||||
fprintf(stderr, "ECCODES DEBUG read_the_rest: Read failed (Coded length=%lu, Already read=%d)\n",
|
||||
fprintf(stderr, "ECCODES DEBUG read_the_rest: Read failed (Coded length=%zu, Already read=%d)\n",
|
||||
message_length, already_read);
|
||||
return err;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ static int read_the_rest(reader* r, size_t message_length, unsigned char* tmp, i
|
|||
buffer[message_length - 1] != '7'))
|
||||
{
|
||||
if (c->debug)
|
||||
fprintf(stderr, "ECCODES DEBUG read_the_rest: No final 7777 at expected location (Coded length=%lu)\n", message_length);
|
||||
fprintf(stderr, "ECCODES DEBUG read_the_rest: No final 7777 at expected location (Coded length=%zu)\n", message_length);
|
||||
return GRIB_WRONG_LENGTH;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,30 +58,30 @@ int main(int argc, char** argv)
|
|||
if (line[0] == '#') continue; /* Ignore first line with column titles */
|
||||
list = string_split(line, "|");
|
||||
if (!list) {
|
||||
fprintf(stderr, "Error on line %lu: string_split failed!\n", line_number);
|
||||
fprintf(stderr, "Error on line %zu: string_split failed!\n", line_number);
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; list[i] != NULL; ++i) {} /* count how many tokens */
|
||||
if (i < MIN_NUM_COLUMNS) {
|
||||
fprintf(stderr, "Error on line %lu: Number of columns (=%lu) < required miniumum (=%lu)!\n",
|
||||
fprintf(stderr, "Error on line %zu: Number of columns (=%zu) < required miniumum (=%zu)!\n",
|
||||
line_number, i, MIN_NUM_COLUMNS);
|
||||
return 1;
|
||||
}
|
||||
str_code = list[0];
|
||||
if (string_to_long(str_code, &lValue) != GRIB_SUCCESS) {
|
||||
fprintf(stderr, "Error on line %lu: descriptor code '%s' (column 1) is not numeric.\n",
|
||||
fprintf(stderr, "Error on line %zu: descriptor code '%s' (column 1) is not numeric.\n",
|
||||
line_number, str_code);
|
||||
return 1;
|
||||
}
|
||||
if (strlen(str_code) != NUM_DESCRIPTOR_DIGITS) {
|
||||
fprintf(stderr, "Error on line %lu: descriptor code '%s' (column 1) is not %lu digits.\n",
|
||||
fprintf(stderr, "Error on line %zu: descriptor code '%s' (column 1) is not %lu digits.\n",
|
||||
line_number, str_code, NUM_DESCRIPTOR_DIGITS);
|
||||
return 1;
|
||||
}
|
||||
str_key = list[1];
|
||||
str_type = list[2];
|
||||
if (check_descriptor_type(str_type) != GRIB_SUCCESS) {
|
||||
fprintf(stderr, "Error on line %lu: descriptor key type '%s' (column 3) is not valid.\n",
|
||||
fprintf(stderr, "Error on line %zu: descriptor key type '%s' (column 3) is not valid.\n",
|
||||
line_number, str_type);
|
||||
fprintf(stderr, "Please choose one of:\n");
|
||||
for (i = 0; i < NUMBER(allowed_types); ++i) {
|
||||
|
@ -90,7 +90,7 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
if (strlen(str_key) >= maxlen_keyName) {
|
||||
fprintf(stderr, "Error on line %lu: descriptor key name '%s' (column 2) exceeds %lu characters.\n",
|
||||
fprintf(stderr, "Error on line %zu: descriptor key name '%s' (column 2) exceeds %lu characters.\n",
|
||||
line_number, str_key, maxlen_keyName);
|
||||
return 1;
|
||||
}
|
||||
|
@ -104,17 +104,17 @@ int main(int argc, char** argv)
|
|||
str_ref = list[6];
|
||||
str_width = list[7];
|
||||
if (string_to_long(str_scale, &lValue) != GRIB_SUCCESS) {
|
||||
fprintf(stderr, "Error on line %lu: descriptor scale '%s' (column 6) is not numeric.\n",
|
||||
fprintf(stderr, "Error on line %zu: descriptor scale '%s' (column 6) is not numeric.\n",
|
||||
line_number, str_scale);
|
||||
return 1;
|
||||
}
|
||||
if (string_to_long(str_ref, &lValue) != GRIB_SUCCESS) {
|
||||
fprintf(stderr, "Error on line %lu: descriptor reference '%s' (column 7) is not numeric.\n",
|
||||
fprintf(stderr, "Error on line %zu: descriptor reference '%s' (column 7) is not numeric.\n",
|
||||
line_number, str_ref);
|
||||
return 1;
|
||||
}
|
||||
if (string_to_long(str_width, &lValue) != GRIB_SUCCESS) {
|
||||
fprintf(stderr, "Error on line %lu: descriptor width '%s' (column 8) is not numeric.\n",
|
||||
fprintf(stderr, "Error on line %zu: descriptor width '%s' (column 8) is not numeric.\n",
|
||||
line_number, str_width);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -24848,7 +24848,7 @@ int main(int argc, char** argv)
|
|||
for (i = 0; i < values_len; i++) {
|
||||
const double diff = fabs(values[i] - vals[i]);
|
||||
if (diff > EPSILON) {
|
||||
fprintf(stderr, "Unpacked value different at i=%lu: original=%.7f decoded=%.7f\n",
|
||||
fprintf(stderr, "Unpacked value different at i=%zu: original=%.7f decoded=%.7f\n",
|
||||
i, values[i], vals[i]);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
|
|||
values = (double*)malloc(size * sizeof(double));
|
||||
/*last_size = size;*/
|
||||
if (!values) {
|
||||
fprintf(stderr, "Failed to allocate memory for values (%lu bytes)\n", size * sizeof(double));
|
||||
fprintf(stderr, "Failed to allocate memory for values (%zu bytes)\n", size * sizeof(double));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue