mirror of https://github.com/ecmwf/eccodes.git
ECC-1749: grib_dump: No gap between offsets and key name
This commit is contained in:
parent
e637b26e76
commit
6776116c11
|
@ -85,7 +85,6 @@ grib_dumper_class* grib_dumper_class_wmo = &_grib_dumper_class_wmo;
|
|||
|
||||
/* END_CLASS_IMP */
|
||||
static void set_begin_end(grib_dumper* d, grib_accessor* a);
|
||||
static void print_offset(FILE* out, long begin, long theEnd);
|
||||
static void print_hexadecimal(FILE* out, unsigned long flags, grib_accessor* a);
|
||||
|
||||
static void init_class(grib_dumper_class* c) {}
|
||||
|
@ -103,6 +102,18 @@ static int destroy(grib_dumper* d)
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
static void print_offset(FILE* out, long begin, long theEnd, int width=10)
|
||||
{
|
||||
char tmp[50];
|
||||
|
||||
if (begin == theEnd)
|
||||
fprintf(out, "%-*ld", width, begin);
|
||||
else {
|
||||
snprintf(tmp, sizeof(tmp), "%ld-%ld", begin, theEnd);
|
||||
fprintf(out, "%-*s", width, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
static void aliases(grib_dumper* d, grib_accessor* a)
|
||||
{
|
||||
int i;
|
||||
|
@ -438,7 +449,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
|
|||
is_char = 1;
|
||||
}
|
||||
|
||||
print_offset(self->dumper.out, self->begin, self->theEnd);
|
||||
print_offset(self->dumper.out, self->begin, self->theEnd, 12); // ECC-1749
|
||||
if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) {
|
||||
char type_name[32] = "";
|
||||
const long native_type = grib_accessor_get_native_type(a);
|
||||
|
@ -563,17 +574,6 @@ static void set_begin_end(grib_dumper* d, grib_accessor* a)
|
|||
}
|
||||
}
|
||||
|
||||
static void print_offset(FILE* out, long begin, long theEnd)
|
||||
{
|
||||
char tmp[50];
|
||||
if (begin == theEnd)
|
||||
fprintf(out, "%-10ld", begin);
|
||||
else {
|
||||
snprintf(tmp, sizeof(tmp), "%ld-%ld", begin, theEnd);
|
||||
fprintf(out, "%-10s", tmp);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_hexadecimal(FILE* out, unsigned long flags, grib_accessor* a)
|
||||
{
|
||||
int i = 0;
|
||||
|
|
|
@ -117,6 +117,13 @@ input=$data_dir/lfpw.grib1
|
|||
${tools_dir}/grib_dump -w count=1 -p SPD $input
|
||||
|
||||
|
||||
# ECC-1749: grib_dump: No gap between offsets and key name
|
||||
#-----------------------------------------------------------
|
||||
file=$data_dir/sst_globus0083.grib
|
||||
${tools_dir}/grib_dump -O $file > $temp 2>&1
|
||||
grep -q "12-10227752 codedValues" $temp
|
||||
|
||||
|
||||
# Error conditions
|
||||
#-----------------------------------------------------------
|
||||
file=$data_dir/sample.grib2
|
||||
|
|
Loading…
Reference in New Issue