From 5075a60942003ba6ebd9e1e2c9bf16b6fa803b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Fri, 3 Jan 2025 16:36:27 +0100 Subject: [PATCH] core: Fix the command-line default string Symptom: When a command line parameter's default value string contains a white space, it is not printed in the help message Root Cause Analysis: While the construction of the stringstream of a particular data type can be arbitrarily designed, possibly including white spaces, the command-line class either inadvertentely failed to support a string including white spaces or intentionally decided not to support a white character in the default value string. The latter case is a design bug, if intended, because the command line class cannot enforce how a data type's string may be constructed. Fix: Take the whole string the stringstream constructs. --- src/core/model/command-line.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/model/command-line.h b/src/core/model/command-line.h index 5f1aa3358..a4e8512f9 100644 --- a/src/core/model/command-line.h +++ b/src/core/model/command-line.h @@ -742,7 +742,7 @@ CommandLine::AddValue(const std::string& name, const std::string& help, T& value std::stringstream ss; ss << value; - ss >> item->m_default; + item->m_default = ss.str(); // Including white spaces m_options.push_back(item); }