hirotakaster / CoAP-simple-library

Other
111 stars 48 forks source link

Fix -Wsign-compare warnings #31

Closed StandaSK closed 2 years ago

StandaSK commented 2 years ago

strlen() returns size_t, so adjust variables i and idx to size_t as well

Fixes warnings:

coap-simple.cpp:151:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < strlen(url); i++) {
                     ~~^~~~~~~~~~~~~
coap-simple.cpp:158:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (idx <= strlen(url)) {
         ~~~~^~~~~~~~~~~~~~

Found by enabling all compiler warnings.

hirotakaster commented 2 years ago

@StandaSK LGTM, Thank you.