Skip to content

Commit

Permalink
Turn out it was device control one character ascii 17 that was part o…
Browse files Browse the repository at this point in the history
…f the string
  • Loading branch information
knro committed Apr 23, 2024
1 parent 0231e1c commit f9c20ff
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions indi-aagcloudwatcher-ng/CloudWatcherController_ng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,23 +925,18 @@ int CloudWatcherController::aggregateInts(int values[], int numberOfValues)

void CloudWatcherController::trimString(char *str)
{
char *read_ptr = str;
char *write_ptr = str;

// Loop through the string
while (*read_ptr != '\0')
while (*write_ptr != '\0')
{
// Check for literal "\0"
if (*read_ptr != '\\' || *(read_ptr + 1) != '0')
if (*write_ptr == 17)
{
// Not literal "\0", copy the character
*write_ptr++ = *read_ptr;
*write_ptr = 0;
break;
}
read_ptr++; // Move read pointer regardless
else
write_ptr++;
}

// Null terminate the modified string
*write_ptr = '\0';
}

bool CloudWatcherController::checkValidMessage(char *buffer, int nBlocks)
Expand Down

0 comments on commit f9c20ff

Please sign in to comment.