From 8bb585d97d5af587712160cced0350080b3094ab Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Fri, 21 May 2021 00:41:27 +0200 Subject: [PATCH] updated to the new pikotools api: changed utf8 functions PascalCase to snake_case --- winixd/core/app.cpp | 32 +++++++++++------------ winixd/core/crypt.cpp | 10 +++---- winixd/core/httpsimpleparser.cpp | 8 +++--- winixd/core/image.cpp | 10 +++---- winixd/core/misc.cpp | 36 +++++++++++++------------- winixd/core/misc.h | 10 +++---- winixd/core/plugin.cpp | 2 +- winixd/core/postmultiparser.cpp | 4 +-- winixd/core/sessionidmanager.cpp | 4 +-- winixd/core/sessionmanager.cpp | 2 +- winixd/core/sessionparser.cpp | 2 +- winixd/core/slog.cpp | 4 +-- winixd/core/textstream.h | 14 +++++----- winixd/db/dbbase.cpp | 4 +-- winixd/db/dbtextstream.cpp | 4 +-- winixd/functions/functionparser.cpp | 12 ++++----- winixd/functions/ipban.cpp | 4 +-- winixd/functions/login.cpp | 2 +- winixd/main/main.cpp | 6 ++--- winixd/notify/notifythread.cpp | 6 ++--- winixd/plugins/export/exportinfo.cpp | 2 +- winixd/plugins/export/exportthread.cpp | 2 +- winixd/plugins/stats/stats.cpp | 6 ++--- winixd/templates/htmltextstream.cpp | 6 ++--- winixd/templates/locale.cpp | 6 ++--- 25 files changed, 99 insertions(+), 99 deletions(-) diff --git a/winixd/core/app.cpp b/winixd/core/app.cpp index 0380f5e..f71cf17 100644 --- a/winixd/core/app.cpp +++ b/winixd/core/app.cpp @@ -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(); diff --git a/winixd/core/crypt.cpp b/winixd/core/crypt.cpp index 923ed0b..47448b3 100644 --- a/winixd/core/crypt.cpp +++ b/winixd/core/crypt.cpp @@ -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) ) { diff --git a/winixd/core/httpsimpleparser.cpp b/winixd/core/httpsimpleparser.cpp index 2589ffb..cbfcc7b 100644 --- a/winixd/core/httpsimpleparser.cpp +++ b/winixd/core/httpsimpleparser.cpp @@ -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); } diff --git a/winixd/core/image.cpp b/winixd/core/image.cpp index 4a5af02..99dff5d 100644 --- a/winixd/core/image.cpp +++ b/winixd/core/image.cpp @@ -294,7 +294,7 @@ bool end; void Image::Add(const std::wstring & in, TextStream & 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(); diff --git a/winixd/core/misc.cpp b/winixd/core/misc.cpp index b0b747f..a734375 100644 --- a/winixd/core/misc.cpp +++ b/winixd/core/misc.cpp @@ -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); } diff --git a/winixd/core/misc.h b/winixd/core/misc.h index 635a7a9..ab8ba9d 100644 --- a/winixd/core/misc.h +++ b/winixd/core/misc.h @@ -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 & 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); diff --git a/winixd/core/sessionmanager.cpp b/winixd/core/sessionmanager.cpp index be90a02..c41dc61 100644 --- a/winixd/core/sessionmanager.cpp +++ b/winixd/core/sessionmanager.cpp @@ -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); diff --git a/winixd/core/sessionparser.cpp b/winixd/core/sessionparser.cpp index 29cf121..6044a56 100644 --- a/winixd/core/sessionparser.cpp +++ b/winixd/core/sessionparser.cpp @@ -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); diff --git a/winixd/core/slog.cpp b/winixd/core/slog.cpp index fbc9ae3..4a12529 100644 --- a/winixd/core/slog.cpp +++ b/winixd/core/slog.cpp @@ -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()); } diff --git a/winixd/core/textstream.h b/winixd/core/textstream.h index 34cf3f4..24ed8ed 100644 --- a/winixd/core/textstream.h +++ b/winixd/core/textstream.h @@ -434,7 +434,7 @@ return *this; template void TextStream::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::Convert(wchar_t c, std::wstring & dst) template void TextStream::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::Convert(const char * src, size_t len, std::wstring template void TextStream::Convert(const char * src, std::wstring & dst) { - pt::UTF8ToWide(src, dst, false); + pt::utf8_to_wide(src, dst, false); } template void TextStream::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::Convert(const std::string & src, std::wstring & dst template void TextStream::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 void TextStream::Convert(const wchar_t * src, std::string & dst) { - pt::WideToUTF8(src, dst, false); + pt::wide_to_utf8(src, dst, false); } template void TextStream::Convert(const std::wstring & src, std::string & dst) { - pt::WideToUTF8(src, dst, false); + pt::wide_to_utf8(src, dst, false); } diff --git a/winixd/db/dbbase.cpp b/winixd/db/dbbase.cpp index 9c80419..f8461ac 100644 --- a/winixd/db/dbbase.cpp +++ b/winixd/db/dbbase.cpp @@ -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); } diff --git a/winixd/db/dbtextstream.cpp b/winixd/db/dbtextstream.cpp index 959de1a..db9b184 100644 --- a/winixd/db/dbtextstream.cpp +++ b/winixd/db/dbtextstream.cpp @@ -229,7 +229,7 @@ DbTextStream & DbTextStream::operator<<(RawText 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; } diff --git a/winixd/functions/functionparser.cpp b/winixd/functions/functionparser.cpp index e157961..5bd9751 100644 --- a/winixd/functions/functionparser.cpp +++ b/winixd/functions/functionparser.cpp @@ -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); } diff --git a/winixd/functions/ipban.cpp b/winixd/functions/ipban.cpp index 2395256..42c369b 100644 --- a/winixd/functions/ipban.cpp +++ b/winixd/functions/ipban.cpp @@ -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); diff --git a/winixd/functions/login.cpp b/winixd/functions/login.cpp index acffdcf..4f935fa 100644 --- a/winixd/functions/login.cpp +++ b/winixd/functions/login.cpp @@ -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 { diff --git a/winixd/main/main.cpp b/winixd/main/main.cpp index 825ce29..d63f8b1 100644 --- a/winixd/main/main.cpp +++ b/winixd/main/main.cpp @@ -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; diff --git a/winixd/notify/notifythread.cpp b/winixd/notify/notifythread.cpp index 01e8b04..1ef2c4a 100644 --- a/winixd/notify/notifythread.cpp +++ b/winixd/notify/notifythread.cpp @@ -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 ; acrypt.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 diff --git a/winixd/plugins/export/exportthread.cpp b/winixd/plugins/export/exportthread.cpp index 3cb9b15..d349837 100644 --- a/winixd/plugins/export/exportthread.cpp +++ b/winixd/plugins/export/exportthread.cpp @@ -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(); } diff --git a/winixd/plugins/stats/stats.cpp b/winixd/plugins/stats/stats.cpp index 346fc3e..ab9bf00 100644 --- a/winixd/plugins/stats/stats.cpp +++ b/winixd/plugins/stats/stats.cpp @@ -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 ) diff --git a/winixd/templates/htmltextstream.cpp b/winixd/templates/htmltextstream.cpp index 48f1522..741a9ef 100644 --- a/winixd/templates/htmltextstream.cpp +++ b/winixd/templates/htmltextstream.cpp @@ -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