Path: blob/main/ftp/libfilezilla/files/extra-patch-lib_libfilezilla_string.hpp
16461 views
--- lib/libfilezilla/string.hpp.orig 2024-10-15 12:59:21 UTC1+++ lib/libfilezilla/string.hpp2@@ -11,6 +11,39 @@3#include <string_view>4#include <vector>56+template<class CharT, class BaseT>7+class traits_cloner8+{9+public:10+ using char_type = CharT;11+12+ using base_type = BaseT;13+ using base_traits = std::char_traits<base_type>;14+15+ static std::size_t length(char_type const* s) {16+ return base_traits::length(reinterpret_cast<base_type const*>(s));17+ }18+ static int compare(char_type const* s1, char_type const* s2, std::size_t count) {19+ return base_traits::compare(reinterpret_cast<base_type const*>(s1), reinterpret_cast<base_type const*>(s2), count);20+ }21+ static char_type* copy(char_type* dest, char_type const* src, std::size_t count) {22+ return reinterpret_cast<char_type*>(base_traits::copy(reinterpret_cast<base_type*>(dest), reinterpret_cast<base_type const*>(src), count));23+ }24+ static void assign( char_type& c1, char_type const& c2 ) noexcept {25+ c1 = c2;26+ }27+ static char_type const* find(char_type const* ptr, std::size_t count, char_type const& ch) {28+ return reinterpret_cast<char_type const*>(base_traits::find(reinterpret_cast<base_type const*>(ptr), count, reinterpret_cast<base_type const&>(ch)));29+ }30+ static bool eq(char_type a, char_type b) {31+ return base_traits::eq(static_cast<base_type>(a), static_cast<base_type>(b));32+ }33+};34+35+template<>36+class std::char_traits<uint8_t> : public traits_cloner<uint8_t, char>37+{};38+39/** \file40* \brief String types and assorted functions.41*424344