diff data/fileio/MP3FileReader.cpp @ 1342:c0fece5e7755 3.0-integration

Improved debug output for file open troubleshooting
author Chris Cannam
date Fri, 06 Jan 2017 09:43:40 +0000
parents 47768571681e
children c380e56c95f5
line wrap: on
line diff
--- a/data/fileio/MP3FileReader.cpp	Fri Jan 06 09:15:36 2017 +0000
+++ b/data/fileio/MP3FileReader.cpp	Fri Jan 06 09:43:40 2017 +0000
@@ -77,8 +77,9 @@
     
     struct stat stat;
     if (::stat(m_path.toLocal8Bit().data(), &stat) == -1 || stat.st_size == 0) {
-	m_error = QString("File %1 does not exist.").arg(m_path);
-	return;
+        m_error = QString("File %1 does not exist.").arg(m_path);
+        SVDEBUG << "MP3FileReader: " << m_error << endl;
+        return;
     }
 
     m_fileSize = stat.st_size;
@@ -95,8 +96,9 @@
                      | O_BINARY
 #endif
                      , 0)) < 0) {
-	m_error = QString("Failed to open file %1 for reading.").arg(m_path);
-	return;
+        m_error = QString("Failed to open file %1 for reading.").arg(m_path);
+        SVDEBUG << "MP3FileReader: " << m_error << endl;
+        return;
     }	
 
     try {
@@ -108,8 +110,9 @@
         memset(m_fileBuffer + m_fileSize, 0, MAD_BUFFER_GUARD);
     } catch (...) {
         m_error = QString("Out of memory");
+        SVDEBUG << "MP3FileReader: " << m_error << endl;
         ::close(fd);
-	return;
+        return;
     }
     
     ssize_t sz = 0;
@@ -121,6 +124,7 @@
                 .arg(m_path).arg(offset);
             delete[] m_fileBuffer;
             ::close(fd);
+            SVDEBUG << "MP3FileReader: " << m_error << endl;
             return;
         } else if (sz == 0) {
             SVCERR << QString("MP3FileReader::MP3FileReader: Warning: reached EOF after only %1 of %2 bytes")