diff options
author | George Hazan <ghazan@miranda.im> | 2023-04-13 15:00:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-04-13 15:00:06 +0300 |
commit | 3e4d98219d4e71ff2bf1ab093e31ffe355204b4e (patch) | |
tree | 878dd28ca855f5917900b21abb33b64be621f83b | |
parent | 338b214ae6675a565abc546f3f31c253d78b1dd2 (diff) |
minor compatibility fix
-rw-r--r-- | include/m_database.h | 4 | ||||
-rw-r--r-- | src/mir_app/src/db_events.cpp | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/include/m_database.h b/include/m_database.h index 3fa9e4e570..a3e7a09af9 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -698,7 +698,7 @@ namespace DB {
ptrW m_wszFileName, m_wszDescription;
ptrA m_szProtoString;
- uint32_t m_iFileSize = 0, m_iTransferred = 0;
+ int64_t m_iFileSize = -1, m_iTransferred = -1;
public:
explicit FILE_BLOB(const wchar_t *pwszName, const wchar_t *pwszDescr = nullptr);
@@ -714,7 +714,7 @@ namespace DB __forceinline uint32_t getSize() const { return m_iFileSize; }
__forceinline uint32_t getTransferred() const { return m_iTransferred; }
- __forceinline bool isCompleted() const { return m_iFileSize == 0 || m_iFileSize == m_iTransferred; }
+ bool isCompleted() const;
__forceinline bool isOffline() const { return m_szProtoString != nullptr; }
};
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index fefc83ba02..c3135bfa76 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -308,6 +308,14 @@ DB::FILE_BLOB::FILE_BLOB(const DB::EventInfo &dbei) DB::FILE_BLOB::~FILE_BLOB()
{}
+bool DB::FILE_BLOB::isCompleted() const
+{
+ if (m_iFileSize == -1)
+ return true;
+
+ return m_iFileSize != 0 && m_iFileSize == m_iTransferred;
+}
+
void DB::FILE_BLOB::write(DB::EventInfo &dbei)
{
JSONNode root;
|