pike.git / src / modules / Image / colortable.c

version» Context lines:

pike.git/src/modules/Image/colortable.c:933:    flat.entries=(struct nct_flat_entry*)    xalloc(flat.numentries*sizeof(struct nct_flat_entry));       for (i=0; i<arr->size; i++)    {    if (TYPEOF(arr->item[i]) == T_INT && !arr->item[i].u.integer)    continue;       if (!image_color_svalue(arr->item+i,    &(flat.entries[n].color))) -  bad_arg_error("create", +  bad_arg_error(NULL,    0, 1, "array of colors or 0", 0,    "Bad element %d of colorlist.\n",i);      #if DEBUG    fprintf(stderr,"got %d: %02x%02x%02x\n",n,    flat.entries[n].color.r,    flat.entries[n].color.g,    flat.entries[n].color.b);   #endif   
pike.git/src/modules/Image/colortable.c:2291:    {    THIS->u.flat=_img_get_flat_from_image(img,numcolors);    THIS->type=NCT_FLAT;    THIS->u.flat=    _img_reduce_number_of_colors(THIS->u.flat,    numcolors,    THIS->spacefactor);    }    }    else -  bad_arg_error("add",args,2,"",sp+2-1-args, -  "Bad argument 2 to add.\n"); +  SIMPLE_ARG_TYPE_ERROR(NULL, 2, "int");    else    {    THIS->u.flat=_img_get_flat_from_image(img,256);    if (THIS->u.flat.numentries>256)    THIS->u.flat=_img_reduce_number_of_colors(THIS->u.flat,256,    THIS->spacefactor);    THIS->type=NCT_FLAT;    }    } -  else bad_arg_error("add",args,1,"",sp+1-1-args, -  "Bad argument 1 to add.\n"); +  else +  SIMPLE_ARG_TYPE_ERROR(NULL, 1, "Image.Image|Image.Colortable|array|string|int");    }    else if (TYPEOF(sp[-args]) == T_ARRAY)    {    THIS->u.flat=_img_get_flat_from_array(sp[-args].u.array);    THIS->type=NCT_FLAT;    }    else if (TYPEOF(sp[-args]) == T_STRING)    {    if (args>1)    {    if (TYPEOF(sp[1-args]) != T_INT) -  SIMPLE_ARG_TYPE_ERROR("add",2,"int"); +  SIMPLE_ARG_TYPE_ERROR(NULL, 2, "int");    switch (sp[1-args].u.integer)    {    case 0: /* rgb */    THIS->u.flat=_img_get_flat_from_string(sp[-args].u.string);    break;    case 1: /* bgr */    THIS->u.flat=_img_get_flat_from_bgr_string(sp[-args].u.string);    break;    case 2: /* bgrz */    THIS->u.flat=    _img_get_flat_from_bgrz_string(sp[-args].u.string);    break;    default: -  SIMPLE_ARG_TYPE_ERROR("add",2,"int(0..2)"); +  SIMPLE_ARG_TYPE_ERROR(NULL, 2, "int(0..2)");    }    }    else    THIS->u.flat=_img_get_flat_from_string(sp[-args].u.string);    THIS->type=NCT_FLAT;    }    else if (TYPEOF(sp[-args]) == T_INT)    {    THIS->u.cube=_img_get_cube_from_args(args);    THIS->type=NCT_CUBE;    } -  else bad_arg_error("add",args,0,"",sp-args, -  "Bad arguments to add.\n"); +  else +  SIMPLE_ARG_TYPE_ERROR(NULL, 1, "Image.Image|Image.Colortable|array|string|int"); +     pop_n_elems(args);    ref_push_object(THISOBJ);      #ifdef COLORTABLE_DEBUG    fprintf(stderr, "COLORTABLE done (%p created, %d args was left, sp-1=%p)\n",    THIS, args, sp-1);   #endif      }   
pike.git/src/modules/Image/colortable.c:2507:    else if (TYPEOF(sp[i-args]) == T_ARRAY ||    TYPEOF(sp[i-args]) == T_OBJECT)    {    struct svalue *sv=sp+i-args;    push_svalue(sv);    tmpo=clone_object(image_colortable_program,1);    src=get_storage(tmpo,image_colortable_program);    if (!src) abort();    }    else { -  bad_arg_error("`+",args,0,"",sp-args, -  "Bad arguments to `+.\n"); +  GENERIC_ARGS_ERROR();    UNREACHABLE(src = NULL);    }       _img_add_colortable(dest,src);       if (tmpo) free_object(tmpo);    }    pop_n_elems(args);    push_object(o);   }