diff --git a/td/telegram/files/FileEncryptionKey.h b/td/telegram/files/FileEncryptionKey.h index 039db2220..56433fd87 100644 --- a/td/telegram/files/FileEncryptionKey.h +++ b/td/telegram/files/FileEncryptionKey.h @@ -86,14 +86,15 @@ struct FileEncryptionKey { } } + friend bool operator==(const FileEncryptionKey &lhs, const FileEncryptionKey &rhs) { + return lhs.key_iv_ == rhs.key_iv_; + } + + private: string key_iv_; // TODO wrong alignment is possible Type type_ = Type::None; }; -inline bool operator==(const FileEncryptionKey &lhs, const FileEncryptionKey &rhs) { - return lhs.key_iv_ == rhs.key_iv_; -} - inline bool operator!=(const FileEncryptionKey &lhs, const FileEncryptionKey &rhs) { return !(lhs == rhs); } diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index 1859a2b48..469180a48 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -1278,7 +1278,7 @@ static int merge_choose_encryption_key(const FileEncryptionKey &a, const FileEnc if (a.empty() != b.empty()) { return a.empty() > b.empty(); } - if (a.key_iv_ != b.key_iv_) { + if (a != b) { return -1; } return 2;