aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Seither <[email protected]>2015-06-20 18:11:55 +0200
committerDaniel Seither <[email protected]>2015-06-20 19:05:07 +0200
commitde51fccc5ad04ca734ee91a829298ee06ee948f4 (patch)
tree93cf8af1e8b8de4286b4e66734a1ca10a1a4803b /src
parent7dcf597fe0a7e513977e50758d649e86416f1a43 (diff)
lib/filters: Convert &vec[0] to vec.data()
Diffstat (limited to 'src')
-rw-r--r--src/lib/filters/algo_filt.cpp2
-rw-r--r--src/lib/filters/buf_filt.cpp8
-rw-r--r--src/lib/filters/buf_filt.h2
-rw-r--r--src/lib/filters/codec_filt/b64_filt.cpp20
-rw-r--r--src/lib/filters/codec_filt/hex_filt.cpp18
-rw-r--r--src/lib/filters/data_src.cpp4
-rw-r--r--src/lib/filters/fd_unix/fd_unix.cpp6
-rw-r--r--src/lib/filters/filter.cpp2
-rw-r--r--src/lib/filters/filter.h8
-rw-r--r--src/lib/filters/pipe_io.cpp8
-rw-r--r--src/lib/filters/pipe_rw.cpp10
-rw-r--r--src/lib/filters/secqueue.cpp6
-rw-r--r--src/lib/filters/threaded_fork.cpp2
13 files changed, 48 insertions, 48 deletions
diff --git a/src/lib/filters/algo_filt.cpp b/src/lib/filters/algo_filt.cpp
index 6c2176a85..6ec8cdd1d 100644
--- a/src/lib/filters/algo_filt.cpp
+++ b/src/lib/filters/algo_filt.cpp
@@ -42,7 +42,7 @@ void StreamCipher_Filter::write(const byte input[], size_t length)
while(length)
{
size_t copied = std::min<size_t>(length, m_buffer.size());
- m_cipher->cipher(input, &m_buffer[0], copied);
+ m_cipher->cipher(input, m_buffer.data(), copied);
send(m_buffer, copied);
input += copied;
length -= copied;
diff --git a/src/lib/filters/buf_filt.cpp b/src/lib/filters/buf_filt.cpp
index 9d2d87305..b03e7fdab 100644
--- a/src/lib/filters/buf_filt.cpp
+++ b/src/lib/filters/buf_filt.cpp
@@ -51,11 +51,11 @@ void Buffered_Filter::write(const byte input[], size_t input_size)
buffer_pos + input_size - final_minimum),
main_block_mod);
- buffered_block(&buffer[0], total_to_consume);
+ buffered_block(buffer.data(), total_to_consume);
buffer_pos -= total_to_consume;
- copy_mem(&buffer[0], &buffer[0] + total_to_consume, buffer_pos);
+ copy_mem(buffer.data(), buffer.data() + total_to_consume, buffer_pos);
}
if(input_size >= final_minimum)
@@ -89,12 +89,12 @@ void Buffered_Filter::end_msg()
if(spare_blocks)
{
size_t spare_bytes = main_block_mod * spare_blocks;
- buffered_block(&buffer[0], spare_bytes);
+ buffered_block(buffer.data(), spare_bytes);
buffered_final(&buffer[spare_bytes], buffer_pos - spare_bytes);
}
else
{
- buffered_final(&buffer[0], buffer_pos);
+ buffered_final(buffer.data(), buffer_pos);
}
buffer_pos = 0;
diff --git a/src/lib/filters/buf_filt.h b/src/lib/filters/buf_filt.h
index 5c94e6423..f9d996ab0 100644
--- a/src/lib/filters/buf_filt.h
+++ b/src/lib/filters/buf_filt.h
@@ -30,7 +30,7 @@ class BOTAN_DLL Buffered_Filter
template<typename Alloc>
void write(const std::vector<byte, Alloc>& in, size_t length)
{
- write(&in[0], length);
+ write(in.data(), length);
}
/**
diff --git a/src/lib/filters/codec_filt/b64_filt.cpp b/src/lib/filters/codec_filt/b64_filt.cpp
index e8bcd3749..d9e4a5f8a 100644
--- a/src/lib/filters/codec_filt/b64_filt.cpp
+++ b/src/lib/filters/codec_filt/b64_filt.cpp
@@ -37,10 +37,10 @@ void Base64_Encoder::encode_and_send(const byte input[], size_t length,
const size_t proc = std::min(length, in.size());
size_t consumed = 0;
- size_t produced = base64_encode(reinterpret_cast<char*>(&out[0]), input,
+ size_t produced = base64_encode(reinterpret_cast<char*>(out.data()), input,
proc, consumed, final_inputs);
- do_output(&out[0], produced);
+ do_output(out.data(), produced);
// FIXME: s/proc/consumed/?
input += proc;
@@ -82,7 +82,7 @@ void Base64_Encoder::write(const byte input[], size_t length)
buffer_insert(in, position, input, length);
if(position + length >= in.size())
{
- encode_and_send(&in[0], in.size());
+ encode_and_send(in.data(), in.size());
input += (in.size() - position);
length -= (in.size() - position);
while(length >= in.size())
@@ -91,7 +91,7 @@ void Base64_Encoder::write(const byte input[], size_t length)
input += in.size();
length -= in.size();
}
- copy_mem(&in[0], input, length);
+ copy_mem(in.data(), input, length);
position = 0;
}
position += length;
@@ -102,7 +102,7 @@ void Base64_Encoder::write(const byte input[], size_t length)
*/
void Base64_Encoder::end_msg()
{
- encode_and_send(&in[0], position, true);
+ encode_and_send(in.data(), position, true);
if(trailing_newline || (out_position && line_length))
send('\n');
@@ -130,8 +130,8 @@ void Base64_Decoder::write(const byte input[], size_t length)
position += to_copy;
size_t consumed = 0;
- size_t written = base64_decode(&out[0],
- reinterpret_cast<const char*>(&in[0]),
+ size_t written = base64_decode(out.data(),
+ reinterpret_cast<const char*>(in.data()),
position,
consumed,
false,
@@ -141,7 +141,7 @@ void Base64_Decoder::write(const byte input[], size_t length)
if(consumed != position)
{
- copy_mem(&in[0], &in[consumed], position - consumed);
+ copy_mem(in.data(), in.data() + consumed, position - consumed);
position = position - consumed;
}
else
@@ -158,8 +158,8 @@ void Base64_Decoder::write(const byte input[], size_t length)
void Base64_Decoder::end_msg()
{
size_t consumed = 0;
- size_t written = base64_decode(&out[0],
- reinterpret_cast<const char*>(&in[0]),
+ size_t written = base64_decode(out.data(),
+ reinterpret_cast<const char*>(in.data()),
position,
consumed,
true,
diff --git a/src/lib/filters/codec_filt/hex_filt.cpp b/src/lib/filters/codec_filt/hex_filt.cpp
index 4cf92670a..05af72680 100644
--- a/src/lib/filters/codec_filt/hex_filt.cpp
+++ b/src/lib/filters/codec_filt/hex_filt.cpp
@@ -45,7 +45,7 @@ Hex_Encoder::Hex_Encoder(Case c) : casing(c), line_length(0)
*/
void Hex_Encoder::encode_and_send(const byte block[], size_t length)
{
- hex_encode(reinterpret_cast<char*>(&out[0]),
+ hex_encode(reinterpret_cast<char*>(out.data()),
block, length,
casing == Uppercase);
@@ -78,7 +78,7 @@ void Hex_Encoder::write(const byte input[], size_t length)
buffer_insert(in, position, input, length);
if(position + length >= in.size())
{
- encode_and_send(&in[0], in.size());
+ encode_and_send(in.data(), in.size());
input += (in.size() - position);
length -= (in.size() - position);
while(length >= in.size())
@@ -87,7 +87,7 @@ void Hex_Encoder::write(const byte input[], size_t length)
input += in.size();
length -= in.size();
}
- copy_mem(&in[0], input, length);
+ copy_mem(in.data(), input, length);
position = 0;
}
position += length;
@@ -98,7 +98,7 @@ void Hex_Encoder::write(const byte input[], size_t length)
*/
void Hex_Encoder::end_msg()
{
- encode_and_send(&in[0], position);
+ encode_and_send(in.data(), position);
if(counter && line_length)
send('\n');
counter = position = 0;
@@ -126,8 +126,8 @@ void Hex_Decoder::write(const byte input[], size_t length)
position += to_copy;
size_t consumed = 0;
- size_t written = hex_decode(&out[0],
- reinterpret_cast<const char*>(&in[0]),
+ size_t written = hex_decode(out.data(),
+ reinterpret_cast<const char*>(in.data()),
position,
consumed,
checking != FULL_CHECK);
@@ -136,7 +136,7 @@ void Hex_Decoder::write(const byte input[], size_t length)
if(consumed != position)
{
- copy_mem(&in[0], &in[consumed], position - consumed);
+ copy_mem(in.data(), in.data() + consumed, position - consumed);
position = position - consumed;
}
else
@@ -153,8 +153,8 @@ void Hex_Decoder::write(const byte input[], size_t length)
void Hex_Decoder::end_msg()
{
size_t consumed = 0;
- size_t written = hex_decode(&out[0],
- reinterpret_cast<const char*>(&in[0]),
+ size_t written = hex_decode(out.data(),
+ reinterpret_cast<const char*>(in.data()),
position,
consumed,
checking != FULL_CHECK);
diff --git a/src/lib/filters/data_src.cpp b/src/lib/filters/data_src.cpp
index 0b13f9e66..969431dfc 100644
--- a/src/lib/filters/data_src.cpp
+++ b/src/lib/filters/data_src.cpp
@@ -47,7 +47,7 @@ size_t DataSource::discard_next(size_t n)
size_t DataSource_Memory::read(byte out[], size_t length)
{
size_t got = std::min<size_t>(source.size() - offset, length);
- copy_mem(out, &source[offset], got);
+ copy_mem(out, source.data() + offset, got);
offset += got;
return got;
}
@@ -112,7 +112,7 @@ size_t DataSource_Stream::peek(byte out[], size_t length, size_t offset) const
if(offset)
{
secure_vector<byte> buf(offset);
- source.read(reinterpret_cast<char*>(&buf[0]), buf.size());
+ source.read(reinterpret_cast<char*>(buf.data()), buf.size());
if(source.bad())
throw Stream_IO_Error("DataSource_Stream::peek: Source failure");
got = source.gcount();
diff --git a/src/lib/filters/fd_unix/fd_unix.cpp b/src/lib/filters/fd_unix/fd_unix.cpp
index 891419f9d..a809ba8d8 100644
--- a/src/lib/filters/fd_unix/fd_unix.cpp
+++ b/src/lib/filters/fd_unix/fd_unix.cpp
@@ -19,7 +19,7 @@ int operator<<(int fd, Pipe& pipe)
secure_vector<byte> buffer(DEFAULT_BUFFERSIZE);
while(pipe.remaining())
{
- size_t got = pipe.read(&buffer[0], buffer.size());
+ size_t got = pipe.read(buffer.data(), buffer.size());
size_t position = 0;
while(got)
{
@@ -41,11 +41,11 @@ int operator>>(int fd, Pipe& pipe)
secure_vector<byte> buffer(DEFAULT_BUFFERSIZE);
while(true)
{
- ssize_t ret = read(fd, &buffer[0], buffer.size());
+ ssize_t ret = read(fd, buffer.data(), buffer.size());
if(ret == 0) break;
if(ret == -1)
throw Stream_IO_Error("Pipe input operator (unixfd) has failed");
- pipe.write(&buffer[0], ret);
+ pipe.write(buffer.data(), ret);
}
return fd;
}
diff --git a/src/lib/filters/filter.cpp b/src/lib/filters/filter.cpp
index 956ab99d7..0bbde2853 100644
--- a/src/lib/filters/filter.cpp
+++ b/src/lib/filters/filter.cpp
@@ -35,7 +35,7 @@ void Filter::send(const byte input[], size_t length)
if(next[j])
{
if(write_queue.size())
- next[j]->write(&write_queue[0], write_queue.size());
+ next[j]->write(write_queue.data(), write_queue.size());
next[j]->write(input, length);
nothing_attached = false;
}
diff --git a/src/lib/filters/filter.h b/src/lib/filters/filter.h
index 1ac6e21b6..9e28655c2 100644
--- a/src/lib/filters/filter.h
+++ b/src/lib/filters/filter.h
@@ -67,12 +67,12 @@ class BOTAN_DLL Filter
/**
* @param in some input for the filter
*/
- void send(const secure_vector<byte>& in) { send(&in[0], in.size()); }
+ void send(const secure_vector<byte>& in) { send(in.data(), in.size()); }
/**
* @param in some input for the filter
*/
- void send(const std::vector<byte>& in) { send(&in[0], in.size()); }
+ void send(const std::vector<byte>& in) { send(in.data(), in.size()); }
/**
* @param in some input for the filter
@@ -80,7 +80,7 @@ class BOTAN_DLL Filter
*/
void send(const secure_vector<byte>& in, size_t length)
{
- send(&in[0], length);
+ send(in.data(), length);
}
/**
@@ -89,7 +89,7 @@ class BOTAN_DLL Filter
*/
void send(const std::vector<byte>& in, size_t length)
{
- send(&in[0], length);
+ send(in.data(), length);
}
Filter();
diff --git a/src/lib/filters/pipe_io.cpp b/src/lib/filters/pipe_io.cpp
index b7381a2f7..ce476fd94 100644
--- a/src/lib/filters/pipe_io.cpp
+++ b/src/lib/filters/pipe_io.cpp
@@ -18,8 +18,8 @@ std::ostream& operator<<(std::ostream& stream, Pipe& pipe)
secure_vector<byte> buffer(DEFAULT_BUFFERSIZE);
while(stream.good() && pipe.remaining())
{
- size_t got = pipe.read(&buffer[0], buffer.size());
- stream.write(reinterpret_cast<const char*>(&buffer[0]), got);
+ size_t got = pipe.read(buffer.data(), buffer.size());
+ stream.write(reinterpret_cast<const char*>(buffer.data()), got);
}
if(!stream.good())
throw Stream_IO_Error("Pipe output operator (iostream) has failed");
@@ -34,8 +34,8 @@ std::istream& operator>>(std::istream& stream, Pipe& pipe)
secure_vector<byte> buffer(DEFAULT_BUFFERSIZE);
while(stream.good())
{
- stream.read(reinterpret_cast<char*>(&buffer[0]), buffer.size());
- pipe.write(&buffer[0], stream.gcount());
+ stream.read(reinterpret_cast<char*>(buffer.data()), buffer.size());
+ pipe.write(buffer.data(), stream.gcount());
}
if(stream.bad() || (stream.fail() && !stream.eof()))
throw Stream_IO_Error("Pipe input operator (iostream) has failed");
diff --git a/src/lib/filters/pipe_rw.cpp b/src/lib/filters/pipe_rw.cpp
index 10b4f5666..077bd93bb 100644
--- a/src/lib/filters/pipe_rw.cpp
+++ b/src/lib/filters/pipe_rw.cpp
@@ -63,8 +63,8 @@ void Pipe::write(DataSource& source)
secure_vector<byte> buffer(DEFAULT_BUFFERSIZE);
while(!source.end_of_data())
{
- size_t got = source.read(&buffer[0], buffer.size());
- write(&buffer[0], got);
+ size_t got = source.read(buffer.data(), buffer.size());
+ write(buffer.data(), got);
}
}
@@ -99,7 +99,7 @@ secure_vector<byte> Pipe::read_all(message_id msg)
{
msg = ((msg != DEFAULT_MESSAGE) ? msg : default_msg());
secure_vector<byte> buffer(remaining(msg));
- size_t got = read(&buffer[0], buffer.size(), msg);
+ size_t got = read(buffer.data(), buffer.size(), msg);
buffer.resize(got);
return buffer;
}
@@ -116,10 +116,10 @@ std::string Pipe::read_all_as_string(message_id msg)
while(true)
{
- size_t got = read(&buffer[0], buffer.size(), msg);
+ size_t got = read(buffer.data(), buffer.size(), msg);
if(got == 0)
break;
- str.append(reinterpret_cast<const char*>(&buffer[0]), got);
+ str.append(reinterpret_cast<const char*>(buffer.data()), got);
}
return str;
diff --git a/src/lib/filters/secqueue.cpp b/src/lib/filters/secqueue.cpp
index db6274c90..718223876 100644
--- a/src/lib/filters/secqueue.cpp
+++ b/src/lib/filters/secqueue.cpp
@@ -25,7 +25,7 @@ class SecureQueueNode
size_t write(const byte input[], size_t length)
{
size_t copied = std::min<size_t>(length, buffer.size() - end);
- copy_mem(&buffer[end], input, copied);
+ copy_mem(buffer.data() + end, input, copied);
end += copied;
return copied;
}
@@ -33,7 +33,7 @@ class SecureQueueNode
size_t read(byte output[], size_t length)
{
size_t copied = std::min(length, end - start);
- copy_mem(output, &buffer[start], copied);
+ copy_mem(output, buffer.data() + start, copied);
start += copied;
return copied;
}
@@ -43,7 +43,7 @@ class SecureQueueNode
const size_t left = end - start;
if(offset >= left) return 0;
size_t copied = std::min(length, left - offset);
- copy_mem(output, &buffer[start + offset], copied);
+ copy_mem(output, buffer.data() + start + offset, copied);
return copied;
}
diff --git a/src/lib/filters/threaded_fork.cpp b/src/lib/filters/threaded_fork.cpp
index c01c84057..a6bb4c713 100644
--- a/src/lib/filters/threaded_fork.cpp
+++ b/src/lib/filters/threaded_fork.cpp
@@ -97,7 +97,7 @@ void Threaded_Fork::set_next(Filter* f[], size_t n)
void Threaded_Fork::send(const byte input[], size_t length)
{
if(write_queue.size())
- thread_delegate_work(&write_queue[0], write_queue.size());
+ thread_delegate_work(write_queue.data(), write_queue.size());
thread_delegate_work(input, length);
bool nothing_attached = true;