mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-09-30 00:55:17 +00:00
bug #28659: Missing casts
This commit is contained in:
parent
0f5c7fa169
commit
892859455c
@ -24,7 +24,7 @@ http_server_netconn_serve(struct netconn *conn)
|
|||||||
err = netconn_recv(conn, &inbuf);
|
err = netconn_recv(conn, &inbuf);
|
||||||
|
|
||||||
if (err == ERR_OK) {
|
if (err == ERR_OK) {
|
||||||
netbuf_data(inbuf, &buf, &buflen);
|
netbuf_data(inbuf, (void**)&buf, &buflen);
|
||||||
|
|
||||||
/* Is this an HTTP GET command? (only check the first 5 chars, since
|
/* Is this an HTTP GET command? (only check the first 5 chars, since
|
||||||
there are other formats for GET, and we're keeping it very simple )*/
|
there are other formats for GET, and we're keeping it very simple )*/
|
||||||
|
@ -100,9 +100,9 @@ static struct http_state*
|
|||||||
http_state_alloc()
|
http_state_alloc()
|
||||||
{
|
{
|
||||||
#if HTTPD_USE_MEM_POOL
|
#if HTTPD_USE_MEM_POOL
|
||||||
return memp_malloc(MEMP_HTTPD_STATE);
|
return (struct http_state *)memp_malloc(MEMP_HTTPD_STATE);
|
||||||
#else /* HTTPD_USE_MEM_POOL */
|
#else /* HTTPD_USE_MEM_POOL */
|
||||||
return mem_malloc(sizeof(struct http_state));
|
return (struct http_state *)mem_malloc(sizeof(struct http_state));
|
||||||
#endif /* HTTPD_USE_MEM_POOL */
|
#endif /* HTTPD_USE_MEM_POOL */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ http_parse_request(struct pbuf *p, struct http_state *hs)
|
|||||||
struct fs_file file;
|
struct fs_file file;
|
||||||
const char* filename = NULL;
|
const char* filename = NULL;
|
||||||
|
|
||||||
data = p->payload;
|
data = (char*)p->payload;
|
||||||
|
|
||||||
/* default is request not supported */
|
/* default is request not supported */
|
||||||
request_supported = ERR_ARG;
|
request_supported = ERR_ARG;
|
||||||
@ -285,7 +285,7 @@ http_parse_request(struct pbuf *p, struct http_state *hs)
|
|||||||
static void
|
static void
|
||||||
http_err(void *arg, err_t err)
|
http_err(void *arg, err_t err)
|
||||||
{
|
{
|
||||||
struct http_state *hs = arg;
|
struct http_state *hs = (struct http_state *)arg;
|
||||||
LWIP_UNUSED_ARG(err);
|
LWIP_UNUSED_ARG(err);
|
||||||
|
|
||||||
LWIP_DEBUGF(HTTPD_DEBUG, ("http_err: %s", lwip_strerr(err)));
|
LWIP_DEBUGF(HTTPD_DEBUG, ("http_err: %s", lwip_strerr(err)));
|
||||||
@ -302,7 +302,7 @@ http_err(void *arg, err_t err)
|
|||||||
static err_t
|
static err_t
|
||||||
http_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
|
http_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
|
||||||
{
|
{
|
||||||
struct http_state *hs = arg;
|
struct http_state *hs = (struct http_state *)arg;
|
||||||
LWIP_DEBUGF(HTTPD_DEBUG, ("http_sent: pcb=%p hs=%p len=%"U16_F"\n",
|
LWIP_DEBUGF(HTTPD_DEBUG, ("http_sent: pcb=%p hs=%p len=%"U16_F"\n",
|
||||||
(void*)pcb, (void*)hs, len));
|
(void*)pcb, (void*)hs, len));
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ http_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
|
|||||||
static err_t
|
static err_t
|
||||||
http_poll(void *arg, struct tcp_pcb *pcb)
|
http_poll(void *arg, struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
struct http_state *hs = arg;
|
struct http_state *hs = (struct http_state *)arg;
|
||||||
LWIP_DEBUGF(HTTPD_DEBUG, ("http_poll: pcb=%p hs=%p pcb_state=%s\n",
|
LWIP_DEBUGF(HTTPD_DEBUG, ("http_poll: pcb=%p hs=%p pcb_state=%s\n",
|
||||||
(void*)pcb, (void*)hs, tcp_debug_state_str(pcb->state)));
|
(void*)pcb, (void*)hs, tcp_debug_state_str(pcb->state)));
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ static err_t
|
|||||||
http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||||
{
|
{
|
||||||
err_t parsed = ERR_ABRT;
|
err_t parsed = ERR_ABRT;
|
||||||
struct http_state *hs = arg;
|
struct http_state *hs = (struct http_state *)arg;
|
||||||
LWIP_DEBUGF(HTTPD_DEBUG, ("http_recv: pcb=%p pbuf=%p err=%s\n", (void*)pcb,
|
LWIP_DEBUGF(HTTPD_DEBUG, ("http_recv: pcb=%p pbuf=%p err=%s\n", (void*)pcb,
|
||||||
(void*)p, lwip_strerr(err)));
|
(void*)p, lwip_strerr(err)));
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ struct packet_adapter {
|
|||||||
* @return number of adapters found or negative on error
|
* @return number of adapters found or negative on error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
get_adapter_list(void** adapter_list, int list_len, void* buffer, size_t buf_len)
|
get_adapter_list(char** adapter_list, int list_len, void* buffer, size_t buf_len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *temp, *start;
|
char *temp, *start;
|
||||||
@ -123,8 +123,8 @@ get_adapter_list(void** adapter_list, int list_len, void* buffer, size_t buf_len
|
|||||||
/* get the start of each adapter name in the list and put it into
|
/* get the start of each adapter name in the list and put it into
|
||||||
* the AdapterList array */
|
* the AdapterList array */
|
||||||
i = 0;
|
i = 0;
|
||||||
temp = buffer;
|
temp = (char*)buffer;
|
||||||
start = buffer;
|
start = (char*)buffer;
|
||||||
while ((*temp != '\0') || (*(temp - 1) != '\0')) {
|
while ((*temp != '\0') || (*(temp - 1) != '\0')) {
|
||||||
if (*temp == '\0') {
|
if (*temp == '\0') {
|
||||||
adapter_list[i] = start;
|
adapter_list[i] = start;
|
||||||
@ -147,7 +147,7 @@ get_adapter_list(void** adapter_list, int list_len, void* buffer, size_t buf_len
|
|||||||
int
|
int
|
||||||
get_adapter_index(const char* adapter_guid)
|
get_adapter_index(const char* adapter_guid)
|
||||||
{
|
{
|
||||||
void *AdapterList[MAX_NUM_ADAPTERS];
|
char *AdapterList[MAX_NUM_ADAPTERS];
|
||||||
int i;
|
int i;
|
||||||
char AdapterName[ADAPTER_NAME_LEN]; /* string that contains a list of the network adapters */
|
char AdapterName[ADAPTER_NAME_LEN]; /* string that contains a list of the network adapters */
|
||||||
int AdapterNum;
|
int AdapterNum;
|
||||||
@ -156,7 +156,7 @@ get_adapter_index(const char* adapter_guid)
|
|||||||
AdapterNum = get_adapter_list(AdapterList, MAX_NUM_ADAPTERS, AdapterName, ADAPTER_NAME_LEN);
|
AdapterNum = get_adapter_list(AdapterList, MAX_NUM_ADAPTERS, AdapterName, ADAPTER_NAME_LEN);
|
||||||
if (AdapterNum > 0) {
|
if (AdapterNum > 0) {
|
||||||
for (i = 0; i < AdapterNum; i++) {
|
for (i = 0; i < AdapterNum; i++) {
|
||||||
if(strstr(AdapterList[i], adapter_guid)) {
|
if(strstr((char*)AdapterList[i], adapter_guid)) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ get_adapter_index(const char* adapter_guid)
|
|||||||
void*
|
void*
|
||||||
init_adapter(int adapter_num, char *mac_addr, input_fn input, void *arg)
|
init_adapter(int adapter_num, char *mac_addr, input_fn input, void *arg)
|
||||||
{
|
{
|
||||||
void *AdapterList[MAX_NUM_ADAPTERS];
|
char *AdapterList[MAX_NUM_ADAPTERS];
|
||||||
int i;
|
int i;
|
||||||
char AdapterName[ADAPTER_NAME_LEN]; /* string that contains a list of the network adapters */
|
char AdapterName[ADAPTER_NAME_LEN]; /* string that contains a list of the network adapters */
|
||||||
int AdapterNum;
|
int AdapterNum;
|
||||||
@ -186,7 +186,7 @@ init_adapter(int adapter_num, char *mac_addr, input_fn input, void *arg)
|
|||||||
unsigned char ethaddr[ETHARP_HWADDR_LEN];
|
unsigned char ethaddr[ETHARP_HWADDR_LEN];
|
||||||
struct packet_adapter *pa;
|
struct packet_adapter *pa;
|
||||||
|
|
||||||
pa = malloc(sizeof(struct packet_adapter));
|
pa = (struct packet_adapter *)malloc(sizeof(struct packet_adapter));
|
||||||
if (!pa) {
|
if (!pa) {
|
||||||
printf("Unable to alloc the adapter!\n");
|
printf("Unable to alloc the adapter!\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -209,7 +209,7 @@ init_adapter(int adapter_num, char *mac_addr, input_fn input, void *arg)
|
|||||||
/* set up the selected adapter */
|
/* set up the selected adapter */
|
||||||
lpAdapter = PacketOpenAdapter(AdapterList[i]);
|
lpAdapter = PacketOpenAdapter(AdapterList[i]);
|
||||||
if (lpAdapter && (lpAdapter->hFile != INVALID_HANDLE_VALUE)) {
|
if (lpAdapter && (lpAdapter->hFile != INVALID_HANDLE_VALUE)) {
|
||||||
ppacket_oid_data = malloc(sizeof(PACKET_OID_DATA) + PACKET_OID_DATA_SIZE);
|
ppacket_oid_data = (PPACKET_OID_DATA)malloc(sizeof(PACKET_OID_DATA) + PACKET_OID_DATA_SIZE);
|
||||||
if (ppacket_oid_data) {
|
if (ppacket_oid_data) {
|
||||||
ppacket_oid_data->Oid = OID_GEN_VENDOR_DESCRIPTION;
|
ppacket_oid_data->Oid = OID_GEN_VENDOR_DESCRIPTION;
|
||||||
ppacket_oid_data->Length = PACKET_OID_DATA_SIZE;
|
ppacket_oid_data->Length = PACKET_OID_DATA_SIZE;
|
||||||
@ -242,7 +242,7 @@ init_adapter(int adapter_num, char *mac_addr, input_fn input, void *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* alloc the OID packet */
|
/* alloc the OID packet */
|
||||||
ppacket_oid_data = malloc(sizeof(PACKET_OID_DATA) + PACKET_OID_DATA_SIZE);
|
ppacket_oid_data = (PPACKET_OID_DATA)malloc(sizeof(PACKET_OID_DATA) + PACKET_OID_DATA_SIZE);
|
||||||
if (!ppacket_oid_data) {
|
if (!ppacket_oid_data) {
|
||||||
PacketCloseAdapter(pa->lpAdapter);
|
PacketCloseAdapter(pa->lpAdapter);
|
||||||
free(pa);
|
free(pa);
|
||||||
@ -362,7 +362,7 @@ ProcessPackets(void *adapter, LPPACKET lpPacket)
|
|||||||
|
|
||||||
ulBytesReceived = lpPacket->ulBytesReceived;
|
ulBytesReceived = lpPacket->ulBytesReceived;
|
||||||
|
|
||||||
buf = lpPacket->Buffer;
|
buf = (char*)lpPacket->Buffer;
|
||||||
|
|
||||||
off=0;
|
off=0;
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ link_adapter(void *adapter)
|
|||||||
NDIS_MEDIA_STATE fNdisMediaState = pa->fNdisMediaState;
|
NDIS_MEDIA_STATE fNdisMediaState = pa->fNdisMediaState;
|
||||||
|
|
||||||
/* get the media connect status of the selected adapter */
|
/* get the media connect status of the selected adapter */
|
||||||
ppacket_oid_data = malloc(sizeof(PACKET_OID_DATA) + sizeof(NDIS_MEDIA_STATE));
|
ppacket_oid_data = (PPACKET_OID_DATA)malloc(sizeof(PACKET_OID_DATA) + sizeof(NDIS_MEDIA_STATE));
|
||||||
if (ppacket_oid_data) {
|
if (ppacket_oid_data) {
|
||||||
ppacket_oid_data->Oid = OID_GEN_MEDIA_CONNECT_STATUS;
|
ppacket_oid_data->Oid = OID_GEN_MEDIA_CONNECT_STATUS;
|
||||||
ppacket_oid_data->Length = sizeof(NDIS_MEDIA_STATE);
|
ppacket_oid_data->Length = sizeof(NDIS_MEDIA_STATE);
|
||||||
|
@ -218,8 +218,7 @@ low_level_input(struct netif *netif, void *packet, int packet_len)
|
|||||||
if (((memcmp(ðhdr->dest, &netif->hwaddr, ETHARP_HWADDR_LEN)) &&
|
if (((memcmp(ðhdr->dest, &netif->hwaddr, ETHARP_HWADDR_LEN)) &&
|
||||||
((ethhdr->dest.addr[0] & 0x01) == 0)) ||
|
((ethhdr->dest.addr[0] & 0x01) == 0)) ||
|
||||||
/* and don't let feedback packets through (limitation in winpcap?) */
|
/* and don't let feedback packets through (limitation in winpcap?) */
|
||||||
((!memcmp(ðhdr->src, netif->hwaddr, ETHARP_HWADDR_LEN)) &&
|
(!memcmp(ðhdr->src, netif->hwaddr, ETHARP_HWADDR_LEN))) {
|
||||||
((ethhdr->dest.addr[0] & 0x01) == 0))) {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +278,7 @@ ethernetif_input(struct netif *netif, void *packet, int packet_len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* points to packet payload, which starts with an Ethernet header */
|
/* points to packet payload, which starts with an Ethernet header */
|
||||||
ethhdr = p->payload;
|
ethhdr = (struct eth_hdr *)p->payload;
|
||||||
switch (htons(ethhdr->type)) {
|
switch (htons(ethhdr->type)) {
|
||||||
/* IP or ARP packet? */
|
/* IP or ARP packet? */
|
||||||
case ETHTYPE_IP:
|
case ETHTYPE_IP:
|
||||||
|
Loading…
Reference in New Issue
Block a user