From f3ec06759c21604436567693984ea31c5b1d5e3f Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Mon, 18 May 2015 20:30:21 +0000 Subject: 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 --- protocols/Tox/src/tox_profile.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'protocols/Tox/src/tox_profile.cpp') 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) -- cgit v1.2.3