Fix possible loss of data warning in YeelightController.cpp

This commit is contained in:
Adam Honse 2024-08-01 00:25:30 -05:00
parent 4cdee33ae4
commit 0b05f93eee

View file

@ -157,7 +157,7 @@ void YeelightController::SetMusicMode()
std::string command_str = command.dump().append("\r\n");
port.tcp_client_connect();
port.tcp_client_write((char *)command_str.c_str(), command_str.length() + 1);
port.tcp_client_write((char *)command_str.c_str(), (int)command_str.length() + 1);
port.tcp_close();
}
@ -183,7 +183,7 @@ void YeelightController::SetPower()
std::string command_str = command.dump().append("\r\n");
port.tcp_client_connect();
port.tcp_client_write((char *)command_str.c_str(), command_str.length() + 1);
port.tcp_client_write((char *)command_str.c_str(), (int)command_str.length() + 1);
port.tcp_close();
}
@ -240,12 +240,12 @@ void YeelightController::SetColor(unsigned char red, unsigned char green, unsign
if(music_mode)
{
send(*music_mode_sock, (char *)command_str.c_str(), command_str.length(), 0);
send(*music_mode_sock, (char *)command_str.c_str(), (int)command_str.length(), 0);
}
else
{
port.tcp_client_connect();
port.tcp_client_write((char *)command_str.c_str(), command_str.length() + 1);
port.tcp_client_write((char *)command_str.c_str(), (int)command_str.length() + 1);
port.tcp_close();
}
}