Branch: Tag:

2003-06-05

2003-06-05 15:30:52 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Attempting to call functions in the NULL object, is not a good idea...

Rev: src/encode.c:1.180

2:   || 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.179 2003/06/05 15:03:38 mast Exp $ + || $Id: encode.c,v 1.180 2003/06/05 15:30:52 grubba Exp $   */      #include "global.h"
27:   #include "bignum.h"   #include "pikecode.h"    - RCSID("$Id: encode.c,v 1.179 2003/06/05 15:03:38 mast Exp $"); + RCSID("$Id: encode.c,v 1.180 2003/06/05 15:30:52 grubba Exp $");      /* #define ENCODE_DEBUG */   
847:       if (data->canonic)    Pike_error("Canonical encoding of objects not supported.\n"); +  if (data->codec) {    push_svalue(val);    apply(data->codec, "nameof", 1); -  +  } else { +  push_undefined(); +  }    EDB(5, fprintf(stderr, "%*s->nameof: ", data->depth, "");    print_svalue(stderr, Pike_sp-1);    fputc('\n', stderr););
918:    if (data->canonic)    Pike_error("Canonical encoding of functions not supported.\n");    check_stack(1); +  if (data->codec) {    push_svalue(val);    apply(data->codec,"nameof", 1); -  +  } else { +  push_undefined(); +  }    if(Pike_sp[-1].type == T_INT && Pike_sp[-1].subtype==NUMBER_UNDEFINED)    {    if(val->subtype != FUNCTION_BUILTIN)
966:    if (data->canonic)    Pike_error("Canonical encoding of programs not supported.\n");    check_stack(1); +  if (data->codec) {    push_svalue(val);    apply(data->codec,"nameof", 1); -  +  } else { +  push_undefined(); +  }    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)
2389:    switch(num)    {    case 0: +  if (data->codec) {    apply(data->codec,"objectof", 1); -  +  } else { +  decode_error(NULL, Pike_sp-1, +  "Failed to decode object (no codec). Got: "); +  }    break;       case 1:
2496:    switch(num)    {    case 0: +  if (data->codec) {    apply(data->codec,"functionof", 1); -  +  } else { +  decode_error(NULL, Pike_sp-1, +  "Failed to decode function (no codec). Got: "); +  }    break;       case 1: {
2559:    struct program *p;       decode_value2(data); +  if (data->codec) {    apply(data->codec,"programof", 1); -  +  } else { +  decode_error(NULL, Pike_sp-1, +  "Failed to decode program (no codec). Got: "); +  }       p = program_from_svalue(Pike_sp-1);   
2611:       debug_malloc_touch(p);    ref_push_program(p); +  if (data->codec) {    apply(data->codec, "__register_new_program", 1); -  +  }       /* return a placeholder */    if(Pike_sp[-1].type == T_OBJECT)