aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli/compress.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-10-22 12:39:45 -0400
committerJack Lloyd <[email protected]>2017-10-24 11:51:28 -0400
commit3feae2f7893090b263e762c79b47b99f7f4d07ba (patch)
tree09f0bac281886ff0003d8d07ee90c7aa2e729985 /src/cli/compress.cpp
parentda0a1124242e3a108819df58054e8dd909268a00 (diff)
Refactor option parsing in cli and test code
Allows cleaning up header includes, also somewhat smaller binaries.
Diffstat (limited to 'src/cli/compress.cpp')
-rw-r--r--src/cli/compress.cpp13
1 files changed, 7 insertions, 6 deletions
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 <botan/compression.h>
+ #include <fstream>
#endif
namespace Botan_CLI {
@@ -75,17 +76,17 @@ class Compress final : public Command
while(in.good())
{
buf.resize(buf_size);
- in.read(reinterpret_cast<char*>(&buf[0]), buf.size());
+ in.read(reinterpret_cast<char*>(buf.data()), buf.size());
buf.resize(in.gcount());
compress->update(buf);
- out.write(reinterpret_cast<const char*>(&buf[0]), buf.size());
+ out.write(reinterpret_cast<const char*>(buf.data()), buf.size());
}
buf.clear();
compress->finish(buf);
- out.write(reinterpret_cast<const char*>(&buf[0]), buf.size());
+ out.write(reinterpret_cast<const char*>(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<char*>(&buf[0]), buf.size());
+ in.read(reinterpret_cast<char*>(buf.data()), buf.size());
buf.resize(in.gcount());
decompress->update(buf);
- out.write(reinterpret_cast<const char*>(&buf[0]), buf.size());
+ out.write(reinterpret_cast<const char*>(buf.data()), buf.size());
}
buf.clear();
decompress->finish(buf);
- out.write(reinterpret_cast<const char*>(&buf[0]), buf.size());
+ out.write(reinterpret_cast<const char*>(buf.data()), buf.size());
out.close();
}
};