File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ class BufferIO {
143143 while (*pw != 0 ) {
144144 unsigned cur = 0 ;
145145 int codepoint_size = 0 ;
146- if (sizeof (wchar_t ) == 2 ) {
146+ if constexpr (sizeof (wchar_t ) == 2 ) {
147147 if (IsHighSurrogate (pw[0 ])) {
148148 if (pw[1 ] == 0 )
149149 break ;
@@ -220,7 +220,7 @@ class BufferIO {
220220 if (!IsUnicodeChar (cur))
221221 continue ;
222222 if (cur >= 0x10000 ) {
223- if (sizeof (wchar_t ) == 2 )
223+ if constexpr (sizeof (wchar_t ) == 2 )
224224 codepoint_size = 2 ;
225225 else
226226 codepoint_size = 1 ;
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ class DuelClient {
5555 template <typename ST >
5656 static void SendPacketToServer (unsigned char proto, const ST & st) {
5757 auto p = duel_client_write;
58- if (sizeof (ST ) > MAX_DATA_SIZE )
58+ if constexpr (sizeof (ST ) > MAX_DATA_SIZE )
5959 return ;
6060 buffer_write<uint16_t >(p, (uint16_t )(1 + sizeof (ST )));
6161 buffer_write<uint8_t >(p, proto);
Original file line number Diff line number Diff line change @@ -449,7 +449,7 @@ class ustring16 {
449449 // ! Returns the length of a ustring16 in full characters.
450450 // ! \return Length of a ustring16 in full characters.
451451 u32 size () const {
452- if (sizeof (wchar_t ) == 4 ) {
452+ if constexpr (sizeof (wchar_t ) == 4 ) {
453453 return size_raw_;
454454 } else {
455455 if (size_ != 0xffffffff )
@@ -524,7 +524,7 @@ class ustring16 {
524524 // ! \return A reference to our current string.
525525 void validate () {
526526 // Validate all unicode characters.
527- if (sizeof (wchar_t ) == 4 ) {
527+ if constexpr (sizeof (wchar_t ) == 4 ) {
528528 size_ = size_raw_;
529529 return ;
530530 }
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ class NetServer {
4343 template <typename ST >
4444 static void SendPacketToPlayer (DuelPlayer* dp, unsigned char proto, const ST & st) {
4545 auto p = net_server_write;
46- if (sizeof (ST ) > MAX_DATA_SIZE )
46+ if constexpr (sizeof (ST ) > MAX_DATA_SIZE )
4747 return ;
4848 buffer_write<uint16_t >(p, (uint16_t )(1 + sizeof (ST )));
4949 buffer_write<uint8_t >(p, proto);
Original file line number Diff line number Diff line change 1010#include < event2/thread.h>
1111#include < type_traits>
1212
13- #define check_trivially_copyable (T ) static_assert (std::is_trivially_copyable <T>::value == true && std::is_standard_layout <T>::value == true , " not trivially copyable" )
13+ #define check_trivially_copyable (T ) static_assert (std::is_trivially_copyable_v <T> == true && std::is_standard_layout_v <T> == true , " not trivially copyable" )
1414
1515namespace ygo {
1616 constexpr int SIZE_NETWORK_BUFFER = 0x20000 ;
You can’t perform that action at this time.
0 commit comments