diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-07-22 16:26:28 +0200 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-07-24 15:32:27 +0200 |
commit | 3333f950d49f13662842650ae76599a0dff052eb (patch) | |
tree | 969a51d095f120ac95e01062cc4f8590aaa21727 /src/span.h | |
parent | fa6394dd10ae71755e46fd523dd43c2a1f2b832d (diff) | |
download | bitcoin-3333f950d49f13662842650ae76599a0dff052eb.tar.xz |
refactor: Avoid casting away constness
Seems confusing and brittle to remove const and then add it back in the
return type.
Diffstat (limited to 'src/span.h')
-rw-r--r-- | src/span.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/span.h b/src/span.h index 0563556dc2..792a0a9c07 100644 --- a/src/span.h +++ b/src/span.h @@ -270,7 +270,7 @@ Span<std::byte> MakeWritableByteSpan(V&& v) noexcept inline unsigned char* UCharCast(char* c) { return (unsigned char*)c; } inline unsigned char* UCharCast(unsigned char* c) { return c; } inline unsigned char* UCharCast(std::byte* c) { return (unsigned char*)c; } -inline const unsigned char* UCharCast(const char* c) { return (unsigned char*)c; } +inline const unsigned char* UCharCast(const char* c) { return reinterpret_cast<const unsigned char*>(c); } inline const unsigned char* UCharCast(const unsigned char* c) { return c; } inline const unsigned char* UCharCast(const std::byte* c) { return reinterpret_cast<const unsigned char*>(c); } |