mirror of https://github.com/ecmwf/eccodes.git
ECC-1195: Accessor 'sprintf' should by default be read-only
This commit is contained in:
parent
7e41414f90
commit
bf767d87ef
|
@ -135,6 +135,7 @@ static void init(grib_accessor* a, const long l, grib_arguments* c)
|
|||
{
|
||||
grib_accessor_sprintf* self = (grib_accessor_sprintf*)a;
|
||||
self->args = c;
|
||||
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
||||
}
|
||||
|
||||
static int pack_string(grib_accessor* a, const char* val, size_t* len)
|
||||
|
|
|
@ -77,6 +77,8 @@ if( HAVE_BUILD_TOOLS )
|
|||
grib_ecc-1065
|
||||
grib_ecc-1167
|
||||
grib_ecc-1170
|
||||
grib_ecc-1195
|
||||
bufr_ecc-1195
|
||||
bufr_json_samples
|
||||
bufr_ecc-359
|
||||
bufr_ecc-517
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
# (C) Copyright 2005- ECMWF.
|
||||
#
|
||||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
. ./include.sh
|
||||
set -u
|
||||
REDIRECT=/dev/null
|
||||
label="bufr_ecc-1195-test"
|
||||
temp1=temp.$label.bufr
|
||||
temp2=temp.$label.txt
|
||||
sample_bufr4=$ECCODES_SAMPLES_PATH/BUFR4_local.tmpl
|
||||
|
||||
|
||||
set +e
|
||||
${tools_dir}/bufr_set -s localDate=20140102 $sample_bufr4 $temp1 2>$temp2
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "Value is read only" $temp2
|
||||
|
||||
|
||||
rm -f $temp1 $temp2
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/sh
|
||||
# (C) Copyright 2005- ECMWF.
|
||||
#
|
||||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
. ./include.sh
|
||||
set -u
|
||||
REDIRECT=/dev/null
|
||||
label="grib_ecc-1195-test"
|
||||
temp1=temp.$label.grib
|
||||
temp2=temp.$label.txt
|
||||
sample_grib1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
|
||||
sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
sample_bufr4=$ECCODES_SAMPLES_PATH/BUFR4_local.tmpl
|
||||
|
||||
|
||||
${tools_dir}/grib_set -s localDefinitionNumber=3 $sample_grib1 $temp1
|
||||
set +e
|
||||
${tools_dir}/grib_set -s marsIdent=0 $temp1 /dev/null 2>$temp2
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "Value is read only" $temp2
|
||||
|
||||
set +e
|
||||
${tools_dir}/grib_set -s indicatorOfTypeOfLevel=101,levels=1-1 $sample_grib1 $temp1 2>$temp2
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "Value is read only" $temp2
|
||||
|
||||
#set +e
|
||||
#${tools_dir}/bufr_set -s localDate=20140102 $sample_bufr4 $temp1 2>$temp2
|
||||
#status=$?
|
||||
#set -e
|
||||
#[ $status -ne 0 ]
|
||||
#grep -q "Value is read only" $temp2
|
||||
|
||||
|
||||
rm -f $temp1 $temp2
|
Loading…
Reference in New Issue