Merge pull request #852 from Prcuvu/linux_fix_warnings

Fix GCC warnings on Linux.
This commit is contained in:
Jason Felds
2015-10-08 18:54:16 -04:00
6 changed files with 22 additions and 14 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ void RageBitmapTexture::Create()
{ {
RString warning = ssprintf("RageBitmapTexture: Couldn't load %s: %s", RString warning = ssprintf("RageBitmapTexture: Couldn't load %s: %s",
actualID.filename.c_str(), error.c_str()); actualID.filename.c_str(), error.c_str());
LOG->Warn(warning); LOG->Warn("%s", warning.c_str());
Dialog::OK(warning, "missing_texture"); Dialog::OK(warning, "missing_texture");
pImg = RageSurfaceUtils::MakeDummySurface( 64, 64 ); pImg = RageSurfaceUtils::MakeDummySurface( 64, 64 );
ASSERT( pImg != NULL ); ASSERT( pImg != NULL );
+7 -3
View File
@@ -280,16 +280,20 @@ static void ChangeToDirOfExecutable( const RString &argv0 )
/* Set the CWD. Any effects of this is platform-specific; most files are read and /* Set the CWD. Any effects of this is platform-specific; most files are read and
* written through RageFile. See also RageFileManager::RageFileManager. */ * written through RageFile. See also RageFileManager::RageFileManager. */
#if defined(_WINDOWS) #if defined(_WINDOWS)
chdir( RageFileManagerUtil::sDirOfExecutable + "/.." ); if( _chdir( RageFileManagerUtil::sDirOfExecutable + "/.." ) )
#elif defined(UNIX) #elif defined(UNIX)
chdir( RageFileManagerUtil::sDirOfExecutable + "/" ); if( chdir( RageFileManagerUtil::sDirOfExecutable + "/" ) )
#elif defined(MACOSX) #elif defined(MACOSX)
/* If the basename is not MacOS, then we've likely been launched via the command line /* If the basename is not MacOS, then we've likely been launched via the command line
* through a symlink. Assume this is the case and change to the dir of the symlink. */ * through a symlink. Assume this is the case and change to the dir of the symlink. */
if( Basename(RageFileManagerUtil::sDirOfExecutable) == "MacOS" ) if( Basename(RageFileManagerUtil::sDirOfExecutable) == "MacOS" )
CollapsePath( RageFileManagerUtil::sDirOfExecutable += "/../../../" ); CollapsePath( RageFileManagerUtil::sDirOfExecutable += "/../../../" );
chdir( RageFileManagerUtil::sDirOfExecutable ); if( chdir( RageFileManagerUtil::sDirOfExecutable ) )
#endif #endif
{
LOG->Warn("Can't set current working directory to %s", RageFileManagerUtil::sDirOfExecutable.c_str());
return;
}
} }
RageFileManager::RageFileManager( const RString &argv0 ) RageFileManager::RageFileManager( const RString &argv0 )
+5 -5
View File
@@ -180,17 +180,17 @@ int64_t pos_map_queue::Search( int64_t iSourceFrame, bool *bApproximate ) const
* 3. Underflow; we'll be given a larger frame number than we know about. * 3. Underflow; we'll be given a larger frame number than we know about.
*/ */
#if defined(WIN32) #if defined(WIN32)
#define LI "%I64i" #define I64F "%I64i"
#elif defined(PRIi64) #elif defined(__x86_64__)
#define LI "%" PRIi64 #define I64F "%li"
#else #else
#define LI "%lli" #define I64F "%lli"
#endif #endif
static RageTimer last; static RageTimer last;
if( last.PeekDeltaTime() >= 1.0f ) if( last.PeekDeltaTime() >= 1.0f )
{ {
last.GetDeltaTime(); last.GetDeltaTime();
LOG->Trace( "Approximate sound time: driver frame " LI ", m_pImpl->m_Queue frame " LI ".." LI " (dist " LI "), closest position is " LI, LOG->Trace( "Approximate sound time: driver frame " I64F ", m_pImpl->m_Queue frame " I64F ".." I64F " (dist " I64F "), closest position is " I64F,
iSourceFrame, pClosestBlock->m_iDestFrame, pClosestBlock->m_iDestFrame+pClosestBlock->m_iFrames, iSourceFrame, pClosestBlock->m_iDestFrame, pClosestBlock->m_iDestFrame+pClosestBlock->m_iFrames,
iClosestPositionDist, iClosestPosition ); iClosestPositionDist, iClosestPosition );
} }
+2 -2
View File
@@ -265,13 +265,13 @@ void ScreenEvaluation::Init()
m_SmallBanner[i].LoadFromSong( pSong ); m_SmallBanner[i].LoadFromSong( pSong );
m_SmallBanner[i].ScaleToClipped( BANNER_WIDTH, BANNER_HEIGHT ); m_SmallBanner[i].ScaleToClipped( BANNER_WIDTH, BANNER_HEIGHT );
m_SmallBanner[i].SetName( ssprintf("SmallBanner%d",i+1) ); m_SmallBanner[i].SetName( ssprintf("SmallBanner%zu",i+1) );
ActorUtil::LoadAllCommands( m_SmallBanner[i], m_sName ); ActorUtil::LoadAllCommands( m_SmallBanner[i], m_sName );
SET_XY( m_SmallBanner[i] ); SET_XY( m_SmallBanner[i] );
this->AddChild( &m_SmallBanner[i] ); this->AddChild( &m_SmallBanner[i] );
m_sprSmallBannerFrame[i].Load( THEME->GetPathG(m_sName,"BannerFrame") ); m_sprSmallBannerFrame[i].Load( THEME->GetPathG(m_sName,"BannerFrame") );
m_sprSmallBannerFrame[i]->SetName( ssprintf("SmallBanner%d",i+1) ); m_sprSmallBannerFrame[i]->SetName( ssprintf("SmallBanner%zu",i+1) );
ActorUtil::LoadAllCommands( *m_sprSmallBannerFrame[i], m_sName ); ActorUtil::LoadAllCommands( *m_sprSmallBannerFrame[i], m_sName );
SET_XY( m_sprSmallBannerFrame[i] ); SET_XY( m_sprSmallBannerFrame[i] );
this->AddChild( m_sprSmallBannerFrame[i] ); this->AddChild( m_sprSmallBannerFrame[i] );
+1 -1
View File
@@ -143,7 +143,7 @@ void TimingData::DumpOneTable(const beat_start_lookup_t& lookup, const RString&
SegInfoStr(stops, starts.stop, "stop").c_str(), SegInfoStr(stops, starts.stop, "stop").c_str(),
SegInfoStr(delays, starts.delay, "delay").c_str(), SegInfoStr(delays, starts.delay, "delay").c_str(),
starts.last_row, starts.last_time, starts.warp_destination, starts.is_warping); starts.last_row, starts.last_time, starts.warp_destination, starts.is_warping);
LOG->Trace(str.c_str()); LOG->Trace("%s", str.c_str());
} }
} }
+6 -2
View File
@@ -24,7 +24,7 @@ LightsDriver_Linux_PIUIO::LightsDriver_Linux_PIUIO()
fd = open("/dev/piuio0", O_WRONLY); fd = open("/dev/piuio0", O_WRONLY);
if( fd < 0 ) if( fd < 0 )
{ {
LOG->Warn( "Error opening serial port for lights. Error:: %d %s", errno, strerror(errno) ); LOG->Warn( "Error opening serial port for lights. Error: %d %s", errno, strerror(errno) );
return; return;
} }
LOG->Info("Opened PIUIO device for lights"); LOG->Info("Opened PIUIO device for lights");
@@ -75,7 +75,11 @@ void LightsDriver_Linux_PIUIO::Set( const LightsState *ls )
return; return;
memcpy(oldbuf, buf, 8); memcpy(oldbuf, buf, 8);
write(fd, buf, 8); if (write(fd, buf, 8) != 8)
{
LOG->Warn( "Error setting lights state. Error: %d %s", errno, strerror(errno) );
return;
}
} }
/* /*