Branch: Tag:

2018-02-22

2018-02-22 19:21:47 by Martin Nilsson <nilsson@fastmail.com>

Calculate base_sp in bad_arg_error.

1074:       free_type(sval_type);    -  bad_arg_error(NULL, Pike_sp-1, 1, 1, t1->str, Pike_sp-1, +  bad_arg_error(NULL, NULL, 1, 1, t1->str, Pike_sp-1,    "%s(): Soft cast failed.\n%S",    fname, s.s);   
2200:    }    }    -  bad_arg_error("`-", Pike_sp-2, 2, 2, get_name_of_type(TYPEOF(Pike_sp[-2])), +  bad_arg_error("`-", NULL, 2, 2, get_name_of_type(TYPEOF(Pike_sp[-2])),    Pike_sp-1, "Subtract on different types.\n");    }   
4454:    ptrdiff_t len, i;       if(Pike_sp[-1].u.string->size_shift) { -  bad_arg_error("`~", Pike_sp-1, 1, 1, "string(0)", Pike_sp-1, +  bad_arg_error("`~", NULL, 1, 1, "string(0)", Pike_sp-1,    "Expected 8-bit string.\n");    }   
4735:    int f;    if (!o->prog)    bad_arg_error (range_func_name (bound_types), -  ind, Pike_sp - ind, 1, "object", ind, +  NULL, Pike_sp - ind, 1, "object", ind,    "Cannot call `[..] in destructed object.\n");       if ((f = FIND_LFUN(o->prog->inherits[SUBTYPEOF(*ind)].prog,
4776:    switch (call_old_range_lfun (bound_types, o, low, high)) {    case 1:    bad_arg_error (range_func_name (bound_types), -  ind, Pike_sp - ind, 1, "object", ind, +  NULL, Pike_sp - ind, 1, "object", ind,    "Object got neither `[..] nor `[].\n");    break;    case 2:    bad_arg_error (range_func_name (bound_types), -  ind, Pike_sp - ind, 1, "object", ind, +  NULL, Pike_sp - ind, 1, "object", ind,    "Object got no `[..] and there is no _sizeof to "    "translate the from-the-end index to use `[].\n");    break;    case 3:    bad_arg_error (range_func_name (bound_types), -  ind, 3, 1, "object", ind, +  NULL, 3, 1, "object", ind,    "Cannot call `[..] in destructed object.\n");    break;    default:
4807:    if (!(bound_types & RANGE_LOW_OPEN)) {    if (TYPEOF(*low) != T_INT)    bad_arg_error (range_func_name (bound_types), -  ind, Pike_sp - ind, 2, "int", low, +  NULL, Pike_sp - ind, 2, "int", low,    "Bad lower bound. Expected int, got %s.\n",    get_name_of_type (TYPEOF(*low)));    l = low->u.integer;
4815:    if (!(bound_types & RANGE_HIGH_OPEN)) {    if (TYPEOF(*high) != T_INT)    bad_arg_error (range_func_name (bound_types), -  ind, Pike_sp - ind, high - ind + 1, "int", high, +  NULL, Pike_sp - ind, high - ind + 1, "int", high,    "Bad upper bound. Expected int, got %s.\n",    get_name_of_type (TYPEOF(*high)));    h = high->u.integer;
4830:       default:    bad_arg_error (range_func_name (bound_types), -  ind, Pike_sp - ind, 1, "string|array|object", ind, +  NULL, Pike_sp - ind, 1, "string|array|object", ind,    "Cannot use [..] on a %s. Expected string, array or object.\n",    get_name_of_type (TYPEOF(*ind)));    }