improv-wifi / improv-wifi/sdk-cpp

Compiler warnings

Open
#30 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
78
Forks
21
Avg merge
6h 47m
Merged PRs (30d)
1

Description

It would be nice if you could clean up these compiler warnings...

warning: comparison of integer expressions of different signedness: 'size_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]

.pio/libdeps/ratgdo_esp8266_hV25/Improv/src/improv.cpp: In function 'bool improv::parse_improv_serial_byte(size_t, uint8_t, const uint8_t*, std::function<bool(improv::ImprovCommand)>&&, std::function<void(improv::Error)>&&)':
.pio/libdeps/ratgdo_esp8266_hV25/Improv/src/improv.cpp:84:16: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
   84 |   if (position <= 8 + data_len)
      |       ~~~~~~~~~^~~~~~~~~~~~~~~
.pio/libdeps/ratgdo_esp8266_hV25/Improv/src/improv.cpp:87:16: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
   87 |   if (position == 8 + data_len + 1) {
      |       ~~~~~~~~~^~~~~~~~~~~~~~~~~~~
.pio/libdeps/ratgdo_esp8266_hV25/Improv/src/improv.cpp: In function 'std::vector<unsigned char> improv::build_rpc_response(improv::Command, const std::vector<std::__cxx11::basic_string<char> >&, bool)':
.pio/libdeps/ratgdo_esp8266_hV25/Improv/src/improv.cpp:112:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'unsigned int'} [-Wsign-compare]
  112 |   for (int i = 0; i < datum.size(); i++) {
      |                   ~~^~~~~~~~~~~~~~
Archiving .pio/build/ratgdo_esp8266_hV25/lib858/libEEPROM.a
.pio/libdeps/ratgdo_esp8266_hV25/Improv/src/improv.cpp: In function 'std::vector<unsigned char> improv::build_rpc_response(improv::Command, const std::vector<String>&, bool)':
.pio/libdeps/ratgdo_esp8266_hV25/Improv/src/improv.cpp:152:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<String>::size_type' {aka 'unsigned int'} [-Wsign-compare]
  152 |   for (int i = 0; i < datum.size(); i++) {
      |                   ~~^~~~~~~~~~~~~~

A simple cast to (int) should do it.
Thanks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with .pio/libdeps/ratgdo_esp8266_hV25/Improv/src/improv.cpp and inspect parse_improv_serial_byte and build_rpc_response at the warning locations. Rebuild the ESP8266 target and confirm the signedness warnings no longer appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.