1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-13 14:13:32 +02:00

Clean up some dead code and MSVC warnings.

- Dead code from experiments in SelectionBar removed.
- Many warnings about unused parameters fixed with WXUNUSED()
- Many warnings about signed / unsigned comparisons cleaned up.
- Several 'local variable declared but not used' warnings fixed.
This commit is contained in:
James Crook
2017-12-08 11:26:09 +00:00
parent b63e61d8e9
commit f463eda36c
68 changed files with 216 additions and 510 deletions

View File

@@ -740,10 +740,10 @@ ProgressResult FFmpegImportFileHandle::WriteData(streamContext *sc)
// Separate the channels and convert input sample format to 16-bit
uint8_t *in = sc->m_decodedAudioSamples.get();
int index = 0;
int pos = 0;
unsigned int pos = 0;
while (pos < insamples)
{
for (int chn = 0; chn < sc->m_stream->codec->channels; chn++)
for (size_t chn = 0; chn < (size_t)sc->m_stream->codec->channels; chn++)
{
if (chn < nChannels)
{
@@ -788,7 +788,7 @@ ProgressResult FFmpegImportFileHandle::WriteData(streamContext *sc)
// Write audio into WaveTracks
auto iter2 = iter->begin();
for (int chn=0; chn < nChannels; ++iter2, ++chn)
for (size_t chn=0; chn < nChannels; ++iter2, ++chn)
{
iter2->get()->Append((samplePtr)tmp[chn].get(), sc->m_osamplefmt, index);
}

View File

@@ -478,7 +478,7 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory,
else
block = SFCall<sf_count_t>(sf_readf_float, mFile.get(), (float *)srcbuffer.ptr(), block);
if(block < 0 || block > maxBlock) {
if(block < 0 || block > (long)maxBlock) {
wxASSERT(false);
block = maxBlock;
}

View File

@@ -15,6 +15,7 @@
#include "../Audacity.h"
#include "RawAudioGuess.h"
#include "../AudacityException.h"
#include "../MemoryX.h"
#include <stdio.h>
@@ -187,7 +188,7 @@ static void Extract(bool bits16,
bool stereo,
bool bigendian,
bool offset,
char *rawData, int dataSize,
char *rawData, int dataSizeIn,
float *data1, float *data2, size_t *len1, size_t *len2)
{
size_t rawCount = 0;
@@ -201,14 +202,19 @@ static void Extract(bool bits16,
/* Special case so as to not flip stereo channels during analysis */
if (stereo && !bigendian) {
rawData += 3;
dataSize -= 3;
dataSizeIn -= 3;
}
else {
rawData++;
dataSize--;
dataSizeIn--;
}
}
if( dataSizeIn < 1 )
throw SimpleMessageBoxException{_("Bad data size")};
size_t dataSize = (size_t)dataSizeIn;
if (bits16) {
if (sign && bigendian)
while (rawCount + 1 < dataSize) {
@@ -322,7 +328,7 @@ static int GuessFloatFormats(unsigned numTests, const ArrayOf<char> rawData[], s
* floats with a 1-byte offset.
*/
for(int prec = 0; prec < 2; prec++) {
for(unsigned int prec = 0; prec < 2; prec++) {
for(int endian = 0; endian < 2; endian++) {
for(size_t offset = 0; offset < (4 * prec + 4); offset++) {
unsigned finiteVotes = 0;