Core: Clean up some 64bit warnings

This commit is contained in:
zilmar 2022-08-01 13:15:52 +09:30
parent 0419ba232e
commit 18870634a5
14 changed files with 32 additions and 23 deletions

View File

@ -138,7 +138,7 @@ SRes C7zip::SzFileReadImp(void *object, void *buffer, size_t *processedSize)
{ {
CFileInStream *p = (CFileInStream *)object; CFileInStream *p = (CFileInStream *)object;
DWORD dwRead; DWORD dwRead;
if (!ReadFile(p->file.handle, buffer, *processedSize, &dwRead, nullptr)) if (!ReadFile(p->file.handle, buffer, (DWORD)*processedSize, &dwRead, nullptr))
{ {
return SZ_ERROR_FAIL; return SZ_ERROR_FAIL;
} }
@ -174,13 +174,13 @@ SRes C7zip::SzFileSeekImp(void *p, Int64 *pos, ESzSeek origin)
return SZ_OK; return SZ_OK;
} }
const char * C7zip::FileName(char * FileName, int SizeOfFileName) const const char * C7zip::FileName(char * FileName, size_t SizeOfFileName) const
{ {
if (FileName == nullptr) if (FileName == nullptr)
{ {
return nullptr; return nullptr;
} }
int Len = strlen(m_FileName); size_t Len = strlen(m_FileName);
if (Len > (SizeOfFileName - 1)) if (Len > (SizeOfFileName - 1))
{ {
Len = (SizeOfFileName - 1); Len = (SizeOfFileName - 1);
@ -198,7 +198,7 @@ std::wstring C7zip::FileNameIndex(int index)
// No filename // No filename
return filename; return filename;
} }
int namelen = SzArEx_GetFileNameUtf16(m_db, index, nullptr); size_t namelen = SzArEx_GetFileNameUtf16(m_db, index, nullptr);
if (namelen <= 0) if (namelen <= 0)
{ {
// No filename // No filename

View File

@ -29,7 +29,7 @@ public:
inline bool OpenSuccess(void) const { return m_Opened; } inline bool OpenSuccess(void) const { return m_Opened; }
bool GetFile(int index, Byte * Data, size_t DataLen); bool GetFile(int index, Byte * Data, size_t DataLen);
const char * FileName(char * FileName, int SizeOfFileName) const; const char * FileName(char * FileName, size_t SizeOfFileName) const;
std::wstring FileNameIndex(int index); std::wstring FileNameIndex(int index);
void SetNotificationCallback(LP7ZNOTIFICATION NotfyFnc, void * CBInfo); void SetNotificationCallback(LP7ZNOTIFICATION NotfyFnc, void * CBInfo);

View File

@ -30,7 +30,7 @@ void CLogging::LogMessage(const char * Message, ...)
strcat(Msg, "\r\n"); strcat(Msg, "\r\n");
m_hLogFile->Write(Msg, strlen(Msg)); m_hLogFile->Write(Msg, (uint32_t)strlen(Msg));
} }
void CLogging::StartLog(void) void CLogging::StartLog(void)

View File

@ -660,6 +660,8 @@ int32_t CMipsMemoryVM::MemoryFilter(uint32_t dwExptCode, void * lpExceptionPoint
} }
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
#else #else
dwExptCode = dwExptCode; //unreferenced formal parameter
lpExceptionPointer = lpExceptionPointer; // unreferenced formal parameter
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
#endif #endif
} }

View File

@ -382,7 +382,7 @@ void CEnhancmentFile::SaveCurrentSection(void)
} }
else else
{ {
int NeededBufferLen = Section.length(); int NeededBufferLen = (int)Section.length();
int currentLen = 0; int currentLen = 0;
m_File.Seek(m_CurrentSectionFilePos, CFileBase::begin); m_File.Seek(m_CurrentSectionFilePos, CFileBase::begin);
@ -420,7 +420,7 @@ void CEnhancmentFile::SaveCurrentSection(void)
} }
m_File.Seek(StartPos, CFileBase::begin); m_File.Seek(StartPos, CFileBase::begin);
} }
m_File.Write(Section.data(), Section.length()); m_File.Write(Section.data(), (uint32_t)Section.length());
} }
int CEnhancmentFile::GetStringFromFile(char * & String, std::unique_ptr<char> & Data, int & MaxDataSize, int & DataSize, int & ReadPos) int CEnhancmentFile::GetStringFromFile(char * & String, std::unique_ptr<char> & Data, int & MaxDataSize, int & DataSize, int & ReadPos)

View File

