WIP: remove the old database abstraction layer

remove such classes:
- DbBase
- DbConn
- DbTextStream
- Db

while here:
- remove: TextStream, SLog, TexTextStream
This commit is contained in:
2024-06-22 18:03:54 +02:00
parent 5d457f3d4b
commit 6aa100f12c
138 changed files with 6658 additions and 12402 deletions
+12 -35
View File
@@ -855,7 +855,7 @@ bool IsFile(const wchar_t * file)
struct stat sb;
char file_name[WINIX_OS_PATH_SIZE];
if( !wide_to_utf8(file, file_name, WINIX_OS_PATH_SIZE) )
if( !pt::wide_to_utf8(file, (char*)file_name, WINIX_OS_PATH_SIZE) )
return false;
return (stat(file_name, &sb) == 0);
@@ -877,7 +877,7 @@ char dir_name[WINIX_OS_PATH_SIZE];
if( !IsFile(dir) )
{
if( !wide_to_utf8(dir, dir_name, WINIX_OS_PATH_SIZE) )
if( !pt::wide_to_utf8(dir, (char*)dir_name, WINIX_OS_PATH_SIZE) )
return false;
if( mkdir(dir_name, 0777) < 0 )
@@ -953,7 +953,7 @@ struct group * result;
char group_name[WINIX_OS_USERNAME_SIZE];
char buffer[512];
if( !wide_to_utf8(name, group_name, WINIX_OS_USERNAME_SIZE) )
if( !pt::wide_to_utf8(name, (char*)group_name, WINIX_OS_USERNAME_SIZE) )
return -1;
if( getgrnam_r(group_name, &gr, buffer, sizeof(buffer)/sizeof(char), &result) != 0 )
@@ -989,7 +989,7 @@ bool SetPriv(const wchar_t * name, int priv, int group)
{
char file_name[WINIX_OS_PATH_SIZE];
if( !wide_to_utf8(name, file_name, WINIX_OS_PATH_SIZE) )
if( !pt::wide_to_utf8(name, (char*)file_name, WINIX_OS_PATH_SIZE) )
return false;
if( chmod(file_name, priv) < 0 )
@@ -1047,10 +1047,10 @@ char src_name[WINIX_OS_PATH_SIZE];
char dst_name[WINIX_OS_PATH_SIZE];
FILE * in, * out;
if( !wide_to_utf8(src, src_name, WINIX_OS_PATH_SIZE) )
if( !pt::wide_to_utf8(src, (char*)src_name, WINIX_OS_PATH_SIZE) )
return false;
if( !wide_to_utf8(dst, dst_name, WINIX_OS_PATH_SIZE) )
if( !pt::wide_to_utf8(dst, (char*)dst_name, WINIX_OS_PATH_SIZE) )
return false;
in = fopen(src_name, "rb");
@@ -1092,7 +1092,7 @@ bool RemoveFile(const wchar_t * file)
{
char file_name[WINIX_OS_PATH_SIZE];
if( !wide_to_utf8(file, file_name, WINIX_OS_PATH_SIZE) )
if( !pt::wide_to_utf8(file, (char*)file_name, WINIX_OS_PATH_SIZE) )
return false;
return unlink(file_name) == 0;
@@ -1111,10 +1111,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( !wide_to_utf8(from, from_name, WINIX_OS_PATH_SIZE) )
if( !pt::wide_to_utf8(from, (char*)from_name, WINIX_OS_PATH_SIZE) )
return false;
if( !wide_to_utf8(to, to_name, WINIX_OS_PATH_SIZE) )
if( !pt::wide_to_utf8(to, (char*)to_name, WINIX_OS_PATH_SIZE) )
return false;
return rename(from_name, to_name) == 0;
@@ -1138,7 +1138,7 @@ std::ifstream get_file_content;
if( clear_content )
content.clear();
if( !wide_to_utf8(file_path, file, WINIX_OS_PATH_SIZE) )
if( !pt::wide_to_utf8(file_path, (char*)file, WINIX_OS_PATH_SIZE) )
return false;
get_file_content.open(file, std::ios_base::in | std::ios_base::binary);
@@ -1170,7 +1170,7 @@ std::ifstream get_file_content;
if( clear_content )
content.clear();
if( !wide_to_utf8(file_path, file, WINIX_OS_PATH_SIZE) )
if( !pt::wide_to_utf8(file_path, (char*)file, WINIX_OS_PATH_SIZE) )
return false;
get_file_content.open(file, std::ios_base::in | std::ios_base::binary);
@@ -1205,7 +1205,7 @@ std::ifstream get_file_content;
if( clear_content )
content.clear();
if( !wide_to_utf8(file_path, file, WINIX_OS_PATH_SIZE) )
if( !pt::wide_to_utf8(file_path, (char*)file, WINIX_OS_PATH_SIZE) )
return false;
get_file_content.open(file, std::ios_base::in | std::ios_base::binary);
@@ -1544,29 +1544,6 @@ void JSONescapeStream(const std::wstring & in, pt::WTextStream & out)
bool wide_to_utf8(const wchar_t * wide_string, char * utf8, size_t utf8_size)
{
bool res = pt::wide_to_utf8(wide_string, utf8, utf8_size);
if( !res )
{
/*
* either the 'utf8' buffer is too small or there was an error when converting
*/
//log << log1 << "Misc: I cannot convert from a wide string to an UTF-8 string, original string was: "
// << wide_string << logend;
}
return res;
}
bool wide_to_utf8(const std::wstring & wide_string, char * utf8, size_t utf8_size)
{
return wide_to_utf8(wide_string.c_str(), utf8, utf8_size);
}
void calculate_timespec_diff(timespec & start, timespec & stop, timespec & result)
{
/*