pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: array.c,v 1.180 2005/04/06 18:43:39 grubba Exp $ + || $Id: array.c,v 1.181 2005/05/19 22:35:23 mast Exp $   */      #include "global.h"   #include "svalue.h"   #include "array.h"   #include "object.h"   #include "las.h"   #include "stralloc.h"   #include "interpret.h"   #include "opcodes.h"
pike.git/src/array.c:285:    case T_INT: {    INT_TYPE p = ind->u.integer;    INT_TYPE i = p < 0 ? p + a->size : p;    if(i<0 || i>=a->size) {    struct svalue tmp;    tmp.type=T_ARRAY;    tmp.u.array=a;    if (a->size) {    index_error(0,0,0,&tmp,ind,    "Index %"PRINTPIKEINT"d is out of array range " -  "%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n", -  p, -a->size, a->size-1); +  "%d..%d.\n", p, -a->size, a->size-1);    } else {    index_error(0,0,0,&tmp,ind,    "Attempt to index the empty array with %"PRINTPIKEINT"d.\n", p);    }    }    array_index_no_free(s,a,i);    break;    }       case T_STRING:
pike.git/src/array.c:338:      PMOD_EXPORT void simple_set_index(struct array *a,struct svalue *ind,struct svalue *s)   {    switch (ind->type) {    case T_INT: {    INT_TYPE p = ind->u.integer;    INT_TYPE i = p < 0 ? p + a->size : p;    if(i<0 || i>=a->size) {    if (a->size) {    Pike_error("Index %"PRINTPIKEINT"d is out of array range " -  "%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n", -  p, -a->size, a->size-1); +  "%d..%d.\n", p, -a->size, a->size-1);    } else {    Pike_error("Attempt to index the empty array with %"PRINTPIKEINT"d.\n", p);    }    }    array_set_index(a,i,s);    break;    }       case T_STRING:    {
pike.git/src/array.c:1330:   {    INT_TYPE i, p;    if(ind->type != T_INT)    Pike_error("Expected integer as array index, got %s.\n",    get_name_of_type (ind->type));    p = ind->u.integer;    i = p < 0 ? p + a->size : p;    if(i<0 || i>=a->size) {    if (a->size) {    Pike_error("Index %"PRINTPIKEINT"d is out of array range " -  "%"PRINTPTRDIFFT"d..%"PRINTPTRDIFFT"d.\n", -  p, -a->size, a->size-1); +  "%d..%d.\n", p, -a->size, a->size-1);    } else {    Pike_error("Attempt to index the empty array with %"PRINTPIKEINT"d.\n", p);    }    }    return low_array_get_item_ptr(a,i,t);   }      /**    * Organize an array of INT32 to specify how to zip two arrays together    * to maintain the order.
pike.git/src/array.c:2229:    INT32 e;    struct svalue *argp = Pike_sp-args;    TYPE_FIELD new_types = 0;    struct array *cycl;    DECLARE_CYCLIC();       check_array_for_destruct(a);    check_stack(120 + args + 1);       /* FIXME: Ought to use a better key on the arguments below. */ -  if (!(cycl = (struct array *)BEGIN_CYCLIC(a, args))) { +  if (!(cycl = (struct array *)BEGIN_CYCLIC(a, (ptrdiff_t) args))) {    BEGIN_AGGREGATE_ARRAY(a->size) {    SET_CYCLIC_RET(Pike_sp[-1].u.array);    for (e=0;e<a->size;e++) {    assign_svalues_no_free(Pike_sp, argp, args, BIT_MIXED);    Pike_sp+=args;    /* FIXME: Don't throw apply errors from apply_svalue here. */    apply_svalue(ITEM(a)+e,args);    new_types |= 1 << Pike_sp[-1].type;    DO_AGGREGATE_ARRAY(120);    }