--- parser3/src/classes/file.C 2009/04/22 04:41:32 1.185 +++ parser3/src/classes/file.C 2009/05/13 07:36:04 1.188 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_FILE_C="$Date: 2009/04/22 04:41:32 $"; +static const char * const IDENT_FILE_C="$Date: 2009/05/13 07:36:04 $"; #include "pa_config_includes.h" @@ -368,9 +368,8 @@ static void pass_cgi_header_attribute( } static void append_to_argv(Request& r, ArrayString& argv, const String* str){ - if( str->length() ){ + if(!str->is_empty()) argv+=new String(str->cstr_to_string_body(String::L_UNSPECIFIED, 0, &r.charsets), String::L_AS_IS); - } } /// @todo fix `` in perl - they produced flipping consoles and no output to perl @@ -402,7 +401,7 @@ static void _exec_cgi(Request& r, Method if(value_cstr) \ env.put( \ String::Body(#name), \ - String::Body(value_cstr, 0)); \ + String::Body(value_cstr)); \ // passing SAPI::environment if(const char *const *pairs=SAPI::environment(r.sapi_info)) { while(const char* pair=*pairs++) @@ -517,7 +516,7 @@ static void _exec_cgi(Request& r, Method if(file_out->length && is_text_mode(mode_name)){ fix_line_breaks(file_out->str, file_out->length); // treat output as string - String *real_out = new String(file_out->str, file_out->length); + String *real_out = new String(file_out->str); // transcode out if necessary if(charset) @@ -573,7 +572,7 @@ static void _exec_cgi(Request& r, Method } file_out->str[header_break_pos] = 0; - String *header=new String(file_out->str, header_break_pos); + String *header=new String(file_out->str); unsigned long headersize = header_break_pos+eol_marker_size*2; file_out->str += headersize; file_out->length -= headersize; @@ -602,7 +601,7 @@ static void _exec_cgi(Request& r, Method self.fields().put(file_status_name, new VInt(execution.status)); // $stderr - if(real_err->length()) + if(!real_err->is_empty()) self.fields().put( String::Body("stderr"), new VString(*real_err)); @@ -625,9 +624,9 @@ static void _list(Request& r, MethodPara vregex=static_cast(value); } else { vregex=new VRegex(r.charsets.source(), ®exp.as_string(), 0/*options*/); + vregex->study(); vrcleaner.vregex=vregex; } - vregex->study(); } else { vregex=0; } @@ -647,7 +646,7 @@ static void _list(Request& r, MethodPara if(!vregex || vregex->exec(ffblk.ff_name, file_name_size, ovector, ovector_size)>=0) { Table::element_type row(new ArrayString); - *row+=new String(pa_strdup(file_name_cstr, file_name_size), file_name_size, true/*tainted*/); + *row+=new String(pa_strdup(file_name_cstr, file_name_size), true/*tainted*/); table+=row; } ); @@ -686,7 +685,7 @@ static int lastposafter(const String& s, if(beforelast) size=s.length(); size_t at; - while((at=s.pos(String::Body(substr, substr_size), after))!=STRING_NOT_FOUND) { + while((at=s.pos(String::Body(substr), after))!=STRING_NOT_FOUND) { size_t newafter=at+substr_size/*skip substr*/; if(beforelast && newafter==size) break; @@ -828,11 +827,11 @@ public: break; case 1: if(!user_file_name) // user not specified? - user_file_name=new String(str, length, true); + user_file_name=new String(str, true); break; case 2: if(!user_content_type) // user not specified? - user_content_type=new String(str, length, true); + user_content_type=new String(str, true); break; default: error=SQL_Error(PARSER_RUNTIME, "result must not contain more then one row, three rows"); @@ -922,13 +921,13 @@ static void _base64(Request& r, MethodPa } else { // encode: ^f.base64[] const char* encoded=pa_base64_encode(self.value_ptr(), self.value_size()); - r.write_assign_lang(*new String(encoded, 0, true/*tainted. once ?param=base64(something) was needed**/)); + r.write_assign_lang(*new String(encoded, true/*tainted. once ?param=base64(something) was needed**/)); } } else { // encode: ^file:base64[filespec] const String& file_spec=params.as_string(0, FILE_NAME_MUST_BE_STRING); const char* encoded=pa_base64_encode(r.absolute(file_spec)); - r.write_assign_lang(*new String(encoded, 0, true/*tainted. once ?param=base64(something) was needed*/)); + r.write_assign_lang(*new String(encoded, true/*tainted. once ?param=base64(something) was needed*/)); } }