Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/io/src/tools/vpParseArgv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void vpParseArgv::printUsage(vpArgvInfo *argTable, int flags)
continue;
}
FPRINTF(stderr, "\n %s:", infoPtr->key);
numSpaces = ((width + 1) >= strlen(infoPtr->key) ? width + 1 - strlen(infoPtr->key) : 0);
numSpaces = ((width + 1) >= strlen(infoPtr->key) ? ((width + 1) - strlen(infoPtr->key)) : 0);
while (numSpaces > 0) {
if (numSpaces >= NUM_SPACES) {
FPRINTF(stderr, "%s", spaces);
Expand Down
4 changes: 3 additions & 1 deletion modules/io/test/parser/catchParseArgv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ class ArgvHolder
for (auto &s : m_storage) {
m_ptrs.push_back(s.c_str());
}

m_ptrs.push_back(nullptr); // A conventional C argv array is normally terminated with a null pointer
}

int argc() const { return static_cast<int>(m_ptrs.size()); }
int argc() const { return (static_cast<int>(m_ptrs.size()) - 1); /* minus one not to count the nullptr*/ }
const char **argv() { return m_ptrs.data(); }

private:
Expand Down
Loading