Fixed compiler warnings when MEM_SIZE < 64000

This commit is contained in:
goldsimon 2010-02-02 20:14:05 +00:00
parent 30d69d68e3
commit 9ff7d29696
3 changed files with 9 additions and 9 deletions

View File

@ -342,7 +342,7 @@ dns_init_local()
struct local_hostlist_entry *init_entry = &local_hostlist_init[i];
LWIP_ASSERT("invalid host name (NULL)", init_entry->name != NULL);
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);
if (entry != NULL) {
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;
LWIP_ASSERT("invalid host name (NULL)", hostname != NULL);
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) {
return ERR_MEM;
}

View File

@ -248,7 +248,7 @@ plug_holes(struct mem *mem)
lfree = mem;
}
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 */
@ -259,7 +259,7 @@ plug_holes(struct mem *mem)
lfree = pmem;
}
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;
}
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 */
plug_holes(mem);
@ -398,7 +398,7 @@ mem_realloc(void *rmem, mem_size_t newsize)
/* Get the corresponding struct mem ... */
mem = (struct mem *)((u8_t *)rmem - SIZEOF_STRUCT_MEM);
/* ... and its offset pointer */
ptr = (u8_t *)mem - ram;
ptr = (mem_size_t)((u8_t *)mem - ram);
size = mem->next - ptr - SIZEOF_STRUCT_MEM;
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,
* 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) {
mem = (struct mem *)&ram[ptr];
#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!
*/
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) {

View File

@ -383,7 +383,7 @@ pbuf_realloc(struct pbuf *p, u16_t new_len)
/* (other types merely adjust their length fields */
if ((q->type == PBUF_RAM) && (rem_len != q->len)) {
/* 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);
}
/* adjust length fields for new last pbuf */