analyse: correct the argument count index check

This commit is contained in:
Danny Robson 2020-12-06 09:00:03 +10:00
parent 7902ed93b8
commit 09e4cf63bb
2 changed files with 6 additions and 5 deletions

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2019, Danny Robson <danny@nerdcruft.net>
* Copyright 2019-2020, Danny Robson <danny@nerdcruft.net>
*/
#pragma once

View File

@ -8,6 +8,7 @@
#include "emory/chunk/map.hpp"
#include "emory/chunk/params.hpp"
#include "emory/chunk/ostream.hpp"
#include <cruft/util/io.hpp>
#include <cruft/util/view.hpp>
@ -81,11 +82,11 @@ int main (int argc, char const **argv)
}
emory::chunk::params p = emory::chunk::DEFAULT_PARAMS;
if (argc > ARG_BITS)
p.window = cruft::parse::from_string<std::size_t> (argv[ARG_WINDOW]);
if (argc > ARG_WINDOW)
if (argc > ARG_BITS + 1)
p.bits = cruft::parse::from_string<std::size_t> (argv[ARG_WINDOW]);
if (argc > ARG_WINDOW + 1)
p.window = cruft::parse::from_string<std::size_t> (argv[ARG_BITS]);
if (argc > ARG_BITS)
if (argc > ARG_BITS + 1)
p.minimum = cruft::parse::from_string<std::size_t> (argv[ARG_MINIMUM]);
std::cerr << p << '\n';