* Add some assertions.

This commit is contained in:
bg- 2007-01-12 18:16:56 +00:00
parent 519f0468e7
commit f51c7f03df
1 changed files with 10 additions and 3 deletions

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: tcp_loader2.c,v 1.1 2007/01/05 17:46:26 bg- Exp $ * @(#)$Id: tcp_loader2.c,v 1.2 2007/01/12 18:16:56 bg- Exp $
*/ */
#include <stdio.h> #include <stdio.h>
@ -44,6 +44,9 @@
#include "dev/xmem.h" #include "dev/xmem.h"
#define NDEBUG
#include "lib/assert.h"
#include "codeprop.h" #include "codeprop.h"
#define PRINTF(x) #define PRINTF(x)
@ -61,6 +64,8 @@ struct codeprop_state {
static static
PT_THREAD(recv_tcpthread(struct pt *pt)) PT_THREAD(recv_tcpthread(struct pt *pt))
{ {
register int ret;
PT_BEGIN(pt); PT_BEGIN(pt);
/* Read the header. */ /* Read the header. */
@ -77,12 +82,14 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
uip_appdata += sizeof(struct codeprop_tcphdr); uip_appdata += sizeof(struct codeprop_tcphdr);
uip_len -= sizeof(struct codeprop_tcphdr); uip_len -= sizeof(struct codeprop_tcphdr);
xmem_erase(XMEM_ERASE_UNIT_SIZE, EEPROMFS_ADDR_CODEPROP); ret = xmem_erase(XMEM_ERASE_UNIT_SIZE, EEPROMFS_ADDR_CODEPROP);
assert(ret == 0);
/* Read the rest of the data. */ /* Read the rest of the data. */
do { do {
if(uip_len > 0) { if(uip_len > 0) {
xmem_pwrite(uip_appdata, uip_len, EEPROMFS_ADDR_CODEPROP + s.addr); ret = xmem_pwrite(uip_appdata, uip_len, EEPROMFS_ADDR_CODEPROP + s.addr);
assert(ret = uip_len);
s.addr += uip_len; s.addr += uip_len;
} }
if(s.addr < s.len) { if(s.addr < s.len) {