Skip to content

Commit ca671fd

Browse files
committed
Fixing more warnings (Paul Stoffregen).
1 parent 965480f commit ca671fd

File tree

10 files changed

+19
-18
lines changed

10 files changed

+19
-18
lines changed

hardware/arduino/cores/arduino/HardwareSerial.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
9191
#if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \
9292
!defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \
9393
!defined(SIG_UART_RECV)
94-
#error Don't know what the Data Received vector is called for the first UART
94+
#error "Don't know what the Data Received vector is called for the first UART"
9595
#else
9696
void serialEvent() __attribute__((weak));
9797
void serialEvent() {}
@@ -180,7 +180,7 @@ void serialEventRun(void)
180180
// do nothing - on the 32u4 the first USART is USART1
181181
#else
182182
#if !defined(UART0_UDRE_vect) && !defined(UART_UDRE_vect) && !defined(USART0_UDRE_vect) && !defined(USART_UDRE_vect)
183-
#error Don't know what the Data Register Empty vector is called for the first UART
183+
#error "Don't know what the Data Register Empty vector is called for the first UART"
184184
#else
185185
#if defined(UART0_UDRE_vect)
186186
ISR(UART0_UDRE_vect)

hardware/arduino/cores/arduino/Print.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ size_t Print::print(const __FlashStringHelper *ifsh)
5454
size_t Print::print(const String &s)
5555
{
5656
size_t n = 0;
57-
for (int i = 0; i < s.length(); i++) {
57+
for (uint16_t i = 0; i < s.length(); i++) {
5858
n += write(s[i]);
5959
}
6060
return n;

hardware/arduino/cores/arduino/WString.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ int String::lastIndexOf( char theChar ) const
498498
return lastIndexOf(theChar, len - 1);
499499
}
500500

501-
int String::lastIndexOf(char ch, int fromIndex) const
501+
int String::lastIndexOf(char ch, unsigned int fromIndex) const
502502
{
503503
if (fromIndex >= len || fromIndex < 0) return -1;
504504
char tempchar = buffer[fromIndex + 1];
@@ -514,15 +514,15 @@ int String::lastIndexOf(const String &s2) const
514514
return lastIndexOf(s2, len - s2.len);
515515
}
516516

517-
int String::lastIndexOf(const String &s2, int fromIndex) const
517+
int String::lastIndexOf(const String &s2, unsigned int fromIndex) const
518518
{
519519
if (s2.len == 0 || len == 0 || s2.len > len || fromIndex < 0) return -1;
520520
if (fromIndex >= len) fromIndex = len - 1;
521521
int found = -1;
522522
for (char *p = buffer; p <= buffer + fromIndex; p++) {
523523
p = strstr(p, s2.buffer);
524524
if (!p) break;
525-
if (p - buffer <= fromIndex) found = p - buffer;
525+
if ((unsigned int)(p - buffer) <= fromIndex) found = p - buffer;
526526
}
527527
return found;
528528
}

hardware/arduino/cores/arduino/WString.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ class String
154154
int indexOf( const String &str ) const;
155155
int indexOf( const String &str, unsigned int fromIndex ) const;
156156
int lastIndexOf( char ch ) const;
157-
int lastIndexOf( char ch, int fromIndex ) const;
157+
int lastIndexOf( char ch, unsigned int fromIndex ) const;
158158
int lastIndexOf( const String &str ) const;
159-
int lastIndexOf( const String &str, int fromIndex ) const;
159+
int lastIndexOf( const String &str, unsigned int fromIndex ) const;
160160
String substring( unsigned int beginIndex ) const;
161161
String substring( unsigned int beginIndex, unsigned int endIndex ) const;
162162

hardware/arduino/cores/arduino/wiring_private.h

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
#include <avr/io.h>
2929
#include <avr/interrupt.h>
30-
#include <avr/delay.h>
3130
#include <stdio.h>
3231
#include <stdarg.h>
3332

libraries/SD/File.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
uint8_t nfilecount=0;
1919
*/
2020

21-
File::File(SdFile f, char *n) {
21+
File::File(SdFile f, const char *n) {
2222
// oh man you are kidding me, new() doesnt exist? Ok we do it by hand!
2323
_file = (SdFile *)malloc(sizeof(SdFile));
2424
if (_file) {

libraries/SD/SD.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ boolean SDClass::begin(uint8_t csPin) {
348348

349349

350350
// this little helper is used to traverse paths
351-
SdFile SDClass::getParentDir(char *filepath, int *index) {
351+
SdFile SDClass::getParentDir(const char *filepath, int *index) {
352352
// get parent directory
353353
SdFile d1 = root; // start with the mostparent, root!
354354
SdFile d2;
@@ -357,7 +357,7 @@ SdFile SDClass::getParentDir(char *filepath, int *index) {
357357
SdFile *parent = &d1;
358358
SdFile *subdir = &d2;
359359

360-
char *origpath = filepath;
360+
const char *origpath = filepath;
361361

362362
while (strchr(filepath, '/')) {
363363

@@ -404,7 +404,7 @@ SdFile SDClass::getParentDir(char *filepath, int *index) {
404404
}
405405

406406

407-
File SDClass::open(char *filepath, uint8_t mode) {
407+
File SDClass::open(const char *filepath, uint8_t mode) {
408408
/*
409409
410410
Open the supplied file path for reading or writing.

libraries/SD/SD.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class File : public Stream {
2929
SdFile *_file; // underlying file pointer
3030

3131
public:
32-
File(SdFile f, char *name); // wraps an underlying SdFile
32+
File(SdFile f, const char *name); // wraps an underlying SdFile
3333
File(void); // 'empty' constructor
3434
~File(void); // destructor
3535
virtual size_t write(uint8_t);
@@ -62,7 +62,7 @@ class SDClass {
6262
SdFile root;
6363

6464
// my quick&dirty iterator, should be replaced
65-
SdFile getParentDir(char *filepath, int *indx);
65+
SdFile getParentDir(const char *filepath, int *indx);
6666
public:
6767
// This needs to be called to set up the connection to the SD card
6868
// before other methods are used.
@@ -71,7 +71,7 @@ class SDClass {
7171
// Open the specified file/directory with the supplied mode (e.g. read or
7272
// write, etc). Returns a File object for interacting with the file.
7373
// Note that currently only one file can be open at a time.
74-
File open(char *filename, uint8_t mode = FILE_READ);
74+
File open(const char *filename, uint8_t mode = FILE_READ);
7575

7676
// Methods to determine if the requested file path exists.
7777
boolean exists(char *filepath);

libraries/SD/utility/SdFatUtil.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030
/** Store and print a string in flash memory followed by a CR/LF.*/
3131
#define PgmPrintln(x) SerialPrintln_P(PSTR(x))
3232
/** Defined so doxygen works for function definitions. */
33-
#define NOINLINE __attribute__((noinline))
33+
#define NOINLINE __attribute__((noinline,unused))
34+
#define UNUSEDOK __attribute__((unused))
3435
//------------------------------------------------------------------------------
3536
/** Return the number of bytes currently free in RAM. */
36-
static int FreeRam(void) {
37+
static UNUSEDOK int FreeRam(void) {
3738
extern int __bss_end;
3839
extern int* __brkval;
3940
int free_memory;

libraries/Wire/utility/twi.c

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <avr/io.h>
2424
#include <avr/interrupt.h>
2525
#include <compat/twi.h>
26+
#include "Arduino.h" // for digitalWrite
2627

2728
#ifndef cbi
2829
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))

0 commit comments

Comments
 (0)