From a5a48ca0ade2fff4d29dbf005de96ae90901b4e9 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 6 Nov 2025 09:57:06 +0100 Subject: [PATCH 1/4] Fix for crash in debug mode in macos when reading windows stlye line ending --- lib_util/cmdl_tools.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib_util/cmdl_tools.c b/lib_util/cmdl_tools.c index bec772ce4..5a1673f70 100644 --- a/lib_util/cmdl_tools.c +++ b/lib_util/cmdl_tools.c @@ -186,15 +186,21 @@ void remove_cr( char *str ) { char *pos; + int32_t n, p = 0; /* remove all \r characters from the string */ pos = strchr( str, '\r' ); while ( pos != NULL ) + for ( n = 0; str[n] != 0; n++ ) { strcpy( pos, pos + 1 ); pos = strchr( pos, '\r' ); + char c = str[n]; + str[p] = c; + p += ( c == '\r' ) ? 0 : 1; } + str[p] = 0; return; } -- GitLab From e353932948188c5201ea7aa36f56ae868a9c1232 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 6 Nov 2025 09:59:38 +0100 Subject: [PATCH 2/4] clang format --- lib_util/cmdl_tools.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_util/cmdl_tools.c b/lib_util/cmdl_tools.c index 5a1673f70..cd0d034bf 100644 --- a/lib_util/cmdl_tools.c +++ b/lib_util/cmdl_tools.c @@ -191,14 +191,14 @@ void remove_cr( /* remove all \r characters from the string */ pos = strchr( str, '\r' ); while ( pos != NULL ) - for ( n = 0; str[n] != 0; n++ ) - { - strcpy( pos, pos + 1 ); - pos = strchr( pos, '\r' ); - char c = str[n]; - str[p] = c; - p += ( c == '\r' ) ? 0 : 1; - } + for ( n = 0; str[n] != 0; n++ ) + { + strcpy( pos, pos + 1 ); + pos = strchr( pos, '\r' ); + char c = str[n]; + str[p] = c; + p += ( c == '\r' ) ? 0 : 1; + } str[p] = 0; return; -- GitLab From 5b7e572b7043fb84078116f6781ade62bb540fba Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 6 Nov 2025 10:08:55 +0100 Subject: [PATCH 3/4] fix merge issue --- lib_util/cmdl_tools.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib_util/cmdl_tools.c b/lib_util/cmdl_tools.c index cd0d034bf..2174ce0c0 100644 --- a/lib_util/cmdl_tools.c +++ b/lib_util/cmdl_tools.c @@ -185,26 +185,23 @@ void convert_backslash( void remove_cr( char *str ) { - char *pos; int32_t n, p = 0; /* remove all \r characters from the string */ - pos = strchr( str, '\r' ); - while ( pos != NULL ) - for ( n = 0; str[n] != 0; n++ ) - { - strcpy( pos, pos + 1 ); - pos = strchr( pos, '\r' ); - char c = str[n]; - str[p] = c; - p += ( c == '\r' ) ? 0 : 1; - } - + for ( n = 0; str[n] != 0; n++ ) + { + char c = str[n]; + str[p] = c; + p += ( c == '\r' ) ? 0 : 1; + } + str[p] = 0; + return; } + /*---------------------------------------------------------------------* * clearString() * -- GitLab From 60dd9f8f8afa3b9619591dcb384c922d1f38b944 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 6 Nov 2025 10:10:22 +0100 Subject: [PATCH 4/4] clang format --- lib_util/cmdl_tools.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib_util/cmdl_tools.c b/lib_util/cmdl_tools.c index 2174ce0c0..344f3cc9f 100644 --- a/lib_util/cmdl_tools.c +++ b/lib_util/cmdl_tools.c @@ -194,14 +194,13 @@ void remove_cr( str[p] = c; p += ( c == '\r' ) ? 0 : 1; } - + str[p] = 0; - + return; } - /*---------------------------------------------------------------------* * clearString() * -- GitLab