This commit is contained in:
Steve Checkoway
2006-02-19 11:24:37 +00:00
parent 2c99a2b194
commit 4c593087a3
2 changed files with 27 additions and 22 deletions
+12 -7
View File
@@ -46,15 +46,18 @@ void MsdFile::ReadBuf( char *buf, int len )
if( i+1 < len && buf[i] == '/' && buf[i+1] == '/' ) if( i+1 < len && buf[i] == '/' && buf[i+1] == '/' )
{ {
/* //; erase with spaces until newline */ /* //; erase with spaces until newline */
do { do
{
buf[i] = ' '; buf[i] = ' ';
i++; i++;
} while(i < len && buf[i] != '\n'); }
while( i < len && buf[i] != '\n' );
continue; continue;
} }
if(ReadingValue && buf[i] == '#') { if( ReadingValue && buf[i] == '#' )
{
/* Unfortunately, many of these files are missing ;'s. /* Unfortunately, many of these files are missing ;'s.
* If we get a # when we thought we were inside a value, assume we * If we get a # when we thought we were inside a value, assume we
* missed the ;. Back up and end the value. */ * missed the ;. Back up and end the value. */
@@ -70,7 +73,8 @@ void MsdFile::ReadBuf( char *buf, int len )
break; break;
} }
if(!FirstChar) { if( !FirstChar )
{
/* Oops, we're not; handle this like a regular character. */ /* Oops, we're not; handle this like a regular character. */
i++; i++;
continue; continue;
@@ -85,7 +89,8 @@ void MsdFile::ReadBuf( char *buf, int len )
} }
/* # starts a new value. */ /* # starts a new value. */
if(!ReadingValue && buf[i] == '#') { if( !ReadingValue && buf[i] == '#' )
{
AddValue(); AddValue();
ReadingValue=true; ReadingValue=true;
} }
@@ -160,8 +165,8 @@ void MsdFile::ReadFromString( const RString &sString )
RString MsdFile::GetParam(unsigned val, unsigned par) const RString MsdFile::GetParam(unsigned val, unsigned par) const
{ {
if(val >= GetNumValues()) return RString(); if( val >= GetNumValues() || par >= GetNumParams(val) )
if(par >= GetNumParams(val)) return RString(); return RString();
return values[val].params[par]; return values[val].params[par];
} }