Mercurial > hg > svcore
changeset 928:6a94bb528e9d warnfix_no_size_t
Remove size_t's, fix compiler warnings
author | Chris Cannam |
---|---|
date | Tue, 17 Jun 2014 13:52:07 +0100 |
parents | 49618f39ff09 |
children | 59e7fe1b1003 |
files | base/AudioPlaySource.h base/Clipboard.cpp base/Clipboard.h base/Exceptions.cpp base/Exceptions.h base/PropertyContainer.cpp base/RealTime.cpp base/RecentFiles.cpp base/RecentFiles.h base/Resampler.cpp base/Resampler.h base/RingBuffer.h base/Selection.cpp base/Selection.h base/StringBits.cpp base/ViewManagerBase.h base/Window.h base/ZoomConstraint.h |
diffstat | 18 files changed, 160 insertions(+), 155 deletions(-) [+] |
line wrap: on
line diff
--- a/base/AudioPlaySource.h Tue Jun 03 11:05:49 2014 +0100 +++ b/base/AudioPlaySource.h Tue Jun 17 13:52:07 2014 +0100 @@ -37,7 +37,7 @@ * Start playing from the given frame. If playback is already * under way, reseek to the given frame and continue. */ - virtual void play(size_t startFrame) = 0; + virtual void play(int startFrame) = 0; /** * Stop playback. @@ -53,7 +53,7 @@ * Return the frame number that is currently expected to be coming * out of the speakers. (i.e. compensating for playback latency.) */ - virtual size_t getCurrentPlayingFrame() = 0; + virtual int getCurrentPlayingFrame() = 0; /** * Return the current (or thereabouts) output levels in the range @@ -65,14 +65,14 @@ * Return the sample rate of the source material -- any material * that wants to play at a different rate will sound wrong. */ - virtual size_t getSourceSampleRate() const = 0; + virtual int getSourceSampleRate() const = 0; /** * Return the sample rate set by the target audio device (or the * source sample rate if the target hasn't set one). If the * source and target sample rates differ, resampling will occur. */ - virtual size_t getTargetSampleRate() const = 0; + virtual int getTargetSampleRate() const = 0; /** * Get the block size of the target audio device. This may be an @@ -80,7 +80,7 @@ * size; the source should behave itself even if this value turns * out to be inaccurate. */ - virtual size_t getTargetBlockSize() const = 0; + virtual int getTargetBlockSize() const = 0; /** * Get the number of channels of audio that will be provided @@ -88,7 +88,7 @@ * count: for example, a mono source will provide 2 channels * after pan. */ - virtual size_t getTargetChannelCount() const = 0; + virtual int getTargetChannelCount() const = 0; /** * Set a plugin or other subclass of Auditionable as an
--- a/base/Clipboard.cpp Tue Jun 03 11:05:49 2014 +0100 +++ b/base/Clipboard.cpp Tue Jun 17 13:52:07 2014 +0100 @@ -44,7 +44,7 @@ { } -Clipboard::Point::Point(long frame, float value, size_t duration, QString label) : +Clipboard::Point::Point(long frame, float value, int duration, QString label) : m_haveFrame(true), m_frame(frame), m_haveValue(true), @@ -60,7 +60,7 @@ { } -Clipboard::Point::Point(long frame, float value, size_t duration, float level, QString label) : +Clipboard::Point::Point(long frame, float value, int duration, float level, QString label) : m_haveFrame(true), m_frame(frame), m_haveValue(true), @@ -159,14 +159,14 @@ return m_haveDuration; } -size_t +int Clipboard::Point::getDuration() const { return m_duration; } Clipboard::Point -Clipboard::Point::withDuration(size_t duration) const +Clipboard::Point::withDuration(int duration) const { Point p(*this); p.m_haveDuration = true;
--- a/base/Clipboard.h Tue Jun 03 11:05:49 2014 +0100 +++ b/base/Clipboard.h Tue Jun 17 13:52:07 2014 +0100 @@ -27,8 +27,8 @@ public: Point(long frame, QString label); Point(long frame, float value, QString label); - Point(long frame, float value, size_t duration, QString label); - Point(long frame, float value, size_t duration, float level, QString label); + Point(long frame, float value, int duration, QString label); + Point(long frame, float value, int duration, float level, QString label); Point(const Point &point); Point &operator=(const Point &point); @@ -41,8 +41,8 @@ Point withValue(float value) const; bool haveDuration() const; - size_t getDuration() const; - Point withDuration(size_t duration) const; + int getDuration() const; + Point withDuration(int duration) const; bool haveLabel() const; QString getLabel() const; @@ -64,7 +64,7 @@ bool m_haveValue; float m_value; bool m_haveDuration; - size_t m_duration; + int m_duration; bool m_haveLabel; QString m_label; bool m_haveLevel;
--- a/base/Exceptions.cpp Tue Jun 03 11:05:49 2014 +0100 +++ b/base/Exceptions.cpp Tue Jun 17 13:52:07 2014 +0100 @@ -91,8 +91,8 @@ } InsufficientDiscSpace::InsufficientDiscSpace(QString directory, - size_t required, - size_t available) throw() : + int required, + int available) throw() : m_directory(directory), m_required(required), m_available(available)
--- a/base/Exceptions.h Tue Jun 03 11:05:49 2014 +0100 +++ b/base/Exceptions.h Tue Jun 17 13:52:07 2014 +0100 @@ -82,19 +82,19 @@ { public: InsufficientDiscSpace(QString directory, - size_t required, size_t available) throw(); + int required, int available) throw(); InsufficientDiscSpace(QString directory) throw(); virtual ~InsufficientDiscSpace() throw() { } virtual const char *what() const throw(); QString getDirectory() const { return m_directory; } - size_t getRequired() const { return m_required; } - size_t getAvailable() const { return m_available; } + int getRequired() const { return m_required; } + int getAvailable() const { return m_available; } protected: QString m_directory; - size_t m_required; - size_t m_available; + int m_required; + int m_available; }; class AllocationFailed : virtual public std::exception
--- a/base/PropertyContainer.cpp Tue Jun 03 11:05:49 2014 +0100 +++ b/base/PropertyContainer.cpp Tue Jun 17 13:52:07 2014 +0100 @@ -54,7 +54,7 @@ } QString -PropertyContainer::getPropertyValueLabel(const PropertyName &name, int value) const +PropertyContainer::getPropertyValueLabel(const PropertyName &, int) const { return QString(); }
--- a/base/RealTime.cpp Tue Jun 03 11:05:49 2014 +0100 +++ b/base/RealTime.cpp Tue Jun 17 13:52:07 2014 +0100 @@ -89,8 +89,6 @@ bool negative = false, afterT = false; - int valstart = 0; - while (i < len) { if (s[i] == '-') { @@ -103,7 +101,6 @@ char *eptr = 0; if (isdigit(s[i]) || s[i] == '.') { - valstart = i; value = strtod(&s[i], &eptr); i = eptr - s; } @@ -151,7 +148,11 @@ t = t + fromSeconds(second); - return t; + if (negative) { + return -t; + } else { + return t; + } } double
--- a/base/RecentFiles.cpp Tue Jun 03 11:05:49 2014 +0100 +++ b/base/RecentFiles.cpp Tue Jun 17 13:52:07 2014 +0100 @@ -21,7 +21,7 @@ #include <QSettings> #include <QRegExp> -RecentFiles::RecentFiles(QString settingsGroup, size_t maxCount) : +RecentFiles::RecentFiles(QString settingsGroup, int maxCount) : m_settingsGroup(settingsGroup), m_maxCount(maxCount) { @@ -40,7 +40,7 @@ QSettings settings; settings.beginGroup(m_settingsGroup); - for (size_t i = 0; i < 100; ++i) { + for (int i = 0; i < 100; ++i) { QString key = QString("recent-%1").arg(i); QString name = settings.value(key, "").toString(); if (name == "") break; @@ -57,10 +57,10 @@ QSettings settings; settings.beginGroup(m_settingsGroup); - for (size_t i = 0; i < m_maxCount; ++i) { + for (int i = 0; i < m_maxCount; ++i) { QString key = QString("recent-%1").arg(i); QString name = ""; - if (i < m_names.size()) name = m_names[i]; + if (i < (int)m_names.size()) name = m_names[i]; settings.setValue(key, name); } @@ -70,7 +70,7 @@ void RecentFiles::truncateAndWrite() { - while (m_names.size() > m_maxCount) { + while (int(m_names.size()) > m_maxCount) { m_names.pop_back(); } write(); @@ -80,8 +80,8 @@ RecentFiles::getRecent() const { std::vector<QString> names; - for (size_t i = 0; i < m_maxCount; ++i) { - if (i < m_names.size()) { + for (int i = 0; i < m_maxCount; ++i) { + if (i < (int)m_names.size()) { names.push_back(m_names[i]); } } @@ -92,7 +92,7 @@ RecentFiles::add(QString name) { bool have = false; - for (size_t i = 0; i < m_names.size(); ++i) { + for (int i = 0; i < int(m_names.size()); ++i) { if (m_names[i] == name) { have = true; break; @@ -104,7 +104,7 @@ } else { std::deque<QString> newnames; newnames.push_back(name); - for (size_t i = 0; i < m_names.size(); ++i) { + for (int i = 0; i < int(m_names.size()); ++i) { if (m_names[i] == name) continue; newnames.push_back(m_names[i]); }
--- a/base/RecentFiles.h Tue Jun 03 11:05:49 2014 +0100 +++ b/base/RecentFiles.h Tue Jun 17 13:52:07 2014 +0100 @@ -37,7 +37,7 @@ * given QSettings group and truncates when the given count of * strings is reached. */ - RecentFiles(QString settingsGroup = "RecentFiles", size_t maxCount = 10); + RecentFiles(QString settingsGroup = "RecentFiles", int maxCount = 10); virtual ~RecentFiles(); @@ -68,7 +68,7 @@ protected: QString m_settingsGroup; - size_t m_maxCount; + int m_maxCount; std::deque<QString> m_names;
--- a/base/Resampler.cpp Tue Jun 03 11:05:49 2014 +0100 +++ b/base/Resampler.cpp Tue Jun 17 13:52:07 2014 +0100 @@ -31,15 +31,15 @@ class Resampler::D { public: - D(Quality quality, size_t channels, size_t chunkSize); + D(Quality quality, int channels, int chunkSize); ~D(); - size_t resample(float **in, float **out, - size_t incount, float ratio, + int resample(float **in, float **out, + int incount, float ratio, bool final); - size_t resampleInterleaved(float *in, float *out, - size_t incount, float ratio, + int resampleInterleaved(float *in, float *out, + int incount, float ratio, bool final); void reset(); @@ -48,12 +48,12 @@ SRC_STATE *m_src; float *m_iin; float *m_iout; - size_t m_channels; - size_t m_iinsize; - size_t m_ioutsize; + int m_channels; + int m_iinsize; + int m_ioutsize; }; -Resampler::D::D(Quality quality, size_t channels, size_t chunkSize) : +Resampler::D::D(Quality quality, int channels, int chunkSize) : m_src(0), m_iin(0), m_iout(0), @@ -89,16 +89,16 @@ } } -size_t +int Resampler::D::resample(float **in, float **out, - size_t incount, float ratio, + int incount, float ratio, bool final) { if (m_channels == 1) { return resampleInterleaved(*in, *out, incount, ratio, final); } - size_t outcount = lrintf(ceilf(incount * ratio)); + int outcount = lrintf(ceilf(incount * ratio)); if (incount * m_channels > m_iinsize) { m_iinsize = incount * m_channels; @@ -108,16 +108,16 @@ m_ioutsize = outcount * m_channels; m_iout = (float *)realloc(m_iout, m_ioutsize * sizeof(float)); } - for (size_t i = 0; i < incount; ++i) { - for (size_t c = 0; c < m_channels; ++c) { + for (int i = 0; i < incount; ++i) { + for (int c = 0; c < m_channels; ++c) { m_iin[i * m_channels + c] = in[c][i]; } } - size_t gen = resampleInterleaved(m_iin, m_iout, incount, ratio, final); + int gen = resampleInterleaved(m_iin, m_iout, incount, ratio, final); - for (size_t i = 0; i < gen; ++i) { - for (size_t c = 0; c < m_channels; ++c) { + for (int i = 0; i < gen; ++i) { + for (int c = 0; c < m_channels; ++c) { out[c][i] = m_iout[i * m_channels + c]; } } @@ -125,14 +125,14 @@ return gen; } -size_t +int Resampler::D::resampleInterleaved(float *in, float *out, - size_t incount, float ratio, + int incount, float ratio, bool final) { SRC_DATA data; - size_t outcount = lrintf(ceilf(incount * ratio)); + int outcount = lrintf(ceilf(incount * ratio)); data.data_in = in; data.data_out = out; @@ -143,9 +143,13 @@ int err = src_process(m_src, &data); - //!!! check err, respond appropriately + if (err) { + cerr << "Resampler: ERROR: src_process returned error: " << + src_strerror(err) << endl; + return 0; + } - if (data.input_frames_used != incount) { + if (data.input_frames_used != (int)incount) { cerr << "Resampler: NOTE: input_frames_used == " << data.input_frames_used << " (while incount = " << incount << ")" << endl; } @@ -158,7 +162,7 @@ src_reset(m_src); } -Resampler::Resampler(Quality quality, size_t channels, size_t chunkSize) +Resampler::Resampler(Quality quality, int channels, int chunkSize) { m_d = new D(quality, channels, chunkSize); } @@ -168,17 +172,17 @@ delete m_d; } -size_t +int Resampler::resample(float **in, float **out, - size_t incount, float ratio, + int incount, float ratio, bool final) { return m_d->resample(in, out, incount, ratio, final); } -size_t +int Resampler::resampleInterleaved(float *in, float *out, - size_t incount, float ratio, + int incount, float ratio, bool final) { return m_d->resampleInterleaved(in, out, incount, ratio, final);
--- a/base/Resampler.h Tue Jun 03 11:05:49 2014 +0100 +++ b/base/Resampler.h Tue Jun 17 13:52:07 2014 +0100 @@ -28,15 +28,15 @@ public: enum Quality { Best, FastestTolerable, Fastest }; - Resampler(Quality quality, size_t channels, size_t chunkSize = 0); + Resampler(Quality quality, int channels, int chunkSize = 0); ~Resampler(); - size_t resample(float **in, float **out, - size_t incount, float ratio, + int resample(float **in, float **out, + int incount, float ratio, bool final = false); - size_t resampleInterleaved(float *in, float *out, - size_t incount, float ratio, + int resampleInterleaved(float *in, float *out, + int incount, float ratio, bool final = false); void reset();
--- a/base/RingBuffer.h Tue Jun 03 11:05:49 2014 +0100 +++ b/base/RingBuffer.h Tue Jun 17 13:52:07 2014 +0100 @@ -55,7 +55,7 @@ * power of two, this means n should ideally be some power of two * minus one. */ - RingBuffer(size_t n); + RingBuffer(int n); virtual ~RingBuffer(); @@ -63,7 +63,7 @@ * Return the total capacity of the ring buffer in samples. * (This is the argument n passed to the constructor.) */ - size_t getSize() const; + int getSize() const; /** * Return a new ring buffer (allocated with "new" -- caller must @@ -74,7 +74,7 @@ * inconsistent. If this buffer's data will not fit in the new * size, the contents are undefined. */ - RingBuffer<T, N> *resized(size_t newSize) const; + RingBuffer<T, N> *resized(int newSize) const; /** * Lock the ring buffer into physical memory. Returns true @@ -92,19 +92,19 @@ * Return the amount of data available for reading by reader R, in * samples. */ - size_t getReadSpace(int R = 0) const; + int getReadSpace(int R = 0) const; /** * Return the amount of space available for writing, in samples. */ - size_t getWriteSpace() const; + int getWriteSpace() const; /** * Read n samples from the buffer, for reader R. If fewer than n * are available, the remainder will be zeroed out. Returns the * number of samples actually read. */ - size_t read(T *destination, size_t n, int R = 0); + int read(T *destination, int n, int R = 0); /** * Read n samples from the buffer, for reader R, adding them to @@ -112,7 +112,7 @@ * will be left alone. Returns the number of samples actually * read. */ - size_t readAdding(T *destination, size_t n, int R = 0); + int readAdding(T *destination, int n, int R = 0); /** * Read one sample from the buffer, for reader R. If no sample is @@ -130,7 +130,7 @@ * n are available, the remainder will be zeroed out. Returns the * number of samples actually read. */ - size_t peek(T *destination, size_t n, int R = 0) const; + int peek(T *destination, int n, int R = 0) const; /** * Read one sample from the buffer, if available, without @@ -146,29 +146,29 @@ * samples). Returns the number of samples actually available for * discarding. */ - size_t skip(size_t n, int R = 0); + int skip(int n, int R = 0); /** * Write n samples to the buffer. If insufficient space is * available, not all samples may actually be written. Returns * the number of samples actually written. */ - size_t write(const T *source, size_t n); + int write(const T *source, int n); /** * Write n zero-value samples to the buffer. If insufficient * space is available, not all zeros may actually be written. * Returns the number of zeroes actually written. */ - size_t zero(size_t n); + int zero(int n); protected: - T *m_buffer; - bool m_mlocked; - size_t m_writer; - size_t *m_readers; - size_t m_size; - size_t m_spare; + T *m_buffer; + bool m_mlocked; + int m_writer; + int *m_readers; + int m_size; + int m_spare; private: RingBuffer(const RingBuffer &); // not provided @@ -176,11 +176,11 @@ }; template <typename T, int N> -RingBuffer<T, N>::RingBuffer(size_t n) : +RingBuffer<T, N>::RingBuffer(int n) : m_buffer(new T[n + 1]), m_mlocked(false), m_writer(0), - m_readers(new size_t[N]), + m_readers(new int[N]), m_size(n + 1) { #ifdef DEBUG_RINGBUFFER @@ -216,7 +216,7 @@ } template <typename T, int N> -size_t +int RingBuffer<T, N>::getSize() const { #ifdef DEBUG_RINGBUFFER @@ -228,7 +228,7 @@ template <typename T, int N> RingBuffer<T, N> * -RingBuffer<T, N>::resized(size_t newSize) const +RingBuffer<T, N>::resized(int newSize) const { #ifdef DEBUG_RINGBUFFER std::cerr << "RingBuffer<T," << N << ">[" << this << "]::resized(" << newSize << ")" << std::endl; @@ -270,12 +270,12 @@ } template <typename T, int N> -size_t +int RingBuffer<T, N>::getReadSpace(int R) const { - size_t writer = m_writer; - size_t reader = m_readers[R]; - size_t space = 0; + int writer = m_writer; + int reader = m_readers[R]; + int space = 0; if (writer > reader) space = writer - reader; else space = ((writer + m_size) - reader) % m_size; @@ -288,17 +288,17 @@ } template <typename T, int N> -size_t +int RingBuffer<T, N>::getWriteSpace() const { - size_t space = 0; + int space = 0; for (int i = 0; i < N; ++i) { - size_t here = (m_readers[i] + m_size - m_writer - 1) % m_size; + int here = (m_readers[i] + m_size - m_writer - 1) % m_size; if (i == 0 || here < space) space = here; } #ifdef DEBUG_RINGBUFFER - size_t rs(getReadSpace()), rp(m_readers[0]); + int rs(getReadSpace()), rp(m_readers[0]); std::cerr << "RingBuffer: write space " << space << ", read space " << rs << ", total " << (space + rs) << ", m_size " << m_size << std::endl; @@ -313,14 +313,14 @@ } template <typename T, int N> -size_t -RingBuffer<T, N>::read(T *destination, size_t n, int R) +int +RingBuffer<T, N>::read(T *destination, int n, int R) { #ifdef DEBUG_RINGBUFFER std::cerr << "RingBuffer<T," << N << ">[" << this << "]::read(dest, " << n << ", " << R << ")" << std::endl; #endif - size_t available = getReadSpace(R); + int available = getReadSpace(R); if (n > available) { #ifdef DEBUG_RINGBUFFER std::cerr << "WARNING: Only " << available << " samples available" @@ -331,7 +331,7 @@ } if (n == 0) return n; - size_t here = m_size - m_readers[R]; + int here = m_size - m_readers[R]; if (here >= n) { memcpy(destination, m_buffer + m_readers[R], n * sizeof(T)); } else { @@ -350,14 +350,14 @@ } template <typename T, int N> -size_t -RingBuffer<T, N>::readAdding(T *destination, size_t n, int R) +int +RingBuffer<T, N>::readAdding(T *destination, int n, int R) { #ifdef DEBUG_RINGBUFFER std::cerr << "RingBuffer<T," << N << ">[" << this << "]::readAdding(dest, " << n << ", " << R << ")" << std::endl; #endif - size_t available = getReadSpace(R); + int available = getReadSpace(R); if (n > available) { #ifdef DEBUG_RINGBUFFER std::cerr << "WARNING: Only " << available << " samples available" @@ -367,17 +367,17 @@ } if (n == 0) return n; - size_t here = m_size - m_readers[R]; + int here = m_size - m_readers[R]; if (here >= n) { - for (size_t i = 0; i < n; ++i) { + for (int i = 0; i < n; ++i) { destination[i] += (m_buffer + m_readers[R])[i]; } } else { - for (size_t i = 0; i < here; ++i) { + for (int i = 0; i < here; ++i) { destination[i] += (m_buffer + m_readers[R])[i]; } - for (size_t i = 0; i < (n - here); ++i) { + for (int i = 0; i < (n - here); ++i) { destination[i + here] += m_buffer[i]; } } @@ -411,14 +411,14 @@ } template <typename T, int N> -size_t -RingBuffer<T, N>::peek(T *destination, size_t n, int R) const +int +RingBuffer<T, N>::peek(T *destination, int n, int R) const { #ifdef DEBUG_RINGBUFFER std::cerr << "RingBuffer<T," << N << ">[" << this << "]::peek(dest, " << n << ", " << R << ")" << std::endl; #endif - size_t available = getReadSpace(R); + int available = getReadSpace(R); if (n > available) { #ifdef DEBUG_RINGBUFFER std::cerr << "WARNING: Only " << available << " samples available" @@ -429,7 +429,7 @@ } if (n == 0) return n; - size_t here = m_size - m_readers[R]; + int here = m_size - m_readers[R]; if (here >= n) { memcpy(destination, m_buffer + m_readers[R], n * sizeof(T)); } else { @@ -466,14 +466,14 @@ } template <typename T, int N> -size_t -RingBuffer<T, N>::skip(size_t n, int R) +int +RingBuffer<T, N>::skip(int n, int R) { #ifdef DEBUG_RINGBUFFER std::cerr << "RingBuffer<T," << N << ">[" << this << "]::skip(" << n << ", " << R << ")" << std::endl; #endif - size_t available = getReadSpace(R); + int available = getReadSpace(R); if (n > available) { #ifdef DEBUG_RINGBUFFER std::cerr << "WARNING: Only " << available << " samples available" @@ -487,14 +487,14 @@ } template <typename T, int N> -size_t -RingBuffer<T, N>::write(const T *source, size_t n) +int +RingBuffer<T, N>::write(const T *source, int n) { #ifdef DEBUG_RINGBUFFER std::cerr << "RingBuffer<T," << N << ">[" << this << "]::write(" << n << ")" << std::endl; #endif - size_t available = getWriteSpace(); + int available = getWriteSpace(); if (n > available) { #ifdef DEBUG_RINGBUFFER std::cerr << "WARNING: Only room for " << available << " samples" @@ -504,7 +504,7 @@ } if (n == 0) return n; - size_t here = m_size - m_writer; + int here = m_size - m_writer; if (here >= n) { memcpy(m_buffer + m_writer, source, n * sizeof(T)); } else { @@ -523,14 +523,14 @@ } template <typename T, int N> -size_t -RingBuffer<T, N>::zero(size_t n) +int +RingBuffer<T, N>::zero(int n) { #ifdef DEBUG_RINGBUFFER std::cerr << "RingBuffer<T," << N << ">[" << this << "]::zero(" << n << ")" << std::endl; #endif - size_t available = getWriteSpace(); + int available = getWriteSpace(); if (n > available) { #ifdef DEBUG_RINGBUFFER std::cerr << "WARNING: Only room for " << available << " samples" @@ -540,7 +540,7 @@ } if (n == 0) return n; - size_t here = m_size - m_writer; + int here = m_size - m_writer; if (here >= n) { memset(m_buffer + m_writer, 0, n * sizeof(T)); } else {
--- a/base/Selection.cpp Tue Jun 03 11:05:49 2014 +0100 +++ b/base/Selection.cpp Tue Jun 17 13:52:07 2014 +0100 @@ -22,12 +22,12 @@ { } -Selection::Selection(size_t startFrame, size_t endFrame) : +Selection::Selection(int startFrame, int endFrame) : m_startFrame(startFrame), m_endFrame(endFrame) { if (m_startFrame > m_endFrame) { - size_t tmp = m_endFrame; + int tmp = m_endFrame; m_endFrame = m_startFrame; m_startFrame = tmp; } @@ -59,20 +59,20 @@ return m_startFrame == m_endFrame; } -size_t +int Selection::getStartFrame() const { return m_startFrame; } -size_t +int Selection::getEndFrame() const { return m_endFrame; } bool -Selection::contains(size_t frame) const +Selection::contains(int frame) const { return (frame >= m_startFrame) && (frame < m_endFrame); } @@ -174,7 +174,7 @@ } void -MultiSelection::getExtents(size_t &startFrame, size_t &endFrame) const +MultiSelection::getExtents(int &startFrame, int &endFrame) const { startFrame = 0; endFrame = 0; @@ -193,7 +193,7 @@ } Selection -MultiSelection::getContainingSelection(size_t frame, bool defaultToFollowing) const +MultiSelection::getContainingSelection(int frame, bool defaultToFollowing) const { // This scales very badly with the number of selections, but it's // more efficient for very small numbers of selections than a more
--- a/base/Selection.h Tue Jun 03 11:05:49 2014 +0100 +++ b/base/Selection.h Tue Jun 17 13:52:07 2014 +0100 @@ -25,22 +25,22 @@ { public: Selection(); - Selection(size_t startFrame, size_t endFrame); + Selection(int startFrame, int endFrame); Selection(const Selection &); Selection &operator=(const Selection &); virtual ~Selection(); bool isEmpty() const; - size_t getStartFrame() const; - size_t getEndFrame() const; - bool contains(size_t frame) const; + int getStartFrame() const; + int getEndFrame() const; + bool contains(int frame) const; bool operator<(const Selection &) const; bool operator==(const Selection &) const; protected: - size_t m_startFrame; - size_t m_endFrame; + int m_startFrame; + int m_endFrame; }; class MultiSelection : public XmlExportable @@ -57,7 +57,7 @@ void removeSelection(const Selection &selection); void clearSelections(); - void getExtents(size_t &startFrame, size_t &endFrame) const; + void getExtents(int &startFrame, int &endFrame) const; /** * Return the selection that contains a given frame. @@ -65,7 +65,7 @@ * selected area, return the next selection after the given frame. * Return the empty selection if no appropriate selection is found. */ - Selection getContainingSelection(size_t frame, bool defaultToFollowing) const; + Selection getContainingSelection(int frame, bool defaultToFollowing) const; virtual void toXml(QTextStream &stream, QString indent = "", QString extraAttributes = "") const;
--- a/base/StringBits.cpp Tue Jun 03 11:05:49 2014 +0100 +++ b/base/StringBits.cpp Tue Jun 17 13:52:07 2014 +0100 @@ -105,14 +105,14 @@ c = s[i]; switch (mode) { case sep: mode = unq; tok += c; break; - default: tok += c; break; + case unq: case q1: case q2: tok += c; break; } } } else { switch (mode) { case sep: mode = unq; tok += c; break; - default: tok += c; break; + case unq: case q1: case q2: tok += c; break; } } }
--- a/base/ViewManagerBase.h Tue Jun 03 11:05:49 2014 +0100 +++ b/base/ViewManagerBase.h Tue Jun 17 13:52:07 2014 +0100 @@ -37,15 +37,15 @@ virtual void setAudioPlaySource(AudioPlaySource *source) = 0; - virtual size_t alignPlaybackFrameToReference(size_t) const = 0; - virtual size_t alignReferenceToPlaybackFrame(size_t) const = 0; + virtual int alignPlaybackFrameToReference(int) const = 0; + virtual int alignReferenceToPlaybackFrame(int) const = 0; virtual const MultiSelection &getSelection() const = 0; virtual const MultiSelection::SelectionList &getSelections() const = 0; - virtual size_t constrainFrameToSelection(size_t frame) const = 0; + virtual int constrainFrameToSelection(int frame) const = 0; virtual Selection getContainingSelection - (size_t frame, bool defaultToFollowing) const = 0; + (int frame, bool defaultToFollowing) const = 0; virtual bool getPlayLoopMode() const = 0; virtual bool getPlaySelectionMode() const = 0;
--- a/base/Window.h Tue Jun 03 11:05:49 2014 +0100 +++ b/base/Window.h Tue Jun 17 13:52:07 2014 +0100 @@ -47,7 +47,7 @@ * than symmetrical. (A window of size N is equivalent to a * symmetrical window of size N+1 with the final element missing.) */ - Window(WindowType type, size_t size) : m_type(type), m_size(size) { encache(); } + Window(WindowType type, int size) : m_type(type), m_size(size) { encache(); } Window(const Window &w) : m_type(w.m_type), m_size(w.m_size) { encache(); } Window &operator=(const Window &w) { if (&w == this) return *this; @@ -60,14 +60,14 @@ void cut(T *src) const { cut(src, src); } void cut(T *src, T *dst) const { - for (size_t i = 0; i < m_size; ++i) dst[i] = src[i] * m_cache[i]; + for (int i = 0; i < m_size; ++i) dst[i] = src[i] * m_cache[i]; } T getArea() { return m_area; } - T getValue(size_t i) { return m_cache[i]; } + T getValue(int i) { return m_cache[i]; } WindowType getType() const { return m_type; } - size_t getSize() const { return m_size; } + int getSize() const { return m_size; } // The names used by these functions are un-translated, for use in // e.g. XML I/O. Use Preferences::getPropertyValueLabel if you @@ -77,7 +77,7 @@ protected: WindowType m_type; - size_t m_size; + int m_size; T *m_cache; T m_area; @@ -88,7 +88,7 @@ template <typename T> void Window<T>::encache() { - int n = int(m_size); + const int n = m_size; T *mult = new T[n]; int i; for (i = 0; i < n; ++i) mult[i] = 1.0; @@ -164,7 +164,7 @@ template <typename T> void Window<T>::cosinewin(T *mult, T a0, T a1, T a2, T a3) { - int n = int(m_size); + const int n = m_size; for (int i = 0; i < n; ++i) { mult[i] *= (a0 - a1 * cos((2 * M_PI * i) / n)
--- a/base/ZoomConstraint.h Tue Jun 03 11:05:49 2014 +0100 +++ b/base/ZoomConstraint.h Tue Jun 17 13:52:07 2014 +0100 @@ -48,7 +48,7 @@ * summaries at powers-of-two block sizes, return 1024 or 2048 * depending on the rounding direction supplied. */ - virtual size_t getNearestBlockSize(size_t requestedBlockSize, + virtual int getNearestBlockSize(int requestedBlockSize, RoundingDirection = RoundNearest) const { @@ -59,7 +59,7 @@ /** * Return the maximum zoom level within range for this constraint. */ - virtual size_t getMaxZoomLevel() const { return 262144; } + virtual int getMaxZoomLevel() const { return 262144; } }; #endif