mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-27 02:23:27 +01:00
endian correctness
This commit is contained in:
parent
5da789cc37
commit
af68fa7ee0
@ -24,6 +24,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include <tox/tox.h>
|
#include <tox/tox.h>
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ static int save_blocklist(char *path)
|
|||||||
if (Blocked_Contacts.list[i].active) {
|
if (Blocked_Contacts.list[i].active) {
|
||||||
BlockedFriend tmp;
|
BlockedFriend tmp;
|
||||||
memset(&tmp, 0, sizeof(BlockedFriend));
|
memset(&tmp, 0, sizeof(BlockedFriend));
|
||||||
tmp.namelength = Blocked_Contacts.list[i].namelength;
|
tmp.namelength = htons(Blocked_Contacts.list[i].namelength);
|
||||||
memcpy(tmp.name, Blocked_Contacts.list[i].name, Blocked_Contacts.list[i].namelength + 1);
|
memcpy(tmp.name, Blocked_Contacts.list[i].name, Blocked_Contacts.list[i].namelength + 1);
|
||||||
memcpy(tmp.pub_key, Blocked_Contacts.list[i].pub_key, TOX_CLIENT_ID_SIZE);
|
memcpy(tmp.pub_key, Blocked_Contacts.list[i].pub_key, TOX_CLIENT_ID_SIZE);
|
||||||
|
|
||||||
@ -169,8 +170,8 @@ int load_blocklist(char *path)
|
|||||||
memcpy(&tmp, data + i * sizeof(BlockedFriend), sizeof(BlockedFriend));
|
memcpy(&tmp, data + i * sizeof(BlockedFriend), sizeof(BlockedFriend));
|
||||||
Blocked_Contacts.list[i].active = true;
|
Blocked_Contacts.list[i].active = true;
|
||||||
Blocked_Contacts.list[i].num = i;
|
Blocked_Contacts.list[i].num = i;
|
||||||
Blocked_Contacts.list[i].namelength = tmp.namelength;
|
Blocked_Contacts.list[i].namelength = ntohs(tmp.namelength);
|
||||||
memcpy(Blocked_Contacts.list[i].name, tmp.name, tmp.namelength + 1);
|
memcpy(Blocked_Contacts.list[i].name, tmp.name, Blocked_Contacts.list[i].namelength + 1);
|
||||||
memcpy(Blocked_Contacts.list[i].pub_key, tmp.pub_key, TOX_CLIENT_ID_SIZE);
|
memcpy(Blocked_Contacts.list[i].pub_key, tmp.pub_key, TOX_CLIENT_ID_SIZE);
|
||||||
|
|
||||||
uint8_t lastonline[sizeof(uint64_t)];
|
uint8_t lastonline[sizeof(uint64_t)];
|
||||||
|
Loading…
Reference in New Issue
Block a user