diff transform/FileFeatureWriter.cpp @ 512:e7a39c45a7a4

* close output streams a little sooner when writing features for more than one file (doesn't affect eventual output though)
author Chris Cannam
date Tue, 09 Dec 2008 16:53:37 +0000
parents 0944d13689b2
children 6acdddf6f99e
line wrap: on
line diff
--- a/transform/FileFeatureWriter.cpp	Mon Dec 08 15:08:39 2008 +0000
+++ b/transform/FileFeatureWriter.cpp	Tue Dec 09 16:53:37 2008 +0000
@@ -32,6 +32,7 @@
 
 FileFeatureWriter::FileFeatureWriter(int support,
                                      QString extension) :
+    m_prevstream(0),
     m_support(support),
     m_extension(extension),
     m_manyFiles(false),
@@ -258,6 +259,13 @@
         }
     }
 
-    return m_streams[file];
+    QTextStream *stream = m_streams[file];
+
+    if (m_prevstream && stream != m_prevstream) {
+        m_prevstream->flush();
+    }
+    m_prevstream = stream;
+
+    return stream;
 }