mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Cross compatibility function union (strcasecmp, unlink)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@293 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -22,6 +22,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
// Function Cross-Compatibility
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define strcasecmp _stricmp
|
||||||
|
#define unlink _unlink
|
||||||
|
#else
|
||||||
|
#define _stricmp strcasecmp
|
||||||
|
#define _unlink unlink
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define POSIX 0
|
#define POSIX 0
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
@ -52,15 +52,9 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios)
|
|||||||
{
|
{
|
||||||
std::string Extension;
|
std::string Extension;
|
||||||
SplitPath(m_strFilename, NULL, NULL, &Extension);
|
SplitPath(m_strFilename, NULL, NULL, &Extension);
|
||||||
#ifdef _WIN32
|
if (!strcasecmp(Extension.c_str(), ".gcm") ||
|
||||||
if (!_stricmp(Extension.c_str(), ".gcm") ||
|
|
||||||
!_stricmp(Extension.c_str(), ".iso") ||
|
|
||||||
!_stricmp(Extension.c_str(), ".gcz") )
|
|
||||||
#else
|
|
||||||
if (!strcasecmp(Extension.c_str(), ".gcm") || //TODO(Sonic): Shouldn't these work on all platforms?
|
|
||||||
!strcasecmp(Extension.c_str(), ".iso") ||
|
!strcasecmp(Extension.c_str(), ".iso") ||
|
||||||
!strcasecmp(Extension.c_str(), ".gcz") )
|
!strcasecmp(Extension.c_str(), ".gcz") )
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
m_BootType = BOOT_ISO;
|
m_BootType = BOOT_ISO;
|
||||||
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename.c_str());
|
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename.c_str());
|
||||||
@ -97,32 +91,20 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios)
|
|||||||
|
|
||||||
delete pVolume;
|
delete pVolume;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
|
||||||
else if (!_stricmp(Extension.c_str(), ".elf"))
|
|
||||||
#else
|
|
||||||
else if (!strcasecmp(Extension.c_str(), ".elf"))
|
else if (!strcasecmp(Extension.c_str(), ".elf"))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
bWii = CBoot::IsElfWii(m_strFilename.c_str());
|
bWii = CBoot::IsElfWii(m_strFilename.c_str());
|
||||||
BaseDataPath = s_DataBasePath_USA;
|
BaseDataPath = s_DataBasePath_USA;
|
||||||
m_BootType = BOOT_ELF;
|
m_BootType = BOOT_ELF;
|
||||||
bNTSC = true;
|
bNTSC = true;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
|
||||||
else if (!_stricmp(Extension.c_str(), ".bin"))
|
|
||||||
#else
|
|
||||||
else if (!strcasecmp(Extension.c_str(), ".bin"))
|
else if (!strcasecmp(Extension.c_str(), ".bin"))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
BaseDataPath = s_DataBasePath_USA;
|
BaseDataPath = s_DataBasePath_USA;
|
||||||
m_BootType = BOOT_BIN;
|
m_BootType = BOOT_BIN;
|
||||||
bNTSC = true;
|
bNTSC = true;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
|
||||||
else if (!_stricmp(Extension.c_str(), ".dol"))
|
|
||||||
#else
|
|
||||||
else if (!strcasecmp(Extension.c_str(), ".dol"))
|
else if (!strcasecmp(Extension.c_str(), ".dol"))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
BaseDataPath = s_DataBasePath_USA;
|
BaseDataPath = s_DataBasePath_USA;
|
||||||
m_BootType = BOOT_DOL;
|
m_BootType = BOOT_DOL;
|
||||||
|
@ -111,11 +111,7 @@ XSymbolIndex FindSymbol(const char *name)
|
|||||||
for (int i = 0; i < (int)g_Symbols.size(); i++)
|
for (int i = 0; i < (int)g_Symbols.size(); i++)
|
||||||
{
|
{
|
||||||
const Symbol& rSymbol = g_Symbols[i];
|
const Symbol& rSymbol = g_Symbols[i];
|
||||||
#ifdef _WIN32
|
|
||||||
if (!_stricmp(rSymbol.GetName().c_str(), name))
|
|
||||||
#else
|
|
||||||
if (!strcasecmp(rSymbol.GetName().c_str(), name))
|
if (!strcasecmp(rSymbol.GetName().c_str(), name))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
return (XSymbolIndex)i;
|
return (XSymbolIndex)i;
|
||||||
}
|
}
|
||||||
|
@ -51,11 +51,8 @@ CDebugger_Log::CDebugger_Log(const char* _szShortName, const char* _szName) :
|
|||||||
strcpy((char*)m_szName, _szName);
|
strcpy((char*)m_szName, _szName);
|
||||||
strcpy((char*)m_szShortName, _szShortName);
|
strcpy((char*)m_szShortName, _szShortName);
|
||||||
sprintf((char*)m_szFilename, "Logs/%s.txt", _szName);
|
sprintf((char*)m_szFilename, "Logs/%s.txt", _szName);
|
||||||
#ifdef _WIN32
|
|
||||||
_unlink(m_szFilename);
|
|
||||||
#else
|
|
||||||
unlink(m_szFilename);
|
unlink(m_szFilename);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CDebugger_Log::~CDebugger_Log(void)
|
CDebugger_Log::~CDebugger_Log(void)
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include "Common.h"
|
||||||
|
|
||||||
#include "FileHandlerARC.h"
|
#include "FileHandlerARC.h"
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
@ -225,11 +226,7 @@ CARCFile::FindFileInfo(std::string _rFullPath) const
|
|||||||
{
|
{
|
||||||
for (size_t i = 0; i < m_FileInfoVector.size(); i++)
|
for (size_t i = 0; i < m_FileInfoVector.size(); i++)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
if (!strcasecmp(m_FileInfoVector[i].m_FullPath.c_str(), _rFullPath.c_str()))
|
||||||
if (!_stricmp(m_FileInfoVector[i].m_FullPath.c_str(), _rFullPath.c_str()))
|
|
||||||
#else
|
|
||||||
if (!strcasecmp(m_FileInfoVector[i].m_FullPath.c_str(), _rFullPath.c_str())) //TODO(Sonic): Shouldn't this work in all platforms?
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
return(&m_FileInfoVector[i]);
|
return(&m_FileInfoVector[i]);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include "Common.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -164,11 +165,7 @@ CFileSystemGCWii::FindFileInfo(const char* _rFullPath) const
|
|||||||
{
|
{
|
||||||
for (size_t i = 0; i < m_FileInfoVector.size(); i++)
|
for (size_t i = 0; i < m_FileInfoVector.size(); i++)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
if (!strcasecmp(m_FileInfoVector[i].m_FullPath, _rFullPath))
|
||||||
if (!_stricmp(m_FileInfoVector[i].m_FullPath, _rFullPath))
|
|
||||||
#else
|
|
||||||
if (!strcasecmp(m_FileInfoVector[i].m_FullPath, _rFullPath)) //TODO(Sonic): Shouldn't this work in all platforms?
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
return(&m_FileInfoVector[i]);
|
return(&m_FileInfoVector[i]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user