Use cmake to determine which string func we need.
On a side note, better to default to linux names when possible.
This commit is contained in:
+3
-2
@@ -87,14 +87,15 @@ include(CheckCXXSymbolExists)
|
|||||||
# Mostly Windows functions.
|
# Mostly Windows functions.
|
||||||
check_function_exists(_mkdir HAVE__MKDIR)
|
check_function_exists(_mkdir HAVE__MKDIR)
|
||||||
check_cxx_symbol_exists(_snprintf cstdio HAVE__SNPRINTF)
|
check_cxx_symbol_exists(_snprintf cstdio HAVE__SNPRINTF)
|
||||||
#check_function_exists(_snprintf HAVE__SNPRINTF)
|
check_cxx_symbol_exists(stricmp cstring HAVE_STRICMP)
|
||||||
|
check_cxx_symbol_exists(_stricmp cstring HAVE__STRICMP)
|
||||||
|
|
||||||
# Mostly non-Windows functions.
|
# Mostly non-Windows functions.
|
||||||
check_function_exists(fcntl HAVE_FCNTL)
|
check_function_exists(fcntl HAVE_FCNTL)
|
||||||
check_function_exists(fork HAVE_FORK)
|
check_function_exists(fork HAVE_FORK)
|
||||||
check_function_exists(mkdir HAVE_MKDIR)
|
check_function_exists(mkdir HAVE_MKDIR)
|
||||||
#check_function_exists(snprintf HAVE_SNPRINTF)
|
|
||||||
check_cxx_symbol_exists(snprintf cstdio HAVE_SNPRINTF)
|
check_cxx_symbol_exists(snprintf cstdio HAVE_SNPRINTF)
|
||||||
|
check_cxx_symbol_exists(strcasecmp cstring HAVE_STRCASECMP)
|
||||||
check_function_exists(waitpid HAVE_WAITPID)
|
check_function_exists(waitpid HAVE_WAITPID)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ void AnnouncerManager::GetAnnouncerNames( vector<RString>& AddTo )
|
|||||||
|
|
||||||
// strip out the empty announcer folder
|
// strip out the empty announcer folder
|
||||||
for( int i=AddTo.size()-1; i>=0; i-- )
|
for( int i=AddTo.size()-1; i>=0; i-- )
|
||||||
if( !stricmp( AddTo[i], EMPTY_ANNOUNCER_NAME ) )
|
if( !strcasecmp( AddTo[i], EMPTY_ANNOUNCER_NAME ) )
|
||||||
AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );
|
AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ bool AnnouncerManager::DoesAnnouncerExist( RString sAnnouncerName )
|
|||||||
vector<RString> asAnnouncerNames;
|
vector<RString> asAnnouncerNames;
|
||||||
GetAnnouncerNames( asAnnouncerNames );
|
GetAnnouncerNames( asAnnouncerNames );
|
||||||
for( unsigned i=0; i<asAnnouncerNames.size(); i++ )
|
for( unsigned i=0; i<asAnnouncerNames.size(); i++ )
|
||||||
if( 0==stricmp(sAnnouncerName, asAnnouncerNames[i]) )
|
if( 0==strcasecmp(sAnnouncerName, asAnnouncerNames[i]) )
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1044,7 +1044,7 @@ MultiPlayer InputMapper::InputDeviceToMultiPlayer( InputDevice id )
|
|||||||
GameButton InputScheme::ButtonNameToIndex( const RString &sButtonName ) const
|
GameButton InputScheme::ButtonNameToIndex( const RString &sButtonName ) const
|
||||||
{
|
{
|
||||||
for( GameButton gb=(GameButton) 0; gb<m_iButtonsPerController; gb=(GameButton)(gb+1) )
|
for( GameButton gb=(GameButton) 0; gb<m_iButtonsPerController; gb=(GameButton)(gb+1) )
|
||||||
if( stricmp(GetGameButtonName(gb), sButtonName) == 0 )
|
if( strcasecmp(GetGameButtonName(gb), sButtonName) == 0 )
|
||||||
return gb;
|
return gb;
|
||||||
|
|
||||||
return GameButton_Invalid;
|
return GameButton_Invalid;
|
||||||
|
|||||||
@@ -927,7 +927,7 @@ unsigned long NetworkSyncManager::GetCurrentSMBuild( LoadingWindow* ld )
|
|||||||
Trim( sFieldName );
|
Trim( sFieldName );
|
||||||
Trim( sFieldValue );
|
Trim( sFieldValue );
|
||||||
|
|
||||||
if( 0 == stricmp(sFieldName,"X-SM-Build") )
|
if( 0 == strcasecmp(sFieldName,"X-SM-Build") )
|
||||||
{
|
{
|
||||||
bSuccess = true;
|
bSuccess = true;
|
||||||
uCurrentSMBuild = strtoul( sFieldValue, NULL, 10 );
|
uCurrentSMBuild = strtoul( sFieldValue, NULL, 10 );
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ bool NoteSkinManager::NoteSkinNameInList(const RString name, vector<RString> nam
|
|||||||
{
|
{
|
||||||
for(size_t i= 0; i < name_list.size(); ++i)
|
for(size_t i= 0; i < name_list.size(); ++i)
|
||||||
{
|
{
|
||||||
if(0 == stricmp(name, name_list[i]))
|
if(0 == strcasecmp(name, name_list[i]))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ static void GameSel( int &sel, bool ToSel, const ConfOption *pConfOption )
|
|||||||
|
|
||||||
sel = 0;
|
sel = 0;
|
||||||
for(unsigned i = 0; i < choices.size(); ++i)
|
for(unsigned i = 0; i < choices.size(); ++i)
|
||||||
if( !stricmp(choices[i], sCurGameName) )
|
if( !strcasecmp(choices[i], sCurGameName) )
|
||||||
sel = i;
|
sel = i;
|
||||||
} else {
|
} else {
|
||||||
vector<const Game*> aGames;
|
vector<const Game*> aGames;
|
||||||
@@ -218,12 +218,12 @@ static void Language( int &sel, bool ToSel, const ConfOption *pConfOption )
|
|||||||
{
|
{
|
||||||
sel = -1;
|
sel = -1;
|
||||||
for( unsigned i=0; sel == -1 && i < vs.size(); ++i )
|
for( unsigned i=0; sel == -1 && i < vs.size(); ++i )
|
||||||
if( !stricmp(vs[i], THEME->GetCurLanguage()) )
|
if( !strcasecmp(vs[i], THEME->GetCurLanguage()) )
|
||||||
sel = i;
|
sel = i;
|
||||||
|
|
||||||
// If the current language doesn't exist, we'll show BASE_LANGUAGE, so select that.
|
// If the current language doesn't exist, we'll show BASE_LANGUAGE, so select that.
|
||||||
for( unsigned i=0; sel == -1 && i < vs.size(); ++i )
|
for( unsigned i=0; sel == -1 && i < vs.size(); ++i )
|
||||||
if( !stricmp(vs[i], SpecialFiles::BASE_LANGUAGE) )
|
if( !strcasecmp(vs[i], SpecialFiles::BASE_LANGUAGE) )
|
||||||
sel = i;
|
sel = i;
|
||||||
|
|
||||||
if( sel == -1 )
|
if( sel == -1 )
|
||||||
@@ -272,7 +272,7 @@ static void RequestedTheme( int &sel, bool ToSel, const ConfOption *pConfOption
|
|||||||
{
|
{
|
||||||
sel = 0;
|
sel = 0;
|
||||||
for( unsigned i=1; i<vsThemeNames.size(); i++ )
|
for( unsigned i=1; i<vsThemeNames.size(); i++ )
|
||||||
if( !stricmp(vsThemeNames[i], PREFSMAN->m_sTheme.Get()) )
|
if( !strcasecmp(vsThemeNames[i], PREFSMAN->m_sTheme.Get()) )
|
||||||
sel = i;
|
sel = i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -298,7 +298,7 @@ static void Announcer( int &sel, bool ToSel, const ConfOption *pConfOption )
|
|||||||
{
|
{
|
||||||
sel = 0;
|
sel = 0;
|
||||||
for( unsigned i=1; i<choices.size(); i++ )
|
for( unsigned i=1; i<choices.size(); i++ )
|
||||||
if( !stricmp(choices[i], ANNOUNCER->GetCurAnnouncerName()) )
|
if( !strcasecmp(choices[i], ANNOUNCER->GetCurAnnouncerName()) )
|
||||||
sel = i;
|
sel = i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -325,7 +325,7 @@ static void DefaultNoteSkin( int &sel, bool ToSel, const ConfOption *pConfOption
|
|||||||
po.FromString( PREFSMAN->m_sDefaultModifiers );
|
po.FromString( PREFSMAN->m_sDefaultModifiers );
|
||||||
sel = 0;
|
sel = 0;
|
||||||
for( unsigned i=0; i < choices.size(); i++ )
|
for( unsigned i=0; i < choices.size(); i++ )
|
||||||
if( !stricmp(choices[i], po.m_sNoteSkin) )
|
if( !strcasecmp(choices[i], po.m_sNoteSkin) )
|
||||||
sel = i;
|
sel = i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|
||||||
#if _MSC_VER == 1400 // VC8 specific warnings
|
#if _MSC_VER == 1400 // VC8 specific warnings
|
||||||
#pragma warning (disable : 4996) // deprecated functions vs "ISO C++ conformant names". (stricmp vs _stricmp)
|
|
||||||
#pragma warning (disable : 4005) // macro redefinitions (ARRAYSIZE)
|
#pragma warning (disable : 4005) // macro redefinitions (ARRAYSIZE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,15 @@
|
|||||||
/* Defined to 1 if the underlying system provides the snprintf function. */
|
/* Defined to 1 if the underlying system provides the snprintf function. */
|
||||||
#cmakedefine HAVE_SNPRINTF 1
|
#cmakedefine HAVE_SNPRINTF 1
|
||||||
|
|
||||||
|
/* Defined to 1 if the underlying system provides the stricmp function. */
|
||||||
|
#cmakedefine HAVE_STRICMP 1
|
||||||
|
|
||||||
|
/* Defined to 1 if the underlying system provides the _stricmp function. */
|
||||||
|
#cmakedefine HAVE__STRICMP 1
|
||||||
|
|
||||||
|
/* Defined to 1 if the underlying system provides the strcasecmp function. */
|
||||||
|
#cmakedefine HAVE_STRCASECMP 1
|
||||||
|
|
||||||
/* Defined to 1 if the underlying system provides the powf function. */
|
/* Defined to 1 if the underlying system provides the powf function. */
|
||||||
#cmakedefine HAVE_POWF 1
|
#cmakedefine HAVE_POWF 1
|
||||||
|
|
||||||
@@ -164,6 +173,16 @@ typedef long ssize_t;
|
|||||||
#error "No size limited sprintf function available. Aborting."
|
#error "No size limited sprintf function available. Aborting."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Ensure we have a function that acts like a case insensitive string comparison. */
|
||||||
|
#if defined(HAVE_STRCASECMP)
|
||||||
|
#elif defined(HAVE__STRICMP)
|
||||||
|
#define strcasecmp _stricmp
|
||||||
|
#elif defined(HAVE_STRICMP)
|
||||||
|
#define strcasecmp stricmp
|
||||||
|
#else
|
||||||
|
#error "No case insensitive string comparison function available. Aborting."
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Ensure we have a function that can create a directory on the file system. */
|
/* Ensure we have a function that can create a directory on the file system. */
|
||||||
#if defined(HAVE__MKDIR)
|
#if defined(HAVE__MKDIR)
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
|||||||
@@ -147,13 +147,6 @@ template<int> struct CompileAssertDecl { };
|
|||||||
/** @brief Use RStrings throughout the program. */
|
/** @brief Use RStrings throughout the program. */
|
||||||
typedef StdString::CStdString RString;
|
typedef StdString::CStdString RString;
|
||||||
|
|
||||||
#if !defined(WIN32)
|
|
||||||
/** @brief Define stricmp to be strcasecmp. */
|
|
||||||
#define stricmp strcasecmp
|
|
||||||
/** @brief Define strnicmp to be strncasecmp. */
|
|
||||||
#define strnicmp strncasecmp
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "RageException.h"
|
#include "RageException.h"
|
||||||
|
|
||||||
/* Define a few functions if necessary */
|
/* Define a few functions if necessary */
|
||||||
|
|||||||
Reference in New Issue
Block a user