updated to the new pikotools api: changed utf8 functions PascalCase to snake_case

This commit is contained in:
Tomasz Sowa 2021-05-21 00:41:27 +02:00
parent 8c523ce8b9
commit 8bb585d97d
25 changed files with 99 additions and 99 deletions

View File

@ -182,13 +182,13 @@ void App::InitPlugins()
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;
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;
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 true;
@ -934,7 +934,7 @@ void App::SetEnv(const char * name, std::wstring & env)
if( v )
{
pt::UTF8ToWide(v, env);
pt::utf8_to_wide(v, env);
}
}
@ -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::utf8_to_wide(header_name, http_header_name);
pt::utf8_to_wide(header_value, http_header_value);
cur.request->headers_in.add(http_header_name, http_header_value);
http_header_name.clear();
@ -1052,7 +1052,7 @@ void App::ReadEnvRemoteIP()
http_header_name += config.proxy_ip_header;
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);
}
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::utf8_to_wide(v, cur.request->ip_str);
}
}
@ -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::wide_to_utf8(i->first, aheader_name);
pt::wide_to_utf8(*i->second->get_wstr(), aheader_value);
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
FCGX_PutS(": ", fcgi_request.out);
@ -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::wide_to_utf8(i->first, aheader_name);
pt::wide_to_utf8(*i->second->get_wstr(), aheader_value);
FCGX_PutS("Set-Cookie: ", 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);
pt::WideToUTF8(*source, output_8bit);
pt::wide_to_utf8(*source, output_8bit);
// !! IMPROVE ME add to log the binary stream as well
if( config.log_server_answer )
@ -2022,10 +2022,10 @@ void App::LogUserGroups()
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;
if( !WideToUTF8(config.group, group, WINIX_OS_USERNAME_SIZE) )
if( !wide_to_utf8(config.group, group, WINIX_OS_USERNAME_SIZE) )
return false;
return true;
@ -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::wide_to_utf8(app->config.fcgi_socket, app->socket_to_send_on_exit);
app->Unlock();
app->SendEmptyFastCGIPacket();

View File

