head 1.10; access; symbols pkgsrc-2020Q4:1.9.0.4 pkgsrc-2020Q4-base:1.9 pkgsrc-2020Q3:1.9.0.2 pkgsrc-2020Q3-base:1.9 pkgsrc-2016Q2:1.2.0.2 pkgsrc-2016Q2-base:1.2; locks; strict; comment @// @; 1.10 date 2021.03.12.10.35.47; author wiz; state dead; branches; next 1.9; commitid 7qmeskTPtx8Lu0LC; 1.9 date 2020.09.18.08.55.45; author jperkin; state Exp; branches; next 1.8; commitid iYQOLciB3MdhzvoC; 1.8 date 2020.09.18.07.57.54; author wiz; state dead; branches; next 1.7; commitid 3IonWAYe4aQrfvoC; 1.7 date 2020.09.17.14.48.08; author wiz; state Exp; branches; next 1.6; commitid zrm5uxLt077aypoC; 1.6 date 2020.09.17.10.05.44; author jperkin; state Exp; branches; next 1.5; commitid alJ2YwVhyFlZYnoC; 1.5 date 2016.09.12.15.40.13; author wiz; state dead; branches; next 1.4; commitid 2rSDNigFam2BX0mz; 1.4 date 2016.07.21.17.16.17; author wiz; state Exp; branches; next 1.3; commitid nhRbs8BQM5i2cdfz; 1.3 date 2016.07.19.18.42.22; author wiz; state dead; branches; next 1.2; commitid 1Gf9D3lFYKTJJXez; 1.2 date 2016.04.29.14.14.16; author wiz; state Exp; branches; next 1.1; commitid kmbjhPpLfBwbRw4z; 1.1 date 2016.04.29.11.54.06; author wiz; state Exp; branches; next ; commitid zSXERmVijxg75w4z; desc @@ 1.10 log @libfilezilla: update to 0.27.0. 2021-03-04 - libfilezilla 0.27.0 released New features: Added fz::normalize_hypens to replace all hyphen-like characters in a string with the good old hyphen-minus Added fz::pbkdf2_hmac_sha256 Added visibility_helper.hpp to simplify exporting symbols in shared libraries Added fz::compound_rate_limited_layer to which multiple rate limiters can be dynamically added/removed Added redirect_io parameter to fz::process::spawn Added --enable-socketdebug configure argument to check for invariant violation when handling socket events Added a optional preamble to server_handshake that is sent after initializing the session, but before the SERVER_HELLO Bugfixes and minor changes: Various fixes to socket event retriggering if socket_interface::set_event_handler is used Fixed a nullpointer dereference in fz::tls_layer if a hostname is set prior to creating a session 2020-12-17 - libfilezilla 0.26.0 released New features: Added fz::buffer::capacity() fz::buffer::append now also accepts single characters and std::vector Added fz::nonowning_buffer MSW: Added fz::process::handle() *nix: Allow passing extra file descriptors to child processes fz::to_wstring_from_utf8 now accepts std::string_view and fz::buffer fz::replace_substrings and fz::replaced_substrings now accept string views and single characters Bugfixes and minor changes: Reset bucket data if it gets removed from a rate_limiter 2020-10-13 - libfilezilla 0.25.0 released New features: Added fz::invoker to asynchronously call functions to run in a specific thread independent of the caller's thread Bugfixes and minor changes: Added additional checks to fz::buffer to leave the buffer in a valid state in out-of-memory situations and to prevent mis-use Detect a particular socket buffer tuning issue under Linux where setting a receiver buffer size shrinks the window scale factor Reordered a few data members to reduce the amount of structure padding due to alignment @ text @$NetBSD: patch-lib_string.cpp,v 1.9 2020/09/18 08:55:45 jperkin Exp $ Use std::wcsnrtombs() on SunOS. --- lib/string.cpp.orig 2020-07-07 12:06:31.000000000 +0000 +++ lib/string.cpp @@@@ -13,6 +13,10 @@@@ #include +#ifdef __sun +using std::wcsnrtombs; +#endif + static_assert('a' + 25 == 'z', "We only support systems running with an ASCII-based character set. Sorry, no EBCDIC."); // char may be unsigned, yielding stange results if subtracting characters. To work around it, expect a particular order of characters. @ 1.9 log @libfilezilla: Limit std::wcsnrtombs to SunOS. @ text @d1 1 a1 1 $NetBSD$ @ 1.8 log @libfilezilla: remove patch that breaks the build on NetBSD @ text @d1 1 a1 1 $NetBSD: patch-lib_string.cpp,v 1.7 2020/09/17 14:48:08 wiz Exp $ d3 1 a3 3 Explicitly use std::wcsnrtombs. https://trac.filezilla-project.org/ticket/12280 d7 3 a9 1 @@@@ -354,7 +354,7 @@@@ std::string to_string(std::wstring_view d11 5 a15 9 std::mbstate_t ps{}; wchar_t const* in_p = in.data() + start; - size_t len = wcsnrtombs(nullptr, &in_p, inlen, 0, &ps); + size_t len = std::wcsnrtombs(nullptr, &in_p, inlen, 0, &ps); if (len != static_cast(-1)) { size_t old = ret.size(); if (start) { @@@@ -364,7 +364,7 @@@@ std::string to_string(std::wstring_view char* out_p = &ret[old]; d17 1 a17 6 in_p = in.data() + start; // Some implementations of wcsrtombs change src even on null dst - wcsnrtombs(out_p, &in_p, inlen, len, &ps); + std::wcsnrtombs(out_p, &in_p, inlen, len, &ps); } else { ret.clear(); @ 1.7 log @libfilezilla: add upstream bug report URL @ text @d1 1 a1 1 $NetBSD: patch-lib_string.cpp,v 1.6 2020/09/17 10:05:44 jperkin Exp $ @ 1.6 log @libfilezilla: Update to 0.24.1. While here fix the build on SunOS, based on patches in joyent/pkgsrc#266 from mrferda. 0.24.1 (2020-08-27) - fz::to_integral can now handle strongly typed enum return types 0.24.0 (2020-08-21) + Added fz::equal_consttime - fz::sprintf now works corrcetly if arguments are passed as (w)string_view 0.23.0 (2020-07-07) + Added reader/writer locks - fz::mkdir can now return the the longest created path in case of partial failures @ text @d1 1 a1 1 $NetBSD$ d5 2 @ 1.5 log @Updated libfilezilla to 0.6.1. 2016-07-27 - libfilezilla 0.6.1 released Bugfixes and minor changes: Fix UTF-8 conversion functions and added a testcase 2016-07-20 - libfilezilla 0.6.0 released New features: Add fz::sprintf, a safe replacement for for the C sprintf function @ text @d1 1 a1 1 $NetBSD: patch-lib_string.cpp,v 1.4 2016/07/21 17:16:17 wiz Exp $ d3 1 a3 1 SVN 7668 d5 1 a5 1 --- lib/string.cpp.orig 2016-06-20 08:08:07.000000000 +0000 d7 1 a7 58 @@@@ -95,6 +95,59 @@@@ std::wstring to_wstring(std::string cons // Depending which one is used, declare iconv_second_arg_type as either char* or char const* extern "C" typedef size_t (*iconv_prototype_with_const)(iconv_t, char const**, size_t *, char**, size_t *); typedef std::conditional::value, char const*, char*>::type iconv_second_arg_type; + +namespace { +// On some platforms, e.g. those derived from SunOS, iconv does not understand "WCHAR_T", so we +// need to guess an encoding. +char const* const calc_wchar_t_encoding() +{ + auto try_encoding = [](char const* const encoding) -> bool { + iconv_t cd = iconv_open(encoding, "UTF-8"); + if (cd == reinterpret_cast(-1)) { + return false; + } + iconv_close(cd); + return true; + + }; + if (try_encoding("WCHAR_T")) { + return "WCHAR_T"; + } + else { + // Explicitly specify endianess, otherwise we'll get a BOM prefixed to everything + + int const i = 1; + char const* p = reinterpret_cast(&i); + bool little_endian = p[0] == 1; + + if (sizeof(wchar_t) == 4) { + if (little_endian && try_encoding("UTF-32LE")) { + return "UTF-32LE"; + } + if (!little_endian && try_encoding("UTF-32BE")) { + return "UTF-32BE"; + } + } + else if (sizeof(wchar_t) == 2) { + if (little_endian && try_encoding("UTF-16LE")) { + return "UTF-16LE"; + } + if (!little_endian && try_encoding("UTF-16BE")) { + return "UTF-16BE"; + } + } + } + + // Oh dear... + return "WCHAR_T"; +} + +char const* wchar_t_encoding() +{ + static char const* const encoding = calc_wchar_t_encoding(); + return encoding; +} +} #endif d9 16 a24 19 std::wstring to_wstring_from_utf8(std::string const& in) @@@@ -111,7 +164,7 @@@@ std::wstring to_wstring_from_utf8(std::s MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, in_p, len, out_p, len); } #else - iconv_t cd = iconv_open("WCHAR_T", "UTF-8"); + iconv_t cd = iconv_open(wchar_t_encoding(), "UTF-8"); if (cd != reinterpret_cast(-1)) { auto in_p = const_cast(in.c_str()); size_t in_len = in.size(); @@@@ -175,7 +228,7 @@@@ std::string FZ_PUBLIC_SYMBOL to_utf8(std WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, in_p, len, out_p, len, 0, 0); } #else - iconv_t cd = iconv_open("UTF-8", "WCHAR_T"); + iconv_t cd = iconv_open("UTF-8", wchar_t_encoding()); if (cd != reinterpret_cast(-1)) { auto in_p = reinterpret_cast(const_cast(in.c_str())); size_t in_len = in.size() * sizeof(wchar_t); @ 1.4 log @Add two patches from upstream that fix wide character support. In particular, this fixes ftp mode. Investigated with upstream by richard@@, thank you very much! Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD$ @ 1.3 log @Update libfilezilla to 0.5.3: 2016-06-20 - libfilezilla 0.5.3 released New features: Add fz::replace_substrincs to search and replace substrings in std::(w)string Bugfixes and minor changes: Explicitly request large file support on 32bit systems 2016-05-20 - libfilezilla 0.5.2 released New features: Add fz::shared_optional::is_same that checks whether two instances share the same underlying pointer value, like a shallow equal. Add fz::int_to_hex_char as reverse to fz::hex_char_to_int 2016-05-09 - libfilezilla 0.5.1 released New features: Add constructore to sparse_optional taking pointers Bugfixes and minor changes: Fix compilation on systems where iconv's second argument is const @ text @d1 1 a1 1 $NetBSD: patch-lib_string.cpp,v 1.2 2016/04/29 14:14:16 wiz Exp $ d3 1 a3 2 Fix build with different types of iconv(). https://svn.filezilla-project.org/filezilla/libfilezilla/trunk/lib/string.cpp?view=patch&r1=7361&r2=7464&pathrev=7464 d5 1 a5 1 --- lib/string.cpp.orig 2016-04-15 07:52:15.000000000 +0000 d7 50 a56 4 @@@@ -7,6 +7,8 @@@@ #else #include #include d58 6 a63 1 +#include a65 12 #include @@@@ -88,6 +90,13 @@@@ std::wstring to_wstring(std::string cons return ret; } +#ifndef FZ_WINDOWS +// On some platforms, e.g. NetBSD, the second argument to iconv is const. +// Depending which one is used, declare iconv_second_arg_type as either char* or char const* +extern "C" typedef size_t (*iconv_prototype_with_const)(iconv_t, char const**, size_t *, char**, size_t *); +typedef std::conditional::value, char const*, char*>::type iconv_second_arg_type; +#endif + d67 3 a69 3 { std::wstring ret; @@@@ -104,7 +113,7 @@@@ std::wstring to_wstring_from_utf8(std::s d71 2 a72 1 iconv_t cd = iconv_open("WCHAR_T", "UTF-8"); d74 1 a74 2 - char * in_p = const_cast(in.c_str()); + auto in_p = const_cast(in.c_str()); d76 3 a78 3 size_t out_len = in_len * sizeof(wchar_t) * 2; @@@@ -168,7 +177,7 @@@@ std::string FZ_PUBLIC_SYMBOL to_utf8(std d80 2 a81 1 iconv_t cd = iconv_open("UTF-8", "WCHAR_T"); d83 1 a83 2 - char * in_p = reinterpret_cast(const_cast(in.c_str())); + auto in_p = reinterpret_cast(const_cast(in.c_str())); a84 2 size_t out_len = in.size() * 4; @ 1.2 log @Use upstream version of patch. @ text @d1 1 a1 1 $NetBSD$ @ 1.1 log @Import libfilezilla-0.5.0 as net/libfilezilla. libfilezilla is a free, open source C++ library, offering some basic functionality to build high-performing, platform-independent programs. Some of the highlights include: * A typesafe, multi-threaded event system that's very simple to use yet extremely efficient * Timers for periodic events * A datetime class that not only tracks timestamp but also their accuracy, which simplifies dealing with timestamps originating from different sources * Simple process handling for spawning child processes with redirected I/O @ text @d3 2 a4 1 Fix build on NetBSD with iconv's second argument being const char **. d8 7 a14 3 @@@@ -111,7 +111,7 @@@@ std::wstring to_wstring_from_utf8(std::s char* out_buf = new char[out_len]; char* out_p = out_buf; d16 4 a19 2 - size_t r = iconv(cd, &in_p, &in_len, &out_p, &out_len); + size_t r = iconv(cd, (const char **)&in_p, &in_len, &out_p, &out_len); d21 17 a37 5 if (r != static_cast(-1)) { ret.assign(reinterpret_cast(out_buf), reinterpret_cast(out_p)); @@@@ -175,7 +175,7 @@@@ std::string FZ_PUBLIC_SYMBOL to_utf8(std char* out_buf = new char[out_len]; char* out_p = out_buf; d39 8 a46 2 - size_t r = iconv(cd, &in_p, &in_len, &out_p, &out_len); + size_t r = iconv(cd, (const char **)&in_p, &in_len, &out_p, &out_len); d48 1 a48 2 if (r != static_cast(-1)) { ret.assign(out_buf, out_p); @