correct cppcheck warnings; notably use of std::vector::reserve where std::vector::resize was intended.