@ -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::wide_to_utf8(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::wide_to_utf8(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::wide_to_utf8(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::wide_to_utf8(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::wide_to_utf8(user.password, passa);
if( RSA(true, path_to_rsa_private_key, passa, user.pass_encrypted) )
{

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* Copyright (c) 2008-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -143,7 +143,7 @@ void HttpSimpleParser::ReadName()
}
if( getchar_returns_utf8_chars )
pt::UTF8ToWide(utf8_token, last_name);
pt::utf8_to_wide(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::utf8_to_wide(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::utf8_to_wide(utf8_token, last_value);
}

View File

@ -294,7 +294,7 @@ bool end;
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;
}
@ -387,7 +387,7 @@ bool Image::CreateInputFileName()
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;
}
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::wide_to_utf8(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::wide_to_utf8(item_work.source, sourcea);
pt::wide_to_utf8(item_work.dst, dsta);
MagickWandGenesis();

View File

@ -854,7 +854,7 @@ bool IsFile(const wchar_t * file)
struct stat sb;
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 (stat(file_name, &sb) == 0);
@ -876,7 +876,7 @@ char dir_name[WINIX_OS_PATH_SIZE];
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;
if( mkdir(dir_name, 0777) < 0 )
@ -952,7 +952,7 @@ struct group * result;
char group_name[WINIX_OS_USERNAME_SIZE];
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;
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];
if( !WideToUTF8(name, file_name, WINIX_OS_PATH_SIZE) )
if( !wide_to_utf8(name, file_name, WINIX_OS_PATH_SIZE) )
return false;
if( chmod(file_name, priv) < 0 )
@ -1046,10 +1046,10 @@ char src_name[WINIX_OS_PATH_SIZE];
char dst_name[WINIX_OS_PATH_SIZE];
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;
if( !WideToUTF8(dst, dst_name, WINIX_OS_PATH_SIZE) )
if( !wide_to_utf8(dst, dst_name, WINIX_OS_PATH_SIZE) )
return false;
in = fopen(src_name, "rb");
@ -1091,7 +1091,7 @@ bool RemoveFile(const wchar_t * file)
{
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 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 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;
if( !WideToUTF8(to, to_name, WINIX_OS_PATH_SIZE) )
if( !wide_to_utf8(to, to_name, WINIX_OS_PATH_SIZE) )
return false;
return rename(from_name, to_name) == 0;
@ -1137,7 +1137,7 @@ std::ifstream get_file_content;
if( clear_content )
content.clear();
if( !WideToUTF8(file_path, file, WINIX_OS_PATH_SIZE) )
if( !wide_to_utf8(file_path, file, WINIX_OS_PATH_SIZE) )
return false;
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
*/
pt::UTF8ToWide(get_file_content, content);
pt::utf8_to_wide(get_file_content, content);
get_file_content.close();
return true;
@ -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::wide_to_utf8(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::wide_to_utf8(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::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 )
{
@ -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);
}

View File

@ -743,7 +743,7 @@ void UrlEncode(const wchar_t * in,
{
static std::string ain;
pt::WideToUTF8(in, ain);
pt::wide_to_utf8(in, ain);
if( clear_out )
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 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)
{
@ -984,10 +984,10 @@ 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::wide_to_utf8()
*/
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);
bool wide_to_utf8(const wchar_t * wide_string, char * utf8, size_t utf8_size);
bool wide_to_utf8(const std::wstring & wide_string, char * utf8, size_t utf8_size);

View File

@ -265,7 +265,7 @@ void * Plugin::LoadInitFun(const wchar_t * filename, Fun1 & fun_init)
{
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;
void * p = dlopen(file, RTLD_NOW | RTLD_LOCAL);

View File

@ -389,7 +389,7 @@ void PostMultiParser::ReadContent()
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 = 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);
// !! IMPROVE ME dodac ustawienie chmod config.upload_files_chmod dla tymczasowego pliku

View File

@ -100,7 +100,7 @@ std::string key_ascii, key_base64_decoded;
{
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) )
{
@ -197,7 +197,7 @@ 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::wide_to_utf8(file, file_name_ascii);
out_file.clear();
out_file.open(file_name_ascii, std::ios_base::binary | std::ios_base::out);

View File

@ -688,7 +688,7 @@ char file_path[WINIX_OS_PATH_SIZE];
if( config->session_file.empty() )
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;
std::ofstream file(file_path);

View File

@ -60,7 +60,7 @@ char file_path[WINIX_OS_PATH_SIZE];
container.Clear();
if( !WideToUTF8(path, file_path, WINIX_OS_PATH_SIZE) )
if( !wide_to_utf8(path, file_path, WINIX_OS_PATH_SIZE) )
return false;
file.open(file_path, std::ios_base::in | std::ios_base::binary);

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2011-2014, Tomasz Sowa
* Copyright (c) 2011-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -189,7 +189,7 @@ return *this;
SLog & SLog::TranslateText(const char * str)
{
pt::UTF8ToWide(str, key_temp);
pt::utf8_to_wide(str, key_temp);
return TranslateText(key_temp.c_str());
}

View File

@ -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::int_to_utf8((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::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>
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>
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>
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>
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>
void TextStream<StringType>::Convert(const std::wstring & src, std::string & dst)
{
pt::WideToUTF8(src, dst, false);
pt::wide_to_utf8(src, dst, false);
}

View File

@ -187,7 +187,7 @@ const std::wstring & DbBase::AssertValueWide(PGresult * r, int row, int col)
const char * res = AssertValue(r, row, col);
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;
}
@ -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)
{
const char * res = AssertValue(r, row, col);
pt::UTF8ToWide(res, result);
pt::utf8_to_wide(res, result);
}

View File

@ -229,7 +229,7 @@ DbTextStream & DbTextStream::operator<<(RawText<pt::Date> date)
{
tmp_stream.Clear();
date.par.Serialize(tmp_stream);
pt::WideToUTF8(tmp_stream.CStr(), buffer, false);
pt::wide_to_utf8(tmp_stream.CStr(), buffer, false);
tmp_stream.Clear();
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
else
if( c != 0 )
pt::IntToUTF8(int(c), buffer, false);
pt::int_to_utf8(int(c), buffer, false);
return *this;
}

View File

@ -296,7 +296,7 @@ void FunctionParser::ParseAnchor()
while( *path )
name_ascii += GetChar();
pt::UTF8ToWide(name_ascii, cur->request->anchor);
pt::utf8_to_wide(name_ascii, cur->request->anchor);
if( !cur->request->anchor.empty() )
log << log3 << "FP: anchor: " << cur->request->anchor << logend;
@ -368,7 +368,7 @@ void FunctionParser::ReadName()
while( *path && *path!='/' && *path!='?' && *path!='#' )
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!='#' )
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!='#' )
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!='#' )
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!='#' )
value_ascii += GetChar();
pt::UTF8ToWide(value_ascii, value);
pt::utf8_to_wide(value_ascii, value);
}

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2012-2014, Tomasz Sowa
* Copyright (c) 2012-2021, Tomasz Sowa
* All rights reserved.
*
* 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 )
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);
session_manager->RemoveIPBan(ip);

