From 845ce6c4814ab1c7cf18bdc980151163021e9165 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 16 Jun 2015 21:01:59 +0000 Subject: [PATCH] changed -setlist: now takes size of list first; otherwise cannot treat negative numbers --- Common/CommandLine.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index 7f2ccf5eb6..010b042999 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -564,12 +564,15 @@ void GetOptions(int argc, char *argv[]) i++; if (i + 1 < argc && argv[i][0] != '-') { std::string n(argv[i]); - std::vector<double> v(1, atof(argv[i + 1])); + std::vector<double> v; + int s = atoi(argv[i + 1]), j = 0; i += 2; - while(i < argc && argv[i][0] != '-'){ + while(j < s && i < argc){ v.push_back(atof(argv[i])); - i++; + i++; j++; } + if(j < s) + Message::Error("Missing values in list (got %d instead of %d)", j, s); gmsh_yysymbols[n].value = v; Msg::GetCommandLineNumbers()[n] = v; } -- GitLab