From f9c20ffd1da4c36c519f16c05aea56b60316f566 Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Tue, 23 Apr 2024 09:57:29 +0300 Subject: [PATCH] Turn out it was device control one character ascii 17 that was part of the string --- .../CloudWatcherController_ng.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/indi-aagcloudwatcher-ng/CloudWatcherController_ng.cpp b/indi-aagcloudwatcher-ng/CloudWatcherController_ng.cpp index 38bb2720d..f83838065 100644 --- a/indi-aagcloudwatcher-ng/CloudWatcherController_ng.cpp +++ b/indi-aagcloudwatcher-ng/CloudWatcherController_ng.cpp @@ -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)