diff --git a/examples/WebRadio/WebRadio.ino b/examples/WebRadio/WebRadio.ino index d13f0d3..40540d4 100644 --- a/examples/WebRadio/WebRadio.ino +++ b/examples/WebRadio/WebRadio.ino @@ -164,7 +164,7 @@ void HandleChangeURL(WiFiClient *client, char *params) isAAC = false; } strcpy_P(status, PSTR("Changing URL...")); - Serial.printf_P("Changed URL to: %s(%s)\n", url, newType); + Serial.printf_P(PSTR("Changed URL to: %s(%s)\n"), url, newType); RedirectToIndex(client); } else { WebError(client, 404, NULL, false); @@ -214,11 +214,11 @@ void MDCallback(void *cbData, const char *type, bool isUnicode, Stream *stream) const char *ptr = reinterpret_cast(cbData); (void) isUnicode; // Punt this ball for now (void) ptr; - if (strstr(type, "Title")) { + if (strstr(type, PSTR("Title"))) { strncpy(title, stream->readString().c_str(), sizeof(title)); title[sizeof(title)-1] = 0; } else { - // Who knows what yo do? Not me! + // Who knows what to do? Not me! } } void StatusCallback(void *cbData, int code, const char *string) @@ -226,7 +226,7 @@ void StatusCallback(void *cbData, int code, const char *string) const char *ptr = reinterpret_cast(cbData); (void) code; (void) ptr; - strncpy(status, string, sizeof(status)-1); + strncpy_P(status, string, sizeof(status)-1); status[sizeof(status)-1] = 0; } diff --git a/src/AudioFileSourceBuffer.cpp b/src/AudioFileSourceBuffer.cpp index 92f7d04..306dcbd 100644 --- a/src/AudioFileSourceBuffer.cpp +++ b/src/AudioFileSourceBuffer.cpp @@ -27,7 +27,7 @@ AudioFileSourceBuffer::AudioFileSourceBuffer(AudioFileSource *source, int buffSi { buffSize = buffSizeBytes; buffer = (uint8_t*)malloc(sizeof(uint8_t) * buffSize); - if (!buffer) Serial.printf_P("Unable to allocate AudioFileSourceBuffer::buffer[]\n"); + if (!buffer) Serial.printf_P(PSTR("Unable to allocate AudioFileSourceBuffer::buffer[]\n")); writePtr = 0; readPtr = 0; src = source; @@ -79,7 +79,7 @@ uint32_t AudioFileSourceBuffer::read(void *data, uint32_t len) uint32_t bytes = 0; if (!filled) { // Fill up completely before returning any data at all - cb.st(STATUS_FILLING, "Refilling buffer"); + cb.st(STATUS_FILLING, PSTR("Refilling buffer")); length = src->read(buffer, buffSize); writePtr = length % buffSize; filled = true; @@ -116,7 +116,7 @@ uint32_t AudioFileSourceBuffer::read(void *data, uint32_t len) writePtr = 0; length = 0; filled = false; - cb.st(STATUS_UNDERFLOW, "Buffer underflow"); + cb.st(STATUS_UNDERFLOW, PSTR("Buffer underflow")); } fill(); diff --git a/src/AudioFileSourceHTTPStream.cpp b/src/AudioFileSourceHTTPStream.cpp index 3c12b2f..e1d449d 100644 --- a/src/AudioFileSourceHTTPStream.cpp +++ b/src/AudioFileSourceHTTPStream.cpp @@ -42,7 +42,7 @@ bool AudioFileSourceHTTPStream::open(const char *url) int code = http.GET(); if (code != HTTP_CODE_OK) { http.end(); - cb.st(STATUS_HTTPFAIL, "Can't open HTTP request"); + cb.st(STATUS_HTTPFAIL, PSTR("Can't open HTTP request")); return false; } size = http.getSize(); @@ -70,20 +70,20 @@ uint32_t AudioFileSourceHTTPStream::readInternal(void *data, uint32_t len, bool { retry: if (!http.connected()) { - cb.st(STATUS_DISCONNECTED, "Stream disconnected"); + cb.st(STATUS_DISCONNECTED, PSTR("Stream disconnected")); http.end(); for (int i = 0; i < reconnectTries; i++) { char buff[32]; - sprintf(buff, "Attempting to reconnect, try %d", i); + sprintf_P(buff, PSTR("Attempting to reconnect, try %d"), i); cb.st(STATUS_RECONNECTING, buff); delay(reconnectDelayMs); if (open(saveURL)) { - cb.st(STATUS_RECONNECTED, "Stream reconnected"); + cb.st(STATUS_RECONNECTED, PSTR("Stream reconnected")); break; } } if (!http.connected()) { - cb.st(STATUS_DISCONNECTED, "Unable to reconnect"); + cb.st(STATUS_DISCONNECTED, PSTR("Unable to reconnect")); return 0; } } @@ -101,7 +101,7 @@ retry: size_t avail = stream->available(); if (!nonBlock && !avail) { - cb.st(STATUS_NODATA, "No stream data available"); + cb.st(STATUS_NODATA, PSTR("No stream data available")); http.end(); goto retry; } diff --git a/src/AudioFileSourceICYStream.cpp b/src/AudioFileSourceICYStream.cpp index 2ff8eb4..0dc86fa 100644 --- a/src/AudioFileSourceICYStream.cpp +++ b/src/AudioFileSourceICYStream.cpp @@ -47,7 +47,7 @@ bool AudioFileSourceICYStream::open(const char *url) int code = http.GET(); if (code != HTTP_CODE_OK) { http.end(); - cb.st(STATUS_HTTPFAIL, "Can't open HTTP request"); + cb.st(STATUS_HTTPFAIL, PSTR("Can't open HTTP request")); return false; } if (http.hasHeader(hdr[0])) { @@ -123,20 +123,20 @@ uint32_t AudioFileSourceICYStream::readInternal(void *data, uint32_t len, bool n { retry: if (!http.connected()) { - cb.st(STATUS_DISCONNECTED, "Stream disconnected"); + cb.st(STATUS_DISCONNECTED, PSTR("Stream disconnected")); http.end(); for (int i = 0; i < reconnectTries; i++) { char buff[32]; - sprintf(buff, "Attempting to reconnect, try %d", i); + sprintf_P(buff, PSTR("Attempting to reconnect, try %d"), i); cb.st(STATUS_RECONNECTING, buff); delay(reconnectDelayMs); if (open(saveURL)) { - cb.st(STATUS_RECONNECTED, "Stream reconnected"); + cb.st(STATUS_RECONNECTED, PSTR("Stream reconnected")); break; } } if (!http.connected()) { - cb.st(STATUS_DISCONNECTED, "Unable to reconnect"); + cb.st(STATUS_DISCONNECTED, PSTR("Unable to reconnect")); return 0; } } @@ -154,7 +154,7 @@ retry: size_t avail = stream->available(); if (!nonBlock && !avail) { - cb.st(STATUS_NODATA, "No stream data available"); + cb.st(STATUS_NODATA, PSTR("No stream data available")); http.end(); goto retry; } diff --git a/src/AudioGeneratorAAC.cpp b/src/AudioGeneratorAAC.cpp index 007c223..10e3f58 100644 --- a/src/AudioGeneratorAAC.cpp +++ b/src/AudioGeneratorAAC.cpp @@ -112,7 +112,7 @@ bool AudioGeneratorAAC::loop() if (ret) { // Error, skip the frame... char buff[48]; - sprintf(buff, "AAC decode error %d", ret); + sprintf_P(buff, PSTR("AAC decode error %d"), ret); cb.st(ret, buff); } else { lastFrameEnd = buffValid - bytesLeft; diff --git a/src/AudioGeneratorMP3.cpp b/src/AudioGeneratorMP3.cpp index 2ad073e..9e987ca 100644 --- a/src/AudioGeneratorMP3.cpp +++ b/src/AudioGeneratorMP3.cpp @@ -73,7 +73,7 @@ enum mad_flow AudioGeneratorMP3::ErrorToFlow() if ((lastReadPos==0) && (stream.error==MAD_ERROR_LOSTSYNC)) return MAD_FLOW_CONTINUE; strcpy_P(err, mad_stream_errorstr(&stream)); - snprintf(errLine, sizeof(errLine), "Decoding error '%s' at byte offset %d", + snprintf_P(errLine, sizeof(errLine), PSTR("Decoding error '%s' at byte offset %d"), err, (stream.this_frame - buff) + lastReadPos); yield(); // Something bad happened anyway, ensure WiFi gets some time, too cb.st(stream.error, errLine); diff --git a/src/libhelix-aac/filefmt.c b/src/libhelix-aac/filefmt.c index 77acad9..ccfac59 100644 --- a/src/libhelix-aac/filefmt.c +++ b/src/libhelix-aac/filefmt.c @@ -82,8 +82,9 @@ int UnpackADTSHeader(AACDecInfo *aacDecInfo, unsigned char **buf, int *bitOffset GetBits(&bsi, *bitOffset); /* verify that first 12 bits of header are syncword */ - if (GetBits(&bsi, 12) != 0x0fff) { printf("no ffff\n"); - return ERR_AAC_INVALID_ADTS_HEADER; } + if (GetBits(&bsi, 12) != 0x0fff) { + return ERR_AAC_INVALID_ADTS_HEADER; + } /* fixed fields - should not change from frame to frame */ fhADTS->id = GetBits(&bsi, 1); diff --git a/src/libmad/config.h b/src/libmad/config.h index 0cb10b4..e72019e 100644 --- a/src/libmad/config.h +++ b/src/libmad/config.h @@ -20,7 +20,7 @@ extern int stackfree(); /* #undef EXPERIMENTAL */ /* Define to 1 if you have the header file. */ -#define HAVE_ASSERT_H 1 +//#define HAVE_ASSERT_H 1 /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H @@ -85,7 +85,7 @@ extern int stackfree(); #undef HAVE_WAITPID /* Define to disable debugging assertions. */ -/* #undef NDEBUG */ +#define NDEBUG 1 /* Define to optimize for accuracy over speed. */ /* #undef OPT_ACCURACY */ @@ -98,7 +98,7 @@ extern int stackfree(); /* Define to influence a strict interpretation of the ISO/IEC standards, even if this is in opposition with best accepted practices. */ -/* #undef OPT_STRICT */ +#undef OPT_STRICT /* Name of package */ #define PACKAGE "libmad"