changeset 259:dc46851837d6

* Fix many compile warnings, remove some debug output
author Chris Cannam
date Mon, 30 Apr 2007 13:36:23 +0000
parents 96a6dd889c68
children d4a33cdca86f
files base/AudioLevel.cpp base/CommandHistory.cpp base/Profiler.cpp base/StorageAdviser.cpp data/fft/FFTDataServer.cpp data/fft/FFTFileCache.cpp data/fileio/CSVFileReader.cpp data/fileio/MatrixFile.cpp data/fileio/WavFileReader.cpp data/model/NoteModel.cpp plugin/DSSIPluginFactory.cpp plugin/DSSIPluginInstance.cpp plugin/FeatureExtractionPluginFactory.cpp plugin/LADSPAPluginFactory.cpp plugin/LADSPAPluginInstance.cpp plugin/RealTimePluginFactory.cpp plugin/RealTimePluginFactory.h system/Init.cpp
diffstat 18 files changed, 73 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/base/AudioLevel.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/base/AudioLevel.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -45,9 +45,9 @@
     FaderDescription(-40.f,   0.f, 1.00f), // preview
 };
 
-typedef std::vector<float> LevelList;
-static std::map<int, LevelList> previewLevelCache;
-static const LevelList &getPreviewLevelCache(int levels);
+//typedef std::vector<float> LevelList;
+//static std::map<int, LevelList> previewLevelCache;
+//static const LevelList &getPreviewLevelCache(int levels);
 
 float
 AudioLevel::multiplier_to_dB(float multiplier)
@@ -219,7 +219,7 @@
     return fader;
 }
 
-
+/*
 const LevelList &
 getPreviewLevelCache(int levels)
 {
@@ -234,6 +234,7 @@
     }
     return ll;
 }
+*/
 
 int
 AudioLevel::multiplier_to_preview(float m, int levels)
--- a/base/CommandHistory.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/base/CommandHistory.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -367,7 +367,7 @@
 	CommandStack tempStack;
 
 	for (i = 0; i < limit; ++i) {
-	    Command *command = stack.top();
+//	    Command *command = stack.top();
 //	    std::cerr << "CommandHistory::clipStack: Saving recent command: " << command->getName().toLocal8Bit().data() << " at " << command << std::endl;
 	    tempStack.push(stack.top());
 	    stack.pop();
--- a/base/Profiler.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/base/Profiler.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -48,7 +48,13 @@
     dump();
 }
 
-void Profiles::accumulate(const char* id, clock_t time, RealTime rt)
+void Profiles::accumulate(
+#ifndef NO_TIMING
+    const char* id, clock_t time, RealTime rt
+#else
+    const char*, clock_t, RealTime
+#endif
+)
 {
 #ifndef NO_TIMING    
     ProfilePair &pair(m_profiles[id]);
--- a/base/StorageAdviser.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/base/StorageAdviser.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -167,8 +167,8 @@
 {
     if (area == MemoryAllocation) m_memoryPlanned += size;
     else if (area == DiscAllocation) m_discPlanned += size;
-    std::cerr << "storage planned up: memory: " << m_memoryPlanned << ", disc "
-              << m_discPlanned << std::endl;
+//    std::cerr << "storage planned up: memory: " << m_memoryPlanned << ", disc "
+//              << m_discPlanned << std::endl;
 }
 
 void
@@ -181,7 +181,7 @@
         if (m_discPlanned > size) m_discPlanned -= size; 
         else m_discPlanned = 0;
     }
-    std::cerr << "storage planned down: memory: " << m_memoryPlanned << ", disc "
-              << m_discPlanned << std::endl;
+//    std::cerr << "storage planned down: memory: " << m_memoryPlanned << ", disc "
+//              << m_discPlanned << std::endl;
 }
 
--- a/data/fft/FFTDataServer.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/data/fft/FFTDataServer.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -376,7 +376,7 @@
               << m_releasedServers.size() << " candidates" << std::endl;
 #endif
 
