luc-github / ESP32SSDP

Simple SSDP library for ESP32
GNU General Public License v3.0
47 stars 22 forks source link

[BUG] compiler warning - large integer implicitly truncated to unsigned type #17

Closed datacute closed 4 years ago

datacute commented 4 years ago

Using platformio to compile https://github.com/sharandac/My-TTGO-Watch (which uses this library), gives a warning:

.pio\libdeps\ttgo-t-watch\ESP32SSPD\ESP32SSDP.cpp: In constructor 'SSDPClass::SSDPClass()': .pio\libdeps\ttgo-t-watch\ESP32SSPD\ESP32SSDP.cpp:112:19: warning: large integer implicitly truncated to unsigned type [-Woverflow] _notify_time(0) ^

This is actually because of the earlier line in the constructor: _interval(SSDP_INTERVAL),

Where _interval is uint8_t and SSDP_INTERVAL is 1200

Should _interval be uint32_t or unsigned long instead?

github-actions[bot] commented 4 years ago

Thank your for submiting, please be sure you followed template or your issue may be dismissed.

luc-github commented 4 years ago

yes indeed should be uint32_t

void SSDPClass::setInterval(uint32_t interval)
{
    _interval = interval;
}
luc-github commented 4 years ago

fixed - thank you https://github.com/luc-github/ESP32SSDP/commit/803e713c0a4a132f2db7ea317d2e83f02a990024 ^_^