From 3feae2f7893090b263e762c79b47b99f7f4d07ba Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 22 Oct 2017 12:39:45 -0400 Subject: Refactor option parsing in cli and test code Allows cleaning up header includes, also somewhat smaller binaries. --- src/cli/compress.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/cli/compress.cpp') diff --git a/src/cli/compress.cpp b/src/cli/compress.cpp index c60a33921..e9cd02290 100644 --- a/src/cli/compress.cpp +++ b/src/cli/compress.cpp @@ -8,6 +8,7 @@ #if defined(BOTAN_HAS_COMPRESSION) #include + #include #endif namespace Botan_CLI { @@ -75,17 +76,17 @@ class Compress final : public Command while(in.good()) { buf.resize(buf_size); - in.read(reinterpret_cast(&buf[0]), buf.size()); + in.read(reinterpret_cast(buf.data()), buf.size()); buf.resize(in.gcount()); compress->update(buf); - out.write(reinterpret_cast(&buf[0]), buf.size()); + out.write(reinterpret_cast(buf.data()), buf.size()); } buf.clear(); compress->finish(buf); - out.write(reinterpret_cast(&buf[0]), buf.size()); + out.write(reinterpret_cast(buf.data()), buf.size()); out.close(); } }; @@ -147,17 +148,17 @@ class Decompress final : public Command while(in.good()) { buf.resize(buf_size); - in.read(reinterpret_cast(&buf[0]), buf.size()); + in.read(reinterpret_cast(buf.data()), buf.size()); buf.resize(in.gcount()); decompress->update(buf); - out.write(reinterpret_cast(&buf[0]), buf.size()); + out.write(reinterpret_cast(buf.data()), buf.size()); } buf.clear(); decompress->finish(buf); - out.write(reinterpret_cast(&buf[0]), buf.size()); + out.write(reinterpret_cast(buf.data()), buf.size()); out.close(); } }; -- cgit v1.2.3