diff options
author | Simon Warta <[email protected]> | 2015-06-23 10:34:21 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-06-23 10:34:21 +0200 |
commit | 5ca7fb9b6744ccad16feda0d4a14132cbce6cd30 (patch) | |
tree | cd1d6da4856c57948b5c46e5b173dc7b1381e2ea /src | |
parent | 43e3c4555c9f2535f18741f3e252b3c93cbbaeca (diff) |
ifstream/ostream take std::string
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/base64.cpp | 2 | ||||
-rw-r--r-- | src/cmd/compress.cpp | 8 | ||||
-rw-r--r-- | src/cmd/dsa_sign.cpp | 2 | ||||
-rw-r--r-- | src/lib/filters/data_snk.cpp | 5 | ||||
-rw-r--r-- | src/lib/filters/data_src.cpp | 5 | ||||
-rw-r--r-- | src/lib/misc/srp6/srp6_files.cpp | 2 | ||||
-rw-r--r-- | src/tests/test_bigint.cpp | 2 | ||||
-rw-r--r-- | src/tests/test_cvc.cpp | 6 |
8 files changed, 15 insertions, 17 deletions
diff --git a/src/cmd/base64.cpp b/src/cmd/base64.cpp index b0e39132f..69682ee58 100644 --- a/src/cmd/base64.cpp +++ b/src/cmd/base64.cpp @@ -59,7 +59,7 @@ int base64(int argc, char* argv[]) { std::istream* stream; if(files[j] == "-") stream = &std::cin; - else stream = new std::ifstream(files[j].c_str()); + else stream = new std::ifstream(files[j]); if(!*stream) { diff --git a/src/cmd/compress.cpp b/src/cmd/compress.cpp index d7456fc31..6c6a98720 100644 --- a/src/cmd/compress.cpp +++ b/src/cmd/compress.cpp @@ -42,7 +42,7 @@ int compress(int argc, char* argv[]) } const std::string in_file = argv[1]; - std::ifstream in(in_file.c_str()); + std::ifstream in(in_file); if(!in.good()) { @@ -62,7 +62,7 @@ int compress(int argc, char* argv[]) } const std::string out_file = in_file + "." + suffix; - std::ofstream out(out_file.c_str()); + std::ofstream out(out_file); do_compress(*compress, in, out); @@ -84,7 +84,7 @@ void parse_extension(const std::string& in_file, int uncompress(int argc, char* argv[]) { const std::string in_file = argv[1]; - std::ifstream in(in_file.c_str()); + std::ifstream in(in_file); if(!in.good()) { @@ -95,7 +95,7 @@ int uncompress(int argc, char* argv[]) std::string out_file, suffix; parse_extension(in_file, out_file, suffix); - std::ofstream out(out_file.c_str()); + std::ofstream out(out_file); std::unique_ptr<Transform> decompress(make_decompressor(suffix)); diff --git a/src/cmd/dsa_sign.cpp b/src/cmd/dsa_sign.cpp index baf884301..41c4cbc54 100644 --- a/src/cmd/dsa_sign.cpp +++ b/src/cmd/dsa_sign.cpp @@ -39,7 +39,7 @@ int dsa_sign(int argc, char* argv[]) } std::string outfile = argv[2] + SUFFIX; - std::ofstream sigfile(outfile.c_str()); + std::ofstream sigfile(outfile); if(!sigfile) { std::cout << "Couldn't write the signature to " diff --git a/src/lib/filters/data_snk.cpp b/src/lib/filters/data_snk.cpp index 66d22ca5b..f56c2d869 100644 --- a/src/lib/filters/data_snk.cpp +++ b/src/lib/filters/data_snk.cpp @@ -40,9 +40,8 @@ DataSink_Stream::DataSink_Stream(std::ostream& out, DataSink_Stream::DataSink_Stream(const std::string& path, bool use_binary) : identifier(path), - sink_p(new std::ofstream( - path.c_str(), - use_binary ? std::ios::binary : std::ios::out)), + sink_p(new std::ofstream(path, + use_binary ? std::ios::binary : std::ios::out)), sink(*sink_p) { if(!sink.good()) diff --git a/src/lib/filters/data_src.cpp b/src/lib/filters/data_src.cpp index 969431dfc..7551b0037 100644 --- a/src/lib/filters/data_src.cpp +++ b/src/lib/filters/data_src.cpp @@ -155,9 +155,8 @@ std::string DataSource_Stream::id() const DataSource_Stream::DataSource_Stream(const std::string& path, bool use_binary) : identifier(path), - source_p(new std::ifstream( - path.c_str(), - use_binary ? std::ios::binary : std::ios::in)), + source_p(new std::ifstream(path, + use_binary ? std::ios::binary : std::ios::in)), source(*source_p), total_read(0) { diff --git a/src/lib/misc/srp6/srp6_files.cpp b/src/lib/misc/srp6/srp6_files.cpp index 50f51fa75..c028767ad 100644 --- a/src/lib/misc/srp6/srp6_files.cpp +++ b/src/lib/misc/srp6/srp6_files.cpp @@ -14,7 +14,7 @@ namespace Botan { SRP6_Authenticator_File::SRP6_Authenticator_File(const std::string& filename) { - std::ifstream in(filename.c_str()); + std::ifstream in(filename); if(!in) return; // no entries diff --git a/src/tests/test_bigint.cpp b/src/tests/test_bigint.cpp index 99114a422..82fc49861 100644 --- a/src/tests/test_bigint.cpp +++ b/src/tests/test_bigint.cpp @@ -288,7 +288,7 @@ size_t is_primetest(const std::vector<std::string>& args, size_t test_bigint() { const std::string filename = TEST_DATA_DIR "/mp_valid.dat"; - std::ifstream test_data(filename.c_str()); + std::ifstream test_data(filename); if(!test_data) throw Botan::Stream_IO_Error("Couldn't open test file " + filename); diff --git a/src/tests/test_cvc.cpp b/src/tests/test_cvc.cpp index eb10ebd40..a2e398c37 100644 --- a/src/tests/test_cvc.cpp +++ b/src/tests/test_cvc.cpp @@ -44,15 +44,15 @@ namespace { void helper_write_file(EAC_Signed_Object const& to_write, std::string const& file_path) { std::vector<byte> sv = to_write.BER_encode(); - std::ofstream cert_file(file_path.c_str(), std::ios::binary); + std::ofstream cert_file(file_path, std::ios::binary); cert_file.write((char*)&sv[0], sv.size()); cert_file.close(); } bool helper_files_equal(std::string const& file_path1, std::string const& file_path2) { - std::ifstream cert_1_in(file_path1.c_str()); - std::ifstream cert_2_in(file_path2.c_str()); + std::ifstream cert_1_in(file_path1); + std::ifstream cert_2_in(file_path2); std::vector<byte> sv1; std::vector<byte> sv2; if (!cert_1_in || !cert_2_in) |