Skip to content
Snippets Groups Projects
Commit 9c6beb12 authored by Karsten Suehring's avatar Karsten Suehring
Browse files

Fix logic of multi-layer parameter reading

A bug in !1700 cause the encoder to pass all parameters into all layers (independent of the specified target layer)
parent 2c8788f9
No related branches found
No related tags found
1 merge request!1710Fix logic of multi-layer parameter reading
......@@ -140,30 +140,33 @@ int main(int argc, char* argv[])
{
if( argv[i][0] == '-' && argv[i][1] == 'l' )
{
int incr = 0; // count how many parameters are consumed
if( argv[i][2] == std::to_string( layerIdx ).c_str()[0] )
if (argc <= i + 1)
{
THROW("Command line parsing error: missing parameter after -lx\n");
}
int numParams = 1; // count how many parameters are consumed
// check for long parameters, which start with "--"
const std::string param = argv[i + 1];
if (param.rfind("--", 0) != 0)
{
if (argc <= i + 1)
// only short parameters have a second parameter for the value
if (argc <= i + 2)
{
THROW("Command line parsing error: missing parameter after -lx\n");
}
numParams++;
}
// check if correct layer index
if( argv[i][2] == std::to_string( layerIdx ).c_str()[0] )
{
layerArgv[j] = argv[i + 1];
incr++;
// check for long parameters, which start with "--"
const std::string param = argv[i + 1];
if (param.rfind("--", 0) != 0)
if (numParams > 1)
{
// only short parameters have a second parameter for the value
if (argc <= i + 2)
{
THROW("Command line parsing error: missing parameter after -lx\n");
}
layerArgv[j + 1] = argv[i + 2];
incr++;
}
j+= incr;
j+= numParams;
}
i += incr;
i += numParams;
}
else
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment