changeset 1084:e4d40c185c72

Fix overflow in width calculation
author Chris Cannam
date Wed, 10 Jun 2015 13:31:21 +0100
parents 7fb788f891d0
children bf6f64dabe73
files data/fft/FFTDataServer.cpp
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/data/fft/FFTDataServer.cpp	Wed Jun 10 13:14:32 2015 +0100
+++ b/data/fft/FFTDataServer.cpp	Wed Jun 10 13:31:21 2015 +0100
@@ -529,7 +529,7 @@
 
     int maxCacheSize = 20 * 1024 * 1024;
     int columnSize = int(m_height * sizeof(fftsample) * 2 + sizeof(fftsample));
-    if (m_width * columnSize < maxCacheSize * 2) m_cacheWidth = m_width;
+    if (m_width < ((maxCacheSize * 2) / columnSize)) m_cacheWidth = m_width;
     else m_cacheWidth = maxCacheSize / columnSize;
     
 #ifdef DEBUG_FFT_SERVER
@@ -1411,13 +1411,13 @@
     QString err;
     if (m_error != "") {
         err = m_error;
-        cerr << "FFTDataServer::getError: err (server " << this << ") = " << err << endl;
+//        cerr << "FFTDataServer::getError: err (server " << this << ") = " << err << endl;
     } else {
         MutexLocker locker(&m_fftBuffersLock, "FFTDataServer::getError");
         if (m_fillThread) {
             err = m_fillThread->getError();
-            cerr << "FFTDataServer::getError: err (server " << this << ", from thread " << m_fillThread
-                 << ") = " << err << endl;
+//            cerr << "FFTDataServer::getError: err (server " << this << ", from thread " << m_fillThread
+//                 << ") = " << err << endl;
         }
     }
     return err;