Index: trunk/BNC/src/rinex/corrfile.cpp
===================================================================
--- trunk/BNC/src/rinex/corrfile.cpp	(revision 6182)
+++ trunk/BNC/src/rinex/corrfile.cpp	(revision 6183)
@@ -54,4 +54,6 @@
   _stream = new QTextStream();
   _stream->setDevice(_file);
+  _lastOrbCorr = 0;
+  _lastClkCorr = 0;
 }
 
@@ -71,47 +73,30 @@
   }
 
-  QStringList lines;
-
-  if (!_lastLine.isEmpty()) {
-    lines << _lastLine;
-  }
+  _orbCorr.clear();
+  _clkCorr.clear();
 
   while (_stream->status() == QTextStream::Ok && !_stream->atEnd()) {
-    QString line = _stream->readLine();
+    QString line = _stream->readLine().trimmed();
     if (line.isEmpty() || line[0] == '!') {
       continue;
     }
-    _lastLine = line;
+    if      (line[0] == 'O') {
+      delete _lastOrbCorr; _lastOrbCorr = new t_orbCorr(line.toAscii().data());
+    }
+    else if (line[0] == 'C') {
+      delete _lastClkCorr; _lastClkCorr = new t_clkCorr(line.toAscii().data());
+    }
+    if (stopRead(tt)) {
+      break;
+    }
+  }
 
-    if (stopRead(tt)) {
-      QList<t_orbCorr> orbCorr;
-      QList<t_clkCorr> clkCorr;
-      QListIterator<QString> it(lines);
-      while (it.hasNext()) {
-        const QString& str = it.next();
-        if      (str[0] == 'C') {
-          t_clkCorr corr(str.toAscii().data());
-          _lastTime = corr._time;
-          _corrIODs[QString(corr._prn.toString().c_str())] = corr.IOD();
-          clkCorr.push_back(corr);
-        }
-        else if (str[0] == 'O') {
-          t_orbCorr corr(str.toAscii().data());
-          _lastTime = corr._time;
-          _corrIODs[QString(corr._prn.toString().c_str())] = corr.IOD();
-          orbCorr.push_back(corr);
-        }
-      }         
-      if (orbCorr.size() > 0) {
-        emit newOrbCorrections(orbCorr);
-      }
-      if (clkCorr.size() > 0) {
-        emit newClkCorrections(clkCorr);
-      }
-      return;
-    }
-    else {
-      lines << _lastLine;
-    }
+  if (_orbCorr.size() > 0) {
+    emit newOrbCorrections(_orbCorr);
+    _orbCorr.clear();
+  }
+  if (_clkCorr.size() > 0) {
+    emit newClkCorrections(_clkCorr);
+    _clkCorr.clear();
   }
 }
@@ -120,14 +105,24 @@
 ////////////////////////////////////////////////////////////////////////////
 bool t_corrFile::stopRead(const bncTime& tt) {
-
-  if (_lastTime.undef()) {
-    return false;
+  if (_lastOrbCorr) {
+    if (_lastOrbCorr->_time > tt) {
+      return true;
+    }
+    else {
+      _orbCorr.push_back(*_lastOrbCorr);
+      _corrIODs[QString(_lastOrbCorr->_prn.toString().c_str())] = _lastOrbCorr->_iod;
+      delete _lastOrbCorr; _lastOrbCorr = 0;
+    }
   }
-
-  if (_lastTime > tt) {
-    return true;
-  }    
-  else {
-    return false;
+  if (_lastClkCorr) {
+    if (_lastClkCorr->_time > tt) {
+      return true;
+    }
+    else {
+      _clkCorr.push_back(*_lastClkCorr);
+      _corrIODs[QString(_lastClkCorr->_prn.toString().c_str())] = _lastClkCorr->_iod;
+      delete _lastClkCorr; _lastClkCorr = 0;
+    }
   }
+  return false;
 }
Index: trunk/BNC/src/rinex/corrfile.h
===================================================================
--- trunk/BNC/src/rinex/corrfile.h	(revision 6182)
+++ trunk/BNC/src/rinex/corrfile.h	(revision 6183)
@@ -48,7 +48,9 @@
   QFile*             _file;
   QTextStream*       _stream;
-  QString            _lastLine;
+  QList<t_orbCorr>   _orbCorr;
+  QList<t_clkCorr>   _clkCorr;
+  t_orbCorr*         _lastOrbCorr;
+  t_clkCorr*         _lastClkCorr;
   QMap<QString, int> _corrIODs;
-  bncTime            _lastTime;
 };
 
