[ardour-dev] Compilation warnings patch
Carl Hetherington
lists at carlh.net
Fri Mar 16 08:03:28 PDT 2007
Hi,
Attached is a patch which fixes some of the compilation warnings from gcc
4.1.2 in current SVN.
Cheers
Carl
-------------- next part --------------
diff -r -u -X exclude trunk/libs/ardour/audiosource.cc warnings/libs/ardour/audiosource.cc
--- trunk/libs/ardour/audiosource.cc 2007-03-16 12:53:00.000000000 +0000
+++ warnings/libs/ardour/audiosource.cc 2007-03-16 15:01:00.000000000 +0000
@@ -671,7 +671,7 @@
Sample* buf2 = 0;
nframes_t to_do;
uint32_t peaks_computed;
- PeakData* peakbuf;
+ PeakData* peakbuf = 0;
int ret = -1;
nframes_t current_frame;
nframes_t frames_done;
diff -r -u -X exclude trunk/libs/ardour/import.cc warnings/libs/ardour/import.cc
--- trunk/libs/ardour/import.cc 2007-03-15 12:06:31.000000000 +0000
+++ warnings/libs/ardour/import.cc 2007-03-16 15:01:00.000000000 +0000
@@ -117,7 +117,6 @@
float *data = 0;
Sample **channel_data = 0;
long nfiles = 0;
- long n;
string basepath;
string sounds_dir;
nframes_t so_far;
@@ -143,14 +142,14 @@
importable = new ImportableSource (in, &info);
}
- for (n = 0; n < info.channels; ++n) {
+ for (int n = 0; n < info.channels; ++n) {
newfiles.push_back (boost::shared_ptr<AudioFileSource>());
}
sounds_dir = discover_best_sound_dir ();
basepath = PBD::basename_nosuffix (status.paths.front());
- for (n = 0; n < info.channels; ++n) {
+ for (int n = 0; n < info.channels; ++n) {
bool goodfile = false;
@@ -162,7 +161,7 @@
snprintf (buf, sizeof(buf), "%s/%s-R.wav", sounds_dir.c_str(), basepath.c_str());
}
} else if (info.channels > 1) {
- snprintf (buf, sizeof(buf), "%s/%s-c%lu.wav", sounds_dir.c_str(), basepath.c_str(), n+1);
+ snprintf (buf, sizeof(buf), "%s/%s-c%d.wav", sounds_dir.c_str(), basepath.c_str(), n+1);
} else {
snprintf (buf, sizeof(buf), "%s/%s.wav", sounds_dir.c_str(), basepath.c_str());
}
@@ -199,7 +198,7 @@
data = new float[nframes * info.channels];
channel_data = new Sample * [ info.channels ];
- for (n = 0; n < info.channels; ++n) {
+ for (int n = 0; n < info.channels; ++n) {
channel_data[n] = new Sample[nframes];
}
@@ -222,7 +221,8 @@
/* de-interleave */
for (chn = 0; chn < info.channels; ++chn) {
-
+
+ nframes_t n;
for (x = chn, n = 0; n < nfread; x += info.channels, ++n) {
channel_data[chn][n] = (Sample) data[x];
}
@@ -257,7 +257,7 @@
if (status.multichan) {
/* all sources are used in a single multichannel region */
- for (n = 0; n < nfiles && !status.cancel; ++n) {
+ for (int n = 0; n < nfiles && !status.cancel; ++n) {
/* flush the final length to the header */
newfiles[n]->update_header(0, *now, xnow);
sources.push_back(newfiles[n]);
@@ -274,7 +274,7 @@
status.new_regions.push_back (r);
} else {
- for (n = 0; n < nfiles && !status.cancel; ++n) {
+ for (int n = 0; n < nfiles && !status.cancel; ++n) {
/* flush the final length to the header */
@@ -309,7 +309,7 @@
}
if (channel_data) {
- for (n = 0; n < info.channels; ++n) {
+ for (int n = 0; n < info.channels; ++n) {
delete [] channel_data[n];
}
delete [] channel_data;
diff -r -u -X exclude trunk/libs/ardour/mix.cc warnings/libs/ardour/mix.cc
--- trunk/libs/ardour/mix.cc 2007-03-15 12:06:31.000000000 +0000
+++ warnings/libs/ardour/mix.cc 2007-03-16 15:01:00.000000000 +0000
@@ -92,7 +92,7 @@
void
find_peaks (ARDOUR::Sample *buf, nframes_t nframes, float *min, float *max)
{
- long i;
+ nframes_t i;
float a, b;
a = *max;
diff -r -u -X exclude trunk/libs/pbd/pbd/abstract_ui.cc warnings/libs/pbd/pbd/abstract_ui.cc
--- trunk/libs/pbd/pbd/abstract_ui.cc 2007-03-15 12:09:14.000000000 +0000
+++ warnings/libs/pbd/pbd/abstract_ui.cc 2007-03-16 15:01:00.000000000 +0000
@@ -54,6 +54,8 @@
}
RequestBufferVector vec;
+ vec.buf[0] = 0;
+ vec.buf[1] = 0;
rbuf->get_write_vector (&vec);
diff -r -u -X exclude trunk/libs/pbd/stacktrace.cc warnings/libs/pbd/stacktrace.cc
--- trunk/libs/pbd/stacktrace.cc 2007-03-15 12:09:14.000000000 +0000
+++ warnings/libs/pbd/stacktrace.cc 2007-03-16 15:01:00.000000000 +0000
@@ -23,7 +23,7 @@
printf ("Obtained %zd stack frames.\n", size);
- for (i = 0; i < size && (levels == 0 || i < levels); i++) {
+ for (i = 0; i < size && (levels == 0 || i < size_t(levels)); i++) {
out << strings[i] << std::endl;
}
diff -r -u -X exclude trunk/libs/pbd/strsplit.cc warnings/libs/pbd/strsplit.cc
--- trunk/libs/pbd/strsplit.cc 2007-03-16 12:53:00.000000000 +0000
+++ warnings/libs/pbd/strsplit.cc 2007-03-16 15:01:00.000000000 +0000
@@ -56,7 +56,7 @@
}
for (ustring::size_type n = 0; n < len; ++n) {
- if (str[n] == splitchar) {
+ if (str[n] == gunichar(splitchar)) {
cnt++;
}
}
diff -r -u -X exclude trunk/libs/soundtouch/RateTransposer.cpp warnings/libs/soundtouch/RateTransposer.cpp
--- trunk/libs/soundtouch/RateTransposer.cpp 2007-03-15 12:06:13.000000000 +0000
+++ warnings/libs/soundtouch/RateTransposer.cpp 2007-03-16 15:01:00.000000000 +0000
@@ -339,7 +339,7 @@
// Returns nonzero if there aren't any samples available for outputting.
-uint RateTransposer::isEmpty()
+int RateTransposer::isEmpty() const
{
int res;
diff -r -u -X exclude trunk/libs/soundtouch/RateTransposer.h warnings/libs/soundtouch/RateTransposer.h
--- trunk/libs/soundtouch/RateTransposer.h 2007-03-15 12:06:13.000000000 +0000
+++ warnings/libs/soundtouch/RateTransposer.h 2007-03-16 15:01:00.000000000 +0000
@@ -150,7 +150,7 @@
void clear();
/// Returns nonzero if there aren't any samples available for outputting.
- uint isEmpty();
+ int isEmpty() const;
};
}
diff -r -u -X exclude trunk/libs/soundtouch/TDStretch.cpp warnings/libs/soundtouch/TDStretch.cpp
--- trunk/libs/soundtouch/TDStretch.cpp 2007-03-15 12:06:13.000000000 +0000
+++ warnings/libs/soundtouch/TDStretch.cpp 2007-03-16 15:01:00.000000000 +0000
@@ -114,13 +114,6 @@
-// Calculates the x having the closest 2^x value for the given value
-static int _getClosest2Power(double value)
-{
- return (int)(log(value) / log(2.0) + 0.5);
-}
-
-
// Sets routine control parameters. These control are certain time constants
// defining how the sound is stretched to the desired duration.
More information about the Ardour-Dev
mailing list