1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix: remove unnecessary variable when checking whether save is a TES

There is a reason why magic length is not exposed via TES header –
knowing it is not needed. Client should check whether file is a TES with
a define that is provided in the public API.
This commit is contained in:
Zetok Zalbavar 2016-12-08 18:00:05 +00:00
parent 3c71e5e2e1
commit 231e1d746a
No known key found for this signature in database
GPG Key ID: C953D3880212068A
2 changed files with 2 additions and 7 deletions

View File

@ -46,10 +46,6 @@
*
* @var bool Profile::isRemoved
* @brief True if the profile has been removed by remove().
*
* @var static constexpr int Profile::encryptHeaderSize = 8
* @brief How much data we need to read to check if the file is encrypted.
* @note Must be >= TOX_ENC_SAVE_MAGIC_LENGTH (8), which isn't publicly defined.
*/
QVector<QString> Profile::profiles;
@ -631,7 +627,7 @@ bool Profile::isEncrypted() const
*/
bool Profile::isEncrypted(QString name)
{
uint8_t data[encryptHeaderSize] = {0};
uint8_t data[TOX_PASS_ENCRYPTION_EXTRA_LENGTH] = {0};
QString path = Settings::getInstance().getSettingsDirPath() + name + ".tox";
QFile saveFile(path);
if (!saveFile.open(QIODevice::ReadOnly))
@ -640,7 +636,7 @@ bool Profile::isEncrypted(QString name)
return false;
}
saveFile.read((char*)data, encryptHeaderSize);
saveFile.read((char*)data, TOX_PASS_ENCRYPTION_EXTRA_LENGTH);
saveFile.close();
return tox_is_data_encrypted(data);

View File

@ -98,7 +98,6 @@ private:
bool newProfile;
bool isRemoved;
static QVector<QString> profiles;
static constexpr int encryptHeaderSize = 8;
};
#endif // PROFILE_H