aboutsummaryrefslogtreecommitdiff
path: root/primedev/core
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2024-01-21 19:34:19 +0000
committerGitHub <noreply@github.com>2024-01-21 20:34:19 +0100
commit7f84bdf8fd5c93286f000bc5f9314eab81128cee (patch)
treed97974691eb50b7cd8a2bf8a7cbc342fdc7bdd44 /primedev/core
parente72f0cbbac6ffcbfbf0c52f14a2a3cb7c18ba8fc (diff)
downloadNorthstarLauncher-7f84bdf8fd5c93286f000bc5f9314eab81128cee.tar.gz
NorthstarLauncher-7f84bdf8fd5c93286f000bc5f9314eab81128cee.zip
Address C4267 compiler warnings (#647)v1.22.2-rc1
Implicit conversion from `size_t` to a smaller type
Diffstat (limited to 'primedev/core')
-rw-r--r--primedev/core/convar/convar.cpp2
-rw-r--r--primedev/core/hooks.cpp8
-rw-r--r--primedev/core/hooks.h14
-rw-r--r--primedev/core/math/bitbuf.h4
-rw-r--r--primedev/core/memory.cpp4
5 files changed, 16 insertions, 16 deletions
diff --git a/primedev/core/convar/convar.cpp b/primedev/core/convar/convar.cpp
index e77ae1fd..94e41fee 100644
--- a/primedev/core/convar/convar.cpp
+++ b/primedev/core/convar/convar.cpp
@@ -382,7 +382,7 @@ void ConVar::ChangeStringValue(const char* pszTempVal, float flOldValue)
if (pszTempVal)
{
- int len = strlen(pszTempVal) + 1;
+ size_t len = strlen(pszTempVal) + 1;
if (len > m_Value.m_iStringLength)
{
diff --git a/primedev/core/hooks.cpp b/primedev/core/hooks.cpp
index 26b3fe57..7ea435fe 100644
--- a/primedev/core/hooks.cpp
+++ b/primedev/core/hooks.cpp
@@ -77,7 +77,7 @@ void __fileAutohook::Dispatch()
void __fileAutohook::DispatchForModule(const char* pModuleName)
{
- const int iModuleNameLen = strlen(pModuleName);
+ const size_t iModuleNameLen = strlen(pModuleName);
for (__autohook* hook : hooks)
if ((hook->iAddressResolutionMode == __autohook::OFFSET_STRING && !strncmp(pModuleName, hook->pAddrString, iModuleNameLen)) ||
@@ -87,14 +87,14 @@ void __fileAutohook::DispatchForModule(const char* pModuleName)
ManualHook::ManualHook(const char* funcName, LPVOID func) : pHookFunc(func), ppOrigFunc(nullptr)
{
- const int iFuncNameStrlen = strlen(funcName);
+ const size_t iFuncNameStrlen = strlen(funcName);
pFuncName = new char[iFuncNameStrlen];
memcpy(pFuncName, funcName, iFuncNameStrlen);
}
ManualHook::ManualHook(const char* funcName, LPVOID* orig, LPVOID func) : pHookFunc(func), ppOrigFunc(orig)
{
- const int iFuncNameStrlen = strlen(funcName);
+ const size_t iFuncNameStrlen = strlen(funcName);
pFuncName = new char[iFuncNameStrlen];
memcpy(pFuncName, funcName, iFuncNameStrlen);
}
@@ -141,7 +141,7 @@ uintptr_t ParseDLLOffsetString(const char* pAddrString)
uintptr_t iOffset = 0;
int iOffsetBegin = iDllNameEnd;
- int iOffsetEnd = strlen(pAddrString);
+ size_t iOffsetEnd = strlen(pAddrString);
// seek until we hit the start of the number offset
for (; !(pAddrString[iOffsetBegin] >= '0' && pAddrString[iOffsetBegin] <= '9') && pAddrString[iOffsetBegin]; iOffsetBegin++)
diff --git a/primedev/core/hooks.h b/primedev/core/hooks.h
index 15edbf0b..7c1b001c 100644
--- a/primedev/core/hooks.h
+++ b/primedev/core/hooks.h
@@ -119,7 +119,7 @@ public:
{
iAddressResolutionMode = ABSOLUTE_ADDR;
- const int iFuncNameStrlen = strlen(funcName) + 1;
+ const size_t iFuncNameStrlen = strlen(funcName) + 1;
pFuncName = new char[iFuncNameStrlen];
memcpy(pFuncName, funcName, iFuncNameStrlen);
@@ -131,11 +131,11 @@ public:
{
iAddressResolutionMode = OFFSET_STRING;
- const int iFuncNameStrlen = strlen(funcName) + 1;
+ const size_t iFuncNameStrlen = strlen(funcName) + 1;
pFuncName = new char[iFuncNameStrlen];
memcpy(pFuncName, funcName, iFuncNameStrlen);
- const int iAddrStrlen = strlen(addrString) + 1;
+ const size_t iAddrStrlen = strlen(addrString) + 1;
pAddrString = new char[iAddrStrlen];
memcpy(pAddrString, addrString, iAddrStrlen);
@@ -147,15 +147,15 @@ public:
{
iAddressResolutionMode = PROCADDRESS;
- const int iFuncNameStrlen = strlen(funcName) + 1;
+ const size_t iFuncNameStrlen = strlen(funcName) + 1;
pFuncName = new char[iFuncNameStrlen];
memcpy(pFuncName, funcName, iFuncNameStrlen);
- const int iModuleNameStrlen = strlen(moduleName) + 1;
+ const size_t iModuleNameStrlen = strlen(moduleName) + 1;
pModuleName = new char[iModuleNameStrlen];
memcpy(pModuleName, moduleName, iModuleNameStrlen);
- const int iProcNameStrlen = strlen(procName) + 1;
+ const size_t iProcNameStrlen = strlen(procName) + 1;
pProcName = new char[iProcNameStrlen];
memcpy(pProcName, procName, iProcNameStrlen);
@@ -293,7 +293,7 @@ public:
{
m_pTarget = pTarget;
- const int iAddrStrlen = strlen(pAddrString) + 1;
+ const size_t iAddrStrlen = strlen(pAddrString) + 1;
m_pAddrString = new char[iAddrStrlen];
memcpy(m_pAddrString, pAddrString, iAddrStrlen);
diff --git a/primedev/core/math/bitbuf.h b/primedev/core/math/bitbuf.h
index 5ca75455..a06dab17 100644
--- a/primedev/core/math/bitbuf.h
+++ b/primedev/core/math/bitbuf.h
@@ -630,7 +630,7 @@ public:
// at the head to make reading and detecting the end efficient.
int nHead = m_DataBytes & 3;
- int posBytes = startPos / 8;
+ size_t posBytes = startPos / 8;
if ((m_DataBytes < 4) || (nHead && (posBytes < nHead)))
{
// partial first dword
@@ -652,7 +652,7 @@ public:
}
else
{
- int adjustedPos = startPos - (nHead << 3);
+ size_t adjustedPos = startPos - (nHead << 3);
m_DataIn = reinterpret_cast<u32 const*>(reinterpret_cast<u8 const*>(m_Data) + ((adjustedPos / 32) << 2) + nHead);
diff --git a/primedev/core/memory.cpp b/primedev/core/memory.cpp
index 3770586f..41110aee 100644
--- a/primedev/core/memory.cpp
+++ b/primedev/core/memory.cpp
@@ -103,7 +103,7 @@ inline std::vector<uint8_t> HexBytesToString(const char* pHexString)
{
std::vector<uint8_t> ret;
- int size = strlen(pHexString);
+ size_t size = strlen(pHexString);
for (int i = 0; i < size; i++)
{
// If this is a space character, ignore it
@@ -289,7 +289,7 @@ inline std::pair<std::vector<uint8_t>, std::string> MaskedBytesFromPattern(const
std::vector<uint8_t> vRet;
std::string sMask;
- int size = strlen(pPatternString);
+ size_t size = strlen(pPatternString);
for (int i = 0; i < size; i++)
{
// If this is a space character, ignore it