summaryrefslogtreecommitdiff
path: root/library/config.cpp
Side-by-side diff
Diffstat (limited to 'library/config.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/config.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/library/config.cpp b/library/config.cpp
index b47c620..b28c771 100644
--- a/library/config.cpp
+++ b/library/config.cpp
@@ -465,5 +465,5 @@ void Config::write( const QString &fn )
}
-
+
QString str;
- QCString cstr;
+ QCString cstr;
QMap< QString, ConfigGroup >::Iterator g_it = groups.begin();
@@ -477,3 +477,3 @@ void Config::write( const QString &fn )
cstr = str.utf8();
-
+
int total_length;
@@ -487,3 +487,3 @@ void Config::write( const QString &fn )
}
-
+
f.close();
@@ -491,6 +491,6 @@ void Config::write( const QString &fn )
if ( rename( strNewFile, filename ) < 0 ) {
- qWarning( "problem renaming the file %s to %s", strNewFile.latin1(),
+ qWarning( "problem renaming the file %s to %s", strNewFile.latin1(),
filename.latin1() );
QFile::remove( strNewFile );
- }
+ }
}
@@ -523,2 +523,12 @@ void Config::read()
+
+ // hack to avoid problems if big files are passed to test
+ // if they are valid configs ( like passing a mp3 ... )
+ // I just hope that there are no conf files > 100000 byte
+ // not the best solution, find something else later
+ if ( f.size() > 100000 ) {
+ return;
+ }
+
+
QTextStream s( &f );
@@ -548,6 +558,6 @@ bool Config::parse( const QString &l )
QString line = l.stripWhiteSpace();
-
+
if ( line [0] == QChar ( '#' ))
return true; // ignore comments
-
+
if ( line[ 0 ] == QChar( '[' ) ) {