diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-05-18 20:30:21 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-05-18 20:30:21 +0000 |
commit | f3ec06759c21604436567693984ea31c5b1d5e3f (patch) | |
tree | 78d2b0bbaa105cb1faf96e49e0a3e94fa0df4444 /protocols/Tox/src/tox_profile.cpp | |
parent | 83341d2f5f8b20549d1be6da322cb0cc2f72b5a1 (diff) |
Tox:
- fixed bugs from coverity
- fixed empty profile loading
- version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@13687 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_profile.cpp')
-rw-r--r-- | protocols/Tox/src/tox_profile.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 1b31e1f9ab..c422dcc947 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -16,7 +16,7 @@ std::tstring CToxProto::GetToxProfilePath(const TCHAR *accountName) return profilePath;
}
-bool CToxProto::LoadToxProfile(Tox_Options *options)
+bool CToxProto::LoadToxProfile(const Tox_Options *options)
{
debugLogA(__FUNCTION__": loading tox profile");
@@ -37,11 +37,10 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) fseek(profile, 0, SEEK_END);
size = ftell(profile);
rewind(profile);
- if (size == 0)
+ if (size < 0)
{
fclose(profile);
- debugLogA(__FUNCTION__": tox profile is empty");
- return true;
+ size = 0;
}
data = (uint8_t*)mir_calloc(size);
@@ -54,7 +53,7 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) }
fclose(profile);
- if (data != NULL && tox_is_data_encrypted(data))
+ if (data && tox_is_data_encrypted(data))
{
password = mir_utf8encodeW(ptrT(getTStringA("Password")));
if (password == NULL || mir_strlen(password) == 0)
|