diff options
author | Chris Robinson <[email protected]> | 2023-01-31 04:02:58 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-01-31 04:02:58 -0800 |
commit | 58c8f5720d7a9fa1b4fd5276d01b2fb69444ca7b (patch) | |
tree | b5a45b04abd7fca74868b1b667db72626638117d | |
parent | 4021cccc3e735d707be83fd431473f57614a13d7 (diff) |
Make sure a variable is set before use
-rw-r--r-- | utils/makemhr/loaddef.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/utils/makemhr/loaddef.cpp b/utils/makemhr/loaddef.cpp index ea38b8c9..e8092363 100644 --- a/utils/makemhr/loaddef.cpp +++ b/utils/makemhr/loaddef.cpp @@ -1745,12 +1745,11 @@ static void AverageHrirMagnitude(const uint points, const uint n, const double * // Process the list of sources in the data set definition. static int ProcessSources(TokenReaderT *tr, HrirDataT *hData, const uint outRate) { - uint channels = (hData->mChannelType == CT_STEREO) ? 2 : 1; + const uint channels{(hData->mChannelType == CT_STEREO) ? 2u : 1u}; hData->mHrirsBase.resize(channels * hData->mIrCount * hData->mIrSize); double *hrirs = hData->mHrirsBase.data(); auto hrir = std::make_unique<double[]>(hData->mIrSize); uint line, col, fi, ei, ai; - int count; std::vector<double> onsetSamples(OnsetRateMultiple * hData->mIrPoints); PPhaseResampler onsetResampler; @@ -1766,7 +1765,7 @@ static int ProcessSources(TokenReaderT *tr, HrirDataT *hData, const uint outRate printf("Loading sources..."); fflush(stdout); - count = 0; + int count{0}; while(TrIsOperator(tr, "[")) { double factor[2]{ 1.0, 1.0 }; @@ -1853,6 +1852,7 @@ static int ProcessSources(TokenReaderT *tr, HrirDataT *hData, const uint outRate { return (std::abs(aer[2] - fld.mDistance) < 0.001); }); if(field == hData->mFds.cend()) continue; + fi = static_cast<uint>(std::distance(hData->mFds.cbegin(), field)); const double evscale{180.0 / static_cast<double>(field->mEvs.size()-1)}; double ef{(90.0 + aer[1]) / evscale}; |