updated to the new pikotools api: changed utf8 functions PascalCase to snake_case
This commit is contained in:
parent
8c523ce8b9
commit
8bb585d97d
|
@ -182,13 +182,13 @@ void App::InitPlugins()
|
||||||
|
|
||||||
bool App::InitFCGI(char * sock, char * sock_user, char * sock_group)
|
bool App::InitFCGI(char * sock, char * sock_user, char * sock_group)
|
||||||
{
|
{
|
||||||
if( !WideToUTF8(config.fcgi_socket, sock, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(config.fcgi_socket, sock, WINIX_OS_PATH_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !WideToUTF8(config.fcgi_socket_user, sock_user, WINIX_OS_USERNAME_SIZE) )
|
if( !wide_to_utf8(config.fcgi_socket_user, sock_user, WINIX_OS_USERNAME_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !WideToUTF8(config.fcgi_socket_group, sock_group, WINIX_OS_USERNAME_SIZE) )
|
if( !wide_to_utf8(config.fcgi_socket_group, sock_group, WINIX_OS_USERNAME_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -934,7 +934,7 @@ void App::SetEnv(const char * name, std::wstring & env)
|
||||||
|
|
||||||
if( v )
|
if( v )
|
||||||
{
|
{
|
||||||
pt::UTF8ToWide(v, env);
|
pt::utf8_to_wide(v, env);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1031,8 +1031,8 @@ bool App::SaveEnvHTTPVariable(const char * env)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pt::UTF8ToWide(header_name, http_header_name);
|
pt::utf8_to_wide(header_name, http_header_name);
|
||||||
pt::UTF8ToWide(header_value, http_header_value);
|
pt::utf8_to_wide(header_value, http_header_value);
|
||||||
|
|
||||||
cur.request->headers_in.add(http_header_name, http_header_value);
|
cur.request->headers_in.add(http_header_name, http_header_value);
|
||||||
http_header_name.clear();
|
http_header_name.clear();
|
||||||
|
@ -1052,7 +1052,7 @@ void App::ReadEnvRemoteIP()
|
||||||
http_header_name += config.proxy_ip_header;
|
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::wide_to_utf8(http_header_name, http_header_8bit);
|
||||||
v = FCGX_GetParam(http_header_8bit.c_str(), fcgi_request.envp);
|
v = FCGX_GetParam(http_header_8bit.c_str(), fcgi_request.envp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1063,7 +1063,7 @@ void App::ReadEnvRemoteIP()
|
||||||
if( v )
|
if( v )
|
||||||
{
|
{
|
||||||
cur.request->ip = (int)inet_addr(v);
|
cur.request->ip = (int)inet_addr(v);
|
||||||
pt::UTF8ToWide(v, cur.request->ip_str);
|
pt::utf8_to_wide(v, cur.request->ip_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1494,8 +1494,8 @@ void App::SendHeaders()
|
||||||
{
|
{
|
||||||
if( i->second->is_wstr() )
|
if( i->second->is_wstr() )
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(i->first, aheader_name);
|
pt::wide_to_utf8(i->first, aheader_name);
|
||||||
pt::WideToUTF8(*i->second->get_wstr(), aheader_value);
|
pt::wide_to_utf8(*i->second->get_wstr(), aheader_value);
|
||||||
|
|
||||||
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
|
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
|
||||||
FCGX_PutS(": ", fcgi_request.out);
|
FCGX_PutS(": ", fcgi_request.out);
|
||||||
|
@ -1528,8 +1528,8 @@ void App::SendCookies()
|
||||||
{
|
{
|
||||||
if( i->second->is_wstr() )
|
if( i->second->is_wstr() )
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(i->first, aheader_name);
|
pt::wide_to_utf8(i->first, aheader_name);
|
||||||
pt::WideToUTF8(*i->second->get_wstr(), aheader_value);
|
pt::wide_to_utf8(*i->second->get_wstr(), aheader_value);
|
||||||
|
|
||||||
FCGX_PutS("Set-Cookie: ", fcgi_request.out);
|
FCGX_PutS("Set-Cookie: ", fcgi_request.out);
|
||||||
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
|
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
|
||||||
|
@ -1788,7 +1788,7 @@ size_t output_size = 0;
|
||||||
|
|
||||||
SelectCompression(source->length(), compressing, compress_encoding);
|
SelectCompression(source->length(), compressing, compress_encoding);
|
||||||
|
|
||||||
pt::WideToUTF8(*source, output_8bit);
|
pt::wide_to_utf8(*source, output_8bit);
|
||||||
|
|
||||||
// !! IMPROVE ME add to log the binary stream as well
|
// !! IMPROVE ME add to log the binary stream as well
|
||||||
if( config.log_server_answer )
|
if( config.log_server_answer )
|
||||||
|
@ -2022,10 +2022,10 @@ void App::LogUserGroups()
|
||||||
|
|
||||||
bool App::DropPrivileges(char * user, char * group)
|
bool App::DropPrivileges(char * user, char * group)
|
||||||
{
|
{
|
||||||
if( !WideToUTF8(config.user, user, WINIX_OS_USERNAME_SIZE) )
|
if( !wide_to_utf8(config.user, user, WINIX_OS_USERNAME_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !WideToUTF8(config.group, group, WINIX_OS_USERNAME_SIZE) )
|
if( !wide_to_utf8(config.group, group, WINIX_OS_USERNAME_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2270,7 +2270,7 @@ int sig;
|
||||||
app->synchro.was_stop_signal = true;
|
app->synchro.was_stop_signal = true;
|
||||||
FCGX_ShutdownPending();
|
FCGX_ShutdownPending();
|
||||||
|
|
||||||
pt::WideToUTF8(app->config.fcgi_socket, app->socket_to_send_on_exit);
|
pt::wide_to_utf8(app->config.fcgi_socket, app->socket_to_send_on_exit);
|
||||||
app->Unlock();
|
app->Unlock();
|
||||||
|
|
||||||
app->SendEmptyFastCGIPacket();
|
app->SendEmptyFastCGIPacket();
|
||||||
|
|
|
@ -78,7 +78,7 @@ bool Crypt::HashBin(int hash, const char * in, size_t inlen, std::string & out)
|
||||||
|
|
||||||
run.Clear();
|
run.Clear();
|
||||||
run.set_dependency(this);
|
run.set_dependency(this);
|
||||||
pt::WideToUTF8(config->opensll_path, command);
|
pt::wide_to_utf8(config->opensll_path, command);
|
||||||
run.Cmd(command);
|
run.Cmd(command);
|
||||||
run.Par("dgst");
|
run.Par("dgst");
|
||||||
run.Par("-binary");
|
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)
|
bool Crypt::HashBin(int hash, const wchar_t * in, size_t inlen, std::string & out)
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(in, inlen, bufina);
|
pt::wide_to_utf8(in, inlen, bufina);
|
||||||
int res = HashBin(hash, bufina.c_str(), bufina.size(), out);
|
int res = HashBin(hash, bufina.c_str(), bufina.size(), out);
|
||||||
bufina.clear();
|
bufina.clear();
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ bool Crypt::RSA(bool encrypt, const char * keypath, const char * in, size_t inle
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
run.Clear();
|
run.Clear();
|
||||||
pt::WideToUTF8(config->opensll_path, command);
|
pt::wide_to_utf8(config->opensll_path, command);
|
||||||
run.Cmd(command);
|
run.Cmd(command);
|
||||||
|
|
||||||
run.Par("rsautl");
|
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)
|
bool Crypt::RSA(bool encrypt, const wchar_t * keypath, const char * in, size_t inlen, std::string & out)
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(keypath, keypatha);
|
pt::wide_to_utf8(keypath, keypatha);
|
||||||
return RSA(encrypt, keypatha.c_str(), in, inlen, out);
|
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() )
|
if( !path_to_rsa_private_key.empty() )
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(user.password, passa);
|
pt::wide_to_utf8(user.password, passa);
|
||||||
|
|
||||||
if( RSA(true, path_to_rsa_private_key, passa, user.pass_encrypted) )
|
if( RSA(true, path_to_rsa_private_key, passa, user.pass_encrypted) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008-2014, Tomasz Sowa
|
* Copyright (c) 2008-2021, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -143,7 +143,7 @@ void HttpSimpleParser::ReadName()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( getchar_returns_utf8_chars )
|
if( getchar_returns_utf8_chars )
|
||||||
pt::UTF8ToWide(utf8_token, last_name);
|
pt::utf8_to_wide(utf8_token, last_name);
|
||||||
|
|
||||||
if( last_c == '=' )
|
if( last_c == '=' )
|
||||||
last_c = GetChar();
|
last_c = GetChar();
|
||||||
|
@ -173,7 +173,7 @@ void HttpSimpleParser::ReadQuotedValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( getchar_returns_utf8_chars )
|
if( getchar_returns_utf8_chars )
|
||||||
pt::UTF8ToWide(utf8_token, last_value);
|
pt::utf8_to_wide(utf8_token, last_value);
|
||||||
|
|
||||||
if( last_c == '"' )
|
if( last_c == '"' )
|
||||||
last_c = GetChar();
|
last_c = GetChar();
|
||||||
|
@ -204,7 +204,7 @@ void HttpSimpleParser::ReadNormalValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( getchar_returns_utf8_chars )
|
if( getchar_returns_utf8_chars )
|
||||||
pt::UTF8ToWide(utf8_token, last_value);
|
pt::utf8_to_wide(utf8_token, last_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ bool end;
|
||||||
|
|
||||||
void Image::Add(const std::wstring & in, TextStream<std::string> & out)
|
void Image::Add(const std::wstring & in, TextStream<std::string> & out)
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(in, add_tempa);
|
pt::wide_to_utf8(in, add_tempa);
|
||||||
out << add_tempa;
|
out << add_tempa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ bool Image::CreateInputFileName()
|
||||||
|
|
||||||
if( system->MakeFilePath(file_work, src_path, thumb) )
|
if( system->MakeFilePath(file_work, src_path, thumb) )
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(src_path, input_file_name);
|
pt::wide_to_utf8(src_path, input_file_name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -404,7 +404,7 @@ void Image::CreateTmpFileName()
|
||||||
{
|
{
|
||||||
stream_tmp_path.Clear();
|
stream_tmp_path.Clear();
|
||||||
stream_tmp_path << config->upload_dir << L"/tmp/image_" << std::time(0);
|
stream_tmp_path << config->upload_dir << L"/tmp/image_" << std::time(0);
|
||||||
pt::WideToUTF8(stream_tmp_path.Str(), tmp_file_name);
|
pt::wide_to_utf8(stream_tmp_path.Str(), tmp_file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -612,8 +612,8 @@ void Image::CreateImage()
|
||||||
|
|
||||||
void Image::CreateThumbnail()
|
void Image::CreateThumbnail()
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(item_work.source, sourcea);
|
pt::wide_to_utf8(item_work.source, sourcea);
|
||||||
pt::WideToUTF8(item_work.dst, dsta);
|
pt::wide_to_utf8(item_work.dst, dsta);
|
||||||
|
|
||||||
MagickWandGenesis();
|
MagickWandGenesis();
|
||||||
|
|
||||||
|
|
|
@ -854,7 +854,7 @@ bool IsFile(const wchar_t * file)
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
char file_name[WINIX_OS_PATH_SIZE];
|
char file_name[WINIX_OS_PATH_SIZE];
|
||||||
|
|
||||||
if( !WideToUTF8(file, file_name, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(file, file_name, WINIX_OS_PATH_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (stat(file_name, &sb) == 0);
|
return (stat(file_name, &sb) == 0);
|
||||||
|
@ -876,7 +876,7 @@ char dir_name[WINIX_OS_PATH_SIZE];
|
||||||
|
|
||||||
if( !IsFile(dir) )
|
if( !IsFile(dir) )
|
||||||
{
|
{
|
||||||
if( !WideToUTF8(dir, dir_name, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(dir, dir_name, WINIX_OS_PATH_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( mkdir(dir_name, 0777) < 0 )
|
if( mkdir(dir_name, 0777) < 0 )
|
||||||
|
@ -952,7 +952,7 @@ struct group * result;
|
||||||
char group_name[WINIX_OS_USERNAME_SIZE];
|
char group_name[WINIX_OS_USERNAME_SIZE];
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
|
|
||||||
if( !WideToUTF8(name, group_name, WINIX_OS_USERNAME_SIZE) )
|
if( !wide_to_utf8(name, group_name, WINIX_OS_USERNAME_SIZE) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( getgrnam_r(group_name, &gr, buffer, sizeof(buffer)/sizeof(char), &result) != 0 )
|
if( getgrnam_r(group_name, &gr, buffer, sizeof(buffer)/sizeof(char), &result) != 0 )
|
||||||
|
@ -988,7 +988,7 @@ bool SetPriv(const wchar_t * name, int priv, int group)
|
||||||
{
|
{
|
||||||
char file_name[WINIX_OS_PATH_SIZE];
|
char file_name[WINIX_OS_PATH_SIZE];
|
||||||
|
|
||||||
if( !WideToUTF8(name, file_name, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(name, file_name, WINIX_OS_PATH_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( chmod(file_name, priv) < 0 )
|
if( chmod(file_name, priv) < 0 )
|
||||||
|
@ -1046,10 +1046,10 @@ char src_name[WINIX_OS_PATH_SIZE];
|
||||||
char dst_name[WINIX_OS_PATH_SIZE];
|
char dst_name[WINIX_OS_PATH_SIZE];
|
||||||
FILE * in, * out;
|
FILE * in, * out;
|
||||||
|
|
||||||
if( !WideToUTF8(src, src_name, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(src, src_name, WINIX_OS_PATH_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !WideToUTF8(dst, dst_name, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(dst, dst_name, WINIX_OS_PATH_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
in = fopen(src_name, "rb");
|
in = fopen(src_name, "rb");
|
||||||
|
@ -1091,7 +1091,7 @@ bool RemoveFile(const wchar_t * file)
|
||||||
{
|
{
|
||||||
char file_name[WINIX_OS_PATH_SIZE];
|
char file_name[WINIX_OS_PATH_SIZE];
|
||||||
|
|
||||||
if( !WideToUTF8(file, file_name, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(file, file_name, WINIX_OS_PATH_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return unlink(file_name) == 0;
|
return unlink(file_name) == 0;
|
||||||
|
@ -1110,10 +1110,10 @@ bool RenameFile(const wchar_t * from, const wchar_t * to)
|
||||||
char from_name[WINIX_OS_PATH_SIZE];
|
char from_name[WINIX_OS_PATH_SIZE];
|
||||||
char to_name[WINIX_OS_PATH_SIZE];
|
char to_name[WINIX_OS_PATH_SIZE];
|
||||||
|
|
||||||
if( !WideToUTF8(from, from_name, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(from, from_name, WINIX_OS_PATH_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !WideToUTF8(to, to_name, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(to, to_name, WINIX_OS_PATH_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return rename(from_name, to_name) == 0;
|
return rename(from_name, to_name) == 0;
|
||||||
|
@ -1137,7 +1137,7 @@ std::ifstream get_file_content;
|
||||||
if( clear_content )
|
if( clear_content )
|
||||||
content.clear();
|
content.clear();
|
||||||
|
|
||||||
if( !WideToUTF8(file_path, file, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(file_path, file, WINIX_OS_PATH_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
get_file_content.open(file, std::ios_base::in | std::ios_base::binary);
|
get_file_content.open(file, std::ios_base::in | std::ios_base::binary);
|
||||||
|
@ -1148,7 +1148,7 @@ std::ifstream get_file_content;
|
||||||
/*
|
/*
|
||||||
* we don't report any errors when converting from UTF8 to wide characters here
|
* we don't report any errors when converting from UTF8 to wide characters here
|
||||||
*/
|
*/
|
||||||
pt::UTF8ToWide(get_file_content, content);
|
pt::utf8_to_wide(get_file_content, content);
|
||||||
get_file_content.close();
|
get_file_content.close();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1280,7 +1280,7 @@ void UrlEncode(const wchar_t * in, std::string & out, bool clear_out)
|
||||||
{
|
{
|
||||||
static std::string ain;
|
static std::string ain;
|
||||||
|
|
||||||
pt::WideToUTF8(in, ain);
|
pt::wide_to_utf8(in, ain);
|
||||||
|
|
||||||
if( clear_out )
|
if( clear_out )
|
||||||
out.clear();
|
out.clear();
|
||||||
|
@ -1301,7 +1301,7 @@ void UrlEncode(const wchar_t * in, std::wstring & out, bool clear_out)
|
||||||
{
|
{
|
||||||
static std::string ain;
|
static std::string ain;
|
||||||
|
|
||||||
pt::WideToUTF8(in, ain);
|
pt::wide_to_utf8(in, ain);
|
||||||
|
|
||||||
if( clear_out )
|
if( clear_out )
|
||||||
out.clear();
|
out.clear();
|
||||||
|
@ -1372,7 +1372,7 @@ int c1, c2;
|
||||||
|
|
||||||
url_utf8[index] = 0;
|
url_utf8[index] = 0;
|
||||||
|
|
||||||
return pt::UTF8ToWide(url_utf8, out, false);
|
return pt::utf8_to_wide(url_utf8, out, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1416,9 +1416,9 @@ void RemovePostFileTmp(PostFileTab & post_file_tab)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool WideToUTF8(const wchar_t * wide_string, char * utf8, size_t utf8_size)
|
bool wide_to_utf8(const wchar_t * wide_string, char * utf8, size_t utf8_size)
|
||||||
{
|
{
|
||||||
bool res = pt::WideToUTF8(wide_string, utf8, utf8_size);
|
bool res = pt::wide_to_utf8(wide_string, utf8, utf8_size);
|
||||||
|
|
||||||
if( !res )
|
if( !res )
|
||||||
{
|
{
|
||||||
|
@ -1433,9 +1433,9 @@ return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool WideToUTF8(const std::wstring & wide_string, char * utf8, size_t utf8_size)
|
bool wide_to_utf8(const std::wstring & wide_string, char * utf8, size_t utf8_size)
|
||||||
{
|
{
|
||||||
return WideToUTF8(wide_string.c_str(), utf8, utf8_size);
|
return wide_to_utf8(wide_string.c_str(), utf8, utf8_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -743,7 +743,7 @@ void UrlEncode(const wchar_t * in,
|
||||||
{
|
{
|
||||||
static std::string ain;
|
static std::string ain;
|
||||||
|
|
||||||
pt::WideToUTF8(in, ain);
|
pt::wide_to_utf8(in, ain);
|
||||||
|
|
||||||
if( clear_out )
|
if( clear_out )
|
||||||
out.clear();
|
out.clear();
|
||||||
|
@ -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 len1 = sizeof(buf1) / sizeof(char);
|
||||||
size_t len2 = sizeof(buf2) / sizeof(char);
|
size_t len2 = sizeof(buf2) / sizeof(char);
|
||||||
size_t len = pt::IntToUTF8(int(c), buf1, len1);
|
size_t len = pt::int_to_utf8(int(c), buf1, len1);
|
||||||
|
|
||||||
for(size_t i=0 ; i<len ; ++i)
|
for(size_t i=0 ; i<len ; ++i)
|
||||||
{
|
{
|
||||||
|
@ -984,10 +984,10 @@ void JSONescape(Stream & out, const StringType & str)
|
||||||
* converting from a wide string to an UTF-8 string
|
* converting from a wide string to an UTF-8 string
|
||||||
* and puts a log if the conversion fails
|
* and puts a log if the conversion fails
|
||||||
*
|
*
|
||||||
* it uses pt::WideToUTF8()
|
* it uses pt::wide_to_utf8()
|
||||||
*/
|
*/
|
||||||
bool WideToUTF8(const wchar_t * wide_string, char * utf8, size_t utf8_size);
|
bool wide_to_utf8(const wchar_t * wide_string, char * utf8, size_t utf8_size);
|
||||||
bool WideToUTF8(const std::wstring & wide_string, char * utf8, size_t utf8_size);
|
bool wide_to_utf8(const std::wstring & wide_string, char * utf8, size_t utf8_size);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ void * Plugin::LoadInitFun(const wchar_t * filename, Fun1 & fun_init)
|
||||||
{
|
{
|
||||||
char file[WINIX_OS_PATH_SIZE];
|
char file[WINIX_OS_PATH_SIZE];
|
||||||
|
|
||||||
if( !WideToUTF8(filename, file, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(filename, file, WINIX_OS_PATH_SIZE) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
void * p = dlopen(file, RTLD_NOW | RTLD_LOCAL);
|
void * p = dlopen(file, RTLD_NOW | RTLD_LOCAL);
|
||||||
|
|
|
@ -389,7 +389,7 @@ void PostMultiParser::ReadContent()
|
||||||
|
|
||||||
void PostMultiParser::ConvStr(const std::string & src, std::wstring & dst)
|
void PostMultiParser::ConvStr(const std::string & src, std::wstring & dst)
|
||||||
{
|
{
|
||||||
pt::UTF8ToWide(src, dst);
|
pt::utf8_to_wide(src, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ size_t buf_len = sizeof(buf)/sizeof(wchar_t);
|
||||||
tmp_filename_postfix += 1;
|
tmp_filename_postfix += 1;
|
||||||
|
|
||||||
tmp_filename = buf;
|
tmp_filename = buf;
|
||||||
pt::WideToUTF8(tmp_filename, atmp_filename);
|
pt::wide_to_utf8(tmp_filename, atmp_filename);
|
||||||
|
|
||||||
tmp_file.open(atmp_filename.c_str(), std::ios_base::binary | std::ios_base::out);
|
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
|
// !! IMPROVE ME dodac ustawienie chmod config.upload_files_chmod dla tymczasowego pliku
|
||||||
|
|
|
@ -100,7 +100,7 @@ std::string key_ascii, key_base64_decoded;
|
||||||
{
|
{
|
||||||
dest_key[i].clear();
|
dest_key[i].clear();
|
||||||
|
|
||||||
if( pt::WideToUTF8(keys[i], key_ascii) )
|
if( pt::wide_to_utf8(keys[i], key_ascii) )
|
||||||
{
|
{
|
||||||
if( base64.Decode(key_ascii, key_base64_decoded) )
|
if( base64.Decode(key_ascii, key_base64_decoded) )
|
||||||
{
|
{
|
||||||
|
@ -197,7 +197,7 @@ void SessionIdManager::SaveKeysToFile(std::vector<std::string> & keys)
|
||||||
bool SessionIdManager::SaveKeysToFile(const wchar_t * file)
|
bool SessionIdManager::SaveKeysToFile(const wchar_t * file)
|
||||||
{
|
{
|
||||||
pt::Date date = last_key_generated;
|
pt::Date date = last_key_generated;
|
||||||
pt::WideToUTF8(file, file_name_ascii);
|
pt::wide_to_utf8(file, file_name_ascii);
|
||||||
|
|
||||||
out_file.clear();
|
out_file.clear();
|
||||||
out_file.open(file_name_ascii, std::ios_base::binary | std::ios_base::out);
|
out_file.open(file_name_ascii, std::ios_base::binary | std::ios_base::out);
|
||||||
|
|
|
@ -688,7 +688,7 @@ char file_path[WINIX_OS_PATH_SIZE];
|
||||||
if( config->session_file.empty() )
|
if( config->session_file.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !WideToUTF8(config->session_file, file_path, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(config->session_file, file_path, WINIX_OS_PATH_SIZE) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::ofstream file(file_path);
|
std::ofstream file(file_path);
|
||||||
|
|
|
@ -60,7 +60,7 @@ char file_path[WINIX_OS_PATH_SIZE];
|
||||||
|
|
||||||
container.Clear();
|
container.Clear();
|
||||||
|
|
||||||
if( !WideToUTF8(path, file_path, WINIX_OS_PATH_SIZE) )
|
if( !wide_to_utf8(path, file_path, WINIX_OS_PATH_SIZE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
file.open(file_path, std::ios_base::in | std::ios_base::binary);
|
file.open(file_path, std::ios_base::in | std::ios_base::binary);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2014, Tomasz Sowa
|
* Copyright (c) 2011-2021, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -189,7 +189,7 @@ return *this;
|
||||||
|
|
||||||
SLog & SLog::TranslateText(const char * str)
|
SLog & SLog::TranslateText(const char * str)
|
||||||
{
|
{
|
||||||
pt::UTF8ToWide(str, key_temp);
|
pt::utf8_to_wide(str, key_temp);
|
||||||
return TranslateText(key_temp.c_str());
|
return TranslateText(key_temp.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,7 @@ return *this;
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(wchar_t c, std::string & dst)
|
void TextStream<StringType>::Convert(wchar_t c, std::string & dst)
|
||||||
{
|
{
|
||||||
pt::IntToUTF8((int)c, dst, false);
|
pt::int_to_utf8((int)c, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ void TextStream<StringType>::Convert(wchar_t c, std::wstring & dst)
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const char * src, size_t len, std::wstring & dst)
|
void TextStream<StringType>::Convert(const char * src, size_t len, std::wstring & dst)
|
||||||
{
|
{
|
||||||
pt::UTF8ToWide(src, len, dst, false);
|
pt::utf8_to_wide(src, len, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -456,14 +456,14 @@ void TextStream<StringType>::Convert(const char * src, size_t len, std::wstring
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const char * src, std::wstring & dst)
|
void TextStream<StringType>::Convert(const char * src, std::wstring & dst)
|
||||||
{
|
{
|
||||||
pt::UTF8ToWide(src, dst, false);
|
pt::utf8_to_wide(src, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const std::string & src, std::wstring & dst)
|
void TextStream<StringType>::Convert(const std::string & src, std::wstring & dst)
|
||||||
{
|
{
|
||||||
pt::UTF8ToWide(src, dst, false);
|
pt::utf8_to_wide(src, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -473,21 +473,21 @@ void TextStream<StringType>::Convert(const std::string & src, std::wstring & dst
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const wchar_t * src, size_t len, std::string & dst)
|
void TextStream<StringType>::Convert(const wchar_t * src, size_t len, std::string & dst)
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(src, len, dst, false);
|
pt::wide_to_utf8(src, len, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const wchar_t * src, std::string & dst)
|
void TextStream<StringType>::Convert(const wchar_t * src, std::string & dst)
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(src, dst, false);
|
pt::wide_to_utf8(src, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const std::wstring & src, std::string & dst)
|
void TextStream<StringType>::Convert(const std::wstring & src, std::string & dst)
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(src, dst, false);
|
pt::wide_to_utf8(src, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ const std::wstring & DbBase::AssertValueWide(PGresult * r, int row, int col)
|
||||||
const char * res = AssertValue(r, row, col);
|
const char * res = AssertValue(r, row, col);
|
||||||
static std::wstring temp_wide_value; // !! IMPROVE ME add as a class field (nonstatic)
|
static std::wstring temp_wide_value; // !! IMPROVE ME add as a class field (nonstatic)
|
||||||
|
|
||||||
pt::UTF8ToWide(res, temp_wide_value);
|
pt::utf8_to_wide(res, temp_wide_value);
|
||||||
|
|
||||||
return temp_wide_value;
|
return temp_wide_value;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ void DbBase::AssertValueBin(PGresult * r, int row, int col, std::string & result
|
||||||
void DbBase::AssertValueWide(PGresult * r, int row, int col, std::wstring & result)
|
void DbBase::AssertValueWide(PGresult * r, int row, int col, std::wstring & result)
|
||||||
{
|
{
|
||||||
const char * res = AssertValue(r, row, col);
|
const char * res = AssertValue(r, row, col);
|
||||||
pt::UTF8ToWide(res, result);
|
pt::utf8_to_wide(res, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ DbTextStream & DbTextStream::operator<<(RawText<pt::Date> date)
|
||||||
{
|
{
|
||||||
tmp_stream.Clear();
|
tmp_stream.Clear();
|
||||||
date.par.Serialize(tmp_stream);
|
date.par.Serialize(tmp_stream);
|
||||||
pt::WideToUTF8(tmp_stream.CStr(), buffer, false);
|
pt::wide_to_utf8(tmp_stream.CStr(), buffer, false);
|
||||||
tmp_stream.Clear();
|
tmp_stream.Clear();
|
||||||
|
|
||||||
was_param = false;
|
was_param = false;
|
||||||
|
@ -290,7 +290,7 @@ DbTextStream & DbTextStream::ETextPutChar(wchar_t c)
|
||||||
buffer += "\\\'"; // don't use "''" because we use the method for PQconnectdb too
|
buffer += "\\\'"; // don't use "''" because we use the method for PQconnectdb too
|
||||||
else
|
else
|
||||||
if( c != 0 )
|
if( c != 0 )
|
||||||
pt::IntToUTF8(int(c), buffer, false);
|
pt::int_to_utf8(int(c), buffer, false);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,7 +296,7 @@ void FunctionParser::ParseAnchor()
|
||||||
while( *path )
|
while( *path )
|
||||||
name_ascii += GetChar();
|
name_ascii += GetChar();
|
||||||
|
|
||||||
pt::UTF8ToWide(name_ascii, cur->request->anchor);
|
pt::utf8_to_wide(name_ascii, cur->request->anchor);
|
||||||
|
|
||||||
if( !cur->request->anchor.empty() )
|
if( !cur->request->anchor.empty() )
|
||||||
log << log3 << "FP: anchor: " << cur->request->anchor << logend;
|
log << log3 << "FP: anchor: " << cur->request->anchor << logend;
|
||||||
|
@ -368,7 +368,7 @@ void FunctionParser::ReadName()
|
||||||
while( *path && *path!='/' && *path!='?' && *path!='#' )
|
while( *path && *path!='/' && *path!='?' && *path!='#' )
|
||||||
name_ascii += GetChar();
|
name_ascii += GetChar();
|
||||||
|
|
||||||
pt::UTF8ToWide(name_ascii, name);
|
pt::utf8_to_wide(name_ascii, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ void FunctionParser::ReadOrdinaryParName()
|
||||||
while( *path && *path!='=' && *path!='&' && *path!='#' )
|
while( *path && *path!='=' && *path!='&' && *path!='#' )
|
||||||
name_ascii += GetChar();
|
name_ascii += GetChar();
|
||||||
|
|
||||||
pt::UTF8ToWide(name_ascii, name);
|
pt::utf8_to_wide(name_ascii, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ void FunctionParser::ReadOrdinaryParValue()
|
||||||
while( *path && *path!='&' && *path!='#' )
|
while( *path && *path!='&' && *path!='#' )
|
||||||
value_ascii += GetChar();
|
value_ascii += GetChar();
|
||||||
|
|
||||||
pt::UTF8ToWide(value_ascii, value);
|
pt::utf8_to_wide(value_ascii, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ void FunctionParser::ReadWinixParName()
|
||||||
while( *path && *path!='/' && *path!=':' && *path!='#' )
|
while( *path && *path!='/' && *path!=':' && *path!='#' )
|
||||||
name_ascii += GetChar();
|
name_ascii += GetChar();
|
||||||
|
|
||||||
pt::UTF8ToWide(name_ascii, name);
|
pt::utf8_to_wide(name_ascii, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ void FunctionParser::ReadWinixParValue()
|
||||||
while( *path && *path!='/' && *path!='#' )
|
while( *path && *path!='/' && *path!='#' )
|
||||||
value_ascii += GetChar();
|
value_ascii += GetChar();
|
||||||
|
|
||||||
pt::UTF8ToWide(value_ascii, value);
|
pt::utf8_to_wide(value_ascii, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2014, Tomasz Sowa
|
* Copyright (c) 2012-2021, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -89,7 +89,7 @@ size_t tmp_ip_len = sizeof(tmp_ip_str) / sizeof(char);
|
||||||
if( cur->session->ip_ban )
|
if( cur->session->ip_ban )
|
||||||
cur_ip = cur->session->ip_ban->ip;
|
cur_ip = cur->session->ip_ban->ip;
|
||||||
|
|
||||||
if( WideToUTF8(cur->request->ParamValue(L"removeip"), tmp_ip_str, tmp_ip_len) )
|
if( wide_to_utf8(cur->request->ParamValue(L"removeip"), tmp_ip_str, tmp_ip_len) )
|
||||||
{
|
{
|
||||||
int ip = (int)inet_addr(tmp_ip_str);
|
int ip = (int)inet_addr(tmp_ip_str);
|
||||||
session_manager->RemoveIPBan(ip);
|
session_manager->RemoveIPBan(ip);
|
||||||
|
|
|
@ -69,7 +69,7 @@ bool Login::CheckPasswords(User & user, const std::wstring & password)
|
||||||
{
|
{
|
||||||
if( system->crypt.RSA(false, config->pass_rsa_private_key, user.pass_encrypted, pass_decrypted) )
|
if( system->crypt.RSA(false, config->pass_rsa_private_key, user.pass_encrypted, pass_decrypted) )
|
||||||
{
|
{
|
||||||
pt::UTF8ToWide(pass_decrypted, user.password);
|
pt::utf8_to_wide(pass_decrypted, user.password);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -120,7 +120,7 @@ void SavePidFile(Log & log)
|
||||||
if( !app.config.pid_file.empty() )
|
if( !app.config.pid_file.empty() )
|
||||||
{
|
{
|
||||||
std::string file_name;
|
std::string file_name;
|
||||||
pt::WideToUTF8(app.config.pid_file, file_name);
|
pt::wide_to_utf8(app.config.pid_file, file_name);
|
||||||
std::ofstream file(file_name);
|
std::ofstream file(file_name);
|
||||||
|
|
||||||
if( !file )
|
if( !file )
|
||||||
|
@ -142,7 +142,7 @@ void RemovePidFile()
|
||||||
if( !app.config.pid_file.empty() )
|
if( !app.config.pid_file.empty() )
|
||||||
{
|
{
|
||||||
std::string file_name;
|
std::string file_name;
|
||||||
pt::WideToUTF8(app.config.pid_file, file_name);
|
pt::wide_to_utf8(app.config.pid_file, file_name);
|
||||||
unlink(file_name.c_str());
|
unlink(file_name.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ using Winix::app;
|
||||||
|
|
||||||
app.system.system_start = time(0);
|
app.system.system_start = time(0);
|
||||||
|
|
||||||
if( !pt::UTF8ToWide(argc[1], app.config.config_file) )
|
if( !pt::utf8_to_wide(argc[1], app.config.config_file) )
|
||||||
{
|
{
|
||||||
std::wcout << "An incorrect UTF-8 path of the config file" << std::endl;
|
std::wcout << "An incorrect UTF-8 path of the config file" << std::endl;
|
||||||
return 6;
|
return 6;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
* Copyright (c) 2008-2021, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -267,7 +267,7 @@ void NotifyThread::SendMail(const std::wstring & email, const std::wstring & mes
|
||||||
}
|
}
|
||||||
|
|
||||||
sendmail_command = "sendmail ";
|
sendmail_command = "sendmail ";
|
||||||
pt::WideToUTF8(email, sendmail_command, false);
|
pt::wide_to_utf8(email, sendmail_command, false);
|
||||||
FILE * sendmail = popen(sendmail_command.c_str(), "w");
|
FILE * sendmail = popen(sendmail_command.c_str(), "w");
|
||||||
|
|
||||||
if( !sendmail )
|
if( !sendmail )
|
||||||
|
@ -297,7 +297,7 @@ size_t len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = pt::IntToUTF8(int(message[i]), buf, sizeof(buf) / sizeof(char));
|
len = pt::int_to_utf8(int(message[i]), buf, sizeof(buf) / sizeof(char));
|
||||||
|
|
||||||
for(size_t a=0 ; a<len ; ++a)
|
for(size_t a=0 ; a<len ; ++a)
|
||||||
fputc(buf[a], sendmail);
|
fputc(buf[a], sendmail);
|
||||||
|
|
|
@ -123,7 +123,7 @@ bool ExportInfo::DecodePass(Export & exp)
|
||||||
/*
|
/*
|
||||||
if( system->crypt.RSA(false, rsa_key, exp.ftp_pass_bin, pass_decrypted) )
|
if( system->crypt.RSA(false, rsa_key, exp.ftp_pass_bin, pass_decrypted) )
|
||||||
{
|
{
|
||||||
pt::UTF8ToWide(pass_decrypted, exp.ftp_pass);
|
pt::utf8_to_wide(pass_decrypted, exp.ftp_pass);
|
||||||
system->crypt.ClearString(pass_decrypted);
|
system->crypt.ClearString(pass_decrypted);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -262,7 +262,7 @@ return len;
|
||||||
void ExportThread::Convert(const std::wstring & in, std::string & out, bool clear)
|
void ExportThread::Convert(const std::wstring & in, std::string & out, bool clear)
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
pt::WideToUTF8(in, out, clear);
|
pt::wide_to_utf8(in, out, clear);
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010-2014, Tomasz Sowa
|
* Copyright (c) 2010-2021, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -96,7 +96,7 @@ void Stats::ReadStats()
|
||||||
if( stats_file.empty() )
|
if( stats_file.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pt::WideToUTF8(stats_file, astats_file);
|
pt::wide_to_utf8(stats_file, astats_file);
|
||||||
std::ifstream file(astats_file.c_str());
|
std::ifstream file(astats_file.c_str());
|
||||||
|
|
||||||
if( !file )
|
if( !file )
|
||||||
|
@ -147,7 +147,7 @@ void Stats::SaveStats()
|
||||||
if( stats_file.empty() )
|
if( stats_file.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pt::WideToUTF8(stats_file, astats_file);
|
pt::wide_to_utf8(stats_file, astats_file);
|
||||||
std::ofstream file(astats_file.c_str());
|
std::ofstream file(astats_file.c_str());
|
||||||
|
|
||||||
if( !file )
|
if( !file )
|
||||||
|
|
|
@ -329,7 +329,7 @@ return *this;
|
||||||
|
|
||||||
HtmlTextStream & HtmlTextStream::EPutText(const char * str)
|
HtmlTextStream & HtmlTextStream::EPutText(const char * str)
|
||||||
{
|
{
|
||||||
pt::UTF8ToWide(str, tmp_string);
|
pt::utf8_to_wide(str, tmp_string);
|
||||||
|
|
||||||
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
||||||
ETextPutChar(tmp_string[i]);
|
ETextPutChar(tmp_string[i]);
|
||||||
|
@ -343,7 +343,7 @@ return *this;
|
||||||
|
|
||||||
HtmlTextStream & HtmlTextStream::EPutText(const char * str, size_t len)
|
HtmlTextStream & HtmlTextStream::EPutText(const char * str, size_t len)
|
||||||
{
|
{
|
||||||
pt::UTF8ToWide(str, len, tmp_string);
|
pt::utf8_to_wide(str, len, tmp_string);
|
||||||
|
|
||||||
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
||||||
ETextPutChar(tmp_string[i]);
|
ETextPutChar(tmp_string[i]);
|
||||||
|
@ -362,7 +362,7 @@ HtmlTextStream & HtmlTextStream::EPutText(const std::string * str)
|
||||||
|
|
||||||
HtmlTextStream & HtmlTextStream::EPutText(const std::string & str)
|
HtmlTextStream & HtmlTextStream::EPutText(const std::string & str)
|
||||||
{
|
{
|
||||||
pt::UTF8ToWide(str, tmp_string);
|
pt::utf8_to_wide(str, tmp_string);
|
||||||
|
|
||||||
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
||||||
ETextPutChar(tmp_string[i]);
|
ETextPutChar(tmp_string[i]);
|
||||||
|
|
|
@ -266,7 +266,7 @@ void Locale::Read(const char * dir, const char * dir_def)
|
||||||
|
|
||||||
for(size_t i=0 ; i<locale_files.size() ; ++i)
|
for(size_t i=0 ; i<locale_files.size() ; ++i)
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(locale_files[i], locale_filea);
|
pt::wide_to_utf8(locale_files[i], locale_filea);
|
||||||
ReadFile(dir, dir_def, locale_filea.c_str());
|
ReadFile(dir, dir_def, locale_filea.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ void Locale::Read(const std::string & dir, const std::string & dir_def)
|
||||||
|
|
||||||
void Locale::Read(const wchar_t * dir, const wchar_t * dir_def)
|
void Locale::Read(const wchar_t * dir, const wchar_t * dir_def)
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(dir, adir1);
|
pt::wide_to_utf8(dir, adir1);
|
||||||
|
|
||||||
if( !dir_def )
|
if( !dir_def )
|
||||||
{
|
{
|
||||||
|
@ -293,7 +293,7 @@ void Locale::Read(const wchar_t * dir, const wchar_t * dir_def)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pt::WideToUTF8(dir_def, adir2);
|
pt::wide_to_utf8(dir_def, adir2);
|
||||||
Read(adir1.c_str(), adir2.c_str());
|
Read(adir1.c_str(), adir2.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue