author | eilers <eilers> | 2003-08-08 14:45:49 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-08-08 14:45:49 (UTC) |
commit | 14d394e6c107b037a09a31a92605034fe50f7813 (patch) (unidiff) | |
tree | 800699cf4dc9681c3eb023340634dd6a15fd04c8 /library/config.cpp | |
parent | dbc6ea35f5535a1f69deb7ebbafc0f721721dbf2 (diff) | |
download | opie-14d394e6c107b037a09a31a92605034fe50f7813.zip opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.gz opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.bz2 |
Merged branches from BRANCH_1_0
-rw-r--r-- | library/config.cpp | 26 |
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 ) | |||
465 | } | 465 | } |
466 | 466 | ||
467 | QString str; | 467 | QString str; |
468 | QCString cstr; | 468 | QCString cstr; |
469 | QMap< QString, ConfigGroup >::Iterator g_it = groups.begin(); | 469 | QMap< QString, ConfigGroup >::Iterator g_it = groups.begin(); |
@@ -477,3 +477,3 @@ void Config::write( const QString &fn ) | |||
477 | cstr = str.utf8(); | 477 | cstr = str.utf8(); |
478 | 478 | ||
479 | int total_length; | 479 | int total_length; |
@@ -487,3 +487,3 @@ void Config::write( const QString &fn ) | |||
487 | } | 487 | } |
488 | 488 | ||
489 | f.close(); | 489 | f.close(); |
@@ -491,6 +491,6 @@ void Config::write( const QString &fn ) | |||
491 | if ( rename( strNewFile, filename ) < 0 ) { | 491 | if ( rename( strNewFile, filename ) < 0 ) { |
492 | qWarning( "problem renaming the file %s to %s", strNewFile.latin1(), | 492 | qWarning( "problem renaming the file %s to %s", strNewFile.latin1(), |
493 | filename.latin1() ); | 493 | filename.latin1() ); |
494 | QFile::remove( strNewFile ); | 494 | QFile::remove( strNewFile ); |
495 | } | 495 | } |
496 | } | 496 | } |
@@ -523,2 +523,12 @@ void Config::read() | |||
523 | 523 | ||
524 | |||
525 | // hack to avoid problems if big files are passed to test | ||
526 | // if they are valid configs ( like passing a mp3 ... ) | ||
527 | // I just hope that there are no conf files > 100000 byte | ||
528 | // not the best solution, find something else later | ||
529 | if ( f.size() > 100000 ) { | ||
530 | return; | ||
531 | } | ||
532 | |||
533 | |||
524 | QTextStream s( &f ); | 534 | QTextStream s( &f ); |
@@ -548,6 +558,6 @@ bool Config::parse( const QString &l ) | |||
548 | QString line = l.stripWhiteSpace(); | 558 | QString line = l.stripWhiteSpace(); |
549 | 559 | ||
550 | if ( line [0] == QChar ( '#' )) | 560 | if ( line [0] == QChar ( '#' )) |
551 | return true; // ignore comments | 561 | return true; // ignore comments |
552 | 562 | ||
553 | if ( line[ 0 ] == QChar( '[' ) ) { | 563 | if ( line[ 0 ] == QChar( '[' ) ) { |