From b2d1fc119d50f0f9a9f2edb784577f9ad6585fbe Mon Sep 17 00:00:00 2001 From: Freddie Chopin Date: Thu, 5 Dec 2019 22:12:45 +0100 Subject: [PATCH] PPP, PPPoS: Use `const void*` instead of `u8_t*` in pppos_output_cb_fn() There is no good reason why this function should take a non-const pointer, as the output callback should never modify what lwIP gives it. While changing that also switch to a more generic `void*` instead of "byte". --- contrib/examples/example_app/test.c | 4 ++-- contrib/examples/ppp/pppos_example.c | 4 ++-- doc/ppp.txt | 2 +- src/include/netif/ppp/pppos.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/examples/example_app/test.c b/contrib/examples/example_app/test.c index 95cca1f1..21b682cb 100644 --- a/contrib/examples/example_app/test.c +++ b/contrib/examples/example_app/test.c @@ -258,11 +258,11 @@ pppLinkStatusCallback(ppp_pcb *pcb, int errCode, void *ctx) #if PPPOS_SUPPORT static u32_t -ppp_output_cb(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx) +ppp_output_cb(ppp_pcb *pcb, const void *data, u32_t len, void *ctx) { LWIP_UNUSED_ARG(pcb); LWIP_UNUSED_ARG(ctx); - return sio_write(ppp_sio, data, len); + return sio_write(ppp_sio, (u8_t*)data, len); } #endif /* PPPOS_SUPPORT */ #endif /* USE_PPP */ diff --git a/contrib/examples/ppp/pppos_example.c b/contrib/examples/ppp/pppos_example.c index a3362dfb..d356eecc 100644 --- a/contrib/examples/ppp/pppos_example.c +++ b/contrib/examples/ppp/pppos_example.c @@ -156,11 +156,11 @@ ppp_link_status_cb(ppp_pcb *pcb, int err_code, void *ctx) } static u32_t -ppp_output_cb(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx) +ppp_output_cb(ppp_pcb *pcb, const void *data, u32_t len, void *ctx) { LWIP_UNUSED_ARG(pcb); LWIP_UNUSED_ARG(ctx); - return sio_write(ppp_sio, data, len); + return sio_write(ppp_sio, (u8_t*)data, len); } #if LWIP_NETIF_STATUS_CALLBACK diff --git a/doc/ppp.txt b/doc/ppp.txt index 797b4e0a..a713cc52 100644 --- a/doc/ppp.txt +++ b/doc/ppp.txt @@ -195,7 +195,7 @@ static void status_cb(ppp_pcb *pcb, int err_code, void *ctx) { * * Return value: len if write succeed */ -static u32_t output_cb(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx) { +static u32_t output_cb(ppp_pcb *pcb, const void *data, u32_t len, void *ctx) { return uart_write(UART, data, len); } diff --git a/src/include/netif/ppp/pppos.h b/src/include/netif/ppp/pppos.h index 983da56c..f587498d 100644 --- a/src/include/netif/ppp/pppos.h +++ b/src/include/netif/ppp/pppos.h @@ -58,7 +58,7 @@ enum { }; /* PPPoS serial output callback function prototype */ -typedef u32_t (*pppos_output_cb_fn)(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx); +typedef u32_t (*pppos_output_cb_fn)(ppp_pcb *pcb, const void *data, u32_t len, void *ctx); /* * Extended asyncmap - allows any character to be escaped.