reformat remaining files
This commit is contained in:
+5
-16
@@ -46,23 +46,16 @@ union PSOCommandHeader {
|
||||
PSOCommandHeader();
|
||||
} __packed_ws__(PSOCommandHeader, 8);
|
||||
|
||||
// This function is used in a lot of places to check received command sizes and
|
||||
// cast them to the appropriate type
|
||||
// This function is used in a lot of places to check received command sizes and cast them to the appropriate type
|
||||
template <typename RetT, typename PtrT>
|
||||
RetT& check_size_generic(
|
||||
PtrT data,
|
||||
size_t size,
|
||||
size_t min_size,
|
||||
size_t max_size) {
|
||||
RetT& check_size_generic(PtrT data, size_t size, size_t min_size, size_t max_size) {
|
||||
if (size < min_size) {
|
||||
throw std::runtime_error(std::format(
|
||||
"command too small (expected at least 0x{:X} bytes, received 0x{:X} bytes)",
|
||||
min_size, size));
|
||||
"command too small (expected at least 0x{:X} bytes, received 0x{:X} bytes)", min_size, size));
|
||||
}
|
||||
if (size > max_size) {
|
||||
throw std::runtime_error(std::format(
|
||||
"command too large (expected at most 0x{:X} bytes, received 0x{:X} bytes)",
|
||||
max_size, size));
|
||||
"command too large (expected at most 0x{:X} bytes, received 0x{:X} bytes)", max_size, size));
|
||||
}
|
||||
return *reinterpret_cast<RetT*>(data);
|
||||
}
|
||||
@@ -128,8 +121,4 @@ T* check_size_vec_t(std::string& data, size_t count, bool allow_extra = false) {
|
||||
void check_size_v(size_t size, size_t min_size, size_t max_size = 0);
|
||||
|
||||
std::string prepend_command_header(
|
||||
Version version,
|
||||
bool encryption_enabled,
|
||||
uint16_t cmd,
|
||||
uint32_t flag,
|
||||
const std::string& data);
|
||||
Version version, bool encryption_enabled, uint16_t cmd, uint32_t flag, const std::string& data);
|
||||
|
||||
Reference in New Issue
Block a user