--- parser3/src/main/untaint.C 2001/03/25 10:30:43 1.21 +++ parser3/src/main/untaint.C 2001/03/29 08:28:04 1.25 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: untaint.C,v 1.21 2001/03/25 10:30:43 paf Exp $ + $Id: untaint.C,v 1.25 2001/03/29 08:28:04 paf Exp $ */ #include "pa_config_includes.h" @@ -71,11 +71,14 @@ static bool typo_present(Array::Item *va partial==1; // typo left column starts 'src' } -/// @todo optimize whitespaces for all but 'html' +/// @todo @b now: optimize whitespaces for all but 'html' char *String::store_to(char *dest) const { // $MAIN:html-typo table - Table *user_typo_table=static_cast(pool().tag()); - Table *typo_table=user_typo_table?user_typo_table:default_typo_table; + Table *typo_table=0; + if(Request *request=pool().request()) + typo_table=request->html_typo_table; + if(!typo_table) + typo_table=default_typo_table; const Chunk *chunk=&head; do { @@ -91,7 +94,7 @@ char *String::store_to(char *dest) const // clean piece case UL_YES: // tainted piece, but undefined untaint language - // for VString.get_double of tainted values + // for VString.as_double of tainted values // for ^process{body} evaluation case UL_AS_IS: // tainted, untaint language: as-is @@ -170,8 +173,9 @@ char *String::store_to(char *dest) const case '\r': if(typo_table) { *dest++='\\'; *dest++='n'; // \r -> \n - if(src[1]=='\n') // \r\n -> remove \n - src++; + if(src[1]=='\n') { // \r\n -> remove \n + size--; src++; + } } break; case '\n': @@ -194,7 +198,7 @@ char *String::store_to(char *dest) const const String& b=*static_cast(item)->get_string(1); // empty 'a' | 'b' checks if(a.size()==0 || b.size()==0) { - pool().set_tag(default_typo_table); // avoid recursion + pool().set_request(0); // avoid recursion THROW(0, 0, typo_table->origin_string(), "typo table column elements must not be empty"); @@ -202,7 +206,7 @@ char *String::store_to(char *dest) const // overflow check: // b allowed to be max UNTAINT_TIMES_BIGGER then a if(b.size()>UNTAINT_TIMES_BIGGER*a.size()) { - pool().set_tag(default_typo_table); // avoid recursion + pool().set_request(0); // avoid recursion THROW(0, 0, &b, "is %g times longer then '%s', "