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

version» Context lines:

pike.git/src/modules/_Roxen/roxen.c:367:    }    if (terminator) {    *(pnt++) = '\r';    *(pnt++) = '\n';    }       pop_n_elems( args );    push_string( end_shared_string( res ) );   }    + static p_wchar2 parse_hexchar(p_wchar2 hex) + { +  if(hex>='0' && hex<='9') +  return hex-'0'; +  hex |= 32; +  if(hex>='a' && hex<='f') +  return hex-'W'; +  Pike_error("Illegal transport encoding.\n"); + } +    static void f_http_decode_string(INT32 args)   /*! @decl string http_decode_string(string encoded)    *!    *! Decodes an http transport-encoded string. Knows about %XX and    *! %uXXXX syntax. Treats %UXXXX as %uXXXX. It will treat '+' as '+'    *! and not ' ', so form decoding needs to replace that in a second    *! step.    */   {    int proc = 0;
pike.git/src/modules/_Roxen/roxen.c:431:    foo = MKPCHARP_STR(Pike_sp[-args].u.string);       for (; COMPARE_PCHARP(foo, <, end); INC_PCHARP(foo, 1)) {    p_wchar2 c = INDEX_PCHARP(foo, 0);    if (c == '%') {    c = INDEX_PCHARP(foo, 1);    if (c == 'u' || c == 'U') {    c = 0;    if (SUBTRACT_PCHARP(end, foo) > 5) {    p_wchar2 hex = INDEX_PCHARP(foo, 2); -  c = (((hex<'A')?hex:(hex + 9)) & 15)<<12; +  c = parse_hexchar(hex)<<12;    hex = INDEX_PCHARP(foo, 3); -  c |= (((hex<'A')?hex:(hex + 9)) & 15)<<8; +  c |= parse_hexchar(hex)<<8;    hex = INDEX_PCHARP(foo, 4); -  c |= (((hex<'A')?hex:(hex + 9)) & 15)<<4; +  c |= parse_hexchar(hex)<<4;    hex = INDEX_PCHARP(foo, 5); -  c |= ((hex<'A')?hex:(hex + 9)) & 15; +  c |= parse_hexchar(hex);    }    INC_PCHARP(foo, 5);    } else {    c = 0;    if (SUBTRACT_PCHARP(end, foo) > 2) {    p_wchar2 hex = INDEX_PCHARP(foo, 1); -  c = (((hex<'A')?hex:(hex + 9)) & 15)<<4; +  c = parse_hexchar(hex)<<4;    hex = INDEX_PCHARP(foo, 2); -  c |= ((hex<'A')?hex:(hex + 9)) & 15; +  c |= parse_hexchar(hex);    }    INC_PCHARP(foo, 2);    }    }    string_builder_putchar(&newstr, c);    }       pop_n_elems(args);    push_string(finish_string_builder(&newstr));   }