Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/improv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ bool parse_improv_serial_byte(size_t position, uint8_t byte, const uint8_t *buff
uint8_t type = buffer[7];
uint8_t data_len = buffer[8];

if (position <= 8 + data_len)
if (position <= 8u + data_len)
return true;

if (position == 8 + data_len + 1) {
if (position == 8u + data_len + 1) {
uint8_t checksum = 0x00;
for (size_t i = 0; i < position; i++)
checksum += buffer[i];
Expand All @@ -109,7 +109,7 @@ std::vector<uint8_t> build_rpc_response(Command command, const std::vector<std::
size_t frame_length = 3;
// Frame length variable: string lengths: n + length of data in datum
frame_length += datum.size();
for (int i = 0; i < datum.size(); i++) {
for (uint32_t i = 0; i < datum.size(); i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (uint32_t i = 0; i < datum.size(); i++) {
for (size_t i = 0; i < datum.size(); i++) {

frame_length += datum[i].length();
}
// Reserve frame_length bytes in vector
Expand Down Expand Up @@ -149,7 +149,7 @@ std::vector<uint8_t> build_rpc_response(Command command, const std::vector<Strin
size_t frame_length = 3;
// Frame length variable: string lengths: n + length of data in datum
frame_length += datum.size();
for (int i = 0; i < datum.size(); i++) {
for (uint32_t i = 0; i < datum.size(); i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (uint32_t i = 0; i < datum.size(); i++) {
for (size_t i = 0; i < datum.size(); i++) {

frame_length += datum[i].length();
}
// Reserve frame_length bytes in vector
Expand Down