mirror of https://github.com/ecmwf/eccodes.git
Examples: cppcheck warnings
This commit is contained in:
parent
1631acfa9f
commit
17cf9edcd4
|
@ -62,6 +62,7 @@ int main(int argc, char** argv)
|
|||
h = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err);
|
||||
if (h == NULL) {
|
||||
fprintf(stderr, "Error: unable to create handle from file %s\n", infile);
|
||||
fclose(out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ int main(int argc, char** argv)
|
|||
h = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err);
|
||||
if (h == NULL) {
|
||||
fprintf(stderr, "Error: unable to create handle from file %s\n", infile);
|
||||
fclose(out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ int main(int argc, char** argv)
|
|||
h = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err);
|
||||
if (h == NULL) {
|
||||
fprintf(stderr, "Error: unable to create handle from file %s\n", infile);
|
||||
fclose(out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,10 +47,11 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* create a new handle from a message in a file */
|
||||
/* create a new GRIB handle from a message in a file */
|
||||
h = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err);
|
||||
if (h == NULL) {
|
||||
fprintf(stderr, "Error: unable to create handle from file %s\n", infile);
|
||||
fclose(out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ int main(int argc, char** argv)
|
|||
h = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err);
|
||||
if (h == NULL) {
|
||||
fprintf(stderr, "Error: unable to create handle from file %s\n", infile);
|
||||
fclose(out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,15 +17,17 @@ int main()
|
|||
{
|
||||
const int ni = 2880;
|
||||
const int nj = 2880;
|
||||
size_t numbytes = 0;
|
||||
double* values;
|
||||
int i = 0;
|
||||
codes_handle* h = NULL;
|
||||
const char* filename = "bigfile.grib";
|
||||
|
||||
values = (double*)malloc(ni * nj * sizeof(double));
|
||||
numbytes = ni * nj * sizeof(double);
|
||||
values = (double*)malloc(numbytes);
|
||||
if (!values) {
|
||||
printf("Malloc failed - requested %lu bytes\n", ni * nj * sizeof(double));
|
||||
exit(1);
|
||||
printf("Malloc failed - requested %lu bytes\n", (unsigned long)numbytes);
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < ni * nj; i++) {
|
||||
|
|
Loading…
Reference in New Issue