pike.git / src / modules / _Roxen / roxen.c

version» Context lines:

pike.git/src/modules/_Roxen/roxen.c:94:    int str_len;    int tot_slash_n=hp->slash_n, slash_n = hp->tslash_n, spc = hp->spc;    unsigned char *pp,*ep;    struct svalue *tmp;    struct mapping *headers;    ptrdiff_t os=0, i, j, l;    unsigned char *in;       if (args != 1)    Pike_error("Bad number of arguments to feed().\n"); -  if( Pike_sp[-1].type != PIKE_T_STRING ) +  if( TYPEOF(Pike_sp[-1]) != PIKE_T_STRING )    Pike_error("Wrong type of argument to feed()\n");    if( str->size_shift )    Pike_error("Wide string headers not supported\n");    str_len = str->len;    while( str_len >= hp->left )    {    unsigned char *buf;    if( hp->hsize > 512 * 1024 )    Pike_error("Too many headers\n");    hp->hsize += 8192;
pike.git/src/modules/_Roxen/roxen.c:225:    /* Check for continuation line. */    } while ((os < l) && ((in[os] == ' ') || (in[os] == '\t')));       if (val_cnt > 1) {    /* Join partial header values. */    f_add(val_cnt);    }       if((tmp = low_mapping_lookup(headers, Pike_sp-2)))    { -  if( tmp->type == PIKE_T_ARRAY ) +  if( TYPEOF(*tmp) == PIKE_T_ARRAY )    {    f_aggregate( 1 );    ref_push_array(tmp->u.array);    stack_swap();    map_delete(headers, Pike_sp-3);    f_add(2);    } else {    ref_push_string(tmp->u.string);    stack_swap();    map_delete(headers, Pike_sp-3);
pike.git/src/modules/_Roxen/roxen.c:295:    *! int(0..1)|void no_terminator)    */   {    int total_len = 0, e;    unsigned char *pnt;    struct mapping *m;    struct keypair *k;    struct pike_string *res;    int terminator = 2;    -  if( Pike_sp[-args].type != PIKE_T_MAPPING ) +  if( TYPEOF(Pike_sp[-args]) != PIKE_T_MAPPING )    Pike_error("Wrong argument type to make_http_headers(mapping heads)\n");    m = Pike_sp[-args].u.mapping;       if (args > 1) { -  if (Pike_sp[1-args].type != PIKE_T_INT) +  if (TYPEOF(Pike_sp[1-args]) != PIKE_T_INT)    Pike_error("Bad argument 2 to make_http_headers(). Expected int.\n");    if (Pike_sp[1-args].u.integer)    terminator = 0;    }       /* loop to check len */    NEW_MAPPING_LOOP( m->data )    { -  if( k->ind.type != PIKE_T_STRING || k->ind.u.string->size_shift ) +  if( TYPEOF(k->ind) != PIKE_T_STRING || k->ind.u.string->size_shift )    Pike_error("Wrong argument type to make_http_headers("    "mapping(string(8bit):string(8bit)|array(string(8bit))) heads)\n"); -  if( k->val.type == PIKE_T_STRING && !k->val.u.string->size_shift ) +  if( TYPEOF(k->val) == PIKE_T_STRING && !k->val.u.string->size_shift )    total_len += k->val.u.string->len + 2 + k->ind.u.string->len + 2; -  else if( k->val.type == PIKE_T_ARRAY ) +  else if( TYPEOF(k->val) == PIKE_T_ARRAY )    {    struct array *a = k->val.u.array;    ptrdiff_t i, kl = k->ind.u.string->len + 2 ;    for( i = 0; i<a->size; i++ ) -  if( a->item[i].type != PIKE_T_STRING||a->item[i].u.string->size_shift ) +  if( TYPEOF(a->item[i]) != PIKE_T_STRING || +  a->item[i].u.string->size_shift )    Pike_error("Wrong argument type to make_http_headers("    "mapping(string(8bit):string(8bit)|"    "array(string(8bit))) heads)\n");    else    total_len += kl + a->item[i].u.string->len + 2;    } else    Pike_error("Wrong argument type to make_http_headers("    "mapping(string(8bit):string(8bit)|"    "array(string(8bit))) heads)\n");    }
pike.git/src/modules/_Roxen/roxen.c:342:    res = begin_shared_string( total_len );    pnt = STR0(res);   #define STRADD(X) \    for( l=(X).u.string->len, s=STR0((X).u.string), c=0; c<l; c++ ) \    *(pnt++)=*(s++)       NEW_MAPPING_LOOP( m->data )    {    unsigned char *s;    ptrdiff_t l, c; -  if( k->val.type == PIKE_T_STRING ) +  if( TYPEOF(k->val) == PIKE_T_STRING )    {    STRADD( k->ind ); *(pnt++) = ':'; *(pnt++) = ' ';    STRADD( k->val ); *(pnt++) = '\r'; *(pnt++) = '\n';    }    else    {    struct array *a = k->val.u.array;    ptrdiff_t i, kl = k->ind.u.string->len + 2;    for( i = 0; i<a->size; i++ )    {
pike.git/src/modules/_Roxen/roxen.c:379:    *!    *! Decodes an http transport-encoded string.    */   {    int proc;    int size_shift = 0;    int adjust_len = 0;    p_wchar0 *foo, *bar, *end;    struct pike_string *newstr;    -  if (!args || Pike_sp[-args].type != PIKE_T_STRING || +  if (!args || TYPEOF(Pike_sp[-args]) != PIKE_T_STRING ||    Pike_sp[-args].u.string->size_shift)    Pike_error("Invalid argument to http_decode_string(string(8bit));\n");       foo = bar = STR0(Pike_sp[-args].u.string);    end = foo + Pike_sp[-args].u.string->len;       /* count '%' and wide characters */    for (proc=0; foo<end; foo++) {    if (*foo=='%') {    proc++;
pike.git/src/modules/_Roxen/roxen.c:475:    *!    *! Encodes the @[in] data as an HTML safe string.    */   {    struct pike_string *str;    int newlen;       if( args != 1 )    Pike_error("Wrong number of arguments to html_encode_string\n" );    -  switch( Pike_sp[-1].type ) +  switch( TYPEOF(Pike_sp[-1]) )    {    void o_cast_to_string();       case PIKE_T_INT:    /* Optimization, this is basically a inlined cast_int_to_string */    {    char buf[21], *b = buf+19;    int neg, i, j=0;    i = Pike_sp[-1].u.integer;    pop_stack();