From acb8254284f6251291e4ae25ee5e3ee6302d3029 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Fri, 26 Jun 2015 11:17:02 +0200 Subject: lib/codec: Convert &vec[0] to vec.data() --- src/lib/codec/hex/hex.cpp | 12 ++++++------ src/lib/codec/hex/hex.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/lib/codec/hex') diff --git a/src/lib/codec/hex/hex.cpp b/src/lib/codec/hex/hex.cpp index 21c5a5a03..4da719320 100644 --- a/src/lib/codec/hex/hex.cpp +++ b/src/lib/codec/hex/hex.cpp @@ -41,7 +41,7 @@ std::string hex_encode(const byte input[], std::string output(2 * input_length, 0); if(input_length) - hex_encode(&output[0], input, input_length, uppercase); + hex_encode(&output.front(), input, input_length, uppercase); return output; } @@ -156,7 +156,7 @@ size_t hex_decode(byte output[], const std::string& input, bool ignore_ws) { - return hex_decode(output, &input[0], input.length(), ignore_ws); + return hex_decode(output, input.data(), input.length(), ignore_ws); } secure_vector hex_decode_locked(const char input[], @@ -165,7 +165,7 @@ secure_vector hex_decode_locked(const char input[], { secure_vector bin(1 + input_length / 2); - size_t written = hex_decode(&bin[0], + size_t written = hex_decode(bin.data(), input, input_length, ignore_ws); @@ -177,7 +177,7 @@ secure_vector hex_decode_locked(const char input[], secure_vector hex_decode_locked(const std::string& input, bool ignore_ws) { - return hex_decode_locked(&input[0], input.size(), ignore_ws); + return hex_decode_locked(input.data(), input.size(), ignore_ws); } std::vector hex_decode(const char input[], @@ -186,7 +186,7 @@ std::vector hex_decode(const char input[], { std::vector bin(1 + input_length / 2); - size_t written = hex_decode(&bin[0], + size_t written = hex_decode(bin.data(), input, input_length, ignore_ws); @@ -198,7 +198,7 @@ std::vector hex_decode(const char input[], std::vector hex_decode(const std::string& input, bool ignore_ws) { - return hex_decode(&input[0], input.size(), ignore_ws); + return hex_decode(input.data(), input.size(), ignore_ws); } } diff --git a/src/lib/codec/hex/hex.h b/src/lib/codec/hex/hex.h index bd57ec88e..b524c43f0 100644 --- a/src/lib/codec/hex/hex.h +++ b/src/lib/codec/hex/hex.h @@ -46,7 +46,7 @@ template std::string hex_encode(const std::vector& input, bool uppercase = true) { - return hex_encode(&input[0], input.size(), uppercase); + return hex_encode(input.data(), input.size(), uppercase); } /** -- cgit v1.2.3