@ -34,7 +34,7 @@ bool ISViewerHandler::Write32(uint32_t Address, uint32_t Value, uint32_t Mask)
size_t DataStrLen = strnlen((const char *)&m_Data[0x20], m_Data.size() - 0x20); size_t DataStrLen = strnlen((const char *)&m_Data[0x20], m_Data.size() - 0x20);
if (DataStrLen < MaskedValue) if (DataStrLen < MaskedValue)
{ {
MaskedValue = DataStrLen; MaskedValue = (uint32_t)DataStrLen;
} }
memcpy(&m_Buffer[m_BufferPos], (const char *)&m_Data[0x20], MaskedValue); memcpy(&m_Buffer[m_BufferPos], (const char *)&m_Data[0x20], MaskedValue);
m_BufferPos += MaskedValue; m_BufferPos += MaskedValue;
@ -49,7 +49,7 @@ bool ISViewerHandler::Write32(uint32_t Address, uint32_t Value, uint32_t Mask)
} }
if (m_hLogFile != nullptr && NewLine != m_Buffer) if (m_hLogFile != nullptr && NewLine != m_Buffer)
{ {
m_hLogFile->Write(m_Buffer, (NewLine - m_Buffer) + 1); m_hLogFile->Write(m_Buffer, (uint32_t)((NewLine - m_Buffer) + 1));
m_hLogFile->Flush(); m_hLogFile->Flush();
} }
} }

View File

