aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/utils/datastor/datastor.cpp4
-rw-r--r--src/lib/utils/http_util/http_util.cpp6
-rw-r--r--src/lib/utils/loadstor.h4
-rw-r--r--src/lib/utils/stl_util.h3
-rw-r--r--src/lib/utils/xor_buf.h8
5 files changed, 12 insertions, 13 deletions
diff --git a/src/lib/utils/datastor/datastor.cpp b/src/lib/utils/datastor/datastor.cpp
index 344c03f7c..69c1bf453 100644
--- a/src/lib/utils/datastor/datastor.cpp
+++ b/src/lib/utils/datastor/datastor.cpp
@@ -141,12 +141,12 @@ void Data_Store::add(const std::string& key, u32bit val)
*/
void Data_Store::add(const std::string& key, const secure_vector<byte>& val)
{
- add(key, hex_encode(&val[0], val.size()));
+ add(key, hex_encode(val.data(), val.size()));
}
void Data_Store::add(const std::string& key, const std::vector<byte>& val)
{
- add(key, hex_encode(&val[0], val.size()));
+ add(key, hex_encode(val.data(), val.size()));
}
/*
diff --git a/src/lib/utils/http_util/http_util.cpp b/src/lib/utils/http_util/http_util.cpp
index 913d4fd19..1a15d6418 100644
--- a/src/lib/utils/http_util/http_util.cpp
+++ b/src/lib/utils/http_util/http_util.cpp
@@ -123,7 +123,7 @@ Response http_sync(http_exch_fn http_transact,
if(content_type != "")
outbuf << "Content-Type: " << content_type << "\r\n";
outbuf << "Connection: close\r\n\r\n";
- outbuf.write(reinterpret_cast<const char*>(&body[0]), body.size());
+ outbuf.write(reinterpret_cast<const char*>(body.data()), body.size());
std::istringstream io(http_transact(hostname, outbuf.str()));
@@ -171,8 +171,8 @@ Response http_sync(http_exch_fn http_transact,
std::vector<byte> buf(4096);
while(io.good())
{
- io.read(reinterpret_cast<char*>(&buf[0]), buf.size());
- resp_body.insert(resp_body.end(), &buf[0], &buf[io.gcount()]);
+ io.read(reinterpret_cast<char*>(buf.data()), buf.size());
+ resp_body.insert(resp_body.end(), buf.data(), &buf[io.gcount()]);
}
const std::string header_size = search_map(headers, std::string("Content-Length"));
diff --git a/src/lib/utils/loadstor.h b/src/lib/utils/loadstor.h
index 4db3d07fa..d3871480c 100644
--- a/src/lib/utils/loadstor.h
+++ b/src/lib/utils/loadstor.h
@@ -641,7 +641,7 @@ void copy_out_be(byte out[], size_t out_bytes, const T in[])
template<typename T, typename Alloc>
void copy_out_vec_be(byte out[], size_t out_bytes, const std::vector<T, Alloc>& in)
{
- copy_out_be(out, out_bytes, &in[0]);
+ copy_out_be(out, out_bytes, in.data());
}
template<typename T>
@@ -662,7 +662,7 @@ void copy_out_le(byte out[], size_t out_bytes, const T in[])
template<typename T, typename Alloc>
void copy_out_vec_le(byte out[], size_t out_bytes, const std::vector<T, Alloc>& in)
{
- copy_out_le(out, out_bytes, &in[0]);
+ copy_out_le(out, out_bytes, in.data());
}
}
diff --git a/src/lib/utils/stl_util.h b/src/lib/utils/stl_util.h
index 06f09498e..76cf77ef8 100644
--- a/src/lib/utils/stl_util.h
+++ b/src/lib/utils/stl_util.h
@@ -16,8 +16,7 @@ namespace Botan {
inline std::vector<byte> to_byte_vector(const std::string& s)
{
- return std::vector<byte>(reinterpret_cast<const byte*>(&s[0]),
- reinterpret_cast<const byte*>(&s[s.size()]));
+ return std::vector<byte>(s.cbegin(), s.cend());
}
/*
diff --git a/src/lib/utils/xor_buf.h b/src/lib/utils/xor_buf.h
index 967348d4c..23151f72e 100644
--- a/src/lib/utils/xor_buf.h
+++ b/src/lib/utils/xor_buf.h
@@ -107,7 +107,7 @@ void xor_buf(std::vector<byte, Alloc>& out,
const std::vector<byte, Alloc2>& in,
size_t n)
{
- xor_buf(&out[0], &in[0], n);
+ xor_buf(out.data(), in.data(), n);
}
template<typename Alloc>
@@ -115,7 +115,7 @@ void xor_buf(std::vector<byte, Alloc>& out,
const byte* in,
size_t n)
{
- xor_buf(&out[0], in, n);
+ xor_buf(out.data(), in, n);
}
template<typename Alloc, typename Alloc2>
@@ -124,7 +124,7 @@ void xor_buf(std::vector<byte, Alloc>& out,
const std::vector<byte, Alloc2>& in2,
size_t n)
{
- xor_buf(&out[0], &in[0], &in2[0], n);
+ xor_buf(out.data(), in, in2.data(), n);
}
template<typename T, typename Alloc, typename Alloc2>
@@ -135,7 +135,7 @@ operator^=(std::vector<T, Alloc>& out,
if(out.size() < in.size())
out.resize(in.size());
- xor_buf(&out[0], &in[0], in.size());
+ xor_buf(out.data(), in.data(), in.size());
return out;
}