From f02ed66d5936bb5f3ae37d18dd57ef6ef2cb15c9 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 5 Jan 2006 07:36:09 +0000 Subject: [PATCH] assert if we're about to write an unparsable ini file --- stepmania/src/IniFile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/stepmania/src/IniFile.cpp b/stepmania/src/IniFile.cpp index a8962e689a..7330b494b8 100644 --- a/stepmania/src/IniFile.cpp +++ b/stepmania/src/IniFile.cpp @@ -95,7 +95,14 @@ bool IniFile::WriteFile( RageFileBasic &f ) const FOREACH_CONST_Attr( pKey, pAttr ) { - if( f.PutLine( ssprintf("%s=%s", pAttr->first.c_str(), pAttr->second.c_str()) ) == -1 ) + const RString &sName = pAttr->first; + const RString &sValue = pAttr->second; + + // TODO: Are there esacpe rules for these? + DEBUG_ASSERT( sName.find('\n') == sName.npos ); + DEBUG_ASSERT( sName.find('=') == sName.npos ); + + if( f.PutLine( ssprintf("%s=%s", sName.c_str(), sValue.c_str()) ) == -1 ) { m_sError = f.GetError(); return false;