mirror of https://github.com/ecmwf/eccodes.git
ECC-650: bufr_filter: outputs non-printable characters if string key is MISSING
This commit is contained in:
parent
7715022145
commit
f1bc8176b6
|
@ -315,7 +315,11 @@ int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const cha
|
|||
char sbuf[1024]={0,};
|
||||
len = sizeof(sbuf);
|
||||
ret = grib_unpack_string(al->accessor,sbuf,&len);
|
||||
fprintf(out,"%s",sbuf);
|
||||
if (grib_is_missing_string(al->accessor,(unsigned char *)sbuf,len)) {
|
||||
fprintf(out,"%s","MISSING");
|
||||
} else {
|
||||
fprintf(out,"%s",sbuf);
|
||||
}
|
||||
} else {
|
||||
int i=0;
|
||||
int cols=0;
|
||||
|
@ -391,7 +395,8 @@ int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const cha
|
|||
*newline=0;
|
||||
break;
|
||||
default:
|
||||
grib_context_log(h->context, GRIB_LOG_WARNING,"grib_accessor_print: Problem to print \"%s\", invalid type %d", a->name,type);
|
||||
grib_context_log(h->context, GRIB_LOG_WARNING,
|
||||
"grib_accessor_print: Problem printing \"%s\", invalid type %d", a->name, grib_get_type_name(type));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -470,13 +470,24 @@ EOF
|
|||
f="ship_9.bufr"
|
||||
echo "Test: get string" >> $fLog
|
||||
echo "file: $f" >> $fLog
|
||||
${tools_dir}/codes_bufr_filter $fRules $f 2>> $fLog 1>> $fLog
|
||||
|
||||
${tools_dir}/codes_bufr_filter $fRules $f 2> ${f}.log 1> ${f}.log
|
||||
cat > ${f}.ref <<EOF
|
||||
WYM9567
|
||||
echo "WYM9567" > ${f}.ref
|
||||
|
||||
diff ${f}.ref ${f}.log
|
||||
|
||||
rm -f ${f}.ref ${f}.log
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# Test: get string whose value is MISSING (ECC-650)
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
print "[shipOrMobileLandStationIdentifier]";
|
||||
EOF
|
||||
|
||||
f="btem_109.bufr"
|
||||
${tools_dir}/codes_bufr_filter $fRules $f 2> ${f}.log 1> ${f}.log
|
||||
echo "MISSING" > ${f}.ref
|
||||
diff ${f}.ref ${f}.log
|
||||
|
||||
rm -f ${f}.ref ${f}.log
|
||||
|
|
Loading…
Reference in New Issue