summaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorGDR! <gdr@gdr.name>2016-12-07 15:26:38 +0100
committerGDR! <gdr@gdr.name>2016-12-07 15:26:38 +0100
commitb3b0e345a94830a186168a4ecd53e0259a00b0c0 (patch)
tree724820bfcc6e770be3d8053a436257494a8b2b96 /client.c
parent5667e567a59041b673861804fc6eba3cf99fcb05 (diff)
Fixed some warnings
Diffstat (limited to 'client.c')
-rw-r--r--client.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/client.c b/client.c
index 0634702..381087c 100644
--- a/client.c
+++ b/client.c
@@ -37,7 +37,6 @@ int handle_pong_frame(protocol_frame *rcvd_frame)
37 37
38 if(ping_mode) 38 if(ping_mode)
39 { 39 {
40// state = CLIENT_STATE_PONG_RECEIVED;
41 state = CLIENT_STATE_SEND_PING; 40 state = CLIENT_STATE_SEND_PING;
42 } 41 }
43 return 0; 42 return 0;
@@ -198,7 +197,7 @@ int handle_server_tcp_frame(protocol_frame *rcvd_frame)
198 197
199 if(sent_bytes < 0) 198 if(sent_bytes < 0)
200 { 199 {
201 char data[PROTOCOL_BUFFER_OFFSET]; 200 uint8_t data[PROTOCOL_BUFFER_OFFSET];
202 protocol_frame frame_st, *frame; 201 protocol_frame frame_st, *frame;
203 202
204 log_printf(L_INFO, "Could not write to socket %d: %s\n", write_sockfd, strerror(errno)); 203 log_printf(L_INFO, "Could not write to socket %d: %s\n", write_sockfd, strerror(errno));
@@ -231,7 +230,6 @@ int handle_server_tcp_frame(protocol_frame *rcvd_frame)
231int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame) 230int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame)
232{ 231{
233 tunnel *tun=NULL; 232 tunnel *tun=NULL;
234 int offset = 0;
235 int connid = rcvd_frame->connid; 233 int connid = rcvd_frame->connid;
236 234
237 HASH_FIND_INT(by_id, &connid, tun); 235 HASH_FIND_INT(by_id, &connid, tun);
@@ -258,7 +256,7 @@ int handle_server_tcp_fin_frame(protocol_frame *rcvd_frame)
258} 256}
259 257
260/* Main loop for the client */ 258/* Main loop for the client */
261int do_client_loop(char *tox_id_str) 259int do_client_loop(unsigned char *tox_id_str)
262{ 260{
263 unsigned char tox_packet_buf[PROTOCOL_MAX_PACKET_SIZE]; 261 unsigned char tox_packet_buf[PROTOCOL_MAX_PACKET_SIZE];
264 unsigned char tox_id[TOX_ADDRESS_SIZE]; 262 unsigned char tox_id[TOX_ADDRESS_SIZE];
@@ -273,7 +271,7 @@ int do_client_loop(char *tox_id_str)
273 client_tunnel.sockfd = 0; 271 client_tunnel.sockfd = 0;
274 FD_ZERO(&client_master_fdset); 272 FD_ZERO(&client_master_fdset);
275 273
276 tox_callback_friend_lossless_packet(tox, parse_lossless_packet, NULL); 274 tox_callback_friend_lossless_packet(tox, parse_lossless_packet);
277 275
278 if(!string_to_id(tox_id, tox_id_str)) 276 if(!string_to_id(tox_id, tox_id_str))
279 { 277 {
@@ -292,7 +290,7 @@ int do_client_loop(char *tox_id_str)
292 while(1) 290 while(1)
293 { 291 {
294 /* Let tox do its stuff */ 292 /* Let tox do its stuff */
295 tox_iterate(tox); 293 tox_iterate(tox, NULL);
296 294
297 switch(state) 295 switch(state)
298 { 296 {
@@ -307,15 +305,15 @@ int do_client_loop(char *tox_id_str)
307 break; 305 break;
308 case CLIENT_STATE_CONNECTED: 306 case CLIENT_STATE_CONNECTED:
309 { 307 {
310 uint8_t* data = "Hi, fellow tuntox instance!"; 308 uint8_t* data = (uint8_t *)"Hi, fellow tuntox instance!";
311 uint16_t length = sizeof(data); 309 uint16_t length = sizeof(data);
312 TOX_ERR_FRIEND_ADD add_error; 310 TOX_ERR_FRIEND_ADD add_error;
313 311
314 if(use_shared_secret) 312 if(use_shared_secret)
315 { 313 {
316 data = shared_secret; 314 data = (uint8_t *)shared_secret;
317 data[TOX_MAX_FRIEND_REQUEST_LENGTH-1] = '\0'; 315 data[TOX_MAX_FRIEND_REQUEST_LENGTH-1] = '\0';
318 length = strlen(data)+1; 316 length = strlen((char *)data)+1;
319 log_printf(L_DEBUG, "Sent shared secret of length %u\n", length); 317 log_printf(L_DEBUG, "Sent shared secret of length %u\n", length);
320 } 318 }
321 319