pike.git / src / operators.c

version» Context lines:

pike.git/src/operators.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h"   #include <math.h> - RCSID("$Id: operators.c,v 1.97 2000/08/10 09:51:51 per Exp $"); + RCSID("$Id: operators.c,v 1.98 2000/08/10 17:44:56 grubba Exp $");   #include "interpret.h"   #include "svalue.h"   #include "multiset.h"   #include "mapping.h"   #include "array.h"   #include "stralloc.h"   #include "opcodes.h"   #include "operators.h"   #include "language.h"   #include "pike_memory.h"
pike.git/src/operators.c:1772:    OP_DIVISION_BY_ZERO_ERROR("`/");       if(len<0)    {    len=-len;    size=(ptrdiff_t)ceil( ((double)sp[-2].u.string->len) / len);    a=allocate_array(size);       for(last=sp[-2].u.string->len,e=0;e<size-1;e++)    { -  pos=sp[-2].u.string->len - (INT32)((e+1)*len); +  pos=sp[-2].u.string->len - (ptrdiff_t)((e+1)*len);    a->item[size-1-e].u.string=string_slice(sp[-2].u.string,    pos,    last-pos);    a->item[size-1-e].type=T_STRING;    last=pos;    }    pos=0;    a->item[0].u.string=string_slice(sp[-2].u.string,    pos,    last-pos);    a->item[0].type=T_STRING;    }else{ -  size=(INT32)ceil( ((double)sp[-2].u.string->len) / len); +  size=(ptrdiff_t)ceil( ((double)sp[-2].u.string->len) / len);    a=allocate_array(size);       for(last=0,e=0;e<size-1;e++)    {    pos=(INT32)((e+1)*len);    a->item[e].u.string=string_slice(sp[-2].u.string,    last,    pos-last);    a->item[e].type=T_STRING;    last=pos;
pike.git/src/operators.c:1861:    OP_DIVISION_BY_ZERO_ERROR("`/");       if(len<0)    {    len=-len;    size = (ptrdiff_t)ceil( ((double)sp[-2].u.array->size) / len);    a=allocate_array(size);       for(last=sp[-2].u.array->size,e=0;e<size-1;e++)    { -  pos=sp[-2].u.array->size - (INT32)((e+1)*len); +  pos=sp[-2].u.array->size - (ptrdiff_t)((e+1)*len);    a->item[size-1-e].u.array=friendly_slice_array(sp[-2].u.array,    pos,    last);    a->item[size-1-e].type=T_ARRAY;    last=pos;    }    a->item[0].u.array=slice_array(sp[-2].u.array,    0,    last);    a->item[0].type=T_ARRAY;    }else{ -  size=(INT32)ceil( ((double)sp[-2].u.array->size) / len); +  size = (ptrdiff_t)ceil( ((double)sp[-2].u.array->size) / len);    a=allocate_array(size);       for(last=0,e=0;e<size-1;e++)    { -  pos=(INT32)((e+1)*len); +  pos = (ptrdiff_t)((e+1)*len);    a->item[e].u.array=friendly_slice_array(sp[-2].u.array,    last,    pos);    a->item[e].type=T_ARRAY;    last=pos;    }    a->item[e].u.array=slice_array(sp[-2].u.array,    last,    sp[-2].u.array->size);    a->item[e].type=T_ARRAY;
pike.git/src/operators.c:2227:    push_type(T_NOT);    pop_stack();    push_string(pop_unfinished_type());    sp[-1].type = T_TYPE;    }    break;       case T_STRING:    {    struct pike_string *s; -  INT32 len, i; +  ptrdiff_t len, i;       if(sp[-1].u.string->size_shift) {    bad_arg_error("`~", sp-1, 1, 1, "string(0)", sp-1,    "Expected 8-bit string.\n");    }       len = sp[-1].u.string->len;    s = begin_shared_string(len);    for (i=0; i<len; i++)    s->str[i] = ~ sp[-1].u.string->str[i];