diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index ca671ab12..2feb94c8a 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -391,8 +391,14 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string& while (0 != src_bytes) { - size_t const iconv_result = iconv(conv_desc, (char**)(&src_buffer), &src_bytes, - &dst_buffer, &dst_bytes); + const char** iconv_inbuff = reinterpret_cast(&src_buffer); + + // This const_cast is here because iconv declares its second argument as + // "char**" where it should be "const char**" because the only thing + // actually modified is the pointer, hence the const_cast. + const size_t iconv_result = iconv(conv_desc, + const_cast(iconv_inbuff), + &src_bytes, &dst_buffer, &dst_bytes); if (static_cast(-1) == iconv_result) {