Skip to content

Commit 61cd7ed

Browse files
committed
Update yasio version
1 parent 679d484 commit 61cd7ed

5 files changed

Lines changed: 46 additions & 43 deletions

File tree

3rdparty/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@
263263

264264
## yasio
265265
- [![Upstream](https://img.shields.io/github/v/release/yasio/yasio?label=Upstream)](https://github.com/yasio/yasio)
266-
- Version: 4.3.2
266+
- Version: 4.4.0
267267
- License: MIT WITH Anti-996
268268

269269
## zlib

3rdparty/yasio/yasio/bindings/yasio_ni.cpp

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ SOFTWARE.
3232
#include <array>
3333
#include <string.h>
3434
#include "yasio/yasio.hpp"
35-
#include "yasio/split.hpp"
35+
#include "yasio/tlx/split.hpp"
3636

3737
#if defined(_WINDLL)
3838
# define YASIO_NI_API __declspec(dllexport)
@@ -46,8 +46,8 @@ using namespace yasio;
4646

4747
namespace
4848
{
49-
inline int svtoi(cxx17::string_view& sv) { return !sv.empty() ? atoi(sv.data()) : 0; }
50-
inline const char* svtoa(cxx17::string_view& sv) { return !sv.empty() ? sv.data() : ""; }
49+
inline int svtoi(std::string_view& sv) { return !sv.empty() ? atoi(sv.data()) : 0; }
50+
inline const char* svtoa(std::string_view& sv) { return !sv.empty() ? sv.data() : ""; }
5151
} // namespace
5252

5353
extern "C" {
@@ -60,12 +60,12 @@ YASIO_NI_API void yasio_init_globals(void(YASIO_INTEROP_DECL* pfn)(int level, co
6060
YASIO_NI_API void yasio_cleanup_globals() { io_service::cleanup_globals(); }
6161

6262
struct yasio_io_event {
63-
int kind; // event kind
64-
int channel; // channel index
63+
int kind; // event kind
64+
int channel; // channel index
6565
void* thandle; // transport
6666
union {
6767
void* hmsg; // io_packet*
68-
int ec; // error code
68+
int ec; // error code
6969
};
7070
void* user; // user data
7171
};
@@ -154,16 +154,19 @@ YASIO_NI_API void yasio_set_option(void* service_ptr, int opt, const char* pszAr
154154

155155
// split args
156156
std::string strArgs = pszArgs;
157-
std::array<cxx17::string_view, YASIO_MAX_OPTION_ARGC> args;
157+
std::array<std::string_view, YASIO_MAX_OPTION_ARGC> args;
158158
int argc = 0;
159-
tlx::split_if(&strArgs.front(), ';', [&](char* s, char* e) {
160-
if (e) {
161-
*e = '\0'; // to c style string
162-
args[argc++] = cxx17::string_view(s, e - s);
163-
} else {
164-
args[argc++] = cxx17::string_view{s};
159+
tlx::split_until(&strArgs.front(), ';', [&](char* s, char* e) {
160+
if (e)
161+
{
162+
*e = '\0'; // to c style string
163+
args[argc++] = std::string_view(s, e - s);
165164
}
166-
return (argc < YASIO_MAX_OPTION_ARGC);
165+
else
166+
{
167+
args[argc++] = std::string_view{s};
168+
}
169+
return (argc >= YASIO_MAX_OPTION_ARGC);
167170
});
168171

169172
switch (opt)
@@ -233,7 +236,7 @@ YASIO_NI_API int yasio_write(void* service_ptr, void* thandle, const char* bytes
233236
{
234237
auto service = reinterpret_cast<io_service*>(service_ptr);
235238
if (service)
236-
return service->write(reinterpret_cast<transport_handle_t>(thandle), yasio::sbyte_buffer(bytes, bytes + len));
239+
return service->write(reinterpret_cast<transport_handle_t>(thandle), tlx::sbyte_buffer(bytes, bytes + len));
237240
return -1;
238241
}
239242
YASIO_NI_API int yasio_forward(void* service_ptr, void* thandle, void* bufferHandle,
@@ -324,6 +327,6 @@ YASIO_NI_API void yasio_ob_write_bytes(void* obs_ptr, void* bytes, int len)
324327
obs->write_bytes(bytes, len);
325328
}
326329

327-
YASIO_NI_API long long yasio_highp_time(void) { return highp_clock<system_clock_t>(); }
328-
YASIO_NI_API long long yasio_highp_clock(void) { return highp_clock<steady_clock_t>(); }
330+
YASIO_NI_API long long yasio_highp_time(void) { return tlx::highp_clock<tlx::system_clock_t>(); }
331+
YASIO_NI_API long long yasio_highp_clock(void) { return tlx::highp_clock<tlx::steady_clock_t>(); }
329332
}

3rdparty/yasio/yasio/config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ SOFTWARE.
199199
/*
200200
** The yasio version macros
201201
*/
202-
#define YASIO_VERSION_NUM 0x040302
202+
#define YASIO_VERSION_NUM 0x040400
203203

204204
/*
205205
** The macros used by io_service.

3rdparty/yasio/yasio/endian_portable.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ template <>
146146
struct byte_order_impl<fp16_t, sizeof(fp16_t)> {
147147
static inline fp16_t host_to_network(fp16_t value)
148148
{
149-
uint16_t& underlying_value = (uint16_t&)value;
150-
YASIO__SWAP_SHORT(underlying_value);
149+
auto underlying_value = reinterpret_cast<uint16_t*>(&value);
150+
YASIO__SWAP_SHORT(*underlying_value);
151151
return value;
152152
}
153153
static inline fp16_t network_to_host(fp16_t value) { return host_to_network(value); }

3rdparty/yasio/yasio/tlx/vector.hpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace tlx
5353
{
5454

5555
// Writable iterator for sequential containers
56-
template <class _Myvec>
56+
template <typename _Myvec>
5757
class sequence_const_iterator {
5858
public:
5959
using iterator_concept = std::contiguous_iterator_tag;
@@ -146,7 +146,7 @@ class sequence_const_iterator {
146146
_Tptr _Ptr; // pointer to element in vector
147147
};
148148

149-
template <class _Myvec>
149+
template <typename _Myvec>
150150
class sequence_iterator : public sequence_const_iterator<_Myvec> {
151151
public:
152152
using _Mybase = sequence_const_iterator<_Myvec>;
@@ -227,7 +227,7 @@ class sequence_iterator : public sequence_const_iterator<_Myvec> {
227227
constexpr reference operator[](const difference_type _Off) const noexcept { return const_cast<reference>(_Mybase::operator[](_Off)); }
228228
};
229229

230-
template <class _Value_type, class _Size_type, class _Difference_type, class _Pointer, class _Const_pointer>
230+
template <typename _Value_type, typename _Size_type, typename _Difference_type, typename _Pointer, typename _Const_pointer>
231231
struct _Vec_iter_types {
232232
using value_type = _Value_type;
233233
using size_type = _Size_type;
@@ -272,10 +272,10 @@ struct _Vector_val {
272272
pointer _Myend;
273273
};
274274

275-
template <class _Ty, class _Alloc = std::allocator<_Ty>, fill_policy _FillPolicy = fill_policy::always>
275+
template <typename _Ty, typename _Alloc = std::allocator<_Ty>, fill_policy _FillPolicy = fill_policy::always>
276276
class vector { // varying size array of values
277277
private:
278-
template <class>
278+
template <typename>
279279
friend class _Vb_val;
280280
friend __tidy_guard<vector>;
281281

@@ -374,7 +374,7 @@ class vector { // varying size array of values
374374
_Construct_n(_Count, _Val);
375375
}
376376

377-
template <class _Iter, enable_if_t<is_iterator<_Iter>::value, int> = 0>
377+
template <typename _Iter, enable_if_t<is_iterator<_Iter>::value, int> = 0>
378378
constexpr vector(_Iter _First, _Iter _Last, const _Alloc& _Al = _Alloc()) : _Mypair(_TLX __one_then_variadic_args_t{}, _Al)
379379
{
380380
auto _UFirst = _First;
@@ -451,7 +451,7 @@ class vector { // varying size array of values
451451
constexpr ~vector() noexcept { _Tidy(); }
452452

453453
private:
454-
template <class... _Valty>
454+
template <typename... _Valty>
455455
constexpr _Ty& _Emplace_one_at_back(_Valty&&... _Val)
456456
{
457457
// insert by perfectly forwarding into element at end, provide strong guarantee
@@ -466,7 +466,7 @@ class vector { // varying size array of values
466466
return *_Emplace_reallocate(_Mylast, std::forward<_Valty>(_Val)...);
467467
}
468468

469-
template <class... Valty>
469+
template <typename... Valty>
470470
constexpr _Ty& _Emplace_back_with_unused_capacity(Valty&&... val)
471471
{
472472
auto& data = _Mypair._Myval2;
@@ -487,7 +487,7 @@ class vector { // varying size array of values
487487
return result;
488488
}
489489

490-
template <class... _Valty>
490+
template <typename... _Valty>
491491
constexpr pointer _Emplace_reallocate(const pointer _Whereptr, _Valty&&... _Val)
492492
{
493493
// reallocate and insert by perfectly forwarding _Val at _Whereptr
@@ -542,7 +542,7 @@ class vector { // varying size array of values
542542
}
543543

544544
public:
545-
template <class... _Valty>
545+
template <typename... _Valty>
546546
constexpr _Ty& emplace_back(_Valty&&... _Val)
547547
{
548548
// insert by perfectly forwarding into element at end, provide strong guarantee
@@ -570,7 +570,7 @@ class vector { // varying size array of values
570570
return *this;
571571
}
572572

573-
template <class _U = value_type, typename = std::enable_if_t<std::is_pointer<_U>::value>>
573+
template <typename _Valty = value_type, std::enable_if_t<std::is_pointer_v<_Valty>, int> = 0>
574574
constexpr void resize(const size_type _Newsize, std::nullptr_t)
575575
{
576576
_Resize(_Newsize, _TLX value_init);
@@ -638,7 +638,7 @@ class vector { // varying size array of values
638638
#pragma endregion
639639

640640
public:
641-
template <class... _Valty>
641+
template <typename... _Valty>
642642
constexpr iterator emplace(const_iterator _Where, _Valty&&... _Val)
643643
{
644644
auto _Whereptr = _Where._Ptr;
@@ -682,7 +682,7 @@ class vector { // varying size array of values
682682
return emplace(_Where, std::move(_Val));
683683
}
684684

685-
template <class... _Valty>
685+
template <typename... _Valty>
686686
constexpr iterator insert(const_iterator _Where, const size_type _Count, const _Ty& _Val)
687687
{
688688
// insert _Count copies of _Val at _Where
@@ -772,7 +772,7 @@ class vector { // varying size array of values
772772
}
773773

774774
private:
775-
template <class _Iter>
775+
template <typename _Iter>
776776
constexpr void _Insert_counted_range(const_iterator _Where, _Iter _First, const size_type _Count)
777777
{
778778
// insert counted range _First + [0, _Count) at _Where
@@ -888,7 +888,7 @@ class vector { // varying size array of values
888888
}
889889

890890
public:
891-
template <class _Iter, enable_if_t<tlx::is_iterator_v<_Iter>, int> = 0>
891+
template <typename _Iter, enable_if_t<tlx::is_iterator_v<_Iter>, int> = 0>
892892
constexpr iterator insert(const_iterator _Where, _Iter _First, _Iter _Last)
893893
{
894894
auto _Whereptr = _Where._Ptr;
@@ -947,7 +947,7 @@ class vector { // varying size array of values
947947
}
948948

949949
private:
950-
template <class _Iter>
950+
template <typename _Iter>
951951
constexpr void _Assign_counted_range(_Iter _First, const size_type _Newsize)
952952
{
953953
// assign elements from counted range _First + [0, _Newsize)
@@ -999,7 +999,7 @@ class vector { // varying size array of values
999999
}
10001000

10011001
public:
1002-
template <class _Iter, enable_if_t<std::is_pointer_v<_Iter>, int> = 0>
1002+
template <typename _Iter, enable_if_t<std::is_pointer_v<_Iter>, int> = 0>
10031003
constexpr void assign(_Iter _First, _Iter _Last)
10041004
{
10051005
const auto _Length = static_cast<size_t>(_Last - _First); // pointer difference
@@ -1039,7 +1039,7 @@ class vector { // varying size array of values
10391039
}
10401040

10411041
private:
1042-
template <class _Ty2>
1042+
template <typename _Ty2>
10431043
constexpr void _Resize_reallocate(const size_type _Newsize, const _Ty2& _Val)
10441044
{
10451045
if (_Newsize > max_size())
@@ -1086,7 +1086,7 @@ class vector { // varying size array of values
10861086
_Change_array(_Newvec, _Newsize, _Newcapacity);
10871087
}
10881088

1089-
template <class _Ty2>
1089+
template <typename _Ty2>
10901090
constexpr void _Resize(const size_type _Newsize, const _Ty2& _Val)
10911091
{
10921092
// trim or append elements, provide strong guarantee
@@ -1528,7 +1528,7 @@ class vector { // varying size array of values
15281528
}
15291529
}
15301530

1531-
template <class... _Valty>
1531+
template <typename... _Valty>
15321532
constexpr void _Construct_n(const size_type _Count, _Valty&&... _Val)
15331533
{
15341534
// Dispatch between the three sized constructions:
@@ -1673,15 +1673,15 @@ inline typename _Cont::iterator ordered_insert(_Cont& vec, typename _Cont::value
16731673

16741674
namespace std
16751675
{
1676-
template <class _Myvec>
1676+
template <typename _Myvec>
16771677
struct pointer_traits<_TLX sequence_const_iterator<_Myvec>> {
16781678
using pointer = _TLX sequence_const_iterator<_Myvec>;
16791679
using element_type = const typename pointer::value_type;
16801680
using difference_type = typename pointer::difference_type;
16811681

16821682
static constexpr element_type* to_address(const pointer _Iter) noexcept { return std::to_address(_Iter._Ptr); }
16831683
};
1684-
template <class _Myvec>
1684+
template <typename _Myvec>
16851685
struct pointer_traits<_TLX sequence_iterator<_Myvec>> {
16861686
using pointer = _TLX sequence_iterator<_Myvec>;
16871687
using element_type = typename pointer::value_type;

0 commit comments

Comments
 (0)