Date: Wed, 16 Jan 2019 20:36:47 +0000 (UTC) From: Tijl Coosemans <tijl@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r490518 - in head/devel/boost-libs: . files Message-ID: <201901162036.x0GKal5r088815@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tijl Date: Wed Jan 16 20:36:47 2019 New Revision: 490518 URL: https://svnweb.freebsd.org/changeset/ports/490518 Log: Fix use of iconv in Boost Locale. On FreeBSD it used __ICONV_F_HIDE_INVALID which hides invalid sequences, but what Boost really wants is that iconv returns an error on invalid sequences like GNU libiconv does by default. On FreeBSD ICONV_SET_ILSEQ_INVALID can be used for this. It has to be set via iconvctl. PR: 215393 Added: head/devel/boost-libs/files/patch-libs_locale_src_encoding_iconv_codepage.ipp (contents, props changed) head/devel/boost-libs/files/patch-libs_locale_src_posix_codecvt.cpp (contents, props changed) head/devel/boost-libs/files/patch-libs_locale_src_util_iconv.hpp (contents, props changed) Modified: head/devel/boost-libs/Makefile Modified: head/devel/boost-libs/Makefile ============================================================================== --- head/devel/boost-libs/Makefile Wed Jan 16 20:17:52 2019 (r490517) +++ head/devel/boost-libs/Makefile Wed Jan 16 20:36:47 2019 (r490518) @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= boost-libs -PORTREVISION= 0 +PORTREVISION= 1 COMMENT= Free portable C++ libraries (without Boost.Python) Added: head/devel/boost-libs/files/patch-libs_locale_src_encoding_iconv_codepage.ipp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/boost-libs/files/patch-libs_locale_src_encoding_iconv_codepage.ipp Wed Jan 16 20:36:47 2019 (r490518) @@ -0,0 +1,11 @@ +--- libs/locale/src/encoding/iconv_codepage.ipp.orig 2017-09-02 09:56:14 UTC ++++ libs/locale/src/encoding/iconv_codepage.ipp +@@ -43,7 +43,7 @@ class iconverter_base { (public) + bool open(char const *to,char const *from,method_type how) + { + close(); +- cvt_ = iconv_open(to,from); ++ cvt_ = call_iconv_open(to,from); + how_ = how; + return cvt_ != (iconv_t)(-1); + } Added: head/devel/boost-libs/files/patch-libs_locale_src_posix_codecvt.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/boost-libs/files/patch-libs_locale_src_posix_codecvt.cpp Wed Jan 16 20:36:47 2019 (r490518) @@ -0,0 +1,20 @@ +--- libs/locale/src/posix/codecvt.cpp.orig 2017-09-02 09:56:14 UTC ++++ libs/locale/src/posix/codecvt.cpp +@@ -38,7 +38,7 @@ namespace impl_posix { + iconv_t d = (iconv_t)(-1); + std::vector<uint32_t> first_byte_table; + try { +- d = iconv_open(utf32_encoding(),encoding.c_str()); ++ d = call_iconv_open(utf32_encoding(),encoding.c_str()); + if(d == (iconv_t)(-1)) { + throw std::runtime_error("Unsupported encoding" + encoding); + } +@@ -186,7 +186,7 @@ namespace impl_posix { + { + if(d!=(iconv_t)(-1)) + return; +- d=iconv_open(to,from); ++ d=call_iconv_open(to,from); + } + + static char const *utf32_encoding() Added: head/devel/boost-libs/files/patch-libs_locale_src_util_iconv.hpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/boost-libs/files/patch-libs_locale_src_util_iconv.hpp Wed Jan 16 20:36:47 2019 (r490518) @@ -0,0 +1,49 @@ +--- libs/locale/src/util/iconv.hpp.orig 2017-09-02 09:56:14 UTC ++++ libs/locale/src/util/iconv.hpp +@@ -12,27 +12,7 @@ + + namespace boost { + namespace locale { +-#if defined(__ICONV_F_HIDE_INVALID) && defined(__FreeBSD__) + extern "C" { +- typedef size_t (*const_iconv_ptr_type)(iconv_t d,char const **in,size_t *insize,char **out,size_t *outsize,uint32_t,size_t *); +- typedef size_t (*nonconst_iconv_ptr_type)(iconv_t d,char **in,size_t *insize,char **out,size_t *outsize,uint32_t,size_t *); +- } +- inline size_t do_iconv(const_iconv_ptr_type ptr,iconv_t d,char **in,size_t *insize,char **out,size_t *outsize) +- { +- char const **rin = const_cast<char const **>(in); +- return ptr(d,rin,insize,out,outsize,__ICONV_F_HIDE_INVALID,0); +- } +- inline size_t do_iconv(nonconst_iconv_ptr_type ptr,iconv_t d,char **in,size_t *insize,char **out,size_t *outsize) +- { +- return ptr(d,in,insize,out,outsize,__ICONV_F_HIDE_INVALID,0); +- } +- inline size_t call_iconv(iconv_t d,char **in,size_t *insize,char **out,size_t *outsize) +- { +- char const **rin = const_cast<char const **>(in); +- return do_iconv(__iconv, d, in,insize,out,outsize); +- } +-#else +- extern "C" { + typedef size_t (*gnu_iconv_ptr_type)(iconv_t d,char const **in,size_t *insize,char **out,size_t *outsize); + typedef size_t (*posix_iconv_ptr_type)(iconv_t d,char **in,size_t *insize,char **out,size_t *outsize); + } +@@ -49,8 +29,17 @@ namespace boost { + { + return do_iconv( iconv, d, in,insize,out,outsize); + } ++ inline iconv_t call_iconv_open(char const *to,char const *from) ++ { ++ iconv_t d = iconv_open(to,from); ++#if defined(ICONV_SET_ILSEQ_INVALID) && defined(__FreeBSD__) ++ if(d != (iconv_t)(-1)) { ++ int ilseq_invalid = 1; ++ iconvctl(d,ICONV_SET_ILSEQ_INVALID,&ilseq_invalid); ++ } + #endif +- ++ return d; ++ } + } // locale + } // boost +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901162036.x0GKal5r088815>