diff --git a/include/Compat.h b/include/Compat.h index 8f66409..18d2b90 100644 --- a/include/Compat.h +++ b/include/Compat.h @@ -23,7 +23,7 @@ inline void CloseSocketProper(int socket) { #ifdef WIN32 #include #include -inline void CloseSocketProper(u_int64 socket) { +inline void CloseSocketProper(SOCKET socket) { shutdown(socket, SD_BOTH); closesocket(socket); } diff --git a/include/TResourceManager.h b/include/TResourceManager.h index af6d4cb..6dc8e43 100644 --- a/include/TResourceManager.h +++ b/include/TResourceManager.h @@ -6,14 +6,14 @@ class TResourceManager { public: TResourceManager(); - [[nodiscard]] uint64_t MaxModSize() const { return mMaxModSize; } + [[nodiscard]] size_t MaxModSize() const { return mMaxModSize; } [[nodiscard]] std::string FileList() const { return mFileList; } [[nodiscard]] std::string TrimmedList() const { return mTrimmedList; } [[nodiscard]] std::string FileSizes() const { return mFileSizes; } [[nodiscard]] int ModsLoaded() const { return mModsLoaded; } private: - uint64_t mMaxModSize = 0; + size_t mMaxModSize = 0; std::string mFileSizes; std::string mFileList; std::string mTrimmedList; diff --git a/include/TTCPServer.h b/include/TTCPServer.h index 2178808..3316bfb 100644 --- a/include/TTCPServer.h +++ b/include/TTCPServer.h @@ -50,5 +50,5 @@ private: void Parse(TClient& c, const std::string& Packet); void SendFile(TClient& c, const std::string& Name); static bool TCPSendRaw(SOCKET C, char* Data, int32_t Size); - static void SplitLoad(TClient& c, int64_t Sent, int64_t Size, bool D, const std::string& Name); + static void SplitLoad(TClient& c, size_t Sent, size_t Size, bool D, const std::string& Name); }; \ No newline at end of file diff --git a/src/TResourceManager.cpp b/src/TResourceManager.cpp index c79aa0e..862c27a 100644 --- a/src/TResourceManager.cpp +++ b/src/TResourceManager.cpp @@ -20,8 +20,8 @@ TResourceManager::TResourceManager() { File = File.substr(i,pos-i); } mTrimmedList += File + ';'; - mFileSizes += std::to_string(uint64_t(fs::file_size(entry.path()))) + ';'; - mMaxModSize += uint64_t(fs::file_size(entry.path())); + mFileSizes += std::to_string(size_t(fs::file_size(entry.path()))) + ';'; + mMaxModSize += size_t(fs::file_size(entry.path())); mModsLoaded++; } } diff --git a/src/TTCPServer.cpp b/src/TTCPServer.cpp index 6a013e6..0c32091 100644 --- a/src/TTCPServer.cpp +++ b/src/TTCPServer.cpp @@ -443,7 +443,7 @@ void TTCPServer::SendFile(TClient& c, const std::string& Name) { return; } - int64_t Size = std::filesystem::file_size(Name), MSize = Size / 2; + size_t Size = size_t(std::filesystem::file_size(Name)), MSize = Size / 2; std::thread SplitThreads[2] { std::thread([&] { @@ -461,9 +461,9 @@ void TTCPServer::SendFile(TClient& c, const std::string& Name) { } } -void TTCPServer::SplitLoad(TClient& c, int64_t Sent, int64_t Size, bool D, const std::string& Name) { +void TTCPServer::SplitLoad(TClient& c, size_t Sent, size_t Size, bool D, const std::string& Name) { std::ifstream f(Name.c_str(), std::ios::binary); - int32_t Split = 0x7735940; //125MB + uint32_t Split = 0x7735940; //125MB char* Data; if (Size > Split) Data = new char[Split]; @@ -476,7 +476,7 @@ void TTCPServer::SplitLoad(TClient& c, int64_t Sent, int64_t Size, bool D, const TCPSock = c.GetTCPSock(); info("Split load Socket " + std::to_string(TCPSock)); while (c.GetStatus() > -1 && Sent < Size) { - int64_t Diff = Size - Sent; + size_t Diff = Size - Sent; if (Diff > Split) { f.seekg(Sent, std::ios_base::beg); f.read(Data, Split); @@ -502,9 +502,9 @@ void TTCPServer::SplitLoad(TClient& c, int64_t Sent, int64_t Size, bool D, const } bool TTCPServer::TCPSendRaw(SOCKET C, char* Data, int32_t Size) { - int64_t Sent = 0; + intmax_t Sent = 0; do { - int64_t Temp = send(C, &Data[Sent], int(Size - Sent), 0); + intmax_t Temp = send(C, &Data[Sent], int(Size - Sent), 0); if (Temp < 1) { info("Socket Closed! " + std::to_string(C)); CloseSocketProper(C); diff --git a/src/TUDPServer.cpp b/src/TUDPServer.cpp index af6e79e..7f3ccca 100644 --- a/src/TUDPServer.cpp +++ b/src/TUDPServer.cpp @@ -162,7 +162,7 @@ std::string TUDPServer::UDPRcvFromClient(sockaddr_in& client) const { size_t clientLength = sizeof(client); std::array Ret {}; #ifdef WIN32 - int64_t Rcv = recvfrom(mUDPSock, Ret.data(), int(Ret.size()), 0, (sockaddr*)&client, (int*)&clientLength); + auto Rcv = recvfrom(mUDPSock, Ret.data(), int(Ret.size()), 0, (sockaddr*)&client, (int*)&clientLength); #else // unix int64_t Rcv = recvfrom(mUDPSock, Ret.data(), Ret.size(), 0, (sockaddr*)&client, (socklen_t*)&clientLength); #endif // WIN32