return NULL -> return CString() for clarity and efficiency

This commit is contained in:
Chris Danford
2005-09-04 16:55:21 +00:00
parent c414d1bcf8
commit 48ebc53549
55 changed files with 107 additions and 107 deletions
+5 -5
View File
@@ -66,7 +66,7 @@ CString GetRandomFileInDir( CString sDir )
CStringArray asFiles;
GetDirListing( sDir, asFiles, false, true );
if( asFiles.empty() )
return NULL;
return CString();
else
return asFiles[rand()%asFiles.size()];
}
@@ -78,7 +78,7 @@ CString Character::GetModelPath() const
if( DoesFileExist(s) )
return s;
else
return NULL;
return CString();
}
CString Character::GetRestAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Rest/")); }
@@ -92,7 +92,7 @@ CString Character::GetTakingABreakPath() const
GetDirListing( m_sCharDir+"break.gif", as, false, true );
GetDirListing( m_sCharDir+"break.bmp", as, false, true );
if( as.empty() )
return NULL;
return CString();
else
return as[0];
}
@@ -115,7 +115,7 @@ CString Character::GetSongSelectIconPath() const
GetDirListing( m_sCharDir+"icon.gif", as, false, true );
GetDirListing( m_sCharDir+"icon.bmp", as, false, true );
if( as.empty() )
return NULL;
return CString();
else
return as[0];
}
@@ -141,7 +141,7 @@ CString Character::GetStageIconPath() const
GetDirListing( m_sCharDir+"card.gif", as, false, true );
GetDirListing( m_sCharDir+"card.bmp", as, false, true );
if( as.empty() )
return NULL;
return CString();
else
return as[0];
}
+1 -1
View File
@@ -17,7 +17,7 @@ void IncorrectNumberArgsWarning( const Command &command, int iMaxIndexAccessed )
CString Command::GetName() const
{
if( m_vsArgs.empty() )
return NULL;
return CString();
CString s = m_vsArgs[0];
s.MakeLower();
return s;
+1 -1
View File
@@ -278,7 +278,7 @@ CString CourseID::ToString() const
return sPath;
if( !sFullTitle.empty() )
return sFullTitle;
return NULL;
return CString();
}
bool CourseID::IsValid() const
+1 -1
View File
@@ -245,7 +245,7 @@ CString CryptManager::GetMD5( CString fn )
if( !file.Open( fn, RageFile::READ ) )
{
LOG->Warn( "GetMD5: Failed to open file '%s'", fn.c_str() );
return NULL;
return CString();
}
MD5Init(&md5c);
+1 -1
View File
@@ -197,7 +197,7 @@ static const CString MONTH_TO_NAME[MONTHS_IN_YEAR] =
CString MonthToString( int iMonthIndex )
{
if( iMonthIndex < 0 || iMonthIndex >= (int) sizeof(MONTH_TO_NAME) )
return NULL;
return CString();
return MONTH_TO_NAME[iMonthIndex];
}
LuaFunction( MonthToString, MonthToString( IArg(1) ) );
+2 -2
View File
@@ -600,7 +600,7 @@ CString FontPageSettings::MapRange( CString sMapping, int iMapOffset, int iGlyph
iCount--;
}
return NULL;
return CString();
}
const wchar_t *pMapping = FontCharmaps::get_char_map( sMapping );
@@ -631,7 +631,7 @@ CString FontPageSettings::MapRange( CString sMapping, int iMapOffset, int iGlyph
if( iCount )
return "Map overflow"; /* there aren't enough characters in the map */
return NULL;
return CString();
}
static CStringArray LoadStack;
+3 -3
View File
@@ -2763,7 +2763,7 @@ CString GameManager::GetMenuButtonSecondaryFunction( const Game *pGame, GameButt
* it) and/or map to a menu button (if m_DedicatedMenuButton or m_SecondaryMenuButton
* map to it).
*
* If a button is only used in gameplay or is only used in menus, return NULL; the
* If a button is only used in gameplay or is only used in menus, return CString(); the
* primary description is sufficient.
*
* If a button is used in both gameplay and menus, return szSecondaryNames[] for
@@ -2799,12 +2799,12 @@ CString GameManager::GetMenuButtonSecondaryFunction( const Game *pGame, GameButt
FOREACH_MenuButton(m)
{
if( !bUsedInGameplay && pGame->m_DedicatedMenuButton[m] == gb )
return NULL;
return CString();
else if( bUsedInGameplay && pGame->m_SecondaryMenuButton[m] == gb )
return szSecondaryNames[m];
}
return NULL; // only used in gameplay
return CString(); // only used in gameplay
}
+2 -2
View File
@@ -160,8 +160,8 @@ void MsdFile::ReadFromString( const CString &sString )
CString MsdFile::GetParam(unsigned val, unsigned par) const
{
if(val >= GetNumValues()) return NULL;
if(par >= GetNumParams(val)) return NULL;
if(val >= GetNumValues()) return CString();
if(par >= GetNumParams(val)) return CString();
return values[val].params[par];
}
+1 -1
View File
@@ -11,7 +11,7 @@ public:
{
vector<CString> params;
CString operator[](unsigned i) const { if(i >= params.size()) return NULL; return params[i]; }
CString operator[](unsigned i) const { if(i >= params.size()) return CString(); return params[i]; }
};
virtual ~MsdFile() { }
+2 -2
View File
@@ -13,7 +13,7 @@ NetworkSyncManager::~NetworkSyncManager () { }
void NetworkSyncManager::CloseConnection() { }
void NetworkSyncManager::PostStartUp(const CString& ServerIP ) { }
bool NetworkSyncManager::Connect(const CString& addy, unsigned short port) { return false; }
CString NetworkSyncManager::GetServerName() { return NULL; }
CString NetworkSyncManager::GetServerName() { return CString(); }
void NetworkSyncManager::ReportNSSOnOff(int i) { }
void NetworkSyncManager::ReportTiming(float offset, int PlayerNumber) { }
void NetworkSyncManager::ReportScore(int playerID, int step, int score, int combo) { }
@@ -25,7 +25,7 @@ void NetworkSyncManager::Update( float fDeltaTime ) { }
bool NetworkSyncManager::ChangedScoreboard(int Column) { return false; }
void NetworkSyncManager::SendChat(const CString& message) { }
void NetworkSyncManager::SelectUserSong() { }
CString NetworkSyncManager::MD5Hex( const CString &sInput ) { return NULL; }
CString NetworkSyncManager::MD5Hex( const CString &sInput ) { return CString(); }
int NetworkSyncManager::GetSMOnlineSalt() { return 0; }
#else
#include "ezsockets.h"
+1 -1
View File
@@ -273,7 +273,7 @@ CString NoteSkinManager::GetPathFromDirAndFile( const CString &sDir, const CStri
GetDirListing( sDir+sFileName+"*", matches, false, true );
if( matches.empty() )
return NULL;
return CString();
if( matches.size() > 1 )
{
+1 -1
View File
@@ -185,7 +185,7 @@ CString Profile::GetDisplayNameOrHighScoreName() const
else if( !m_sLastUsedHighScoreName.empty() )
return m_sLastUsedHighScoreName;
else
return NULL;
return CString();
}
Character *Profile::GetCharacter() const
+4 -4
View File
@@ -54,20 +54,20 @@ CString RageDisplay::SetVideoMode( VideoModeParams p, bool &bNeedReloadTextures
CString err;
err = this->TryVideoMode(p,bNeedReloadTextures);
if( err == "" )
return NULL;
return CString();
LOG->Trace( "TryVideoMode failed: %s", err.c_str() );
// fall back
p.windowed = false;
if( this->TryVideoMode(p,bNeedReloadTextures) == "" )
return NULL;
return CString();
p.bpp = 16;
if( this->TryVideoMode(p,bNeedReloadTextures) == "" )
return NULL;
return CString();
p.width = 640;
p.height = 480;
if( this->TryVideoMode(p,bNeedReloadTextures) == "" )
return NULL;
return CString();
return ssprintf( "SetVideoMode failed: %s", err.c_str() );
}
+2 -2
View File
@@ -222,7 +222,7 @@ public:
};
bool SaveScreenshot( CString sPath, GraphicsFileFormat format );
virtual CString GetTextureDiagnostics( unsigned id ) const { return NULL; }
virtual CString GetTextureDiagnostics( unsigned id ) const { return CString(); }
virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it.
protected:
@@ -235,7 +235,7 @@ protected:
virtual void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
virtual void DrawCircleInternal( const RageSpriteVertex &v, float radius );
// return NULL if mode change was successful, an error message otherwise.
// return CString() if mode change was successful, an error message otherwise.
// bNewDeviceOut is set true if a new device was created and textures
// need to be reloaded.
virtual CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ) = 0;
+2 -2
View File
@@ -391,7 +391,7 @@ CString SetD3DParams( bool &bNewDeviceOut )
}
}
return NULL;
return CString();
}
/* If the given parameters have failed, try to lower them. */
@@ -604,7 +604,7 @@ CString RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
/* Palettes were lost by Reset(), so mark them unloaded. */
g_TexResourceToPaletteIndex.clear();
return NULL; // mode change successful
return CString(); // mode change successful
}
void RageDisplay_D3D::ResolutionChanged()
+1 -1
View File
@@ -74,7 +74,7 @@ protected:
void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth ) { }
VideoModeParams m_Params;
CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ) { m_Params = params; return NULL; }
CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ) { m_Params = params; return CString(); }
RageSurface* CreateScreenshot();
void SetViewport(int shift_left, int shift_down) { }
RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf );
+4 -4
View File
@@ -334,7 +334,7 @@ CString GetInfoLog( GLhandleARB h )
GLint iLength;
GLExt.glGetObjectParameterivARB( h, GL_OBJECT_INFO_LOG_LENGTH_ARB, &iLength );
if( !iLength )
return NULL;
return CString();
GLcharARB *pInfoLog = new GLcharARB[iLength];
GLExt.glGetInfoLogARB( h, iLength, &iLength, pInfoLog );
@@ -477,7 +477,7 @@ CString RageDisplay_OGL::Init( VideoModeParams p, bool bAllowUnacceleratedRender
InitScalingScript();
return NULL;
return CString();
}
#if defined(UNIX) && defined(HAVE_LIBXTST)
@@ -698,7 +698,7 @@ CString RageDisplay_OGL::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
ResolutionChanged();
return NULL; // successfully set mode
return CString(); // successfully set mode
}
void RageDisplay_OGL::SetViewport(int shift_left, int shift_down)
@@ -1884,7 +1884,7 @@ void RageDisplay_OGL::SetLineWidth( float fWidth )
CString RageDisplay_OGL::GetTextureDiagnostics( unsigned id ) const
{
return NULL;
return CString();
}
void RageDisplay_OGL::SetAlphaTest( bool b )
+2 -2
View File
@@ -33,7 +33,7 @@ RageFileBasic *RageFile::Copy() const
CString RageFile::GetPath() const
{
if ( !IsOpen() )
return NULL;
return CString();
CString sRet = m_File->GetDisplayPath();
if( sRet != "" )
@@ -218,7 +218,7 @@ void FileReading::ReadBytes( RageFileBasic &f, void *buf, int size, CString &sEr
CString FileReading::ReadString( RageFileBasic &f, int size, CString &sError )
{
if( sError.size() != 0 )
return NULL;
return CString();
CString sBuf;
int ret = f.Read( sBuf, size );
+2 -2
View File
@@ -42,7 +42,7 @@ public:
virtual int Flush() = 0;
/* This returns a descriptive path for the file, or "". */
virtual CString GetDisplayPath() const { return NULL; }
virtual CString GetDisplayPath() const { return CString(); }
virtual RageFileBasic *Copy() const = 0;
@@ -88,7 +88,7 @@ public:
bool GetCRC32( uint32_t *iRet );
virtual int GetFileSize() const = 0;
virtual CString GetDisplayPath() const { return NULL; }
virtual CString GetDisplayPath() const { return CString(); }
virtual RageFileBasic *Copy() const { FAIL_M( "Copying unimplemented" ); }
protected:
+2 -2
View File
@@ -335,11 +335,11 @@ CString LoadedDriver::GetPath( const CString &sPath ) const
if( sPath.size() >= 2 && sPath[1] == '@' )
{
if( m_sMountPoint.size() < 2 || m_sMountPoint[1] != '@' )
return NULL;
return CString();
}
if( sPath.Left(m_sMountPoint.size()).CompareNoCase(m_sMountPoint) )
return NULL; /* no match */
return CString(); /* no match */
/* Add one, so we don't cut off the leading slash. */
CString sRet = sPath.Right( sPath.size() - m_sMountPoint.size() + 1 );
+3 -3
View File
@@ -270,8 +270,8 @@ CString DeviceButtonToString( InputDevice device, DeviceButton i )
case DEVICE_PUMP2: return PumpPadButtonToString( (PumpPadButton)i );
case DEVICE_MIDI: return MidiButtonToString( i );
case DEVICE_PARA1: return ParaPadButtonToString( (ParaPadButton)i );
case DEVICE_NONE: return NULL;
default: ASSERT(0); return NULL;
case DEVICE_NONE: return CString();
default: ASSERT(0); return CString();
}
}
@@ -337,7 +337,7 @@ int GetNumDeviceButtons( InputDevice device )
CString DeviceInput::toString() const
{
if( device == DEVICE_NONE )
return NULL;
return CString();
CString s = InputDeviceToString(device) + "_" + DeviceButtonToString(device,button);
return s;
+1 -1
View File
@@ -357,7 +357,7 @@ public:
CString ReadString( RageFile &f, int iSize, CString &sError )
{
if( sError.size() != 0 )
return NULL;
return CString();
CString sBuf;
char *pBuf = sBuf.GetBuffer( iSize );
+8 -8
View File
@@ -277,7 +277,7 @@ CString werr_ssprintf( int err, const char *fmt, ...)
CString ConvertWstringToACP( wstring s )
{
if( s.empty() )
return NULL;
return CString();
int iBytes = WideCharToMultiByte( CP_ACP, 0, s.data(), s.size(),
NULL, 0, NULL, FALSE );
@@ -301,7 +301,7 @@ CString ConvertUTF8ToACP( CString s )
CString join( const CString &Deliminator, const CStringArray& Source)
{
if( Source.empty() )
return NULL;
return CString();
CString csTmp;
@@ -317,7 +317,7 @@ CString join( const CString &Deliminator, const CStringArray& Source)
CString join( const CString &Delimitor, CStringArray::const_iterator begin, CStringArray::const_iterator end )
{
if( begin == end )
return NULL;
return CString();
CString ret;
while( begin != end )
@@ -512,11 +512,11 @@ CString GetExtension( const CString &sPath )
{
size_t pos = sPath.rfind( '.' );
if( pos == sPath.npos )
return NULL;
return CString();
size_t slash = sPath.find( '/', pos );
if( slash != sPath.npos )
return NULL; /* rare: path/dir.ext/fn */
return CString(); /* rare: path/dir.ext/fn */
return sPath.substr( pos+1, sPath.size()-pos+1 );
}
@@ -695,7 +695,7 @@ CString DerefRedir(const CString &_path)
/* Empty is invalid. */
if( sNewFileName == "" )
return NULL;
return CString();
FixSlashesInPlace( sNewFileName );
@@ -1253,7 +1253,7 @@ CString Basename( const CString &dir )
{
size_t end = dir.find_last_not_of( "/\\" );
if( end == dir.npos )
return NULL;
return CString();
size_t start = dir.find_last_of( "/\\", end );
if( start == dir.npos )
@@ -1295,7 +1295,7 @@ CString Dirname( const CString &dir )
CString Capitalize( const CString &s )
{
if( s.GetLength()==0 )
return NULL;
return CString();
CString s2 = s;
/* XXX: utf-8 */
if( !(s2[0] & 0x80) )
+2 -2
View File
@@ -69,11 +69,11 @@ BackgroundLoader::~BackgroundLoader()
CString BackgroundLoader::GetRequest()
{
if( !g_bEnableBackgroundLoading )
return NULL;
return CString();
LockMut( m_Mutex );
if( !m_CacheRequests.size() )
return NULL;
return CString();
CString ret;
ret = m_CacheRequests.front();
+1 -1
View File
@@ -540,7 +540,7 @@ static CString GetOneBakedRandomFile( Song *pSong, bool bTryGenre = true )
if( !vsNamesOut.empty() )
return vsNamesOut[rand()%vsNamesOut.size()];
else
return NULL;
return CString();
}
static MenuDef g_InsertTapAttack(
+4 -4
View File
@@ -43,7 +43,7 @@ CString GetStatsLineTitle( PlayerNumber pn, EndingStatsLine line )
CourseDifficulty cd = (CourseDifficulty)(DIFFICULTY_EASY+line-PERCENT_COMPLETE_EASY);
ASSERT( cd >= 0 && cd < NUM_COURSE_DIFFICULTIES );
if( !GAMESTATE->IsCourseDifficultyShown(cd) )
return NULL;
return CString();
return CourseDifficultyToThemedString(cd);
}
else
@@ -53,7 +53,7 @@ CString GetStatsLineTitle( PlayerNumber pn, EndingStatsLine line )
return DifficultyToThemedString(dc);
}
}
default: ASSERT(0); return NULL;
default: ASSERT(0); return CString();
}
}
@@ -107,7 +107,7 @@ CString GetStatsLineValue( PlayerNumber pn, EndingStatsLine line )
CourseDifficulty cd = (CourseDifficulty)(DIFFICULTY_EASY+line-PERCENT_COMPLETE_EASY);
ASSERT( cd >= 0 && cd < NUM_COURSE_DIFFICULTIES );
if( !GAMESTATE->IsCourseDifficultyShown(cd) )
return NULL;
return CString();
CString sDifficulty = CourseDifficultyToThemedString(cd);
fPercent = pProfile->GetCoursesPercentComplete(st,cd);
}
@@ -120,7 +120,7 @@ CString GetStatsLineValue( PlayerNumber pn, EndingStatsLine line )
}
return ssprintf( "%05.2f%%", fPercent*100 );
}
default: ASSERT(0); return NULL;
default: ASSERT(0); return CString();
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ CString ASMHClass::NumberToString( ScreenMessage SM )
if ( SM == iter->second )
return (*iter).first;
return NULL;
return CString();
}
/*
+1 -1
View File
@@ -386,7 +386,7 @@ CString ScreenOptions::GetExplanationText( int iRow ) const
bool bAllowExplanation = row.GetRowDef().m_bAllowExplanation;
bool bShowExplanations = bAllowExplanation && SHOW_EXPLANATIONS.GetValue();
if( !bShowExplanations )
return NULL;
return CString();
CString sLineName = row.GetRowDef().m_sName;
ASSERT( !sLineName.empty() );
+1 -1
View File
@@ -409,7 +409,7 @@ CString ScreenPackages::URLEncode( const CString &URL )
CString ScreenPackages::StripOutContainers( const CString & In )
{
if( In.size() == 0 )
return NULL;
return CString();
unsigned i = 0;
char t = In.at(i);
+2 -2
View File
@@ -228,7 +228,7 @@ CString ScreenProfileOptions::GetSelectedProfileID()
const OptionRow &row = *m_pRows[GetCurrentRow()];
const int Selection = row.GetOneSharedSelection();
if( !Selection )
return NULL;
return CString();
return vsProfiles[ Selection-1 ];
}
@@ -237,7 +237,7 @@ CString ScreenProfileOptions::GetSelectedProfileName()
const OptionRow &row = *m_pRows[GetCurrentRow()];
const int Selection = row.GetOneSharedSelection();
if( !Selection )
return NULL;
return CString();
return g_ProfileOptionsLines[PO_PLAYER1].m_vsChoices[ Selection ];
}
+1 -1
View File
@@ -169,7 +169,7 @@ CString ScreenSMOnlineLogin::GetSelectedProfileID()
const OptionRow &row = *m_pRows[GetCurrentRow()];
const int Selection = row.GetOneSharedSelection();
if( !Selection )
return NULL;
return CString();
return vsProfiles[ Selection-1 ];
}
+2 -2
View File
@@ -132,7 +132,7 @@ void ScreenSystemLayer::ReloadCreditsText()
CString ScreenSystemLayer::GetCreditsMessage( PlayerNumber pn ) const
{
if( (bool)CREDITS_JOIN_ONLY && !GAMESTATE->PlayersCanJoin() )
return NULL;
return CString();
bool bShowCreditsMessage;
if( SCREENMAN && SCREENMAN->GetTopScreen() && SCREENMAN->GetTopScreen()->GetScreenType() == system_menu )
@@ -160,7 +160,7 @@ CString ScreenSystemLayer::GetCreditsMessage( PlayerNumber pn ) const
else if( GAMESTATE->PlayersCanJoin() )
return CREDITS_INSERT_CARD.GetValue();
else
return NULL;
return CString();
case MEMORY_CARD_STATE_ERROR: return THEME->GetMetric( m_sName, "CreditsCard" + MEMCARDMAN->GetCardError(pn) );
case MEMORY_CARD_STATE_TOO_LATE: return CREDITS_CARD_TOO_LATE.GetValue();
+2 -2
View File
@@ -1240,7 +1240,7 @@ vector<BackgroundChange> &Song::GetForegroundChanges()
CString GetSongAssetPath( CString sPath, const CString &sSongPath )
{
if( sPath == "" )
return NULL;
return CString();
/* If there's no path in the file, the file is in the same directory
* as the song. (This is the preferred configuration.) */
@@ -1259,7 +1259,7 @@ CString GetSongAssetPath( CString sPath, const CString &sSongPath )
/* If the path still begins with "../", then there were an unreasonable number
* of them at the beginning of the path. Ignore the path entirely. */
if( sPath.Left(3) == "../" )
return NULL;
return CString();
return sPath;
}
+6 -6
View File
@@ -315,7 +315,7 @@ CString SongManager::GetSongGroupBannerPath( CString sSongGroup )
return m_sSongGroupBannerPaths[i];
}
return NULL;
return CString();
}
void SongManager::GetSongGroupNames( CStringArray &AddTo )
@@ -384,7 +384,7 @@ CString SongManager::GetCourseGroupBannerPath( const CString &sCourseGroup )
if( iter == m_mapCourseGroupToInfo.end() )
{
ASSERT_M( 0, ssprintf("requested banner for course group '%s' that doesn't exist",sCourseGroup.c_str()) );
return NULL;
return CString();
}
else
{
@@ -1451,7 +1451,7 @@ CString GetCurrentSongDisplayTitle()
{
const Song* pSong = GAMESTATE->m_pCurSong;
if( pSong == NULL )
return NULL;
return CString();
return pSong->GetDisplayFullTitle();
}
@@ -1459,7 +1459,7 @@ CString GetCurrentSongDisplayArtist()
{
const Song* pSong = GAMESTATE->m_pCurSong;
if( pSong == NULL )
return NULL;
return CString();
return pSong->GetDisplayArtist();
}
@@ -1467,7 +1467,7 @@ CString GetCurrentSongCredit()
{
const Song* pSong = GAMESTATE->m_pCurSong;
if( pSong == NULL )
return NULL;
return CString();
return pSong->m_sCredit;
}
@@ -1475,7 +1475,7 @@ CString GetCurrentStepsCredits()
{
const Song* pSong = GAMESTATE->m_pCurSong;
if( pSong == NULL )
return NULL;
return CString();
CString s;
+6 -6
View File
@@ -212,12 +212,12 @@ void SongUtil::SortSongPointerArrayByNumPlays( vector<Song*> &vpSongsInOut, cons
CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so )
{
if( pSong == NULL )
return NULL;
return CString();
switch( so )
{
case SORT_PREFERRED:
return NULL;
return CString();
case SORT_GROUP:
// guaranteed not empty
return pSong->m_sGroupName;
@@ -234,7 +234,7 @@ CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
s = MakeSortString(s); // resulting string will be uppercase
if( s.empty() )
return NULL;
return CString();
else if( s[0] >= '0' && s[0] <= '9' )
return "NUM";
else if( s[0] < 'A' || s[0] > 'Z')
@@ -256,7 +256,7 @@ CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
return ssprintf("%03d-%03d",iMaxBPM-(iBPMGroupSize-1), iMaxBPM);
}
case SORT_POPULARITY:
return NULL;
return CString();
case SORT_TOP_GRADES:
{
int iCounts[NUM_Grade];
@@ -299,14 +299,14 @@ CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
return "N/A";
}
case SORT_MODE_MENU:
return NULL;
return CString();
case SORT_ALL_COURSES:
case SORT_NONSTOP_COURSES:
case SORT_ONI_COURSES:
case SORT_ENDLESS_COURSES:
default:
ASSERT(0);
return NULL;
return CString();
}
}
+1 -1
View File
@@ -733,7 +733,7 @@ void Sprite::SetSecondsIntoAnimation( float fSeconds )
CString Sprite::GetTexturePath() const
{
if( m_pTexture==NULL )
return NULL;
return CString();
return m_pTexture->GetID().filename;
}
+1 -1
View File
@@ -1236,7 +1236,7 @@ CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature,
if( !bResult )
{
SCREENMAN->PlayInvalidSound();
return NULL;
return CString();
}
SCREENMAN->PlayScreenshotSound();
+2 -2
View File
@@ -55,11 +55,11 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../Program/StepMania-debug.exe"
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../../itg/Program/StepMania-debug.exe"
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# Begin Special Build Tool
IntDir=.\../Debug6
TargetDir=\cvs\stepmania\Program
TargetDir=\cvs\itg\Program
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
+1 -1
View File
@@ -18,7 +18,7 @@ void ChangeCurrentGame( const Game* g );
void FocusChanged( bool bHasFocus );
bool AppHasFocus();
// If successful, return filename of screenshot in sDir, else return NULL
// If successful, return filename of screenshot in sDir, else return CString()
CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, int iIndex = -1 );
void InsertCoin( int iNum = 1, const RageTimer *pTime = NULL );
+1 -1
View File
@@ -11,7 +11,7 @@ public:
virtual Dialog::Result AbortRetryIgnore( CString sMessage, CString sID ) { return Dialog::ignore; }
virtual Dialog::Result AbortRetry( CString sMessage, CString sID ) { return Dialog::abort; }
virtual CString Init() { return ""; }
virtual CString Init() { return CString(); }
virtual ~DialogDriver() { }
};
@@ -7,7 +7,7 @@ struct RageSurface;
class LoadingWindow
{
public:
virtual CString Init() { return ""; }
virtual CString Init() { return CString(); }
virtual ~LoadingWindow() { }
virtual void Paint() = 0;
@@ -14,7 +14,7 @@ public:
virtual void *GetProcAddress(CString s) = 0;
// Return "" if mode change was successful, otherwise an error message.
// return NULL if mode change was successful, otherwise an error message.
// bNewDeviceOut is set true if a new device was created and textures
// need to be reloaded.
virtual CString TryVideoMode( RageDisplay::VideoModeParams p, bool &bNewDeviceOut ) = 0;
@@ -208,7 +208,7 @@ CString LowLevelWindow_Win32::TryVideoMode( RageDisplay::VideoModeParams p, bool
return hr_ssprintf( GetLastError(), "wglCreateContext" );
}
}
return ""; // we set the video mode successfully
return CString(); // we set the video mode successfully
}
void LowLevelWindow_Win32::SwapBuffers()
@@ -8,7 +8,7 @@ class RageMovieTexture : public RageTexture
public:
RageMovieTexture( RageTextureID ID ): RageTexture(ID) { }
virtual ~RageMovieTexture() { }
virtual CString Init() { return ""; }
virtual CString Init() { return CString(); }
virtual void Update(float fDeltaTime) { }
virtual void Reload() = 0;
@@ -157,7 +157,7 @@ CString MovieTexture_DShow::Init()
// flip all frame rects because movies are upside down
for( unsigned i=0; i<m_TextureCoordRects.size(); i++ )
swap(m_TextureCoordRects[i].top, m_TextureCoordRects[i].bottom);
return "";
return CString();
}
/* Hold buffer_lock. If it's held, then the decoding thread is waiting
@@ -411,7 +411,7 @@ CString MovieTexture_DShow::Create()
// Start the graph running
Play();
return "";
return CString();
}
@@ -453,7 +453,7 @@ CString MovieTexture_FFMpeg::Init()
StartThread();
return "";
return CString();
}
MovieTexture_FFMpeg::~MovieTexture_FFMpeg()
@@ -599,7 +599,7 @@ CString MovieTexture_FFMpeg::CreateDecoder()
* on an exception unless it was really opened. */
decoder->m_stream = stream;
return "";
return CString();
}
+2 -2
View File
@@ -138,7 +138,7 @@ CString DSound::Init()
SetPrimaryBufferMode();
return "";
return CString();
}
DSound::~DSound()
@@ -292,7 +292,7 @@ CString DSoundBuf::Init( DSound &ds, DSoundBuf::hw hardware,
m_pTempBuffer = new char[m_iBufferSize];
return "";
return CString();
}
void DSoundBuf::SetSampleRate( int hz )
+1 -1
View File
@@ -8,7 +8,7 @@ public:
friend class RageSoundManager;
/* Initialize. On failure, an error message is returned. */
virtual CString Init() { return ""; }
virtual CString Init() { return CString(); }
/* A RageSound calls this to request to be played.
* XXX: define what we should do when it can't be played (eg. out of
@@ -251,7 +251,7 @@ CString RageSound_DSound::Init()
MixingThread.SetName("Mixer thread");
MixingThread.Create( MixerThread_start, this );
return "";
return CString();
}
RageSound_DSound::~RageSound_DSound()
@@ -103,7 +103,7 @@ CString RageSound_DSound_Software::Init()
MixingThread.SetName("Mixer thread");
MixingThread.Create( MixerThread_start, this );
return "";
return CString();
}
RageSound_DSound_Software::~RageSound_DSound_Software()
@@ -140,7 +140,7 @@ CString RageSound_WaveOut::Init()
MixingThread.SetName( "Mixer thread" );
MixingThread.Create( MixerThread_start, this );
return "";
return CString();
}
RageSound_WaveOut::~RageSound_WaveOut()
@@ -78,7 +78,7 @@ CString FindSystemFile( CString fn )
if( !stat( sPath, &buf ) )
return sPath;
return "";
return CString();
}
/* Get the full path of the process running in iProcessID. On error, false is
@@ -140,7 +140,7 @@ CString GraphicsWindow::SetScreenMode( const RageDisplay::VideoModeParams &p )
if( !g_CurrentParams.windowed )
ChangeDisplaySettings( NULL, 0 );
return "";
return CString();
}
DEVMODE DevMode;
@@ -169,7 +169,7 @@ CString GraphicsWindow::SetScreenMode( const RageDisplay::VideoModeParams &p )
if( ret != DISP_CHANGE_SUCCESSFUL )
return "Couldn't set screen mode";
return "";
return CString();
}
static int GetWindowStyle( const RageDisplay::VideoModeParams &p )
+1 -1
View File
@@ -29,7 +29,7 @@ static CString GetUSBDevicePath (int num)
NULL, &guid, num, &DeviceInterface))
{
SetupDiDestroyDeviceInfoList (DeviceInfo);
return "";
return CString();
}
unsigned long size;
@@ -14,14 +14,14 @@ CString GetPrimaryVideoName()
hInstUser32 = LoadLibrary("User32.DLL");
if( !hInstUser32 )
return "";
return CString();
// VC6 don't have a stub to static link with, so link dynamically.
EnumDisplayDevices = (pfnEnumDisplayDevices)GetProcAddress(hInstUser32,"EnumDisplayDevicesA");
if( EnumDisplayDevices == NULL )
{
FreeLibrary(hInstUser32);
return "";
return CString();
}
CString sPrimaryDeviceName;