summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2004-04-08 18:34:28 (UTC)
committer zecke <zecke>2004-04-08 18:34:28 (UTC)
commite892ef3b71ac582a3ee23e1a2a65e3b43121a40c (patch) (unidiff)
treeee0a3b858daeca2dcbd24c196c31b18b47616f2e /library
parentc8481d7f647ffdc08005f630263dfc05cfd7b230 (diff)
downloadopie-e892ef3b71ac582a3ee23e1a2a65e3b43121a40c.zip
opie-e892ef3b71ac582a3ee23e1a2a65e3b43121a40c.tar.gz
opie-e892ef3b71ac582a3ee23e1a2a65e3b43121a40c.tar.bz2
Be a bit more picky on config files
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/config.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/config.cpp b/library/config.cpp
index 8b60f60..0bfb476 100644
--- a/library/config.cpp
+++ b/library/config.cpp
@@ -515,27 +515,29 @@ void Config::read()
515 515
516 QFile f( filename ); 516 QFile f( filename );
517 if ( !f.open( IO_ReadOnly ) ) { 517 if ( !f.open( IO_ReadOnly ) ) {
518 git = groups.end(); 518 git = groups.end();
519 return; 519 return;
520 } 520 }
521 521
522 522
523 // hack to avoid problems if big files are passed to test 523 // hack to avoid problems if big files are passed to test
524 // if they are valid configs ( like passing a mp3 ... ) 524 // if they are valid configs ( like passing a mp3 ... )
525 // I just hope that there are no conf files > 100000 byte 525 // I just hope that there are no conf files > 100000 byte
526 // not the best solution, find something else later 526 // not the best solution, find something else later
527 if ( f.size() > 100000 ) { 527 if ( f.getch()!='[' ||f.size() > 100000 ) {
528 git = groups.end();
528 return; 529 return;
529 } 530 }
531 f.ungetch('[');
530 532
531 533
532 QTextStream s( &f ); 534 QTextStream s( &f );
533#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 535#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
534 // The below should work, but doesn't in Qt 2.3.0 536 // The below should work, but doesn't in Qt 2.3.0
535 s.setCodec( QTextCodec::codecForMib( 106 ) ); 537 s.setCodec( QTextCodec::codecForMib( 106 ) );
536#else 538#else
537 s.setEncoding( QTextStream::UnicodeUTF8 ); 539 s.setEncoding( QTextStream::UnicodeUTF8 );
538#endif 540#endif
539 541
540 QStringList list = QStringList::split('\n', s.read() ); 542 QStringList list = QStringList::split('\n', s.read() );
541 f.close(); 543 f.close();