diff --git a/hardware/arduino/cores/arduino/HardwareSerial.cpp b/hardware/arduino/cores/arduino/HardwareSerial.cpp index b5992ad6f..1b1fa71d8 100644 --- a/hardware/arduino/cores/arduino/HardwareSerial.cpp +++ b/hardware/arduino/cores/arduino/HardwareSerial.cpp @@ -91,7 +91,7 @@ inline void store_char(unsigned char c, ring_buffer *buffer) #if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \ !defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \ !defined(SIG_UART_RECV) - #error Don't know what the Data Received vector is called for the first UART + #error "Don't know what the Data Received vector is called for the first UART" #else void serialEvent() __attribute__((weak)); void serialEvent() {} @@ -180,7 +180,7 @@ void serialEventRun(void) // do nothing - on the 32u4 the first USART is USART1 #else #if !defined(UART0_UDRE_vect) && !defined(UART_UDRE_vect) && !defined(USART0_UDRE_vect) && !defined(USART_UDRE_vect) - #error Don't know what the Data Register Empty vector is called for the first UART + #error "Don't know what the Data Register Empty vector is called for the first UART" #else #if defined(UART0_UDRE_vect) ISR(UART0_UDRE_vect) diff --git a/hardware/arduino/cores/arduino/Print.cpp b/hardware/arduino/cores/arduino/Print.cpp index 500de8cf3..ff9b15459 100755 --- a/hardware/arduino/cores/arduino/Print.cpp +++ b/hardware/arduino/cores/arduino/Print.cpp @@ -54,7 +54,7 @@ size_t Print::print(const __FlashStringHelper *ifsh) size_t Print::print(const String &s) { size_t n = 0; - for (int i = 0; i < s.length(); i++) { + for (uint16_t i = 0; i < s.length(); i++) { n += write(s[i]); } return n; diff --git a/hardware/arduino/cores/arduino/WString.cpp b/hardware/arduino/cores/arduino/WString.cpp index f90cef01e..ad8d8289f 100644 --- a/hardware/arduino/cores/arduino/WString.cpp +++ b/hardware/arduino/cores/arduino/WString.cpp @@ -498,7 +498,7 @@ int String::lastIndexOf( char theChar ) const return lastIndexOf(theChar, len - 1); } -int String::lastIndexOf(char ch, int fromIndex) const +int String::lastIndexOf(char ch, unsigned int fromIndex) const { if (fromIndex >= len || fromIndex < 0) return -1; char tempchar = buffer[fromIndex + 1]; @@ -514,7 +514,7 @@ int String::lastIndexOf(const String &s2) const return lastIndexOf(s2, len - s2.len); } -int String::lastIndexOf(const String &s2, int fromIndex) const +int String::lastIndexOf(const String &s2, unsigned int fromIndex) const { if (s2.len == 0 || len == 0 || s2.len > len || fromIndex < 0) return -1; if (fromIndex >= len) fromIndex = len - 1; @@ -522,7 +522,7 @@ int String::lastIndexOf(const String &s2, int fromIndex) const for (char *p = buffer; p <= buffer + fromIndex; p++) { p = strstr(p, s2.buffer); if (!p) break; - if (p - buffer <= fromIndex) found = p - buffer; + if ((unsigned int)(p - buffer) <= fromIndex) found = p - buffer; } return found; } diff --git a/hardware/arduino/cores/arduino/WString.h b/hardware/arduino/cores/arduino/WString.h index a601aca93..d76d2a33d 100644 --- a/hardware/arduino/cores/arduino/WString.h +++ b/hardware/arduino/cores/arduino/WString.h @@ -154,9 +154,9 @@ public: int indexOf( const String &str ) const; int indexOf( const String &str, unsigned int fromIndex ) const; int lastIndexOf( char ch ) const; - int lastIndexOf( char ch, int fromIndex ) const; + int lastIndexOf( char ch, unsigned int fromIndex ) const; int lastIndexOf( const String &str ) const; - int lastIndexOf( const String &str, int fromIndex ) const; + int lastIndexOf( const String &str, unsigned int fromIndex ) const; String substring( unsigned int beginIndex ) const; String substring( unsigned int beginIndex, unsigned int endIndex ) const; diff --git a/hardware/arduino/cores/arduino/wiring_private.h b/hardware/arduino/cores/arduino/wiring_private.h index 74c0d06a2..41d1d40f6 100755 --- a/hardware/arduino/cores/arduino/wiring_private.h +++ b/hardware/arduino/cores/arduino/wiring_private.h @@ -27,7 +27,6 @@ #include #include -#include #include #include diff --git a/libraries/SD/File.cpp b/libraries/SD/File.cpp index e0ef30a9c..88d9e9ac9 100644 --- a/libraries/SD/File.cpp +++ b/libraries/SD/File.cpp @@ -18,7 +18,7 @@ uint8_t nfilecount=0; */ -File::File(SdFile f, char *n) { +File::File(SdFile f, const char *n) { // oh man you are kidding me, new() doesnt exist? Ok we do it by hand! _file = (SdFile *)malloc(sizeof(SdFile)); if (_file) { diff --git a/libraries/SD/SD.cpp b/libraries/SD/SD.cpp index 64dc40b98..c746809b6 100644 --- a/libraries/SD/SD.cpp +++ b/libraries/SD/SD.cpp @@ -348,7 +348,7 @@ boolean SDClass::begin(uint8_t csPin) { // this little helper is used to traverse paths -SdFile SDClass::getParentDir(char *filepath, int *index) { +SdFile SDClass::getParentDir(const char *filepath, int *index) { // get parent directory SdFile d1 = root; // start with the mostparent, root! SdFile d2; @@ -357,7 +357,7 @@ SdFile SDClass::getParentDir(char *filepath, int *index) { SdFile *parent = &d1; SdFile *subdir = &d2; - char *origpath = filepath; + const char *origpath = filepath; while (strchr(filepath, '/')) { @@ -404,7 +404,7 @@ SdFile SDClass::getParentDir(char *filepath, int *index) { } -File SDClass::open(char *filepath, uint8_t mode) { +File SDClass::open(const char *filepath, uint8_t mode) { /* Open the supplied file path for reading or writing. diff --git a/libraries/SD/SD.h b/libraries/SD/SD.h index b4e46ccce..f21ec0f29 100644 --- a/libraries/SD/SD.h +++ b/libraries/SD/SD.h @@ -29,7 +29,7 @@ class File : public Stream { SdFile *_file; // underlying file pointer public: - File(SdFile f, char *name); // wraps an underlying SdFile + File(SdFile f, const char *name); // wraps an underlying SdFile File(void); // 'empty' constructor ~File(void); // destructor virtual size_t write(uint8_t); @@ -62,7 +62,7 @@ private: SdFile root; // my quick&dirty iterator, should be replaced - SdFile getParentDir(char *filepath, int *indx); + SdFile getParentDir(const char *filepath, int *indx); public: // This needs to be called to set up the connection to the SD card // before other methods are used. @@ -71,7 +71,7 @@ public: // Open the specified file/directory with the supplied mode (e.g. read or // write, etc). Returns a File object for interacting with the file. // Note that currently only one file can be open at a time. - File open(char *filename, uint8_t mode = FILE_READ); + File open(const char *filename, uint8_t mode = FILE_READ); // Methods to determine if the requested file path exists. boolean exists(char *filepath); diff --git a/libraries/SD/utility/SdFatUtil.h b/libraries/SD/utility/SdFatUtil.h index c626bfeb9..283fcb21a 100644 --- a/libraries/SD/utility/SdFatUtil.h +++ b/libraries/SD/utility/SdFatUtil.h @@ -30,10 +30,11 @@ /** Store and print a string in flash memory followed by a CR/LF.*/ #define PgmPrintln(x) SerialPrintln_P(PSTR(x)) /** Defined so doxygen works for function definitions. */ -#define NOINLINE __attribute__((noinline)) +#define NOINLINE __attribute__((noinline,unused)) +#define UNUSEDOK __attribute__((unused)) //------------------------------------------------------------------------------ /** Return the number of bytes currently free in RAM. */ -static int FreeRam(void) { +static UNUSEDOK int FreeRam(void) { extern int __bss_end; extern int* __brkval; int free_memory; diff --git a/libraries/Wire/utility/twi.c b/libraries/Wire/utility/twi.c index 120d77a27..d80114b6e 100644 --- a/libraries/Wire/utility/twi.c +++ b/libraries/Wire/utility/twi.c @@ -23,6 +23,7 @@ #include #include #include +#include "Arduino.h" // for digitalWrite #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))