1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-18 07:52:14 +01:00

Fixing warnings in Ethernet library (Paul Stoffregen).

http://code.google.com/p/arduino/issues/detail?id=208
This commit is contained in:
David A. Mellis 2011-10-02 10:17:33 -04:00
parent 85c109f255
commit 965480f148
8 changed files with 12 additions and 13 deletions

View File

@ -243,7 +243,7 @@ uint8_t DhcpClass::parseDHCPResponse(unsigned long responseTimeout, uint32_t& tr
// Skip to the option part
// Doing this a byte at a time so we don't have to put a big buffer
// on the stack (as we don't have lots of memory lying around)
for (int i =0; i < (240 - sizeof(RIP_MSG_FIXED)); i++)
for (int i =0; i < (240 - (int)sizeof(RIP_MSG_FIXED)); i++)
{
_dhcpUdpSocket.read(); // we don't care about the returned byte
}

View File

@ -252,7 +252,7 @@ uint16_t DNSClient::BuildRequest(const char* aName)
}
uint16_t DNSClient::ProcessResponse(int aTimeout, IPAddress& aAddress)
uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
{
uint32_t startTime = millis();
@ -285,7 +285,7 @@ uint16_t DNSClient::ProcessResponse(int aTimeout, IPAddress& aAddress)
uint16_t header_flags = htons(*((uint16_t*)&header[2]));
// Check that it's a response to this request
if ( ( iRequestId != (*((uint16_t*)&header[0])) ) ||
(header_flags & QUERY_RESPONSE_MASK != RESPONSE_FLAG) )
((header_flags & QUERY_RESPONSE_MASK) != (uint16_t)RESPONSE_FLAG) )
{
// Mark the entire packet as read
iUdp.flush();
@ -310,7 +310,7 @@ uint16_t DNSClient::ProcessResponse(int aTimeout, IPAddress& aAddress)
}
// Skip over any questions
for (int i =0; i < htons(*((uint16_t*)&header[4])); i++)
for (uint16_t i =0; i < htons(*((uint16_t*)&header[4])); i++)
{
// Skip over the name
uint8_t len;
@ -340,7 +340,7 @@ uint16_t DNSClient::ProcessResponse(int aTimeout, IPAddress& aAddress)
// type A answer) and some authority and additional resource records but
// we're going to ignore all of them.
for (int i =0; i < answerCount; i++)
for (uint16_t i =0; i < answerCount; i++)
{
// Skip the name
uint8_t len;
@ -407,7 +407,7 @@ uint16_t DNSClient::ProcessResponse(int aTimeout, IPAddress& aAddress)
else
{
// This isn't an answer type we're after, move onto the next one
for (int i =0; i < htons(header_flags); i++)
for (uint16_t i =0; i < htons(header_flags); i++)
{
iUdp.read(); // we don't care about the returned byte
}

View File

@ -31,7 +31,7 @@ public:
protected:
uint16_t BuildRequest(const char* aName);
uint16_t ProcessResponse(int aTimeout, IPAddress& aAddress);
uint16_t ProcessResponse(uint16_t aTimeout, IPAddress& aAddress);
IPAddress iDNSServer;
uint16_t iRequestId;

View File

@ -69,7 +69,7 @@ EthernetClient EthernetServer::available()
size_t EthernetServer::write(uint8_t b)
{
write(&b, 1);
return write(&b, 1);
}
size_t EthernetServer::write(const uint8_t *buffer, size_t size)

View File

@ -1,7 +1,7 @@
#ifndef UTIL_H
#define UTIL_H
#define htons(x) ( (x)<<8 | ((x)>>8)&0xFF )
#define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) )
#define ntohs(x) htons(x)
#define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \

View File

@ -9,7 +9,6 @@ static uint16_t local_port;
*/
uint8_t socket(SOCKET s, uint8_t protocol, uint16_t port, uint8_t flag)
{
uint8_t ret;
if ((protocol == SnMR::TCP) || (protocol == SnMR::UDP) || (protocol == SnMR::IPRAW) || (protocol == SnMR::MACRAW) || (protocol == SnMR::PPPOE))
{
close(s);

View File

@ -140,7 +140,7 @@ uint8_t W5100Class::write(uint16_t _addr, uint8_t _data)
uint16_t W5100Class::write(uint16_t _addr, const uint8_t *_buf, uint16_t _len)
{
for (int i=0; i<_len; i++)
for (uint16_t i=0; i<_len; i++)
{
setSS();
SPI.transfer(0xF0);
@ -166,7 +166,7 @@ uint8_t W5100Class::read(uint16_t _addr)
uint16_t W5100Class::read(uint16_t _addr, uint8_t *_buf, uint16_t _len)
{
for (int i=0; i<_len; i++)
for (uint16_t i=0; i<_len; i++)
{
setSS();
SPI.transfer(0x0F);

View File

@ -22,7 +22,7 @@
#define SPI_CLOCK_DIV2 0x04
#define SPI_CLOCK_DIV8 0x05
#define SPI_CLOCK_DIV32 0x06
#define SPI_CLOCK_DIV64 0x07
//#define SPI_CLOCK_DIV64 0x07
#define SPI_MODE0 0x00
#define SPI_MODE1 0x04