PPP: Change data argument in sio_write to const

To fix the build after ppp_output_cb started taking it as const in
commit b2d1fc119d50f0f9a9f2edb784577f9ad6585fbe.

Fixes this failure:
../contrib/examples/ppp/pppos_example.c: In function ‘ppp_output_cb’:
../contrib/examples/ppp/pppos_example.c:163:29: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
   return sio_write(ppp_sio, (u8_t*)data, len);
                             ^
This commit is contained in:
Erik Ekman 2020-12-03 09:47:00 +01:00
parent d1fc5c2ec4
commit c748395bda
6 changed files with 6 additions and 5 deletions

View File

@ -9,6 +9,7 @@ with newer versions.
* [Enter new changes just after this line - do not remove this line] * [Enter new changes just after this line - do not remove this line]
* The eth_addr_cmp and ip_addr_cmp set of functions have been renamed to eth_addr_eq, ip_addr_eq * The eth_addr_cmp and ip_addr_cmp set of functions have been renamed to eth_addr_eq, ip_addr_eq
and so on, since they return non-zero on equality. Macros for the old names exist. and so on, since they return non-zero on equality. Macros for the old names exist.
* The sio_write function used by PPP now takes the data argument as const.
(2.1.0) (2.1.0)

View File

@ -262,7 +262,7 @@ ppp_output_cb(ppp_pcb *pcb, const void *data, u32_t len, void *ctx)
{ {
LWIP_UNUSED_ARG(pcb); LWIP_UNUSED_ARG(pcb);
LWIP_UNUSED_ARG(ctx); LWIP_UNUSED_ARG(ctx);
return sio_write(ppp_sio, (u8_t*)data, len); return sio_write(ppp_sio, (const u8_t*)data, len);
} }
#endif /* PPPOS_SUPPORT */ #endif /* PPPOS_SUPPORT */
#endif /* USE_PPP */ #endif /* USE_PPP */

View File

@ -160,7 +160,7 @@ ppp_output_cb(ppp_pcb *pcb, const void *data, u32_t len, void *ctx)
{ {
LWIP_UNUSED_ARG(pcb); LWIP_UNUSED_ARG(pcb);
LWIP_UNUSED_ARG(ctx); LWIP_UNUSED_ARG(ctx);
return sio_write(ppp_sio, (u8_t*)data, len); return sio_write(ppp_sio, (const u8_t*)data, len);
} }
#if LWIP_NETIF_STATUS_CALLBACK #if LWIP_NETIF_STATUS_CALLBACK

View File

@ -300,7 +300,7 @@ void sio_expect_string( u8_t *str, sio_status_t * siostat )
#endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */ #endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */
#if (PPP_SUPPORT || LWIP_HAVE_SLIPIF) #if (PPP_SUPPORT || LWIP_HAVE_SLIPIF)
u32_t sio_write(sio_status_t * siostat, u8_t *buf, u32_t size) u32_t sio_write(sio_status_t * siostat, const u8_t *buf, u32_t size)
{ {
ssize_t wsz = write( siostat->fd, buf, size ); ssize_t wsz = write( siostat->fd, buf, size );
return wsz < 0 ? 0 : wsz; return wsz < 0 ? 0 : wsz;

View File

@ -278,7 +278,7 @@ u32_t sio_tryread(sio_fd_t fd, u8_t* data, u32_t len)
* *
* @note This function will block until all data can be sent. * @note This function will block until all data can be sent.
*/ */
u32_t sio_write(sio_fd_t fd, u8_t* data, u32_t len) u32_t sio_write(sio_fd_t fd, const u8_t* data, u32_t len)
{ {
BOOL ret; BOOL ret;
DWORD dwNbBytesWritten = 0; DWORD dwNbBytesWritten = 0;

View File

@ -123,7 +123,7 @@ u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len);
* *
* @note This function will block until all data can be sent. * @note This function will block until all data can be sent.
*/ */
u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len); u32_t sio_write(sio_fd_t fd, const u8_t *data, u32_t len);
#endif #endif
#ifndef sio_read_abort #ifndef sio_read_abort