Merge pull request #1054 from wolfman2000/wolf-windows-pedantic-touchups
Fix minor windows pedantic warnings.
This commit is contained in:
@@ -52,7 +52,7 @@ void AutoKeysounds::LoadAutoplaySoundsInto( RageSoundReader_Chain *pChain )
|
||||
for( int t = 0; t < iNumTracks; t++ )
|
||||
{
|
||||
int iRow = -1;
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
/* Find the next row that either player has a note on. */
|
||||
int iNextRow = INT_MAX;
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public:
|
||||
// ... meanwhile DWORD WINAPI ZipReceiverThread(void *dat)
|
||||
// { HANDLE hread = (HANDLE)dat;
|
||||
// char buf[1000];
|
||||
// while (true)
|
||||
// for(;;)
|
||||
// { DWORD red; ReadFile(hread,buf,1000,&red,NULL);
|
||||
// // ... and do something with this zip data we're receiving
|
||||
// if (red==0) break;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ bool CsvFile::ReadFile( RageFileBasic &f )
|
||||
|
||||
// hi,"hi2,","""hi3"""
|
||||
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
RString line;
|
||||
switch( f.GetLine(line) )
|
||||
|
||||
@@ -166,7 +166,7 @@ void StepsDisplayList::UpdatePositions()
|
||||
|
||||
/* If less than total (and Rows.size()) are displayed, fill in the empty
|
||||
* space intelligently. */
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
const int sum = (first_end - first_start) + (second_end - second_start);
|
||||
if( sum >= (int) Rows.size() || sum >= total)
|
||||
|
||||
@@ -238,7 +238,7 @@ void FileTransfer::HTTPUpdate()
|
||||
// Keep this as a code block, as there may be need to "if" it out some time.
|
||||
/* If you need a conditional for a large block of code, stick it in
|
||||
* a function and return. */
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
char Buffer[1024];
|
||||
int iSize = m_wSocket.ReadData( Buffer, 1024 );
|
||||
@@ -359,13 +359,15 @@ bool FileTransfer::ParseHTTPAddress( const RString &URL, RString &sProto, RStrin
|
||||
|
||||
void FileTransfer::Finish()
|
||||
{
|
||||
while( true )
|
||||
for(;;)
|
||||
{
|
||||
float fSleepSeconds = 0.1f;
|
||||
this->Update( fSleepSeconds );
|
||||
usleep( int( fSleepSeconds * 1000000.0 ) );
|
||||
if( this->IsFinished() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -2369,15 +2369,18 @@ bool GameState::ChangePreferredDifficulty( PlayerNumber pn, int dir )
|
||||
const vector<Difficulty> &v = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue();
|
||||
|
||||
Difficulty d = GetClosestShownDifficulty(pn);
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
d = enum_add2( d, dir );
|
||||
if( d < 0 || d >= NUM_Difficulty )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if( find(v.begin(), v.end(), d) != v.end() )
|
||||
{
|
||||
break; // found
|
||||
}
|
||||
}
|
||||
|
||||
m_PreferredDifficulty[pn].Set( d );
|
||||
return true;
|
||||
}
|
||||
@@ -2424,17 +2427,22 @@ bool GameState::ChangePreferredCourseDifficulty( PlayerNumber pn, int dir )
|
||||
const vector<CourseDifficulty> &v = CommonMetrics::COURSE_DIFFICULTIES_TO_SHOW.GetValue();
|
||||
|
||||
CourseDifficulty cd = m_PreferredCourseDifficulty[pn];
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
cd = enum_add2( cd, dir );
|
||||
if( cd < 0 || cd >= NUM_Difficulty )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if( find(v.begin(),v.end(),cd) == v.end() )
|
||||
{
|
||||
continue; /* not available */
|
||||
}
|
||||
if( !pCourse || pCourse->GetTrail( GetCurrentStyle(pn)->m_StepsType, cd ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ChangePreferredCourseDifficulty( pn, cd );
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -36,11 +36,11 @@ bool IniFile::ReadFile( RageFileBasic &f )
|
||||
RString keyname;
|
||||
// keychild is used to cache the node that values are being added to. -Kyz
|
||||
XNode* keychild= NULL;
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
RString line;
|
||||
// Read lines until we reach a line that doesn't end in a backslash
|
||||
while( true )
|
||||
for(;;)
|
||||
{
|
||||
RString s;
|
||||
switch( f.GetLine(s) )
|
||||
@@ -57,8 +57,9 @@ bool IniFile::ReadFile( RageFileBasic &f )
|
||||
line += s;
|
||||
|
||||
if( line.empty() || line[line.size()-1] != '\\' )
|
||||
{
|
||||
break;
|
||||
|
||||
}
|
||||
line.erase( line.end()-1 );
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ bool InputQueueCode::Load( RString sButtonsNames )
|
||||
|
||||
bool bHold = false;
|
||||
bool bNotHold = false;
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
if( sButtonName.Left(1) == "+" )
|
||||
{
|
||||
|
||||
+3
-2
@@ -26,11 +26,12 @@ namespace
|
||||
/* Look at the first class. If it has a base class that needs to be registered,
|
||||
* go there first. */
|
||||
LuaBinding *pBinding = mapToRegister.begin()->second;
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
if( !pBinding->IsDerivedClass() )
|
||||
{
|
||||
break;
|
||||
|
||||
}
|
||||
RString sBase = pBinding->GetBaseClassName();
|
||||
map<RString, LuaBinding *>::const_iterator it = mapToRegister.find(sBase);
|
||||
if( it != mapToRegister.end() )
|
||||
|
||||
@@ -32,12 +32,14 @@ bool LyricsLoader::LoadFromLRCFile(const RString& sPath, Song& out)
|
||||
|
||||
out.m_LyricSegments.clear();
|
||||
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
RString line;
|
||||
int ret = input.GetLine( line );
|
||||
if( ret == 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
if( ret == -1 )
|
||||
{
|
||||
LuaHelpers::ReportScriptErrorFmt("Error reading %s: %s", input.GetPath().c_str(), input.GetError().c_str() );
|
||||
@@ -47,15 +49,18 @@ bool LyricsLoader::LoadFromLRCFile(const RString& sPath, Song& out)
|
||||
utf8_remove_bom( line );
|
||||
|
||||
if(!line.compare(0, 2, "//"))
|
||||
{
|
||||
continue;
|
||||
|
||||
}
|
||||
// (most tags are in the format of...)
|
||||
// "[data1] data2". Ignore whitespace at the beginning of the line.
|
||||
static Regex x("^ *\\[([^]]+)\\] *(.*)$");
|
||||
|
||||
vector<RString> matches;
|
||||
if(!x.Compare(line, matches))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ASSERT( matches.size() == 2 );
|
||||
|
||||
RString &sValueName = matches[0];
|
||||
|
||||
@@ -70,19 +70,22 @@ static void LoadFromSMNoteDataStringWithPlayer( NoteData& out, const RString &sS
|
||||
* would do as I would expect. */
|
||||
split( sSMNoteData, ",", start, size, end, true ); // Ignore empty is important.
|
||||
if( start == end )
|
||||
{
|
||||
break;
|
||||
|
||||
}
|
||||
// Partial string split.
|
||||
int measureLineStart = start, measureLineSize = -1;
|
||||
const int measureEnd = start + size;
|
||||
|
||||
aMeasureLines.clear();
|
||||
while( true )
|
||||
for(;;)
|
||||
{
|
||||
// Ignore empty is clearly important here.
|
||||
split( sSMNoteData, "\n", measureLineStart, measureLineSize, measureEnd, true );
|
||||
if( measureLineStart == measureEnd )
|
||||
{
|
||||
break;
|
||||
}
|
||||
//RString &line = sSMNoteData.substr( measureLineStart, measureLineSize );
|
||||
const char *beginLine = sSMNoteData.data() + measureLineStart;
|
||||
const char *endLine = beginLine + measureLineSize;
|
||||
@@ -706,11 +709,13 @@ void LightTransformHelper( const NoteData &in, NoteData &out, const vector<int>
|
||||
* until we've extended to the end of the latest overlapping hold note. */
|
||||
int iHoldStart = r;
|
||||
int iHoldEnd = -1;
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
int iMaxTailRow = FindLongestOverlappingHoldNoteForAnyTrack( in, r );
|
||||
if( iMaxTailRow == -1 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
iHoldEnd = iMaxTailRow;
|
||||
r = iMaxTailRow;
|
||||
}
|
||||
|
||||
+9
-2
@@ -924,7 +924,7 @@ void NoteField::DrawPrimitives()
|
||||
FOREACH_BackgroundLayer( j )
|
||||
iter[j] = GAMESTATE->m_pCurSong->GetBackgroundChanges(j).begin();
|
||||
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
float fLowestBeat = FLT_MAX;
|
||||
vector<BackgroundLayer> viLowestIndex;
|
||||
@@ -932,8 +932,9 @@ void NoteField::DrawPrimitives()
|
||||
FOREACH_BackgroundLayer( j )
|
||||
{
|
||||
if( iter[j] == GAMESTATE->m_pCurSong->GetBackgroundChanges(j).end() )
|
||||
{
|
||||
continue;
|
||||
|
||||
}
|
||||
float fBeat = iter[j]->m_fStartBeat;
|
||||
if( fBeat < fLowestBeat )
|
||||
{
|
||||
@@ -950,7 +951,9 @@ void NoteField::DrawPrimitives()
|
||||
if( viLowestIndex.empty() )
|
||||
{
|
||||
FOREACH_BackgroundLayer( j )
|
||||
{
|
||||
ASSERT( iter[j] == GAMESTATE->m_pCurSong->GetBackgroundChanges(j).end() );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -963,13 +966,17 @@ void NoteField::DrawPrimitives()
|
||||
const BackgroundChange& change = *iter[*bl];
|
||||
RString s = change.GetTextDescription();
|
||||
if( *bl!=0 )
|
||||
{
|
||||
s = ssprintf("%d: ",*bl) + s;
|
||||
}
|
||||
vsBGChanges.push_back( s );
|
||||
}
|
||||
DrawBGChangeText(fLowestBeat, join("\n",vsBGChanges), text_glow);
|
||||
}
|
||||
FOREACH_CONST( BackgroundLayer, viLowestIndex, bl )
|
||||
{
|
||||
iter[*bl]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -116,7 +116,7 @@ bool NoteSkinManager::LoadNoteSkinDataRecursive( const RString &sNoteSkinName_,
|
||||
int iDepth = 0;
|
||||
bool bLoadedCommon = false;
|
||||
bool bLoadedBase = false;
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
++iDepth;
|
||||
if(iDepth >= 20)
|
||||
|
||||
@@ -327,12 +327,13 @@ int RageFileObj::GetLine( RString &sOut )
|
||||
sOut = "";
|
||||
|
||||
if( m_bEOF )
|
||||
{
|
||||
return 0;
|
||||
|
||||
}
|
||||
EnableReadBuffering();
|
||||
|
||||
bool bGotData = false;
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
bool bDone = false;
|
||||
|
||||
@@ -361,12 +362,15 @@ int RageFileObj::GetLine( RString &sOut )
|
||||
{
|
||||
char *RealEnd = p;
|
||||
if( bDone && p > m_pReadBuf && p[-1] == '\r' )
|
||||
{
|
||||
--RealEnd; /* not including \r */
|
||||
}
|
||||
sOut.append( m_pReadBuf, RealEnd );
|
||||
|
||||
if( bDone )
|
||||
{
|
||||
++p; /* skip \n */
|
||||
|
||||
}
|
||||
const int iUsed = p-m_pReadBuf;
|
||||
if( iUsed )
|
||||
{
|
||||
|
||||
@@ -224,12 +224,13 @@ RageFileObjDeflate::~RageFileObjDeflate()
|
||||
int RageFileObjDeflate::WriteInternal( const void *pBuffer, size_t iBytes )
|
||||
{
|
||||
if( iBytes == 0 )
|
||||
{
|
||||
return 0;
|
||||
|
||||
}
|
||||
m_pDeflate->next_in = (Bytef*) pBuffer;
|
||||
m_pDeflate->avail_in = iBytes;
|
||||
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
char buf[1024*4];
|
||||
m_pDeflate->next_out = (Bytef *) buf;
|
||||
@@ -238,8 +239,9 @@ int RageFileObjDeflate::WriteInternal( const void *pBuffer, size_t iBytes )
|
||||
int err = deflate( m_pDeflate, Z_NO_FLUSH );
|
||||
|
||||
if( err != Z_OK )
|
||||
{
|
||||
FAIL_M( ssprintf("deflate: err %i", err) );
|
||||
|
||||
}
|
||||
if( m_pDeflate->avail_out < sizeof(buf) )
|
||||
{
|
||||
int lBytes = sizeof(buf)-m_pDeflate->avail_out;
|
||||
@@ -257,9 +259,10 @@ int RageFileObjDeflate::WriteInternal( const void *pBuffer, size_t iBytes )
|
||||
}
|
||||
|
||||
if( m_pDeflate->avail_in == 0 && m_pDeflate->avail_out != 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return iBytes;
|
||||
}
|
||||
|
||||
@@ -270,7 +273,7 @@ int RageFileObjDeflate::FlushInternal()
|
||||
{
|
||||
m_pDeflate->avail_in = 0;
|
||||
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
char buf[1024*4];
|
||||
m_pDeflate->next_out = (Bytef *) buf;
|
||||
@@ -278,8 +281,9 @@ int RageFileObjDeflate::FlushInternal()
|
||||
|
||||
int err = deflate( m_pDeflate, Z_FINISH );
|
||||
if( err != Z_OK && err != Z_STREAM_END )
|
||||
{
|
||||
FAIL_M( ssprintf("deflate: err %i", err) );
|
||||
|
||||
}
|
||||
if( m_pDeflate->avail_out < sizeof(buf) )
|
||||
{
|
||||
int iBytes = sizeof(buf)-m_pDeflate->avail_out;
|
||||
@@ -297,7 +301,9 @@ int RageFileObjDeflate::FlushInternal()
|
||||
}
|
||||
|
||||
if( err == Z_STREAM_END && m_pDeflate->avail_out != 0 )
|
||||
{
|
||||
return m_pFile->Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,13 +117,16 @@ static bool GrabDriver( RageFileDriver *pDriver )
|
||||
{
|
||||
g_Mutex->Lock();
|
||||
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
unsigned i;
|
||||
for( i = 0; i < g_pDrivers.size(); ++i )
|
||||
{
|
||||
if( g_pDrivers[i]->m_pDriver == pDriver )
|
||||
{
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
if( i == g_pDrivers.size() )
|
||||
{
|
||||
g_Mutex->Unlock();
|
||||
|
||||
@@ -389,7 +389,7 @@ int RageSoundReader_MP3::do_mad_frame_decode( bool headers_only )
|
||||
{
|
||||
int bytes_read = 0;
|
||||
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -861,7 +861,7 @@ int RageSoundReader_MP3::SetPosition_hard( int iFrame )
|
||||
}
|
||||
|
||||
/* Decode frames until the current frame contains the desired offset. */
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
/* If desired < next_frame_timer, this frame contains the position. Since we've
|
||||
* already decoded the frame, synth it, too. */
|
||||
@@ -1035,13 +1035,17 @@ int RageSoundReader_MP3::GetLengthInternal( bool fast )
|
||||
}
|
||||
|
||||
MADLIB_rewind();
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
int ret = do_mad_frame_decode( true );
|
||||
if( ret == -1 )
|
||||
{
|
||||
return -1; /* it set the error */
|
||||
}
|
||||
if( ret == 0 ) /* EOF */
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* mad->Timer is the timestamp of the current frame; find the timestamp of
|
||||
|
||||
@@ -69,20 +69,24 @@ bool RageSoundReader_Preload::Open( RageSoundReader *pSource )
|
||||
m_Buffer.Get()->reserve( iBytes );
|
||||
}
|
||||
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
/* If the rate changes, we won't preload it. */
|
||||
if( pSource->GetStreamToSourceRatio() != m_fRate )
|
||||
{
|
||||
return false; /* Don't bother trying to preload it. */
|
||||
|
||||
}
|
||||
float buffer[1024];
|
||||
int iCnt = pSource->Read( buffer, ARRAYLEN(buffer) / m_iChannels );
|
||||
|
||||
if( iCnt == END_OF_FILE )
|
||||
{
|
||||
break;
|
||||
}
|
||||
if( iCnt < 0 )
|
||||
{
|
||||
return false;
|
||||
|
||||
}
|
||||
/* Add the buffer. */
|
||||
if( m_bBufferIs16Bit )
|
||||
{
|
||||
@@ -96,7 +100,9 @@ bool RageSoundReader_Preload::Open( RageSoundReader *pSource )
|
||||
}
|
||||
|
||||
if( m_Buffer.Get()->size() > iMaxSamples * samplesize )
|
||||
{
|
||||
return false; /* too big */
|
||||
}
|
||||
}
|
||||
|
||||
m_iPosition = 0;
|
||||
|
||||
@@ -110,12 +110,13 @@ namespace
|
||||
|
||||
int GCD( int i1, int i2 )
|
||||
{
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
unsigned iRem = i2 % i1;
|
||||
if( iRem == 0 )
|
||||
{
|
||||
return i1;
|
||||
|
||||
}
|
||||
i2 = i1;
|
||||
i1 = iRem;
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ int RageSoundReader_SpeedChange::GetCursorAvail() const
|
||||
|
||||
int RageSoundReader_SpeedChange::Read( float *pBuf, int iFrames )
|
||||
{
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
if( m_iDataBufferAvailFrames == 0 && m_fTrailingSpeedRatio == m_fSpeedRatio && m_fSpeedRatio == 1.0f )
|
||||
{
|
||||
@@ -250,9 +250,13 @@ int RageSoundReader_SpeedChange::Read( float *pBuf, int iFrames )
|
||||
{
|
||||
int iRet = Step();
|
||||
if( iRet < 0 )
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
if( !GetCursorAvail() )
|
||||
{
|
||||
return END_OF_FILE;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,22 +120,27 @@ void RageSurfaceUtils::Palettize( RageSurface *&pImg, int iColors, bool bDither
|
||||
* [GRR POSSIBLE BUG: what about 32^4 ?] */
|
||||
acolorhist_item *achv;
|
||||
int colors;
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
achv = pam_computeacolorhist( pImg, MAXCOLORS, &colors );
|
||||
if( achv != NULL )
|
||||
{
|
||||
break;
|
||||
}
|
||||
pixval newmaxval = maxval / 2;
|
||||
|
||||
int table[256];
|
||||
for( int c = 0; c <= maxval; ++c )
|
||||
{
|
||||
table[c] = ( (uint8_t) c * newmaxval + maxval/2 ) / maxval;
|
||||
|
||||
}
|
||||
for( int row = 0; row < pImg->h; ++row )
|
||||
{
|
||||
apixel *pP = (apixel *) (pImg->pixels+row*pImg->pitch);
|
||||
for( int col = 0; col < pImg->w; ++col, ++pP )
|
||||
{
|
||||
PAM_DEPTH( *pP );
|
||||
}
|
||||
}
|
||||
maxval = newmaxval;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ RageSurfaceUtils::OpenResult RageSurface_Load_GIF( const RString &sPath, RageSur
|
||||
|
||||
int transparency = -1;
|
||||
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
unsigned char type;
|
||||
if( !ReadOK(f, &type, 1) )
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* As a timer,
|
||||
* RageTimer Timer;
|
||||
* while(1) {
|
||||
* for(;;) {
|
||||
* printf( "Will be approximately: %f", Timer.PeekDeltaTime()) ;
|
||||
* float fDeltaTime = Timer.GetDeltaTime();
|
||||
* }
|
||||
|
||||
+10
-2
@@ -881,7 +881,7 @@ void split( const wstring &sSource, const wstring &sDelimitor, vector<wstring> &
|
||||
|
||||
RString str="a,b,c";
|
||||
int start = 0, size = -1;
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
do_split( str, ",", start, size );
|
||||
if( start == str.size() )
|
||||
@@ -2379,24 +2379,30 @@ bool FileCopy( const RString &sSrcFile, const RString &sDstFile )
|
||||
|
||||
bool FileCopy( RageFileBasic &in, RageFileBasic &out, RString &sError, bool *bReadError )
|
||||
{
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
RString data;
|
||||
if( in.Read(data, 1024*32) == -1 )
|
||||
{
|
||||
sError = ssprintf( "read error: %s", in.GetError().c_str() );
|
||||
if( bReadError != NULL )
|
||||
{
|
||||
*bReadError = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if( data.empty() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
int i = out.Write(data);
|
||||
if( i == -1 )
|
||||
{
|
||||
sError = ssprintf( "write error: %s", out.GetError().c_str() );
|
||||
if( bReadError != NULL )
|
||||
{
|
||||
*bReadError = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2405,7 +2411,9 @@ bool FileCopy( RageFileBasic &in, RageFileBasic &out, RString &sError, bool *bRe
|
||||
{
|
||||
sError = ssprintf( "write error: %s", out.GetError().c_str() );
|
||||
if( bReadError != NULL )
|
||||
{
|
||||
*bReadError = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+11
-2
@@ -640,23 +640,32 @@ void ScreenOptions::PositionRows( bool bTween )
|
||||
|
||||
/* If less than total (and Rows.size()) are displayed, fill in the empty
|
||||
* space intelligently. */
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
const int sum = (first_end - first_start) + (second_end - second_start);
|
||||
if( sum >= (int) Rows.size() || sum >= total)
|
||||
{
|
||||
break; // nothing more to display, or no room
|
||||
|
||||
}
|
||||
/* First priority: expand the top of the second half until it meets
|
||||
* the first half. */
|
||||
if( second_start > first_end )
|
||||
{
|
||||
second_start--;
|
||||
}
|
||||
// Otherwise, expand either end.
|
||||
else if( first_start > 0 )
|
||||
{
|
||||
first_start--;
|
||||
}
|
||||
else if( second_end < (int) Rows.size() )
|
||||
{
|
||||
second_end++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FAIL_M("Do we have room to grow or don't we?");
|
||||
}
|
||||
}
|
||||
|
||||
int pos = 0;
|
||||
|
||||
@@ -592,20 +592,22 @@ static LocalizedString WAITING_FOR_HEADER( "ScreenPackages", "Waiting for header
|
||||
void ScreenPackages::HTTPUpdate()
|
||||
{
|
||||
if( !m_bIsDownloading )
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
int BytesGot=0;
|
||||
// Keep this as a code block
|
||||
// as there may be need to "if" it out some time.
|
||||
/* If you need a conditional for a large block of code, stick it in
|
||||
* a function and return. */
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
char Buffer[1024];
|
||||
int iSize = m_wSocket.ReadData( Buffer, 1024 );
|
||||
if( iSize <= 0 )
|
||||
{
|
||||
break;
|
||||
|
||||
}
|
||||
m_sBUFFER.append( Buffer, iSize );
|
||||
BytesGot += iSize;
|
||||
}
|
||||
|
||||
+12
-6
@@ -295,7 +295,7 @@ void ThemeManager::LoadThemeMetrics( const RString &sThemeName_, const RString &
|
||||
m_sCurLanguage = sLanguage;
|
||||
|
||||
bool bLoadedBase = false;
|
||||
while(1)
|
||||
for(;;)
|
||||
{
|
||||
ASSERT_M( g_vThemes.size() < 20, "Circular theme fallback references detected." );
|
||||
|
||||
@@ -315,13 +315,15 @@ void ThemeManager::LoadThemeMetrics( const RString &sThemeName_, const RString &
|
||||
}
|
||||
iniStrings.ReadFile( GetLanguageIniPath(sThemeName,SpecialFiles::BASE_LANGUAGE) );
|
||||
if( sLanguage.CompareNoCase(SpecialFiles::BASE_LANGUAGE) )
|
||||
{
|
||||
iniStrings.ReadFile( GetLanguageIniPath(sThemeName,sLanguage) );
|
||||
|
||||
}
|
||||
bool bIsBaseTheme = !sThemeName.CompareNoCase(SpecialFiles::BASE_THEME_NAME);
|
||||
iniMetrics.GetValue( "Global", "IsBaseTheme", bIsBaseTheme );
|
||||
if( bIsBaseTheme )
|
||||
{
|
||||
bLoadedBase = true;
|
||||
|
||||
}
|
||||
/* Read the fallback theme. If no fallback theme is specified, and we haven't
|
||||
* already loaded it, fall back on SpecialFiles::BASE_THEME_NAME.
|
||||
* That way, default theme fallbacks can be disabled with
|
||||
@@ -330,9 +332,10 @@ void ThemeManager::LoadThemeMetrics( const RString &sThemeName_, const RString &
|
||||
if( !iniMetrics.GetValue("Global","FallbackTheme",sFallback) )
|
||||
{
|
||||
if( sThemeName.CompareNoCase( SpecialFiles::BASE_THEME_NAME ) && !bLoadedBase )
|
||||
{
|
||||
sFallback = SpecialFiles::BASE_THEME_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
/* We actually want to load themes bottom-to-top, loading fallback themes
|
||||
* first, so derived themes overwrite metrics in fallback themes. But, we
|
||||
* need to load the derived theme first, to find out the name of the fallback
|
||||
@@ -342,7 +345,9 @@ void ThemeManager::LoadThemeMetrics( const RString &sThemeName_, const RString &
|
||||
XmlFileUtil::MergeIniUnder( &iniStrings, &g_pLoadedThemeData->iniStrings );
|
||||
|
||||
if( sFallback.empty() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
sThemeName = sFallback;
|
||||
}
|
||||
|
||||
@@ -960,12 +965,13 @@ RString ThemeManager::GetMetricRaw( const IniFile &ini, const RString &sMetricsG
|
||||
const RString sMetricsGroup = sMetricsGroup_;
|
||||
const RString sValueName = sValueName_;
|
||||
|
||||
while( true )
|
||||
for(;;)
|
||||
{
|
||||
RString ret;
|
||||
if( ThemeManager::GetMetricRawRecursive(ini, sMetricsGroup, sValueName, ret) )
|
||||
{
|
||||
return ret;
|
||||
|
||||
}
|
||||
RString sCurMetricPath = GetMetricsIniPath( m_sCurThemeName );
|
||||
RString sDefaultMetricPath = GetMetricsIniPath( SpecialFiles::BASE_THEME_NAME );
|
||||
|
||||
|
||||
@@ -174,21 +174,28 @@ int MovieDecoder_FFMpeg::DecodeFrame( float fTargetTime )
|
||||
m_fLastFrame=fTargetTime;
|
||||
}
|
||||
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
int ret = DecodePacket( fTargetTime );
|
||||
|
||||
if( ret == 1 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if( ret == -1 )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if( ret == 0 && m_iEOF > 0 )
|
||||
{
|
||||
return 0; /* eof */
|
||||
|
||||
}
|
||||
ASSERT( ret == 0 );
|
||||
ret = ReadPacket();
|
||||
if( ret < 0 )
|
||||
{
|
||||
return ret; /* error */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,17 +40,25 @@ static const char *itoa(unsigned n)
|
||||
static intptr_t xtoi( const char *hex )
|
||||
{
|
||||
intptr_t ret = 0;
|
||||
while( 1 )
|
||||
for(;;)
|
||||
{
|
||||
int val = -1;
|
||||
if( *hex >= '0' && *hex <= '9' )
|
||||
{
|
||||
val = *hex - '0';
|
||||
}
|
||||
else if( *hex >= 'A' && *hex <= 'F' )
|
||||
{
|
||||
val = *hex - 'A' + 10;
|
||||
}
|
||||
else if( *hex >= 'a' && *hex <= 'f' )
|
||||
{
|
||||
val = *hex - 'a' + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
hex++;
|
||||
|
||||
ret *= 16;
|
||||
|
||||
@@ -31,17 +31,21 @@ static void safe_print( int fd, ... )
|
||||
va_list ap;
|
||||
va_start( ap, fd );
|
||||
|
||||
while( true )
|
||||
for(;;)
|
||||
{
|
||||
const char *p = va_arg( ap, const char * );
|
||||
if( p == NULL )
|
||||
{
|
||||
break;
|
||||
}
|
||||
size_t len = strlen( p );
|
||||
while( len )
|
||||
{
|
||||
ssize_t result = write( fd, p, strlen(p) );
|
||||
if( result == -1 )
|
||||
{
|
||||
_exit( 1 );
|
||||
}
|
||||
len -= result;
|
||||
p += result;
|
||||
}
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ void NORETURN sm_crash( const char *reason )
|
||||
if( IsDebuggerPresent() )
|
||||
{
|
||||
DebugBreak();
|
||||
while(1); /* don't return */
|
||||
for(;;); /* don't return */
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -39,7 +39,7 @@ void NORETURN sm_crash( const char *reason )
|
||||
|
||||
/* This isn't actually reached. We just do this to convince the compiler that the
|
||||
* function really doesn't return. */
|
||||
while(1);
|
||||
for(;;);
|
||||
#endif
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
|
||||
Reference in New Issue
Block a user