Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence several compiler warnings #324

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

developer79433
Copy link
Contributor

No description provided.

Silences warnings:

opensprinkler_server.cpp: In function ‘void server_change_board_attrib(const OTF::Request&, char, unsigned char*)’:
opensprinkler_server.cpp:520:41: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
  520 |                 snprintf(tbuf2+1, 3, "%d", bid);
      |                                         ^
opensprinkler_server.cpp:520:25: note: ‘snprintf’ output between 2 and 4 bytes into a destination of size 3
  520 |                 snprintf(tbuf2+1, 3, "%d", bid);
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
opensprinkler_server.cpp: In function ‘void server_change_stations_attrib(const OTF::Request&, char, unsigned char*)’:
opensprinkler_server.cpp:539:49: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
  539 |                         snprintf(tbuf2+1, 3, "%d", sid);
      |                                                 ^
opensprinkler_server.cpp:539:33: note: ‘snprintf’ output between 2 and 4 bytes into a destination of size 3
  539 |                         snprintf(tbuf2+1, 3, "%d", sid);
      |                         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
opensprinkler_server.cpp: In function ‘void server_change_stations(const OTF::Request&, OTF::Response&)’:
opensprinkler_server.cpp:571:41: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
  571 |                 snprintf(tbuf2+1, 3, "%d", sid);
      |                                         ^
opensprinkler_server.cpp:571:25: note: ‘snprintf’ output between 2 and 4 bytes into a destination of size 3
  571 |                 snprintf(tbuf2+1, 3, "%d", sid);
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Silences warnings:

OpenSprinkler.cpp:2022:18: warning: unused variable ‘stoptime’ [-Wunused-variable]
 2022 |         uint32_t stoptime = millis()+timeout;
      |                  ^~~~~~~~
OpenSprinkler.cpp: In static member function ‘static void OpenSprinkler::switch_remotestation(RemoteOTCStationData*, bool, uint16_t)’:
OpenSprinkler.cpp:2154:13: warning: unused variable ‘x’ [-Wunused-variable]
 2154 |         int x = send_http_request(DEFAULT_OTC_SERVER_APP, DEFAULT_OTC_PORT_APP, p, remote_http_callback, true);
      |             ^
Silences:

mqtt.cpp: In function ‘void subscribe_callback(mosquitto*, void*, const mosquitto_message*)’:
mqtt.cpp:697:15: warning: unused variable ‘topic’ [-Wunused-variable]
  697 |         char *topic = message->topic;
      |               ^~~~~
Fixes:

    In file included from external/TinyWebsockets/tiny_websockets_lib/include/tiny_websockets/network/linux/linux_tcp_client.hpp:6,
                     from external/TinyWebsockets/tiny_websockets_lib/include/tiny_websockets/internals/ws_common.hpp:37,
                     from external/TinyWebsockets/tiny_websockets_lib/include/tiny_websockets/internals/wscrypto/crypto.hpp:3,
                     from external/TinyWebsockets/tiny_websockets_lib/src/crypto.cpp:1:
    external/TinyWebsockets/tiny_websockets_lib/include/tiny_websockets/network/tcp_client.hpp:11:29: error: ‘uint8_t’ does not name a type
       11 |     virtual void send(const uint8_t* data, const uint32_t len) = 0;
          |                             ^~~~~~~
    external/TinyWebsockets/tiny_websockets_lib/include/tiny_websockets/network/tcp_client.hpp:5:1: note: ‘uint8_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
        4 | #include <tiny_websockets/network/tcp_socket.hpp>
      +++ |+#include <cstdint>
        5 |
@developer79433
Copy link
Contributor Author

This is failing CI build because it needs #326 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant