namespace PT renamed to pt
This commit is contained in:
@@ -815,7 +815,7 @@ void App::Make()
|
||||
|
||||
if( cur.session->ip_ban && cur.session->ip_ban->IsIPBanned() )
|
||||
{
|
||||
PT::Date date(cur.session->ip_ban->expires);
|
||||
pt::Date date(cur.session->ip_ban->expires);
|
||||
|
||||
// IMPROVE ME there is no slog now
|
||||
//slog << logerror << T("this_ip_is_banned_until") << ' ' << date << " UTC" << logend;
|
||||
@@ -878,7 +878,7 @@ void App::LogEnvironmentHTTPVariables()
|
||||
{
|
||||
if( cur.request->headers_in.is_object() )
|
||||
{
|
||||
PT::Space::ObjectType::iterator i = cur.request->headers_in.value.value_object.begin();
|
||||
pt::Space::ObjectType::iterator i = cur.request->headers_in.value.value_object.begin();
|
||||
|
||||
for( ; i != cur.request->headers_in.value.value_object.end() ; ++i)
|
||||
{
|
||||
@@ -934,7 +934,7 @@ void App::SetEnv(const char * name, std::wstring & env)
|
||||
|
||||
if( v )
|
||||
{
|
||||
PT::UTF8ToWide(v, env);
|
||||
pt::UTF8ToWide(v, env);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -967,12 +967,12 @@ void App::ReadEnvHTTPVariables()
|
||||
{
|
||||
char * env = *e;
|
||||
|
||||
if( PT::is_substr_nc("HTTP_", env) )
|
||||
if( pt::is_substr_nc("HTTP_", env) )
|
||||
{
|
||||
env += http_prefix_len;
|
||||
|
||||
// cookies we have in a different table
|
||||
if( !PT::is_substr_nc("COOKIE=", env) )
|
||||
if( !pt::is_substr_nc("COOKIE=", env) )
|
||||
{
|
||||
if( SaveEnvHTTPVariable(env) )
|
||||
{
|
||||
@@ -1002,7 +1002,7 @@ bool App::SaveEnvHTTPVariable(const char * env)
|
||||
|
||||
for( ; env[i] != 0 && env[i] != '=' && i < Request::INPUT_HEADER_NAME_MAX_LENGTH ; ++i)
|
||||
{
|
||||
header_name[i] = PT::to_lower(env[i]);
|
||||
header_name[i] = pt::to_lower(env[i]);
|
||||
}
|
||||
|
||||
header_name[i] = 0;
|
||||
@@ -1031,8 +1031,8 @@ bool App::SaveEnvHTTPVariable(const char * env)
|
||||
return false;
|
||||
}
|
||||
|
||||
PT::UTF8ToWide(header_name, http_header_name);
|
||||
PT::UTF8ToWide(header_value, http_header_value);
|
||||
pt::UTF8ToWide(header_name, http_header_name);
|
||||
pt::UTF8ToWide(header_value, http_header_value);
|
||||
|
||||
cur.request->headers_in.add(http_header_name, http_header_value);
|
||||
http_header_name.clear();
|
||||
@@ -1050,9 +1050,9 @@ void App::ReadEnvRemoteIP()
|
||||
{
|
||||
http_header_name = L"HTTP_";
|
||||
http_header_name += config.proxy_ip_header;
|
||||
PT::to_upper_emplace(http_header_name);
|
||||
pt::to_upper_emplace(http_header_name);
|
||||
|
||||
PT::WideToUTF8(http_header_name, http_header_8bit);
|
||||
pt::WideToUTF8(http_header_name, http_header_8bit);
|
||||
v = FCGX_GetParam(http_header_8bit.c_str(), fcgi_request.envp);
|
||||
}
|
||||
else
|
||||
@@ -1063,7 +1063,7 @@ void App::ReadEnvRemoteIP()
|
||||
if( v )
|
||||
{
|
||||
cur.request->ip = (int)inet_addr(v);
|
||||
PT::UTF8ToWide(v, cur.request->ip_str);
|
||||
pt::UTF8ToWide(v, cur.request->ip_str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,16 +1076,16 @@ void App::CheckRequestMethod()
|
||||
|
||||
if( !cur.request->env_request_method.empty() )
|
||||
{
|
||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'g' )
|
||||
if( pt::to_lower(cur.request->env_request_method[0]) == 'g' )
|
||||
cur.request->method = Request::get;
|
||||
else
|
||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'p' )
|
||||
if( pt::to_lower(cur.request->env_request_method[0]) == 'p' )
|
||||
cur.request->method = Request::post;
|
||||
else
|
||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'h' )
|
||||
if( pt::to_lower(cur.request->env_request_method[0]) == 'h' )
|
||||
cur.request->method = Request::head;
|
||||
else
|
||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'd' )
|
||||
if( pt::to_lower(cur.request->env_request_method[0]) == 'd' )
|
||||
cur.request->method = Request::delete_;
|
||||
}
|
||||
}
|
||||
@@ -1101,7 +1101,7 @@ void App::CheckSSL()
|
||||
if( config.assume_connection_is_through_ssl )
|
||||
cur.request->using_ssl = true;
|
||||
else
|
||||
if( PT::is_equal_nc(cur.request->env_https.c_str(), L"on") )
|
||||
if( pt::is_equal_nc(cur.request->env_https.c_str(), L"on") )
|
||||
cur.request->using_ssl = true;
|
||||
}
|
||||
|
||||
@@ -1145,7 +1145,7 @@ void App::ReadPostJson()
|
||||
do
|
||||
{
|
||||
// IMPROVE ME
|
||||
// we can read to PT::TextBuffer and make a PT::JSONToSpaceParser::Parse(PT::TextBuffer &) method
|
||||
// we can read to pt::TextBuffer and make a pt::JSONToSpaceParser::Parse(pt::TextBuffer &) method
|
||||
read_len = FCGX_GetStr(buffer, buffer_len, fcgi_request.in);
|
||||
|
||||
if( read_len > 0 )
|
||||
@@ -1155,14 +1155,14 @@ void App::ReadPostJson()
|
||||
|
||||
if( !post_buffer.empty() )
|
||||
{
|
||||
PT::SpaceParser::Status status = space_parser.ParseJSON(post_buffer.c_str());
|
||||
pt::SpaceParser::Status status = space_parser.ParseJSON(post_buffer.c_str());
|
||||
post_buffer.clear();
|
||||
|
||||
if( status != PT::SpaceParser::ok )
|
||||
if( status != pt::SpaceParser::ok )
|
||||
{
|
||||
log << log1 << "App: cannot parse the input stream as an JSON object";
|
||||
|
||||
if( status == PT::SpaceParser::syntax_error )
|
||||
if( status == pt::SpaceParser::syntax_error )
|
||||
log << ", syntax error in line: " << space_parser.get_last_parsed_line() << logend;
|
||||
|
||||
cur.request->post_in.clear();
|
||||
@@ -1184,13 +1184,13 @@ void App::ReadPostVars()
|
||||
|
||||
if( cur.request->method == Request::post || cur.request->method == Request::delete_ )
|
||||
{
|
||||
if( PT::is_substr_nc(L"multipart/form-data", cur.request->env_content_type.c_str()) )
|
||||
if( pt::is_substr_nc(L"multipart/form-data", cur.request->env_content_type.c_str()) )
|
||||
{
|
||||
log << log3 << "App: post content type: multipart/form-data" << logend;
|
||||
post_multi_parser.Parse(fcgi_request.in, cur.request->post_tab, cur.request->post_file_tab);
|
||||
}
|
||||
else
|
||||
if( PT::is_substr_nc(L"application/json", cur.request->env_content_type.c_str()) )
|
||||
if( pt::is_substr_nc(L"application/json", cur.request->env_content_type.c_str()) )
|
||||
{
|
||||
log << log3 << "App: post content type: application/json" << logend;
|
||||
ReadPostJson();
|
||||
@@ -1246,7 +1246,7 @@ void App::PrepareSessionCookie()
|
||||
}
|
||||
else
|
||||
{
|
||||
PT::Date expires = cur.request->start_time + config.session_remember_max_idle;
|
||||
pt::Date expires = cur.request->start_time + config.session_remember_max_idle;
|
||||
cur.request->AddCookie(config.http_session_id_name, cookie_id_string, expires);
|
||||
}
|
||||
}
|
||||
@@ -1277,7 +1277,7 @@ return false;
|
||||
}
|
||||
|
||||
|
||||
bool App::AddHeader(const wchar_t * name, const PT::WTextStream & value)
|
||||
bool App::AddHeader(const wchar_t * name, const pt::WTextStream & value)
|
||||
{
|
||||
if( !cur.request->out_headers.has_key(name) )
|
||||
{
|
||||
@@ -1289,7 +1289,7 @@ return false;
|
||||
}
|
||||
|
||||
|
||||
bool App::AddHeader(const std::wstring & name, const PT::WTextStream & value)
|
||||
bool App::AddHeader(const std::wstring & name, const pt::WTextStream & value)
|
||||
{
|
||||
if( !cur.request->out_headers.has_key(name) )
|
||||
{
|
||||
@@ -1301,7 +1301,7 @@ return false;
|
||||
}
|
||||
|
||||
|
||||
bool App::PrepareHeadersStaticCreateResource(PT::WTextStream & out_path)
|
||||
bool App::PrepareHeadersStaticCreateResource(pt::WTextStream & out_path)
|
||||
{
|
||||
size_t i = 0;
|
||||
Item * dir = system.dirs.GetDir(system.mounts.pmount->dir_id);
|
||||
@@ -1348,7 +1348,7 @@ void App::PrepareHeadersStatic()
|
||||
return;
|
||||
}
|
||||
|
||||
PT::WTextStream path;
|
||||
pt::WTextStream path;
|
||||
path << config.static_dirs[index] << L"/";
|
||||
|
||||
if( !PrepareHeadersStaticCreateResource(path) )
|
||||
@@ -1470,7 +1470,7 @@ void App::PrepareHeadersNormal(Header header, size_t output_size)
|
||||
|
||||
if( output_size != static_cast<size_t>(-1) )
|
||||
{
|
||||
PT::WTextStream buf;
|
||||
pt::WTextStream buf;
|
||||
buf << output_size;
|
||||
AddHeader(L"Content-Length", buf);
|
||||
}
|
||||
@@ -1483,8 +1483,8 @@ void App::PrepareHeadersNormal(Header header, size_t output_size)
|
||||
// and if compression is enabled the client's browser will not be able to decompress the stream
|
||||
void App::SendHeaders()
|
||||
{
|
||||
PT::Space::ObjectType::iterator i;
|
||||
PT::Space & headers = cur.request->out_headers;
|
||||
pt::Space::ObjectType::iterator i;
|
||||
pt::Space & headers = cur.request->out_headers;
|
||||
|
||||
if( headers.is_object() )
|
||||
{
|
||||
@@ -1494,8 +1494,8 @@ void App::SendHeaders()
|
||||
{
|
||||
if( i->second->is_wstr() )
|
||||
{
|
||||
PT::WideToUTF8(i->first, aheader_name);
|
||||
PT::WideToUTF8(*i->second->get_wstr(), aheader_value);
|
||||
pt::WideToUTF8(i->first, aheader_name);
|
||||
pt::WideToUTF8(*i->second->get_wstr(), aheader_value);
|
||||
|
||||
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
|
||||
FCGX_PutS(": ", fcgi_request.out);
|
||||
@@ -1517,8 +1517,8 @@ void App::SendHeaders()
|
||||
|
||||
void App::SendCookies()
|
||||
{
|
||||
PT::Space::ObjectType::iterator i;
|
||||
PT::Space & cookies = cur.request->out_cookies;
|
||||
pt::Space::ObjectType::iterator i;
|
||||
pt::Space & cookies = cur.request->out_cookies;
|
||||
|
||||
if( cookies.is_object() )
|
||||
{
|
||||
@@ -1528,8 +1528,8 @@ void App::SendCookies()
|
||||
{
|
||||
if( i->second->is_wstr() )
|
||||
{
|
||||
PT::WideToUTF8(i->first, aheader_name);
|
||||
PT::WideToUTF8(*i->second->get_wstr(), aheader_value);
|
||||
pt::WideToUTF8(i->first, aheader_name);
|
||||
pt::WideToUTF8(*i->second->get_wstr(), aheader_value);
|
||||
|
||||
FCGX_PutS("Set-Cookie: ", fcgi_request.out);
|
||||
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
|
||||
@@ -1582,7 +1582,7 @@ void App::PrepareHeaders(bool compressing, int compress_encoding, Header header,
|
||||
|
||||
void App::PrepareStandardJSONFields()
|
||||
{
|
||||
PT::Space & info = cur.request->info;
|
||||
pt::Space & info = cur.request->info;
|
||||
|
||||
if( !info.has_key(L"status") )
|
||||
{
|
||||
@@ -1788,7 +1788,7 @@ size_t output_size = 0;
|
||||
|
||||
SelectCompression(source->length(), compressing, compress_encoding);
|
||||
|
||||
PT::WideToUTF8(*source, output_8bit);
|
||||
pt::WideToUTF8(*source, output_8bit);
|
||||
|
||||
// !! IMPROVE ME add to log the binary stream as well
|
||||
if( config.log_server_answer )
|
||||
@@ -2270,7 +2270,7 @@ int sig;
|
||||
app->synchro.was_stop_signal = true;
|
||||
FCGX_ShutdownPending();
|
||||
|
||||
PT::WideToUTF8(app->config.fcgi_socket, app->socket_to_send_on_exit);
|
||||
pt::WideToUTF8(app->config.fcgi_socket, app->socket_to_send_on_exit);
|
||||
app->Unlock();
|
||||
|
||||
app->SendEmptyFastCGIPacket();
|
||||
|
||||
@@ -143,7 +143,7 @@ private:
|
||||
|
||||
PostParser post_parser;
|
||||
PostMultiParser post_multi_parser;
|
||||
PT::SpaceParser space_parser;
|
||||
pt::SpaceParser space_parser;
|
||||
std::string post_buffer;
|
||||
|
||||
CookieParser cookie_parser;
|
||||
@@ -181,7 +181,7 @@ private:
|
||||
//////////////////////////
|
||||
|
||||
// log_buffer for the main thread
|
||||
PT::WTextStream log_buffer;
|
||||
pt::WTextStream log_buffer;
|
||||
|
||||
// logger only for App object
|
||||
Log log;
|
||||
@@ -238,9 +238,9 @@ private:
|
||||
void SendCookies();
|
||||
bool AddHeader(const wchar_t * name, const wchar_t * value);
|
||||
bool AddHeader(const std::wstring & name, const std::wstring & value);
|
||||
bool AddHeader(const wchar_t * name, const PT::WTextStream & value);
|
||||
bool AddHeader(const std::wstring & name, const PT::WTextStream & value);
|
||||
bool PrepareHeadersStaticCreateResource(PT::WTextStream & out_path);
|
||||
bool AddHeader(const wchar_t * name, const pt::WTextStream & value);
|
||||
bool AddHeader(const std::wstring & name, const pt::WTextStream & value);
|
||||
bool PrepareHeadersStaticCreateResource(pt::WTextStream & out_path);
|
||||
void PrepareHeadersStatic();
|
||||
void PrepareHeaderContentType();
|
||||
void PrepareHeadersForbidden();
|
||||
|
||||
@@ -54,13 +54,13 @@ BaseThread::~BaseThread()
|
||||
}
|
||||
|
||||
|
||||
void BaseThread::set_main_log_buffer(PT::WTextStream * log_buffer)
|
||||
void BaseThread::set_main_log_buffer(pt::WTextStream * log_buffer)
|
||||
{
|
||||
main_log.SetLogBuffer(log_buffer);
|
||||
}
|
||||
|
||||
|
||||
void BaseThread::set_main_file_log(PT::FileLog * file_log)
|
||||
void BaseThread::set_main_file_log(pt::FileLog * file_log)
|
||||
{
|
||||
main_log.SetFileLog(file_log);
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ public:
|
||||
BaseThread();
|
||||
virtual ~BaseThread();
|
||||
|
||||
void set_main_log_buffer(PT::WTextStream * log_buffer);
|
||||
void set_main_file_log(PT::FileLog * file_log);
|
||||
void set_main_log_buffer(pt::WTextStream * log_buffer);
|
||||
void set_main_file_log(pt::FileLog * file_log);
|
||||
|
||||
|
||||
// work mode
|
||||
|
||||
@@ -55,7 +55,7 @@ void Config::SetFileLog(FileLog * file_log)
|
||||
}
|
||||
|
||||
|
||||
void Config::SetLogBuffer(PT::WTextStream * log_buffer)
|
||||
void Config::SetLogBuffer(pt::WTextStream * log_buffer)
|
||||
{
|
||||
log.SetLogBuffer(log_buffer);
|
||||
}
|
||||
@@ -66,22 +66,22 @@ void Config::ShowError()
|
||||
|
||||
switch( parser.status )
|
||||
{
|
||||
case PT::SpaceParser::no_space:
|
||||
case pt::SpaceParser::no_space:
|
||||
log << log2 << "Config: space not set" << logend;
|
||||
break;
|
||||
|
||||
case PT::SpaceParser::ok:
|
||||
case pt::SpaceParser::ok:
|
||||
log << log2 << "Config: syntax ok" << logend;
|
||||
break;
|
||||
|
||||
case PT::SpaceParser::cant_open_file:
|
||||
case pt::SpaceParser::cant_open_file:
|
||||
if( errors_to_stdout )
|
||||
std::wcout << L"Config: I cannot open a config file: " << config_file << std::endl;
|
||||
|
||||
log << log1 << "Config: cant open a config file: " << config_file << logend;
|
||||
break;
|
||||
|
||||
case PT::SpaceParser::syntax_error:
|
||||
case pt::SpaceParser::syntax_error:
|
||||
if( errors_to_stdout )
|
||||
std::wcout << "Config: syntax error, line: " << parser.get_last_parsed_line() << std::endl;
|
||||
|
||||
@@ -108,9 +108,9 @@ bool Config::ReadConfig(bool errors_to_stdout_, bool stdout_is_closed)
|
||||
log << log2 << "Config: reading a config file" << logend;
|
||||
|
||||
parser.SetSpace(space);
|
||||
PT::SpaceParser::Status status = parser.ParseSpaceFile(config_file);
|
||||
pt::SpaceParser::Status status = parser.ParseSpaceFile(config_file);
|
||||
|
||||
if( status == PT::SpaceParser::ok )
|
||||
if( status == pt::SpaceParser::ok )
|
||||
{
|
||||
AssignValues(stdout_is_closed);
|
||||
SetAdditionalVariables();
|
||||
|
||||
@@ -817,16 +817,16 @@ public:
|
||||
//void Print(std::wostream & out);
|
||||
|
||||
// raw access to the config
|
||||
PT::Space space;
|
||||
pt::Space space;
|
||||
|
||||
|
||||
void SetFileLog(FileLog * file_log);
|
||||
void SetLogBuffer(PT::WTextStream * log_buffer);
|
||||
void SetLogBuffer(pt::WTextStream * log_buffer);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
PT::SpaceParser parser;
|
||||
pt::SpaceParser parser;
|
||||
bool errors_to_stdout;
|
||||
Log log;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ bool Crypt::HashBin(int hash, const char * in, size_t inlen, std::string & out)
|
||||
|
||||
run.Clear();
|
||||
run.set_dependency(this);
|
||||
PT::WideToUTF8(config->opensll_path, command);
|
||||
pt::WideToUTF8(config->opensll_path, command);
|
||||
run.Cmd(command);
|
||||
run.Par("dgst");
|
||||
run.Par("-binary");
|
||||
@@ -119,7 +119,7 @@ bool Crypt::HashBin(int hash, const std::string & in, std::string & out)
|
||||
|
||||
bool Crypt::HashBin(int hash, const wchar_t * in, size_t inlen, std::string & out)
|
||||
{
|
||||
PT::WideToUTF8(in, inlen, bufina);
|
||||
pt::WideToUTF8(in, inlen, bufina);
|
||||
int res = HashBin(hash, bufina.c_str(), bufina.size(), out);
|
||||
bufina.clear();
|
||||
|
||||
@@ -211,7 +211,7 @@ bool Crypt::RSA(bool encrypt, const char * keypath, const char * in, size_t inle
|
||||
return false;
|
||||
|
||||
run.Clear();
|
||||
PT::WideToUTF8(config->opensll_path, command);
|
||||
pt::WideToUTF8(config->opensll_path, command);
|
||||
run.Cmd(command);
|
||||
|
||||
run.Par("rsautl");
|
||||
@@ -243,7 +243,7 @@ bool Crypt::RSA(bool encrypt, const std::string & keypath, const std::string & i
|
||||
|
||||
bool Crypt::RSA(bool encrypt, const wchar_t * keypath, const char * in, size_t inlen, std::string & out)
|
||||
{
|
||||
PT::WideToUTF8(keypath, keypatha);
|
||||
pt::WideToUTF8(keypath, keypatha);
|
||||
return RSA(encrypt, keypatha.c_str(), in, inlen, out);
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ bool Crypt::PassCrypt(const std::wstring & path_to_rsa_private_key, User & user)
|
||||
|
||||
if( !path_to_rsa_private_key.empty() )
|
||||
{
|
||||
PT::WideToUTF8(user.password, passa);
|
||||
pt::WideToUTF8(user.password, passa);
|
||||
|
||||
if( RSA(true, path_to_rsa_private_key, passa, user.pass_encrypted) )
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ void FileLog::set_synchro(Synchro * synchro)
|
||||
|
||||
void FileLog::init(const std::wstring & log_file, bool log_stdout, int log_level, bool save_each_line, size_t log_time_zone_id)
|
||||
{
|
||||
PT::FileLog::init(log_file, log_stdout, log_level, save_each_line);
|
||||
pt::FileLog::init(log_file, log_stdout, log_level, save_each_line);
|
||||
this->log_time_zone_id = log_time_zone_id;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ bool FileLog::should_save_each_line()
|
||||
|
||||
|
||||
|
||||
PT::Date FileLog::get_local_date(const PT::Date & date)
|
||||
pt::Date FileLog::get_local_date(const pt::Date & date)
|
||||
{
|
||||
if( time_zones )
|
||||
{
|
||||
@@ -100,7 +100,7 @@ PT::Date FileLog::get_local_date(const PT::Date & date)
|
||||
|
||||
if( tz )
|
||||
{
|
||||
PT::Date local_date = tz->ToLocal(date);
|
||||
pt::Date local_date = tz->ToLocal(date);
|
||||
return local_date;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Winix
|
||||
class TimeZones;
|
||||
|
||||
|
||||
class FileLog : public PT::FileLog
|
||||
class FileLog : public pt::FileLog
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -58,14 +58,14 @@ public:
|
||||
|
||||
void set_synchro(Synchro * synchro);
|
||||
|
||||
// using PT::FileLog::init to suppress clang warning:
|
||||
// using pt::FileLog::init to suppress clang warning:
|
||||
// warning: 'Winix::FileLog::init' hides overloaded virtual function [-Woverloaded-virtual]
|
||||
using PT::FileLog::init;
|
||||
using pt::FileLog::init;
|
||||
|
||||
void init(const std::wstring & log_file, bool log_stdout, int log_level, bool save_each_line, size_t log_time_zone_id);
|
||||
|
||||
void set_time_zones(TimeZones * time_zones);
|
||||
PT::Date get_local_date(const PT::Date & date);
|
||||
pt::Date get_local_date(const pt::Date & date);
|
||||
|
||||
int get_log_level();
|
||||
bool should_save_each_line();
|
||||
|
||||
@@ -143,7 +143,7 @@ void HttpSimpleParser::ReadName()
|
||||
}
|
||||
|
||||
if( getchar_returns_utf8_chars )
|
||||
PT::UTF8ToWide(utf8_token, last_name);
|
||||
pt::UTF8ToWide(utf8_token, last_name);
|
||||
|
||||
if( last_c == '=' )
|
||||
last_c = GetChar();
|
||||
@@ -173,7 +173,7 @@ void HttpSimpleParser::ReadQuotedValue()
|
||||
}
|
||||
|
||||
if( getchar_returns_utf8_chars )
|
||||
PT::UTF8ToWide(utf8_token, last_value);
|
||||
pt::UTF8ToWide(utf8_token, last_value);
|
||||
|
||||
if( last_c == '"' )
|
||||
last_c = GetChar();
|
||||
@@ -204,7 +204,7 @@ void HttpSimpleParser::ReadNormalValue()
|
||||
}
|
||||
|
||||
if( getchar_returns_utf8_chars )
|
||||
PT::UTF8ToWide(utf8_token, last_value);
|
||||
pt::UTF8ToWide(utf8_token, last_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ bool end;
|
||||
|
||||
void Image::Add(const std::wstring & in, TextStream<std::string> & out)
|
||||
{
|
||||
PT::WideToUTF8(in, add_tempa);
|
||||
pt::WideToUTF8(in, add_tempa);
|
||||
out << add_tempa;
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ bool Image::CreateInputFileName()
|
||||
|
||||
if( system->MakeFilePath(file_work, src_path, thumb) )
|
||||
{
|
||||
PT::WideToUTF8(src_path, input_file_name);
|
||||
pt::WideToUTF8(src_path, input_file_name);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -404,7 +404,7 @@ void Image::CreateTmpFileName()
|
||||
{
|
||||
stream_tmp_path.Clear();
|
||||
stream_tmp_path << config->upload_dir << L"/tmp/image_" << std::time(0);
|
||||
PT::WideToUTF8(stream_tmp_path.Str(), tmp_file_name);
|
||||
pt::WideToUTF8(stream_tmp_path.Str(), tmp_file_name);
|
||||
}
|
||||
|
||||
|
||||
@@ -612,8 +612,8 @@ void Image::CreateImage()
|
||||
|
||||
void Image::CreateThumbnail()
|
||||
{
|
||||
PT::WideToUTF8(item_work.source, sourcea);
|
||||
PT::WideToUTF8(item_work.dst, dsta);
|
||||
pt::WideToUTF8(item_work.source, sourcea);
|
||||
pt::WideToUTF8(item_work.dst, dsta);
|
||||
|
||||
MagickWandGenesis();
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ void IPBanContainer::PrintTab()
|
||||
{
|
||||
log << log4 << i << ": ip: " << ipban_tab[i].ip << ", flags: " << ipban_tab[i].flags << ", last_used: ";
|
||||
|
||||
PT::Date date(ipban_tab[i].last_used);
|
||||
pt::Date date(ipban_tab[i].last_used);
|
||||
log << date << ", expires: ";
|
||||
|
||||
date = ipban_tab[i].expires;
|
||||
@@ -168,7 +168,7 @@ void IPBanContainer::PrintTab2()
|
||||
|
||||
log << log4 << i << ": ip: " << ipban.ip << ", flags: " << ipban.flags << ", last_used: ";
|
||||
|
||||
PT::Date date(ipban.last_used);
|
||||
pt::Date date(ipban.last_used);
|
||||
log << date << ", expires: ";
|
||||
|
||||
date = ipban.expires;
|
||||
|
||||
@@ -60,7 +60,7 @@ void Job::CheckPriority(int & priority) const
|
||||
|
||||
|
||||
// first thread (objects locked)
|
||||
void Job::Add(PT::Space & job, int priority)
|
||||
void Job::Add(pt::Space & job, int priority)
|
||||
{
|
||||
CheckPriority(priority);
|
||||
jobs_queue_tab[priority].push(job);
|
||||
@@ -150,7 +150,7 @@ bool is_empty;
|
||||
Lock();
|
||||
// references will not be invalidated after insertion to jobs_queue
|
||||
// (jobs_queue is std::queue and it uses std::deque by default)
|
||||
PT::Space & job = jobs_queue.front();
|
||||
pt::Space & job = jobs_queue.front();
|
||||
Unlock();
|
||||
|
||||
DoJob(job);
|
||||
@@ -165,7 +165,7 @@ bool is_empty;
|
||||
|
||||
|
||||
// second thread (objects not locked)
|
||||
void Job::DoJob(PT::Space & job)
|
||||
void Job::DoJob(pt::Space & job)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -181,7 +181,7 @@ void Job::DoJob(PT::Space & job)
|
||||
|
||||
|
||||
// second thread (objects not locked)
|
||||
void Job::DoWinixJob(PT::Space & job)
|
||||
void Job::DoWinixJob(pt::Space & job)
|
||||
{
|
||||
//log << log1 << "standard winix job: " << job.Text(L"type") << logend;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
add a new job to the queue
|
||||
priority: 0-31 (0 - the lowest priority, 31 - the highest priority)
|
||||
*/
|
||||
void Add(PT::Space & job, int priority = 0);
|
||||
void Add(pt::Space & job, int priority = 0);
|
||||
|
||||
|
||||
/*
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
typedef std::queue<PT::Space> JobsQueue;
|
||||
typedef std::queue<pt::Space> JobsQueue;
|
||||
typedef std::vector<JobsQueue> JobsQueueTab;
|
||||
JobsQueueTab jobs_queue_tab;
|
||||
|
||||
@@ -102,8 +102,8 @@ private:
|
||||
bool SignalReceived();
|
||||
void Do();
|
||||
void DoQueue(JobsQueue & jobs_queue);
|
||||
void DoJob(PT::Space & job);
|
||||
void DoWinixJob(PT::Space & job);
|
||||
void DoJob(pt::Space & job);
|
||||
void DoWinixJob(pt::Space & job);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@ struct LastItem
|
||||
long session_id;
|
||||
|
||||
// start logging and end logging
|
||||
PT::Date start;
|
||||
PT::Date end;
|
||||
pt::Date start;
|
||||
pt::Date end;
|
||||
|
||||
|
||||
LastItem();
|
||||
|
||||
@@ -72,7 +72,7 @@ void Log::SetMaxRequests(int max_requests)
|
||||
|
||||
|
||||
|
||||
void Log::PrintDate(const PT::Date & date)
|
||||
void Log::PrintDate(const pt::Date & date)
|
||||
{
|
||||
FileLog * winix_file_log = dynamic_cast<FileLog*>(file_log);
|
||||
|
||||
@@ -86,7 +86,7 @@ void Log::PrintDate(const PT::Date & date)
|
||||
|
||||
Log & Log::operator<<(const void * s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ Log & Log::operator<<(const void * s)
|
||||
|
||||
Log & Log::operator<<(const char * s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ Log & Log::operator<<(const char * s)
|
||||
|
||||
Log & Log::operator<<(const std::string & s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ Log & Log::operator<<(const std::string & s)
|
||||
|
||||
Log & Log::operator<<(const std::string * s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ Log & Log::operator<<(const std::string * s)
|
||||
|
||||
Log & Log::operator<<(const wchar_t * s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ Log & Log::operator<<(const wchar_t * s)
|
||||
|
||||
Log & Log::operator<<(const std::wstring & s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ Log & Log::operator<<(const std::wstring & s)
|
||||
|
||||
Log & Log::operator<<(const std::wstring * s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ Log & Log::operator<<(const std::wstring * s)
|
||||
|
||||
Log & Log::operator<<(int s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ Log & Log::operator<<(int s)
|
||||
|
||||
Log & Log::operator<<(long s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -162,21 +162,21 @@ Log & Log::operator<<(long s)
|
||||
|
||||
Log & Log::operator<<(char s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Log & Log::operator<<(wchar_t s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Log & Log::operator<<(size_t s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -184,30 +184,30 @@ Log & Log::operator<<(size_t s)
|
||||
|
||||
Log & Log::operator<<(double s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Log & Log::operator<<(const PT::Space & s)
|
||||
Log & Log::operator<<(const pt::Space & s)
|
||||
{
|
||||
PT::Log::operator<<(s);
|
||||
pt::Log::operator<<(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Log & Log::operator<<(const PT::Date & date)
|
||||
Log & Log::operator<<(const pt::Date & date)
|
||||
{
|
||||
PT::Log::operator<<(date);
|
||||
pt::Log::operator<<(date);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Log & Log::operator<<(morm::Model & model)
|
||||
{
|
||||
PT::Log::operator<<(model);
|
||||
pt::Log::operator<<(model);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -217,27 +217,27 @@ Log & Log::operator<<(LogManipulators m)
|
||||
switch(m)
|
||||
{
|
||||
case LogManipulators::log1:
|
||||
PT::Log::operator<<(PT::Log::log1);
|
||||
pt::Log::operator<<(pt::Log::log1);
|
||||
break;
|
||||
|
||||
case LogManipulators::log2:
|
||||
PT::Log::operator<<(PT::Log::log2);
|
||||
pt::Log::operator<<(pt::Log::log2);
|
||||
break;
|
||||
|
||||
case LogManipulators::log3:
|
||||
PT::Log::operator<<(PT::Log::log3);
|
||||
pt::Log::operator<<(pt::Log::log3);
|
||||
break;
|
||||
|
||||
case LogManipulators::log4:
|
||||
PT::Log::operator<<(PT::Log::log4);
|
||||
pt::Log::operator<<(pt::Log::log4);
|
||||
break;
|
||||
|
||||
case LogManipulators::logend:
|
||||
PT::Log::operator<<(PT::Log::logend);
|
||||
pt::Log::operator<<(pt::Log::logend);
|
||||
break;
|
||||
|
||||
case LogManipulators::logsave:
|
||||
PT::Log::operator<<(PT::Log::logsave);
|
||||
pt::Log::operator<<(pt::Log::logsave);
|
||||
break;
|
||||
|
||||
case LogManipulators::logendrequest:
|
||||
@@ -274,27 +274,27 @@ return *this;
|
||||
|
||||
Log & Log::LogString(const std::string & value, size_t max_size)
|
||||
{
|
||||
PT::Log::LogString(value, max_size);
|
||||
pt::Log::LogString(value, max_size);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Log & Log::LogString(const std::wstring & value, size_t max_size)
|
||||
{
|
||||
PT::Log::LogString(value, max_size);
|
||||
pt::Log::LogString(value, max_size);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Log & Log::LogBinary(const char * blob, size_t blob_len)
|
||||
{
|
||||
PT::Log::LogBinary(blob, blob_len);
|
||||
pt::Log::LogBinary(blob, blob_len);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Log & Log::LogBinary(const std::string & blob)
|
||||
{
|
||||
PT::Log::LogBinary(blob);
|
||||
pt::Log::LogBinary(blob);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Winix
|
||||
|
||||
|
||||
|
||||
class Log : public PT::Log
|
||||
class Log : public pt::Log
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -75,15 +75,15 @@ public:
|
||||
virtual Log & operator<<(wchar_t s);
|
||||
virtual Log & operator<<(size_t s);
|
||||
virtual Log & operator<<(double s);
|
||||
virtual Log & operator<<(const PT::Space & space);
|
||||
virtual Log & operator<<(const pt::Space & space);
|
||||
virtual Log & operator<<(LogManipulators m);
|
||||
virtual Log & operator<<(const PT::Date & date);
|
||||
virtual Log & operator<<(const pt::Date & date);
|
||||
virtual Log & operator<<(morm::Model & model);
|
||||
|
||||
virtual void PrintDate(const PT::Date & date);
|
||||
virtual void PrintDate(const pt::Date & date);
|
||||
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
Log & operator<<(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & buf);
|
||||
Log & operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf);
|
||||
|
||||
|
||||
virtual Log & LogString(const std::string & value, size_t max_size);
|
||||
@@ -112,9 +112,9 @@ private:
|
||||
|
||||
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
Log & Log::operator<<(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & buf)
|
||||
Log & Log::operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf)
|
||||
{
|
||||
PT::Log::operator<<(buf);
|
||||
pt::Log::operator<<(buf);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace misc_private
|
||||
0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028,
|
||||
0x2029, 0x202F, 0x205F, 0x3000 };
|
||||
|
||||
PT::WTextStream tmp_qencode;
|
||||
pt::WTextStream tmp_qencode;
|
||||
}
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ void CorrectUrlOnlyAllowedChar(std::wstring & url)
|
||||
{
|
||||
CorrectUrlDots(url);
|
||||
CorrectUrlChars(url);
|
||||
PT::to_lower_emplace(url);
|
||||
pt::to_lower_emplace(url);
|
||||
Trim(url, '_');
|
||||
|
||||
if( url.empty() || url == L"." )
|
||||
@@ -408,7 +408,7 @@ static wchar_t buffer[100];
|
||||
|
||||
|
||||
|
||||
const wchar_t * DateToStr(const PT::Date & d)
|
||||
const wchar_t * DateToStr(const pt::Date & d)
|
||||
{
|
||||
return DateToStr(d.year, d.month, d.day, d.hour, d.min, d.sec);
|
||||
}
|
||||
@@ -416,14 +416,14 @@ const wchar_t * DateToStr(const PT::Date & d)
|
||||
|
||||
const wchar_t * DateToStr(time_t t)
|
||||
{
|
||||
PT::Date date = t;
|
||||
pt::Date date = t;
|
||||
|
||||
return DateToStr(date);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const wchar_t * DateToStrWithoutHours(const PT::Date & d)
|
||||
const wchar_t * DateToStrWithoutHours(const pt::Date & d)
|
||||
{
|
||||
return DateToStr(d.year, d.month, d.day);
|
||||
}
|
||||
@@ -431,7 +431,7 @@ const wchar_t * DateToStrWithoutHours(const PT::Date & d)
|
||||
|
||||
const wchar_t * DateToStrWithoutHours(time_t t)
|
||||
{
|
||||
PT::Date date = t;
|
||||
pt::Date date = t;
|
||||
|
||||
return DateToStrWithoutHours(date);
|
||||
}
|
||||
@@ -460,7 +460,7 @@ return buffer;
|
||||
|
||||
|
||||
|
||||
const char * DateToStrCookie(const PT::Date & d)
|
||||
const char * DateToStrCookie(const pt::Date & d)
|
||||
{
|
||||
return DateToStrCookie(d.year, d.month, d.day, d.hour, d.min, d.sec);
|
||||
}
|
||||
@@ -468,7 +468,7 @@ const char * DateToStrCookie(const PT::Date & d)
|
||||
|
||||
const char * DateToStrCookie(time_t t)
|
||||
{
|
||||
PT::Date date = t;
|
||||
pt::Date date = t;
|
||||
|
||||
return DateToStrCookie(date);
|
||||
}
|
||||
@@ -493,9 +493,9 @@ return buffer;
|
||||
|
||||
|
||||
|
||||
PT::WTextStream IPToStr(unsigned int ip)
|
||||
pt::WTextStream IPToStr(unsigned int ip)
|
||||
{
|
||||
PT::WTextStream buf;
|
||||
pt::WTextStream buf;
|
||||
|
||||
for(int i=0 ; i<4 ; ++i, ip >>= 8)
|
||||
{
|
||||
@@ -509,7 +509,7 @@ return buf;
|
||||
}
|
||||
|
||||
|
||||
PT::WTextStream IPToStr(int ip)
|
||||
pt::WTextStream IPToStr(int ip)
|
||||
{
|
||||
return IPToStr(static_cast<unsigned int>(ip));
|
||||
}
|
||||
@@ -1148,7 +1148,7 @@ std::ifstream get_file_content;
|
||||
/*
|
||||
* we don't report any errors when converting from UTF8 to wide characters here
|
||||
*/
|
||||
PT::UTF8ToWide(get_file_content, content);
|
||||
pt::UTF8ToWide(get_file_content, content);
|
||||
get_file_content.close();
|
||||
|
||||
return true;
|
||||
@@ -1219,31 +1219,31 @@ int SelectFileType(const wchar_t * file_name)
|
||||
|
||||
// as an image we're using only those types which can be rendered
|
||||
// by a web browser
|
||||
if( PT::is_equal_nc(ext, L"jpg") ||
|
||||
PT::is_equal_nc(ext, L"jpeg") ||
|
||||
PT::is_equal_nc(ext, L"jpe") ||
|
||||
PT::is_equal_nc(ext, L"pic") ||
|
||||
PT::is_equal_nc(ext, L"tga") ||
|
||||
PT::is_equal_nc(ext, L"gif") ||
|
||||
PT::is_equal_nc(ext, L"bmp") ||
|
||||
PT::is_equal_nc(ext, L"png") )
|
||||
if( pt::is_equal_nc(ext, L"jpg") ||
|
||||
pt::is_equal_nc(ext, L"jpeg") ||
|
||||
pt::is_equal_nc(ext, L"jpe") ||
|
||||
pt::is_equal_nc(ext, L"pic") ||
|
||||
pt::is_equal_nc(ext, L"tga") ||
|
||||
pt::is_equal_nc(ext, L"gif") ||
|
||||
pt::is_equal_nc(ext, L"bmp") ||
|
||||
pt::is_equal_nc(ext, L"png") )
|
||||
return WINIX_ITEM_FILETYPE_IMAGE;
|
||||
|
||||
if( PT::is_equal_nc(ext, L"pdf") ||
|
||||
PT::is_equal_nc(ext, L"doc") ||
|
||||
PT::is_equal_nc(ext, L"xls") ||
|
||||
PT::is_equal_nc(ext, L"txt") ||
|
||||
PT::is_equal_nc(ext, L"ods") ||
|
||||
PT::is_equal_nc(ext, L"odt") )
|
||||
if( pt::is_equal_nc(ext, L"pdf") ||
|
||||
pt::is_equal_nc(ext, L"doc") ||
|
||||
pt::is_equal_nc(ext, L"xls") ||
|
||||
pt::is_equal_nc(ext, L"txt") ||
|
||||
pt::is_equal_nc(ext, L"ods") ||
|
||||
pt::is_equal_nc(ext, L"odt") )
|
||||
return WINIX_ITEM_FILETYPE_DOCUMENT;
|
||||
|
||||
if( PT::is_equal_nc(ext, L"avi") ||
|
||||
PT::is_equal_nc(ext, L"mp4") ||
|
||||
PT::is_equal_nc(ext, L"flv") ||
|
||||
PT::is_equal_nc(ext, L"mpg") ||
|
||||
PT::is_equal_nc(ext, L"mpeg") ||
|
||||
PT::is_equal_nc(ext, L"mkv") ||
|
||||
PT::is_equal_nc(ext, L"wmv") )
|
||||
if( pt::is_equal_nc(ext, L"avi") ||
|
||||
pt::is_equal_nc(ext, L"mp4") ||
|
||||
pt::is_equal_nc(ext, L"flv") ||
|
||||
pt::is_equal_nc(ext, L"mpg") ||
|
||||
pt::is_equal_nc(ext, L"mpeg") ||
|
||||
pt::is_equal_nc(ext, L"mkv") ||
|
||||
pt::is_equal_nc(ext, L"wmv") )
|
||||
return WINIX_ITEM_FILETYPE_VIDEO;
|
||||
|
||||
return WINIX_ITEM_FILETYPE_UNKNOWN;
|
||||
@@ -1280,7 +1280,7 @@ void UrlEncode(const wchar_t * in, std::string & out, bool clear_out)
|
||||
{
|
||||
static std::string ain;
|
||||
|
||||
PT::WideToUTF8(in, ain);
|
||||
pt::WideToUTF8(in, ain);
|
||||
|
||||
if( clear_out )
|
||||
out.clear();
|
||||
@@ -1301,7 +1301,7 @@ void UrlEncode(const wchar_t * in, std::wstring & out, bool clear_out)
|
||||
{
|
||||
static std::string ain;
|
||||
|
||||
PT::WideToUTF8(in, ain);
|
||||
pt::WideToUTF8(in, ain);
|
||||
|
||||
if( clear_out )
|
||||
out.clear();
|
||||
@@ -1372,7 +1372,7 @@ int c1, c2;
|
||||
|
||||
url_utf8[index] = 0;
|
||||
|
||||
return PT::UTF8ToWide(url_utf8, out, false);
|
||||
return pt::UTF8ToWide(url_utf8, out, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1418,7 +1418,7 @@ void RemovePostFileTmp(PostFileTab & post_file_tab)
|
||||
|
||||
bool WideToUTF8(const wchar_t * wide_string, char * utf8, size_t utf8_size)
|
||||
{
|
||||
bool res = PT::WideToUTF8(wide_string, utf8, utf8_size);
|
||||
bool res = pt::WideToUTF8(wide_string, utf8, utf8_size);
|
||||
|
||||
if( !res )
|
||||
{
|
||||
|
||||
@@ -238,13 +238,13 @@ void CorrectUrlOnlyAllowedChar(std::wstring & url);
|
||||
|
||||
const wchar_t * DateToStr(int year, int month, int day);
|
||||
const wchar_t * DateToStr(int year, int month, int day, int hour, int min, int sec);
|
||||
const wchar_t * DateToStr(const PT::Date & d);
|
||||
const wchar_t * DateToStr(const pt::Date & d);
|
||||
const wchar_t * DateToStr(time_t t);
|
||||
const wchar_t * DateToStrWithoutHours(const PT::Date & d);
|
||||
const wchar_t * DateToStrWithoutHours(const pt::Date & d);
|
||||
const wchar_t * DateToStrWithoutHours(time_t t);
|
||||
|
||||
const char * DateToStrCookie(int year, int month, int day, int hour, int min, int sec);
|
||||
const char * DateToStrCookie(const PT::Date & d);
|
||||
const char * DateToStrCookie(const pt::Date & d);
|
||||
const char * DateToStrCookie(time_t t);
|
||||
|
||||
// depracated
|
||||
@@ -253,8 +253,8 @@ const wchar_t * IpToStr(unsigned int ip_);
|
||||
|
||||
// in a new code we can use WTextStream in such a way
|
||||
// DateToStr() etc can use it too
|
||||
PT::WTextStream IPToStr(unsigned int ip);
|
||||
PT::WTextStream IPToStr(int ip);
|
||||
pt::WTextStream IPToStr(unsigned int ip);
|
||||
pt::WTextStream IPToStr(int ip);
|
||||
|
||||
|
||||
|
||||
@@ -420,7 +420,7 @@ size_t i = 0;
|
||||
|
||||
while( i < buf.size() )
|
||||
{
|
||||
if( PT::is_substr(look_for.c_str(), buf.c_str() + i) )
|
||||
if( pt::is_substr(look_for.c_str(), buf.c_str() + i) )
|
||||
{
|
||||
buf.erase(i, look_for.size());
|
||||
buf.insert(i, replace);
|
||||
@@ -681,7 +681,7 @@ int SelectFileType(const std::wstring & file_name);
|
||||
// thread safe
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
void UrlEncode(char c,
|
||||
PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
bool clear_out = true)
|
||||
{
|
||||
char buffer[10];
|
||||
@@ -713,7 +713,7 @@ size_t buflen = sizeof(buffer)/sizeof(char);
|
||||
// thread safe
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
void UrlEncode(const char * in,
|
||||
PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
bool clear_out = true)
|
||||
{
|
||||
if( clear_out )
|
||||
@@ -727,7 +727,7 @@ void UrlEncode(const char * in,
|
||||
// thread safe
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
void UrlEncode(const std::string & in,
|
||||
PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
bool clear_out = true)
|
||||
{
|
||||
UrlEncode(in.c_str(), out, clear_out);
|
||||
@@ -738,12 +738,12 @@ void UrlEncode(const std::string & in,
|
||||
// not thread safe
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
void UrlEncode(const wchar_t * in,
|
||||
PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
bool clear_out = true)
|
||||
{
|
||||
static std::string ain;
|
||||
|
||||
PT::WideToUTF8(in, ain);
|
||||
pt::WideToUTF8(in, ain);
|
||||
|
||||
if( clear_out )
|
||||
out.clear();
|
||||
@@ -756,7 +756,7 @@ static std::string ain;
|
||||
// not thread safe
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
void UrlEncode(const std::wstring & in,
|
||||
PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
bool clear_out = true)
|
||||
{
|
||||
UrlEncode(in.c_str(), out, clear_out);
|
||||
@@ -768,14 +768,14 @@ void UrlEncode(const std::wstring & in,
|
||||
template<class StringType>
|
||||
void UrlEncode(char c, StringType & out, bool clear_out = true)
|
||||
{
|
||||
static PT::TextStream tmp;
|
||||
static pt::TextStream tmp;
|
||||
|
||||
UrlEncode(c, tmp);
|
||||
tmp.to_string(out, clear_out);
|
||||
}
|
||||
|
||||
|
||||
// !! IMROVE ME we need some UrlEncode methods with PT::TextBuffer instead of std::string
|
||||
// !! IMROVE ME we need some UrlEncode methods with pt::TextBuffer instead of std::string
|
||||
|
||||
|
||||
void UrlEncode(const char * in, std::string & out, bool clear_out = true);
|
||||
@@ -802,7 +802,7 @@ bool UrlDecode(const std::string & url, std::wstring & out, bool clear_out = tr
|
||||
|
||||
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
void QEncodeAddChar(char_type c, PT::TextStreamBase<char_type, stack_size, heap_block_size> & out)
|
||||
void QEncodeAddChar(char_type c, pt::TextStreamBase<char_type, stack_size, heap_block_size> & out)
|
||||
{
|
||||
if( (c>='A' && c<='Z') ||
|
||||
(c>='a' && c<='z') ||
|
||||
@@ -817,7 +817,7 @@ void QEncodeAddChar(char_type c, PT::TextStreamBase<char_type, stack_size, heap_
|
||||
|
||||
size_t len1 = sizeof(buf1) / sizeof(char);
|
||||
size_t len2 = sizeof(buf2) / sizeof(char);
|
||||
size_t len = PT::IntToUTF8(int(c), buf1, len1);
|
||||
size_t len = pt::IntToUTF8(int(c), buf1, len1);
|
||||
|
||||
for(size_t i=0 ; i<len ; ++i)
|
||||
{
|
||||
@@ -850,7 +850,7 @@ void QEncodeAddChar(char_type c, PT::TextStreamBase<char_type, stack_size, heap_
|
||||
charset, encoding, encoded-text, and delimiters."
|
||||
*/
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
void QEncode(const wchar_t * in, PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
void QEncode(const wchar_t * in, pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
bool clear = true)
|
||||
{
|
||||
if( clear )
|
||||
@@ -866,7 +866,7 @@ void QEncode(const wchar_t * in, PT::TextStreamBase<char_type, stack_size, heap_
|
||||
|
||||
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
void QEncode(const std::wstring & in, PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
void QEncode(const std::wstring & in, pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||
bool clear = true)
|
||||
{
|
||||
if( clear )
|
||||
@@ -984,7 +984,7 @@ void JSONescape(Stream & out, const StringType & str)
|
||||
* converting from a wide string to an UTF-8 string
|
||||
* and puts a log if the conversion fails
|
||||
*
|
||||
* it uses PT::WideToUTF8()
|
||||
* it uses pt::WideToUTF8()
|
||||
*/
|
||||
bool WideToUTF8(const wchar_t * wide_string, char * utf8, size_t utf8_size);
|
||||
bool WideToUTF8(const std::wstring & wide_string, char * utf8, size_t utf8_size);
|
||||
|
||||
@@ -382,14 +382,14 @@ void PostMultiParser::ReadContent()
|
||||
|
||||
log << log2 << "PMP: content size: " << content_len << " bytes" << logend;
|
||||
|
||||
if( !PT::is_substr_nc("pass", name.c_str()) )
|
||||
if( !pt::is_substr_nc("pass", name.c_str()) )
|
||||
LogFirst(content, config->log_post_value_size);
|
||||
}
|
||||
|
||||
|
||||
void PostMultiParser::ConvStr(const std::string & src, std::wstring & dst)
|
||||
{
|
||||
PT::UTF8ToWide(src, dst);
|
||||
pt::UTF8ToWide(src, dst);
|
||||
}
|
||||
|
||||
|
||||
@@ -496,7 +496,7 @@ size_t buf_len = sizeof(buf)/sizeof(wchar_t);
|
||||
tmp_filename_postfix += 1;
|
||||
|
||||
tmp_filename = buf;
|
||||
PT::WideToUTF8(tmp_filename, atmp_filename);
|
||||
pt::WideToUTF8(tmp_filename, atmp_filename);
|
||||
|
||||
tmp_file.open(atmp_filename.c_str(), std::ios_base::binary | std::ios_base::out);
|
||||
// !! IMPROVE ME dodac ustawienie chmod config.upload_files_chmod dla tymczasowego pliku
|
||||
|
||||
@@ -77,7 +77,7 @@ protected:
|
||||
{
|
||||
log << log2 << "Method POST, name: \"" << name << "\"";
|
||||
|
||||
if( log_value_size > 0 && !PT::is_substr_nc(L"pass", name.c_str()) )
|
||||
if( log_value_size > 0 && !pt::is_substr_nc(L"pass", name.c_str()) )
|
||||
{
|
||||
log << ", value: ";
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ struct Request
|
||||
they are set when a request starts
|
||||
*/
|
||||
time_t start_time;
|
||||
PT::Date start_date;
|
||||
pt::Date start_date;
|
||||
|
||||
|
||||
|
||||
@@ -118,13 +118,13 @@ struct Request
|
||||
|
||||
/*
|
||||
raw parameters
|
||||
!! CHECK ME may post_tab and cookie_tab should be changed to PT::Space now?
|
||||
!! CHECK ME may post_tab and cookie_tab should be changed to pt::Space now?
|
||||
or may change the name to cookie_in? or in_cookie?
|
||||
*/
|
||||
PostTab post_tab;
|
||||
PostFileTab post_file_tab;
|
||||
CookieTab cookie_tab;
|
||||
PT::Space post_in;
|
||||
pt::Space post_in;
|
||||
bool is_postin_used;// temporarily, before all post variables will be put to post_in
|
||||
|
||||
// input headers (without cookies)
|
||||
@@ -134,7 +134,7 @@ struct Request
|
||||
// although https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 says that there can be more
|
||||
// than one http header with the same name we do not support it
|
||||
// each header has a different name here, cookies we have in a different container (cookie_tab)
|
||||
PT::Space headers_in;
|
||||
pt::Space headers_in;
|
||||
|
||||
|
||||
/*
|
||||
@@ -232,11 +232,11 @@ struct Request
|
||||
bool send_as_attachment;
|
||||
|
||||
// headers send to the client (without cookies) (may change to headers_out?)
|
||||
PT::Space out_headers;
|
||||
pt::Space out_headers;
|
||||
|
||||
// cookies send to the client
|
||||
// a value can be either a cookie value or the whole cookie string (with domain, date etc)
|
||||
PT::Space out_cookies;
|
||||
pt::Space out_cookies;
|
||||
|
||||
// winix can return either a text answer or a binary answer
|
||||
// if send_bin_stream is true then the binary answer is sent (out_bin_stream)
|
||||
@@ -305,7 +305,7 @@ struct Request
|
||||
bool return_info_only;
|
||||
|
||||
// additional info added when sending the JSON answer
|
||||
PT::Space info;
|
||||
pt::Space info;
|
||||
|
||||
|
||||
|
||||
@@ -382,14 +382,14 @@ struct Request
|
||||
|
||||
|
||||
// setting a cookie
|
||||
// name - cookie name (either const wchar_t, or std::wstring or PT::WTextStream)
|
||||
// value - cookie value (can be everything which can be put to PT::WTextStream stream)
|
||||
// name - cookie name (either const wchar_t, or std::wstring or pt::WTextStream)
|
||||
// value - cookie value (can be everything which can be put to pt::WTextStream stream)
|
||||
// the return std::wstring reference is a reference to the cookie inserted value (in out_cookies structure)
|
||||
template<typename NameType, typename ValueType>
|
||||
void AddCookie(const NameType & name, const ValueType & value, PT::Date * expires = 0);
|
||||
void AddCookie(const NameType & name, const ValueType & value, pt::Date * expires = 0);
|
||||
|
||||
template<typename NameType, typename ValueType>
|
||||
void AddCookie(const NameType & name, const ValueType & value, PT::Date & expires);
|
||||
void AddCookie(const NameType & name, const ValueType & value, pt::Date & expires);
|
||||
|
||||
|
||||
|
||||
@@ -409,9 +409,9 @@ private:
|
||||
|
||||
|
||||
template<typename NameType, typename ValueType>
|
||||
void Request::AddCookie(const NameType & name, const ValueType & value, PT::Date * expires)
|
||||
void Request::AddCookie(const NameType & name, const ValueType & value, pt::Date * expires)
|
||||
{
|
||||
PT::WTextStream cookie;
|
||||
pt::WTextStream cookie;
|
||||
|
||||
cookie << value;
|
||||
|
||||
@@ -438,7 +438,7 @@ void Request::AddCookie(const NameType & name, const ValueType & value, PT::Date
|
||||
|
||||
|
||||
template<typename NameType, typename ValueType>
|
||||
void Request::AddCookie(const NameType & name, const ValueType & value, PT::Date & expires)
|
||||
void Request::AddCookie(const NameType & name, const ValueType & value, pt::Date & expires)
|
||||
{
|
||||
AddCookie(name, value, &expires);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ typedef std::vector<Param> ParamTab;
|
||||
typedef std::map<std::wstring, std::wstring> CookieTab;
|
||||
|
||||
|
||||
typedef PT::TextStreamBase<char, 1, 4096> BinaryPage;
|
||||
typedef pt::TextStreamBase<char, 1, 4096> BinaryPage;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -81,12 +81,12 @@ struct Session
|
||||
// when this session was created
|
||||
// (the same values)
|
||||
time_t start_time;
|
||||
PT::Date start_date;
|
||||
pt::Date start_date;
|
||||
|
||||
// when this session was last used
|
||||
// (the same values)
|
||||
time_t last_time;
|
||||
PT::Date last_date;
|
||||
pt::Date last_date;
|
||||
|
||||
// when there was a last get request
|
||||
// (used to calculate spam or invalid login attempts etc.)
|
||||
|
||||
@@ -86,7 +86,7 @@ void SessionIdManager::SetKeyRenewTime(time_t renew_time)
|
||||
}
|
||||
|
||||
|
||||
void SessionIdManager::ReadKey(const wchar_t * name, PT::Space & space, std::vector<std::string> & dest_key)
|
||||
void SessionIdManager::ReadKey(const wchar_t * name, pt::Space & space, std::vector<std::string> & dest_key)
|
||||
{
|
||||
std::vector<std::wstring> keys;
|
||||
std::string key_ascii, key_base64_decoded;
|
||||
@@ -100,7 +100,7 @@ std::string key_ascii, key_base64_decoded;
|
||||
{
|
||||
dest_key[i].clear();
|
||||
|
||||
if( PT::WideToUTF8(keys[i], key_ascii) )
|
||||
if( pt::WideToUTF8(keys[i], key_ascii) )
|
||||
{
|
||||
if( base64.Decode(key_ascii, key_base64_decoded) )
|
||||
{
|
||||
@@ -140,14 +140,14 @@ void SessionIdManager::InitializeAesKeys()
|
||||
|
||||
bool SessionIdManager::ReadKeysFromFile(const wchar_t * file)
|
||||
{
|
||||
PT::Space space;
|
||||
PT::SpaceParser parser;
|
||||
PT::Date date;
|
||||
pt::Space space;
|
||||
pt::SpaceParser parser;
|
||||
pt::Date date;
|
||||
|
||||
parser.SetSpace(space);
|
||||
PT::SpaceParser::Status status = parser.ParseSpaceFile(file);
|
||||
pt::SpaceParser::Status status = parser.ParseSpaceFile(file);
|
||||
|
||||
if( status == PT::SpaceParser::ok )
|
||||
if( status == pt::SpaceParser::ok )
|
||||
{
|
||||
key_index = space.to_ulong(L"key_index");
|
||||
|
||||
@@ -166,7 +166,7 @@ PT::Date date;
|
||||
log << log1 << "SIM: I cannot read the session keys from: " << file << logend;
|
||||
}
|
||||
|
||||
return status == PT::SpaceParser::ok;
|
||||
return status == pt::SpaceParser::ok;
|
||||
}
|
||||
|
||||
|
||||
@@ -196,8 +196,8 @@ void SessionIdManager::SaveKeysToFile(std::vector<std::string> & keys)
|
||||
|
||||
bool SessionIdManager::SaveKeysToFile(const wchar_t * file)
|
||||
{
|
||||
PT::Date date = last_key_generated;
|
||||
PT::WideToUTF8(file, file_name_ascii);
|
||||
pt::Date date = last_key_generated;
|
||||
pt::WideToUTF8(file, file_name_ascii);
|
||||
|
||||
out_file.clear();
|
||||
out_file.open(file_name_ascii, std::ios_base::binary | std::ios_base::out);
|
||||
|
||||
@@ -124,7 +124,7 @@ private:
|
||||
bool ReadKeysFromFile(const std::wstring & file);
|
||||
bool SaveKeysToFile(const wchar_t * file);
|
||||
bool SaveKeysToFile(const std::wstring & file);
|
||||
void ReadKey(const wchar_t * name, PT::Space & space, std::vector<std::string> & dest_key);
|
||||
void ReadKey(const wchar_t * name, pt::Space & space, std::vector<std::string> & dest_key);
|
||||
bool AreKeysCorrect(size_t index);
|
||||
void GenerateKeys(size_t index, time_t cur_utc_time);
|
||||
void CheckKeys(time_t cur_utc_time);
|
||||
|
||||
@@ -256,7 +256,7 @@ void SessionManager::IncrementBanLevel(IPBan * ip_ban)
|
||||
cur->request->start_time + (time_t)config->ban_level_2_delay,
|
||||
cur->request->start_time + (time_t)config->ban_level_3_delay);
|
||||
|
||||
PT::Date date(ip_ban->expires);
|
||||
pt::Date date(ip_ban->expires);
|
||||
main_log << log2 << "SM: this IP address has been banned to: " << date << " UTC" << logend;
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ bool SessionManager::IsIPBanned()
|
||||
else
|
||||
if( current_ip_ban->IsIPBanned() )
|
||||
{
|
||||
PT::Date date = current_ip_ban->expires;
|
||||
pt::Date date = current_ip_ban->expires;
|
||||
main_log << log2 << "SM: this ip is bannned to: " << date << " UTC" << logend;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ SLog & SLog::operator<<(double s)
|
||||
}
|
||||
|
||||
|
||||
SLog & SLog::operator<<(const PT::Date & date)
|
||||
SLog & SLog::operator<<(const pt::Date & date)
|
||||
{
|
||||
return PutLog(date);
|
||||
}
|
||||
@@ -189,7 +189,7 @@ return *this;
|
||||
|
||||
SLog & SLog::TranslateText(const char * str)
|
||||
{
|
||||
PT::UTF8ToWide(str, key_temp);
|
||||
pt::UTF8ToWide(str, key_temp);
|
||||
return TranslateText(key_temp.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -99,10 +99,10 @@ public:
|
||||
SLog & operator<<(size_t s);
|
||||
SLog & operator<<(double s);
|
||||
SLog & operator<<(LogManipulators m);
|
||||
SLog & operator<<(const PT::Date & date);
|
||||
SLog & operator<<(const pt::Date & date);
|
||||
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
SLog & operator<<(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & buf);
|
||||
SLog & operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf);
|
||||
|
||||
|
||||
SLog & TranslateText(const char * str);
|
||||
@@ -148,7 +148,7 @@ SLog::TranslateTextHelper<RawType> T(const RawType & par)
|
||||
|
||||
|
||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||
SLog & SLog::operator<<(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & buf)
|
||||
SLog & SLog::operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf)
|
||||
{
|
||||
return PutLog(buf);
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ void System::PutUrlProto(bool can_use_ssl, std::wstring & str, bool clear_str)
|
||||
/*
|
||||
* try_to_use_ssl is to be meant: config->use_ssl, config->use_ssl_static, config->use_ssl_common
|
||||
*/
|
||||
void System::PutUrlProto(bool can_use_ssl, PT::TextStream & str, bool clear_stream)
|
||||
void System::PutUrlProto(bool can_use_ssl, pt::TextStream & str, bool clear_stream)
|
||||
{
|
||||
if( clear_stream )
|
||||
str.clear();
|
||||
@@ -241,7 +241,7 @@ void System::PutUrlProto(std::wstring & str, bool clear_str)
|
||||
}
|
||||
|
||||
|
||||
void System::PutUrlProto(PT::TextStream & str, bool clear_stream)
|
||||
void System::PutUrlProto(pt::TextStream & str, bool clear_stream)
|
||||
{
|
||||
return PutUrlProto(config->use_ssl, str, clear_stream);
|
||||
}
|
||||
@@ -1117,7 +1117,7 @@ return utc_time;
|
||||
|
||||
|
||||
|
||||
PT::Date System::ToLocal(const PT::Date & utc_date)
|
||||
pt::Date System::ToLocal(const pt::Date & utc_date)
|
||||
{
|
||||
size_t tz_id;
|
||||
|
||||
@@ -1156,7 +1156,7 @@ return local_time;
|
||||
|
||||
|
||||
|
||||
PT::Date System::ToUTC(const PT::Date & local_date)
|
||||
pt::Date System::ToUTC(const pt::Date & local_date)
|
||||
{
|
||||
size_t tz_id;
|
||||
|
||||
|
||||
@@ -127,9 +127,9 @@ public:
|
||||
bool IsSSLRequired(bool try_to_use_ssl);
|
||||
bool IsSSLRequired();
|
||||
void PutUrlProto(bool can_use_ssl, std::wstring & str, bool clear_str = true);
|
||||
void PutUrlProto(bool can_use_ssl, PT::TextStream & str, bool clear_stream = true);
|
||||
void PutUrlProto(bool can_use_ssl, pt::TextStream & str, bool clear_stream = true);
|
||||
void PutUrlProto(std::wstring & str, bool clear_str = true);
|
||||
void PutUrlProto(PT::TextStream & str, bool clear_stream = true);
|
||||
void PutUrlProto(pt::TextStream & str, bool clear_stream = true);
|
||||
|
||||
void RedirectTo(const Item & item, const wchar_t * postfix = 0, bool use_reqtype = true);
|
||||
void RedirectTo(long item_id, const wchar_t * postfix = 0, bool use_reqtype = true);
|
||||
@@ -185,10 +185,10 @@ public:
|
||||
|
||||
|
||||
time_t ToLocal(time_t utc_time);
|
||||
PT::Date ToLocal(const PT::Date & utc_date);
|
||||
pt::Date ToLocal(const pt::Date & utc_date);
|
||||
|
||||
time_t ToUTC(time_t local_time);
|
||||
PT::Date ToUTC(const PT::Date & local_date);
|
||||
pt::Date ToUTC(const pt::Date & local_date);
|
||||
|
||||
|
||||
int FollowLink(const std::vector<Item*> & current_dir_tab, const std::wstring & link_to,
|
||||
|
||||
@@ -104,11 +104,11 @@ public:
|
||||
TextStream & operator<<(unsigned long);
|
||||
TextStream & operator<<(double);
|
||||
TextStream & operator<<(const void *);// printing a pointer
|
||||
TextStream & operator<<(const PT::Space & space);
|
||||
TextStream & operator<<(const PT::Date & date);
|
||||
TextStream & operator<<(const pt::Space & space);
|
||||
TextStream & operator<<(const pt::Date & date);
|
||||
|
||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||
TextStream & operator<<(const PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg);
|
||||
TextStream & operator<<(const pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg);
|
||||
|
||||
TextStream & Write(const char * buf, size_t len);
|
||||
TextStream & Write(const wchar_t * buf, size_t len);
|
||||
@@ -396,7 +396,7 @@ TextStream<StringType> & TextStream<StringType>::write(const wchar_t * buf, size
|
||||
|
||||
|
||||
template<class StringType>
|
||||
TextStream<StringType> & TextStream<StringType>::operator<<(const PT::Space & space)
|
||||
TextStream<StringType> & TextStream<StringType>::operator<<(const pt::Space & space)
|
||||
{
|
||||
space.serialize_to_space_stream(*this, true);
|
||||
|
||||
@@ -406,7 +406,7 @@ return *this;
|
||||
|
||||
|
||||
template<class StringType>
|
||||
TextStream<StringType> & TextStream<StringType>::operator<<(const PT::Date & date)
|
||||
TextStream<StringType> & TextStream<StringType>::operator<<(const pt::Date & date)
|
||||
{
|
||||
date.Serialize(*this);
|
||||
|
||||
@@ -417,9 +417,9 @@ return *this;
|
||||
template<class StringType>
|
||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||
TextStream<StringType> & TextStream<StringType>::operator<<(
|
||||
const PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg)
|
||||
const pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg)
|
||||
{
|
||||
typename PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size>::const_iterator i;
|
||||
typename pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size>::const_iterator i;
|
||||
|
||||
for(i=arg.begin() ; i != arg.end() ; ++i)
|
||||
buffer += static_cast<char_type>(*i);
|
||||
@@ -434,7 +434,7 @@ return *this;
|
||||
template<class StringType>
|
||||
void TextStream<StringType>::Convert(wchar_t c, std::string & dst)
|
||||
{
|
||||
PT::IntToUTF8((int)c, dst, false);
|
||||
pt::IntToUTF8((int)c, dst, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -448,7 +448,7 @@ void TextStream<StringType>::Convert(wchar_t c, std::wstring & dst)
|
||||
template<class StringType>
|
||||
void TextStream<StringType>::Convert(const char * src, size_t len, std::wstring & dst)
|
||||
{
|
||||
PT::UTF8ToWide(src, len, dst, false);
|
||||
pt::UTF8ToWide(src, len, dst, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -456,14 +456,14 @@ void TextStream<StringType>::Convert(const char * src, size_t len, std::wstring
|
||||
template<class StringType>
|
||||
void TextStream<StringType>::Convert(const char * src, std::wstring & dst)
|
||||
{
|
||||
PT::UTF8ToWide(src, dst, false);
|
||||
pt::UTF8ToWide(src, dst, false);
|
||||
}
|
||||
|
||||
|
||||
template<class StringType>
|
||||
void TextStream<StringType>::Convert(const std::string & src, std::wstring & dst)
|
||||
{
|
||||
PT::UTF8ToWide(src, dst, false);
|
||||
pt::UTF8ToWide(src, dst, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -473,21 +473,21 @@ void TextStream<StringType>::Convert(const std::string & src, std::wstring & dst
|
||||
template<class StringType>
|
||||
void TextStream<StringType>::Convert(const wchar_t * src, size_t len, std::string & dst)
|
||||
{
|
||||
PT::WideToUTF8(src, len, dst, false);
|
||||
pt::WideToUTF8(src, len, dst, false);
|
||||
}
|
||||
|
||||
|
||||
template<class StringType>
|
||||
void TextStream<StringType>::Convert(const wchar_t * src, std::string & dst)
|
||||
{
|
||||
PT::WideToUTF8(src, dst, false);
|
||||
pt::WideToUTF8(src, dst, false);
|
||||
}
|
||||
|
||||
|
||||
template<class StringType>
|
||||
void TextStream<StringType>::Convert(const std::wstring & src, std::string & dst)
|
||||
{
|
||||
PT::WideToUTF8(src, dst, false);
|
||||
pt::WideToUTF8(src, dst, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
morm::JSONConnector json_connector;
|
||||
morm::PostgreSQLConnector postgresql_connector;
|
||||
|
||||
PT::WTextStream log_buffer;
|
||||
pt::WTextStream log_buffer;
|
||||
};
|
||||
|
||||
struct ThreadItem
|
||||
|
||||
@@ -57,7 +57,7 @@ void TimeZone::Dst::Clear()
|
||||
}
|
||||
|
||||
|
||||
bool TimeZone::Dst::IsDstUsed(const PT::Date & date) const
|
||||
bool TimeZone::Dst::IsDstUsed(const pt::Date & date) const
|
||||
{
|
||||
if( !has_dst )
|
||||
return false;
|
||||
@@ -70,7 +70,7 @@ return false;
|
||||
}
|
||||
|
||||
|
||||
int TimeZone::Dst::Compare(const PT::Date & date1, const PT::Date & date2) const
|
||||
int TimeZone::Dst::Compare(const pt::Date & date1, const pt::Date & date2) const
|
||||
{
|
||||
// year is ignored
|
||||
|
||||
@@ -135,7 +135,7 @@ return &i->second;
|
||||
|
||||
|
||||
|
||||
time_t TimeZone::CalcLocalOffset(const PT::Date & utc_date)
|
||||
time_t TimeZone::CalcLocalOffset(const pt::Date & utc_date)
|
||||
{
|
||||
time_t dst_offset = 0;
|
||||
|
||||
@@ -151,22 +151,22 @@ return offset + dst_offset;
|
||||
|
||||
time_t TimeZone::ToLocal(time_t utc_time)
|
||||
{
|
||||
time_t offset = CalcLocalOffset(PT::Date(utc_time));
|
||||
time_t offset = CalcLocalOffset(pt::Date(utc_time));
|
||||
|
||||
return utc_time + offset;
|
||||
}
|
||||
|
||||
|
||||
PT::Date TimeZone::ToLocal(const PT::Date & utc_date)
|
||||
pt::Date TimeZone::ToLocal(const pt::Date & utc_date)
|
||||
{
|
||||
PT::Date local(utc_date);
|
||||
pt::Date local(utc_date);
|
||||
local += CalcLocalOffset(utc_date);
|
||||
|
||||
return local;
|
||||
}
|
||||
|
||||
|
||||
time_t TimeZone::CalcUTCOffset(const PT::Date & local_date)
|
||||
time_t TimeZone::CalcUTCOffset(const pt::Date & local_date)
|
||||
{
|
||||
time_t dst_offset = 0;
|
||||
|
||||
@@ -175,7 +175,7 @@ time_t dst_offset = 0;
|
||||
if( dst && dst->has_dst )
|
||||
{
|
||||
// dst date ranges we have in UTC
|
||||
PT::Date utc(local_date);
|
||||
pt::Date utc(local_date);
|
||||
utc -= (offset + dst->offset);
|
||||
|
||||
if( dst->IsDstUsed(utc) )
|
||||
@@ -189,17 +189,17 @@ return offset + dst_offset;
|
||||
|
||||
time_t TimeZone::ToUTC(time_t local_time)
|
||||
{
|
||||
time_t offset = CalcUTCOffset(PT::Date(local_time));
|
||||
time_t offset = CalcUTCOffset(pt::Date(local_time));
|
||||
|
||||
return local_time - offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PT::Date TimeZone::ToUTC(const PT::Date & local_date)
|
||||
pt::Date TimeZone::ToUTC(const pt::Date & local_date)
|
||||
{
|
||||
time_t offset;
|
||||
PT::Date utc(local_date);
|
||||
pt::Date utc(local_date);
|
||||
|
||||
offset = CalcUTCOffset(local_date);
|
||||
utc -= offset;
|
||||
@@ -211,7 +211,7 @@ return utc;
|
||||
|
||||
time_t TimeZone::ParseStrOffset(const wchar_t * str)
|
||||
{
|
||||
PT::Date date;
|
||||
pt::Date date;
|
||||
bool is_sign = false;
|
||||
time_t offset = 0;
|
||||
|
||||
@@ -240,7 +240,7 @@ return offset;
|
||||
}
|
||||
|
||||
|
||||
time_t TimeZone::GetOffset(PT::Space & space)
|
||||
time_t TimeZone::GetOffset(pt::Space & space)
|
||||
{
|
||||
std::wstring * offset_str = space.get_wstr(L"offset_str");
|
||||
|
||||
@@ -251,7 +251,7 @@ time_t TimeZone::GetOffset(PT::Space & space)
|
||||
}
|
||||
|
||||
|
||||
bool TimeZone::SetTzDst(PT::Space & year)
|
||||
bool TimeZone::SetTzDst(pt::Space & year)
|
||||
{
|
||||
time_t h24 = 60 * 60 * 24; // 24 hours
|
||||
bool result = true;
|
||||
@@ -291,7 +291,7 @@ return result;
|
||||
}
|
||||
|
||||
|
||||
bool TimeZone::SetTz(PT::Space & space)
|
||||
bool TimeZone::SetTz(pt::Space & space)
|
||||
{
|
||||
bool result = true;
|
||||
name.clear();
|
||||
@@ -306,13 +306,13 @@ bool TimeZone::SetTz(PT::Space & space)
|
||||
if( offset < -h24 || offset > h24 )
|
||||
result = false;
|
||||
|
||||
PT::Space * dst = space.find_child_space(L"dst");
|
||||
pt::Space * dst = space.find_child_space(L"dst");
|
||||
|
||||
if( dst && dst->child_spaces )
|
||||
{
|
||||
for(size_t i=0 ; i<dst->child_spaces->size() ; ++i)
|
||||
{
|
||||
PT::Space & year = *(*dst->child_spaces)[i];
|
||||
pt::Space & year = *(*dst->child_spaces)[i];
|
||||
|
||||
if( !SetTzDst(year) )
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
// time zone daylight saving time (used if has_dst is true)
|
||||
// the 'year' field is the same in 'start' and 'end'
|
||||
// start and end are represented in UTC time
|
||||
PT::Date start, end;
|
||||
pt::Date start, end;
|
||||
|
||||
// time zone daylight saving time offset
|
||||
// used when has_dst is true and the date is whithin start and end
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
// checking whether specified 'date' is in the range of <start, end>
|
||||
// the year field in date, start and end is ignored
|
||||
// has_dst must be true
|
||||
bool IsDstUsed(const PT::Date & date) const;
|
||||
bool IsDstUsed(const pt::Date & date) const;
|
||||
|
||||
|
||||
private:
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
// return value less than zero if date1 is lower than date2
|
||||
// and a value greater than zero if date1 is greater than date2
|
||||
// the year field is ignored
|
||||
int Compare(const PT::Date & date1, const PT::Date & date2) const;
|
||||
int Compare(const pt::Date & date1, const pt::Date & date2) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -106,23 +106,23 @@ public:
|
||||
"tz_dst_end" the same as above
|
||||
"tz_dst_offset" (long)
|
||||
*/
|
||||
bool SetTz(PT::Space & space);
|
||||
bool SetTz(pt::Space & space);
|
||||
|
||||
|
||||
/*
|
||||
converting from UTC to local time
|
||||
*/
|
||||
time_t CalcLocalOffset(const PT::Date & utc_date);
|
||||
time_t CalcLocalOffset(const pt::Date & utc_date);
|
||||
time_t ToLocal(time_t utc_time);
|
||||
PT::Date ToLocal(const PT::Date & utc_date);
|
||||
pt::Date ToLocal(const pt::Date & utc_date);
|
||||
|
||||
|
||||
/*
|
||||
converting from local time to UTC
|
||||
*/
|
||||
time_t CalcUTCOffset(const PT::Date & local_date);
|
||||
time_t CalcUTCOffset(const pt::Date & local_date);
|
||||
time_t ToUTC(time_t local_time);
|
||||
PT::Date ToUTC(const PT::Date & local_date);
|
||||
pt::Date ToUTC(const pt::Date & local_date);
|
||||
|
||||
// return a Dst structure for the specified year
|
||||
// or null if it not exists
|
||||
@@ -155,8 +155,8 @@ public:
|
||||
private:
|
||||
|
||||
time_t ParseStrOffset(const wchar_t * str);
|
||||
time_t GetOffset(PT::Space & space);
|
||||
bool SetTzDst(PT::Space & year);
|
||||
time_t GetOffset(pt::Space & space);
|
||||
bool SetTzDst(pt::Space & year);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ void TimeZones::ParseZones()
|
||||
{
|
||||
for(size_t i=0 ; i<temp_space.child_spaces->size() ; ++i)
|
||||
{
|
||||
PT::Space & zone = *((*temp_space.child_spaces)[i]);
|
||||
pt::Space & zone = *((*temp_space.child_spaces)[i]);
|
||||
temp_zone.Clear();
|
||||
|
||||
if( temp_zone.SetTz(zone) )
|
||||
@@ -171,27 +171,27 @@ bool TimeZones::ReadTimeZones(const wchar_t * path)
|
||||
zone_tab.clear();
|
||||
temp_space.clear();
|
||||
|
||||
PT::SpaceParser::Status status = parser.ParseSpaceFile(path);
|
||||
pt::SpaceParser::Status status = parser.ParseSpaceFile(path);
|
||||
|
||||
if( status == PT::SpaceParser::ok )
|
||||
if( status == pt::SpaceParser::ok )
|
||||
{
|
||||
ParseZones();
|
||||
log << log2 << "Tz: time zones loaded, there are " << zone_tab.size() << " zones" << logend;
|
||||
}
|
||||
else
|
||||
if( status == PT::SpaceParser::syntax_error )
|
||||
if( status == pt::SpaceParser::syntax_error )
|
||||
{
|
||||
log << log1 << "TZ: error in time zone file, line: " << parser.get_last_parsed_line() << logend;
|
||||
}
|
||||
else
|
||||
if( status == PT::SpaceParser::cant_open_file )
|
||||
if( status == pt::SpaceParser::cant_open_file )
|
||||
{
|
||||
log << log1 << "TZ: I cannot open the time zone file: " << path << logend;
|
||||
}
|
||||
|
||||
temp_space.clear();
|
||||
|
||||
return status == PT::SpaceParser::ok;
|
||||
return status == pt::SpaceParser::ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -98,8 +98,8 @@ private:
|
||||
// everywhere we use zone_index we refer to this table
|
||||
std::vector<TimeZone> zone_tab;
|
||||
|
||||
PT::SpaceParser parser;
|
||||
PT::Space temp_space;
|
||||
pt::SpaceParser parser;
|
||||
pt::Space temp_space;
|
||||
TimeZone temp_zone;
|
||||
|
||||
void ParseZones();
|
||||
|
||||
@@ -63,7 +63,7 @@ void WinixBase::set_synchro(Synchro * synchro)
|
||||
}
|
||||
|
||||
|
||||
void WinixBase::set_log_buffer(PT::WTextStream * log_buffer)
|
||||
void WinixBase::set_log_buffer(pt::WTextStream * log_buffer)
|
||||
{
|
||||
log.SetLogBuffer(log_buffer);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
|
||||
void set_config(Config * config);
|
||||
void set_synchro(Synchro * synchro);
|
||||
void set_log_buffer(PT::WTextStream * log_buffer);
|
||||
void set_log_buffer(pt::WTextStream * log_buffer);
|
||||
void set_file_log(FileLog * file_log);
|
||||
|
||||
Log * get_logger();
|
||||
|
||||
Reference in New Issue
Block a user