summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-07-19 10:02:52 -0700
committerirungentoo <irungentoo@gmail.com>2013-07-19 10:02:52 -0700
commit00320267ae5e3e4c13867396f37164473f12f6e0 (patch)
tree6fc4c362e381949595ad8f261a867be152c4f6f0
parentc657778f0ce7c14d37717547037b6b1f46cd9fe6 (diff)
parent2b4712122c0349626f67a54ef10cb0da7fea3896 (diff)
Merge pull request #56 from Martijnvdc/patch-1
Patch 1
-rw-r--r--core/DHT.c74
-rw-r--r--core/Messenger.c18
2 files changed, 46 insertions, 46 deletions
diff --git a/core/DHT.c b/core/DHT.c
index 0d8145d1..d4a3e806 100644
--- a/core/DHT.c
+++ b/core/DHT.c
@@ -91,7 +91,7 @@ static Pinged send_nodes[LSEND_NODES_ARRAY];
91int id_closest(uint8_t * client_id, uint8_t * client_id1, uint8_t * client_id2)//tested 91int id_closest(uint8_t * client_id, uint8_t * client_id1, uint8_t * client_id2)//tested
92{ 92{
93 uint32_t i; 93 uint32_t i;
94 for(i = 0; i < CLIENT_ID_SIZE; i++) 94 for(i = 0; i < CLIENT_ID_SIZE; ++i)
95 { 95 {
96 if(abs(client_id[i] ^ client_id1[i]) < abs(client_id[i] ^ client_id2[i])) 96 if(abs(client_id[i] ^ client_id1[i]) < abs(client_id[i] ^ client_id2[i]))
97 { 97 {
@@ -118,7 +118,7 @@ int client_in_list(Client_data * list, uint32_t length, uint8_t * client_id, IP_
118 uint32_t i; 118 uint32_t i;
119 uint32_t temp_time = unix_time(); 119 uint32_t temp_time = unix_time();
120 120
121 for(i = 0; i < length; i++) 121 for(i = 0; i < length; ++i)
122 { 122 {
123 if(memcmp(list[i].client_id, client_id, CLIENT_ID_SIZE) == 0) 123 if(memcmp(list[i].client_id, client_id, CLIENT_ID_SIZE) == 0)
124 { 124 {
@@ -138,7 +138,7 @@ int client_in_list(Client_data * list, uint32_t length, uint8_t * client_id, IP_
138int client_in_nodelist(Node_format * list, uint32_t length, uint8_t * client_id) 138int client_in_nodelist(Node_format * list, uint32_t length, uint8_t * client_id)
139{ 139{
140 uint32_t i; 140 uint32_t i;
141 for(i = 0; i < length; i++) 141 for(i = 0; i < length; ++i)
142 { 142 {
143 if(memcmp(list[i].client_id, client_id, CLIENT_ID_SIZE) == 0) 143 if(memcmp(list[i].client_id, client_id, CLIENT_ID_SIZE) == 0)
144 { 144 {
@@ -166,7 +166,7 @@ int get_close_nodes(uint8_t * client_id, Node_format * nodes_list)
166 uint32_t i, j, k; 166 uint32_t i, j, k;
167 int num_nodes=0; 167 int num_nodes=0;
168 uint32_t temp_time = unix_time(); 168 uint32_t temp_time = unix_time();
169 for(i = 0; i < LCLIENT_LIST; i++) 169 for(i = 0; i < LCLIENT_LIST; ++i)
170 { 170 {
171 if(close_clientlist[i].timestamp + BAD_NODE_TIMEOUT > temp_time && 171 if(close_clientlist[i].timestamp + BAD_NODE_TIMEOUT > temp_time &&
172 !client_in_nodelist(nodes_list, MAX_SENT_NODES,close_clientlist[i].client_id)) 172 !client_in_nodelist(nodes_list, MAX_SENT_NODES,close_clientlist[i].client_id))
@@ -178,7 +178,7 @@ int get_close_nodes(uint8_t * client_id, Node_format * nodes_list)
178 nodes_list[num_nodes].ip_port = close_clientlist[i].ip_port; 178 nodes_list[num_nodes].ip_port = close_clientlist[i].ip_port;
179 num_nodes++; 179 num_nodes++;
180 } 180 }
181 else for(j = 0; j < MAX_SENT_NODES; j++) 181 else for(j = 0; j < MAX_SENT_NODES; ++j)
182 { 182 {
183 if(id_closest(client_id, nodes_list[j].client_id, close_clientlist[i].client_id) == 2) 183 if(id_closest(client_id, nodes_list[j].client_id, close_clientlist[i].client_id) == 2)
184 { 184 {
@@ -190,9 +190,9 @@ int get_close_nodes(uint8_t * client_id, Node_format * nodes_list)
190 } 190 }
191 191
192 } 192 }
193 for(i = 0; i < num_friends; i++) 193 for(i = 0; i < num_friends; ++i)
194 { 194 {
195 for(j = 0; j < MAX_FRIEND_CLIENTS; j++) 195 for(j = 0; j < MAX_FRIEND_CLIENTS; ++j)
196 { 196 {
197 if(friends_list[i].client_list[j].timestamp + BAD_NODE_TIMEOUT > temp_time && 197 if(friends_list[i].client_list[j].timestamp + BAD_NODE_TIMEOUT > temp_time &&
198 !client_in_nodelist(nodes_list, MAX_SENT_NODES,friends_list[i].client_list[j].client_id)) 198 !client_in_nodelist(nodes_list, MAX_SENT_NODES,friends_list[i].client_list[j].client_id))
@@ -204,7 +204,7 @@ int get_close_nodes(uint8_t * client_id, Node_format * nodes_list)
204 nodes_list[num_nodes].ip_port = friends_list[i].client_list[j].ip_port; 204 nodes_list[num_nodes].ip_port = friends_list[i].client_list[j].ip_port;
205 num_nodes++; 205 num_nodes++;
206 } 206 }
207 else for(k = 0; k < MAX_SENT_NODES; k++) 207 else for(k = 0; k < MAX_SENT_NODES; ++k)
208 { 208 {
209 if(id_closest(client_id, nodes_list[k].client_id, friends_list[i].client_list[j].client_id) == 2) 209 if(id_closest(client_id, nodes_list[k].client_id, friends_list[i].client_list[j].client_id) == 2)
210 { 210 {
@@ -230,7 +230,7 @@ int replace_bad(Client_data * list, uint32_t length, uint8_t * client_id, IP_Por
230{ 230{
231 uint32_t i; 231 uint32_t i;
232 uint32_t temp_time = unix_time(); 232 uint32_t temp_time = unix_time();
233 for(i = 0; i < length; i++) 233 for(i = 0; i < length; ++i)
234 { 234 {
235 if(list[i].timestamp + BAD_NODE_TIMEOUT < temp_time)//if node is bad. 235 if(list[i].timestamp + BAD_NODE_TIMEOUT < temp_time)//if node is bad.
236 { 236 {
@@ -250,7 +250,7 @@ int replace_good(Client_data * list, uint32_t length, uint8_t * client_id, IP_Po
250 uint32_t i; 250 uint32_t i;
251 uint32_t temp_time = unix_time(); 251 uint32_t temp_time = unix_time();
252 252
253 for(i = 0; i < length; i++) 253 for(i = 0; i < length; ++i)
254 { 254 {
255 if(id_closest(comp_client_id, list[i].client_id, client_id) == 2) 255 if(id_closest(comp_client_id, list[i].client_id, client_id) == 2)
256 { 256 {
@@ -280,7 +280,7 @@ void addto_lists(IP_Port ip_port, uint8_t * client_id)
280 } 280 }
281 281
282 } 282 }
283 for(i = 0; i < num_friends; i++) 283 for(i = 0; i < num_friends; ++i)
284 { 284 {
285 if(!client_in_list(friends_list[i].client_list, MAX_FRIEND_CLIENTS, client_id, ip_port)) 285 if(!client_in_list(friends_list[i].client_list, MAX_FRIEND_CLIENTS, client_id, ip_port))
286 { 286 {
@@ -308,7 +308,7 @@ int is_pinging(IP_Port ip_port, uint64_t ping_id)
308 uint8_t pinging; 308 uint8_t pinging;
309 uint32_t temp_time = unix_time(); 309 uint32_t temp_time = unix_time();
310 310
311 for(i = 0; i < LPING_ARRAY; i++ ) 311 for(i = 0; i < LPING_ARRAY; ++i )
312 { 312 {
313 if((pings[i].timestamp + PING_TIMEOUT) > temp_time) 313 if((pings[i].timestamp + PING_TIMEOUT) > temp_time)
314 { 314 {
@@ -318,14 +318,14 @@ int is_pinging(IP_Port ip_port, uint64_t ping_id)
318 if(pings[i].ip_port.ip.i == ip_port.ip.i && 318 if(pings[i].ip_port.ip.i == ip_port.ip.i &&
319 pings[i].ip_port.port == ip_port.port) 319 pings[i].ip_port.port == ip_port.port)
320 { 320 {
321 pinging++; 321 ++pinging;
322 } 322 }
323 } 323 }
324 if(ping_id != 0) 324 if(ping_id != 0)
325 { 325 {
326 if(pings[i].ping_id == ping_id) 326 if(pings[i].ping_id == ping_id)
327 { 327 {
328 pinging++; 328 ++pinging;
329 } 329 }
330 } 330 }
331 if(pinging == (ping_id != 0) + (ip_port.ip.i != 0)) 331 if(pinging == (ping_id != 0) + (ip_port.ip.i != 0))
@@ -348,7 +348,7 @@ int is_gettingnodes(IP_Port ip_port, uint64_t ping_id)
348 uint8_t pinging; 348 uint8_t pinging;
349 uint32_t temp_time = unix_time(); 349 uint32_t temp_time = unix_time();
350 350
351 for(i = 0; i < LSEND_NODES_ARRAY; i++ ) 351 for(i = 0; i < LSEND_NODES_ARRAY; ++i )
352 { 352 {
353 if((send_nodes[i].timestamp + PING_TIMEOUT) > temp_time) 353 if((send_nodes[i].timestamp + PING_TIMEOUT) > temp_time)
354 { 354 {
@@ -358,14 +358,14 @@ int is_gettingnodes(IP_Port ip_port, uint64_t ping_id)
358 if(send_nodes[i].ip_port.ip.i == ip_port.ip.i && 358 if(send_nodes[i].ip_port.ip.i == ip_port.ip.i &&
359 send_nodes[i].ip_port.port == ip_port.port) 359 send_nodes[i].ip_port.port == ip_port.port)
360 { 360 {
361 pinging++; 361 ++pinging;
362 } 362 }
363 } 363 }
364 if(ping_id != 0) 364 if(ping_id != 0)
365 { 365 {
366 if(send_nodes[i].ping_id == ping_id) 366 if(send_nodes[i].ping_id == ping_id)
367 { 367 {
368 pinging++; 368 ++pinging;
369 } 369 }
370 } 370 }
371 if(pinging == (ping_id != 0) + (ip_port.ip.i != 0)) 371 if(pinging == (ping_id != 0) + (ip_port.ip.i != 0))
@@ -391,9 +391,9 @@ uint64_t add_pinging(IP_Port ip_port)
391 uint64_t ping_id = ((uint64_t)random_int() << 32) + random_int(); 391 uint64_t ping_id = ((uint64_t)random_int() << 32) + random_int();
392 uint32_t temp_time = unix_time(); 392 uint32_t temp_time = unix_time();
393 393
394 for(i = 0; i < PING_TIMEOUT; i++ ) 394 for(i = 0; i < PING_TIMEOUT; ++i )
395 { 395 {
396 for(j = 0; j < LPING_ARRAY; j++ ) 396 for(j = 0; j < LPING_ARRAY; ++j )
397 { 397 {
398 if((pings[j].timestamp + PING_TIMEOUT - i) < temp_time) 398 if((pings[j].timestamp + PING_TIMEOUT - i) < temp_time)
399 { 399 {
@@ -415,9 +415,9 @@ uint64_t add_gettingnodes(IP_Port ip_port)
415 uint64_t ping_id = ((uint64_t)random_int() << 32) + random_int(); 415 uint64_t ping_id = ((uint64_t)random_int() << 32) + random_int();
416 uint32_t temp_time = unix_time(); 416 uint32_t temp_time = unix_time();
417 417
418 for(i = 0; i < PING_TIMEOUT; i++ ) 418 for(i = 0; i < PING_TIMEOUT; ++i )
419 { 419 {
420 for(j = 0; j < LSEND_NODES_ARRAY; j++ ) 420 for(j = 0; j < LSEND_NODES_ARRAY; ++j )
421 { 421 {
422 if((send_nodes[j].timestamp + PING_TIMEOUT - i) < temp_time) 422 if((send_nodes[j].timestamp + PING_TIMEOUT - i) < temp_time)
423 { 423 {
@@ -727,7 +727,7 @@ int handle_sendnodes(uint8_t * packet, uint32_t length, IP_Port source)
727 memcpy(nodes_list, plain + sizeof(ping_id), num_nodes * sizeof(Node_format)); 727 memcpy(nodes_list, plain + sizeof(ping_id), num_nodes * sizeof(Node_format));
728 728
729 uint32_t i; 729 uint32_t i;
730 for(i = 0; i < num_nodes; i++) 730 for(i = 0; i < num_nodes; ++i)
731 { 731 {
732 pingreq(nodes_list[i].ip_port, nodes_list[i].client_id); 732 pingreq(nodes_list[i].ip_port, nodes_list[i].client_id);
733 } 733 }
@@ -760,7 +760,7 @@ int DHT_addfriend(uint8_t * client_id)
760 friends_list = temp; 760 friends_list = temp;
761 memset(&friends_list[num_friends], 0, sizeof(Friend)); 761 memset(&friends_list[num_friends], 0, sizeof(Friend));
762 memcpy(friends_list[num_friends].client_id, client_id, CLIENT_ID_SIZE); 762 memcpy(friends_list[num_friends].client_id, client_id, CLIENT_ID_SIZE);
763 num_friends++; 763 ++num_friends;
764 return 0; 764 return 0;
765} 765}
766 766
@@ -772,11 +772,11 @@ int DHT_delfriend(uint8_t * client_id)
772{ 772{
773 uint32_t i; 773 uint32_t i;
774 Friend * temp; 774 Friend * temp;
775 for(i = 0; i < num_friends; i++) 775 for(i = 0; i < num_friends; ++i)
776 { 776 {
777 if(memcmp(friends_list[i].client_id, client_id, CLIENT_ID_SIZE) == 0)//Equal 777 if(memcmp(friends_list[i].client_id, client_id, CLIENT_ID_SIZE) == 0)//Equal
778 { 778 {
779 num_friends--; 779 --num_friends;
780 if(num_friends != i) 780 if(num_friends != i)
781 { 781 {
782 memcpy(friends_list[i].client_id, friends_list[num_friends].client_id, CLIENT_ID_SIZE); 782 memcpy(friends_list[i].client_id, friends_list[num_friends].client_id, CLIENT_ID_SIZE);
@@ -801,11 +801,11 @@ IP_Port DHT_getfriendip(uint8_t * client_id)
801 uint32_t i, j; 801 uint32_t i, j;
802 IP_Port empty = {{{0}}, 0}; 802 IP_Port empty = {{{0}}, 0};
803 uint32_t temp_time = unix_time(); 803 uint32_t temp_time = unix_time();
804 for(i = 0; i < num_friends; i++) 804 for(i = 0; i < num_friends; ++i)
805 { 805 {
806 if(memcmp(friends_list[i].client_id, client_id, CLIENT_ID_SIZE) == 0)//Equal 806 if(memcmp(friends_list[i].client_id, client_id, CLIENT_ID_SIZE) == 0)//Equal
807 { 807 {
808 for(j = 0; j < MAX_FRIEND_CLIENTS; j++) 808 for(j = 0; j < MAX_FRIEND_CLIENTS; ++j)
809 { 809 {
810 if(memcmp(friends_list[i].client_list[j].client_id, client_id, CLIENT_ID_SIZE) == 0 && 810 if(memcmp(friends_list[i].client_list[j].client_id, client_id, CLIENT_ID_SIZE) == 0 &&
811 friends_list[i].client_list[j].timestamp + BAD_NODE_TIMEOUT > temp_time) 811 friends_list[i].client_list[j].timestamp + BAD_NODE_TIMEOUT > temp_time)
@@ -872,9 +872,9 @@ void doDHTFriends()
872 uint32_t rand_node; 872 uint32_t rand_node;
873 uint32_t index[MAX_FRIEND_CLIENTS]; 873 uint32_t index[MAX_FRIEND_CLIENTS];
874 874
875 for(i = 0; i < num_friends; i++) 875 for(i = 0; i < num_friends; ++i)
876 { 876 {
877 for(j = 0; j < MAX_FRIEND_CLIENTS; j++) 877 for(j = 0; j < MAX_FRIEND_CLIENTS; ++j)
878 { 878 {
879 if(friends_list[i].client_list[j].timestamp + Kill_NODE_TIMEOUT > temp_time)//if node is not dead. 879 if(friends_list[i].client_list[j].timestamp + Kill_NODE_TIMEOUT > temp_time)//if node is not dead.
880 { 880 {
@@ -886,7 +886,7 @@ void doDHTFriends()
886 if(friends_list[i].client_list[j].timestamp + BAD_NODE_TIMEOUT > temp_time)//if node is good. 886 if(friends_list[i].client_list[j].timestamp + BAD_NODE_TIMEOUT > temp_time)//if node is good.
887 { 887 {
888 index[num_nodes] = j; 888 index[num_nodes] = j;
889 num_nodes++; 889 ++num_nodes;
890 } 890 }
891 } 891 }
892 } 892 }
@@ -913,7 +913,7 @@ void doClose()//tested
913 uint32_t rand_node; 913 uint32_t rand_node;
914 uint32_t index[LCLIENT_LIST]; 914 uint32_t index[LCLIENT_LIST];
915 915
916 for(i = 0; i < LCLIENT_LIST; i++) 916 for(i = 0; i < LCLIENT_LIST; ++i)
917 { 917 {
918 if(close_clientlist[i].timestamp + Kill_NODE_TIMEOUT > temp_time)//if node is not dead. 918 if(close_clientlist[i].timestamp + Kill_NODE_TIMEOUT > temp_time)//if node is not dead.
919 { 919 {
@@ -925,7 +925,7 @@ void doClose()//tested
925 if(close_clientlist[i].timestamp + BAD_NODE_TIMEOUT > temp_time)//if node is good. 925 if(close_clientlist[i].timestamp + BAD_NODE_TIMEOUT > temp_time)//if node is good.
926 { 926 {
927 index[num_nodes] = i; 927 index[num_nodes] = i;
928 num_nodes++; 928 ++num_nodes;
929 } 929 }
930 } 930 }
931 } 931 }
@@ -996,10 +996,10 @@ int DHT_load(uint8_t * data, uint32_t size)
996 { 996 {
997 Friend * tempfriends_list = (Friend *)(data + sizeof(close_clientlist)); 997 Friend * tempfriends_list = (Friend *)(data + sizeof(close_clientlist));
998 998
999 for(i = 0; i < temp; i++) 999 for(i = 0; i < temp; ++i)
1000 { 1000 {
1001 DHT_addfriend(tempfriends_list[i].client_id); 1001 DHT_addfriend(tempfriends_list[i].client_id);
1002 for(j = 0; j < MAX_FRIEND_CLIENTS; j++) 1002 for(j = 0; j < MAX_FRIEND_CLIENTS; ++j)
1003 { 1003 {
1004 if(tempfriends_list[i].client_list[j].timestamp != 0) 1004 if(tempfriends_list[i].client_list[j].timestamp != 0)
1005 { 1005 {
@@ -1011,7 +1011,7 @@ int DHT_load(uint8_t * data, uint32_t size)
1011 } 1011 }
1012 Client_data * tempclose_clientlist = (Client_data *)data; 1012 Client_data * tempclose_clientlist = (Client_data *)data;
1013 1013
1014 for(i = 0; i < LCLIENT_LIST; i++) 1014 for(i = 0; i < LCLIENT_LIST; ++i)
1015 { 1015 {
1016 if(tempclose_clientlist[i].timestamp != 0) 1016 if(tempclose_clientlist[i].timestamp != 0)
1017 { 1017 {
@@ -1027,7 +1027,7 @@ int DHT_isconnected()
1027{ 1027{
1028 uint32_t i; 1028 uint32_t i;
1029 uint32_t temp_time = unix_time(); 1029 uint32_t temp_time = unix_time();
1030 for(i = 0; i < LCLIENT_LIST; i++) 1030 for(i = 0; i < LCLIENT_LIST; ++i)
1031 { 1031 {
1032 if(close_clientlist[i].timestamp + BAD_NODE_TIMEOUT > temp_time) 1032 if(close_clientlist[i].timestamp + BAD_NODE_TIMEOUT > temp_time)
1033 { 1033 {
@@ -1035,4 +1035,4 @@ int DHT_isconnected()
1035 } 1035 }
1036 } 1036 }
1037 return 0; 1037 return 0;
1038} \ No newline at end of file 1038}
diff --git a/core/Messenger.c b/core/Messenger.c
index 4780f3c1..5a10c1da 100644
--- a/core/Messenger.c
+++ b/core/Messenger.c
@@ -64,7 +64,7 @@ static uint32_t numfriends;
64int getfriend_id(uint8_t * client_id) 64int getfriend_id(uint8_t * client_id)
65{ 65{
66 uint32_t i; 66 uint32_t i;
67 for(i = 0; i < numfriends; i++) 67 for(i = 0; i < numfriends; ++i)
68 { 68 {
69 if(friendlist[i].status > 0) 69 if(friendlist[i].status > 0)
70 { 70 {
@@ -120,7 +120,7 @@ int m_addfriend(uint8_t * client_id, uint8_t * data, uint16_t length)
120 return -1; 120 return -1;
121 } 121 }
122 uint32_t i; 122 uint32_t i;
123 for(i = 0; i <= numfriends; i++) 123 for(i = 0; i <= numfriends; ++i)
124 { 124 {
125 if(friendlist[i].status == 0) 125 if(friendlist[i].status == 0)
126 { 126 {
@@ -134,7 +134,7 @@ int m_addfriend(uint8_t * client_id, uint8_t * data, uint16_t length)
134 memcpy(friendlist[i].info, data, length); 134 memcpy(friendlist[i].info, data, length);
135 friendlist[i].info_size = length; 135 friendlist[i].info_size = length;
136 136
137 numfriends++; 137 ++numfriends;
138 return i; 138 return i;
139 } 139 }
140 } 140 }
@@ -148,7 +148,7 @@ int m_addfriend_norequest(uint8_t * client_id)
148 return -1; 148 return -1;
149 } 149 }
150 uint32_t i; 150 uint32_t i;
151 for(i = 0; i <= numfriends; i++) 151 for(i = 0; i <= numfriends; ++i)
152 { 152 {
153 if(friendlist[i].status == 0) 153 if(friendlist[i].status == 0)
154 { 154 {
@@ -181,7 +181,7 @@ int m_delfriend(int friendnumber)
181 free(friendlist[friendnumber].userstatus); 181 free(friendlist[friendnumber].userstatus);
182 memset(&friendlist[friendnumber], 0, sizeof(Friend)); 182 memset(&friendlist[friendnumber], 0, sizeof(Friend));
183 uint32_t i; 183 uint32_t i;
184 for(i = numfriends; i != 0; i--) 184 for(i = numfriends; i != 0; --i)
185 { 185 {
186 if(friendlist[i].status != 0) 186 if(friendlist[i].status != 0)
187 { 187 {
@@ -264,7 +264,7 @@ int setname(uint8_t * name, uint16_t length)
264 } 264 }
265 memcpy(self_name, name, length); 265 memcpy(self_name, name, length);
266 uint32_t i; 266 uint32_t i;
267 for(i = 0; i < numfriends; i++) 267 for(i = 0; i < numfriends; ++i)
268 { 268 {
269 friendlist[i].name_sent = 0; 269 friendlist[i].name_sent = 0;
270 } 270 }
@@ -299,7 +299,7 @@ int m_set_userstatus(uint8_t *status, uint16_t length)
299 self_userstatus_len = length; 299 self_userstatus_len = length;
300 300
301 uint32_t i; 301 uint32_t i;
302 for(i = 0; i < numfriends; i++) 302 for(i = 0; i < numfriends; ++i)
303 { 303 {
304 friendlist[i].userstatus_sent = 0; 304 friendlist[i].userstatus_sent = 0;
305 } 305 }
@@ -401,7 +401,7 @@ static void doFriends()
401 uint32_t i; 401 uint32_t i;
402 int len; 402 int len;
403 uint8_t temp[MAX_DATA_SIZE]; 403 uint8_t temp[MAX_DATA_SIZE];
404 for(i = 0; i < numfriends; i++) 404 for(i = 0; i < numfriends; ++i)
405 { 405 {
406 if(friendlist[i].status == 1) 406 if(friendlist[i].status == 1)
407 { 407 {
@@ -625,7 +625,7 @@ int Messenger_load(uint8_t * data, uint32_t length)
625 uint16_t num = size / sizeof(Friend); 625 uint16_t num = size / sizeof(Friend);
626 626
627 uint32_t i; 627 uint32_t i;
628 for(i = 0; i < num; i++) 628 for(i = 0; i < num; ++i)
629 { 629 {
630 if(temp[i].status != 0) 630 if(temp[i].status != 0)
631 { 631 {