From fdb09fc810046db266c010f074796b46ebaffbb1 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 15 Sep 2002 07:03:32 +0000 Subject: [PATCH] fixed crash in MsdFile. Also, updated ez2 and SMMAX2 themes to new element names. --- stepmania/src/Course.cpp | 4 ++-- stepmania/src/MsdFile.cpp | 41 ++++++++++++++++---------------- stepmania/src/MsdFile.h | 5 +--- stepmania/src/NotesLoaderDWI.cpp | 2 +- stepmania/src/NotesLoaderKSF.cpp | 4 ++-- stepmania/src/NotesLoaderSM.cpp | 2 +- 6 files changed, 27 insertions(+), 31 deletions(-) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 9404f9b8b9..ed2d37480a 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -42,8 +42,8 @@ void Course::LoadFromCRSFile( CString sPath, CArray &apSongs ) for( int i=0; i iBytesRead ); + ASSERT( iBufferSize > iBytesRead ); // why are these not always =? m_iNumValues = 0; @@ -59,7 +57,7 @@ bool MsdFile::ReadFile( CString sNewPath ) int i; for( i=0; i= 0 && !strchr("\r\n", m_szFileString[j]); --j) + for(j = i-1; j >= 0 && !strchr("\r\n", szFileString[j]); --j) { - if(m_szFileString[j] == ' ' || m_szFileString[j] == '\t') + if(szFileString[j] == ' ' || szFileString[j] == '\t') continue; FirstChar = false; @@ -84,45 +82,45 @@ bool MsdFile::ReadFile( CString sNewPath ) break; } - for(j = i-1; j >= 0 && isspace(m_szFileString[j]); --j) - m_szFileString[j] = 0; + for(j = i-1; j >= 0 && isspace(szFileString[j]); --j) + szFileString[j] = 0; } ReadingValue=true; m_iNumValues++; int iCurValueIndex = m_iNumValues-1; m_iNumParams[iCurValueIndex] = 1; - m_szValuesAndParams[iCurValueIndex][0] = &m_szFileString[i+1]; + szParams[iCurValueIndex][0] = &szFileString[i+1]; } break; case ':': // begins a new parameter { - m_szFileString[i] = '\0'; + szFileString[i] = '\0'; int iCurValueIndex = m_iNumValues-1; m_iNumParams[iCurValueIndex] ++; int iCurParamIndex = m_iNumParams[iCurValueIndex]-1; - m_szValuesAndParams[iCurValueIndex][iCurParamIndex] = &m_szFileString[i+1]; + szParams[iCurValueIndex][iCurParamIndex] = &szFileString[i+1]; } break; case ';': // ends a value { - m_szFileString[i] = '\0'; + szFileString[i] = '\0'; // fast forward until just before the next '#' - while( m_szFileString[i+1] != '#' && i