|
|
| version 1.176, 2009/04/24 06:29:26 | version 1.180, 2009/05/14 08:10:09 |
|---|---|
| Line 303 static void split_with_options(Request& | Line 303 static void split_with_options(Request& |
| const String* column_name=0; | const String* column_name=0; |
| if(params_count>2){ | if(params_count>2){ |
| column_name=¶ms.as_string(2, COLUMN_NAME_MUST_BE_STRING); | column_name=¶ms.as_string(2, COLUMN_NAME_MUST_BE_STRING); |
| if (horizontal && column_name->length()) | if (horizontal && !column_name->is_empty()) |
| throw Exception(PARSER_RUNTIME, | throw Exception(PARSER_RUNTIME, |
| column_name, | column_name, |
| "column name can't be specified with horisontal split"); | "column name can't be specified with horisontal split"); |
| } | } |
| if(!column_name || !column_name->length()) | if(!column_name || column_name->is_empty()) |
| column_name=new String("piece"); | column_name=new String("piece"); |
| Table& table=horizontal?split_horizontal(pieces, right):split_vertical(pieces, right, column_name); | Table& table=horizontal?split_horizontal(pieces, right):split_vertical(pieces, right, column_name); |
| Line 625 static void _trim(Request& r, MethodPara | Line 625 static void _trim(Request& r, MethodPara |
| const char* chars=0; | const char* chars=0; |
| if(params_count>0) { | if(params_count>0) { |
| const String& skind=params.as_string(0, "'where' must be string"); | const String& skind=params.as_string(0, "'where' must be string"); |
| "'where' must be string"); | if(!skind.is_empty()) |
| if(skind.length()) | |
| if(skind==TRIM_BOTH_OPTION) | if(skind==TRIM_BOTH_OPTION) |
| kind=String::TRIM_BOTH; | kind=String::TRIM_BOTH; |
| else if(skind==TRIM_START_OPTION || skind=="start") | else if(skind==TRIM_START_OPTION || skind=="start") |
| Line 640 static void _trim(Request& r, MethodPara | Line 639 static void _trim(Request& r, MethodPara |
| if(params_count>1) { | if(params_count>1) { |
| const String& schars=params.as_string(1, "'chars' must be string"); | const String& schars=params.as_string(1, "'chars' must be string"); |
| if(schars.length()) | if(!schars.is_empty()) |
| chars=schars.cstr(); | chars=schars.cstr(); |
| } | } |
| } | } |
| Line 672 static void _base64(Request& r, MethodPa | Line 671 static void _base64(Request& r, MethodPa |
| "Invalid \\x00 character found while decode to string. Decode it to file instead."); | "Invalid \\x00 character found while decode to string. Decode it to file instead."); |
| fix_line_breaks(decoded, length); | fix_line_breaks(decoded, length); |
| if(length){ | if(length) |
| r.write_assign_lang(*new String(decoded, length, true/*tainted*/)); | r.write_assign_lang(*new String(decoded, String::L_TAINTED)); |
| } | |
| } | } |
| } else { | } else { |
| // encode: ^str.base64[] | // encode: ^str.base64[] |
| VString& self=GET_SELF(r, VString); | VString& self=GET_SELF(r, VString); |
| const char* cstr=self.string().cstr(); | const char* cstr=self.string().cstr(); |
| const char* encoded=pa_base64_encode(cstr, strlen(cstr)); | const char* encoded=pa_base64_encode(cstr, strlen(cstr)); |
| r.write_assign_lang(*new String(encoded, 0, true/*tainted. once ?param=base64(something) was needed*/)); | r.write_assign_lang(*new String(encoded, String::L_TAINTED/*once ?param=base64(something) was needed*/)); |
| } | } |
| } | } |