Fixed bug #19251 (missing `const' qualifier in socket functions), to get more compatible to standard POSIX sockets.

This commit is contained in:
goldsimon 2007-03-11 17:57:13 +00:00
parent 9b143dd5dc
commit bc4b3764fc
6 changed files with 20 additions and 15 deletions

View File

@ -60,12 +60,17 @@ HISTORY
++ Bug fixes:
2007-03-11 Simon Goldschmidt (based on patch from Dmitry Potapov)
* api_lib.c, sockets.c, api.h, api_msg.h, sockets.h: Fixed bug #19251
(missing `const' qualifier in socket functions), to get more compatible to
standard POSIX sockets.
2007-03-11 Frédéric Bernon (based on patch from Dmitry Potapov)
* sockets.c: Add asserts inside bind, connect and sendto to check input
parameters. Remove excessive set_errno() calls after get_socket(), because
errno is set inside of get_socket(). Move last sock_set_errno() inside
lwip_close.
2007-03-09 Simon Goldschmidt
* memp.c: Fixed bug #11400: New etharp queueing introduced bug: memp_memory
was allocated too small.

View File

@ -92,13 +92,13 @@ netbuf_free(struct netbuf *buf)
}
void
netbuf_ref(struct netbuf *buf, void *dataptr, u16_t size)
netbuf_ref(struct netbuf *buf, const void *dataptr, u16_t size)
{
if (buf->p != NULL) {
pbuf_free(buf->p);
}
buf->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_REF);
buf->p->payload = dataptr;
buf->p->payload = (void*)dataptr;
buf->p->len = buf->p->tot_len = size;
buf->ptr = buf->p;
}
@ -598,7 +598,7 @@ netconn_send(struct netconn *conn, struct netbuf *buf)
}
err_t
netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy)
netconn_write(struct netconn *conn, const void *dataptr, u16_t size, u8_t copy)
{
struct api_msg msg;
u16_t len;

View File

@ -280,7 +280,7 @@ lwip_close(int s)
}
int
lwip_connect(int s, struct sockaddr *name, socklen_t namelen)
lwip_connect(int s, const struct sockaddr *name, socklen_t namelen)
{
struct lwip_socket *sock;
err_t err;
@ -459,7 +459,7 @@ lwip_recv(int s, void *mem, int len, unsigned int flags)
}
int
lwip_send(int s, void *data, int size, unsigned int flags)
lwip_send(int s, const void *data, int size, unsigned int flags)
{
struct lwip_socket *sock;
struct netbuf *buf;
@ -514,7 +514,7 @@ lwip_send(int s, void *data, int size, unsigned int flags)
}
int
lwip_sendto(int s, void *data, int size, unsigned int flags,
lwip_sendto(int s, const void *data, int size, unsigned int flags,
struct sockaddr *to, socklen_t tolen)
{
struct lwip_socket *sock;
@ -597,7 +597,7 @@ lwip_socket(int domain, int type, int protocol)
}
int
lwip_write(int s, void *data, int size)
lwip_write(int s, const void *data, int size)
{
return lwip_send(s, data, size, 0);
}

View File

@ -105,7 +105,7 @@ void netbuf_delete (struct netbuf *buf);
void * netbuf_alloc (struct netbuf *buf, u16_t size);
void netbuf_free (struct netbuf *buf);
void netbuf_ref (struct netbuf *buf,
void *dataptr, u16_t size);
const void *dataptr, u16_t size);
void netbuf_chain (struct netbuf *head,
struct netbuf *tail);
@ -151,7 +151,7 @@ struct netbuf * netconn_recv (struct netconn *conn);
err_t netconn_send (struct netconn *conn,
struct netbuf *buf);
err_t netconn_write (struct netconn *conn,
void *dataptr, u16_t size,
const void *dataptr, u16_t size,
u8_t copy);
err_t netconn_close (struct netconn *conn);

View File

@ -73,7 +73,7 @@ struct api_msg_msg {
u16_t port;
} bc;
struct {
void *dataptr;
const void *dataptr;
u16_t len;
u8_t copy;
} w;

View File

@ -234,17 +234,17 @@ int lwip_getsockname (int s, struct sockaddr *name, socklen_t *namelen);
int lwip_getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen);
int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen);
int lwip_close(int s);
int lwip_connect(int s, struct sockaddr *name, socklen_t namelen);
int lwip_connect(int s, const struct sockaddr *name, socklen_t namelen);
int lwip_listen(int s, int backlog);
int lwip_recv(int s, void *mem, int len, unsigned int flags);
int lwip_read(int s, void *mem, int len);
int lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
struct sockaddr *from, socklen_t *fromlen);
int lwip_send(int s, void *dataptr, int size, unsigned int flags);
int lwip_sendto(int s, void *dataptr, int size, unsigned int flags,
int lwip_send(int s, const void *dataptr, int size, unsigned int flags);
int lwip_sendto(int s, const void *dataptr, int size, unsigned int flags,
struct sockaddr *to, socklen_t tolen);
int lwip_socket(int domain, int type, int protocol);
int lwip_write(int s, void *dataptr, int size);
int lwip_write(int s, const void *dataptr, int size);
int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
struct timeval *timeout);
int lwip_ioctl(int s, long cmd, void *argp);