pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.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: encode.c,v 1.166 2004/05/11 09:43:00 grubba Exp $ + || $Id: encode.c,v 1.167 2004/05/11 10:49:55 grubba Exp $   */      #include "global.h"   #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "mapping.h"
pike.git/src/encode.c:25:   #include "fsort.h"   #include "threads.h"   #include "stuff.h"   #include "version.h"   #include "bignum.h"   #include "pikecode.h"   #include "pike_types.h"   #include "opcodes.h"   #include "peep.h"    - RCSID("$Id: encode.c,v 1.166 2004/05/11 09:43:00 grubba Exp $"); + RCSID("$Id: encode.c,v 1.167 2004/05/11 10:49:55 grubba Exp $");      /* #define ENCODE_DEBUG */      /* Use the old encoding method for programs. */   #define OLD_PIKE_ENCODE_PROGRAM      #ifdef ENCODE_DEBUG   /* Pass a nonzero integer as the third arg to encode_value,    * encode_value_canonic and decode_value to activate this debug. */   #define EDB(N,X) do { debug_malloc_touch(data); if (data->debug>=N) {X;} } while (0)
pike.git/src/encode.c:287:    sval.type = PIKE_T_STRING;    sval.subtype = 0;    sval.u.string = (void *)t->car;       encode_value2(&sval, data);    }    t=t->cdr;    goto one_more_type;       case T_ASSIGN: -  if (((ptrdiff_t)t->car < 0) || ((ptrdiff_t)t->car > 9)) { -  Pike_fatal("Bad assign marker: %ld\n", (long)(ptrdiff_t)t->car); +  { +  ptrdiff_t marker = CAR_TO_INT(t); +  if ((marker < 0) || (marker > 9)) { +  Pike_fatal("Bad assign marker: %ld\n", +  (long)marker);    } -  addchar('0' + (ptrdiff_t)t->car); +  addchar('0' + marker);    t = t->cdr; -  +  }    goto one_more_type;       case T_FUNCTION:    while(t->type == T_FUNCTION) {    encode_type(t->car, data);    t = t->cdr;    }    addchar(T_MANY);    /* FALL_THROUGH */    case T_MANY:
pike.git/src/encode.c:325:    case T_ARRAY:    case T_MULTISET:    case T_NOT:    t = t->car;    goto one_more_type;       case T_INT:    {    ptrdiff_t val;    -  val = (ptrdiff_t)t->car; +  val = CAR_TO_INT(t);    addchar((val >> 24)&0xff);    addchar((val >> 16)&0xff);    addchar((val >> 8)&0xff);    addchar(val & 0xff); -  val = (ptrdiff_t)t->cdr; +  val = CDR_TO_INT(t);    addchar((val >> 24)&0xff);    addchar((val >> 16)&0xff);    addchar((val >> 8)&0xff);    addchar(val & 0xff);    }    break;       case '0':    case '1':    case '2':
pike.git/src/encode.c:358:    case T_FLOAT:    case T_STRING:    case T_MIXED:    case T_ZERO:    case T_VOID:    case PIKE_T_UNKNOWN:    break;       case T_OBJECT:    { -  addchar((ptrdiff_t)t->car); +  addchar(CAR_TO_INT(t));       if(t->cdr)    { -  int id = (int)(ptrdiff_t)t->cdr; +  ptrdiff_t id = CDR_TO_INT(t);    if( id >= PROG_DYNAMIC_ID_START )    { -  struct program *p=id_to_program((ptrdiff_t)t->cdr); +  struct program *p=id_to_program(id);    if(p)    {    ref_push_program(p);    }else{    push_int(0);    }    } else    push_int( id );    }else{    push_int(0);