Skip to content

Commit

Permalink
Fixed String class regression after f80c6c5
Browse files Browse the repository at this point in the history
This should make explicit String-from-integer constructor working again:

   int a = 10;
   String(a, 4);
  • Loading branch information
cmaglie committed Sep 3, 2013
1 parent 2ebd47a commit c86eed9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions hardware/arduino/avr/cores/arduino/WString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ String::String(unsigned long value, unsigned char base)
*this = buf;
}

String::String(float value, int decimalPlaces)
String::String(float value, unsigned char decimalPlaces)
{
init();
char buf[33];
*this = dtostrf(value, (decimalPlaces + 2), decimalPlaces, buf);
}

String::String(double value, int decimalPlaces)
String::String(double value, unsigned char decimalPlaces)
{
init();
char buf[33];
Expand Down
6 changes: 3 additions & 3 deletions hardware/arduino/avr/cores/arduino/WString.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class String
explicit String(unsigned int, unsigned char base=10);
explicit String(long, unsigned char base=10);
explicit String(unsigned long, unsigned char base=10);
explicit String(float, int decimalPlaces=2);
explicit String(double, int decimalPlaces=2);
explicit String(float, unsigned char decimalPlaces=2);
explicit String(double, unsigned char decimalPlaces=2);
~String(void);

// memory management
Expand Down Expand Up @@ -113,7 +113,7 @@ class String
String & operator += (const String &rhs) {concat(rhs); return (*this);}
String & operator += (const char *cstr) {concat(cstr); return (*this);}
String & operator += (char c) {concat(c); return (*this);}
String & operator += (unsigned char num) {concat(num); return (*this);}
String & operator += (unsigned char num) {concat(num); return (*this);}
String & operator += (int num) {concat(num); return (*this);}
String & operator += (unsigned int num) {concat(num); return (*this);}
String & operator += (long num) {concat(num); return (*this);}
Expand Down
4 changes: 2 additions & 2 deletions hardware/arduino/sam/cores/arduino/WString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ String::String(unsigned long value, unsigned char base)
*this = buf;
}

String::String(float value, int decimalPlaces)
String::String(float value, unsigned char decimalPlaces)
{
init();
char buf[33];
*this = dtostrf(value, (decimalPlaces + 2), decimalPlaces, buf);
}

String::String(double value, int decimalPlaces)
String::String(double value, unsigned char decimalPlaces)
{
init();
char buf[33];
Expand Down
4 changes: 2 additions & 2 deletions hardware/arduino/sam/cores/arduino/WString.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class String
explicit String(unsigned int, unsigned char base=10);
explicit String(long, unsigned char base=10);
explicit String(unsigned long, unsigned char base=10);
explicit String(float, int decimalPlaces=2);
explicit String(double, int decimalPlaces=2);
explicit String(float, unsigned char decimalPlaces=2);
explicit String(double, unsigned char decimalPlaces=2);
~String(void);

// memory management
Expand Down

0 comments on commit c86eed9

Please sign in to comment.