diff options
author | Martijnvdc <martijnvdc@gmail.com> | 2013-07-19 19:28:58 +0200 |
---|---|---|
committer | Martijnvdc <martijnvdc@gmail.com> | 2013-07-19 19:28:58 +0200 |
commit | 727ab4adeefb01e5741cf38709feeaa285d1d4bb (patch) | |
tree | 8bcdba4a4519a86265e6cc1a3dd63d07637c71b7 | |
parent | 00320267ae5e3e4c13867396f37164473f12f6e0 (diff) |
Update Lossless_UDP.c
changed all "i++" into "++i", as proposed by nfkd
-rw-r--r-- | core/Lossless_UDP.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/core/Lossless_UDP.c b/core/Lossless_UDP.c index 55bc1cfb..427d764f 100644 --- a/core/Lossless_UDP.c +++ b/core/Lossless_UDP.c | |||
@@ -103,7 +103,7 @@ static Connection connections[MAX_CONNECTIONS]; | |||
103 | int getconnection_id(IP_Port ip_port) | 103 | int getconnection_id(IP_Port ip_port) |
104 | { | 104 | { |
105 | uint32_t i; | 105 | uint32_t i; |
106 | for(i = 0; i < MAX_CONNECTIONS; i++ ) | 106 | for(i = 0; i < MAX_CONNECTIONS; ++i) |
107 | { | 107 | { |
108 | if(connections[i].ip_port.ip.i == ip_port.ip.i && | 108 | if(connections[i].ip_port.ip.i == ip_port.ip.i && |
109 | connections[i].ip_port.port == ip_port.port && connections[i].status > 0) | 109 | connections[i].ip_port.port == ip_port.port && connections[i].status > 0) |
@@ -124,7 +124,7 @@ static uint32_t randtable[6][256]; | |||
124 | uint32_t handshake_id(IP_Port source) | 124 | uint32_t handshake_id(IP_Port source) |
125 | { | 125 | { |
126 | uint32_t id = 0, i; | 126 | uint32_t id = 0, i; |
127 | for(i = 0; i < 6; i++) | 127 | for(i = 0; i < 6; ++i) |
128 | { | 128 | { |
129 | if(randtable[i][((uint8_t *)&source)[i]] == 0) | 129 | if(randtable[i][((uint8_t *)&source)[i]] == 0) |
130 | { | 130 | { |
@@ -159,7 +159,7 @@ int new_connection(IP_Port ip_port) | |||
159 | return connect; | 159 | return connect; |
160 | } | 160 | } |
161 | uint32_t i; | 161 | uint32_t i; |
162 | for(i = 0; i < MAX_CONNECTIONS; i++) | 162 | for(i = 0; i < MAX_CONNECTIONS; ++i) |
163 | { | 163 | { |
164 | if(connections[i].status == 0) | 164 | if(connections[i].status == 0) |
165 | { | 165 | { |
@@ -195,7 +195,7 @@ int new_inconnection(IP_Port ip_port) | |||
195 | return -1; | 195 | return -1; |
196 | } | 196 | } |
197 | uint32_t i; | 197 | uint32_t i; |
198 | for(i = 0; i < MAX_CONNECTIONS; i++) | 198 | for(i = 0; i < MAX_CONNECTIONS; ++i) |
199 | { | 199 | { |
200 | if(connections[i].status == 0) | 200 | if(connections[i].status == 0) |
201 | { | 201 | { |
@@ -223,7 +223,7 @@ int new_inconnection(IP_Port ip_port) | |||
223 | int incoming_connection() | 223 | int incoming_connection() |
224 | { | 224 | { |
225 | uint32_t i; | 225 | uint32_t i; |
226 | for(i = 0; i < MAX_CONNECTIONS; i++) | 226 | for(i = 0; i < MAX_CONNECTIONS; ++i) |
227 | { | 227 | { |
228 | if(connections[i].inbound == 2) | 228 | if(connections[i].inbound == 2) |
229 | { | 229 | { |
@@ -323,7 +323,7 @@ int read_packet(int connection_id, uint8_t * data) | |||
323 | uint16_t index = connections[connection_id].successful_read % MAX_QUEUE_NUM; | 323 | uint16_t index = connections[connection_id].successful_read % MAX_QUEUE_NUM; |
324 | uint16_t size = connections[connection_id].recvbuffer[index].size; | 324 | uint16_t size = connections[connection_id].recvbuffer[index].size; |
325 | memcpy(data, connections[connection_id].recvbuffer[index].data, size); | 325 | memcpy(data, connections[connection_id].recvbuffer[index].data, size); |
326 | connections[connection_id].successful_read++; | 326 | ++connections[connection_id].successful_read; |
327 | connections[connection_id].recvbuffer[index].size = 0; | 327 | connections[connection_id].recvbuffer[index].size = 0; |
328 | return size; | 328 | return size; |
329 | } | 329 | } |
@@ -372,7 +372,7 @@ uint32_t missing_packets(int connection_id, uint32_t * requested) | |||
372 | { | 372 | { |
373 | temp = htonl(i); | 373 | temp = htonl(i); |
374 | memcpy(requested + number, &temp, 4); | 374 | memcpy(requested + number, &temp, 4); |
375 | number++; | 375 | ++number; |
376 | } | 376 | } |
377 | } | 377 | } |
378 | if(number == 0) | 378 | if(number == 0) |
@@ -556,7 +556,7 @@ int handle_SYNC2(int connection_id, uint8_t counter, uint32_t recv_packetnum, ui | |||
556 | { | 556 | { |
557 | connections[connection_id].status = 3; | 557 | connections[connection_id].status = 3; |
558 | connections[connection_id].recv_counter = counter; | 558 | connections[connection_id].recv_counter = counter; |
559 | connections[connection_id].send_counter++; | 559 | ++connections[connection_id].send_counter; |
560 | send_SYNC(connection_id); | 560 | send_SYNC(connection_id); |
561 | return 0; | 561 | return 0; |
562 | } | 562 | } |
@@ -579,8 +579,8 @@ int handle_SYNC3(int connection_id, uint8_t counter, uint32_t recv_packetnum, ui | |||
579 | connections[connection_id].successful_sent = recv_packetnum; | 579 | connections[connection_id].successful_sent = recv_packetnum; |
580 | connections[connection_id].last_recvSYNC = current_time(); | 580 | connections[connection_id].last_recvSYNC = current_time(); |
581 | connections[connection_id].recv_counter = counter; | 581 | connections[connection_id].recv_counter = counter; |
582 | connections[connection_id].send_counter++; | 582 | ++connections[connection_id].send_counter; |
583 | for(i = 0; i < number; i++) | 583 | for(i = 0; i < number; ++i) |
584 | { | 584 | { |
585 | temp = ntohl(req_packets[i]); | 585 | temp = ntohl(req_packets[i]); |
586 | memcpy(connections[connection_id].req_packets + i, &temp, 4 * number); | 586 | memcpy(connections[connection_id].req_packets + i, &temp, 4 * number); |
@@ -641,7 +641,7 @@ int add_recv(int connection_id, uint32_t data_num, uint8_t * data, uint16_t size | |||
641 | uint32_t i; | 641 | uint32_t i; |
642 | uint32_t maxnum = connections[connection_id].successful_read + BUFFER_PACKET_NUM; | 642 | uint32_t maxnum = connections[connection_id].successful_read + BUFFER_PACKET_NUM; |
643 | uint32_t sent_packet = data_num - connections[connection_id].osent_packetnum; | 643 | uint32_t sent_packet = data_num - connections[connection_id].osent_packetnum; |
644 | for(i = connections[connection_id].recv_packetnum; i != maxnum; i++) | 644 | for(i = connections[connection_id].recv_packetnum; i != maxnum; ++i) |
645 | { | 645 | { |
646 | if(i == data_num) | 646 | if(i == data_num) |
647 | { | 647 | { |
@@ -655,7 +655,7 @@ int add_recv(int connection_id, uint32_t data_num, uint8_t * data, uint16_t size | |||
655 | break; | 655 | break; |
656 | } | 656 | } |
657 | } | 657 | } |
658 | for(i = connections[connection_id].recv_packetnum; i != maxnum; i++) | 658 | for(i = connections[connection_id].recv_packetnum; i != maxnum; ++i) |
659 | { | 659 | { |
660 | if(connections[connection_id].recvbuffer[i % MAX_QUEUE_NUM].size != 0) | 660 | if(connections[connection_id].recvbuffer[i % MAX_QUEUE_NUM].size != 0) |
661 | { | 661 | { |
@@ -729,7 +729,7 @@ void doNew() | |||
729 | { | 729 | { |
730 | uint32_t i; | 730 | uint32_t i; |
731 | uint64_t temp_time = current_time(); | 731 | uint64_t temp_time = current_time(); |
732 | for(i = 0; i < MAX_CONNECTIONS; i++) | 732 | for(i = 0; i < MAX_CONNECTIONS; ++i) |
733 | { | 733 | { |
734 | if(connections[i].status == 1) | 734 | if(connections[i].status == 1) |
735 | { | 735 | { |
@@ -758,7 +758,7 @@ void doSYNC() | |||
758 | { | 758 | { |
759 | uint32_t i; | 759 | uint32_t i; |
760 | uint64_t temp_time = current_time(); | 760 | uint64_t temp_time = current_time(); |
761 | for(i = 0; i < MAX_CONNECTIONS; i++) | 761 | for(i = 0; i < MAX_CONNECTIONS; ++i) |
762 | { | 762 | { |
763 | if(connections[i].status == 2 || connections[i].status == 3) | 763 | if(connections[i].status == 2 || connections[i].status == 3) |
764 | { | 764 | { |
@@ -776,7 +776,7 @@ void doData() | |||
776 | uint32_t i; | 776 | uint32_t i; |
777 | uint64_t j; | 777 | uint64_t j; |
778 | uint64_t temp_time = current_time(); | 778 | uint64_t temp_time = current_time(); |
779 | for(i = 0; i < MAX_CONNECTIONS; i++) | 779 | for(i = 0; i < MAX_CONNECTIONS; ++i) |
780 | { | 780 | { |
781 | if(connections[i].status == 3 && sendqueue(i) != 0) | 781 | if(connections[i].status == 3 && sendqueue(i) != 0) |
782 | { | 782 | { |
@@ -801,7 +801,7 @@ void adjustRates() | |||
801 | { | 801 | { |
802 | uint32_t i; | 802 | uint32_t i; |
803 | uint64_t temp_time = current_time(); | 803 | uint64_t temp_time = current_time(); |
804 | for(i = 0; i < MAX_CONNECTIONS; i++) | 804 | for(i = 0; i < MAX_CONNECTIONS; ++i) |
805 | { | 805 | { |
806 | if(connections[i].status == 3) | 806 | if(connections[i].status == 3) |
807 | { | 807 | { |
@@ -834,4 +834,4 @@ void doLossless_UDP() | |||
834 | adjustRates(); | 834 | adjustRates(); |
835 | 835 | ||
836 | 836 | ||
837 | } \ No newline at end of file | 837 | } |