-    while (m_releasedServers.size() > maxSize) {
+    while (int(m_releasedServers.size()) > maxSize) {
 
         FFTDataServer *server = *m_releasedServers.begin();
 
@@ -566,7 +566,7 @@
             StorageAdviser::recommend(criteria, minimumSize, maximumSize);
     }
 
-    std::cerr << "Recommendation was: " << recommendation << std::endl;
+//    std::cerr << "Recommendation was: " << recommendation << std::endl;
 
     m_memoryCache = ((recommendation & StorageAdviser::UseMemory) ||
                      (recommendation & StorageAdviser::PreferMemory));
@@ -723,7 +723,7 @@
 
         for (IntQueue::iterator i = m_dormantCaches.begin();
              i != m_dormantCaches.end(); ++i) {
-            if (*i == c) {
+            if (*i == int(c)) {
                 m_dormantCaches.erase(i);
                 break;
             }
--- a/data/fft/FFTFileCache.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/data/fft/FFTFileCache.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -40,7 +40,7 @@
            mode == MatrixFile::ReadOnly)),
     m_storageType(storageType)
 {
-    std::cerr << "FFTFileCache: storage type is " << (storageType == Compact ? "Compact" : storageType == Polar ? "Polar" : "Rectangular") << std::endl;
+//    std::cerr << "FFTFileCache: storage type is " << (storageType == Compact ? "Compact" : storageType == Polar ? "Polar" : "Rectangular") << std::endl;
 }
 
 FFTFileCache::~FFTFileCache()
@@ -234,7 +234,12 @@
 //    std::cerr << "Normalization factor: " << factor << ", max " << maxFactor << " (height " << getHeight() << ")" << std::endl;
 
     if (m_storageType == Compact) {
-        ((uint16_t *)m_writebuf)[h * 2] = factor * 65535.0;
+        if (factor < 0.f || factor > 1.f) {
+            std::cerr << "WARNING: FFTFileCache::setColumnAt: Normalization factor " << factor << " out of range" << std::endl;
+            if (factor < 0.f) factor = 0.f;
+            if (factor > 1.f) factor = 1.f;
+        }
+        ((uint16_t *)m_writebuf)[h * 2] = (uint16_t)(factor * 65535.0);
     } else {
         ((float *)m_writebuf)[h * 2] = factor;
     }
--- a/data/fileio/CSVFileReader.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/data/fileio/CSVFileReader.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -342,7 +342,7 @@
     for (int i = 0; i <= 16; ++i) {
 	int value = 1 << i;
 	m_windowSizeCombo->addItem(QString("%1").arg(value));
-	if (value == m_windowSize) m_windowSizeCombo->setCurrentIndex(i);
+	if (value == int(m_windowSize)) m_windowSizeCombo->setCurrentIndex(i);
     }
     m_windowSizeCombo->setEditable(true);
 
--- a/data/fileio/MatrixFile.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/data/fileio/MatrixFile.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -159,7 +159,7 @@
     QMutexLocker locker(&m_refcountMutex);
     ++m_refcount[fileName];
 
-    std::cerr << "MatrixFile(" << this << "): fd " << m_fd << ", file " << fileName.toStdString() << ", ref " << m_refcount[fileName] << std::endl;
+//    std::cerr << "MatrixFile(" << this << "): fd " << m_fd << ", file " << fileName.toStdString() << ", ref " << m_refcount[fileName] << std::endl;
 
 //    std::cerr << "MatrixFile::MatrixFile: Done, size is " << "(" << m_width << ", " << m_height << ")" << std::endl;
 
@@ -196,10 +196,10 @@
         if (--m_refcount[m_fileName] == 0) {
 
             if (::unlink(m_fileName.toLocal8Bit())) {
-                ::perror("Unlink failed");
-                std::cerr << "WARNING: MatrixFile::~MatrixFile: reference count reached 0, but failed to unlink file \"" << m_fileName.toStdString() << "\"" << std::endl;
+//                ::perror("Unlink failed");
+//                std::cerr << "WARNING: MatrixFile::~MatrixFile: reference count reached 0, but failed to unlink file \"" << m_fileName.toStdString() << "\"" << std::endl;
             } else {
-                std::cerr << "deleted " << m_fileName.toStdString() << std::endl;
+//                std::cerr << "deleted " << m_fileName.toStdString() << std::endl;
             }
 
             QMutexLocker locker2(&m_columnBitsetWriteMutex);
@@ -212,9 +212,9 @@
     totalMemory -= (2 * m_defaultCacheWidth * m_height * m_cellSize);
     totalCount --;
 
-    std::cerr << "MatrixFile::~MatrixFile: " << std::endl;
-    std::cerr << "Total storage now " << totalStorage/1024 << "K, theoretical max memory "
-              << totalMemory/1024 << "K in " << totalCount << " instances" << std::endl;
+//    std::cerr << "MatrixFile::~MatrixFile: " << std::endl;
+//    std::cerr << "Total storage now " << totalStorage/1024 << "K, theoretical max memory "
+//              << totalMemory/1024 << "K in " << totalCount << " instances" << std::endl;
 
 }
 
--- a/data/fileio/WavFileReader.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/data/fileio/WavFileReader.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -56,7 +56,7 @@
         m_sampleRate = m_fileInfo.samplerate;
     }
 
