1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

From: martin@steghoefer.eu [PATCH 01/15] Fix runtime problem with wxWidgets 3.0: Correct string formatting: wxLongLong -> %lld + long long

The functions wxString::Format, wxString::Printf (and others indirectly) have become stricter about parameter types that don't match (format specifier vs. function parameters). So the bugs (that were already present in audacity before) become visible in wx3.0 as error message dialogs. I've checked all occurrences of Printf, wxPrintf, PrintfV, Format, FormatV, wxLogDebug and wxLogError systematically and made the type match.

Note: In Shuttle.cpp this patch supersedes one related change done in r13466 because a wxLongLong_t can be bigger than an int and in a generic function like "TransferLongLong" this should be taken into account.
This commit is contained in:
james.k.crook@gmail.com 2014-11-08 16:06:28 +00:00
parent 96531ef766
commit 8305bfdb05
5 changed files with 16 additions and 16 deletions

View File

@ -394,8 +394,8 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
t->GetEndTime();
if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != (sampleCount)nChunks * chunkSize) {
Printf(wxT("Expected len %d, track len %d.\n"), nChunks * chunkSize,
t->GetClipByIndex(0)->GetSequence()->GetNumSamples());
Printf(wxT("Expected len %d, track len %lld.\n"), nChunks * chunkSize,
(long long) t->GetClipByIndex(0)->GetSequence()->GetNumSamples());
goto fail;
}
@ -415,8 +415,8 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
Printf(wxT("Trial %d\n"), z);
Printf(wxT("Cut (%d, %d) failed.\n"), (x0 * chunkSize),
(x0 + xlen) * chunkSize);
Printf(wxT("Expected len %d, track len %d.\n"), nChunks * chunkSize,
t->GetClipByIndex(0)->GetSequence()->GetNumSamples());
Printf(wxT("Expected len %d, track len %lld.\n"), nChunks * chunkSize,
(long long) t->GetClipByIndex(0)->GetSequence()->GetNumSamples());
goto fail;
}
@ -432,8 +432,8 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != (sampleCount) nChunks * chunkSize) {
Printf(wxT("Trial %d\n"), z);
Printf(wxT("Expected len %d, track len %d.\n"), nChunks * chunkSize,
t->GetClipByIndex(0)->GetSequence()->GetNumSamples());
Printf(wxT("Expected len %d, track len %lld.\n"), nChunks * chunkSize,
(long long) t->GetClipByIndex(0)->GetSequence()->GetNumSamples());
goto fail;
}
// Copy

View File

@ -1843,10 +1843,10 @@ void Sequence::DebugPrintf(wxString *dest)
for (i = 0; i < mBlock->GetCount(); i++) {
SeqBlock* pSeqBlock = mBlock->Item(i);
*dest += wxString::Format
(wxT(" Block %3d: start %8d, len %8d, refs %d, "),
(wxT(" Block %3u: start %8lld, len %8lld, refs %d, "),
i,
pSeqBlock->start,
pSeqBlock->f ? pSeqBlock->f->GetLength() : 0,
(long long) pSeqBlock->start,
pSeqBlock->f ? (long long) pSeqBlock->f->GetLength() : 0,
pSeqBlock->f ? mDirManager->GetRefCount(pSeqBlock->f) : 0);
if (pSeqBlock->f)
@ -1864,7 +1864,7 @@ void Sequence::DebugPrintf(wxString *dest)
}
if (pos != mNumSamples)
*dest += wxString::Format
(wxT("ERROR mNumSamples = %d\n"), mNumSamples);
(wxT("ERROR mNumSamples = %lld\n"), (long long) mNumSamples);
}
// static

View File

@ -189,7 +189,7 @@ bool Shuttle::TransferLongLong( const wxString & Name, wxLongLong_t & iValue, co
else
{
/// \todo Fix for long long values.
mValueString = wxString::Format(wxT("%d"),(int) iValue);
mValueString = wxString::Format(wxT("%lld"), (long long) iValue);
return ExchangeWithMaster( Name );
}
return true;

View File

@ -1038,7 +1038,7 @@ bool WaveClip::Append(samplePtr buffer, sampleFormat format,
sampleCount len, unsigned int stride /* = 1 */,
XMLWriter* blockFileLog /*=NULL*/)
{
//wxLogDebug(wxT("Append: len=%i"), len);
//wxLogDebug(wxT("Append: len=%lli"), (long long) len);
sampleCount maxBlockSize = mSequence->GetMaxBlockSize();
sampleCount blockSize = mSequence->GetIdealAppendLen();
@ -1113,8 +1113,8 @@ bool WaveClip::AppendCoded(wxString fName, sampleCount start,
bool WaveClip::Flush()
{
//wxLogDebug(wxT("WaveClip::Flush"));
//wxLogDebug(wxT(" mAppendBufferLen=%i"), mAppendBufferLen);
//wxLogDebug(wxT(" previous sample count %i"), mSequence->GetNumSamples());
//wxLogDebug(wxT(" mAppendBufferLen=%lli"), (long long) mAppendBufferLen);
//wxLogDebug(wxT(" previous sample count %lli"), (long long) mSequence->GetNumSamples());
bool success = true;
if (mAppendBufferLen > 0) {
@ -1126,7 +1126,7 @@ bool WaveClip::Flush()
}
}
//wxLogDebug(wxT("now sample count %i"), mSequence->GetNumSamples());
//wxLogDebug(wxT("now sample count %lli"), (long long) mSequence->GetNumSamples());
return success;
}

View File

@ -183,7 +183,7 @@ bool EffectFindClipping::ProcessOne(LabelTrack * l,
if (stoprun >= mStop) {
l->AddLabel(SelectedRegion(startTime,
t->LongSamplesToTime(start + s - mStop)),
wxString::Format(wxT("%lld of %lld"), startrun, samps - mStop));
wxString::Format(wxT("%lld of %lld"), (long long) startrun, (long long) (samps - mStop)));
startrun = 0;
stoprun = 0;
samps = 0;