@@ -29,12 +29,6 @@ typedef void (*discard_cb_t)(void*, ClientContext*);
29
29
extern " C" void esp_yield ();
30
30
extern " C" void esp_schedule ();
31
31
32
- #ifdef LWIP_OPEN_SRC
33
- typedef err_t recv_ret_t ;
34
- #else
35
- typedef int32_t recv_ret_t ;
36
- #endif
37
-
38
32
#include " DataSource.h"
39
33
40
34
class ClientContext
@@ -45,7 +39,7 @@ class ClientContext
45
39
{
46
40
tcp_setprio (pcb, TCP_PRIO_MIN);
47
41
tcp_arg (pcb, this );
48
- tcp_recv (pcb, (tcp_recv_fn) &_s_recv);
42
+ tcp_recv (pcb, &_s_recv);
49
43
tcp_sent (pcb, &_s_sent);
50
44
tcp_err (pcb, &_s_error);
51
45
tcp_poll (pcb, &_s_poll, 1 );
@@ -78,7 +72,7 @@ class ClientContext
78
72
tcp_poll (_pcb, NULL , 0 );
79
73
err = tcp_close (_pcb);
80
74
if (err != ERR_OK) {
81
- DEBUGV (" :tc err %d\r\n " , err);
75
+ DEBUGV (" :tc err %d\r\n " , ( int ) err);
82
76
tcp_abort (_pcb);
83
77
err = ERR_ABRT;
84
78
}
@@ -126,7 +120,7 @@ class ClientContext
126
120
127
121
int connect (ip_addr_t * addr, uint16_t port)
128
122
{
129
- err_t err = tcp_connect (_pcb, addr, port, reinterpret_cast <tcp_connected_fn>( &ClientContext::_s_connected) );
123
+ err_t err = tcp_connect (_pcb, addr, port, &ClientContext::_s_connected);
130
124
if (err != ERR_OK) {
131
125
return 0 ;
132
126
}
@@ -396,7 +390,7 @@ class ClientContext
396
390
break ;
397
391
}
398
392
err_t err = tcp_write (_pcb, buf, next_chunk, TCP_WRITE_FLAG_COPY);
399
- DEBUGV (" :wrc %d %d %d\r\n " , next_chunk, will_send, err);
393
+ DEBUGV (" :wrc %d %d %d\r\n " , next_chunk, will_send, ( int ) err);
400
394
_datasource->release_buffer (buf, next_chunk);
401
395
if (err == ERR_OK) {
402
396
_written += next_chunk;
@@ -456,7 +450,7 @@ class ClientContext
456
450
}
457
451
}
458
452
459
- recv_ret_t _recv (tcp_pcb* pcb, pbuf* pb, err_t err)
453
+ err_t _recv (tcp_pcb* pcb, pbuf* pb, err_t err)
460
454
{
461
455
(void ) pcb;
462
456
(void ) err;
@@ -481,7 +475,7 @@ class ClientContext
481
475
void _error (err_t err)
482
476
{
483
477
(void ) err;
484
- DEBUGV (" :er %d %08x\r\n " , err, (uint32_t ) _datasource);
478
+ DEBUGV (" :er %d 0x %08x\r\n " , ( int ) err, (uint32_t ) _datasource);
485
479
tcp_arg (_pcb, NULL );
486
480
tcp_sent (_pcb, NULL );
487
481
tcp_recv (_pcb, NULL );
@@ -490,7 +484,7 @@ class ClientContext
490
484
_notify_error ();
491
485
}
492
486
493
- int8_t _connected (void * pcb, int8_t err)
487
+ err_t _connected (struct tcp_pcb * pcb, err_t err)
494
488
{
495
489
(void ) err;
496
490
assert (pcb == _pcb);
@@ -505,7 +499,7 @@ class ClientContext
505
499
return ERR_OK;
506
500
}
507
501
508
- static recv_ret_t _s_recv (void *arg, struct tcp_pcb *tpcb, struct pbuf *pb, err_t err)
502
+ static err_t _s_recv (void *arg, struct tcp_pcb *tpcb, struct pbuf *pb, err_t err)
509
503
{
510
504
return reinterpret_cast <ClientContext*>(arg)->_recv (tpcb, pb, err);
511
505
}
@@ -525,7 +519,7 @@ class ClientContext
525
519
return reinterpret_cast <ClientContext*>(arg)->_sent (tpcb, len);
526
520
}
527
521
528
- static int8_t _s_connected (void * arg, void * pcb, int8_t err)
522
+ static err_t _s_connected (void * arg, struct tcp_pcb * pcb, err_t err)
529
523
{
530
524
return reinterpret_cast <ClientContext*>(arg)->_connected (pcb, err);
531
525
}
0 commit comments