@ -699,7 +699,7 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
rom_size = tempFile.GetLength(); rom_size = tempFile.GetLength();
rom.reset(new uint8_t[rom_size]); rom.reset(new uint8_t[rom_size]);
tempFile.Read(rom.get(), rom_size); tempFile.Read(rom.get(), (uint32_t)rom_size);
tempFile.Close(); tempFile.Close();
if (rom_size < 0x8000) if (rom_size < 0x8000)
@ -742,7 +742,7 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
return false; return false;
} }
tempFile.Read(ram.get(), ram_size); tempFile.Read(ram.get(), (uint32_t)ram_size);
} }
// If we have RTC we need to load in the data, we assume the save will use the VBA-M format // If we have RTC we need to load in the data, we assume the save will use the VBA-M format
@ -781,7 +781,7 @@ void GBCart::save_gb_cart(struct gb_cart* gb_cart)
{ {
CFile ramFile; CFile ramFile;
ramFile.Open(g_Settings->LoadStringVal(Game_Transferpak_Sav).c_str(), CFileBase::modeWrite | CFileBase::modeCreate); ramFile.Open(g_Settings->LoadStringVal(Game_Transferpak_Sav).c_str(), CFileBase::modeWrite | CFileBase::modeCreate);
ramFile.Write(gb_cart->ram, gb_cart->ram_size); ramFile.Write(gb_cart->ram, (uint32_t)gb_cart->ram_size);
if (gb_cart->has_rtc) if (gb_cart->has_rtc)
{ {

View File

@ -117,7 +117,11 @@ void CMipsMemoryVM::Reset(bool /*EraseMemory*/)
void CMipsMemoryVM::ReserveMemory() void CMipsMemoryVM::ReserveMemory()
{ {
#if defined(__i386__) || defined(_M_IX86)
m_Reserve1 = (uint8_t *)AllocateAddressSpace(0x20000000, (void *)g_Settings->LoadDword(Setting_FixedRdramAddress)); m_Reserve1 = (uint8_t *)AllocateAddressSpace(0x20000000, (void *)g_Settings->LoadDword(Setting_FixedRdramAddress));
#else
m_Reserve1 = (uint8_t *)AllocateAddressSpace(0x20000000);
#endif
m_Reserve2 = (uint8_t *)AllocateAddressSpace(0x04002000); m_Reserve2 = (uint8_t *)AllocateAddressSpace(0x04002000);
} }

View File

@ -1252,7 +1252,7 @@ void CN64System::ExecuteCPU()
{ {
g_Debugger->EmulationStarted(); g_Debugger->EmulationStarted();
} }
#ifdef _WIN32 #if defined(_WIN32) && (defined(__i386__) || defined(_M_IX86))
_controlfp(_PC_53, _MCW_PC); _controlfp(_PC_53, _MCW_PC);
#endif #endif

View File

@ -127,7 +127,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
if (Section == nullptr) if (Section == nullptr)
{ {
Section = new CCodeSection(this, TargetPC, m_Sections.size(), LinkAllowed); Section = new CCodeSection(this, TargetPC, (uint32_t)m_Sections.size(), LinkAllowed);
if (Section == nullptr) if (Section == nullptr)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);

View File

@ -76,7 +76,7 @@ void CRecompMemory::Reset()
void CRecompMemory::ShowMemUsed() void CRecompMemory::ShowMemUsed()
{ {
uint32_t Size = m_RecompPos - m_RecompCode; uint32_t Size = (uint32_t)(m_RecompPos - m_RecompCode);
uint32_t MB = Size / 0x100000; uint32_t MB = Size / 0x100000;
Size -= MB * 0x100000; Size -= MB * 0x100000;
uint32_t KB = Size / 1024; uint32_t KB = Size / 1024;

View File

@ -35,6 +35,9 @@
<PreBuildEvent> <PreBuildEvent>
<Command>"$(SolutionDir)Source\Script\UpdateVersion.cmd" "$(Configuration)" "$(Platform)" "$(SolutionDir)Source\Project64-core\Version.h.in" "$(SolutionDir)Source\Project64-core\Version.h"</Command> <Command>"$(SolutionDir)Source\Script\UpdateVersion.cmd" "$(Configuration)" "$(Platform)" "$(SolutionDir)Source\Project64-core\Version.h.in" "$(SolutionDir)Source\Project64-core\Version.h"</Command>
</PreBuildEvent> </PreBuildEvent>
<Lib>
<AdditionalOptions>/ignore:4221%(AdditionalOptions)</AdditionalOptions>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="3rdParty\7zip.cpp"> <ClCompile Include="3rdParty\7zip.cpp">

View File

@ -128,7 +128,7 @@ void CRomList::AddRomToList(const char * RomLocation)
strncpy(RomInfo.szFullFileName, RomLocation, (sizeof(RomInfo.szFullFileName) / sizeof(RomInfo.szFullFileName[0])) - 1); strncpy(RomInfo.szFullFileName, RomLocation, (sizeof(RomInfo.szFullFileName) / sizeof(RomInfo.szFullFileName[0])) - 1);
if (FillRomInfo(&RomInfo)) if (FillRomInfo(&RomInfo))
{ {
int32_t ListPos = m_RomInfo.size(); int32_t ListPos = (int32_t)m_RomInfo.size();
m_RomInfo.push_back(RomInfo); m_RomInfo.push_back(RomInfo);
RomAddedToList(ListPos); RomAddedToList(ListPos);
} }
@ -303,7 +303,7 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
FillRomExtensionInfo(&RomInfo); FillRomExtensionInfo(&RomInfo);
WriteTrace(TraceUserInterface, TraceDebug, "17"); WriteTrace(TraceUserInterface, TraceDebug, "17");
int32_t ListPos = m_RomInfo.size(); int32_t ListPos = (int32_t)m_RomInfo.size();
m_RomInfo.push_back(RomInfo); m_RomInfo.push_back(RomInfo);
RomAddedToList(ListPos); RomAddedToList(ListPos);
} }
@ -714,7 +714,7 @@ void CRomList::LoadRomList(void)
{ {
ROM_INFO RomInfo; ROM_INFO RomInfo;
file.Read(&RomInfo, RomInfoSize); file.Read(&RomInfo, RomInfoSize);
int32_t ListPos = m_RomInfo.size(); int32_t ListPos = (int32_t)m_RomInfo.size();
m_RomInfo.push_back(RomInfo); m_RomInfo.push_back(RomInfo);
RomAddedToList(ListPos); RomAddedToList(ListPos);
} }
@ -738,7 +738,7 @@ void CRomList::SaveRomList(strlist & FileList)
file.Write(&RomInfoSize, sizeof(RomInfoSize)); file.Write(&RomInfoSize, sizeof(RomInfoSize));
// Write the number of entries // Write the number of entries
int32_t Entries = m_RomInfo.size(); int32_t Entries = (int32_t)m_RomInfo.size();
file.Write(&Entries, sizeof(Entries)); file.Write(&Entries, sizeof(Entries));
// Write every entry // Write every entry
@ -760,7 +760,7 @@ MD5 CRomList::RomListHash(strlist & FileList)
NewFileNames += *iter; NewFileNames += *iter;
NewFileNames += ";"; NewFileNames += ";";
} }
MD5 md5Hash((const unsigned char *)NewFileNames.c_str(), NewFileNames.length()); MD5 md5Hash((const unsigned char *)NewFileNames.c_str(), (unsigned int)NewFileNames.length());
WriteTrace(TraceUserInterface, TraceDebug, "%s - %s", md5Hash.hex_digest(), NewFileNames.c_str()); WriteTrace(TraceUserInterface, TraceDebug, "%s - %s", md5Hash.hex_digest(), NewFileNames.c_str());
return md5Hash; return md5Hash;
} }

View File

@ -839,10 +839,10 @@ bool CSettings::LoadStringVal(SettingID Type, char * Buffer, uint32_t BufferSize
{ {
stdstr Value; stdstr Value;
bRes = FindInfo->second->Load(0, Value); bRes = FindInfo->second->Load(0, Value);
int len = BufferSize; uint32_t len = BufferSize;
if ((Value.length() + 1) < (size_t)len) if ((Value.length() + 1) < (size_t)len)
{ {
len = Value.length() + 1; len = (uint32_t)(Value.length() + 1);
} }
strncpy(Buffer, Value.c_str(), len); strncpy(Buffer, Value.c_str(), len);
} }