View File

@ -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) )
{
pt::UTF8ToWide(pass_decrypted, user.password);
pt::utf8_to_wide(pass_decrypted, user.password);
}
else
{

View File

@ -120,7 +120,7 @@ void SavePidFile(Log & log)
if( !app.config.pid_file.empty() )
{
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);
if( !file )
@ -142,7 +142,7 @@ void RemovePidFile()
if( !app.config.pid_file.empty() )
{
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());
}
}
@ -166,7 +166,7 @@ using Winix::app;
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;
return 6;

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2018, Tomasz Sowa
* Copyright (c) 2008-2021, Tomasz Sowa
* All rights reserved.
*
* 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 ";
pt::WideToUTF8(email, sendmail_command, false);
pt::wide_to_utf8(email, sendmail_command, false);
FILE * sendmail = popen(sendmail_command.c_str(), "w");
if( !sendmail )
@ -297,7 +297,7 @@ size_t len;
}
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)
fputc(buf[a], sendmail);

View File

@ -123,7 +123,7 @@ bool ExportInfo::DecodePass(Export & exp)
/*
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);
}
else

View File

@ -262,7 +262,7 @@ return len;
void ExportThread::Convert(const std::wstring & in, std::string & out, bool clear)
{
Lock();
pt::WideToUTF8(in, out, clear);
pt::wide_to_utf8(in, out, clear);
Unlock();
}

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -96,7 +96,7 @@ void Stats::ReadStats()
if( stats_file.empty() )
return;
pt::WideToUTF8(stats_file, astats_file);
pt::wide_to_utf8(stats_file, astats_file);
std::ifstream file(astats_file.c_str());
if( !file )
@ -147,7 +147,7 @@ void Stats::SaveStats()
if( stats_file.empty() )
return;
pt::WideToUTF8(stats_file, astats_file);
pt::wide_to_utf8(stats_file, astats_file);
std::ofstream file(astats_file.c_str());
if( !file )

View File

@ -329,7 +329,7 @@ return *this;
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)
ETextPutChar(tmp_string[i]);
@ -343,7 +343,7 @@ return *this;
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)
ETextPutChar(tmp_string[i]);
@ -362,7 +362,7 @@ 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)
ETextPutChar(tmp_string[i]);

View File

@ -266,7 +266,7 @@ void Locale::Read(const char * dir, const char * dir_def)
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());
}
@ -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)
{
pt::WideToUTF8(dir, adir1);
pt::wide_to_utf8(dir, adir1);
if( !dir_def )
{
@ -293,7 +293,7 @@ void Locale::Read(const wchar_t * dir, const wchar_t * dir_def)
}
else
{
pt::WideToUTF8(dir_def, adir2);
pt::wide_to_utf8(dir_def, adir2);
Read(adir1.c_str(), adir2.c_str());
}
}