1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-15 07:01:18 +02:00

Remove many mentions of sampleCount with auto and decltype...

... This makes much code agnostic about how other things (functions and
arguments) are typed.

Many of these neeed to become size_t instead of sampleCount.
This commit is contained in:
Paul Licameli
2016-08-24 11:24:26 -04:00
parent b8c1d02058
commit 79c79f9cd3
69 changed files with 424 additions and 459 deletions

View File

@@ -367,8 +367,8 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
channels.begin()->get()->SetLinked(true);
}
sampleCount fileTotalFrames = (sampleCount)mInfo.frames;
sampleCount maxBlockSize = channels.begin()->get()->GetMaxBlockSize();
auto fileTotalFrames = (sampleCount)mInfo.frames;
auto maxBlockSize = channels.begin()->get()->GetMaxBlockSize();
int updateResult = false;
// If the format is not seekable, we must use 'copy' mode,
@@ -387,7 +387,8 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
bool useOD =fileTotalFrames>kMinimumODFileSampleSize;
int updateCounter = 0;
for (sampleCount i = 0; i < fileTotalFrames; i += maxBlockSize) {
for (decltype(fileTotalFrames) i = 0; i < fileTotalFrames; i += maxBlockSize) {
const auto blockLen =
limitSampleBufferSize( maxBlockSize, fileTotalFrames - i );
@@ -429,9 +430,10 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
// samples in the tracks.
// PRL: guard against excessive memory buffer allocation in case of many channels
sampleCount maxBlock = std::min(maxBlockSize,
sampleCount(std::numeric_limits<int>::max() /
(mInfo.channels * SAMPLE_SIZE(mFormat)))
using type = decltype(maxBlockSize);
auto maxBlock = std::min(maxBlockSize,
std::numeric_limits<type>::max() /
(mInfo.channels * SAMPLE_SIZE(mFormat))
);
if (maxBlock < 1)
return eProgressFailed;