Silence signed/unsigned comparison warnings in GCC

The dn variable in lpc_low_level_output() was originally defined as a
u32_t but it is later compared to the s32_t return value from
lpc_tx_ready().  Since it is intialized to pbuf_clean() which returns
a u8_t, a s32_t type can safely hold the initial value and remains
consistent with the signed lpc_tx_ready() comparison.

I also modifed writtenLen in TCPSocketConnection::send_all() and
readLen in TCPSocketConnection::recieve_all() to be of type int instead
of size_t.  This is more consistent with their usage within these
methods (they accumulate int ret values and are compared to the int
length value) and their use as a signed integer return values.
pull/31/head
Adam Green 2013-08-13 20:50:02 -07:00
parent aa7a55b6dd
commit e014b41377
2 changed files with 5 additions and 5 deletions

View File

@ -618,14 +618,14 @@ static err_t lpc_low_level_output(struct netif *netif, struct pbuf *p)
struct lpc_enetdata *lpc_enetif = netif->state; struct lpc_enetdata *lpc_enetif = netif->state;
struct pbuf *q; struct pbuf *q;
u8_t *dst; u8_t *dst;
u32_t idx; u32_t idx, notdmasafe = 0;
struct pbuf *np; struct pbuf *np;
u32_t dn, notdmasafe = 0; s32_t dn;
/* Zero-copy TX buffers may be fragmented across mutliple payload /* Zero-copy TX buffers may be fragmented across mutliple payload
chains. Determine the number of descriptors needed for the chains. Determine the number of descriptors needed for the
transfer. The pbuf chaining can be a mess! */ transfer. The pbuf chaining can be a mess! */
dn = (u32_t) pbuf_clen(p); dn = (s32_t) pbuf_clen(p);
/* Test to make sure packet addresses are DMA safe. A DMA safe /* Test to make sure packet addresses are DMA safe. A DMA safe
address is once that uses external memory or periphheral RAM. address is once that uses external memory or periphheral RAM.

View File

@ -66,7 +66,7 @@ int TCPSocketConnection::send_all(char* data, int length) {
if ((_sock_fd < 0) || !_is_connected) if ((_sock_fd < 0) || !_is_connected)
return -1; return -1;
size_t writtenLen = 0; int writtenLen = 0;
TimeInterval timeout(_timeout); TimeInterval timeout(_timeout);
while (writtenLen < length) { while (writtenLen < length) {
if (!_blocking) { if (!_blocking) {
@ -110,7 +110,7 @@ int TCPSocketConnection::receive_all(char* data, int length) {
if ((_sock_fd < 0) || !_is_connected) if ((_sock_fd < 0) || !_is_connected)
return -1; return -1;
size_t readLen = 0; int readLen = 0;
TimeInterval timeout(_timeout); TimeInterval timeout(_timeout);
while (readLen < length) { while (readLen < length) {
if (!_blocking) { if (!_blocking) {