Skip to content

Commit

Permalink
Fix warnings flagged by clang build (#2801)
Browse files Browse the repository at this point in the history
Co-authored-by: mikee47 <[email protected]>
  • Loading branch information
mikee47 and mikee47 authored Jun 12, 2024
1 parent cf4e1c9 commit 5e91b29
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 34 deletions.
2 changes: 2 additions & 0 deletions Sming/Components/Network/src/Network/SmtpClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ class SmtpClient : protected TcpClient
void sendMailHeaders(MailMessage* mail);
bool sendMailBody(MailMessage* mail);

using TcpClient::connect;

private:
Url url;
Vector<String> authMethods;
Expand Down
2 changes: 1 addition & 1 deletion Sming/Components/Storage/src/include/Storage/Partition.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct esp_partition_info_t;

namespace Disk
{
class DiskPart;
struct DiskPart;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Sming/Core/Data/Stream/LimitedWriteStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LimitedWriteStream : public StreamWrapper
{
}

bool isValid()
bool isValid() const override
{
return writePos <= maxBytes;
}
Expand Down
2 changes: 1 addition & 1 deletion Sming/Libraries/MHZ19
Submodule MHZ19 updated 1 files
+1 −1 src/Uart.cpp
2 changes: 1 addition & 1 deletion Sming/Libraries/SignalGenerator
2 changes: 1 addition & 1 deletion Sming/Libraries/TFT_S1D13781
Submodule TFT_S1D13781 updated 1 files
+2 −2 src/SeFont.cpp
2 changes: 1 addition & 1 deletion Sming/Libraries/UPnP-Schema
2 changes: 1 addition & 1 deletion Sming/Libraries/WebCam/src/Camera/FakeCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class FakeCamera: public CameraInterface
*
* @retval bytes successfully read and stored in the buffer
*/
size_t read(char* buffer, size_t size, size_t offset = 0)
size_t read(char* buffer, size_t size, size_t offset = 0) override
{
// get the current picture and read the desired data from it.
file.seekFrom(offset, SeekOrigin::Start);
Expand Down
20 changes: 12 additions & 8 deletions samples/Basic_ProgMem/app/TestProgmem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,50 +167,54 @@ void testSpeed(Print& out)

out.printf("Speed tests, %u iterations, times in microseconds\n", iterations);
ElapseTimer timer;
unsigned tmp = 0;
uint32_t baseline, elapsed;

_FPUTS("Baseline test, read string in RAM...");
unsigned sum = 0;
timer.start();
for(unsigned i = 0; i < iterations; ++i) {
tmp += sumBuffer(demoText, sizeof(demoText));
sum += sumBuffer(demoText, sizeof(demoText));
}
baseline = timer.elapsedTime();
out << "Elapsed: " << baseline << endl;
out << "Elapsed: " << baseline << ", sum " << sum << endl;

#define END() \
elapsed = timer.elapsedTime(); \
out << "Elapsed: " << elapsed << " (baseline + " << elapsed - baseline << ')' << endl;
out << "Elapsed: " << elapsed << " (baseline + " << elapsed - baseline << "), sum " << sum << endl;

_FPUTS("Load PSTR into stack buffer...");
sum = 0;
timer.start();
for(unsigned i = 0; i < iterations; ++i) {
LOAD_PSTR(buf, demoPSTR1);
tmp += sumBuffer(buf, sizeof(buf));
sum += sumBuffer(buf, sizeof(buf));
}
END()

_FPUTS("Load PSTR into String...");
sum = 0;
timer.start();
for(unsigned i = 0; i < iterations; ++i) {
String s(demoFSTR1.data());
tmp += sumBuffer(s.c_str(), s.length() + 1);
sum += sumBuffer(s.c_str(), s.length() + 1);
}
END()

_FPUTS("Load FlashString into stack buffer...");
sum = 0;
timer.start();
for(unsigned i = 0; i < iterations; ++i) {
LOAD_FSTR(buf, demoFSTR1);
tmp += sumBuffer(buf, sizeof(buf));
sum += sumBuffer(buf, sizeof(buf));
}
END()

_FPUTS("Load FlashString into String...");
sum = 0;
timer.start();
for(unsigned i = 0; i < iterations; ++i) {
String s(demoFSTR1);
tmp += sumBuffer(s.c_str(), s.length() + 1);
sum += sumBuffer(s.c_str(), s.length() + 1);
}
END()
}
Expand Down
1 change: 0 additions & 1 deletion samples/Basic_ProgMem/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const uint8_t demoRam[] = {1, 2, 3, 4, 5};
const PROGMEM uint8_t demoPgm[] = {1, 2, 3, 4, 5};

const PROGMEM char demoString[] = "Demo";
const PROGMEM char demoString2[] = "Demo";
const PROGMEM char demoFormat[] = "Demo %d";

const PROGMEM uint8_t bytes[] = {1, 2, 3, 4, 5, 6, 7, 8};
Expand Down
2 changes: 1 addition & 1 deletion samples/Basic_Ssl/include/CounterStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class CounterStream : public ReadWriteStream
{
public:
size_t write(const uint8_t* buffer, size_t size)
size_t write(const uint8_t* buffer, size_t size) override
{
streamSize += size;
return size;
Expand Down
4 changes: 0 additions & 4 deletions samples/Basic_Utility/app/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ auto& output = Host::standardOutput;

namespace
{
#define XX(name, ext, mime) ext "\0"
DEFINE_FSTR_LOCAL(fstr_ext, "htm\0" MIME_TYPE_MAP(XX))
#undef XX

namespace Command
{
DEFINE_FSTR(testWebConstants, "testWebConstants")
Expand Down
2 changes: 2 additions & 0 deletions samples/HttpServer_ConfigNetwork/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ DEFINE_FSTR(DEFAULT_GATEWAY, "192.168.1.1")
// Instead of using a SPIFFS file, here we demonstrate usage of imported Flash Strings
IMPORT_FSTR_LOCAL(flashSettings, PROJECT_DIR "/web/build/settings.html")

#ifdef ENABLE_SSL
IMPORT_FSTR_LOCAL(serverKey, PROJECT_DIR "/cert/key_1024");
IMPORT_FSTR_LOCAL(serverCert, PROJECT_DIR "/cert/x509_1024.cer");
#endif

void onIndex(HttpRequest& request, HttpResponse& response)
{
Expand Down
1 change: 0 additions & 1 deletion samples/Humidity_AM2321/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace
AM2321 am2321;

SimpleTimer procTimer;
bool state = true;

// You can change I2C pins here:
const int SCL = 5;
Expand Down
4 changes: 2 additions & 2 deletions samples/LiveDebug/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ COMMAND_HANDLER(read0)
"At GDB prompt, enter `set $pc = $pc + 3` to skip offending instruction,\r\n"
"then enter `c` to continue"));
Serial.flush();
uint8_t value = *(uint8_t*)0;
uint8_t value = *(volatile uint8_t*)0;
Serial << _F("Value at address 0 = 0x") << String(value, HEX, 2) << endl;
return true;
}
Expand All @@ -409,7 +409,7 @@ COMMAND_HANDLER(write0)
"At GDB prompt, enter `set $pc = $pc + 3` to skip offending instruction,\r\n"
"then enter `c` to continue"));
Serial.flush();
*(uint8_t*)0 = 0;
*(volatile uint8_t*)0 = 0;
Serial.println(_F("...still running!"));
return true;
}
Expand Down
3 changes: 1 addition & 2 deletions samples/MeteoControl/app/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ namespace
{
HttpServer server;
HttpClient downloadClient;
bool serverStarted = false;
int dowfid = 0;
bool serverStarted;

void onIndex(HttpRequest& request, HttpResponse& response)
{
Expand Down
10 changes: 3 additions & 7 deletions samples/MqttClient_Hello/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@

namespace
{
// For testing purposes, try a few different URL formats
DEFINE_FSTR(MQTT_URL1, "mqtt://test.mosquitto.org:1883")
DEFINE_FSTR(MQTT_URL2, "mqtts://test.mosquitto.org:8883") // (Need ENABLE_SSL)
DEFINE_FSTR(MQTT_URL3, "mqtt://frank:[email protected]:1883")

#ifdef ENABLE_SSL
#include <ssl/private_key.h>
#include <ssl/cert.h>
#define MQTT_URL MQTT_URL2
DEFINE_FSTR(MQTT_URL, "mqtts://test.mosquitto.org:8883")
#else
#define MQTT_URL MQTT_URL1
DEFINE_FSTR(MQTT_URL, "mqtt://test.mosquitto.org:1883")
// DEFINE_FSTR(MQTT_URL, "mqtt://frank:[email protected]:1883")
#endif

// Forward declarations
Expand Down

0 comments on commit 5e91b29

Please sign in to comment.