summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.c
diff options
context:
space:
mode:
authorCoren[m] <Break@Ocean>2013-09-17 01:08:57 +0200
committerCoren[m] <Break@Ocean>2013-09-17 01:08:57 +0200
commit1c57a3a3de376c8e9f127c409032fd94298e5e7b (patch)
tree7e4f841b70d15b5ea999100eb1445dd3c47361f9 /toxcore/Messenger.c
parent1d2f4465bf634f45704eb69791c45bd623154909 (diff)
Tests of state loading/saving lead to two fixes for DHT.c and util.c
util.c: - fix in empty section at the end of the state, showed as bug when having an empty name DHT.c: - fix in saving less data than originally announced, showed as bug when not having reached any clients ever (no clients or only with timestamp of zero)
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r--toxcore/Messenger.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index cdc133d0..7ab4a92e 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -1483,7 +1483,7 @@ uint32_t Messenger_size(Messenger *m)
1483{ 1483{
1484 uint32_t size32 = sizeof(uint32_t), sizesubhead = size32 * 2; 1484 uint32_t size32 = sizeof(uint32_t), sizesubhead = size32 * 2;
1485 return size32 * 2 // global cookie 1485 return size32 * 2 // global cookie
1486 + sizesubhead + sizeof(uint32_t) + crypto_box_PUBLICKEYBYTES + crypto_box_SECRETKEYBYTES 1486 + sizesubhead + sizeof(uint32_t) + crypto_box_PUBLICKEYBYTES + crypto_box_SECRETKEYBYTES
1487 + sizesubhead + DHT_size(m->dht) // DHT 1487 + sizesubhead + DHT_size(m->dht) // DHT
1488 + sizesubhead + sizeof(Friend) * m->numfriends // Friendlist itself. 1488 + sizesubhead + sizeof(Friend) * m->numfriends // Friendlist itself.
1489 + sizesubhead + m->name_length // Own nickname. 1489 + sizesubhead + m->name_length // Own nickname.
@@ -1595,6 +1595,7 @@ static int messenger_load_state_callback(void *outer, uint8_t *data, uint32_t le
1595 fprintf(stderr, "Load state: contains unrecognized part (len %u, type %u)\n", 1595 fprintf(stderr, "Load state: contains unrecognized part (len %u, type %u)\n",
1596 length, type); 1596 length, type);
1597#endif 1597#endif
1598 break;
1598 } 1599 }
1599 1600
1600 return 0; 1601 return 0;