pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.c:18:   #include "pike_error.h"   #include "operators.h"   #include "builtin_functions.h"   #include "module_support.h"   #include "fsort.h"   #include "threads.h"   #include "stuff.h"   #include "version.h"   #include "bignum.h"    - RCSID("$Id: encode.c,v 1.99 2001/05/14 03:26:57 hubbe Exp $"); + RCSID("$Id: encode.c,v 1.100 2001/07/01 14:27:08 grubba Exp $");      /* #define ENCODE_DEBUG */      #ifdef ENCODE_DEBUG   #define EDB(X) X   #else   #define EDB(X)   #endif      /* The sp macro conflicts with Solaris 2.5.1's <sys/conf.h>. */
pike.git/src/encode.c:358: Inside #if defined(USE_PIKE_TYPE)
   case PIKE_T_UNKNOWN:    break;       case T_OBJECT:    {    addchar((ptrdiff_t)t->car);       if(t->cdr)    {    int id = (int)(ptrdiff_t)t->cdr; -  if( id >= 65536 ) +  if( id >= PROG_DYNAMIC_ID_START )    {    struct program *p=id_to_program((ptrdiff_t)t->cdr);    if(p)    {    ref_push_program(p);    }else{    push_int(0);    }    } else    push_int( id );
pike.git/src/encode.c:450:    case T_VOID:    case PIKE_T_UNKNOWN:    break;       case T_OBJECT:    {    INT32 x;    addchar(EXTRACT_UCHAR(t++));    x=EXTRACT_INT(t);    t+=sizeof(INT32); -  if(x >= 65536) +  if(x >= PROG_DYNAMIC_ID_START)    {    struct program *p=id_to_program(x);    if(p)    {    ref_push_program(p);    }else{    push_int(0);    }    }else{    push_int(x);
pike.git/src/encode.c:777:       code_entry(type_to_tag(val->type), 0,data);    encode_value2(Pike_sp-1, data);    pop_stack();    break;          case T_PROGRAM:    {    int d; +  if (val->u.program->id < PROG_DYNAMIC_ID_START) { +  code_entry(type_to_tag(val->type), 3, data); +  push_int(val->u.program->id); +  encode_value2(Pike_sp-1, data); +  pop_stack(); +  break; +  }    if (data->canonic)    Pike_error("Canonical encoding of programs not supported.\n");    check_stack(1);    push_svalue(val);    apply(data->codec,"nameof", 1);    if(Pike_sp[-1].type == val->type)    Pike_error("Error in master()->nameof(), same type returned.\n");    if(Pike_sp[-1].type == T_INT && Pike_sp[-1].subtype == NUMBER_UNDEFINED)    {    INT32 e;
pike.git/src/encode.c:1999:    if(Pike_sp[-2].type==T_INT)    {    pop_stack();    }else{    f_arrow(2);    }    if(data->pickyness && Pike_sp[-1].type != T_PROGRAM)    Pike_error("Failed to decode program.\n");    break;    +  case 3: +  decode_value2(data); +  if ((Pike_sp[-1].type == T_INT) && +  (Pike_sp[-1].u.integer < PROG_DYNAMIC_ID_START) && +  (Pike_sp[-1].u.integer > 0)) { +  struct program *p = id_to_program(Pike_sp[-1].u.integer); +  if (!p) { +  Pike_error("Failed to decode program %d\n", +  Pike_sp[-1].u.integer); +  } +  pop_stack(); +  push_program(p); +  } else { +  Pike_error("Failed to decode program.\n"); +  } +  break; +     default:    Pike_error("Cannot decode program encoding type %d\n",num);    }    break;       default:    Pike_error("Failed to restore string. (Illegal type)\n");    }       mapping_insert(data->decoded, & tmp, Pike_sp-1);