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;
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;
}
@ -174,13 +174,13 @@ SRes C7zip::SzFileSeekImp(void *p, Int64 *pos, ESzSeek origin)
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)
{
return nullptr;
}
int Len = strlen(m_FileName);
size_t Len = strlen(m_FileName);
if (Len > (SizeOfFileName - 1))
{
Len = (SizeOfFileName - 1);
@ -198,7 +198,7 @@ std::wstring C7zip::FileNameIndex(int index)
// No filename
return filename;
}
int namelen = SzArEx_GetFileNameUtf16(m_db, index, nullptr);
size_t namelen = SzArEx_GetFileNameUtf16(m_db, index, nullptr);
if (namelen <= 0)
{
// No filename

View File

@ -29,7 +29,7 @@ public:
inline bool OpenSuccess(void) const { return m_Opened; }
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);
void SetNotificationCallback(LP7ZNOTIFICATION NotfyFnc, void * CBInfo);

View File

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

View File

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

View File

@ -382,7 +382,7 @@ void CEnhancmentFile::SaveCurrentSection(void)
}
else
{
int NeededBufferLen = Section.length();
int NeededBufferLen = (int)Section.length();
int currentLen = 0;
m_File.Seek(m_CurrentSectionFilePos, CFileBase::begin);
@ -420,7 +420,7 @@ void CEnhancmentFile::SaveCurrentSection(void)
}
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)

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);
if (DataStrLen < MaskedValue)
{
MaskedValue = DataStrLen;
MaskedValue = (uint32_t)DataStrLen;
}
memcpy(&m_Buffer[m_BufferPos], (const char *)&m_Data[0x20], 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)
{
m_hLogFile->Write(m_Buffer, (NewLine - m_Buffer) + 1);
m_hLogFile->Write(m_Buffer, (uint32_t)((NewLine - m_Buffer) + 1));
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.reset(new uint8_t[rom_size]);
tempFile.Read(rom.get(), rom_size);
tempFile.Read(rom.get(), (uint32_t)rom_size);
tempFile.Close();
if (rom_size < 0x8000)
@ -742,7 +742,7 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
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
@ -781,7 +781,7 @@ void GBCart::save_gb_cart(struct gb_cart* gb_cart)
{
CFile ramFile;
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)
{

View File

@ -117,7 +117,11 @@ void CMipsMemoryVM::Reset(bool /*EraseMemory*/)
void CMipsMemoryVM::ReserveMemory()
{
#if defined(__i386__) || defined(_M_IX86)
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);
}

View File

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

View File

@ -127,7 +127,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
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)
{
g_Notify->BreakPoint(__FILE__, __LINE__);

View File

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

View File

@ -35,6 +35,9 @@
<PreBuildEvent>
<Command>"$(SolutionDir)Source\Script\UpdateVersion.cmd" "$(Configuration)" "$(Platform)" "$(SolutionDir)Source\Project64-core\Version.h.in" "$(SolutionDir)Source\Project64-core\Version.h"</Command>
</PreBuildEvent>
<Lib>
<AdditionalOptions>/ignore:4221%(AdditionalOptions)</AdditionalOptions>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<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);
if (FillRomInfo(&RomInfo))
{
int32_t ListPos = m_RomInfo.size();
int32_t ListPos = (int32_t)m_RomInfo.size();
m_RomInfo.push_back(RomInfo);
RomAddedToList(ListPos);
}
@ -303,7 +303,7 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
FillRomExtensionInfo(&RomInfo);
WriteTrace(TraceUserInterface, TraceDebug, "17");
int32_t ListPos = m_RomInfo.size();
int32_t ListPos = (int32_t)m_RomInfo.size();
m_RomInfo.push_back(RomInfo);
RomAddedToList(ListPos);
}
@ -714,7 +714,7 @@ void CRomList::LoadRomList(void)
{
ROM_INFO RomInfo;
file.Read(&RomInfo, RomInfoSize);
int32_t ListPos = m_RomInfo.size();
int32_t ListPos = (int32_t)m_RomInfo.size();
m_RomInfo.push_back(RomInfo);
RomAddedToList(ListPos);
}
@ -738,7 +738,7 @@ void CRomList::SaveRomList(strlist & FileList)
file.Write(&RomInfoSize, sizeof(RomInfoSize));
// Write the number of entries
int32_t Entries = m_RomInfo.size();
int32_t Entries = (int32_t)m_RomInfo.size();
file.Write(&Entries, sizeof(Entries));
// Write every entry
@ -760,7 +760,7 @@ MD5 CRomList::RomListHash(strlist & FileList)
NewFileNames += *iter;
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());
return md5Hash;
}

View File

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