witnessmenow/spotify-api-arduino

Warnings on Arduino IDE

krulkip opened this issue · 5 comments

I am getting many warnings on arduino IDE.
warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
The small program below shows where these come from.
You can find one for instance on line 104 of the ArduinoSpotify.h file.
ArduinoSpotify(Client &client, char *clientId, char *clientSecret, char *refreshToken = "");
char *refreshToken = "" this part gives the warning as illustrated below
You can remove the warning by adding (char *) as shown below but not sure program then still works as intended

char refreshToken1 [] = ""; //Is Ok
char *refreshToken2 = (char *)""; //Is OK
char *refreshToken3 = ""; // gives above warning
void setup() {
}
void loop() {
}

Updated, I no longer have any compiler warnings.

Thank you very much for fixing that.
I still get one warning.
getRefreshToken.ino: In function 'void handleCallback()':
getRefreshToken:118: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
refreshToken = spotify.requestAccessTokens((char*)code.c_str(), callbackURI);

                                             ^

I forked your library and made the changes to fix this issue. Not tested it yet but it assembles without errors.

All working OK now. Tested both getrefreshtoken and getcurrentlyplaying.
Thank you so much. Super cool.