Prefix all size_t with std::

done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
This commit is contained in:
Weiyi Wang 2018-09-06 16:03:28 -04:00
parent eca98eeb3e
commit 7d8f115185
158 changed files with 669 additions and 634 deletions

View file

@ -90,13 +90,13 @@ private:
Request::PortInfo port_info{1, {pad_index, 0, 0, 0}};
auto port_message = Request::Create(port_info, client_id);
std::memcpy(&send_buffer1, &port_message, PORT_INFO_SIZE);
size_t len = socket.send_to(boost::asio::buffer(send_buffer1), send_endpoint);
std::size_t len = socket.send_to(boost::asio::buffer(send_buffer1), send_endpoint);
// Send a request for getting pad data for the pad
Request::PadData pad_data{Request::PadData::Flags::Id, pad_index, EMPTY_MAC_ADDRESS};
auto pad_message = Request::Create(pad_data, client_id);
std::memcpy(send_buffer2.data(), &pad_message, PAD_DATA_SIZE);
size_t len2 = socket.send_to(boost::asio::buffer(send_buffer2), send_endpoint);
std::size_t len2 = socket.send_to(boost::asio::buffer(send_buffer2), send_endpoint);
StartSend(timer.expiry());
}
@ -108,8 +108,8 @@ private:
u32 client_id;
u8 pad_index;
static constexpr size_t PORT_INFO_SIZE = sizeof(Message<Request::PortInfo>);
static constexpr size_t PAD_DATA_SIZE = sizeof(Message<Request::PadData>);
static constexpr std::size_t PORT_INFO_SIZE = sizeof(Message<Request::PortInfo>);
static constexpr std::size_t PAD_DATA_SIZE = sizeof(Message<Request::PadData>);
std::array<u8, PORT_INFO_SIZE> send_buffer1;
std::array<u8, PAD_DATA_SIZE> send_buffer2;
udp::endpoint send_endpoint;

View file

@ -9,7 +9,7 @@
namespace InputCommon::CemuhookUDP {
static const size_t GetSizeOfResponseType(Type t) {
static const std::size_t GetSizeOfResponseType(Type t) {
switch (t) {
case Type::Version:
return sizeof(Response::Version);
@ -29,7 +29,7 @@ namespace Response {
* Note: Modifies the buffer to zero out the crc (since thats the easiest way to check without
* copying the buffer)
*/
boost::optional<Type> Validate(u8* data, size_t size) {
boost::optional<Type> Validate(u8* data, std::size_t size) {
if (size < sizeof(Header)) {
LOG_DEBUG(Input, "Invalid UDP packet received");
return boost::none;
@ -53,7 +53,7 @@ boost::optional<Type> Validate(u8* data, size_t size) {
// and also verify that the packet info mentions the correct size. Since the spec includes the
// type of the packet as part of the data, we need to include it in size calculations here
// ie: payload_length == sizeof(T) + sizeof(Type)
const size_t data_len = GetSizeOfResponseType(header.type);
const std::size_t data_len = GetSizeOfResponseType(header.type);
if (header.payload_length != data_len + sizeof(Type) || size < data_len + sizeof(Header)) {
LOG_ERROR(
Input,

View file

@ -14,7 +14,7 @@
namespace InputCommon::CemuhookUDP {
constexpr size_t MAX_PACKET_SIZE = 100;
constexpr std::size_t MAX_PACKET_SIZE = 100;
constexpr u16 PROTOCOL_VERSION = 1001;
constexpr u32 CLIENT_MAGIC = 0x43555344; // DSUC (but flipped for LE)
constexpr u32 SERVER_MAGIC = 0x53555344; // DSUS (but flipped for LE)
@ -218,7 +218,7 @@ static_assert(sizeof(Message<PadData>) == MAX_PACKET_SIZE,
* @return boost::none if it failed to parse or Type if it succeeded. The client can then safely
* copy the data into the appropriate struct for that Type
*/
boost::optional<Type> Validate(u8* data, size_t size);
boost::optional<Type> Validate(u8* data, std::size_t size);
} // namespace Response