mirror of https://github.com/ecmwf/eccodes.git
Tools: Dead code removal
This commit is contained in:
parent
6cff566ec9
commit
1458690dcf
|
@ -383,7 +383,7 @@ static void save_error(grib_context* c, const char* key)
|
|||
}
|
||||
}
|
||||
|
||||
static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_handle* h2, const char* name, int type)
|
||||
static int compare_values(const grib_runtime_options* options, grib_handle* h1, grib_handle* h2, const char* name, int type)
|
||||
{
|
||||
size_t len1 = 0;
|
||||
size_t len2 = 0;
|
||||
|
|
|
@ -452,7 +452,7 @@ static void save_error(grib_context* c, const char* key)
|
|||
}
|
||||
}
|
||||
|
||||
static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_handle* h2, const char* name, int type)
|
||||
static int compare_values(const grib_runtime_options* options, grib_handle* h1, grib_handle* h2, const char* name, int type)
|
||||
{
|
||||
size_t len1 = 0;
|
||||
size_t len2 = 0;
|
||||
|
@ -464,7 +464,6 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
|||
int isMissing1 = 0, isMissing2 = 0;
|
||||
|
||||
char *sval1 = NULL, *sval2 = NULL;
|
||||
unsigned char *uval1 = NULL, *uval2 = NULL;
|
||||
double *dval1 = NULL, *dval2 = NULL;
|
||||
long *lval1 = NULL, *lval2 = NULL;
|
||||
double maxdiff = 0;
|
||||
|
@ -760,54 +759,6 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
|||
printf(" as bytes\n");
|
||||
if (options->mode == MODE_METAR)
|
||||
return 0;
|
||||
if (len1 < 2)
|
||||
len1 = 512;
|
||||
if (len2 < 2)
|
||||
len2 = 512;
|
||||
uval1 = (unsigned char*)grib_context_malloc(h1->context, len1 * sizeof(unsigned char));
|
||||
uval2 = (unsigned char*)grib_context_malloc(h2->context, len2 * sizeof(unsigned char));
|
||||
|
||||
if ((err1 = grib_get_bytes(h1, name, uval1, &len1)) != GRIB_SUCCESS) {
|
||||
printInfo(h1);
|
||||
save_error(c, name);
|
||||
printf("Error: cannot get bytes value of [%s] in 1st field: %s\n",
|
||||
name, grib_get_error_message(err1));
|
||||
}
|
||||
|
||||
if ((err2 = grib_get_bytes(h2, name, uval2, &len2)) != GRIB_SUCCESS) {
|
||||
printInfo(h1);
|
||||
save_error(c, name);
|
||||
printf("Error: cannot get bytes value of [%s] in 2nd field: %s\n",
|
||||
name, grib_get_error_message(err2));
|
||||
}
|
||||
|
||||
if (err1 == GRIB_SUCCESS && err2 == GRIB_SUCCESS) {
|
||||
if (memcmp(uval1, uval2, len1) != 0) {
|
||||
for (i = 0; i < len1; i++)
|
||||
if (uval1[i] != uval2[i]) {
|
||||
printInfo(h1);
|
||||
save_error(c, name);
|
||||
if (len1 == 1)
|
||||
printf("[%s] byte values are different: [%02x] and [%02x]\n",
|
||||
name, uval1[i], uval2[i]);
|
||||
else
|
||||
printf("[%s] byte value %d of %ld are different: [%02x] and [%02x]\n",
|
||||
name, i, (long)len1, uval1[i], uval2[i]);
|
||||
|
||||
err1 = GRIB_VALUE_MISMATCH;
|
||||
break;
|
||||
}
|
||||
err1 = GRIB_VALUE_MISMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
grib_context_free(h1->context, uval1);
|
||||
grib_context_free(h2->context, uval2);
|
||||
|
||||
if (err1)
|
||||
return err1;
|
||||
if (err2)
|
||||
return err2;
|
||||
break;
|
||||
|
||||
case GRIB_TYPE_LABEL:
|
||||
|
|
Loading…
Reference in New Issue