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.239 2007/01/05 15:49:47 grubba Exp $ + || $Id: encode.c,v 1.240 2007/03/03 16:46:12 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:265:   }      #ifdef _REENTRANT   static void do_enable_threads(void)   {    exit_threads_disable(NULL);   }   #endif      /* NOTE: Take care to encode it exactly as the corresponing -  * type string would have been encoded (cf TFUNCTION, T_MANY). +  * type string would have been encoded (cf T_FUNCTION, T_MANY, +  * T_STRING, PIKE_T_NSTRING).    */   static void encode_type(struct pike_type *t, struct encode_data *data)   {    one_more_type:    if (t->type == T_MANY) {    addchar(T_FUNCTION);    addchar(T_MANY); -  +  } else if (t->type == T_STRING) { +  if (CAR_TO_INT(t) == 32) { +  addchar(T_STRING);    } else { -  +  /* Narrow string */ +  addchar(PIKE_T_NSTRING); +  addchar(CAR_TO_INT(t)); +  } +  return; +  } else {    addchar(t->type);    }    switch(t->type) {    default:    Pike_fatal("error in type tree: %d.\n", t->type);    /*NOTREACHED*/       break;       case PIKE_T_NAME:
pike.git/src/encode.c:2137:    min = (min<<8)|GETC();    min = (min<<8)|GETC();    max = GETC();    max = (max<<8)|GETC();    max = (max<<8)|GETC();    max = (max<<8)|GETC();    push_int_type(min, max);    }    break;    +  case T_STRING: +  /* Common case and compat */ +  push_string_type(32); +  break; +  +  case PIKE_T_NSTRING: +  { +  INT32 width = GETC(); +  push_string_type(width); +  } +  break; +     case '0':    case '1':    case '2':    case '3':    case '4':    case '5':    case '6':    case '7':    case '8':    case '9':    case T_FLOAT: -  case T_STRING: +     case T_MIXED:    case T_ZERO:    case T_VOID:    case PIKE_T_UNKNOWN:    push_type(tmp);    break;       case PIKE_T_NAME:    decode_value2(data);