mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-01 23:46:59 +00:00
fix compiler error in decomp
This commit is contained in:
parent
e46d4b2f0e
commit
1f7c498bd9
@ -9,5 +9,5 @@
|
|||||||
#include <span>
|
#include <span>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
std::vector<char> Comp(std::span<char> input);
|
std::vector<char> Comp(std::span<const char> input);
|
||||||
std::vector<char> DeComp(std::span<char> input);
|
std::vector<char> DeComp(std::span<const char> input);
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<char> Comp(std::span<char> input) {
|
std::vector<char> Comp(std::span<const char> input) {
|
||||||
auto max_size = compressBound(input.size());
|
auto max_size = compressBound(input.size());
|
||||||
std::vector<char> output(max_size);
|
std::vector<char> output(max_size);
|
||||||
uLongf output_size = output.size();
|
uLongf output_size = output.size();
|
||||||
int res = compress(
|
int res = compress(
|
||||||
reinterpret_cast<Bytef*>(output.data()),
|
reinterpret_cast<Bytef*>(output.data()),
|
||||||
&output_size,
|
&output_size,
|
||||||
reinterpret_cast<Bytef*>(input.data()),
|
reinterpret_cast<const Bytef*>(input.data()),
|
||||||
static_cast<uLongf>(input.size()));
|
static_cast<uLongf>(input.size()));
|
||||||
if (res != Z_OK) {
|
if (res != Z_OK) {
|
||||||
error("zlib compress() failed: " + std::to_string(res));
|
error("zlib compress() failed: " + std::to_string(res));
|
||||||
@ -33,7 +33,7 @@ std::vector<char> Comp(std::span<char> input) {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<char> DeComp(std::span<char> input) {
|
std::vector<char> DeComp(std::span<const char> input) {
|
||||||
std::vector<char> output_buffer(std::min<size_t>(input.size() * 5, 15 * 1024 * 1024));
|
std::vector<char> output_buffer(std::min<size_t>(input.size() * 5, 15 * 1024 * 1024));
|
||||||
|
|
||||||
uLongf output_size = output_buffer.size();
|
uLongf output_size = output_buffer.size();
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include "linuxfixes.h"
|
#include "linuxfixes.h"
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <errno.h>
|
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -22,7 +21,6 @@
|
|||||||
|
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <set>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
SOCKET UDPSock = -1;
|
SOCKET UDPSock = -1;
|
||||||
@ -52,7 +50,7 @@ void SendLarge(std::string Data) {
|
|||||||
void UDPParser(std::string_view Packet) {
|
void UDPParser(std::string_view Packet) {
|
||||||
if (Packet.substr(0, 4) == "ABG:") {
|
if (Packet.substr(0, 4) == "ABG:") {
|
||||||
auto substr = Packet.substr(4);
|
auto substr = Packet.substr(4);
|
||||||
auto res = DeComp(std::span<char>(substr.data(), substr.size()));
|
auto res = DeComp(std::span<const char>(substr.data(), substr.size()));
|
||||||
Packet = std::string(res.data(), res.size());
|
Packet = std::string(res.data(), res.size());
|
||||||
}
|
}
|
||||||
ServerParser(Packet);
|
ServerParser(Packet);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user