pike.git / src / opcodes.c

version» Context lines:

pike.git/src/opcodes.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: opcodes.c,v 1.135 2003/02/08 03:49:22 mast Exp $ + || $Id: opcodes.c,v 1.136 2003/02/10 13:59:59 grubba Exp $   */      #include "global.h"   #include <errno.h>   #include <math.h>   #include <ctype.h>   #include "interpret.h"   #include "svalue.h"   #include "array.h"   #include "stralloc.h"
pike.git/src/opcodes.c:23:   #include "fd_control.h"   #include "cyclic.h"   #include "builtin_functions.h"   #include "module_support.h"   #include "security.h"   #include "bignum.h"   #include "operators.h"      #define sp Pike_sp    - RCSID("$Id: opcodes.c,v 1.135 2003/02/08 03:49:22 mast Exp $"); + RCSID("$Id: opcodes.c,v 1.136 2003/02/10 13:59:59 grubba Exp $");      void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)   {    INT32 i;      #ifdef PIKE_SECURITY    if(what->type <= MAX_COMPLEX)    if(!CHECK_DATA_SECURITY(what->u.array, SECURITY_BIT_INDEX))    Pike_error("Index permission denied.\n");   #endif
pike.git/src/opcodes.c:1262:    Pike_error("Error in sscanf format string.\n"); \    \    while(1) \    { \    switch(match[cnt]) \    { \    case '*': \    no_assign=1; \    cnt++; \    if(cnt>=match_len) \ -  Pike_error("Error in sscanf format string.\n"); \ +  Pike_error("Error in sscanf format string.\n"); \    continue; \    \    case '0': case '1': case '2': case '3': case '4': \    case '5': case '6': case '7': case '8': case '9': \    { \    PCHARP t; \    field_length = STRTOL_PCHARP(MKPCHARP(match+cnt, MATCH_SHIFT), \    &t,10); \    cnt = SUBTRACT_PCHARP(t, MKPCHARP(match, MATCH_SHIFT)); \    continue; \
pike.git/src/opcodes.c:1288:    continue; \    \    case '{': \    { \    ONERROR err; \    ptrdiff_t tmp; \    for(e=cnt+1,tmp=1;tmp;e++) \    { \    if(e>=match_len) \    { \ -  Pike_error("Missing %%} in format string.\n"); \ +  Pike_error("Missing %%} in format string.\n"); \    break; /* UNREACHED */ \    } \    if(match[e]=='%') \    { \    switch(match[e+1]) \    { \    case '%': e++; break; \    case '}': tmp--; break; \    case '{': tmp++; break; \    } \
pike.git/src/opcodes.c:1697:    \    cnt=end_str_end-match-1; \    eye=new_eye; \    break; \    } \    \    case '[': \    cnt=PIKE_CONCAT(read_set,MATCH_SHIFT)(match,cnt+1, \    &set,match_len); \    \ -  match_set: \ -  for(e=eye;eye<input_len;eye++) \ +  match_set: \    { \ -  +  int len = input_len; \ +  if (field_length != -1) { \ +  len = eye + field_length; \ +  if (len > input_len) { \ +  /* Mismatch -- too little data */ \ +  chars_matched[0]=eye; \ +  return matches; \ +  } \ +  } \ +  for(e=eye;eye<len;eye++) \ +  { \   CHAROPT2( \    if(input[eye]<sizeof(set.c)) \    { \   ) \ -  if(set.c[input[eye]] == set.neg) \ -  break; \ +  if(set.c[input[eye]] == set.neg) \ +  break; \   CHAROPT2( \    }else{ \ -  if(set.a) \ -  { \ +  if(set.a) \ +  { \    INT32 x; \    struct svalue tmp; \ -  tmp.type=T_INT; \ +  tmp.type=T_INT; \    tmp.u.integer=input[eye]; \    x=switch_lookup(set.a, &tmp); \ -  if( set.neg != (x<0 && (x&1)) ) break; \ +  if( set.neg != (x<0 && (x&1)) ) break; \    }else{ \    if(!set.neg) break; \ -  +  } \    } \ -  } \ +    ) \    } \ -  +  if ((field_length != -1) && (eye != len)) { \ +  /* Couldn't read the entire field. Fail. */ \ +  chars_matched[0]=e; \ +  return matches; \ +  } \ +  } \    if(set.a) { free_array(set.a); set.a=0; } \    sval.type=T_STRING; \    DO_IF_CHECKER(sval.subtype=0); \    sval.u.string=PIKE_CONCAT(make_shared_binary_string, \    INPUT_SHIFT)(input+e,eye-e); \    break; \    \    case 'n': \    sval.type=T_INT; \    sval.subtype=NUMBER_NUMBER; \    sval.u.integer=TO_INT32(eye); \    break; \    \    default: \ -  Pike_error("Unknown sscanf token %%%c(0x%02x)\n", \ +  Pike_error("Unknown sscanf token %%%c(0x%02x)\n", \    match[cnt], match[cnt]); \    } \    break; \    } \    matches++; \    \    if(no_assign) \    { \    free_svalue(&sval); \    }else{ \