Browse Source

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);
                             ^
Erik Ekman 5 years ago
parent
commit
c748395bda

+ 1 - 0
UPGRADING

@@ -9,6 +9,7 @@ with newer versions.
   * [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
     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)
 

+ 1 - 1
contrib/examples/example_app/test.c

@@ -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(ctx);
-  return sio_write(ppp_sio, (u8_t*)data, len);
+  return sio_write(ppp_sio, (const u8_t*)data, len);
 }
 #endif /* PPPOS_SUPPORT */
 #endif /* USE_PPP */

+ 1 - 1
contrib/examples/ppp/pppos_example.c

@@ -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(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

+ 1 - 1
contrib/ports/unix/port/netif/sio.c

@@ -300,7 +300,7 @@ void sio_expect_string( u8_t *str, sio_status_t * siostat )
 #endif /* ! (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 );
     return wsz < 0 ? 0 : wsz;

+ 1 - 1
contrib/ports/win32/sio.c

@@ -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.
  */
-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;
   DWORD dwNbBytesWritten = 0;

+ 1 - 1
src/include/lwip/sio.h

@@ -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.
  */
-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
 
 #ifndef sio_read_abort