$NetBSD: patch-lib_Unicode.cc,v 1.2 2023/02/18 02:15:01 gutteridge Exp $ Fix builds on older NetBSD releases, which have an unusual prototype for iconv. --- lib/Unicode.cc.orig 2014-08-30 08:23:20.000000000 +0000 +++ lib/Unicode.cc @@ -35,6 +35,9 @@ # include #endif +#ifdef __NetBSD__ +#include +#endif namespace bt { @@ -83,9 +86,13 @@ namespace bt { if (cd == invalid) return; - char *inp = - reinterpret_cast +#if defined(__NetBSD__) && (__NetBSD_Version__-0 < 999001700) + const char *inp = + reinterpret_cast (const_cast(in.data())); +#else + char *inp = const_cast(reinterpret_cast((in.data()))); +#endif const typename _Source::size_type in_size = in.size() * sizeof(typename _Source::value_type); typename _Source::size_type in_bytes = in_size; @@ -108,9 +115,13 @@ namespace bt { case EINVAL: { const typename _Source::size_type off = in_size - in_bytes + 1; +#if defined(__NetBSD__) && (__NetBSD_Version__-0 < 999001700) inp = - reinterpret_cast + reinterpret_cast (const_cast(in.data())); +#else + inp = const_cast(reinterpret_cast((in.data()))); +#endif in_bytes = in_size - off; break; }