diff options
author | Yury Melnichek <melnichek@gmail.com> | 2012-09-25 21:37:18 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:43:50 +0300 |
commit | 1aabac1393098d8ce12b059cfe712c648b42fc56 (patch) | |
tree | 627f1b669051d38bc767fc910cb3689d198a304d /coding/dd_vector.hpp | |
parent | 122429fbf20f839cd36db16713891228bc1c4ec0 (diff) |
BlobStorage: more code review fixes.
Diffstat (limited to 'coding/dd_vector.hpp')
-rw-r--r-- | coding/dd_vector.hpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/coding/dd_vector.hpp b/coding/dd_vector.hpp index 3661c18f64..f31452d6d9 100644 --- a/coding/dd_vector.hpp +++ b/coding/dd_vector.hpp @@ -4,6 +4,7 @@ #include "../base/assert.hpp" #include "../base/base.hpp" +#include "../base/exception.hpp" #include "../base/src_point.hpp" #include "../std/type_traits.hpp" @@ -23,6 +24,8 @@ public: typedef TDifference difference_type; typedef TReader ReaderType; + DECLARE_EXCEPTION(OpenException, RootException); + DDVector() : m_Size(0) {} explicit DDVector(TReader const & reader) : m_reader(reader) @@ -163,6 +166,8 @@ public: private: void InitSize() { + if ((m_reader.Size() % sizeof(T)) != 0) + MYTHROW(OpenException, (m_reader.Size(), sizeof(T))); // TODO: Check that reader.Size() % sizeof(T) == 0 m_Size = m_reader.Size() / sizeof(T); } |