*improved error promption of array manipulation.
This commit is contained in:
parent
3227bb521c
commit
dca1299260
3
HISTORY
3
HISTORY
@ -1,3 +1,6 @@
|
|||||||
|
Mar. 15 2016
|
||||||
|
Improved error promption of array manipulation
|
||||||
|
|
||||||
Mar. 11 2016
|
Mar. 11 2016
|
||||||
Improved error promption
|
Improved error promption
|
||||||
|
|
||||||
|
@ -11111,6 +11111,16 @@ int mb_init_array(struct mb_interpreter_t* s, void** l, mb_data_e t, int* d, int
|
|||||||
mb_assert(s && l && d && a);
|
mb_assert(s && l && d && a);
|
||||||
|
|
||||||
*a = 0;
|
*a = 0;
|
||||||
|
if(c >= MB_MAX_DIMENSION_COUNT) {
|
||||||
|
_handle_error_on_obj(s, SE_RN_DIMENSION_TOO_MUCH, s->source_file, TON(l), MB_FUNC_ERR, _exit, result);
|
||||||
|
}
|
||||||
|
for(j = 0; j < c; j++) {
|
||||||
|
n = d[j];
|
||||||
|
if(n <= 0) {
|
||||||
|
_handle_error_on_obj(s, SE_RN_ILLEGAL_BOUND, s->source_file, TON(l), MB_FUNC_ERR, _exit, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef MB_SIMPLE_ARRAY
|
#ifdef MB_SIMPLE_ARRAY
|
||||||
if(t == MB_DT_REAL) {
|
if(t == MB_DT_REAL) {
|
||||||
type = _DT_REAL;
|
type = _DT_REAL;
|
||||||
@ -11130,9 +11140,9 @@ int mb_init_array(struct mb_interpreter_t* s, void** l, mb_data_e t, int* d, int
|
|||||||
n = d[j];
|
n = d[j];
|
||||||
arr->dimensions[arr->dimension_count++] = n;
|
arr->dimensions[arr->dimension_count++] = n;
|
||||||
if(arr->count)
|
if(arr->count)
|
||||||
arr->count *= n;
|
arr->count *= (unsigned int)n;
|
||||||
else
|
else
|
||||||
arr->count += n;
|
arr->count += (unsigned int)n;
|
||||||
}
|
}
|
||||||
_init_array(arr);
|
_init_array(arr);
|
||||||
if(!arr->raw) {
|
if(!arr->raw) {
|
||||||
@ -11142,8 +11152,6 @@ int mb_init_array(struct mb_interpreter_t* s, void** l, mb_data_e t, int* d, int
|
|||||||
}
|
}
|
||||||
*a = arr;
|
*a = arr;
|
||||||
|
|
||||||
goto _exit; /* Avoid an unreferenced label warning */
|
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user