mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-05 15:39:54 +00:00
Fixed compiler warnings when MEM_SIZE < 64000
This commit is contained in:
parent
30d69d68e3
commit
9ff7d29696
@ -342,7 +342,7 @@ dns_init_local()
|
|||||||
struct local_hostlist_entry *init_entry = &local_hostlist_init[i];
|
struct local_hostlist_entry *init_entry = &local_hostlist_init[i];
|
||||||
LWIP_ASSERT("invalid host name (NULL)", init_entry->name != NULL);
|
LWIP_ASSERT("invalid host name (NULL)", init_entry->name != NULL);
|
||||||
namelen = strlen(init_entry->name);
|
namelen = strlen(init_entry->name);
|
||||||
entry = mem_malloc(sizeof(struct local_hostlist_entry) + namelen + 1);
|
entry = mem_malloc((mem_size_t)(sizeof(struct local_hostlist_entry) + namelen + 1));
|
||||||
LWIP_ASSERT("mem-error in dns_init_local", entry != NULL);
|
LWIP_ASSERT("mem-error in dns_init_local", entry != NULL);
|
||||||
if (entry != NULL) {
|
if (entry != NULL) {
|
||||||
entry->name = (char*)entry + sizeof(struct local_hostlist_entry);
|
entry->name = (char*)entry + sizeof(struct local_hostlist_entry);
|
||||||
@ -436,7 +436,7 @@ dns_local_addhost(const char *hostname, const struct ip_addr *addr)
|
|||||||
size_t namelen;
|
size_t namelen;
|
||||||
LWIP_ASSERT("invalid host name (NULL)", hostname != NULL);
|
LWIP_ASSERT("invalid host name (NULL)", hostname != NULL);
|
||||||
namelen = strlen(hostname);
|
namelen = strlen(hostname);
|
||||||
entry = mem_malloc(sizeof(struct local_hostlist_entry) + namelen + 1);
|
entry = mem_malloc((mem_size_t)(sizeof(struct local_hostlist_entry) + namelen + 1));
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ plug_holes(struct mem *mem)
|
|||||||
lfree = mem;
|
lfree = mem;
|
||||||
}
|
}
|
||||||
mem->next = nmem->next;
|
mem->next = nmem->next;
|
||||||
((struct mem *)&ram[nmem->next])->prev = (u8_t *)mem - ram;
|
((struct mem *)&ram[nmem->next])->prev = (mem_size_t)((u8_t *)mem - ram);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* plug hole backward */
|
/* plug hole backward */
|
||||||
@ -259,7 +259,7 @@ plug_holes(struct mem *mem)
|
|||||||
lfree = pmem;
|
lfree = pmem;
|
||||||
}
|
}
|
||||||
pmem->next = mem->next;
|
pmem->next = mem->next;
|
||||||
((struct mem *)&ram[mem->next])->prev = (u8_t *)pmem - ram;
|
((struct mem *)&ram[mem->next])->prev = (mem_size_t)((u8_t *)pmem - ram);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ mem_free(void *rmem)
|
|||||||
lfree = mem;
|
lfree = mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
MEM_STATS_DEC_USED(used, mem->next - ((u8_t *)mem - ram));
|
MEM_STATS_DEC_USED(used, mem->next - (mem_size_t)(((u8_t *)mem - ram)));
|
||||||
|
|
||||||
/* finally, see if prev or next are free also */
|
/* finally, see if prev or next are free also */
|
||||||
plug_holes(mem);
|
plug_holes(mem);
|
||||||
@ -398,7 +398,7 @@ mem_realloc(void *rmem, mem_size_t newsize)
|
|||||||
/* Get the corresponding struct mem ... */
|
/* Get the corresponding struct mem ... */
|
||||||
mem = (struct mem *)((u8_t *)rmem - SIZEOF_STRUCT_MEM);
|
mem = (struct mem *)((u8_t *)rmem - SIZEOF_STRUCT_MEM);
|
||||||
/* ... and its offset pointer */
|
/* ... and its offset pointer */
|
||||||
ptr = (u8_t *)mem - ram;
|
ptr = (mem_size_t)((u8_t *)mem - ram);
|
||||||
|
|
||||||
size = mem->next - ptr - SIZEOF_STRUCT_MEM;
|
size = mem->next - ptr - SIZEOF_STRUCT_MEM;
|
||||||
LWIP_ASSERT("mem_realloc can only shrink memory", newsize <= size);
|
LWIP_ASSERT("mem_realloc can only shrink memory", newsize <= size);
|
||||||
@ -525,7 +525,7 @@ mem_malloc(mem_size_t size)
|
|||||||
/* Scan through the heap searching for a free block that is big enough,
|
/* Scan through the heap searching for a free block that is big enough,
|
||||||
* beginning with the lowest free block.
|
* beginning with the lowest free block.
|
||||||
*/
|
*/
|
||||||
for (ptr = (u8_t *)lfree - ram; ptr < MEM_SIZE_ALIGNED - size;
|
for (ptr = (mem_size_t)((u8_t *)lfree - ram); ptr < MEM_SIZE_ALIGNED - size;
|
||||||
ptr = ((struct mem *)&ram[ptr])->next) {
|
ptr = ((struct mem *)&ram[ptr])->next) {
|
||||||
mem = (struct mem *)&ram[ptr];
|
mem = (struct mem *)&ram[ptr];
|
||||||
#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT
|
#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT
|
||||||
@ -578,7 +578,7 @@ mem_malloc(mem_size_t size)
|
|||||||
* will always be used at this point!
|
* will always be used at this point!
|
||||||
*/
|
*/
|
||||||
mem->used = 1;
|
mem->used = 1;
|
||||||
MEM_STATS_INC_USED(used, mem->next - ((u8_t *)mem - ram));
|
MEM_STATS_INC_USED(used, mem->next - (mem_size_t)((u8_t *)mem - ram));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mem == lfree) {
|
if (mem == lfree) {
|
||||||
|
@ -383,7 +383,7 @@ pbuf_realloc(struct pbuf *p, u16_t new_len)
|
|||||||
/* (other types merely adjust their length fields */
|
/* (other types merely adjust their length fields */
|
||||||
if ((q->type == PBUF_RAM) && (rem_len != q->len)) {
|
if ((q->type == PBUF_RAM) && (rem_len != q->len)) {
|
||||||
/* reallocate and adjust the length of the pbuf that will be split */
|
/* reallocate and adjust the length of the pbuf that will be split */
|
||||||
q = (struct pbuf *)mem_realloc(q, (u8_t *)q->payload - (u8_t *)q + rem_len);
|
q = (struct pbuf *)mem_realloc(q, (u16_t)((u8_t *)q->payload - (u8_t *)q) + rem_len);
|
||||||
LWIP_ASSERT("mem_realloc give q == NULL", q != NULL);
|
LWIP_ASSERT("mem_realloc give q == NULL", q != NULL);
|
||||||
}
|
}
|
||||||
/* adjust length fields for new last pbuf */
|
/* adjust length fields for new last pbuf */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user