diff plugins/ChromagramPlugin.cpp @ 17:d4a92aab8147

* Fix a buffer overrun and some compile warnings
author Chris Cannam <c.cannam@qmul.ac.uk>
date Thu, 30 Nov 2006 14:53:29 +0000
parents 2fbfe5e42ad4
children 99dadc93042e
line wrap: on
line diff
--- a/plugins/ChromagramPlugin.cpp	Fri Oct 13 12:28:44 2006 +0000
+++ b/plugins/ChromagramPlugin.cpp	Thu Nov 30 14:53:29 2006 +0000
@@ -268,7 +268,7 @@
             int ipc = m_minMIDIPitch % 12;
             int index = (i + ipc) % 12;
             d.binNames.push_back(names[index]);
-            for (int j = 0; j < d.binCount / 12 - 1; ++j) {
+            for (int j = 0; j < int(d.binCount) / 12 - 1; ++j) {
                 d.binNames.push_back("");
             }
         }
@@ -323,9 +323,9 @@
 
     for (size_t i = 0; i < m_block/2; ++i) {
 	real[i] = inputBuffers[0][i*2];
-	real[m_block - i] = real[i];
+	if (i > 0) real[m_block - i] = real[i];
         imag[i] = inputBuffers[0][i*2+1];
-        imag[m_block - i] = imag[i];
+        if (i > 0) imag[m_block - i] = imag[i];
     }
 
     double *output = m_chromagram->process(real, imag);