Branch: Tag:

2016-01-26

2016-01-26 19:38:42 by Martin Nilsson <nilsson@fastmail.com>

SIMPLE_BAD_ARG_ERROR is only kept for compatibility, but we still had 500+ uses of it.

732:    {    if (TYPEOF(Pike_sp[-args]) != T_INT ||    Pike_sp[-args].u.integer!=0) -  SIMPLE_BAD_ARG_ERROR("set_image",1,"Image.Image|int(0..0)"); +  SIMPLE_ARG_TYPE_ERROR("set_image",1,"Image.Image|int(0..0)");    }    else if ((img=get_storage(Pike_sp[-args].u.object,image_program)))    {
743:    THIS->ysize=img->ysize;    }    else -  SIMPLE_BAD_ARG_ERROR("set_image",1, "Image.Image|int(0..0)"); +  SIMPLE_ARG_TYPE_ERROR("set_image",1, "Image.Image|int(0..0)");    }       if (args>=2) {
751:    {    if (TYPEOF(Pike_sp[1-args]) != T_INT ||    Pike_sp[1-args].u.integer!=0) -  SIMPLE_BAD_ARG_ERROR("set_image",2, "Image.Image|int(0..0)"); +  SIMPLE_ARG_TYPE_ERROR("set_image",2, "Image.Image|int(0..0)");    }    else if ((img=get_storage(Pike_sp[1-args].u.object,image_program)))    {    if (THIS->img &&    (img->xsize!=THIS->xsize ||    img->ysize!=THIS->ysize)) -  SIMPLE_BAD_ARG_ERROR("set_image",2, "image of same size"); +  SIMPLE_ARG_TYPE_ERROR("set_image",2, "image of same size");    if (!THIS->img)    {    THIS->xsize=img->xsize;
769:    THIS->alp=img;    }    else -  SIMPLE_BAD_ARG_ERROR("set_image",2,"Image.Image|int(0..0)"); +  SIMPLE_ARG_TYPE_ERROR("set_image",2,"Image.Image|int(0..0)");    }       pop_n_elems(args);
843:    FLOAT_TYPE f;    get_all_args("set_alpha_value",args,"%F",&f);    if (f<0.0 || f>1.0) -  SIMPLE_BAD_ARG_ERROR("set_alpha_value",1,"float(0..1)"); +  SIMPLE_ARG_TYPE_ERROR("set_alpha_value",1,"float(0..1)");    THIS->alpha_value=f;    pop_n_elems(args);    ref_push_object(THISOBJ);
1056:    if (args!=1)    SIMPLE_TOO_FEW_ARGS_ERROR("set_mode",1);    if (TYPEOF(Pike_sp[-args]) != T_STRING) -  SIMPLE_BAD_ARG_ERROR("set_mode",1,"string"); +  SIMPLE_ARG_TYPE_ERROR("set_mode",1,"string");       for (i=0; i<LAYER_MODES; i++)    if (Pike_sp[-args].u.string==layer_mode[i].ps)
1070:    return;    }    -  SIMPLE_BAD_ARG_ERROR("set_mode",1,"existing mode"); +  SIMPLE_ARG_TYPE_ERROR("set_mode",1,"existing mode");   }      static void image_layer_mode(INT32 args)
1133:    THIS->fill=black;    else    if (!image_color_arg(-args,&(THIS->fill))) -  SIMPLE_BAD_ARG_ERROR("set_fill",1,"Image.Color"); +  SIMPLE_ARG_TYPE_ERROR("set_fill",1,"Image.Color");       smear_color(THIS->sfill,THIS->fill,SNUMPIXS);   
1145:    if (!image_color_arg(1-args,&(THIS->fill_alpha)))    {    smear_color(THIS->sfill_alpha,THIS->fill_alpha,SNUMPIXS); -  SIMPLE_BAD_ARG_ERROR("set_fill",2,"Image.Color"); +  SIMPLE_ARG_TYPE_ERROR("set_fill",2,"Image.Color");    }    }    smear_color(THIS->sfill_alpha,THIS->fill_alpha,SNUMPIXS);
1361:    &(THIS->xsize),&(THIS->ysize));    if (args>2)    if (!image_color_arg(2-args,&col)) -  SIMPLE_BAD_ARG_ERROR("create",3,"Image.Color"); +  SIMPLE_ARG_TYPE_ERROR("create",3,"Image.Color");       if (args>3)    if (!image_color_arg(3-args,&alpha)) -  SIMPLE_BAD_ARG_ERROR("create",4,"Image.Color"); +  SIMPLE_ARG_TYPE_ERROR("create",4,"Image.Color");       push_int(THIS->xsize);    push_int(THIS->ysize);
1394:    image_layer_set_image(args);    }    else -  SIMPLE_BAD_ARG_ERROR("create",1,"mapping|int|Image.Image"); +  SIMPLE_ARG_TYPE_ERROR("create",1,"mapping|int|Image.Image");   }      /*** layer object *****************************************/
2892:    SIMPLE_TOO_FEW_ARGS_ERROR("lay",1);       if (TYPEOF(Pike_sp[-args]) != T_ARRAY) -  SIMPLE_BAD_ARG_ERROR("lay",1,"array(Image.Layer|mapping)"); +  SIMPLE_ARG_TYPE_ERROR("lay",1,"array(Image.Layer|mapping)");       if (args>1)    {    get_all_args("lay",args-1,"%i%i%i%i",    &xoffset,&yoffset,&xsize,&ysize);    if (xsize<1) -  SIMPLE_BAD_ARG_ERROR("lay",4,"int(1..)"); +  SIMPLE_ARG_TYPE_ERROR("lay",4,"int(1..)");    if (ysize<1) -  SIMPLE_BAD_ARG_ERROR("lay",5,"int(1..)"); +  SIMPLE_ARG_TYPE_ERROR("lay",5,"int(1..)");    }       layers=(a=Pike_sp[-args].u.array)->size;
2923:    {    if (!(l[j]=get_storage(a->item[i].u.object,    image_layer_program))) -  SIMPLE_BAD_ARG_ERROR("lay",1, +  SIMPLE_ARG_TYPE_ERROR("lay",1,    "array(Image.Layer|mapping)");    }    else if (TYPEOF(a->item[i]) == T_MAPPING)
2934:    l[j]=get_storage(o,image_layer_program);    }    else -  SIMPLE_BAD_ARG_ERROR("lay",1, +  SIMPLE_ARG_TYPE_ERROR("lay",1,    "array(Image.Layer|mapping)");    if (l[j]->xsize && l[j]->ysize)    j++;
3234:    if (args != 2 )    SIMPLE_TOO_FEW_ARGS_ERROR("_sprintf",2);    if (TYPEOF(Pike_sp[-args]) != T_INT) -  SIMPLE_BAD_ARG_ERROR("_sprintf",0,"int"); +  SIMPLE_ARG_TYPE_ERROR("_sprintf",0,"int");    if (TYPEOF(Pike_sp[1-args]) != T_MAPPING) -  SIMPLE_BAD_ARG_ERROR("_sprintf",1,"mapping"); +  SIMPLE_ARG_TYPE_ERROR("_sprintf",1,"mapping");       x = Pike_sp[-2].u.integer;