Skip to content

Commit 83d1278

Browse files
committed
Fixing warnings in Ethernet library (Paul Stoffregen).
http://code.google.com/p/arduino/issues/detail?id=208
1 parent b78df36 commit 83d1278

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

Dhcp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ uint8_t DhcpClass::parseDHCPResponse(unsigned long responseTimeout, uint32_t& tr
243243
// Skip to the option part
244244
// Doing this a byte at a time so we don't have to put a big buffer
245245
// on the stack (as we don't have lots of memory lying around)
246-
for (int i =0; i < (240 - sizeof(RIP_MSG_FIXED)); i++)
246+
for (int i =0; i < (240 - (int)sizeof(RIP_MSG_FIXED)); i++)
247247
{
248248
_dhcpUdpSocket.read(); // we don't care about the returned byte
249249
}

Dns.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ uint16_t DNSClient::BuildRequest(const char* aName)
252252
}
253253

254254

255-
uint16_t DNSClient::ProcessResponse(int aTimeout, IPAddress& aAddress)
255+
uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
256256
{
257257
uint32_t startTime = millis();
258258

@@ -285,7 +285,7 @@ uint16_t DNSClient::ProcessResponse(int aTimeout, IPAddress& aAddress)
285285
uint16_t header_flags = htons(*((uint16_t*)&header[2]));
286286
// Check that it's a response to this request
287287
if ( ( iRequestId != (*((uint16_t*)&header[0])) ) ||
288-
(header_flags & QUERY_RESPONSE_MASK != RESPONSE_FLAG) )
288+
((header_flags & QUERY_RESPONSE_MASK) != (uint16_t)RESPONSE_FLAG) )
289289
{
290290
// Mark the entire packet as read
291291
iUdp.flush();
@@ -310,7 +310,7 @@ uint16_t DNSClient::ProcessResponse(int aTimeout, IPAddress& aAddress)
310310
}
311311

312312
// Skip over any questions
313-
for (int i =0; i < htons(*((uint16_t*)&header[4])); i++)
313+
for (uint16_t i =0; i < htons(*((uint16_t*)&header[4])); i++)
314314
{
315315
// Skip over the name
316316
uint8_t len;
@@ -340,7 +340,7 @@ uint16_t DNSClient::ProcessResponse(int aTimeout, IPAddress& aAddress)
340340
// type A answer) and some authority and additional resource records but
341341
// we're going to ignore all of them.
342342

343-
for (int i =0; i < answerCount; i++)
343+
for (uint16_t i =0; i < answerCount; i++)
344344
{
345345
// Skip the name
346346
uint8_t len;
@@ -407,7 +407,7 @@ uint16_t DNSClient::ProcessResponse(int aTimeout, IPAddress& aAddress)
407407
else
408408
{
409409
// This isn't an answer type we're after, move onto the next one
410-
for (int i =0; i < htons(header_flags); i++)
410+
for (uint16_t i =0; i < htons(header_flags); i++)
411411
{
412412
iUdp.read(); // we don't care about the returned byte
413413
}

Dns.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class DNSClient
3131

3232
protected:
3333
uint16_t BuildRequest(const char* aName);
34-
uint16_t ProcessResponse(int aTimeout, IPAddress& aAddress);
34+
uint16_t ProcessResponse(uint16_t aTimeout, IPAddress& aAddress);
3535

3636
IPAddress iDNSServer;
3737
uint16_t iRequestId;

EthernetServer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ EthernetClient EthernetServer::available()
6969

7070
size_t EthernetServer::write(uint8_t b)
7171
{
72-
write(&b, 1);
72+
return write(&b, 1);
7373
}
7474

7575
size_t EthernetServer::write(const uint8_t *buffer, size_t size)

util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef UTIL_H
22
#define UTIL_H
33

4-
#define htons(x) ( (x)<<8 | ((x)>>8)&0xFF )
4+
#define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) )
55
#define ntohs(x) htons(x)
66

77
#define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \

utility/socket.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ static uint16_t local_port;
99
*/
1010
uint8_t socket(SOCKET s, uint8_t protocol, uint16_t port, uint8_t flag)
1111
{
12-
uint8_t ret;
1312
if ((protocol == SnMR::TCP) || (protocol == SnMR::UDP) || (protocol == SnMR::IPRAW) || (protocol == SnMR::MACRAW) || (protocol == SnMR::PPPOE))
1413
{
1514
close(s);

utility/w5100.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ uint8_t W5100Class::write(uint16_t _addr, uint8_t _data)
140140

141141
uint16_t W5100Class::write(uint16_t _addr, const uint8_t *_buf, uint16_t _len)
142142
{
143-
for (int i=0; i<_len; i++)
143+
for (uint16_t i=0; i<_len; i++)
144144
{
145145
setSS();
146146
SPI.transfer(0xF0);
@@ -166,7 +166,7 @@ uint8_t W5100Class::read(uint16_t _addr)
166166

167167
uint16_t W5100Class::read(uint16_t _addr, uint8_t *_buf, uint16_t _len)
168168
{
169-
for (int i=0; i<_len; i++)
169+
for (uint16_t i=0; i<_len; i++)
170170
{
171171
setSS();
172172
SPI.transfer(0x0F);

0 commit comments

Comments
 (0)