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.219 2004/09/18 20:50:48 nilsson Exp $ + || $Id: encode.c,v 1.220 2004/10/15 15:24:51 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:2184:    low_decode_type(data); \    (X)=pop_unfinished_type(); \   } while(0)      static void cleanup_new_program_decode (int *orig_compilation_depth)   {    end_first_pass(0);    compilation_depth = *orig_compilation_depth;   }    - static void set_lex_pragmas(INT32 old_pragmas) + static void set_lex_pragmas(ptrdiff_t old_pragmas)   { -  lex.pragmas = old_pragmas; +  lex.pragmas = DO_NOT_WARN((INT32)old_pragmas);   }      static DECLSPEC(noreturn) void decode_error (struct svalue *decoding,    struct svalue *other,    char *msg, ...)    ATTRIBUTE((noreturn,format (printf, 3, 4)));      static DECLSPEC(noreturn) void decode_error (struct svalue *decoding,    struct svalue *other,    char *msg, ...)
pike.git/src/encode.c:3354:    {    struct program *p;    ONERROR err;    ONERROR err2;    int orig_compilation_depth;    int byteorder;    int bytecode_method;    int entry_type;    INT16 id_flags;    INT16 p_flags; -  INT32 old_pragmas = lex.pragmas; +  ptrdiff_t old_pragmas = lex.pragmas;   #define FOO(NUMTYPE,Y,ARGTYPE,NAME) \    NUMTYPE PIKE_CONCAT(local_num_, NAME) = 0;   #include "program_areas.h"      #ifdef ENCODE_DEBUG    data->depth += 2;   #endif       /* Decode byte-order. */    decode_number(byteorder, data);
pike.git/src/encode.c:4231: Inside #if defined(PIKE_THREADS)
   }   #ifdef PIKE_THREADS    data->thread_state = NULL;   #endif       free( (char *) data);   }      static void low_do_decode (struct decode_data *data)   { -  int e; -  struct keypair *k; -  ONERROR err; -  SET_ONERROR(err, free_decode_data, data); -  current_decode = data; +  decode_value2(current_decode = data);    -  decode_value2(data); -  +     while (data->ptr < data->len) {    decode_value2 (data);    pop_stack();    } -  - #ifdef PIKE_DEBUG -  NEW_MAPPING_LOOP (data->decoded->data) { -  if (k->val.type == T_PROGRAM && -  !(k->val.u.program->flags & PROGRAM_FINISHED)) { -  decode_error (NULL, &k->val, -  "Got unfinished program <%"PRINTPIKEINT"d> after decode: ", -  k->ind.u.integer); +    } -  } - #endif +     -  UNSET_ONERROR(err); -  free_decode_data(data); - } -  +    /* Run pass2 */   int re_decode(struct decode_data *data, int ignored)   { -  +  ONERROR err; +  SET_ONERROR(err, free_decode_data, data);    data->next = current_decode;    low_do_decode (data); -  +  CALL_AND_UNSET_ONERROR(err);    return 1;   }      static INT32 my_decode(struct pike_string *tmp,    struct object *codec   #ifdef ENCODE_DEBUG    , int debug   #endif    )   {    struct decode_data *data; -  +  int e; +  struct keypair *k; +  ONERROR err;       /* Attempt to avoid infinite recursion on circular structures. */    for (data = current_decode; data; data=data->next) {    if (data->raw == tmp && data->codec == codec   #ifdef PIKE_THREADS    && data->thread_state == Pike_interpreter.thread_state   #endif    ) {    struct svalue *res;    struct svalue val = {
pike.git/src/encode.c:4335:    GETC() != 'k' ||    GETC() != 'e' ||    GETC() != '0')    {    free( (char *) data);    return 0;    }       data->decoded=allocate_mapping(128);    +  SET_ONERROR(err, free_decode_data, data); +     init_supporter(& data->supporter,    (supporter_callback *) re_decode,    (void *)data);       low_do_decode (data);    -  + #ifdef PIKE_DEBUG +  NEW_MAPPING_LOOP (data->decoded->data) { +  if (k->val.type == T_PROGRAM && +  !(k->val.u.program->flags & PROGRAM_FINISHED)) { +  decode_error (Pike_sp-1, &k->val, +  "Got unfinished program <k:%"PRINTPIKEINT"d> " +  "after decode: ", +  k->ind.u.integer); +  } +  } + #endif +  +  CALL_AND_UNSET_ONERROR(err);    return 1;   }      /* Compatibilidy decoder */      static unsigned char extract_char(char **v, ptrdiff_t *l)   {    if(!*l) Pike_error("Format error, not enough place for char.\n");    else (*l)--;    (*v)++;