mirror of https://github.com/ecmwf/eccodes.git
Rename macro: Assert -> ECCODES_ASSERT
This commit is contained in:
parent
57ccd4b616
commit
9a621fc454
|
@ -237,7 +237,7 @@ static int push_file(FILE* f, const char* open_mode, char* buffer)
|
|||
|
||||
if(!file_set){
|
||||
file_set = (l_grib_file*)malloc(sizeof(l_grib_file));
|
||||
Assert(file_set);
|
||||
ECCODES_ASSERT(file_set);
|
||||
file_set->id = myindex;
|
||||
file_set->f = f;
|
||||
file_set->mode = fmode;
|
||||
|
@ -261,7 +261,7 @@ static int push_file(FILE* f, const char* open_mode, char* buffer)
|
|||
}
|
||||
|
||||
the_new = (l_grib_file*)malloc(sizeof(l_grib_file));
|
||||
Assert(the_new);
|
||||
ECCODES_ASSERT(the_new);
|
||||
the_new->id = myindex;
|
||||
the_new->f = f;
|
||||
the_new->mode = fmode;
|
||||
|
@ -294,7 +294,7 @@ static void _push_handle(grib_handle *h,int *gid)
|
|||
|
||||
if(!handle_set){
|
||||
handle_set = (l_grib_handle*)malloc(sizeof(l_grib_handle));
|
||||
Assert(handle_set);
|
||||
ECCODES_ASSERT(handle_set);
|
||||
handle_set->id = myindex;
|
||||
handle_set->h = h;
|
||||
handle_set->next = NULL;
|
||||
|
@ -319,7 +319,7 @@ static void _push_handle(grib_handle *h,int *gid)
|
|||
}
|
||||
|
||||
the_new = (l_grib_handle*)malloc(sizeof(l_grib_handle));
|
||||
Assert(the_new);
|
||||
ECCODES_ASSERT(the_new);
|
||||
the_new->id = myindex;
|
||||
the_new->h = h;
|
||||
the_new->next = current;
|
||||
|
@ -352,7 +352,7 @@ static void _push_index(grib_index *h,int *gid)
|
|||
|
||||
if(!index_set){
|
||||
index_set = (l_grib_index*)malloc(sizeof(l_grib_index));
|
||||
Assert(index_set);
|
||||
ECCODES_ASSERT(index_set);
|
||||
index_set->id = myindex;
|
||||
index_set->h = h;
|
||||
index_set->next = NULL;
|
||||
|
@ -377,7 +377,7 @@ static void _push_index(grib_index *h,int *gid)
|
|||
}
|
||||
|
||||
the_new = (l_grib_index*)malloc(sizeof(l_grib_index));
|
||||
Assert(the_new);
|
||||
ECCODES_ASSERT(the_new);
|
||||
the_new->id = myindex;
|
||||
the_new->h = h;
|
||||
the_new->next = current;
|
||||
|
@ -410,7 +410,7 @@ static void _push_multi_handle(grib_multi_handle *h,int *gid)
|
|||
|
||||
if(!multi_handle_set){
|
||||
multi_handle_set = (l_grib_multi_handle*)malloc(sizeof(l_grib_multi_handle));
|
||||
Assert(multi_handle_set);
|
||||
ECCODES_ASSERT(multi_handle_set);
|
||||
multi_handle_set->id = myindex;
|
||||
multi_handle_set->h = h;
|
||||
multi_handle_set->next = NULL;
|
||||
|
@ -435,7 +435,7 @@ static void _push_multi_handle(grib_multi_handle *h,int *gid)
|
|||
}
|
||||
|
||||
the_new = (l_grib_multi_handle*)malloc(sizeof(l_grib_multi_handle));
|
||||
Assert(the_new);
|
||||
ECCODES_ASSERT(the_new);
|
||||
the_new->id = myindex;
|
||||
the_new->h = h;
|
||||
the_new->next = current;
|
||||
|
@ -481,7 +481,7 @@ static int _push_keys_iterator(grib_keys_iterator *i)
|
|||
|
||||
if(!keys_iterator_set){
|
||||
keys_iterator_set = (l_grib_keys_iterator*)malloc(sizeof(l_grib_keys_iterator));
|
||||
Assert(keys_iterator_set);
|
||||
ECCODES_ASSERT(keys_iterator_set);
|
||||
keys_iterator_set->id = myindex;
|
||||
keys_iterator_set->i = i;
|
||||
keys_iterator_set->next = NULL;
|
||||
|
@ -503,7 +503,7 @@ static int _push_keys_iterator(grib_keys_iterator *i)
|
|||
if(!previous) return -1;
|
||||
|
||||
the_new = (l_grib_keys_iterator*)malloc(sizeof(l_grib_keys_iterator));
|
||||
Assert(the_new);
|
||||
ECCODES_ASSERT(the_new);
|
||||
the_new->id = myindex;
|
||||
the_new->i = i;
|
||||
the_new->next = current;
|
||||
|
@ -532,7 +532,7 @@ static int _push_bufr_keys_iterator(bufr_keys_iterator *i)
|
|||
|
||||
if(!bufr_keys_iterator_set){
|
||||
bufr_keys_iterator_set = (l_bufr_keys_iterator*)malloc(sizeof(l_bufr_keys_iterator));
|
||||
Assert(bufr_keys_iterator_set);
|
||||
ECCODES_ASSERT(bufr_keys_iterator_set);
|
||||
bufr_keys_iterator_set->id = myindex;
|
||||
bufr_keys_iterator_set->i = i;
|
||||
bufr_keys_iterator_set->next = NULL;
|
||||
|
@ -554,7 +554,7 @@ static int _push_bufr_keys_iterator(bufr_keys_iterator *i)
|
|||
if(!previous) return -1;
|
||||
|
||||
the_new = (l_bufr_keys_iterator*)malloc(sizeof(l_bufr_keys_iterator));
|
||||
Assert(the_new);
|
||||
ECCODES_ASSERT(the_new);
|
||||
the_new->id = myindex;
|
||||
the_new->i = i;
|
||||
the_new->next = current;
|
||||
|
@ -1020,7 +1020,7 @@ static int _push_iterator(grib_iterator *i)
|
|||
|
||||
if(!iterator_set){
|
||||
iterator_set = (l_grib_iterator*)malloc(sizeof(l_grib_iterator));
|
||||
Assert(iterator_set);
|
||||
ECCODES_ASSERT(iterator_set);
|
||||
iterator_set->id = myindex;
|
||||
iterator_set->i = i;
|
||||
iterator_set->next = NULL;
|
||||
|
@ -1041,7 +1041,7 @@ static int _push_iterator(grib_iterator *i)
|
|||
}
|
||||
|
||||
the_new = (l_grib_iterator*)malloc(sizeof(l_grib_iterator));
|
||||
Assert(the_new);
|
||||
ECCODES_ASSERT(the_new);
|
||||
the_new->id = myindex;
|
||||
the_new->i = i;
|
||||
the_new->next = current;
|
||||
|
@ -1281,7 +1281,7 @@ static int _codes_f_bufr_keys_iterator_new_(int* gid,int* iterid)
|
|||
*iterid=-1;
|
||||
return GRIB_NULL_HANDLE;
|
||||
}
|
||||
Assert(h->product_kind==PRODUCT_BUFR);
|
||||
ECCODES_ASSERT(h->product_kind==PRODUCT_BUFR);
|
||||
iter=codes_bufr_keys_iterator_new(h,0);
|
||||
if (iter)
|
||||
*iterid=push_bufr_keys_iterator(iter);
|
||||
|
@ -2883,14 +2883,14 @@ int codes_f_bufr_multi_element_constant_arrays_off_(void)
|
|||
/*****************************************************************************/
|
||||
void grib_f_set_debug_(int* dmode)
|
||||
{
|
||||
Assert(dmode);
|
||||
ECCODES_ASSERT(dmode);
|
||||
grib_context* c = grib_context_get_default();
|
||||
grib_context_set_debug(c, *dmode);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
void grib_f_set_data_quality_checks_(int* val)
|
||||
{
|
||||
Assert(val);
|
||||
ECCODES_ASSERT(val);
|
||||
grib_context* c = grib_context_get_default();
|
||||
grib_context_set_data_quality_checks(c, *val);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ void grib_accessor_ascii_t::init(const long len, grib_arguments* arg)
|
|||
{
|
||||
grib_accessor_gen_t::init(len, arg);
|
||||
length_ = len;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
int grib_accessor_ascii_t::value_count(long* count)
|
||||
|
|
|
@ -26,10 +26,10 @@ void grib_accessor_bitmap_t::compute_size()
|
|||
grib_accessor* seclen;
|
||||
size_t size;
|
||||
/* Assume reparsing */
|
||||
Assert(hand->loader != 0);
|
||||
ECCODES_ASSERT(hand->loader != 0);
|
||||
if (hand->loader != 0) {
|
||||
seclen = grib_find_accessor(hand, sLength_);
|
||||
Assert(seclen);
|
||||
ECCODES_ASSERT(seclen);
|
||||
grib_get_block_length(seclen->parent_, &size);
|
||||
slen = size;
|
||||
}
|
||||
|
@ -41,11 +41,11 @@ void grib_accessor_bitmap_t::compute_size()
|
|||
|
||||
if (length_ < 0) {
|
||||
/* Assume reparsing */
|
||||
/*Assert(hand->loader != 0);*/
|
||||
/*ECCODES_ASSERT(hand->loader != 0);*/
|
||||
length_ = 0;
|
||||
}
|
||||
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
void grib_accessor_bitmap_t::init(const long len, grib_arguments* arg)
|
||||
|
|
|
@ -39,7 +39,7 @@ void grib_accessor_bits_t::init(const long l, grib_arguments* c)
|
|||
scale_ = c->get_double(hand, n++);
|
||||
}
|
||||
|
||||
Assert(len_ <= sizeof(long) * 8);
|
||||
ECCODES_ASSERT(len_ <= sizeof(long) * 8);
|
||||
|
||||
length_ = 0;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ void grib_accessor_blob_t::init(const long len, grib_arguments* arg)
|
|||
grib_accessor_gen_t::init(len, arg);
|
||||
grib_get_long_internal(grib_handle_of_accessor(this),
|
||||
arg->get_name(parent_->h, 0), &length_);
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
long grib_accessor_blob_t::get_native_type()
|
||||
|
|
|
@ -67,7 +67,7 @@ int grib_accessor_budgdate_t::pack_long(const long* val, size_t* len)
|
|||
|
||||
year -= 1900;
|
||||
|
||||
Assert(year < 255);
|
||||
ECCODES_ASSERT(year < 255);
|
||||
|
||||
if ((ret = grib_set_long_internal(grib_handle_of_accessor(this), day_, day)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
|
|
@ -225,7 +225,7 @@ void grib_accessor_bufr_data_array_t::init(const long v, grib_arguments* params)
|
|||
bitsToEndData_ = get_length() * 8;
|
||||
unpackMode_ = CODES_BUFR_UNPACK_STRUCTURE;
|
||||
inputBitmap_ = NULL;
|
||||
/* Assert(length_ >=0); */
|
||||
/* ECCODES_ASSERT(length_ >=0); */
|
||||
}
|
||||
|
||||
// void clean_string(char* s,int len)
|
||||
|
@ -932,7 +932,7 @@ int decode_element(grib_context* c, grib_accessor_bufr_data_array_t* self, int s
|
|||
double cdval = 0, x;
|
||||
int err = 0;
|
||||
bufr_descriptor* bd = descriptor == NULL ? self->expanded_->v[i] : descriptor;
|
||||
/* Assert( b->data == data); */
|
||||
/* ECCODES_ASSERT( b->data == data); */
|
||||
|
||||
if (self->change_ref_value_operand_ > 0 && self->change_ref_value_operand_ != 255) {
|
||||
/* Operator 203YYY: Change Reference Values: Definition phase */
|
||||
|
@ -1012,7 +1012,7 @@ int decode_replication(grib_context* c, grib_accessor_bufr_data_array_t* self, i
|
|||
err = &ret;
|
||||
descriptors = self->expanded_->v;
|
||||
|
||||
/* Assert(buff->data == data); */
|
||||
/* ECCODES_ASSERT(buff->data == data); */
|
||||
|
||||
grib_context_log(c, GRIB_LOG_DEBUG, "BUFR data decoding: -%d- \tcode=%6.6ld width=%ld ",
|
||||
i, self->expanded_->v[i]->code, self->expanded_->v[i]->width);
|
||||
|
@ -1098,7 +1098,7 @@ int grib_accessor_bufr_data_array_t::encode_overridden_reference_value(grib_cont
|
|||
long currRefVal = -1;
|
||||
long numBits = change_ref_value_operand_;
|
||||
/* We must be encoding between 203YYY and 203255 */
|
||||
Assert(change_ref_value_operand_ > 0 && change_ref_value_operand_ != 255);
|
||||
ECCODES_ASSERT(change_ref_value_operand_ > 0 && change_ref_value_operand_ != 255);
|
||||
if (refValListSize_ == 0) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"encode_new_element: Overridden Reference Values array is empty! "
|
||||
|
@ -1262,7 +1262,7 @@ int encode_element(grib_context* c, grib_accessor_bufr_data_array_t* self, int s
|
|||
int idx, j;
|
||||
int err = 0;
|
||||
bufr_descriptor* bd = descriptor == NULL ? self->expanded_->v[i] : descriptor;
|
||||
/* Assert( buff->data == data); */
|
||||
/* ECCODES_ASSERT( buff->data == data); */
|
||||
|
||||
grib_context_log(c, GRIB_LOG_DEBUG, "BUFR data encoding: -%d- \tcode=%6.6ld width=%ld pos=%ld ulength=%ld ulength_bits=%ld",
|
||||
i, bd->code, bd->width, (long)*pos, buff->ulength, buff->ulength_bits);
|
||||
|
@ -1332,7 +1332,7 @@ int encode_replication(grib_context* c, grib_accessor_bufr_data_array_t* self, i
|
|||
grib_buffer* buff, unsigned char* data, long* pos, int i, long elementIndex,
|
||||
grib_darray* dval, long* numberOfRepetitions)
|
||||
{
|
||||
/* Assert( buff->data == data); */
|
||||
/* ECCODES_ASSERT( buff->data == data); */
|
||||
if (self->compressedData_) {
|
||||
DEBUG_ASSERT(grib_darray_used_size(self->numericValues_->v[elementIndex]) == 1);
|
||||
*numberOfRepetitions = self->numericValues_->v[elementIndex]->v[0];
|
||||
|
@ -1388,7 +1388,7 @@ int grib_accessor_bufr_data_array_t::build_bitmap(unsigned char* data, long* pos
|
|||
i = iBitmapOperator + 1;
|
||||
if (descriptors[i]->code == 101000) {
|
||||
iDelayedReplication = iBitmapOperator + 2;
|
||||
Assert(descriptors[iDelayedReplication]->code == 31001 ||
|
||||
ECCODES_ASSERT(descriptors[iDelayedReplication]->code == 31001 ||
|
||||
descriptors[iDelayedReplication]->code == 31002);
|
||||
i = iDelayedReplication;
|
||||
if (compressedData_) {
|
||||
|
@ -1458,7 +1458,7 @@ int grib_accessor_bufr_data_array_t::consume_bitmap(int iBitmapOperator)
|
|||
bitmapSize = inputExtendedReplications_[iInputExtendedReplications_];
|
||||
break;
|
||||
default:
|
||||
Assert(0);
|
||||
ECCODES_ASSERT(0);
|
||||
}
|
||||
}
|
||||
else if (descriptors[i]->code == 31031) {
|
||||
|
@ -1528,7 +1528,7 @@ int grib_accessor_bufr_data_array_t::build_bitmap_new_data(unsigned char* data,
|
|||
bitmapSize = inputExtendedReplications_[iInputExtendedReplications_];
|
||||
break;
|
||||
default:
|
||||
Assert(0);
|
||||
ECCODES_ASSERT(0);
|
||||
}
|
||||
}
|
||||
else if (descriptors[i]->code == 31031) {
|
||||
|
@ -2043,10 +2043,10 @@ grib_iarray* grib_accessor_bufr_data_array_t::set_subset_list(
|
|||
|
||||
#ifdef DEBUG
|
||||
if (subsetList == NULL) {
|
||||
Assert(subsetListSize == 0);
|
||||
ECCODES_ASSERT(subsetListSize == 0);
|
||||
}
|
||||
if (subsetListSize == 0) {
|
||||
Assert(subsetList == NULL);
|
||||
ECCODES_ASSERT(subsetList == NULL);
|
||||
}
|
||||
#endif
|
||||
if (startSubset > 0) {
|
||||
|
|
|
@ -476,7 +476,7 @@ int grib_accessor_bufr_data_element_t::is_missing()
|
|||
err = unpack_long(&value, &size2);
|
||||
}
|
||||
if (err) return 0; /* TODO: no way of propagating the error up */
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
if (size > 1) {
|
||||
for (i = 0; i < size; i++) {
|
||||
if (!grib_is_missing_long(this, values[i])) {
|
||||
|
@ -504,7 +504,7 @@ int grib_accessor_bufr_data_element_t::is_missing()
|
|||
err = unpack_double(&value, &size2);
|
||||
}
|
||||
if (err) return 0; /* TODO: no way of propagating the error up */
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
if (size > 1) {
|
||||
for (i = 0; i < size; ++i) {
|
||||
if (!grib_is_missing_double(this, values[i])) {
|
||||
|
|
|
@ -234,8 +234,8 @@ int grib_accessor_bufr_elements_table_t::bufr_get_from_table(bufr_descriptor* v)
|
|||
/* ECC-1137: check descriptor key name and unit lengths */
|
||||
const size_t maxlen_shortName = sizeof(v->shortName);
|
||||
const size_t maxlen_units = sizeof(v->units);
|
||||
Assert(strlen(list[1]) < maxlen_shortName);
|
||||
Assert(strlen(list[4]) < maxlen_units);
|
||||
ECCODES_ASSERT(strlen(list[1]) < maxlen_shortName);
|
||||
ECCODES_ASSERT(strlen(list[4]) < maxlen_units);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ void grib_accessor_bytes_t::init(const long len, grib_arguments* arg)
|
|||
grib_accessor_gen_t::init(len, arg);
|
||||
/*grib_accessor_signed* self = (grib_accessor_signed*)a; */
|
||||
length_ = len;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
long grib_accessor_bytes_t::get_native_type()
|
||||
|
@ -93,7 +93,7 @@ int grib_accessor_bytes_t::pack_string(const char* val, size_t* len)
|
|||
grib_context_free(c, bytearray);
|
||||
return GRIB_INVALID_KEY_VALUE;
|
||||
}
|
||||
Assert(byteVal < 256);
|
||||
ECCODES_ASSERT(byteVal < 256);
|
||||
bytearray[i] = (int)byteVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ int grib_accessor_cf_var_name_t::unpack_string(char* val, size_t* len)
|
|||
|
||||
int err = grib_get_string(h, defaultKey_, defaultKey, &size);
|
||||
if (err) return err;
|
||||
Assert(size > 0);
|
||||
Assert(strlen(defaultKey) > 0);
|
||||
ECCODES_ASSERT(size > 0);
|
||||
ECCODES_ASSERT(strlen(defaultKey) > 0);
|
||||
|
||||
if (STR_EQUAL(defaultKey, "~") || isdigit(defaultKey[0])) {
|
||||
// NetCDF variables cannot start with a digit
|
||||
|
|
|
@ -91,8 +91,8 @@ int grib_accessor_change_scanning_direction_t::pack_long(const long* val, size_t
|
|||
return err;
|
||||
}
|
||||
|
||||
Assert(axis_);
|
||||
Assert(strcmp(axis_, "x") == 0 || strcmp(axis_, "y") == 0);
|
||||
ECCODES_ASSERT(axis_);
|
||||
ECCODES_ASSERT(strcmp(axis_, "x") == 0 || strcmp(axis_, "y") == 0);
|
||||
|
||||
if (axis_[0] == 'x') {
|
||||
theEnd = Ni / 2;
|
||||
|
|
|
@ -26,7 +26,7 @@ void grib_accessor_check_internal_version_t::init(const long l, grib_arguments*
|
|||
long defs_file_version = 0;
|
||||
grib_handle* h = grib_handle_of_accessor(this);
|
||||
const char* s_defn_version = args->get_name(h, 0);
|
||||
Assert(s_defn_version);
|
||||
ECCODES_ASSERT(s_defn_version);
|
||||
|
||||
err = grib_get_long_internal(h, s_defn_version, &defs_file_version);
|
||||
if (!err) {
|
||||
|
|
|
@ -69,7 +69,7 @@ int grib_accessor_closest_date_t::unpack_double(double* val, size_t* len)
|
|||
*val = -1; /* initialise to an invalid index */
|
||||
|
||||
if ((err = grib_get_long_internal(h, numForecasts_, &num_forecasts)) != GRIB_SUCCESS) return err;
|
||||
Assert(num_forecasts > 1);
|
||||
ECCODES_ASSERT(num_forecasts > 1);
|
||||
|
||||
if ((err = grib_get_long(h, dateLocal_, &ymdLocal)) != GRIB_SUCCESS) return err;
|
||||
yearLocal = ymdLocal / 10000;
|
||||
|
@ -86,32 +86,32 @@ int grib_accessor_closest_date_t::unpack_double(double* val, size_t* len)
|
|||
secondLocal = hmsLocal;
|
||||
|
||||
if ((err = grib_get_size(h, year_, &size)) != GRIB_SUCCESS) return err;
|
||||
Assert(size == (size_t)num_forecasts);
|
||||
ECCODES_ASSERT(size == (size_t)num_forecasts);
|
||||
yearArray = (long*)grib_context_malloc_clear(c, size * sizeof(long));
|
||||
if ((err = grib_get_long_array_internal(h, year_, yearArray, &size)) != GRIB_SUCCESS) return err;
|
||||
|
||||
if ((err = grib_get_size(h, month_, &size)) != GRIB_SUCCESS) return err;
|
||||
Assert(size == (size_t)num_forecasts);
|
||||
ECCODES_ASSERT(size == (size_t)num_forecasts);
|
||||
monthArray = (long*)grib_context_malloc_clear(c, size * sizeof(long));
|
||||
if ((err = grib_get_long_array_internal(h, month_, monthArray, &size)) != GRIB_SUCCESS) return err;
|
||||
|
||||
if ((err = grib_get_size(h, day_, &size)) != GRIB_SUCCESS) return err;
|
||||
Assert(size == (size_t)num_forecasts);
|
||||
ECCODES_ASSERT(size == (size_t)num_forecasts);
|
||||
dayArray = (long*)grib_context_malloc_clear(c, size * sizeof(long));
|
||||
if ((err = grib_get_long_array_internal(h, day_, dayArray, &size)) != GRIB_SUCCESS) return err;
|
||||
|
||||
if ((err = grib_get_size(h, hour_, &size)) != GRIB_SUCCESS) return err;
|
||||
Assert(size == (size_t)num_forecasts);
|
||||
ECCODES_ASSERT(size == (size_t)num_forecasts);
|
||||
hourArray = (long*)grib_context_malloc_clear(c, size * sizeof(long));
|
||||
if ((err = grib_get_long_array_internal(h, hour_, hourArray, &size)) != GRIB_SUCCESS) return err;
|
||||
|
||||
if ((err = grib_get_size(h, minute_, &size)) != GRIB_SUCCESS) return err;
|
||||
Assert(size == (size_t)num_forecasts);
|
||||
ECCODES_ASSERT(size == (size_t)num_forecasts);
|
||||
minuteArray = (long*)grib_context_malloc_clear(c, size * sizeof(long));
|
||||
if ((err = grib_get_long_array_internal(h, minute_, minuteArray, &size)) != GRIB_SUCCESS) return err;
|
||||
|
||||
if ((err = grib_get_size(h, second_, &size)) != GRIB_SUCCESS) return err;
|
||||
Assert(size == (size_t)num_forecasts);
|
||||
ECCODES_ASSERT(size == (size_t)num_forecasts);
|
||||
secondArray = (long*)grib_context_malloc_clear(c, size * sizeof(long));
|
||||
if ((err = grib_get_long_array_internal(h, second_, secondArray, &size)) != GRIB_SUCCESS) return err;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ void grib_accessor_codeflag_t::init(const long len, grib_arguments* param)
|
|||
grib_accessor_unsigned_t::init(len, param);
|
||||
length_ = len;
|
||||
tablename_ = param->get_string(grib_handle_of_accessor(this), 0);
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
static int test_bit(long a, long b)
|
||||
|
|
|
@ -80,7 +80,7 @@ void grib_accessor_codetable_t::init(const long len, grib_arguments* params)
|
|||
#ifdef DEBUG
|
||||
if (flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) {
|
||||
grib_context_log(context_, GRIB_LOG_FATAL, "codetable '%s' has flag can_be_missing!", name_);
|
||||
Assert(!"codetable with can_be_missing?");
|
||||
ECCODES_ASSERT(!"codetable with can_be_missing?");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -232,7 +232,7 @@ grib_codetable* grib_accessor_codetable_t::load_table()
|
|||
}
|
||||
|
||||
if (flags_ & GRIB_ACCESSOR_FLAG_TRANSIENT) {
|
||||
Assert(vvalue_ != NULL);
|
||||
ECCODES_ASSERT(vvalue_ != NULL);
|
||||
size = vvalue_->length * 8;
|
||||
}
|
||||
else {
|
||||
|
@ -276,7 +276,7 @@ static int grib_load_codetable(grib_context* c, const char* filename,
|
|||
if (!f)
|
||||
return GRIB_IO_PROBLEM;
|
||||
|
||||
Assert(t != NULL);
|
||||
ECCODES_ASSERT(t != NULL);
|
||||
|
||||
if (t->filename[0] == NULL) {
|
||||
t->filename[0] = grib_context_strdup_persistent(c, filename);
|
||||
|
@ -324,7 +324,7 @@ static int grib_load_codetable(grib_context* c, const char* filename,
|
|||
grib_context_log(c, GRIB_LOG_ERROR, "Invalid entry in file %s: line %d", filename, lineNumber);
|
||||
continue; /* skip this line */
|
||||
}
|
||||
Assert(isdigit(*p));
|
||||
ECCODES_ASSERT(isdigit(*p));
|
||||
|
||||
while (*p != '\0') {
|
||||
if (isspace(*p))
|
||||
|
@ -372,8 +372,8 @@ static int grib_load_codetable(grib_context* c, const char* filename,
|
|||
if (!units)
|
||||
units = unknown;
|
||||
|
||||
Assert(*abbreviation);
|
||||
Assert(*title);
|
||||
ECCODES_ASSERT(*abbreviation);
|
||||
ECCODES_ASSERT(*title);
|
||||
string_rtrim(title); /* ECC-1315 */
|
||||
|
||||
if (t->entries[code].abbreviation != NULL) {
|
||||
|
@ -381,8 +381,8 @@ static int grib_load_codetable(grib_context* c, const char* filename,
|
|||
continue;
|
||||
}
|
||||
|
||||
Assert(t->entries[code].abbreviation == NULL);
|
||||
Assert(t->entries[code].title == NULL);
|
||||
ECCODES_ASSERT(t->entries[code].abbreviation == NULL);
|
||||
ECCODES_ASSERT(t->entries[code].title == NULL);
|
||||
|
||||
t->entries[code].abbreviation = grib_context_strdup_persistent(c, abbreviation);
|
||||
t->entries[code].title = grib_context_strdup_persistent(c, title);
|
||||
|
@ -631,7 +631,7 @@ bool strings_equal(const char* s1, const char* s2, bool case_sensitive)
|
|||
int grib_accessor_codetable_t::pack_string(const char* buffer, size_t* len)
|
||||
{
|
||||
long lValue = 0;
|
||||
Assert(buffer);
|
||||
ECCODES_ASSERT(buffer);
|
||||
if (is_number(buffer) && string_to_long(buffer, &lValue, 1) == GRIB_SUCCESS) {
|
||||
// ECC-1654: If value is a pure number, just pack as long
|
||||
size_t l = 1;
|
||||
|
@ -786,8 +786,8 @@ int grib_accessor_codetable_t::unpack_long(long* val, size_t* len)
|
|||
#ifdef DEBUG
|
||||
{
|
||||
int err = value_count(&rlen);
|
||||
Assert(!err);
|
||||
Assert(rlen == 1);
|
||||
ECCODES_ASSERT(!err);
|
||||
ECCODES_ASSERT(rlen == 1);
|
||||
}
|
||||
#endif
|
||||
rlen = 1; /* ECC-480 Performance: avoid func call overhead of grib_value_count */
|
||||
|
|
|
@ -200,7 +200,7 @@ static int concept_conditions_expression_apply(grib_handle* h, grib_concept_cond
|
|||
size_t size;
|
||||
int err = 0;
|
||||
|
||||
Assert(count < 1024);
|
||||
ECCODES_ASSERT(count < 1024);
|
||||
values[count].name = e->name;
|
||||
|
||||
values[count].type = e->expression->native_type(h);
|
||||
|
|
|
@ -150,7 +150,7 @@ int grib_accessor_data_apply_bitmap_t::unpack_double_element_set(const size_t* i
|
|||
for (j = 0; j < idx; j++) {
|
||||
cidx += bvals[j];
|
||||
}
|
||||
Assert(ci < count_1s);
|
||||
ECCODES_ASSERT(ci < count_1s);
|
||||
cidx_array[ci++] = cidx;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ int grib_accessor_data_apply_boustrophedonic_t::unpack(T* val, size_t* len)
|
|||
return ret;
|
||||
|
||||
if (grib_get_size(grib_handle_of_accessor(this), pl_, &plSize) == GRIB_SUCCESS) {
|
||||
Assert(plSize == numberOfRows);
|
||||
ECCODES_ASSERT(plSize == numberOfRows);
|
||||
pl = (long*)grib_context_malloc_clear(context_, sizeof(long) * plSize);
|
||||
ret = grib_get_long_array_internal(grib_handle_of_accessor(this), pl_, pl, &plSize);
|
||||
if (ret)
|
||||
|
@ -228,7 +228,7 @@ int grib_accessor_data_apply_boustrophedonic_t::pack_double(const double* val, s
|
|||
return ret;
|
||||
|
||||
if (grib_get_size(grib_handle_of_accessor(this), pl_, &plSize) == GRIB_SUCCESS) {
|
||||
Assert(plSize == numberOfRows);
|
||||
ECCODES_ASSERT(plSize == numberOfRows);
|
||||
pl = (long*)grib_context_malloc_clear(context_, sizeof(long) * plSize);
|
||||
ret = grib_get_long_array_internal(grib_handle_of_accessor(this), pl_, pl, &plSize);
|
||||
if (ret)
|
||||
|
|
|
@ -43,7 +43,7 @@ int grib_accessor_data_apply_boustrophedonic_bitmap_t::value_count(long* count)
|
|||
int ret = 0;
|
||||
|
||||
/* This accessor is for data with a bitmap after all */
|
||||
Assert(grib_find_accessor(gh, bitmap_));
|
||||
ECCODES_ASSERT(grib_find_accessor(gh, bitmap_));
|
||||
|
||||
ret = grib_get_size(gh, bitmap_, &len);
|
||||
*count = len;
|
||||
|
@ -76,7 +76,7 @@ int grib_accessor_data_apply_boustrophedonic_bitmap_t::unpack_double(double* val
|
|||
err = grib_get_long_internal(gh, numberOfPoints_, &numberOfPoints);
|
||||
if (err)
|
||||
return err;
|
||||
Assert(nn == numberOfPoints);
|
||||
ECCODES_ASSERT(nn == numberOfPoints);
|
||||
|
||||
if (!grib_find_accessor(gh, bitmap_))
|
||||
return grib_get_double_array_internal(gh, coded_values_, val, len);
|
||||
|
@ -263,7 +263,7 @@ int grib_accessor_data_apply_boustrophedonic_bitmap_t::unpack_double_element_set
|
|||
for (j = 0; j < idx; j++) {
|
||||
cidx += bvals[j];
|
||||
}
|
||||
Assert(ci < count_1s);
|
||||
ECCODES_ASSERT(ci < count_1s);
|
||||
cidx_array[ci++] = cidx;
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ int grib_accessor_data_apply_boustrophedonic_bitmap_t::pack_double(const double*
|
|||
err = grib_get_long_internal(gh, numberOfPoints_, &numberOfPoints);
|
||||
if (err)
|
||||
return err;
|
||||
Assert(numberOfPoints == bmaplen);
|
||||
ECCODES_ASSERT(numberOfPoints == bmaplen);
|
||||
|
||||
/* Create a copy of the incoming 'val' array because we're going to change it */
|
||||
values = (double*)grib_context_malloc_clear(context_, sizeof(double) * numberOfPoints);
|
||||
|
|
|
@ -168,7 +168,7 @@ int grib_accessor_data_ccsds_packing_t::pack_double(const double* val, size_t* l
|
|||
if (is_constant_field) {
|
||||
#ifdef DEBUG
|
||||
for (i = 1; i < n_vals; i++) {
|
||||
Assert(val[i] == val[0]);
|
||||
ECCODES_ASSERT(val[i] == val[0]);
|
||||
}
|
||||
#endif
|
||||
if (grib_get_nearest_smaller_value(hand, reference_value_, val[0], &reference_value) != GRIB_SUCCESS) {
|
||||
|
|
|
@ -132,7 +132,7 @@ double calculate_pfactor(const grib_context* ctx, const double* spectralField, l
|
|||
*/
|
||||
for (loop = ismin; loop <= ismax; loop++) {
|
||||
x = log((double)(loop * (loop + 1)));
|
||||
Assert(norms[loop] > 0);
|
||||
ECCODES_ASSERT(norms[loop] > 0);
|
||||
y = log(norms[loop]);
|
||||
weightedSumOverX = weightedSumOverX + x * weights[loop];
|
||||
weightedSumOverY = weightedSumOverY + y * weights[loop];
|
||||
|
@ -743,7 +743,7 @@ int grib_accessor_data_complex_packing_t::unpack_real(T* val, size_t* len)
|
|||
mmax++;
|
||||
}
|
||||
|
||||
//Assert(*len >= i);
|
||||
//ECCODES_ASSERT(*len >= i);
|
||||
if (*len < i) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR, "%s::%s: Invalid values *len=%zu and i=%zu.",
|
||||
class_name_, __func__, *len, i);
|
||||
|
|
|
@ -71,7 +71,7 @@ int grib_accessor_data_g1complex_packing_t::pack_double(const double* val, size_
|
|||
|
||||
dirty_ = 1;
|
||||
|
||||
Assert((sub_j == sub_k) && (sub_m == sub_j));
|
||||
ECCODES_ASSERT((sub_j == sub_k) && (sub_m == sub_j));
|
||||
|
||||
ret = grib_accessor_data_complex_packing_t::pack_double(val, len);
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ int grib_accessor_data_g1second_order_general_extended_packing_t::unpack(double*
|
|||
long bias = 0;
|
||||
long y = 0, z = 0, w = 0;
|
||||
size_t k, ngroups;
|
||||
Assert(!(dvalues && fvalues));
|
||||
ECCODES_ASSERT(!(dvalues && fvalues));
|
||||
|
||||
if (dvalues) {
|
||||
if (!double_dirty_) {
|
||||
|
@ -694,7 +694,7 @@ int grib_accessor_data_g1second_order_general_extended_packing_t::pack_double(co
|
|||
break;
|
||||
}
|
||||
if (orderOfSPD) {
|
||||
Assert(orderOfSPD >= 0 && orderOfSPD < numberOfValues);
|
||||
ECCODES_ASSERT(orderOfSPD >= 0 && orderOfSPD < numberOfValues);
|
||||
bias = X[orderOfSPD];
|
||||
for (i = orderOfSPD + 1; i < numberOfValues; i++) {
|
||||
if (bias > X[i])
|
||||
|
@ -1143,7 +1143,7 @@ int grib_accessor_data_g1second_order_general_extended_packing_t::pack_double(co
|
|||
0,
|
||||
};
|
||||
size_t nSPD = orderOfSPD + 1;
|
||||
Assert(orderOfSPD <= 3);
|
||||
ECCODES_ASSERT(orderOfSPD <= 3);
|
||||
for (i = 0; i < orderOfSPD; i++)
|
||||
SPD[i] = X[i];
|
||||
SPD[orderOfSPD] = bias;
|
||||
|
|
|
@ -108,7 +108,7 @@ int grib_accessor_data_g1secondary_bitmap_t::pack_double(const double* val, size
|
|||
*len = k;
|
||||
|
||||
/*printf("QQQQQQQ %ld %ld second=%ld\n",primary_len,on,m);*/
|
||||
Assert(k == primary_len);
|
||||
ECCODES_ASSERT(k == primary_len);
|
||||
|
||||
err = grib_set_double_array_internal(grib_handle_of_accessor(this), primary_bitmap_, primary_bitmap, k);
|
||||
if (err == GRIB_SUCCESS)
|
||||
|
|
|
@ -193,7 +193,7 @@ int grib_accessor_data_g1simple_packing_t::pack_double(const double* cval, size_
|
|||
"HALF byte: buflen=%d bits_per_value=%ld len=%d half_byte=%ld\n",
|
||||
buflen, bits_per_value, *len, half_byte);
|
||||
|
||||
Assert(half_byte <= 0x0f);
|
||||
ECCODES_ASSERT(half_byte <= 0x0f);
|
||||
|
||||
if ((ret = grib_set_long_internal(grib_handle_of_accessor(this), half_byte_, half_byte)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
|
|
@ -305,8 +305,8 @@ static int min_max_array(double* data, unsigned int n, double* min, double* max)
|
|||
static int post_process(grib_context* c, long* vals, long len, long order, long bias, const unsigned long extras[2])
|
||||
{
|
||||
unsigned long last, penultimate = 0, j = 0;
|
||||
Assert(order > 0);
|
||||
Assert(order <= 3);
|
||||
ECCODES_ASSERT(order > 0);
|
||||
ECCODES_ASSERT(order <= 3);
|
||||
if (!vals)
|
||||
return GRIB_INTERNAL_ERROR;
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ static double laplam(bif_trunc_t* bt, const double val[])
|
|||
free(itab2);
|
||||
return 0.;
|
||||
}
|
||||
Assert(lmax > 0);
|
||||
ECCODES_ASSERT(lmax > 0);
|
||||
|
||||
/*
|
||||
* Now, itab2 contains all possible values of i*i+j*j, and itab1 contains
|
||||
|
@ -527,7 +527,7 @@ int grib_accessor_data_g2bifourier_packing_t::unpack_double(double* val, size_t*
|
|||
isp += 4;
|
||||
}
|
||||
|
||||
Assert(*len >= isp);
|
||||
ECCODES_ASSERT(*len >= isp);
|
||||
*len = isp;
|
||||
|
||||
cleanup:
|
||||
|
|
|
@ -89,7 +89,7 @@ int grib_accessor_data_g2secondary_bitmap_t::pack_double(const double* val, size
|
|||
|
||||
*len = k;
|
||||
|
||||
Assert(k == primary_len);
|
||||
ECCODES_ASSERT(k == primary_len);
|
||||
|
||||
err = grib_set_double_array_internal(grib_handle_of_accessor(this), primary_bitmap_, primary_bitmap, k);
|
||||
if (err == GRIB_SUCCESS)
|
||||
|
|
|
@ -36,7 +36,7 @@ static int pre_processing_func(double* values, long length, long pre_processing,
|
|||
int i = 0, ret = 0;
|
||||
double min = values[0];
|
||||
double next_min = values[0];
|
||||
Assert(length > 0);
|
||||
ECCODES_ASSERT(length > 0);
|
||||
|
||||
switch (pre_processing) {
|
||||
/* NONE */
|
||||
|
@ -75,7 +75,7 @@ static int pre_processing_func(double* values, long length, long pre_processing,
|
|||
}
|
||||
}
|
||||
else {
|
||||
Assert(mode == INVERSE);
|
||||
ECCODES_ASSERT(mode == INVERSE);
|
||||
if (*pre_processing_parameter == 0) {
|
||||
for (i = 0; i < length; i++)
|
||||
values[i] = exp(values[i]);
|
||||
|
|
|
@ -62,7 +62,7 @@ void grib_accessor_data_jpeg2000_packing_t::init(const long v, grib_arguments* a
|
|||
fprintf(stderr, "ECCODES DEBUG jpeg2000_packing: using OPENJPEG_LIB\n");
|
||||
break;
|
||||
default:
|
||||
Assert(0);
|
||||
ECCODES_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -352,8 +352,8 @@ int grib_accessor_data_jpeg2000_packing_t::pack_double(const double* cval, size_
|
|||
class_name_, __func__, type_of_compression_used, target_compression_ratio_);
|
||||
return GRIB_ENCODING_ERROR;
|
||||
}
|
||||
Assert(target_compression_ratio != 255);
|
||||
Assert(target_compression_ratio != 0);
|
||||
ECCODES_ASSERT(target_compression_ratio != 255);
|
||||
ECCODES_ASSERT(target_compression_ratio != 0);
|
||||
helper.compression = target_compression_ratio;
|
||||
break;
|
||||
|
||||
|
@ -401,7 +401,7 @@ int grib_accessor_data_jpeg2000_packing_t::pack_double(const double* cval, size_
|
|||
class_name_, jpeg_lib_ == OPENJPEG_LIB ? "openjpeg" : "jasper",
|
||||
helper.jpeg_length, simple_packing_size);
|
||||
|
||||
Assert(helper.jpeg_length <= helper.buffer_size);
|
||||
ECCODES_ASSERT(helper.jpeg_length <= helper.buffer_size);
|
||||
|
||||
if (dump_jpg_) {
|
||||
FILE* f = fopen(dump_jpg_, "w");
|
||||
|
|
|
@ -54,7 +54,7 @@ typedef struct png_read_callback_data
|
|||
static void png_read_callback(png_structp png, png_bytep data, png_size_t length)
|
||||
{
|
||||
png_read_callback_data* p = (png_read_callback_data*)png_get_io_ptr(png);
|
||||
Assert(p->offset + length <= p->length);
|
||||
ECCODES_ASSERT(p->offset + length <= p->length);
|
||||
memcpy(data, p->buffer + p->offset, length);
|
||||
p->offset += length;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ static void png_write_callback(png_structp png, png_bytep data, png_size_t lengt
|
|||
{
|
||||
png_read_callback_data* p = (png_read_callback_data*)png_get_io_ptr(png);
|
||||
/* printf("p.offset=%zu len=%zu p.len=%zu\n", p->offset, length, p->length); */
|
||||
/* Assert(p->offset + length <= p->length); */
|
||||
/* ECCODES_ASSERT(p->offset + length <= p->length); */
|
||||
if (p->offset + length > p->length) {
|
||||
/* Errors handled through png_error() are fatal, meaning that png_error() should never return to its caller.
|
||||
Currently, this is handled via setjmp() and longjmp() */
|
||||
|
@ -174,7 +174,7 @@ int grib_accessor_data_png_packing_t::unpack_double(double* val, size_t* len)
|
|||
png_set_read_fn(png, &callback_data, png_read_callback);
|
||||
png_read_png(png, info, PNG_TRANSFORM_IDENTITY, NULL);
|
||||
|
||||
Assert(callback_data.offset == callback_data.length);
|
||||
ECCODES_ASSERT(callback_data.offset == callback_data.length);
|
||||
|
||||
rows = png_get_rows(png, info);
|
||||
|
||||
|
@ -192,9 +192,9 @@ int grib_accessor_data_png_packing_t::unpack_double(double* val, size_t* len)
|
|||
bits8 = ((bits_per_value + 7) / 8) * 8;
|
||||
|
||||
#ifdef PNG_ANYBITS
|
||||
Assert(depth == bits8);
|
||||
ECCODES_ASSERT(depth == bits8);
|
||||
#else
|
||||
Assert(bits_per_value % 8 == 0);
|
||||
ECCODES_ASSERT(bits_per_value % 8 == 0);
|
||||
#endif
|
||||
|
||||
i = 0;
|
||||
|
@ -296,7 +296,7 @@ int grib_accessor_data_png_packing_t::pack_double(const double* val, size_t* len
|
|||
if (is_constant_field) {
|
||||
#ifdef DEBUG
|
||||
for (i = 1; i < n_vals; i++) {
|
||||
Assert(val[i] == val[0]);
|
||||
ECCODES_ASSERT(val[i] == val[0]);
|
||||
}
|
||||
#endif
|
||||
if ((err = grib_set_double_internal(grib_handle_of_accessor(this), reference_value_, val[0])) != GRIB_SUCCESS)
|
||||
|
@ -399,7 +399,7 @@ int grib_accessor_data_png_packing_t::pack_double(const double* val, size_t* len
|
|||
divisor = codes_power<double>(-binary_scale_factor, 2);
|
||||
|
||||
#ifndef PNG_ANYBITS
|
||||
Assert(bits_per_value % 8 == 0);
|
||||
ECCODES_ASSERT(bits_per_value % 8 == 0);
|
||||
#endif
|
||||
bits8 = (bits_per_value + 7) / 8 * 8;
|
||||
encoded = (unsigned char*)grib_context_buffer_malloc_clear(context_, bits8 / 8 * n_vals);
|
||||
|
@ -511,7 +511,7 @@ int grib_accessor_data_png_packing_t::pack_double(const double* val, size_t* len
|
|||
|
||||
png_write_png(png, info, PNG_TRANSFORM_IDENTITY, NULL);
|
||||
|
||||
Assert(callback_data.offset <= callback_data.length);
|
||||
ECCODES_ASSERT(callback_data.offset <= callback_data.length);
|
||||
|
||||
grib_buffer_replace(this, buf, callback_data.offset, 1, 1);
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ int grib_accessor_data_raw_packing_t::unpack_double_element(size_t idx, double*
|
|||
|
||||
pos = bytes * idx;
|
||||
|
||||
Assert(pos <= inlen);
|
||||
ECCODES_ASSERT(pos <= inlen);
|
||||
|
||||
nvals = 1;
|
||||
buf += pos;
|
||||
|
|
|
@ -98,8 +98,8 @@ int grib_accessor_data_secondary_bitmap_t::unpack_double(double* val, size_t* le
|
|||
}
|
||||
}
|
||||
|
||||
Assert(k <= *len);
|
||||
Assert(m <= secondary_len);
|
||||
ECCODES_ASSERT(k <= *len);
|
||||
ECCODES_ASSERT(m <= secondary_len);
|
||||
|
||||
/*printf("FOOBAR %d %d %ld %d\n",f,primary_len,expand_by,n_vals);*/
|
||||
|
||||
|
|
|
@ -167,10 +167,10 @@ int grib_accessor_data_sh_packed_t::unpack_double(double* val, size_t* len)
|
|||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
Assert(sub_j == sub_k);
|
||||
Assert(sub_j == sub_m);
|
||||
Assert(pen_j == pen_k);
|
||||
Assert(pen_j == pen_m);
|
||||
ECCODES_ASSERT(sub_j == sub_k);
|
||||
ECCODES_ASSERT(sub_j == sub_m);
|
||||
ECCODES_ASSERT(pen_j == pen_k);
|
||||
ECCODES_ASSERT(pen_j == pen_m);
|
||||
|
||||
buf = (unsigned char*)grib_handle_of_accessor(this)->buffer->data;
|
||||
|
||||
|
@ -232,7 +232,7 @@ int grib_accessor_data_sh_packed_t::unpack_double(double* val, size_t* len)
|
|||
mmax++;
|
||||
}
|
||||
|
||||
Assert(*len >= i);
|
||||
ECCODES_ASSERT(*len >= i);
|
||||
*len = n_vals;
|
||||
|
||||
grib_context_free(context_, scals);
|
||||
|
|
|
@ -54,7 +54,7 @@ int grib_accessor_data_sh_unpacked_t::value_count(long* count)
|
|||
|
||||
if (sub_j != sub_k || sub_j != sub_m) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR, "sub_j=%ld, sub_k=%ld, sub_m=%ld\n", sub_j, sub_k, sub_m);
|
||||
Assert((sub_j == sub_k) && (sub_j == sub_m));
|
||||
ECCODES_ASSERT((sub_j == sub_k) && (sub_j == sub_m));
|
||||
}
|
||||
*count = (sub_j + 1) * (sub_j + 2);
|
||||
return ret;
|
||||
|
@ -157,10 +157,10 @@ int grib_accessor_data_sh_unpacked_t::unpack_double(double* val, size_t* len)
|
|||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
Assert(sub_j == sub_k);
|
||||
Assert(sub_j == sub_m);
|
||||
Assert(pen_j == pen_k);
|
||||
Assert(pen_j == pen_m);
|
||||
ECCODES_ASSERT(sub_j == sub_k);
|
||||
ECCODES_ASSERT(sub_j == sub_m);
|
||||
ECCODES_ASSERT(pen_j == pen_k);
|
||||
ECCODES_ASSERT(pen_j == pen_m);
|
||||
|
||||
buf = (unsigned char*)grib_handle_of_accessor(this)->buffer->data;
|
||||
|
||||
|
@ -178,7 +178,7 @@ int grib_accessor_data_sh_unpacked_t::unpack_double(double* val, size_t* len)
|
|||
d = codes_power<double>(-decimal_scale_factor, 10);
|
||||
|
||||
scals = (double*)grib_context_malloc(context_, maxv * sizeof(double));
|
||||
Assert(scals);
|
||||
ECCODES_ASSERT(scals);
|
||||
if ((ret = grib_get_double_internal(grib_handle_of_accessor(this), laplacianOperator_, &laplacianOperator)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
|
@ -225,7 +225,7 @@ int grib_accessor_data_sh_unpacked_t::unpack_double(double* val, size_t* len)
|
|||
mmax++;
|
||||
}
|
||||
|
||||
Assert(*len >= i);
|
||||
ECCODES_ASSERT(*len >= i);
|
||||
*len = n_vals;
|
||||
|
||||
grib_context_free(context_, scals);
|
||||
|
|
|
@ -104,7 +104,7 @@ int grib_accessor_data_simple_packing_t::unpack_double_element(size_t idx, doubl
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
Assert(idx < n_vals);
|
||||
ECCODES_ASSERT(idx < n_vals);
|
||||
s = codes_power<double>(binary_scale_factor, 2);
|
||||
d = codes_power<double>(-decimal_scale_factor, 10);
|
||||
|
||||
|
@ -113,7 +113,7 @@ int grib_accessor_data_simple_packing_t::unpack_double_element(size_t idx, doubl
|
|||
class_name_, __func__, name_, n_vals, idx);
|
||||
|
||||
buf += byte_offset();
|
||||
/*Assert(((bits_per_value*n_vals)/8) < (1<<29));*/ /* See GRIB-787 */
|
||||
/*ECCODES_ASSERT(((bits_per_value*n_vals)/8) < (1<<29));*/ /* See GRIB-787 */
|
||||
|
||||
if (bits_per_value % 8) {
|
||||
grib_context_log(context_, GRIB_LOG_DEBUG,
|
||||
|
@ -244,7 +244,7 @@ int grib_accessor_data_simple_packing_t::unpack(T* val, size_t* len)
|
|||
offsetBeforeData = byte_offset();
|
||||
buf += offsetBeforeData;
|
||||
|
||||
/*Assert(((bits_per_value*n_vals)/8) < (1<<29));*/ /* See GRIB-787 */
|
||||
/*ECCODES_ASSERT(((bits_per_value*n_vals)/8) < (1<<29));*/ /* See GRIB-787 */
|
||||
|
||||
/* ECC-941 */
|
||||
if (!context_->ieee_packing) {
|
||||
|
@ -385,7 +385,7 @@ int grib_accessor_data_simple_packing_t::_unpack_double(double* val, size_t* len
|
|||
offsetBeforeData = byte_offset();
|
||||
buf += offsetBeforeData;
|
||||
|
||||
/*Assert(((bits_per_value*n_vals)/8) < (1<<29));*/ /* See GRIB-787 */
|
||||
/*ECCODES_ASSERT(((bits_per_value*n_vals)/8) < (1<<29));*/ /* See GRIB-787 */
|
||||
|
||||
/* ECC-941 */
|
||||
if (!context_->ieee_packing) {
|
||||
|
|
|
@ -117,8 +117,8 @@ int grib_accessor_element_t::pack_long(const long* val, size_t* len)
|
|||
goto the_end;
|
||||
}
|
||||
|
||||
Assert(index >= 0);
|
||||
Assert(index < size);
|
||||
ECCODES_ASSERT(index >= 0);
|
||||
ECCODES_ASSERT(index < size);
|
||||
ar[index] = *val;
|
||||
|
||||
if ((ret = grib_set_long_array_internal(hand, array_, ar, size)) != GRIB_SUCCESS)
|
||||
|
@ -164,8 +164,8 @@ int grib_accessor_element_t::pack_double(const double* v, size_t* len)
|
|||
goto the_end;
|
||||
}
|
||||
|
||||
Assert(index >= 0);
|
||||
Assert(index < size);
|
||||
ECCODES_ASSERT(index >= 0);
|
||||
ECCODES_ASSERT(index < size);
|
||||
ar[index] = *v;
|
||||
|
||||
if ((ret = grib_set_double_array_internal(hand, array_, ar, size)) != GRIB_SUCCESS)
|
||||
|
|
|
@ -80,7 +80,7 @@ static const char* descriptor_type_name(int dtype)
|
|||
case BUFR_DESCRIPTOR_TYPE_SEQUENCE:
|
||||
return "sequence";
|
||||
}
|
||||
Assert(!"bufr_descriptor_type_name failed");
|
||||
ECCODES_ASSERT(!"bufr_descriptor_type_name failed");
|
||||
return "unknown";
|
||||
}
|
||||
#endif
|
||||
|
@ -209,9 +209,9 @@ void grib_accessor_expanded_descriptors_t::__expand(bufr_descriptors_array* unex
|
|||
#endif
|
||||
expanded = grib_bufr_descriptors_array_append(expanded, inner_expanded);
|
||||
uidx = grib_bufr_descriptors_array_get(expanded, idx);
|
||||
Assert( uidx->type == BUFR_DESCRIPTOR_TYPE_REPLICATION );
|
||||
Assert( uidx->F == 1 );
|
||||
Assert( uidx->Y == 0 );
|
||||
ECCODES_ASSERT( uidx->type == BUFR_DESCRIPTOR_TYPE_REPLICATION );
|
||||
ECCODES_ASSERT( uidx->F == 1 );
|
||||
ECCODES_ASSERT( uidx->Y == 0 );
|
||||
// ECC-1958 and ECC-1054:
|
||||
// Here X is used to store the size which can exceed 63. The normal X is 6 bits wide so max=63
|
||||
// We need to set X but not the descriptor code
|
||||
|
@ -533,7 +533,7 @@ int grib_accessor_expanded_descriptors_t::expand()
|
|||
|
||||
if (!tablesAccessor_) {
|
||||
tablesAccessor_ = grib_find_accessor(h, tablesAccessorName_);
|
||||
Assert(tablesAccessor_);
|
||||
ECCODES_ASSERT(tablesAccessor_);
|
||||
}
|
||||
|
||||
unexpanded = grib_bufr_descriptors_array_new(unexpandedSize, DESC_SIZE_INCR);
|
||||
|
@ -549,7 +549,7 @@ int grib_accessor_expanded_descriptors_t::expand()
|
|||
|
||||
/* ECC-433: Operator 206YYY */
|
||||
if (aDescriptor1->F == 2 && aDescriptor1->X == 6) {
|
||||
Assert(aDescriptor1->type == BUFR_DESCRIPTOR_TYPE_OPERATOR);
|
||||
ECCODES_ASSERT(aDescriptor1->type == BUFR_DESCRIPTOR_TYPE_OPERATOR);
|
||||
operator206yyy_width = aDescriptor1->Y; /* Store the width for the following descriptor */
|
||||
DEBUG_ASSERT(operator206yyy_width > 0);
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ int grib_accessor_g1forecastmonth_t::unpack_long_edition1(long* val, size_t* len
|
|||
if (check) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR, "%s=%ld (%s-%s)=%ld", fcmonth_,
|
||||
gribForecastMonth, base_date, verification_yearmonth_, fcmonth);
|
||||
Assert(gribForecastMonth == fcmonth);
|
||||
ECCODES_ASSERT(gribForecastMonth == fcmonth);
|
||||
}
|
||||
else {
|
||||
*val = gribForecastMonth;
|
||||
|
|
|
@ -589,7 +589,7 @@ int grib_accessor_g1step_range_t::pack_long(const long* val, size_t* len)
|
|||
}
|
||||
return pack_string(buff, &bufflen);
|
||||
default:
|
||||
Assert(pack_index_ < 2);
|
||||
ECCODES_ASSERT(pack_index_ < 2);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ int grib_accessor_g2_aerosol_t::pack_long(const long* val, size_t* len)
|
|||
grib_get_long(hand, stream_ ,&stream);
|
||||
*/
|
||||
ret = grib_get_string(hand, stepType_, stepType, &slen);
|
||||
Assert(ret == GRIB_SUCCESS);
|
||||
ECCODES_ASSERT(ret == GRIB_SUCCESS);
|
||||
|
||||
// eps = grib2_is_PDTN_EPS(productDefinitionTemplateNumber);
|
||||
eps = grib_is_defined(hand, "perturbationNumber");
|
||||
|
|
|
@ -38,7 +38,7 @@ int grib_accessor_g2_chemical_t::unpack_long(long* val, size_t* len)
|
|||
long productDefinitionTemplateNumber = 0;
|
||||
grib_get_long(grib_handle_of_accessor(this), productDefinitionTemplateNumber_, &productDefinitionTemplateNumber);
|
||||
|
||||
Assert(chemical_type_ == CHEM_PLAIN || chemical_type_ == CHEM_DISTRIB || chemical_type_ == CHEM_SRCSINK);
|
||||
ECCODES_ASSERT(chemical_type_ == CHEM_PLAIN || chemical_type_ == CHEM_DISTRIB || chemical_type_ == CHEM_SRCSINK);
|
||||
if (chemical_type_ == CHEM_DISTRIB)
|
||||
*val = grib2_is_PDTN_ChemicalDistFunc(productDefinitionTemplateNumber);
|
||||
else if (chemical_type_ == CHEM_SRCSINK)
|
||||
|
@ -70,7 +70,7 @@ int grib_accessor_g2_chemical_t::pack_long(const long* val, size_t* len)
|
|||
// grib_get_long(hand, type_ ,&type);
|
||||
// grib_get_long(hand, stream_ ,&stream);
|
||||
ret = grib_get_string(hand, stepType_, stepType, &slen);
|
||||
Assert(ret == GRIB_SUCCESS);
|
||||
ECCODES_ASSERT(ret == GRIB_SUCCESS);
|
||||
|
||||
eps = grib_is_defined(hand, "perturbationNumber");
|
||||
// eps = grib2_is_PDTN_EPS(productDefinitionTemplateNumber);
|
||||
|
@ -78,7 +78,7 @@ int grib_accessor_g2_chemical_t::pack_long(const long* val, size_t* len)
|
|||
if (!strcmp(stepType, "instant"))
|
||||
isInstant = 1;
|
||||
|
||||
Assert(chemical_type_ == CHEM_PLAIN || chemical_type_ == CHEM_DISTRIB || chemical_type_ == CHEM_SRCSINK);
|
||||
ECCODES_ASSERT(chemical_type_ == CHEM_PLAIN || chemical_type_ == CHEM_DISTRIB || chemical_type_ == CHEM_SRCSINK);
|
||||
|
||||
if (eps == 1) {
|
||||
if (isInstant) {
|
||||
|
|
|
@ -76,7 +76,7 @@ static int convert_time_range_long_(
|
|||
long* lengthOfTimeRange /* time_range_value */
|
||||
)
|
||||
{
|
||||
Assert(lengthOfTimeRange != NULL);
|
||||
ECCODES_ASSERT(lengthOfTimeRange != NULL);
|
||||
|
||||
if (indicatorOfUnitForTimeRange != stepUnits) {
|
||||
eccodes::Step time_range{ *lengthOfTimeRange, indicatorOfUnitForTimeRange };
|
||||
|
@ -337,10 +337,10 @@ int grib_accessor_g2end_step_t::unpack_long(long* val, size_t* len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
Assert(numberOfTimeRanges_);
|
||||
ECCODES_ASSERT(numberOfTimeRanges_);
|
||||
if ((ret = grib_get_long_internal(h, numberOfTimeRanges_, &numberOfTimeRanges)))
|
||||
return ret;
|
||||
Assert(numberOfTimeRanges == 1 || numberOfTimeRanges == 2);
|
||||
ECCODES_ASSERT(numberOfTimeRanges == 1 || numberOfTimeRanges == 2);
|
||||
|
||||
try {
|
||||
if (numberOfTimeRanges == 1) {
|
||||
|
@ -379,10 +379,10 @@ int grib_accessor_g2end_step_t::unpack_double(double* val, size_t* len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
Assert(numberOfTimeRanges_);
|
||||
ECCODES_ASSERT(numberOfTimeRanges_);
|
||||
if ((ret = grib_get_long_internal(h, numberOfTimeRanges_, &numberOfTimeRanges)))
|
||||
return ret;
|
||||
Assert(numberOfTimeRanges == 1 || numberOfTimeRanges == 2);
|
||||
ECCODES_ASSERT(numberOfTimeRanges == 1 || numberOfTimeRanges == 2);
|
||||
|
||||
try {
|
||||
if (numberOfTimeRanges == 1) {
|
||||
|
|
|
@ -166,7 +166,7 @@ static int trial(const double* val, long v[6], long* basic_angle, long* sub_divi
|
|||
if (*sub_division < 0)
|
||||
return 0;
|
||||
|
||||
Assert(*sub_division >= 0);
|
||||
ECCODES_ASSERT(*sub_division >= 0);
|
||||
|
||||
return is_ok(val, v, *basic_angle, *sub_division);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ void grib_accessor_gen_t::init(const long len, grib_arguments* param)
|
|||
p = expression->evaluate_string(grib_handle_of_accessor(this), tmp, &s_len, &ret);
|
||||
if (ret != GRIB_SUCCESS) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR, "Unable to evaluate %s as string", name_);
|
||||
Assert(0);
|
||||
ECCODES_ASSERT(0);
|
||||
}
|
||||
s_len = strlen(p) + 1;
|
||||
pack_string(p, &s_len);
|
||||
|
@ -542,12 +542,12 @@ int grib_accessor_gen_t::is_missing()
|
|||
"%s internal error (flags=0x%lX)",
|
||||
name_,
|
||||
flags_);
|
||||
Assert(!"grib_accessor_gen_t::is_missing(): vvalue == NULL");
|
||||
ECCODES_ASSERT(!"grib_accessor_gen_t::is_missing(): vvalue == NULL");
|
||||
return 0;
|
||||
}
|
||||
return vvalue_->missing;
|
||||
}
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
|
||||
v = grib_handle_of_accessor(this)->buffer->data + offset_;
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ int grib_accessor_global_gaussian_t::unpack_long(long* val, size_t* len)
|
|||
long* pl = NULL; /* pl array */
|
||||
if ((ret = grib_get_size(h, pl_, &plsize)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
Assert(plsize);
|
||||
ECCODES_ASSERT(plsize);
|
||||
pl = (long*)grib_context_malloc_clear(c, sizeof(long) * plsize);
|
||||
grib_get_long_array_internal(h, pl_, pl, &plsize);
|
||||
|
||||
|
@ -199,13 +199,13 @@ int grib_accessor_global_gaussian_t::pack_long(const long* val, size_t* len)
|
|||
|
||||
if ((ret = grib_get_size(h, pl_, &plsize)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
Assert(plsize);
|
||||
ECCODES_ASSERT(plsize);
|
||||
pl = (long*)grib_context_malloc_clear(c, sizeof(long) * plsize);
|
||||
grib_get_long_array_internal(h, pl_, pl, &plsize);
|
||||
|
||||
max_pl = pl[0];
|
||||
for (i = 1; i < plsize; i++) {
|
||||
Assert(pl[i] > 0);
|
||||
ECCODES_ASSERT(pl[i] > 0);
|
||||
if (pl[i] > max_pl)
|
||||
max_pl = pl[i];
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ grib_hash_array_value* grib_accessor_hash_array_t::find_hash_value(int* err)
|
|||
|
||||
*err = GRIB_SUCCESS;
|
||||
|
||||
Assert(ha != NULL);
|
||||
ECCODES_ASSERT(ha != NULL);
|
||||
if (!key_) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR,
|
||||
"unable to get hash value for %s, set before getting", creator_->name);
|
||||
|
|
|
@ -22,7 +22,7 @@ void grib_accessor_ibmfloat_t::init(const long len, grib_arguments* arg)
|
|||
arg_ = arg;
|
||||
value_count(&count);
|
||||
length_ = 4 * count;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -139,7 +139,7 @@ long grib_accessor_ibmfloat_t::byte_offset()
|
|||
void grib_accessor_ibmfloat_t::update_size(size_t s)
|
||||
{
|
||||
length_ = (long)s;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
long grib_accessor_ibmfloat_t::next_offset()
|
||||
|
|
|
@ -21,7 +21,7 @@ void grib_accessor_ieeefloat_t::init(const long len, grib_arguments* arg)
|
|||
arg_ = arg;
|
||||
value_count(&count);
|
||||
length_ = 4 * count;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
int grib_accessor_ieeefloat_t::value_count(long* len)
|
||||
|
@ -121,7 +121,7 @@ int grib_accessor_ieeefloat_t::unpack_float(float* val, size_t* len)
|
|||
void grib_accessor_ieeefloat_t::update_size(size_t s)
|
||||
{
|
||||
length_ = (long)s;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
int grib_accessor_ieeefloat_t::nearest_smaller_value(double val, double* nearest)
|
||||
|
|
|
@ -17,7 +17,7 @@ void grib_accessor_ksec1expver_t::init(const long len, grib_arguments* arg)
|
|||
{
|
||||
grib_accessor_ascii_t::init(len, arg);
|
||||
length_ = len;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
int grib_accessor_ksec1expver_t::unpack_long(long* val, size_t* len)
|
||||
|
@ -29,7 +29,7 @@ int grib_accessor_ksec1expver_t::unpack_long(long* val, size_t* len)
|
|||
char expver[5];
|
||||
char refexpver[5];
|
||||
size_t llen = length_ + 1;
|
||||
Assert(length_ == 4);
|
||||
ECCODES_ASSERT(length_ == 4);
|
||||
|
||||
if (*len < 1) {
|
||||
grib_context_log(context_, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", name_, 1);
|
||||
|
|
|
@ -106,7 +106,7 @@ int grib_accessor_latlon_increment_t::unpack_double(double* val, size_t* len)
|
|||
*val = GRIB_MISSING_DOUBLE;
|
||||
}
|
||||
else {
|
||||
Assert(angleDivisor != 0);
|
||||
ECCODES_ASSERT(angleDivisor != 0);
|
||||
*val = (double)directionIncrement / angleDivisor * angleMultiplier;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ int grib_accessor_local_definition_t::pack_long(const long* val, size_t* len)
|
|||
long editionNumber = 0;
|
||||
|
||||
if (grib_get_long(hand, "editionNumber", &editionNumber) == GRIB_SUCCESS) {
|
||||
Assert(editionNumber != 1);
|
||||
ECCODES_ASSERT(editionNumber != 1);
|
||||
}
|
||||
|
||||
if (grib_get_long(hand, productDefinitionTemplateNumber_, &productDefinitionTemplateNumber) != GRIB_SUCCESS)
|
||||
|
|
|
@ -28,7 +28,7 @@ void grib_accessor_long_vector_t::init(const long l, grib_arguments* c)
|
|||
index_ = c->get_long(grib_handle_of_accessor(this), n++);
|
||||
|
||||
/* check index_ on init and never change it */
|
||||
Assert(index_ < v->number_of_elements_ && index_ >= 0);
|
||||
ECCODES_ASSERT(index_ < v->number_of_elements_ && index_ >= 0);
|
||||
|
||||
length_ = 0;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ int grib_accessor_lookup_t::unpack_long(long* val, size_t* len)
|
|||
|
||||
/* This is used when reparsing or rebuilding */
|
||||
if (h->loader) {
|
||||
Assert(*len == 1);
|
||||
ECCODES_ASSERT(*len == 1);
|
||||
return h->loader->lookup_long(h->context, h->loader, name_, val);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ void grib_accessor_md5_t::init(const long len, grib_arguments* arg)
|
|||
current = blocklist_;
|
||||
}
|
||||
else {
|
||||
Assert(current);
|
||||
ECCODES_ASSERT(current);
|
||||
if (current) {
|
||||
current->next = (grib_string_list*)grib_context_malloc_clear(context, sizeof(grib_string_list));
|
||||
current->next->value = grib_context_strdup(context, b);
|
||||
|
|
|
@ -42,7 +42,7 @@ void grib_accessor_message_t::resize(size_t new_size)
|
|||
// grib_context_free(context_ , zero);
|
||||
// grib_context_log(context_ , GRIB_LOG_DEBUG, "resize: grib_accessor_message %ld %ld %s %s",
|
||||
// (long)new_size, (long)a->length, a->cclass->name, name_ );
|
||||
// Assert(new_size == length_ );
|
||||
// ECCODES_ASSERT(new_size == length_ );
|
||||
}
|
||||
|
||||
int grib_accessor_message_t::value_count(long* count)
|
||||
|
|
|
@ -155,7 +155,7 @@ int grib_accessor_number_of_points_gaussian_t::unpack_long_new(long* val, size_t
|
|||
return GRIB_GEOCALCULUS_PROBLEM;
|
||||
|
||||
if (grib_get_long(h, "angleSubdivisions", &angleSubdivisions) == GRIB_SUCCESS) {
|
||||
Assert(angleSubdivisions > 0);
|
||||
ECCODES_ASSERT(angleSubdivisions > 0);
|
||||
angular_precision = 1.0 / angleSubdivisions;
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ int grib_accessor_number_of_points_gaussian_t::unpack_long_with_legacy_support(l
|
|||
return GRIB_GEOCALCULUS_PROBLEM;
|
||||
|
||||
if (grib_get_long(h, "angleSubdivisions", &angleSubdivisions) == GRIB_SUCCESS) {
|
||||
Assert(angleSubdivisions > 0);
|
||||
ECCODES_ASSERT(angleSubdivisions > 0);
|
||||
angular_precision = 1.0 / angleSubdivisions;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ int grib_accessor_number_of_values_data_raw_packing_t::unpack_long(long* val, si
|
|||
long byte_count = 0;
|
||||
|
||||
adata = grib_find_accessor(grib_handle_of_accessor(this), values_);
|
||||
Assert(adata != NULL);
|
||||
ECCODES_ASSERT(adata != NULL);
|
||||
byte_count = adata->byte_count();
|
||||
if ((err = grib_get_long_internal(grib_handle_of_accessor(this), precision_, &precision)) != GRIB_SUCCESS)
|
||||
return err;
|
||||
|
|
|
@ -98,7 +98,7 @@ int grib_accessor_octahedral_gaussian_t::unpack_long(long* val, size_t* len)
|
|||
|
||||
if ((ret = grib_get_size(hand, pl_, &plsize)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
Assert(plsize); /* pl array must have at least one element */
|
||||
ECCODES_ASSERT(plsize); /* pl array must have at least one element */
|
||||
|
||||
pl = (long*)grib_context_malloc_clear(c, sizeof(long) * plsize);
|
||||
if (!pl) {
|
||||
|
|
|
@ -43,7 +43,7 @@ void grib_accessor_padding_t::resize(size_t new_size)
|
|||
grib_context_log(context_, GRIB_LOG_DEBUG,
|
||||
"grib_accessor_padding::resize new_size=%zu length_ =%ld %s %s",
|
||||
new_size, length_, class_name_, name_);
|
||||
Assert(new_size == length_);
|
||||
ECCODES_ASSERT(new_size == length_);
|
||||
}
|
||||
|
||||
int grib_accessor_padding_t::value_count(long* c)
|
||||
|
|
|
@ -213,7 +213,7 @@ int grib_accessor_proj_string_t::unpack_string(char* v, size_t* len)
|
|||
grib_handle* h = grib_handle_of_accessor(this);
|
||||
size_t size = sizeof(grid_type) / sizeof(*grid_type);
|
||||
|
||||
Assert(endpoint_ == ENDPOINT_SOURCE || endpoint_ == ENDPOINT_TARGET);
|
||||
ECCODES_ASSERT(endpoint_ == ENDPOINT_SOURCE || endpoint_ == ENDPOINT_TARGET);
|
||||
|
||||
size_t l = 100; // Safe bet
|
||||
if (*len < l) {
|
||||
|
@ -247,7 +247,7 @@ int grib_accessor_proj_string_t::unpack_string(char* v, size_t* len)
|
|||
}
|
||||
|
||||
size = strlen(v);
|
||||
Assert(size > 0);
|
||||
ECCODES_ASSERT(size > 0);
|
||||
*len = size + 1;
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ void grib_accessor_raw_t::init(const long len, grib_arguments* arg)
|
|||
if (length_ < 0)
|
||||
length_ = 0;
|
||||
|
||||
/* Assert(length_ >=0); */
|
||||
/* ECCODES_ASSERT(length_ >=0); */
|
||||
}
|
||||
|
||||
long grib_accessor_raw_t::get_native_type()
|
||||
|
@ -85,7 +85,7 @@ void grib_accessor_raw_t::update_size(size_t s)
|
|||
{
|
||||
grib_context_log(context_, GRIB_LOG_DEBUG, "updating size of %s old %ld new %ld", name_, length_, s);
|
||||
length_ = s;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
void accessor_raw_set_length(grib_accessor* a, size_t len)
|
||||
|
|
|
@ -40,7 +40,7 @@ int grib_accessor_reference_value_error_t::unpack_double(double* val, size_t* le
|
|||
else if (!strcmp(floatType_, "ieee"))
|
||||
*val = grib_ieeefloat_error(referenceValue);
|
||||
else
|
||||
Assert(1 == 0);
|
||||
ECCODES_ASSERT(1 == 0);
|
||||
|
||||
if (ret == GRIB_SUCCESS)
|
||||
*len = 1;
|
||||
|
|
|
@ -66,10 +66,10 @@ void grib_accessor_section_t::update_size(size_t length)
|
|||
{
|
||||
size_t size = 1;
|
||||
long len = length;
|
||||
Assert(length <= 0x7fffffff);
|
||||
ECCODES_ASSERT(length <= 0x7fffffff);
|
||||
if (sub_section_->aclength) {
|
||||
int e = sub_section_->aclength->pack_long(&len, &size);
|
||||
Assert(e == GRIB_SUCCESS);
|
||||
ECCODES_ASSERT(e == GRIB_SUCCESS);
|
||||
// printf("update_length %s %ld %ld\n", sub_section_ ->aclength->name,
|
||||
// (long)sub_section_ ->aclength->offset,
|
||||
// (long)sub_section_ ->aclength->length);
|
||||
|
@ -80,7 +80,7 @@ void grib_accessor_section_t::update_size(size_t length)
|
|||
|
||||
// printf("update_size %s %ld\n", a->name, length_ );
|
||||
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
grib_accessor* grib_accessor_section_t::next(grib_accessor* a, int explore)
|
||||
|
|
|
@ -20,7 +20,7 @@ void grib_accessor_section_length_t::init(const long len, grib_arguments* arg)
|
|||
length_ = len;
|
||||
flags_ |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
||||
flags_ |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
void grib_accessor_section_length_t::dump(eccodes::Dumper* dumper)
|
||||
|
|
|
@ -45,7 +45,7 @@ size_t grib_accessor_section_padding_t::preferred_size(int from_handle)
|
|||
else
|
||||
alength = 0;
|
||||
|
||||
/*Assert(length_ >=0);*/
|
||||
/*ECCODES_ASSERT(length_ >=0);*/
|
||||
|
||||
if (alength < 0)
|
||||
alength = 0;
|
||||
|
|
|
@ -22,7 +22,7 @@ void grib_accessor_section_pointer_t::init(const long len, grib_arguments* arg)
|
|||
sectionLength_ = arg->get_name(grib_handle_of_accessor(this), n++);
|
||||
sectionNumber_ = arg->get_long(grib_handle_of_accessor(this), n++);
|
||||
|
||||
Assert(sectionNumber_ < MAX_NUM_SECTIONS);
|
||||
ECCODES_ASSERT(sectionNumber_ < MAX_NUM_SECTIONS);
|
||||
|
||||
grib_handle_of_accessor(this)->section_offset[sectionNumber_] = (char*)sectionOffset_;
|
||||
grib_handle_of_accessor(this)->section_length[sectionNumber_] = (char*)sectionLength_;
|
||||
|
|
|
@ -24,7 +24,7 @@ void grib_accessor_signed_t::init(const long len, grib_arguments* arg)
|
|||
value_count(&count);
|
||||
length_ = len * count;
|
||||
nbytes_ = len;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
void grib_accessor_signed_t::dump(eccodes::Dumper* dumper)
|
||||
|
@ -67,7 +67,7 @@ int grib_accessor_signed_t::unpack_long(long* val, size_t* len)
|
|||
}
|
||||
|
||||
if (flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) {
|
||||
Assert(nbytes_ <= 4);
|
||||
ECCODES_ASSERT(nbytes_ <= 4);
|
||||
missing = ones[nbytes_];
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ int grib_accessor_signed_t::pack_long(const long* val, size_t* len)
|
|||
}
|
||||
|
||||
if (flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) {
|
||||
Assert(nbytes_ <= 4);
|
||||
ECCODES_ASSERT(nbytes_ <= 4);
|
||||
missing = ones[nbytes_];
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ long grib_accessor_signed_t::byte_offset()
|
|||
void grib_accessor_signed_t::update_size(size_t s)
|
||||
{
|
||||
length_ = s;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
long grib_accessor_signed_t::next_offset()
|
||||
|
@ -199,7 +199,7 @@ int grib_accessor_signed_t::is_missing()
|
|||
const grib_handle* hand = grib_handle_of_accessor(this);
|
||||
|
||||
if (length_ == 0) {
|
||||
Assert(vvalue_ != NULL);
|
||||
ECCODES_ASSERT(vvalue_ != NULL);
|
||||
return vvalue_->missing;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ int grib_accessor_simple_packing_error_t::unpack_double(double* val, size_t* len
|
|||
else if (!strcmp(floatType_, "ieee"))
|
||||
*val = grib_ieeefloat_error(referenceValue);
|
||||
else
|
||||
Assert(1 == 0);
|
||||
ECCODES_ASSERT(1 == 0);
|
||||
|
||||
if (bitsPerValue != 0)
|
||||
*val = (*val + codes_power<double>(binaryScaleFactor, 2)) * codes_power<double>(-decimalScaleFactor, 10) * 0.5;
|
||||
|
|
|
@ -173,7 +173,7 @@ static int grib_load_smart_table(grib_context* c, const char* filename,
|
|||
if (!f)
|
||||
return GRIB_IO_PROBLEM;
|
||||
|
||||
Assert(t != NULL);
|
||||
ECCODES_ASSERT(t != NULL);
|
||||
|
||||
if (t->filename[0] == NULL) {
|
||||
t->filename[0] = grib_context_strdup_persistent(c, filename);
|
||||
|
|
|
@ -48,7 +48,7 @@ int grib_accessor_sprintf_t::unpack_string(char* val, size_t* len)
|
|||
char *theEnd = NULL, *start;
|
||||
start = (char*)&(uname[++i]);
|
||||
precision = strtol(start, &theEnd, 10);
|
||||
Assert(*theEnd != 0);
|
||||
ECCODES_ASSERT(*theEnd != 0);
|
||||
while (uname[i] != *theEnd)
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ int grib_accessor_unexpanded_descriptors_t::pack_long(const long* val, size_t* l
|
|||
return ret;
|
||||
|
||||
expanded = dynamic_cast<grib_accessor_expanded_descriptors_t*>(grib_find_accessor(hand, "expandedCodes"));
|
||||
Assert(expanded != NULL);
|
||||
ECCODES_ASSERT(expanded != NULL);
|
||||
ret = expanded->grib_accessor_expanded_descriptors_set_do_expand(1);
|
||||
if (ret != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
|
|
@ -78,7 +78,7 @@ int grib_accessor_unsigned_t::pack_long_unsigned_helper(const long* val, size_t*
|
|||
return err;
|
||||
|
||||
if (flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) {
|
||||
Assert(nbytes_ <= 4);
|
||||
ECCODES_ASSERT(nbytes_ <= 4);
|
||||
missing = ones[nbytes_];
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ int grib_accessor_unsigned_t::unpack_long(long* val, size_t* len)
|
|||
}
|
||||
|
||||
if (flags_ & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) {
|
||||
Assert(nbytes_ <= 4);
|
||||
ECCODES_ASSERT(nbytes_ <= 4);
|
||||
missing = ones[nbytes_];
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ int grib_accessor_unsigned_t::is_missing()
|
|||
const grib_handle* hand = grib_handle_of_accessor(this);
|
||||
|
||||
if (length_ == 0) {
|
||||
Assert(vvalue_ != NULL);
|
||||
ECCODES_ASSERT(vvalue_ != NULL);
|
||||
return vvalue_->missing;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ long grib_accessor_values_t::init_length()
|
|||
/* When reparsing */
|
||||
if (offsetdata < offsetsection) {
|
||||
/* printf("init_length offsetdata < offsetsection=0\n"); */
|
||||
Assert(grib_handle_of_accessor(this)->loader);
|
||||
ECCODES_ASSERT(grib_handle_of_accessor(this)->loader);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ void grib_accessor_values_t::init(const long v, grib_arguments* params)
|
|||
values_dirty_ = 1;
|
||||
|
||||
length_ = init_length();
|
||||
/* Assert(length_ >=0); */
|
||||
/* ECCODES_ASSERT(length_ >=0); */
|
||||
}
|
||||
|
||||
long grib_accessor_values_t::get_native_type()
|
||||
|
@ -88,7 +88,7 @@ void grib_accessor_values_t::update_size(size_t s)
|
|||
{
|
||||
grib_context_log(context_, GRIB_LOG_DEBUG, "updating size of %s old %ld new %ld", name_, length_, s);
|
||||
length_ = s;
|
||||
Assert(length_ >= 0);
|
||||
ECCODES_ASSERT(length_ >= 0);
|
||||
}
|
||||
|
||||
int grib_accessor_values_t::compare(grib_accessor* b)
|
||||
|
|
|
@ -34,11 +34,11 @@ int grib_accessor_vector_t::unpack_double(double* val, size_t* len)
|
|||
grib_accessor* va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(this), vector_);
|
||||
grib_accessor_abstract_vector_t* v = (grib_accessor_abstract_vector_t*)va;
|
||||
|
||||
Assert(index_ >= 0);
|
||||
ECCODES_ASSERT(index_ >= 0);
|
||||
|
||||
if (index_ >= v->number_of_elements_) {
|
||||
grib_context_log(context_, GRIB_LOG_FATAL, "index=%d number_of_elements=%d for %s", index_, v->number_of_elements_, name_);
|
||||
Assert(index_ < v->number_of_elements_);
|
||||
ECCODES_ASSERT(index_ < v->number_of_elements_);
|
||||
}
|
||||
|
||||
if (va->dirty_) {
|
||||
|
|
|
@ -72,7 +72,7 @@ static void init(grib_action_class* c)
|
|||
// if(c->super) {
|
||||
// grib_action_class *g = *(c->super);
|
||||
// if (g && !g->inited) {
|
||||
// Assert(g->super == NULL);
|
||||
// ECCODES_ASSERT(g->super == NULL);
|
||||
// g->init_class(g);
|
||||
// g->inited = 1;
|
||||
// }
|
||||
|
@ -205,10 +205,10 @@ void grib_dump_action_branch(FILE* out, grib_action* a, int decay)
|
|||
|
||||
void grib_dump_action_tree(grib_context* ctx, FILE* out)
|
||||
{
|
||||
Assert(ctx);
|
||||
Assert(ctx->grib_reader);
|
||||
Assert(ctx->grib_reader->first);
|
||||
Assert(out);
|
||||
ECCODES_ASSERT(ctx);
|
||||
ECCODES_ASSERT(ctx->grib_reader);
|
||||
ECCODES_ASSERT(ctx->grib_reader->first);
|
||||
ECCODES_ASSERT(out);
|
||||
|
||||
// grib_dump_action_branch(out, ctx->grib_reader->first->root, 0);
|
||||
// grib_action* next = ctx->grib_reader->first->root;
|
||||
|
|
|
@ -230,12 +230,12 @@ static grib_concept_value* get_concept_impl(grib_handle* h, grib_action_concept*
|
|||
if (self->concept_value != NULL)
|
||||
return self->concept_value;
|
||||
|
||||
Assert(self->masterDir);
|
||||
ECCODES_ASSERT(self->masterDir);
|
||||
grib_get_string(h, self->masterDir, masterDir, &lenMasterDir);
|
||||
|
||||
// See ECC-1920: The basename could be a key or a string
|
||||
char* basename = self->basename; // default is a string
|
||||
Assert(basename);
|
||||
ECCODES_ASSERT(basename);
|
||||
char baseNameValue[1024] = {0,}; // its value if a key
|
||||
size_t lenBaseName = sizeof(baseNameValue);
|
||||
if (grib_get_string(h, self->basename, baseNameValue, &lenBaseName) == GRIB_SUCCESS) {
|
||||
|
@ -399,7 +399,7 @@ int get_concept_condition_string(grib_handle* h, const char* key, const char* va
|
|||
while (concept_condition) {
|
||||
//grib_expression* expression = concept_condition->expression;
|
||||
const char* condition_name = concept_condition->name;
|
||||
//Assert(expression);
|
||||
//ECCODES_ASSERT(expression);
|
||||
if (concept_condition_expression_true(h, concept_condition, exprVal) && strcmp(condition_name, "one") != 0) {
|
||||
length += snprintf(result + length, 2048, "%s%s=%s",
|
||||
(length == 0 ? "" : ","), condition_name, exprVal);
|
||||
|
|
|
@ -100,7 +100,7 @@ grib_action* grib_action_create_gen(grib_context* context, const char* name, con
|
|||
flag_stringtype = 1;
|
||||
if (flag_lowercase && !flag_stringtype) {
|
||||
printf("grib_action_create_gen name=%s. Has lowercase but not string_type\n", name);
|
||||
Assert(0);
|
||||
ECCODES_ASSERT(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -195,7 +195,7 @@ static void destroy(grib_context* context, grib_action* act)
|
|||
|
||||
// This is currently unset. So assert that it is NULL
|
||||
const grib_hash_array_value* v = self->hash_array;
|
||||
Assert(v == NULL);
|
||||
ECCODES_ASSERT(v == NULL);
|
||||
// if (v)
|
||||
// grib_trie_delete(v->index);
|
||||
// while (v) {
|
||||
|
@ -233,7 +233,7 @@ static grib_hash_array_value* get_hash_array_impl(grib_handle* h, grib_action* a
|
|||
if (self->hash_array != NULL)
|
||||
return self->hash_array;
|
||||
|
||||
Assert(self->masterDir);
|
||||
ECCODES_ASSERT(self->masterDir);
|
||||
grib_get_string(h, self->masterDir, masterDir, &lenMasterDir);
|
||||
|
||||
snprintf(buf, 4096, "%s/%s", masterDir, self->basename);
|
||||
|
|
|
@ -69,10 +69,10 @@ static void init_class(grib_action_class* c)
|
|||
// static void check_sections(grib_section *s,grib_handle* h)
|
||||
// {
|
||||
// grib_accessor *a = s?s->block->first:NULL;
|
||||
// if(s) Assert(s->h == h);
|
||||
// if(s) ECCODES_ASSERT(s->h == h);
|
||||
// while(a)
|
||||
// {
|
||||
// Assert(grib_handle_of_accessor(a) == h);
|
||||
// ECCODES_ASSERT(grib_handle_of_accessor(a) == h);
|
||||
// check_sections(a->sub_section_,h);
|
||||
// a = a->next;
|
||||
// }
|
||||
|
@ -107,7 +107,7 @@ static int notify_change(grib_action* act, grib_accessor* notified,
|
|||
old_section = notified->sub_section_;
|
||||
if (!old_section) return GRIB_INTERNAL_ERROR;
|
||||
|
||||
Assert(old_section->h == h);
|
||||
ECCODES_ASSERT(old_section->h == h);
|
||||
|
||||
/* printf("old = %p\n",(void*)old_section->branch); */
|
||||
/* printf("new = %p\n",(void*)la); */
|
||||
|
@ -139,7 +139,7 @@ static int notify_change(grib_action* act, grib_accessor* notified,
|
|||
return GRIB_OUT_OF_MEMORY;
|
||||
|
||||
tmp_handle->buffer = grib_create_growable_buffer(h->context);
|
||||
Assert(tmp_handle->buffer); /* FIXME */
|
||||
ECCODES_ASSERT(tmp_handle->buffer); /* FIXME */
|
||||
|
||||
loader.data = h;
|
||||
loader.lookup_long = grib_lookup_long_from_handle;
|
||||
|
@ -150,7 +150,7 @@ static int notify_change(grib_action* act, grib_accessor* notified,
|
|||
return GRIB_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
Assert(h->kid == NULL);
|
||||
ECCODES_ASSERT(h->kid == NULL);
|
||||
tmp_handle->loader = &loader;
|
||||
tmp_handle->main = h;
|
||||
h->kid = tmp_handle;
|
||||
|
@ -188,16 +188,16 @@ static int notify_change(grib_action* act, grib_accessor* notified,
|
|||
//if(h->context->debug > 10)
|
||||
// grib_dump_content(tmp_handle,stdout,NULL,0,NULL);
|
||||
|
||||
/* Assert(tmp_handle->buffer->ulength == len); */
|
||||
/* ECCODES_ASSERT(tmp_handle->buffer->ulength == len); */
|
||||
/* grib_empty_section(h->context,old_section); */
|
||||
|
||||
grib_buffer_replace(notified, tmp_handle->buffer->data, tmp_handle->buffer->ulength, 0, 1);
|
||||
|
||||
Assert(tmp_handle->root->block->first != NULL);
|
||||
ECCODES_ASSERT(tmp_handle->root->block->first != NULL);
|
||||
grib_swap_sections(old_section,
|
||||
tmp_handle->root->block->first->sub_section_);
|
||||
|
||||
Assert(tmp_handle->dependencies == NULL);
|
||||
ECCODES_ASSERT(tmp_handle->dependencies == NULL);
|
||||
/* printf("grib_handle_delete %p\n",(void*)tmp_handle); */
|
||||
|
||||
grib_handle_delete(tmp_handle);
|
||||
|
@ -218,7 +218,7 @@ static int notify_change(grib_action* act, grib_accessor* notified,
|
|||
if (h->context->debug > 10)
|
||||
grib_dump_content(h, stdout, "debug", ~0, NULL);
|
||||
|
||||
Assert(size == len);
|
||||
ECCODES_ASSERT(size == len);
|
||||
|
||||
grib_update_paddings(old_section);
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ static int execute(grib_action* act, grib_handle* h)
|
|||
size_t size = sizeof(tmp);
|
||||
int err = 0;
|
||||
|
||||
Assert(args);
|
||||
ECCODES_ASSERT(args);
|
||||
|
||||
while (c) {
|
||||
e = args->expression_;
|
||||
|
|
|
@ -126,7 +126,7 @@ static int execute(grib_action* act, grib_handle* h)
|
|||
}
|
||||
}
|
||||
|
||||
Assert(filename);
|
||||
ECCODES_ASSERT(filename);
|
||||
if (a->append)
|
||||
of = grib_file_open(filename, "a", &err);
|
||||
else
|
||||
|
|
|
@ -809,7 +809,7 @@ static char* codes_bufr_header_get_centre_name(long edition, long centre_code)
|
|||
|
||||
if( *p =='\0' ) continue;
|
||||
|
||||
Assert(isdigit(*p));
|
||||
ECCODES_ASSERT(isdigit(*p));
|
||||
while(*p != '\0') {
|
||||
if(isspace(*p)) break;
|
||||
code *= 10;
|
||||
|
@ -838,13 +838,13 @@ int codes_bufr_header_get_string(codes_bufr_header* bh, const char* key, char* v
|
|||
{
|
||||
static const char* NOT_FOUND = "not_found";
|
||||
bool isEcmwfLocal = false;
|
||||
Assert(bh);
|
||||
Assert(key);
|
||||
ECCODES_ASSERT(bh);
|
||||
ECCODES_ASSERT(key);
|
||||
*len = strlen(NOT_FOUND); // By default
|
||||
|
||||
isEcmwfLocal = (bh->ecmwfLocalSectionPresent == 1);
|
||||
Assert(!(isEcmwfLocal && bh->bufrHeaderCentre != 98));
|
||||
Assert(!(bh->ecmwfLocalSectionPresent && !bh->localSectionPresent));
|
||||
ECCODES_ASSERT(!(isEcmwfLocal && bh->bufrHeaderCentre != 98));
|
||||
ECCODES_ASSERT(!(bh->ecmwfLocalSectionPresent && !bh->localSectionPresent));
|
||||
|
||||
if (strcmp(key, "message_offset") == 0)
|
||||
*len = snprintf(val, 32, "%lu", bh->message_offset);
|
||||
|
|
|
@ -33,7 +33,7 @@ double rint(double x)
|
|||
double result = 0;
|
||||
buf = (char*)malloc(_CVTBUFSIZE);
|
||||
err = _fcvt_s(buf, _CVTBUFSIZE, x, 0, &decimal, &sign);
|
||||
Assert(err == 0);
|
||||
ECCODES_ASSERT(err == 0);
|
||||
result = atof(buf);
|
||||
if (sign == 1) {
|
||||
result = result * -1;
|
||||
|
@ -148,7 +148,7 @@ int codes_flush_sync_close_file(FILE* f)
|
|||
int err = 0;
|
||||
int fd = 0;
|
||||
const grib_context* c = grib_context_get_default();
|
||||
Assert(f);
|
||||
ECCODES_ASSERT(f);
|
||||
|
||||
fd = fileno(f);
|
||||
if (fd == -1) {
|
||||
|
@ -274,7 +274,7 @@ long convert_to_minutes(long step, long stepUnits)
|
|||
return step * 60; /* unit=hours */
|
||||
if (stepUnits == 13)
|
||||
return step / 60; /* unit=seconds */
|
||||
/* Assert( stepUnits < sizeof(u2m)/sizeof(u2m[0]) ); */
|
||||
/* ECCODES_ASSERT( stepUnits < sizeof(u2m)/sizeof(u2m[0]) ); */
|
||||
|
||||
result = step * u2m[stepUnits];
|
||||
return (long)result;
|
||||
|
@ -514,7 +514,7 @@ int codes_is_feature_enabled(const char* feature)
|
|||
|
||||
int codes_get_features(char* result, size_t* length, int select)
|
||||
{
|
||||
Assert(select == CODES_FEATURES_ALL || select == CODES_FEATURES_ENABLED || select == CODES_FEATURES_DISABLED);
|
||||
ECCODES_ASSERT(select == CODES_FEATURES_ALL || select == CODES_FEATURES_ENABLED || select == CODES_FEATURES_DISABLED);
|
||||
|
||||
const size_t num = NUMBER(known_features);
|
||||
result[0] = '\0';
|
||||
|
@ -541,7 +541,7 @@ int codes_get_features(char* result, size_t* length, int select)
|
|||
if (result[actual_length - 1] == ' ')
|
||||
result[actual_length - 1] = '\0';
|
||||
|
||||
Assert(*length >= actual_length);
|
||||
ECCODES_ASSERT(*length >= actual_length);
|
||||
*length = actual_length;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -579,7 +579,7 @@ void BufrDecodeC::dump_attributes(grib_accessor* a, const char* prefix)
|
|||
|
||||
void BufrDecodeC::header(const grib_handle* h)
|
||||
{
|
||||
Assert(h->product_kind == PRODUCT_BUFR);
|
||||
ECCODES_ASSERT(h->product_kind == PRODUCT_BUFR);
|
||||
|
||||
if (count_ < 2) {
|
||||
/* This is the first message being processed */
|
||||
|
|
|
@ -92,7 +92,7 @@ void BufrEncodeC::dump_values(grib_accessor* a)
|
|||
else {
|
||||
err = a->unpack_double(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -186,7 +186,7 @@ void BufrEncodeC::dump_values_attribute(grib_accessor* a, const char* prefix)
|
|||
else {
|
||||
err = a->unpack_double(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -300,7 +300,7 @@ void BufrEncodeC::dump_long(grib_accessor* a, const char* comment)
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -406,7 +406,7 @@ void BufrEncodeC::dump_long_attribute(grib_accessor* a, const char* prefix)
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -757,7 +757,7 @@ void BufrEncodeC::header(const grib_handle* h)
|
|||
char sampleName[200] = { 0 };
|
||||
long localSectionPresent, edition, bufrHeaderCentre, isSatellite;
|
||||
|
||||
Assert(h->product_kind == PRODUCT_BUFR);
|
||||
ECCODES_ASSERT(h->product_kind == PRODUCT_BUFR);
|
||||
|
||||
grib_get_long(h, "localSectionPresent", &localSectionPresent);
|
||||
grib_get_long(h, "bufrHeaderCentre", &bufrHeaderCentre);
|
||||
|
|
|
@ -69,7 +69,7 @@ void BufrEncodeFilter::dump_values(grib_accessor* a)
|
|||
else {
|
||||
err = a->unpack_double(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
begin_ = 0;
|
||||
empty_ = 0;
|
||||
|
@ -158,7 +158,7 @@ void BufrEncodeFilter::dump_values_attribute(grib_accessor* a, const char* prefi
|
|||
else {
|
||||
err = a->unpack_double(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -251,7 +251,7 @@ void BufrEncodeFilter::dump_long(grib_accessor* a, const char* comment)
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
begin_ = 0;
|
||||
empty_ = 0;
|
||||
|
@ -338,7 +338,7 @@ void BufrEncodeFilter::dump_long_attribute(grib_accessor* a, const char* prefix)
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -689,7 +689,7 @@ void BufrEncodeFilter::header(const grib_handle* h)
|
|||
char sampleName[128] = { 0 };
|
||||
long localSectionPresent, edition, bufrHeaderCentre, isSatellite;
|
||||
|
||||
Assert(h->product_kind == PRODUCT_BUFR);
|
||||
ECCODES_ASSERT(h->product_kind == PRODUCT_BUFR);
|
||||
|
||||
grib_get_long(h, "localSectionPresent", &localSectionPresent);
|
||||
grib_get_long(h, "bufrHeaderCentre", &bufrHeaderCentre);
|
||||
|
|
|
@ -139,7 +139,7 @@ void BufrEncodeFortran::dump_values(grib_accessor* a)
|
|||
else {
|
||||
err = a->unpack_double(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -232,7 +232,7 @@ void BufrEncodeFortran::dump_values_attribute(grib_accessor* a, const char* pref
|
|||
else {
|
||||
err = a->unpack_double(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -346,7 +346,7 @@ void BufrEncodeFortran::dump_long(grib_accessor* a, const char* comment)
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -451,7 +451,7 @@ void BufrEncodeFortran::dump_long_attribute(grib_accessor* a, const char* prefix
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ void BufrEncodePython::dump_values(grib_accessor* a)
|
|||
else {
|
||||
err = a->unpack_double(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -183,7 +183,7 @@ void BufrEncodePython::dump_values_attribute(grib_accessor* a, const char* prefi
|
|||
else {
|
||||
err = a->unpack_double(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -297,7 +297,7 @@ void BufrEncodePython::dump_long(grib_accessor* a, const char* comment)
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -401,7 +401,7 @@ void BufrEncodePython::dump_long_attribute(grib_accessor* a, const char* prefix)
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ void BufrSimple::dump_values(grib_accessor* a)
|
|||
else {
|
||||
err = a->unpack_double(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -160,7 +160,7 @@ void BufrSimple::dump_values_attribute(grib_accessor* a, const char* prefix)
|
|||
else {
|
||||
err = a->unpack_double(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -263,7 +263,7 @@ void BufrSimple::dump_long(grib_accessor* a, const char* comment)
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -359,7 +359,7 @@ void BufrSimple::dump_long_attribute(grib_accessor* a, const char* prefix)
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
empty_ = 0;
|
||||
|
||||
|
@ -553,7 +553,7 @@ void BufrSimple::dump_string(grib_accessor* a, const char* comment)
|
|||
fprintf(out_, " *** ERR=%d (%s) [dump_string on '%s']", err, grib_get_error_message(err), acc_name);
|
||||
return;
|
||||
}
|
||||
Assert(size < MAX_STRING_SIZE);
|
||||
ECCODES_ASSERT(size < MAX_STRING_SIZE);
|
||||
p = value;
|
||||
r = compute_bufr_key_rank(h, keys_, acc_name);
|
||||
if (grib_is_missing_string(a, (unsigned char*)value, size)) {
|
||||
|
@ -643,7 +643,7 @@ void BufrSimple::dump_section(grib_accessor* a, grib_block_of_accessors* block)
|
|||
empty_ = 1;
|
||||
|
||||
err = grib_get_long(h, "numberOfSubsets", &(numberOfSubsets_));
|
||||
Assert(!err);
|
||||
ECCODES_ASSERT(!err);
|
||||
_dump_long_array(h, out_, "dataPresentIndicator");
|
||||
_dump_long_array(h, out_, "delayedDescriptorReplicationFactor");
|
||||
_dump_long_array(h, out_, "shortDelayedDescriptorReplicationFactor");
|
||||
|
|
|
@ -83,7 +83,7 @@ void Default::dump_long(grib_accessor* a, const char* comment)
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
aliases(a);
|
||||
if (comment) {
|
||||
|
@ -549,7 +549,7 @@ void Default::dump_section(grib_accessor* a, grib_block_of_accessors* block)
|
|||
/* char tmp[512]; */
|
||||
/* grib_section* s = a->sub_section; */
|
||||
upper = (char*)malloc(strlen(a->name_) + 1);
|
||||
Assert(upper);
|
||||
ECCODES_ASSERT(upper);
|
||||
p = (char*)a->name_;
|
||||
q = upper;
|
||||
while (*p != '\0') {
|
||||
|
|
|
@ -307,7 +307,7 @@ void GribEncodeC::header(const grib_handle* h)
|
|||
ret = grib_get_long(h, "editionNumber", &edition);
|
||||
if (ret != GRIB_SUCCESS) {
|
||||
grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to get edition number.");
|
||||
Assert(0);
|
||||
ECCODES_ASSERT(0);
|
||||
}
|
||||
|
||||
fprintf(out_,
|
||||
|
|
|
@ -60,7 +60,7 @@ void Json::dump_values(grib_accessor* a)
|
|||
else {
|
||||
err = a->unpack_double(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
(void)err; /* TODO */
|
||||
|
||||
if (begin_ == 0 && empty_ == 0 && isAttribute_ == 0)
|
||||
|
@ -152,7 +152,7 @@ void Json::dump_long(grib_accessor* a, const char* comment)
|
|||
else {
|
||||
err = a->unpack_long(&value, &size2);
|
||||
}
|
||||
Assert(size2 == size);
|
||||
ECCODES_ASSERT(size2 == size);
|
||||
|
||||
if (begin_ == 0 && empty_ == 0 && isAttribute_ == 0)
|
||||
fprintf(out_, ",");
|
||||
|
@ -398,7 +398,7 @@ void Json::dump_string(grib_accessor* a, const char* comment)
|
|||
err, grib_get_error_message(err), a->name_);
|
||||
}
|
||||
else {
|
||||
Assert(size < MAX_STRING_SIZE);
|
||||
ECCODES_ASSERT(size < MAX_STRING_SIZE);
|
||||
}
|
||||
p = value;
|
||||
if (grib_is_missing_string(a, (unsigned char*)value, size)) {
|
||||
|
|
|
@ -274,7 +274,7 @@ void Serialize::dump_values(grib_accessor* a)
|
|||
|
||||
if (len > 0) {
|
||||
columns_str = (char*)malloc((len + 1) * sizeof(char));
|
||||
Assert(columns_str);
|
||||
ECCODES_ASSERT(columns_str);
|
||||
columns_str = (char*)memcpy(columns_str, pcf, len);
|
||||
columns_str[len] = '\0';
|
||||
columns = atoi(columns_str);
|
||||
|
|
|
@ -460,7 +460,7 @@ void Wmo::dump_section(grib_accessor* a, grib_block_of_accessors* block)
|
|||
|
||||
if (is_wmo_section) {
|
||||
upper = (char*)malloc(strlen(a->name_) + 1);
|
||||
Assert(upper);
|
||||
ECCODES_ASSERT(upper);
|
||||
p = (char*)a->name_;
|
||||
q = upper;
|
||||
while (*p != '\0') {
|
||||
|
|
|
@ -36,7 +36,7 @@ Accessor::string Accessor::evaluate_string(grib_handle* h, char* buf, size_t* si
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Assert(buf);
|
||||
ECCODES_ASSERT(buf);
|
||||
if ((*err = grib_get_string_internal(h, name_, mybuf, size)) != GRIB_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
|
@ -90,7 +90,7 @@ void Accessor::add_dependency(grib_accessor* observer)
|
|||
if (!observed) {
|
||||
/* grib_context_log(observer->context, GRIB_LOG_ERROR, */
|
||||
/* "Error in accessor_add_dependency: cannot find [%s]", name_); */
|
||||
/* Assert(observed); */
|
||||
/* ECCODES_ASSERT(observed); */
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ void IsInDict::add_dependency(grib_accessor* observer)
|
|||
if (!observed) {
|
||||
/* grib_context_log(observer->context, GRIB_LOG_ERROR, */
|
||||
/* "Error in accessor_add_dependency: cannot find [%s]", name_); */
|
||||
/* Assert(observed); */
|
||||
/* ECCODES_ASSERT(observed); */
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ void IsInList::add_dependency(grib_accessor* observer)
|
|||
if (!observed) {
|
||||
/* grib_context_log(observer->context, GRIB_LOG_ERROR, */
|
||||
/* "Error in accessor_add_dependency: cannot find [%s]", name_); */
|
||||
/* Assert(observed); */
|
||||
/* ECCODES_ASSERT(observed); */
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ void IsInteger::add_dependency(grib_accessor* observer)
|
|||
if (!observed) {
|
||||
/* grib_context_log(observer->context, GRIB_LOG_ERROR, */
|
||||
/* "Error in accessor_add_dependency: cannot find [%s]", name_); */
|
||||
/* Assert(observed); */
|
||||
/* ECCODES_ASSERT(observed); */
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue