Skip to content

Commit 63ed4a5

Browse files
committed
compiler warnings
1 parent fd38ff0 commit 63ed4a5

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/UniversalTelegramBot.cpp

+11-12
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ String UniversalTelegramBot::buildCommand(const String& cmd) {
6464

6565
String UniversalTelegramBot::sendGetToTelegram(const String& command) {
6666
String body, headers;
67-
bool avail;
6867

6968
// Connect with api.telegram.org if not already connected
7069
if (!client->connected()) {
@@ -99,7 +98,7 @@ String UniversalTelegramBot::sendGetToTelegram(const String& command) {
9998

10099
bool UniversalTelegramBot::readHTTPAnswer(String &body, String &headers) {
101100
int ch_count = 0;
102-
long now = millis();
101+
unsigned long now = millis();
103102
bool finishedHeaders = false;
104103
bool currentLineIsBlank = true;
105104
bool responseReceived = false;
@@ -268,7 +267,7 @@ String UniversalTelegramBot::sendMultipartFormDataToTelegram(
268267
#endif
269268
byte buffer[512];
270269
int count = 0;
271-
char ch;
270+
272271
while (moreDataAvailableCallback()) {
273272
buffer[count] = getNextByteCallback();
274273
count++;
@@ -335,7 +334,7 @@ bool UniversalTelegramBot::setMyCommands(const String& commandArray) {
335334
#endif // defined(_debug)
336335
unsigned long sttime = millis();
337336

338-
while (millis() < sttime + 8000ul) { // loop for a while to send the message
337+
while (millis() - sttime < 8000ul) { // loop for a while to send the message
339338
response = sendPostToTelegram(BOT_CMD("setMyCommands"), payload.as<JsonObject>());
340339
#ifdef _debug
341340
Serial.println("setMyCommands response" + response);
@@ -533,10 +532,10 @@ bool UniversalTelegramBot::sendSimpleMessage(const String& chat_id, const String
533532
#ifdef TELEGRAM_DEBUG
534533
Serial.println(F("sendSimpleMessage: SEND Simple Message"));
535534
#endif
536-
long sttime = millis();
535+
unsigned long sttime = millis();
537536

538537
if (text != "") {
539-
while (millis() < sttime + 8000) { // loop for a while to send the message
538+
while (millis() - sttime < 8000ul) { // loop for a while to send the message
540539
String command = BOT_CMD("sendMessage?chat_id=");
541540
command += chat_id;
542541
command += F("&text=");
@@ -626,10 +625,10 @@ bool UniversalTelegramBot::sendPostMessage(JsonObject payload) {
626625
serializeJson(payload, Serial);
627626
Serial.println();
628627
#endif
629-
long sttime = millis();
628+
unsigned long sttime = millis();
630629

631630
if (payload.containsKey("text")) {
632-
while (millis() < sttime + 8000) { // loop for a while to send the message
631+
while (millis() - sttime < 8000ul) { // loop for a while to send the message
633632
String response = sendPostToTelegram(BOT_CMD("sendMessage"), payload);
634633
#ifdef TELEGRAM_DEBUG
635634
Serial.println(response);
@@ -650,10 +649,10 @@ String UniversalTelegramBot::sendPostPhoto(JsonObject payload) {
650649
#ifdef TELEGRAM_DEBUG
651650
Serial.println(F("sendPostPhoto: SEND Post Photo"));
652651
#endif
653-
long sttime = millis();
652+
unsigned long sttime = millis();
654653

655654
if (payload.containsKey("photo")) {
656-
while (millis() < sttime + 8000) { // loop for a while to send the message
655+
while (millis() - sttime < 8000ul) { // loop for a while to send the message
657656
response = sendPostToTelegram(BOT_CMD("sendPhoto"), payload);
658657
#ifdef TELEGRAM_DEBUG
659658
Serial.println(response);
@@ -733,10 +732,10 @@ bool UniversalTelegramBot::sendChatAction(const String& chat_id, const String& t
733732
#ifdef TELEGRAM_DEBUG
734733
Serial.println(F("SEND Chat Action Message"));
735734
#endif
736-
long sttime = millis();
735+
unsigned long sttime = millis();
737736

738737
if (text != "") {
739-
while (millis() < sttime + 8000) { // loop for a while to send the message
738+
while (millis() - sttime < 8000ul) { // loop for a while to send the message
740739
String command = BOT_CMD("sendChatAction?chat_id=");
741740
command += chat_id;
742741
command += F("&action=");

src/UniversalTelegramBot.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class UniversalTelegramBot {
122122
String name;
123123
String userName;
124124
int longPoll = 0;
125-
int waitForResponse = 1500;
125+
unsigned int waitForResponse = 1500;
126126
int _lastError;
127127
int last_sent_message_id = 0;
128128
int maxMessageLength = 1500;

0 commit comments

Comments
 (0)