mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Second attempt at issue 3458. Fixes issue 3458.
Replaces all occurrences of ftell and fseek with ftello and fseeko, respectively. This matters on non-win32 where only these names are altered by the _FILE_OFFSET_BITS define. Win32 still just maps the funcs to ftelli64/fseeki64. Also add some File::GetSize I had skipped in my last commit. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6515 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -86,7 +86,7 @@ bool CDolLoader::IsDolWii(const char* filename)
|
||||
FILE* pStream = fopen(filename, "rb");
|
||||
if (pStream)
|
||||
{
|
||||
fseek(pStream, 0xe0, SEEK_SET);
|
||||
fseeko(pStream, 0xe0, SEEK_SET);
|
||||
u32 entrypt = fgetc(pStream) << 24 | fgetc(pStream) << 16 |
|
||||
fgetc(pStream) << 8 | fgetc(pStream);
|
||||
|
||||
|
@ -228,9 +228,7 @@ void CEXIIPL::LoadFileToIPL(std::string filename, u32 offset)
|
||||
FILE* pStream = fopen(filename.c_str(), "rb");
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fseek(pStream, 0, SEEK_END);
|
||||
size_t filesize = (size_t)ftell(pStream);
|
||||
rewind(pStream);
|
||||
u64 filesize = File::GetSize(pStream);
|
||||
|
||||
fread(m_pIPL + offset, 1, filesize, pStream);
|
||||
fclose(pStream);
|
||||
|
@ -77,11 +77,7 @@ CEXIMemoryCard::CEXIMemoryCard(const std::string& _rName, const std::string& _rF
|
||||
if (pFile)
|
||||
{
|
||||
// Measure size of the memcard file.
|
||||
fseek(pFile, 0L, SEEK_END);
|
||||
u64 MemFileSize = ftell(pFile);
|
||||
fseek(pFile, 0L, SEEK_SET);
|
||||
|
||||
memory_card_size = (int)MemFileSize;
|
||||
memory_card_size = (int)File::GetSize(pFile);
|
||||
nintendo_card_id = memory_card_size / SIZE_TO_Mb;
|
||||
memory_card_content = new u8[memory_card_size];
|
||||
memset(memory_card_content, 0xFF, memory_card_size);
|
||||
|
@ -163,9 +163,9 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
|
||||
|
||||
if (Mode >= 0 && Mode <= 2)
|
||||
{
|
||||
if (fseek(m_pFileHandle, NewSeekPosition, seek_mode[Mode]) == 0)
|
||||
if (fseeko(m_pFileHandle, NewSeekPosition, seek_mode[Mode]) == 0)
|
||||
{
|
||||
ReturnValue = (u32)ftell(m_pFileHandle);
|
||||
ReturnValue = (u32)ftello(m_pFileHandle);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -243,7 +243,7 @@ bool CWII_IPC_HLE_Device_FileIO::IOCtl(u32 _CommandAddress)
|
||||
case ISFS_IOCTL_GETFILESTATS:
|
||||
{
|
||||
m_FileLength = (u32)File::GetSize(m_Filename.c_str());
|
||||
u32 Position = (u32)ftell(m_pFileHandle);
|
||||
u32 Position = (u32)ftello(m_pFileHandle);
|
||||
|
||||
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
|
||||
INFO_LOG(WII_IPC_FILEIO, "FileIO: ISFS_IOCTL_GETFILESTATS");
|
||||
@ -278,7 +278,7 @@ void CWII_IPC_HLE_Device_FileIO::DoState(PointerWrap &p)
|
||||
{
|
||||
if (p.GetMode() == PointerWrap::MODE_WRITE)
|
||||
{
|
||||
m_Seek = (m_pFileHandle) ? (s32)ftell(m_pFileHandle) : 0;
|
||||
m_Seek = (m_pFileHandle) ? (s32)ftello(m_pFileHandle) : 0;
|
||||
}
|
||||
|
||||
p.Do(m_Mode);
|
||||
@ -290,7 +290,7 @@ void CWII_IPC_HLE_Device_FileIO::DoState(PointerWrap &p)
|
||||
{
|
||||
Open(0, m_Mode);
|
||||
if (m_pFileHandle)
|
||||
fseek(m_pFileHandle, m_Seek, SEEK_SET);
|
||||
fseeko(m_pFileHandle, m_Seek, SEEK_SET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -344,8 +344,8 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
|
||||
{
|
||||
u32 size = req.bsize * req.blocks;
|
||||
|
||||
if (fseek(m_Card, req.arg, SEEK_SET) != 0)
|
||||
ERROR_LOG(WII_IPC_SD, "fseek failed WTF");
|
||||
if (fseeko(m_Card, req.arg, SEEK_SET) != 0)
|
||||
ERROR_LOG(WII_IPC_SD, "fseeko failed WTF");
|
||||
|
||||
u8* buffer = new u8[size];
|
||||
|
||||
@ -383,8 +383,8 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
|
||||
{
|
||||
u32 size = req.bsize * req.blocks;
|
||||
|
||||
if (fseek(m_Card, req.arg, SEEK_SET) != 0)
|
||||
ERROR_LOG(WII_IPC_SD, "fseek failed WTF");
|
||||
if (fseeko(m_Card, req.arg, SEEK_SET) != 0)
|
||||
ERROR_LOG(WII_IPC_SD, "fseeko failed WTF");
|
||||
|
||||
u8* buffer = new u8[size];
|
||||
|
||||
|
@ -358,7 +358,7 @@ void LoadInput(const char *filename)
|
||||
File::Copy(filename, g_recordFile.c_str());
|
||||
|
||||
g_recordfd = fopen(g_recordFile.c_str(), "r+b");
|
||||
fseek(g_recordfd, 0, SEEK_END);
|
||||
fseeko(g_recordfd, 0, SEEK_END);
|
||||
|
||||
g_rerecords++;
|
||||
|
||||
@ -469,6 +469,6 @@ void SaveRecording(const char *filename)
|
||||
Core::DisplayMessage(StringFromFormat("Failed to save %s", filename).c_str(), 2000);
|
||||
|
||||
g_recordfd = fopen(g_recordFile.c_str(), "r+b");
|
||||
fseek(g_recordfd, 0, SEEK_END);
|
||||
fseeko(g_recordfd, 0, SEEK_END);
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user