ECC-134: Case-sensitivity of codetable keys

This commit is contained in:
Shahram Najm 2015-06-23 13:34:03 +01:00
parent f7133a116e
commit c6b93677dd
2 changed files with 24 additions and 2 deletions

View File

@ -595,10 +595,10 @@ static int pack_string(grib_accessor* a, const char* buffer, size_t *len)
typedef int (*cmpproc)(const char*, const char*);
#ifndef ECCODES_ON_WINDOWS
cmpproc cmp = (a->flags | GRIB_ACCESSOR_FLAG_LOWERCASE) ? grib_strcasecmp : strcmp;
cmpproc cmp = (a->flags & GRIB_ACCESSOR_FLAG_LOWERCASE) ? grib_strcasecmp : strcmp;
#else
/* Microsoft Windows Visual Studio support */
cmpproc cmp = (a->flags | GRIB_ACCESSOR_FLAG_LOWERCASE) ? stricmp : strcmp;
cmpproc cmp = (a->flags & GRIB_ACCESSOR_FLAG_LOWERCASE) ? stricmp : strcmp;
#endif
if(!self->table) self->table = load_table(self);

View File

@ -73,5 +73,27 @@ hourEnd=$1; dayEnd=$2
[ "$hourEnd" = "0" ]
[ "$dayEnd" = "6" ]
# ECC-134 case-sensitivity
grib1_sample=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
grib2_sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
temp=temp.step.$$.grib
# M is for Month (code 3)
${tools_dir}grib_set -s indicatorOfUnitOfTimeRange=M $grib1_sample $temp
unit=`${tools_dir}grib_get -p unitOfTimeRange $temp`
[ "$unit" = "3" ]
${tools_dir}grib_set -s indicatorOfUnitOfTimeRange=M $grib2_sample $temp
unit=`${tools_dir}grib_get -p indicatorOfUnitOfTimeRange $temp`
[ "$unit" = "3" ]
# m is for Minute (code 0)
${tools_dir}grib_set -s indicatorOfUnitOfTimeRange=m $grib1_sample $temp
unit=`${tools_dir}grib_get -p unitOfTimeRange $temp`
[ "$unit" = "0" ]
${tools_dir}grib_set -s indicatorOfUnitOfTimeRange=m $grib2_sample $temp
unit=`${tools_dir}grib_get -p indicatorOfUnitOfTimeRange $temp`
[ "$unit" = "0" ]
rm -f $temp
rm -f $grib2File.p8tmp ${grib2File}.tmp | true
rm -f x.grib