Fix compilation on GCC-13 (#443)

* Fix compilation on GCC-13

GCC-13 changes internal cstdint includes, and now files that uses
standart integer types should directly include cstdint header.

See: https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes
Bug: https://bugs.gentoo.org/865117
Bug: https://bugs.gentoo.org/895440

* Convert line endings to Unix format
This commit is contained in:
Azamat H. Hackimov 2023-02-26 00:50:35 +03:00 committed by GitHub
parent aa2ca19895
commit 9157873f5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 150 additions and 133 deletions

View File

@ -25,6 +25,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <cstdint>
#include <string> #include <string>
namespace macaron { namespace macaron {

View File

@ -6,7 +6,7 @@
#pragma once #pragma once
#include <chrono> #include <chrono>
#include <stdint.h> #include <cstdint>
#include <string> #include <string>
namespace ix namespace ix

View File

@ -7,9 +7,9 @@
#pragma once #pragma once
#include <atomic> #include <atomic>
#include <cstdint>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <stdint.h>
#include <string> #include <string>
namespace ix namespace ix

View File

@ -12,6 +12,7 @@
#include "IXCancellationRequest.h" #include "IXCancellationRequest.h"
#include <atomic> #include <atomic>
#include <cstdint>
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include <set> #include <set>

View File

@ -9,6 +9,7 @@
#include "IXProgressCallback.h" #include "IXProgressCallback.h"
#include "IXWebSocketHttpHeaders.h" #include "IXWebSocketHttpHeaders.h"
#include <atomic> #include <atomic>
#include <cstdint>
#include <tuple> #include <tuple>
#include <unordered_map> #include <unordered_map>

View File

@ -12,6 +12,7 @@
#include "IXUserAgent.h" #include "IXUserAgent.h"
#include "IXWebSocketHttpHeaders.h" #include "IXWebSocketHttpHeaders.h"
#include <assert.h> #include <assert.h>
#include <cstdint>
#include <cstring> #include <cstring>
#include <iomanip> #include <iomanip>
#include <random> #include <random>

View File

@ -10,6 +10,7 @@
#include "IXNetSystem.h" #include "IXNetSystem.h"
#include "IXSocketConnect.h" #include "IXSocketConnect.h"
#include "IXUserAgent.h" #include "IXUserAgent.h"
#include <cstdint>
#include <cstring> #include <cstring>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>

View File

@ -6,6 +6,8 @@
#pragma once #pragma once
#include <cstdint>
#ifdef _WIN32 #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN

View File

@ -6,8 +6,8 @@
#pragma once #pragma once
#include <cstdint>
#include <memory> #include <memory>
#include <stdint.h>
#include <string> #include <string>
namespace ix namespace ix

View File

@ -5,8 +5,8 @@
#pragma once #pragma once
#include "IXSelectInterrupt.h" #include "IXSelectInterrupt.h"
#include <cstdint>
#include <mutex> #include <mutex>
#include <stdint.h>
#include <string> #include <string>
#include <deque> #include <deque>
#ifdef _WIN32 #ifdef _WIN32

View File

@ -7,6 +7,7 @@
#pragma once #pragma once
#include "IXSelectInterrupt.h" #include "IXSelectInterrupt.h"
#include <cstdint>
#include <mutex> #include <mutex>
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>

View File

@ -14,7 +14,6 @@
#include <array> #include <array>
#include <assert.h> #include <assert.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -7,6 +7,7 @@
#pragma once #pragma once
#include <atomic> #include <atomic>
#include <cstdint>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <mutex> #include <mutex>

View File

@ -14,6 +14,7 @@
#include "IXNetSystem.h" #include "IXNetSystem.h"
#include "IXSocket.h" #include "IXSocket.h"
#include "IXSocketConnect.h" #include "IXSocketConnect.h"
#include <cstdint>
#include <string.h> #include <string.h>
#ifdef _WIN32 #ifdef _WIN32

View File

@ -16,6 +16,7 @@
#include "IXUuid.h" #include "IXUuid.h"
#include <cstdint>
#include <iomanip> #include <iomanip>
#include <random> #include <random>
#include <sstream> #include <sstream>

View File

@ -13,6 +13,7 @@
#include "IXWebSocketHandshake.h" #include "IXWebSocketHandshake.h"
#include <cassert> #include <cassert>
#include <cmath> #include <cmath>
#include <cstdint>
namespace namespace

View File

@ -21,6 +21,7 @@
#include "IXWebSocketTransport.h" #include "IXWebSocketTransport.h"
#include <atomic> #include <atomic>
#include <condition_variable> #include <condition_variable>
#include <cstdint>
#include <mutex> #include <mutex>
#include <string> #include <string>
#include <thread> #include <thread>

View File

@ -46,6 +46,8 @@
* *
*/ */
#include <cstdint>
#include "IXWebSocketPerMessageDeflate.h" #include "IXWebSocketPerMessageDeflate.h"
#include "IXUniquePtr.h" #include "IXUniquePtr.h"

View File

@ -10,6 +10,7 @@
#include "zlib.h" #include "zlib.h"
#endif #endif
#include <array> #include <array>
#include <cstdint>
#include <string> #include <string>
#include <vector> #include <vector>
#include "IXWebSocketSendData.h" #include "IXWebSocketSendData.h"

View File

@ -6,6 +6,7 @@
#pragma once #pragma once
#include <cstdint>
#include <string> #include <string>
namespace ix namespace ix

View File

@ -1,128 +1,129 @@
/* /*
* IXWebSocketSendData.h * IXWebSocketSendData.h
* *
* WebSocket (Binary/Text) send data buffer * WebSocket (Binary/Text) send data buffer
*/ */
#pragma once #pragma once
#include <string> #include <cstdint>
#include <vector> #include <string>
#include <iterator> #include <vector>
#include <iterator>
namespace ix
{ namespace ix
/* {
* IXWebSocketSendData implements a wrapper for std::string, std:vector<char/uint8_t> and char*. /*
* It removes the necessarity to copy the data or string into a std::string * IXWebSocketSendData implements a wrapper for std::string, std:vector<char/uint8_t> and char*.
*/ * It removes the necessarity to copy the data or string into a std::string
class IXWebSocketSendData { */
public: class IXWebSocketSendData {
public:
template<typename T>
struct IXWebSocketSendData_const_iterator template<typename T>
//: public std::iterator<std::forward_iterator_tag, T> struct IXWebSocketSendData_const_iterator
{ //: public std::iterator<std::forward_iterator_tag, T>
typedef IXWebSocketSendData_const_iterator<T> const_iterator; {
typedef IXWebSocketSendData_const_iterator<T> const_iterator;
using iterator_category = std::forward_iterator_tag;
using difference_type = std::ptrdiff_t; using iterator_category = std::forward_iterator_tag;
using value_type = T; using difference_type = std::ptrdiff_t;
using pointer = value_type*; using value_type = T;
using reference = const value_type&; using pointer = value_type*;
using reference = const value_type&;
pointer _ptr;
public: pointer _ptr;
IXWebSocketSendData_const_iterator() : _ptr(nullptr) {} public:
IXWebSocketSendData_const_iterator(pointer ptr) : _ptr(ptr) {} IXWebSocketSendData_const_iterator() : _ptr(nullptr) {}
~IXWebSocketSendData_const_iterator() {} IXWebSocketSendData_const_iterator(pointer ptr) : _ptr(ptr) {}
~IXWebSocketSendData_const_iterator() {}
const_iterator operator++(int) { return const_iterator(_ptr++); }
const_iterator& operator++() { ++_ptr; return *this; } const_iterator operator++(int) { return const_iterator(_ptr++); }
reference operator* () const { return *_ptr; } const_iterator& operator++() { ++_ptr; return *this; }
pointer operator->() const { return _ptr; } reference operator* () const { return *_ptr; }
const_iterator operator+ (const difference_type offset) const { return const_iterator(_ptr + offset); } pointer operator->() const { return _ptr; }
const_iterator operator- (const difference_type offset) const { return const_iterator(_ptr - offset); } const_iterator operator+ (const difference_type offset) const { return const_iterator(_ptr + offset); }
difference_type operator- (const const_iterator& rhs) const { return _ptr - rhs._ptr; } const_iterator operator- (const difference_type offset) const { return const_iterator(_ptr - offset); }
bool operator==(const const_iterator& rhs) const { return _ptr == rhs._ptr; } difference_type operator- (const const_iterator& rhs) const { return _ptr - rhs._ptr; }
bool operator!=(const const_iterator& rhs) const { return _ptr != rhs._ptr; } bool operator==(const const_iterator& rhs) const { return _ptr == rhs._ptr; }
const_iterator& operator+=(const difference_type offset) { _ptr += offset; return *this; } bool operator!=(const const_iterator& rhs) const { return _ptr != rhs._ptr; }
const_iterator& operator-=(const difference_type offset) { _ptr -= offset; return *this; } const_iterator& operator+=(const difference_type offset) { _ptr += offset; return *this; }
}; const_iterator& operator-=(const difference_type offset) { _ptr -= offset; return *this; }
};
using const_iterator = IXWebSocketSendData_const_iterator<char>;
using const_iterator = IXWebSocketSendData_const_iterator<char>;
/* The assigned std::string must be kept alive for the lifetime of the input buffer */
IXWebSocketSendData(const std::string& str) /* The assigned std::string must be kept alive for the lifetime of the input buffer */
: _data(str.data()) IXWebSocketSendData(const std::string& str)
, _size(str.size()) : _data(str.data())
{ , _size(str.size())
} {
}
/* The assigned std::vector must be kept alive for the lifetime of the input buffer */
IXWebSocketSendData(const std::vector<char>& v) /* The assigned std::vector must be kept alive for the lifetime of the input buffer */
: _data(v.data()) IXWebSocketSendData(const std::vector<char>& v)
, _size(v.size()) : _data(v.data())
{ , _size(v.size())
} {
}
/* The assigned std::vector must be kept alive for the lifetime of the input buffer */
IXWebSocketSendData(const std::vector<uint8_t>& v) /* The assigned std::vector must be kept alive for the lifetime of the input buffer */
: _data(reinterpret_cast<const char*>(v.data())) IXWebSocketSendData(const std::vector<uint8_t>& v)
, _size(v.size()) : _data(reinterpret_cast<const char*>(v.data()))
{ , _size(v.size())
} {
}
/* The assigned memory must be kept alive for the lifetime of the input buffer */
IXWebSocketSendData(const char* data, size_t size) /* The assigned memory must be kept alive for the lifetime of the input buffer */
: _data(data) IXWebSocketSendData(const char* data, size_t size)
, _size(data == nullptr ? 0 : size) : _data(data)
{ , _size(data == nullptr ? 0 : size)
} {
}
bool empty() const
{ bool empty() const
return _data == nullptr || _size == 0; {
} return _data == nullptr || _size == 0;
}
const char* c_str() const
{ const char* c_str() const
return _data; {
} return _data;
}
const char* data() const
{ const char* data() const
return _data; {
} return _data;
}
size_t size() const
{ size_t size() const
return _size; {
} return _size;
}
inline const_iterator begin() const
{ inline const_iterator begin() const
return const_iterator(const_cast<char*>(_data)); {
} return const_iterator(const_cast<char*>(_data));
}
inline const_iterator end() const
{ inline const_iterator end() const
return const_iterator(const_cast<char*>(_data) + _size); {
} return const_iterator(const_cast<char*>(_data) + _size);
}
inline const_iterator cbegin() const
{ inline const_iterator cbegin() const
return begin(); {
} return begin();
}
inline const_iterator cend() const
{ inline const_iterator cend() const
return end(); {
} return end();
}
private:
const char* _data; private:
const size_t _size; const char* _data;
}; const size_t _size;
};
} }

View File

@ -45,7 +45,6 @@
#include <cstdarg> #include <cstdarg>
#include <cstdlib> #include <cstdlib>
#include <sstream> #include <sstream>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <string> #include <string>
#include <thread> #include <thread>

View File

@ -21,6 +21,7 @@
#include "IXWebSocketSendData.h" #include "IXWebSocketSendData.h"
#include "IXWebSocketSendInfo.h" #include "IXWebSocketSendInfo.h"
#include <atomic> #include <atomic>
#include <cstdint>
#include <functional> #include <functional>
#include <list> #include <list>
#include <memory> #include <memory>