[FarGroup/FarManager] master: Refactoring (548f58e06)

0 views
Skip to first unread message

farg...@farmanager.com

unread,
Jun 28, 2026, 2:30:58 PM (9 days ago) Jun 28
to farco...@googlegroups.com
Repository : https://github.com/FarGroup/FarManager
On branch : master
Link : https://github.com/FarGroup/FarManager/commit/548f58e061fb789f0619c7121a96262dce283022

>---------------------------------------------------------------

commit 548f58e061fb789f0619c7121a96262dce283022
Author: Alex Alabuzhev <alab...@gmail.com>
Date: Sun Jun 28 19:17:38 2026 +0100

Refactoring


>---------------------------------------------------------------

548f58e061fb789f0619c7121a96262dce283022
far/changelog | 5 +++++
far/platform.version.cpp | 7 +++++--
far/sqlitedb.cpp | 22 +++++-----------------
far/sqlitedb.hpp | 1 -
far/vbuild.m4 | 2 +-
5 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/far/changelog b/far/changelog
index 6e51363c5..f3cfe8a65 100644
--- a/far/changelog
+++ b/far/changelog
@@ -1,3 +1,8 @@
+--------------------------------------------------------------------------------
+drkns 2026-06-28 19:17:21+01:00 - build 6705
+
+1. Refactoring.
+
--------------------------------------------------------------------------------
yjh 2026-06-28 11:53:25+03:00 - build 6704

diff --git a/far/platform.version.cpp b/far/platform.version.cpp
index b79019b1f..3297b2ee7 100644
--- a/far/platform.version.cpp
+++ b/far/platform.version.cpp
@@ -180,14 +180,17 @@ namespace os::version

const auto InfoPtr = std::bit_cast<OSVERSIONINFO*>(&Info);

+ // Reliable method
if (imports.RtlGetVersion && NT_SUCCESS(imports.RtlGetVersion(InfoPtr)))
return Info;

WARNING_PUSH()
WARNING_DISABLE_MSC(4996) // 'GetVersionExW': was declared deprecated. So helpful. :(
WARNING_DISABLE_CLANG("-Wdeprecated-declarations")
- if (GetVersionEx(InfoPtr))
- return Info;
+ // Unreliable unless the executable is manifested for this or newer OS version.
+ // But at least it fills in the missing wSuiteMask and wProductType fields, not available from the PEB.
+ (void)GetVersionEx(InfoPtr);
+ // Continue to PEB to correctly fill Major, Minor etc.
WARNING_POP()

struct peb_version
diff --git a/far/sqlitedb.cpp b/far/sqlitedb.cpp
index 907503386..6f9f27dce 100644
--- a/far/sqlitedb.cpp
+++ b/far/sqlitedb.cpp
@@ -120,7 +120,7 @@ namespace
{
// These are errors that typically only the user can fix.
// No point in recording dumps, creating bug_report etc., just show them the message.
- switch (ErrorCode)
+ switch (extract_integer<uint8_t, 0>(ErrorCode))
{
case SQLITE_PERM: // Access permission denied
case SQLITE_NOMEM: // A malloc() failed
@@ -279,20 +279,17 @@ void SQLiteDb::library_load()
{
check_version();

- sqlite::sqlite3_config(SQLITE_CONFIG_LOG, sqlite_log, nullptr);
+ if (const auto Result = sqlite::sqlite3_config(SQLITE_CONFIG_LOG, sqlite_log, nullptr); Result != SQLITE_OK)
+ LOGWARNING(L"sqlite3_config(SQLITE_CONFIG_LOG): {}"sv, GetErrorString(Result));

if (const auto Result = sqlite::sqlite3_initialize(); Result != SQLITE_OK)
- {
LOGERROR(L"sqlite3_initialize(): {}"sv, GetErrorString(Result));
- }
}

void SQLiteDb::library_free()
{
if (const auto Result = sqlite::sqlite3_shutdown(); Result != SQLITE_OK)
- {
LOGERROR(L"sqlite3_shutdown(): {}"sv, GetErrorString(Result));
- }
}

void SQLiteDb::SQLiteStmt::stmt_deleter::operator()(sqlite::sqlite3_stmt* Object) const noexcept
@@ -381,7 +378,7 @@ void SQLiteDb::SQLiteStmt::BindImpl(string_view const Value) const
invoke(db(), [&]
{
const auto ValueUtf8 = encoding::utf8::get_bytes(Value);
- return sqlite::sqlite3_bind_text64(m_Stmt.get(), ++m_Param, NullToEmpty(ValueUtf8.data()), static_cast<int>(ValueUtf8.size()), sqlite::transient_destructor, SQLITE_UTF8_ZT) == SQLITE_OK;
+ return sqlite::sqlite3_bind_text64(m_Stmt.get(), ++m_Param, NullToEmpty(ValueUtf8.data()), ValueUtf8.size(), sqlite::transient_destructor, SQLITE_UTF8_ZT) == SQLITE_OK;
},
sql());
}
@@ -390,7 +387,7 @@ void SQLiteDb::SQLiteStmt::BindImpl(bytes_view const Value) const
{
invoke(db(), [&]
{
- return sqlite::sqlite3_bind_blob(m_Stmt.get(), ++m_Param, Value.data(), static_cast<int>(Value.size()), sqlite::transient_destructor) == SQLITE_OK;
+ return sqlite::sqlite3_bind_blob64(m_Stmt.get(), ++m_Param, Value.data(), Value.size(), sqlite::transient_destructor) == SQLITE_OK;
},
sql());
}
@@ -664,15 +661,6 @@ unsigned long long SQLiteDb::LastInsertRowID() const
return sqlite::sqlite3_last_insert_rowid(m_Db.get());
}

-void SQLiteDb::Close()
-{
- // https://www.sqlite.org/c3ref/close.html
- // If the database connection is associated with unfinalized prepared statements or unfinished sqlite3_backup objects
- // then sqlite3_close() will leave the database connection open and return SQLITE_BUSY.
- m_Statements.clear();
- m_Db.reset();
-}
-
void SQLiteDb::SetWALJournalingMode() const
{
Exec("PRAGMA journal_mode = WAL;"sv);
diff --git a/far/sqlitedb.hpp b/far/sqlitedb.hpp
index 4808839f5..184aba6bd 100644
--- a/far/sqlitedb.hpp
+++ b/far/sqlitedb.hpp
@@ -235,7 +235,6 @@ private:
using database_ptr = std::unique_ptr<sqlite::sqlite3, db_closer>;

database_ptr Open(string_view Path, busy_handler BusyHandler, bool WAL);
- void Close();

void add_nocase_collation() const;
void add_numeric_collation() const;
diff --git a/far/vbuild.m4 b/far/vbuild.m4
index bc9e1b1b0..4374e227c 100644
--- a/far/vbuild.m4
+++ b/far/vbuild.m4
@@ -1 +1 @@
-6704
+6705


Reply all
Reply to author
Forward
0 new messages