Merge pull request #848 from wolfman2000/wolf-windows-stricmp-removal

Use cmake to determine which string func we need.
This commit is contained in:
Jason Felds
2015-10-07 19:11:21 -04:00
9 changed files with 33 additions and 21 deletions
+3 -2
View File
@@ -87,14 +87,15 @@ include(CheckCXXSymbolExists)
# Mostly Windows functions.
check_function_exists(_mkdir HAVE__MKDIR)
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.
check_function_exists(fcntl HAVE_FCNTL)
check_function_exists(fork HAVE_FORK)
check_function_exists(mkdir HAVE_MKDIR)
#check_function_exists(snprintf HAVE_SNPRINTF)
check_cxx_symbol_exists(snprintf cstdio HAVE_SNPRINTF)
check_cxx_symbol_exists(strcasecmp cstring HAVE_STRCASECMP)
check_function_exists(waitpid HAVE_WAITPID)
+2 -2
View File
@@ -38,7 +38,7 @@ void AnnouncerManager::GetAnnouncerNames( vector<RString>& AddTo )
// strip out the empty announcer folder
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 );
}
@@ -50,7 +50,7 @@ bool AnnouncerManager::DoesAnnouncerExist( RString sAnnouncerName )
vector<RString> asAnnouncerNames;
GetAnnouncerNames( asAnnouncerNames );
for( unsigned i=0; i<asAnnouncerNames.size(); i++ )
if( 0==stricmp(sAnnouncerName, asAnnouncerNames[i]) )
if( 0==strcasecmp(sAnnouncerName, asAnnouncerNames[i]) )
return true;
return false;
}
+1 -1
View File
@@ -1044,7 +1044,7 @@ MultiPlayer InputMapper::InputDeviceToMultiPlayer( InputDevice id )
GameButton InputScheme::ButtonNameToIndex( const RString &sButtonName ) const
{
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 GameButton_Invalid;
+1 -1
View File
@@ -927,7 +927,7 @@ unsigned long NetworkSyncManager::GetCurrentSMBuild( LoadingWindow* ld )
Trim( sFieldName );
Trim( sFieldValue );
if( 0 == stricmp(sFieldName,"X-SM-Build") )
if( 0 == strcasecmp(sFieldName,"X-SM-Build") )
{
bSuccess = true;
uCurrentSMBuild = strtoul( sFieldValue, NULL, 10 );
+1 -1
View File
@@ -204,7 +204,7 @@ bool NoteSkinManager::NoteSkinNameInList(const RString name, vector<RString> nam
{
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;
}
+6 -6
View File
@@ -183,7 +183,7 @@ static void GameSel( int &sel, bool ToSel, const ConfOption *pConfOption )
sel = 0;
for(unsigned i = 0; i < choices.size(); ++i)
if( !stricmp(choices[i], sCurGameName) )
if( !strcasecmp(choices[i], sCurGameName) )
sel = i;
} else {
vector<const Game*> aGames;
@@ -218,12 +218,12 @@ static void Language( int &sel, bool ToSel, const ConfOption *pConfOption )
{
sel = -1;
for( unsigned i=0; sel == -1 && i < vs.size(); ++i )
if( !stricmp(vs[i], THEME->GetCurLanguage()) )
if( !strcasecmp(vs[i], THEME->GetCurLanguage()) )
sel = i;
// 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 )
if( !stricmp(vs[i], SpecialFiles::BASE_LANGUAGE) )
if( !strcasecmp(vs[i], SpecialFiles::BASE_LANGUAGE) )
sel = i;
if( sel == -1 )
@@ -272,7 +272,7 @@ static void RequestedTheme( int &sel, bool ToSel, const ConfOption *pConfOption
{
sel = 0;
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;
}
else
@@ -298,7 +298,7 @@ static void Announcer( int &sel, bool ToSel, const ConfOption *pConfOption )
{
sel = 0;
for( unsigned i=1; i<choices.size(); i++ )
if( !stricmp(choices[i], ANNOUNCER->GetCurAnnouncerName()) )
if( !strcasecmp(choices[i], ANNOUNCER->GetCurAnnouncerName()) )
sel = i;
}
else
@@ -325,7 +325,7 @@ static void DefaultNoteSkin( int &sel, bool ToSel, const ConfOption *pConfOption
po.FromString( PREFSMAN->m_sDefaultModifiers );
sel = 0;
for( unsigned i=0; i < choices.size(); i++ )
if( !stricmp(choices[i], po.m_sNoteSkin) )
if( !strcasecmp(choices[i], po.m_sNoteSkin) )
sel = i;
}
else
-1
View File
@@ -20,7 +20,6 @@
#if defined(_MSC_VER)
#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)
#endif
+19
View File
@@ -48,6 +48,15 @@
/* Defined to 1 if the underlying system provides the snprintf function. */
#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. */
#cmakedefine HAVE_POWF 1
@@ -164,6 +173,16 @@ typedef long ssize_t;
#error "No size limited sprintf function available. Aborting."
#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. */
#if defined(HAVE__MKDIR)
#include <direct.h>
-7
View File
@@ -147,13 +147,6 @@ template<int> struct CompileAssertDecl { };
/** @brief Use RStrings throughout the program. */
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"
/* Define a few functions if necessary */