diff options
Diffstat (limited to 'src/lib/utils')
-rw-r--r-- | src/lib/utils/data_src.cpp | 14 | ||||
-rw-r--r-- | src/lib/utils/data_src.h | 11 |
2 files changed, 10 insertions, 15 deletions
diff --git a/src/lib/utils/data_src.cpp b/src/lib/utils/data_src.cpp index 169f8e186..55202daac 100644 --- a/src/lib/utils/data_src.cpp +++ b/src/lib/utils/data_src.cpp @@ -101,8 +101,6 @@ DataSource_Memory::DataSource_Memory(const std::string& in) : { } -#if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM) - /* * Read from a stream */ @@ -176,6 +174,8 @@ std::string DataSource_Stream::id() const return m_identifier; } +#if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM) + /* * DataSource_Stream Constructor */ @@ -194,26 +194,22 @@ DataSource_Stream::DataSource_Stream(const std::string& path, } } +#endif + /* * DataSource_Stream Constructor */ DataSource_Stream::DataSource_Stream(std::istream& in, const std::string& name) : m_identifier(name), - m_source_p(nullptr), m_source(in), m_total_read(0) { } -/* -* DataSource_Stream Destructor -*/ DataSource_Stream::~DataSource_Stream() { - delete m_source_p; + // for ~unique_ptr } -#endif - } diff --git a/src/lib/utils/data_src.h b/src/lib/utils/data_src.h index ea28b7602..29f557606 100644 --- a/src/lib/utils/data_src.h +++ b/src/lib/utils/data_src.h @@ -137,8 +137,6 @@ class BOTAN_DLL DataSource_Memory : public DataSource size_t m_offset; }; -#if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM) - /** * This class represents a Stream-Based DataSource. */ @@ -154,12 +152,14 @@ class BOTAN_DLL DataSource_Stream : public DataSource DataSource_Stream(std::istream&, const std::string& id = "<std::istream>"); +#if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM) /** - * Construct a Stream-Based DataSource from file - * @param file the name of the file + * Construct a Stream-Based DataSource from filesystem path + * @param file the path to the file * @param use_binary whether to treat the file as binary or not */ DataSource_Stream(const std::string& file, bool use_binary = false); +#endif DataSource_Stream(const DataSource_Stream&) = delete; @@ -171,13 +171,12 @@ class BOTAN_DLL DataSource_Stream : public DataSource private: const std::string m_identifier; + std::unique_ptr<std::istream> m_source_memory; std::istream* m_source_p; std::istream& m_source; size_t m_total_read; }; -#endif - } #endif |