aboutsummaryrefslogtreecommitdiff
path: root/src/streams.h
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2018-10-03 14:52:08 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2018-11-23 16:58:44 +0100
commit958e1a307e92f6678459ebdcd64e05b61f5f3a77 (patch)
treef7d339797455d9d0a94de6d41bca40bd2a5f291d /src/streams.h
parent2607c38fc5170409dd13f3061ba5e5fa2de6438d (diff)
streams: Remove unused seek(size_t)
Diffstat (limited to 'src/streams.h')
-rw-r--r--src/streams.h20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/streams.h b/src/streams.h
index dc20f7a9da..49a7303d47 100644
--- a/src/streams.h
+++ b/src/streams.h
@@ -126,12 +126,6 @@ class CVectorWriter
{
return nType;
}
- void seek(size_t nSize)
- {
- nPos += nSize;
- if(nPos > vchData.size())
- vchData.resize(nPos);
- }
private:
const int nType;
const int nVersion;
@@ -158,9 +152,11 @@ public:
* @param[in] pos Starting position. Vector index where reads should start.
*/
VectorReader(int type, int version, const std::vector<unsigned char>& data, size_t pos)
- : m_type(type), m_version(version), m_data(data)
+ : m_type(type), m_version(version), m_data(data), m_pos(pos)
{
- seek(pos);
+ if (m_pos > m_data.size()) {
+ throw std::ios_base::failure("VectorReader(...): end of data (m_pos > m_data.size())");
+ }
}
/*
@@ -203,14 +199,6 @@ public:
memcpy(dst, m_data.data() + m_pos, n);
m_pos = pos_next;
}
-
- void seek(size_t n)
- {
- m_pos += n;
- if (m_pos > m_data.size()) {
- throw std::ios_base::failure("VectorReader::seek(): end of data");
- }
- }
};
/** Double ended buffer combining vector and stream-like interfaces.