mirror of https://github.com/ecmwf/eccodes.git
Add asserts in debug mode for offsets
This commit is contained in:
parent
27cba79788
commit
ea8602e0d0
|
@ -199,6 +199,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
|
|||
NS=(MS+1)*(MS+2);
|
||||
|
||||
if ( bpv != 0 ) {
|
||||
DebugAssert( offsetAfterData > offsetBeforeData );
|
||||
*val =((offsetAfterData-offsetBeforeData)*8-unusedBits+NS*(bpv-32))/bpv;
|
||||
} else {
|
||||
if((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues,&numberOfValues)) != GRIB_SUCCESS)
|
||||
|
|
|
@ -176,6 +176,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
|
|||
return ret;
|
||||
|
||||
if ( bpv != 0 ) {
|
||||
DebugAssert( offsetAfterData > offsetBeforeData );
|
||||
*val=((offsetAfterData-offsetBeforeData)*8-unusedBits)/bpv;
|
||||
} else {
|
||||
if((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues,&numberOfValues)) != GRIB_SUCCESS)
|
||||
|
|
|
@ -177,8 +177,9 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
|
|||
return ret;
|
||||
|
||||
if ( bpv != 0 ) {
|
||||
grib_context_log(a->context,GRIB_LOG_DEBUG,"grib_accessor_number_of_coded_values: offsetAfterData=%ld offsetBeforeData=%ld unusedBits=%ld bpv=%ld\n",
|
||||
offsetAfterData,offsetBeforeData,unusedBits,bpv);
|
||||
grib_context_log(a->context,GRIB_LOG_DEBUG,"grib_accessor_number_of_coded_values: offsetAfterData=%ld offsetBeforeData=%ld unusedBits=%ld bpv=%ld\n",
|
||||
offsetAfterData,offsetBeforeData,unusedBits,bpv);
|
||||
DebugAssert( offsetAfterData > offsetBeforeData );
|
||||
*val=((offsetAfterData-offsetBeforeData)*8-unusedBits)/bpv;
|
||||
} else {
|
||||
if((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues,&numberOfValues)) != GRIB_SUCCESS)
|
||||
|
|
Loading…
Reference in New Issue