Fixing more warnings (Paul Stoffregen).

This commit is contained in:
David A. Mellis 2011-10-10 11:28:44 -04:00
parent 965480f148
commit ca671fdc05
10 changed files with 19 additions and 18 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -27,7 +27,6 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/delay.h>
#include <stdio.h>
#include <stdarg.h>

View File

@ -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) {

View File

@ -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.

View File

@ -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);

View File

@ -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;

View File

@ -23,6 +23,7 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include <compat/twi.h>
#include "Arduino.h" // for digitalWrite
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))