aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-01-07 13:13:29 +0000
committerlloyd <[email protected]>2015-01-07 13:13:29 +0000
commit624787ec08f215a7b0be51ceeeb211a717bf7f50 (patch)
tree79073a261e944303db3183b8c3bf31ac91c37b77
parentbb1228d8a9e6f823f4875a1f6bafa9726ef506ae (diff)
Avoid referencing &vec[vec.size()] as this triggers iterator debugging
asserts in MSVC 2013. Github pull 36 from Simon Warta.
-rw-r--r--src/lib/algo_base/symkey.h2
-rw-r--r--src/lib/filters/data_src.h2
-rw-r--r--src/lib/filters/pipe.cpp4
-rw-r--r--src/lib/filters/pipe.h4
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<byte>& in) : bits(&in[0], &in[in.size()]) {}
+ OctetString(const std::vector<byte>& in) : bits(in.begin(), in.end()) {}
private:
secure_vector<byte> 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<byte>& 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<byte>& input)
{
- process_msg(&input[0], input.size());
+ process_msg(input.data(), input.size());
}
void Pipe::process_msg(const std::vector<byte>& 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<byte>& 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<byte>& in)
- { write(&in[0], in.size()); }
+ { write(in.data(), in.size()); }
/**
* Write input to the pipe, i.e. to its first filter.