diff data/fileio/CodedAudioFileReader.cpp @ 544:65d955c4d671

* throw (but do not yet catch!) exception when running out of disc space in coded audio file * simpler (faster?) cache-to-cache move operation in spectrogram, and some other minor fixes
author Chris Cannam
date Wed, 04 Feb 2009 12:13:16 +0000
parents 7a66b94ef1c0
children 939ffbc32d50
line wrap: on
line diff
--- a/data/fileio/CodedAudioFileReader.cpp	Wed Feb 04 10:53:38 2009 +0000
+++ b/data/fileio/CodedAudioFileReader.cpp	Wed Feb 04 12:13:16 2009 +0000
@@ -269,7 +269,6 @@
     }
 
     if (m_cacheWriteBufferIndex > 0) {
-        //!!! check for return value! out of disk space, etc!
         pushBuffer(m_cacheWriteBuffer,
                    m_cacheWriteBufferIndex / m_channelCount,
                    true);
@@ -328,8 +327,11 @@
     switch (m_cacheMode) {
 
     case CacheInTemporaryFile:
-        //!!! check for return value! out of disk space, etc!
-        sf_writef_float(m_cacheFileWritePtr, buffer, sz);
+        if (sf_writef_float(m_cacheFileWritePtr, buffer, sz) < sz) {
+            sf_close(m_cacheFileWritePtr);
+            m_cacheFileWritePtr = 0;
+            throw InsufficientDiscSpace(TempDirectory::getInstance()->getPath());
+        }
         break;
 
     case CacheInMemory: