mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-27 05:04:01 +08:00
fixing some errors via types
(might ebe worng)
This commit is contained in:
parent
765f3f210c
commit
6a464fd295
@ -5,6 +5,7 @@
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
#include <time.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
@ -108,7 +109,8 @@ static void log_exception(LPEXCEPTION_POINTERS ex_pointers)
|
||||
auto now = std::chrono::system_clock::now();
|
||||
auto t_now = std::chrono::system_clock::to_time_t(now);
|
||||
auto gm_time = std::gmtime(&t_now);
|
||||
auto time = std::string(std::asctime(gm_time));
|
||||
auto asc_time = std::asctime(gm_time);
|
||||
auto time = std::string(asc_time);
|
||||
time.pop_back(); // remove the trailing '\n' added by asctime
|
||||
common_helpers::write(file, "[" + time + "]");
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ std::vector<uint8_t> AppTicketV1::Serialize() const
|
||||
pBuffer = buffer.data();
|
||||
*reinterpret_cast<uint32_t*>(pBuffer) = TicketSize; pBuffer += 4;
|
||||
*reinterpret_cast<uint32_t*>(pBuffer) = TicketVersion; pBuffer += 4;
|
||||
*reinterpret_cast<uint32_t*>(pBuffer) = UserData.size(); pBuffer += 4;
|
||||
*reinterpret_cast<uint32_t*>(pBuffer) = static_cast<uint32_t>(UserData.size()); pBuffer += 4;
|
||||
*reinterpret_cast<uint32_t*>(pBuffer) = Unk2; pBuffer += 4;
|
||||
memcpy(pBuffer, UserData.data(), UserData.size());
|
||||
|
||||
@ -132,7 +132,7 @@ std::vector<uint8_t> AppTicketV4::Serialize()
|
||||
appids.emplace_back(0);
|
||||
}
|
||||
|
||||
uint16_t appid_count = static_cast<uint16_t>(appids.size() > 140 ? 140 : appids.size());
|
||||
uint16_t appid_count = static_cast<uint16_t>(static_cast<uint16_t>(appids.size()) > 140 ? 140 : static_cast<uint16_t>(appids.size()));
|
||||
size_t buffer_size = static_cast<uint32_t>(appid_count) * 4ul + 2ul;
|
||||
std::vector<uint8_t> buffer{};
|
||||
uint8_t* pBuffer{};
|
||||
@ -235,8 +235,8 @@ std::vector<uint8_t> DecryptedAppTicket::SerializeTicket()
|
||||
{
|
||||
std::vector<uint8_t> buffer{};
|
||||
|
||||
TicketV1.TicketSize = TicketV1.UserData.size() + 40 + 2 + ((TicketV4.AppIDs.size() == 0 ? 1 : TicketV4.AppIDs.size()) * 4) + (TicketV4.HasVACStatus ? 4 : 0) + (TicketV4.HasAppValue ? 4 : 0);
|
||||
TicketV2.TicketSize = TicketV1.TicketSize - TicketV1.UserData.size();
|
||||
TicketV1.TicketSize = static_cast<uint32_t>(TicketV1.UserData.size()) + 40 + 2 + ((static_cast<uint32_t>(TicketV4.AppIDs.size()) == 0 ? 1 : static_cast<uint32_t>(TicketV4.AppIDs.size())) * 4) + (TicketV4.HasVACStatus ? 4 : 0) + (TicketV4.HasAppValue ? 4 : 0);
|
||||
TicketV2.TicketSize = TicketV1.TicketSize - static_cast<uint32_t>(TicketV1.UserData.size());
|
||||
|
||||
buffer = TicketV1.Serialize();
|
||||
|
||||
|
11
dll/auth.cpp
11
dll/auth.cpp
@ -671,7 +671,7 @@ Auth_Data Auth_Manager::getTicketData( void *pTicket, int cbMaxTicket, uint32 *p
|
||||
ticket_data.Ticket.Licenses.push_back(0); //TODO
|
||||
unsigned int dlcCount = settings->DLCCount();
|
||||
ticket_data.Ticket.DLCs.resize(0); //currently set to 0
|
||||
for (int i = 0; i < dlcCount; ++i)
|
||||
for (unsigned i = 0; i < dlcCount; ++i)
|
||||
{
|
||||
DLC dlc;
|
||||
AppId_t appid;
|
||||
@ -695,9 +695,10 @@ Auth_Data Auth_Manager::getTicketData( void *pTicket, int cbMaxTicket, uint32 *p
|
||||
ticket_data.GC.TicketGeneratedCount = get_ticket_count();
|
||||
}
|
||||
std::vector<uint8_t> ser = ticket_data.Serialize();
|
||||
*pcbTicket = ser.size();
|
||||
if (cbMaxTicket >= ser.size())
|
||||
memcpy(pTicket, ser.data(), ser.size());
|
||||
uint32_t ser_size = static_cast<uint32_t>(ser.size());
|
||||
*pcbTicket = ser_size;
|
||||
if (cbMaxTicket >= ser_size)
|
||||
memcpy(pTicket, ser.data(), ser_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -846,7 +847,7 @@ EBeginAuthSessionResult Auth_Manager::beginAuth(const void *pAuthTicket, int cbA
|
||||
|
||||
uint32 Auth_Manager::countInboundAuth()
|
||||
{
|
||||
return inbound.size();
|
||||
return static_cast<uint32>(inbound.size());
|
||||
}
|
||||
|
||||
bool Auth_Manager::endAuth(CSteamID id)
|
||||
|
@ -204,7 +204,7 @@ void SteamCallResults::setCbAll(void (*cb_all)(std::vector<char> result, int cal
|
||||
|
||||
void SteamCallResults::runCallResults()
|
||||
{
|
||||
unsigned long current_size = callresults.size();
|
||||
unsigned long current_size = static_cast<unsigned long>(callresults.size());
|
||||
for (unsigned i = 0; i < current_size; ++i) {
|
||||
unsigned index = i;
|
||||
|
||||
@ -315,7 +315,7 @@ void SteamCallBacks::addCallBack(int iCallback, class CCallbackBase *cb)
|
||||
CCallbackMgr::SetRegister(cb, iCallback);
|
||||
for (auto & res: callbacks[iCallback].results) {
|
||||
//TODO: timeout?
|
||||
SteamAPICall_t api_id = results->addCallResult(iCallback, &(res[0]), res.size(), 0.0, false);
|
||||
SteamAPICall_t api_id = results->addCallResult(iCallback, &(res[0]), static_cast<unsigned long>(res.size()), 0.0, false);
|
||||
results->addCallBack(api_id, cb);
|
||||
}
|
||||
}
|
||||
|
@ -1105,7 +1105,7 @@ STEAMAPI_API steam_bool S_CALLTYPE SteamAPI_ManualDispatch_GetNextCallback( HSte
|
||||
pCallbackMsg->m_hSteamUser = m_hSteamUser;
|
||||
pCallbackMsg->m_iCallback = q->front().cb_id;
|
||||
pCallbackMsg->m_pubParam = (uint8 *)&(q->front().result[0]);
|
||||
pCallbackMsg->m_cubParam = q->front().result.size();
|
||||
pCallbackMsg->m_cubParam = static_cast<unsigned long>(q->front().result.size());
|
||||
PRINT_DEBUG("cb number %i", q->front().cb_id);
|
||||
return true;
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ void Settings::setStatDefiniton(const std::string &name, const struct Stat_confi
|
||||
|
||||
int Settings::add_image(const std::string &data, uint32 width, uint32 height)
|
||||
{
|
||||
int last = images.size() + 1;
|
||||
int last = static_cast<int>(images.size()) + 1;
|
||||
struct Image_Data dt;
|
||||
dt.width = width;
|
||||
dt.height = height;
|
||||
|
@ -728,7 +728,7 @@ int Steam_GameServer::GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *p
|
||||
if (settings->disable_source_query) return 0;
|
||||
if (outgoing_packets.size() == 0) return 0;
|
||||
|
||||
if (outgoing_packets.back().data.size() < cbMaxOut) cbMaxOut = outgoing_packets.back().data.size();
|
||||
if (outgoing_packets.back().data.size() < cbMaxOut) cbMaxOut = static_cast<int>(outgoing_packets.back().data.size());
|
||||
if (pOut) memcpy(pOut, outgoing_packets.back().data.data(), cbMaxOut);
|
||||
if (pNetAdr) *pNetAdr = outgoing_packets.back().ip;
|
||||
if (pPort) *pPort = outgoing_packets.back().port;
|
||||
|
@ -42,9 +42,9 @@ struct MatchMakingKeyValuePair_t
|
||||
MatchMakingKeyValuePair_t() { m_szKey[0] = m_szValue[0] = 0; }
|
||||
MatchMakingKeyValuePair_t( const char *pchKey, const char *pchValue )
|
||||
{
|
||||
strncpy( m_szKey, pchKey, sizeof(m_szKey) ); // this is a public header, use basic c library string funcs only!
|
||||
strncpy_s( m_szKey, pchKey, sizeof(m_szKey) ); // this is a public header, use basic c library string funcs only!
|
||||
m_szKey[ sizeof( m_szKey ) - 1 ] = '\0';
|
||||
strncpy( m_szValue, pchValue, sizeof(m_szValue) );
|
||||
strncpy_s( m_szValue, pchValue, sizeof(m_szValue) );
|
||||
m_szValue[ sizeof( m_szValue ) - 1 ] = '\0';
|
||||
}
|
||||
char m_szKey[ 256 ];
|
||||
@ -156,9 +156,9 @@ inline const char *servernetadr_t::ToString( uint32 unIP, uint16 usPort ) const
|
||||
static int nBuf = 0;
|
||||
unsigned char *ipByte = (unsigned char *)&unIP;
|
||||
#ifdef VALVE_BIG_ENDIAN
|
||||
_snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[0]), (int)(ipByte[1]), (int)(ipByte[2]), (int)(ipByte[3]), usPort );
|
||||
_snprintf_s (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[0]), (int)(ipByte[1]), (int)(ipByte[2]), (int)(ipByte[3]), usPort );
|
||||
#else
|
||||
_snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort );
|
||||
_snprintf_s (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort );
|
||||
#endif
|
||||
const char *pchRet = s[nBuf];
|
||||
++nBuf;
|
||||
@ -243,7 +243,7 @@ inline const char* gameserveritem_t::GetName() const
|
||||
|
||||
inline void gameserveritem_t::SetName( const char *pName )
|
||||
{
|
||||
strncpy( m_szServerName, pName, sizeof( m_szServerName ) );
|
||||
strncpy_s( m_szServerName, pName, sizeof( m_szServerName ) );
|
||||
m_szServerName[ sizeof( m_szServerName ) - 1 ] = '\0';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user