diff options
Diffstat (limited to 'src/lib/math')
-rw-r--r-- | src/lib/math/bigint/big_code.cpp | 6 | ||||
-rw-r--r-- | src/lib/math/bigint/big_io.cpp | 2 | ||||
-rw-r--r-- | src/lib/math/bigint/bigint.cpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/math/bigint/big_code.cpp b/src/lib/math/bigint/big_code.cpp index f7ab53291..c42819965 100644 --- a/src/lib/math/bigint/big_code.cpp +++ b/src/lib/math/bigint/big_code.cpp @@ -26,7 +26,7 @@ void BigInt::encode(uint8_t output[], const BigInt& n, Base base) secure_vector<uint8_t> binary(n.encoded_size(Binary)); n.binary_encode(binary.data()); - hex_encode(reinterpret_cast<char*>(output), + hex_encode(cast_uint8_ptr_to_char(output), binary.data(), binary.size()); } else if(base == Decimal) @@ -128,12 +128,12 @@ BigInt BigInt::decode(const uint8_t buf[], size_t length, Base base) binary = hex_decode_locked(buf0_with_leading_0, 2); - binary += hex_decode_locked(reinterpret_cast<const char*>(&buf[1]), + binary += hex_decode_locked(cast_uint8_ptr_to_char(&buf[1]), length - 1, false); } else - binary = hex_decode_locked(reinterpret_cast<const char*>(buf), + binary = hex_decode_locked(cast_uint8_ptr_to_char(buf), length, false); r.binary_decode(binary.data(), binary.size()); diff --git a/src/lib/math/bigint/big_io.cpp b/src/lib/math/bigint/big_io.cpp index 7d990e25e..803e1cc4a 100644 --- a/src/lib/math/bigint/big_io.cpp +++ b/src/lib/math/bigint/big_io.cpp @@ -32,7 +32,7 @@ std::ostream& operator<<(std::ostream& stream, const BigInt& n) size_t skip = 0; while(skip < buffer.size() && buffer[skip] == '0') ++skip; - stream.write(reinterpret_cast<const char*>(buffer.data()) + skip, + stream.write(cast_uint8_ptr_to_char(buffer.data()) + skip, buffer.size() - skip); } if(!stream.good()) diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp index 47ff2482a..28fe68f00 100644 --- a/src/lib/math/bigint/bigint.cpp +++ b/src/lib/math/bigint/bigint.cpp @@ -68,7 +68,7 @@ BigInt::BigInt(const std::string& str) base = Hexadecimal; } - *this = decode(reinterpret_cast<const uint8_t*>(str.data()) + markers, + *this = decode(cast_char_ptr_to_uint8(str.data()) + markers, str.length() - markers, base); if(negative) set_sign(Negative); |