-    std::cerr << "WavFileReader: Frame count " << m_frameCount << ", channel count " << m_channelCount << ", sample rate " << m_sampleRate << std::endl;
+//    std::cerr << "WavFileReader: Frame count " << m_frameCount << ", channel count " << m_channelCount << ", sample rate " << m_sampleRate << std::endl;
 
 }
 
--- a/data/model/NoteModel.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/data/model/NoteModel.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -33,7 +33,7 @@
     for (PointListIterator i = endItr; i != m_points.begin(); ) {
         --i;
         if (i->frame < start) {
-            if (i->frame + i->duration >= start) {
+            if (i->frame + long(i->duration) >= start) {
                 rv.insert(*i);
             }
         } else if (i->frame <= end) {
@@ -63,7 +63,7 @@
     for (PointListIterator i = endItr; i != m_points.begin(); ) {
         --i;
         if (i->frame < start) {
-            if (i->frame + i->duration >= start) {
+            if (i->frame + long(i->duration) >= start) {
                 rv.insert(*i);
             }
         } else if (i->frame <= end) {
--- a/plugin/DSSIPluginFactory.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/plugin/DSSIPluginFactory.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -360,7 +360,7 @@
 	    defs = lrdf_get_setting_values(def_uri);
 	}
 	
-	int controlPortNumber = 1;
+	unsigned int controlPortNumber = 1;
 	
 	for (unsigned long i = 0; i < ladspaDescriptor->PortCount; i++) {
 	    
@@ -368,7 +368,7 @@
 		
 		if (def_uri && defs) {
 		    
-		    for (int j = 0; j < defs->count; j++) {
+		    for (unsigned int j = 0; j < defs->count; j++) {
 			if (defs->items[j].pid == controlPortNumber) {
 //			    std::cerr << "Default for this port (" << defs->items[j].pid << ", " << defs->items[j].label << ") is " << defs->items[j].value << "; applying this to port number " << i << " with name " << ladspaDescriptor->PortNames[i] << std::endl;
 			    m_portDefaults[ladspaDescriptor->UniqueID][i] =
--- a/plugin/DSSIPluginInstance.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/plugin/DSSIPluginInstance.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -269,8 +269,8 @@
 
     if (m_latencyPort) {
 	if (!m_run) {
-            for (int i = 0; i < getAudioInputCount(); ++i) {
-                for (int j = 0; j < m_blockSize; ++j) {
+            for (size_t i = 0; i < getAudioInputCount(); ++i) {
+                for (size_t j = 0; j < m_blockSize; ++j) {
                     m_inputBuffers[i][j] = 0.f;
                 }
             }
@@ -1229,9 +1229,9 @@
 }
 
 int
-DSSIPluginInstance::requestMidiSend(LADSPA_Handle instance,
-				    unsigned char ports,
-				    unsigned char channels)
+DSSIPluginInstance::requestMidiSend(LADSPA_Handle /* instance */,
+				    unsigned char /* ports */,
+				    unsigned char /* channels */)
 {
     // This is called from a non-RT context (during instantiate)
 
@@ -1240,9 +1240,9 @@
 }
 
 void
-DSSIPluginInstance::midiSend(LADSPA_Handle instance,
-			     snd_seq_event_t *events,
-			     unsigned long eventCount)
+DSSIPluginInstance::midiSend(LADSPA_Handle /* instance */,
+			     snd_seq_event_t * /* events */,
+			     unsigned long /* eventCount */)
 {
     // This is likely to be called from an RT context
 
--- a/plugin/FeatureExtractionPluginFactory.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/plugin/FeatureExtractionPluginFactory.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -37,8 +37,8 @@
 {
     if (pluginType == "vamp") {
 	if (!_nativeInstance) {
-	    std::cerr << "FeatureExtractionPluginFactory::instance(" << pluginType.toStdString()
-		      << "): creating new FeatureExtractionPluginFactory" << std::endl;
+//	    std::cerr << "FeatureExtractionPluginFactory::instance(" << pluginType.toStdString()
+//		      << "): creating new FeatureExtractionPluginFactory" << std::endl;
 	    _nativeInstance = new FeatureExtractionPluginFactory();
 	}
 	return _nativeInstance;
--- a/plugin/LADSPAPluginFactory.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/plugin/LADSPAPluginFactory.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -594,11 +594,11 @@
 
 //    std::cerr << "LADSPAPluginFactory::discoverPlugins - "
 //	      << "discovering plugins; path is ";
-    for (std::vector<QString>::iterator i = pathList.begin();
-	 i != pathList.end(); ++i) {
-	std::cerr << "[" << i->toStdString() << "] ";
-    }
-    std::cerr << std::endl;
+//    for (std::vector<QString>::iterator i = pathList.begin();
+//	 i != pathList.end(); ++i) {
+//	std::cerr << "[" << i->toStdString() << "] ";
+//    }
+//    std::cerr << std::endl;
 
 #ifdef HAVE_LRDF
     // read the description files 
@@ -709,7 +709,7 @@
 	    defs = lrdf_get_setting_values(def_uri);
 	}
 
-	int controlPortNumber = 1;
+	unsigned int controlPortNumber = 1;
 	
 	for (unsigned long i = 0; i < descriptor->PortCount; i++) {
 	    
@@ -717,7 +717,7 @@
 		
 		if (def_uri && defs) {
 		    
-		    for (int j = 0; j < defs->count; j++) {
+		    for (unsigned int j = 0; j < defs->count; j++) {
 			if (defs->items[j].pid == controlPortNumber) {
 //			    std::cerr << "Default for this port (" << defs->items[j].pid << ", " << defs->items[j].label << ") is " << defs->items[j].value << "; applying this to port number " << i << " with name " << descriptor->PortNames[i] << std::endl;
 			    m_portDefaults[descriptor->UniqueID][i] =
@@ -820,7 +820,7 @@
     lrdf_uris *uris = lrdf_get_instances(uri.toStdString().c_str());
 
     if (uris != NULL) {
-	for (int i = 0; i < uris->count; ++i) {
+	for (unsigned int i = 0; i < uris->count; ++i) {
 	    m_lrdfTaxonomy[lrdf_get_uid(uris->items[i])] = base;
 	}
 	lrdf_free_uris(uris);
@@ -829,7 +829,7 @@
     uris = lrdf_get_subclasses(uri.toStdString().c_str());
 
     if (uris != NULL) {
-	for (int i = 0; i < uris->count; ++i) {
+	for (unsigned int i = 0; i < uris->count; ++i) {
 	    char *label = lrdf_get_label(uris->items[i]);
 	    generateTaxonomy(uris->items[i],
 			     base + (base.length() > 0 ? " > " : "") + label);
--- a/plugin/LADSPAPluginInstance.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/plugin/LADSPAPluginInstance.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -30,6 +30,8 @@
 
 //#define DEBUG_LADSPA 1
 
+#include <cmath>
+
 
 LADSPAPluginInstance::LADSPAPluginInstance(RealTimePluginFactory *factory,
 					   int clientId,
@@ -153,9 +155,9 @@
             if (defaults) {
                 if (defaults->count > 0) {
                     std::map<int, std::string> values;
-                    int v = 0;
+                    size_t v = 0;
                     for (size_t i = 0; i < defaults->count; ++i) {
-                        v = defaults->items[i].value;
+                        v = size_t(lrintf(fabsf(defaults->items[i].value)));
                         values[v] = defaults->items[i].label;
                     }
                     for (size_t i = 0; i <= v; ++i) {
@@ -291,8 +293,8 @@
 {
     if (m_latencyPort) {
 	if (!m_run) {
-            for (int i = 0; i < getAudioInputCount(); ++i) {
-                for (int j = 0; j < m_blockSize; ++j) {
+            for (size_t i = 0; i < getAudioInputCount(); ++i) {
+                for (size_t j = 0; j < m_blockSize; ++j) {
                     m_inputBuffers[i][j] = 0.f;
                 }
             }
@@ -518,8 +520,6 @@
 {
     if (!m_descriptor || !m_descriptor->run) return;
 
-    int inbuf = 0, outbuf = 0;
-
     for (std::vector<LADSPA_Handle>::iterator hi = m_instanceHandles.begin();
 	 hi != m_instanceHandles.end(); ++hi) {
 
--- a/plugin/RealTimePluginFactory.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/plugin/RealTimePluginFactory.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -32,6 +32,10 @@
 static LADSPAPluginFactory *_ladspaInstance = 0;
 static LADSPAPluginFactory *_dssiInstance = 0;
 
+RealTimePluginFactory::~RealTimePluginFactory()
+{
+}
+
 RealTimePluginFactory *
 RealTimePluginFactory::instance(QString pluginType)
 {
--- a/plugin/RealTimePluginFactory.h	Mon Apr 30 09:07:42 2007 +0000
+++ b/plugin/RealTimePluginFactory.h	Mon Apr 30 13:36:23 2007 +0000
@@ -46,6 +46,8 @@
 class RealTimePluginFactory
 {
 public:
+    virtual ~RealTimePluginFactory();
+
     static RealTimePluginFactory *instance(QString pluginType);
     static RealTimePluginFactory *instanceFor(QString identifier);
     static std::vector<QString> getAllPluginIdentifiers();
--- a/system/Init.cpp	Mon Apr 30 09:07:42 2007 +0000
+++ b/system/Init.cpp	Mon Apr 30 13:36:23 2007 +0000
@@ -91,3 +91,5 @@
 #endif
 }
 
+
+