From 624787ec08f215a7b0be51ceeeb211a717bf7f50 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 7 Jan 2015 13:13:29 +0000 Subject: Avoid referencing &vec[vec.size()] as this triggers iterator debugging asserts in MSVC 2013. Github pull 36 from Simon Warta. --- src/lib/algo_base/symkey.h | 2 +- src/lib/filters/data_src.h | 2 +- src/lib/filters/pipe.cpp | 4 ++-- src/lib/filters/pipe.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/algo_base/symkey.h b/src/lib/algo_base/symkey.h index a93f456bb..7dfe9fbcd 100644 --- a/src/lib/algo_base/symkey.h +++ b/src/lib/algo_base/symkey.h @@ -86,7 +86,7 @@ class BOTAN_DLL OctetString * Create a new OctetString * @param in a bytestring */ - OctetString(const std::vector& in) : bits(&in[0], &in[in.size()]) {} + OctetString(const std::vector& in) : bits(in.begin(), in.end()) {} private: secure_vector bits; }; diff --git a/src/lib/filters/data_src.h b/src/lib/filters/data_src.h index e28ef7be1..817bd2e8b 100644 --- a/src/lib/filters/data_src.h +++ b/src/lib/filters/data_src.h @@ -127,7 +127,7 @@ class BOTAN_DLL DataSource_Memory : public DataSource * @param in the MemoryRegion to read from */ DataSource_Memory(const std::vector& in) : - source(&in[0], &in[in.size()]), offset(0) {} + source(in.begin(), in.end()), offset(0) {} virtual size_t get_bytes_read() const { return offset; } private: diff --git a/src/lib/filters/pipe.cpp b/src/lib/filters/pipe.cpp index e3c2f53b6..e89dd79bf 100644 --- a/src/lib/filters/pipe.cpp +++ b/src/lib/filters/pipe.cpp @@ -126,12 +126,12 @@ void Pipe::process_msg(const byte input[], size_t length) */ void Pipe::process_msg(const secure_vector& input) { - process_msg(&input[0], input.size()); + process_msg(input.data(), input.size()); } void Pipe::process_msg(const std::vector& input) { - process_msg(&input[0], input.size()); + process_msg(input.data(), input.size()); } /* diff --git a/src/lib/filters/pipe.h b/src/lib/filters/pipe.h index ec56d4503..1fb03801f 100644 --- a/src/lib/filters/pipe.h +++ b/src/lib/filters/pipe.h @@ -70,14 +70,14 @@ class BOTAN_DLL Pipe : public DataSource * @param in the secure_vector containing the data to write */ void write(const secure_vector& in) - { write(&in[0], in.size()); } + { write(in.data(), in.size()); } /** * Write input to the pipe, i.e. to its first filter. * @param in the std::vector containing the data to write */ void write(const std::vector& in) - { write(&in[0], in.size()); } + { write(in.data(), in.size()); } /** * Write input to the pipe, i.e. to its first filter. -- cgit v1.2.3