--- parser3/src/classes/file.C 2003/01/31 12:34:26 1.107.2.3 +++ parser3/src/classes/file.C 2003/03/17 14:48:04 1.107.4.1 @@ -1,11 +1,11 @@ /** @file Parser: @b file parser class. - Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_FILE_C="$Date: 2003/01/31 12:34:26 $"; +static const char* IDENT_FILE_C="$Date: 2003/03/17 14:48:04 $"; #include "pa_config_includes.h" @@ -30,7 +30,7 @@ static const char* IDENT_FILE_C="$Date: // consts /// from apache-1.3|src|support|suexec.c -static const char* suexec_safe_env_lst[]={ +static const char *suexec_safe_env_lst[]={ "AUTH_TYPE", "CONTENT_LENGTH", "CONTENT_TYPE", @@ -78,7 +78,7 @@ static const char* suexec_safe_env_lst[] class MFile : public Methoded { public: // VStateless_class - ValuePtr create_new_value() { return ValuePtr(new VFile()); } + Value *create_new_value(Pool& pool) { return new(pool) VFile(pool); } public: // Methoded bool used_directly() { return true; } @@ -139,7 +139,7 @@ static void _load(Request& r, const Stri ); char *user_file_name=params->size()>alt_filename_param_index? - params->as_string(alt_filename_param_index, "filename must be string") + params->as_string(alt_filename_param_index, "filename must be string").cstr(String::UL_FILE_SPEC) :lfile_name.cstr(String::UL_FILE_SPEC); Value *vcontent_type=0; @@ -175,7 +175,7 @@ static void _stat(Request& r, const Stri ff.put(*content_type_name, new(pool) VString(r.mime_type_of(lfile_name.cstr(String::UL_FILE_SPEC)))); } -static bool is_safe_env_key(const char* key) { +static bool is_safe_env_key(const char *key) { if(strncasecmp(key, "HTTP_", 5)==0) return true; if(strncasecmp(key, "CGI_", 4)==0) @@ -243,9 +243,9 @@ static void _exec_cgi(Request& r, const env.put(name##key, &name##value); \ } // passing SAPI::environment - if(const char* const *pairs=SAPI::environment(pool)) { - while(const char* pair=*pairs++) - if(const char* eq_at=strchr(pair, '=')) { + if(const char *const *pairs=SAPI::environment(pool)) { + while(const char *pair=*pairs++) + if(const char *eq_at=strchr(pair, '=')) { String& key=*new(pool) String(pool, pair, eq_at-pair); String& value=*new(pool) String(pool, eq_at+1); env.put(key, &value); @@ -283,7 +283,7 @@ static void _exec_cgi(Request& r, const in.append(*sstdin, String::UL_CLEAN, true); } else if(VFile *vfile=static_cast(info.vstdin->as("file", false))) - in.APPEND_TAINTED((const char* )vfile->value_ptr(), vfile->value_size(), + in.APPEND_TAINTED((const char *)vfile->value_ptr(), vfile->value_size(), "$.stdin[assigned]", 0); else throw Exception("parser.runtime", @@ -314,7 +314,7 @@ static void _exec_cgi(Request& r, const const String *body=&out; // ^file:exec Value *content_type=0; - const char* eol_marker=0; size_t eol_marker_size; + const char *eol_marker=0; size_t eol_marker_size; const String *header=0; if(cgi) { // ^file:cgi // construct with 'out' body and header @@ -400,8 +400,8 @@ static void _list(Request& r, const Stri if(params->size()>1) { regexp=¶ms->as_no_junction(1, "regexp must not be code").as_string(); - const char* pattern=regexp->cstr(); - const char* errptr; + const char *pattern=regexp->cstr(); + const char *errptr; int erroffset; regexp_code=pcre_compile(pattern, PCRE_EXTRA | PCRE_DOTALL, &errptr, &erroffset, @@ -442,7 +442,7 @@ static void _list(Request& r, const Stri } if(suits) { - char *file_name_cstr=(char *)pool.malloc(file_name_size); + char *file_name_cstr=(char *)pool.malloc_atomic(file_name_size); memcpy(file_name_cstr, ffblk.ff_name, file_name_size); String &file_name=*new(pool) String(pool); file_name.APPEND_TAINTED(file_name_cstr, file_name_size, @@ -482,7 +482,7 @@ static void _lock(Request& r, const Stri file_write_action_under_lock(file_spec, "lock", lock_execute_body, &info); } -static int lastposafter(const String& s, int after, const char* substr, size_t substr_size, bool beforelast=false) { +static int lastposafter(const String& s, int after, const char *substr, size_t substr_size, bool beforelast=false) { size_t size; if(beforelast) size=s.size();