diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-10-04 02:12:42 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-10-04 02:12:42 +0000 |
commit | 6a3c12bfd2a1829ac537a3b615d42c1e956a0586 (patch) | |
tree | 79d2fa3338a7a8e2040481c0e11b82905efca2b5 /protocols/Tox/src/tox_profile.cpp | |
parent | 928158d25b533037df6ba4a1b1daedeefb05bbbb (diff) |
Tox:
- fixed network setting loading
- code reordering
git-svn-id: http://svn.miranda-ng.org/main/trunk@10680 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_profile.cpp')
-rw-r--r-- | protocols/Tox/src/tox_profile.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 8131164053..de1a844234 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -17,12 +17,6 @@ std::tstring CToxProto::GetToxProfilePath(const TCHAR *accountName) void CToxProto::LoadToxProfile()
{
- if (tox == NULL)
- {
- debugLogA("CToxProto::SaveToxProfile: tox core was not initialized");
- return;
- }
-
DWORD size = GetFileSize(hProfile, NULL);
if (size == 0)
{
@@ -31,7 +25,7 @@ void CToxProto::LoadToxProfile() }
DWORD read = 0;
- uint8_t *data = (uint8_t*)mir_alloc(size);
+ uint8_t *data = (uint8_t*)mir_calloc(size);
if (!ReadFile(hProfile, data, size, &read, NULL) || size != read)
{
debugLogA("CToxProto::LoadToxData: could not read tox profile");
@@ -62,20 +56,13 @@ void CToxProto::LoadToxProfile() void CToxProto::SaveToxProfile()
{
- if (tox == NULL)
- {
- debugLogA("CToxProto::SaveToxProfile: tox core was not initialized");
- return;
- }
-
ptrT password(getTStringA("Password"));
bool needToEncrypt = password && _tcslen(password);
-
DWORD size = needToEncrypt
- ? size = tox_encrypted_size(tox)
- : size = tox_size(tox);
+ ? tox_encrypted_size(tox)
+ : tox_size(tox);
- uint8_t *data = (uint8_t*)mir_alloc(size);
+ uint8_t *data = (uint8_t*)mir_calloc(size);
if (needToEncrypt)
{
char *passwordInUtf8 = mir_utf8encodeW(password);
|