From 09fa77d73829e76123ac7a9b73bc90def12e9d9c Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 1 Feb 2015 09:23:58 +0000 Subject: Tox: - refactoring - updated tox core git-svn-id: http://svn.miranda-ng.org/main/trunk@11970 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 898899bff1..d169b21f78 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -31,8 +31,8 @@ bool CToxProto::LoadToxProfile() } fseek(profile, 0, SEEK_END); - size_t size = ftell(profile); - fseek(profile, 0, SEEK_SET); + size_t size = _ftelli64(profile); + rewind(profile); if (size == 0) { fclose(profile); @@ -41,8 +41,7 @@ bool CToxProto::LoadToxProfile() } uint8_t *data = (uint8_t*)mir_calloc(size); - size_t read = fread((char*)data, sizeof(char), size, profile); - if (size != read) + if (fread((char*)data, sizeof(char), size, profile) != size) { fclose(profile); debugLogA("CToxProto::LoadToxData: could not read tox profile"); @@ -66,7 +65,7 @@ bool CToxProto::LoadToxProfile() } } - if (tox_encrypted_load(tox, data, size, (uint8_t*)password, strlen(password)) == TOX_ERROR) + if (tox_encrypted_load(tox, data, size, (uint8_t*)password, mir_strlen(password)) == TOX_ERROR) { debugLogA("CToxProto::LoadToxData: could not decrypt tox profile"); mir_free(data); -- cgit v1.2.3