pike.git / src / modules / _Stdio / stat.c

version» Context lines:

pike.git/src/modules/_Stdio/stat.c:292:    }    break;    case 2: push_int64(THIS_STAT->s.st_atime); break;    case 3: push_int64(THIS_STAT->s.st_mtime); break;    case 4: push_int64(THIS_STAT->s.st_ctime); break;    case 5: push_int(THIS_STAT->s.st_uid); break;    case 6: push_int(THIS_STAT->s.st_gid); break;    default:    {    INT32 args=1; -  SIMPLE_BAD_ARG_ERROR("`[]",1,"int(0..6)"); +  SIMPLE_ARG_TYPE_ERROR("`[]",1,"int(0..6)");    }    }   }      static void stat_init (struct object *UNUSED(o))   {    memset (&THIS_STAT->s, 0, sizeof (THIS_STAT->s));   }      /*! @decl void create (void|object|array stat);
pike.git/src/modules/_Stdio/stat.c:508:    pop_stack();    stat_push_compat(index);    }    else if( TYPEOF(sp[-1]) == T_STRING )    {    struct svalue *tmp;    tmp = low_mapping_string_lookup( stat_map, sp[-1].u.string );    _stat_index( tmp ? tmp->u.integer : 0 );    }    else -  SIMPLE_BAD_ARG_ERROR("`[]",1,"int(0..6)|string"); +  SIMPLE_ARG_TYPE_ERROR("`[]",1,"int(0..6)|string");    }    else if (args>=2) /* range */    {    INT_TYPE from, to, n=0;       if (args > 2) {    pop_n_elems(args - 2);    args = 2;    }       if (TYPEOF(sp[-2]) != T_INT &&    !(TYPEOF(sp[-2]) == T_OBJECT && is_bignum_object (sp[-2].u.object))) -  SIMPLE_BAD_ARG_ERROR("`[..]",1,"int"); +  SIMPLE_ARG_TYPE_ERROR("`[..]",1,"int");       if (TYPEOF(sp[-1]) != T_INT &&    !(TYPEOF(sp[-1]) == T_OBJECT && is_bignum_object (sp[-1].u.object))) -  SIMPLE_BAD_ARG_ERROR("`[..]",2,"int"); +  SIMPLE_ARG_TYPE_ERROR("`[..]",2,"int");       /* make in range 0..6 */    push_int(6);    f_min(2);    stack_swap();    push_int(0);    f_max(2);    stack_swap();       from = sp[-2].u.integer;
pike.git/src/modules/_Stdio/stat.c:752:    else    got_int_val = 1;    }       /* shouldn't there be an else clause here ? */    /* No, the second argument is checked further below depending on    * what the first is. /mast */       if (TYPEOF(sp[-2]) == T_INT) {    if (!got_int_val) -  SIMPLE_BAD_ARG_ERROR ("`[]=", 2, +  SIMPLE_ARG_TYPE_ERROR ("`[]=", 2,    "integer when the first argument is an integer");    if (!stat_compat_set (sp[-2].u.integer, int_val)) -  SIMPLE_BAD_ARG_ERROR ("`[]=", 1, "int(0..6)|string"); +  SIMPLE_ARG_TYPE_ERROR ("`[]=", 1, "int(0..6)|string");    }    else if (TYPEOF(sp[-2]) == T_STRING) {    INT_TYPE code;    struct svalue *tmp;    tmp = low_mapping_string_lookup( stat_map, sp[-2].u.string );    if (!tmp)    {    /* Fall back to a normal index set on this object, in case    * someone inherited us. */    object_set_index2 (fp->current_object, 0, sp-2, sp-1);    stack_swap();    pop_stack();    return;    }    _stat_index_set( tmp->u.integer, sp-1, got_int_val, int_val);    }    -  else SIMPLE_BAD_ARG_ERROR ("`[]=", 1, "int(0..6)|string"); +  else SIMPLE_ARG_TYPE_ERROR ("`[]=", 1, "int(0..6)|string");       stack_swap();    pop_stack();   }      static void stat_indices(INT32 args);   static void stat_values(INT32 args);      /*! @decl mapping(string:int)|array cast (string to);    *!    *! Convert the stat object to a mapping or array.    */   static void stat_cast(INT32 args)   {    struct pike_string *type;       if (!args)    SIMPLE_TOO_FEW_ARGS_ERROR("Stat cast",1);    if (TYPEOF(sp[-args]) != T_STRING) -  SIMPLE_BAD_ARG_ERROR("cast",1,"string"); +  SIMPLE_ARG_TYPE_ERROR("cast",1,"string");       type = Pike_sp[-args].u.string;    pop_stack(); /* type have at least one more reference. */       if (type == literal_array_string)    {    push_int(0);    push_int(6);    stat_index(2);    }
pike.git/src/modules/_Stdio/stat.c:823:   }      static void stat__sprintf(INT32 args)   {    int x;       if (args<1)    SIMPLE_TOO_FEW_ARGS_ERROR("_sprintf",2);       if (TYPEOF(sp[-args]) != T_INT) -  SIMPLE_BAD_ARG_ERROR("_sprintf",0,"integer"); +  SIMPLE_ARG_TYPE_ERROR("_sprintf",0,"integer");       x=sp[-args].u.integer;    pop_n_elems(args);    switch (x)    {    case 'O':    push_static_text("Stat(%s %db)");    _stat_index(STAT_MODE_STRING);    _stat_index(STAT_SIZE);    f_sprintf(3);
pike.git/src/modules/_Stdio/stat.c:909:    _stat_index_set( k->val.u.integer, sp-1, -1,0 );    }    pop_stack();    }    }    else if (TYPEOF(sp[-1]) == T_ARRAY)    {    struct array *a = sp[-1].u.array;    int i;    if (a->size != 7) -  SIMPLE_BAD_ARG_ERROR ("create", 1, "stat array with 7 elements"); +  SIMPLE_ARG_TYPE_ERROR ("create", 1, "stat array with 7 elements");    for (i = 0; i < 7; i++) {    INT64 val;    if (TYPEOF(ITEM(a)[i]) == T_INT)    val = ITEM(a)[i].u.integer;    else if (TYPEOF(ITEM(a)[i]) == T_OBJECT &&    is_bignum_object (ITEM(a)[i].u.object)) {    if (!int64_from_bignum (&val, ITEM(a)[i].u.object))    Pike_error ("create: Too big integer in stat array.\n");    }    else -  SIMPLE_BAD_ARG_ERROR ("create", 1, "array(int)"); +  SIMPLE_ARG_TYPE_ERROR ("create", 1, "array(int)");    stat_compat_set (i, val);    }    }       else -  SIMPLE_BAD_ARG_ERROR ("create", 1, "void|Stdio.Stat|array(int)"); +  SIMPLE_ARG_TYPE_ERROR ("create", 1, "void|Stdio.Stat|array(int)");    }       pop_n_elems (args);   }   #undef THIS_STAT      void push_stat(PIKE_STAT_T *s)   {    struct object *o;    struct stat_storage *stor;