aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-09-11 06:47:56 -0700
committerChris Robinson <[email protected]>2019-09-11 06:47:56 -0700
commitbe0442c6207cc10fca079a803bbdd8985959b657 (patch)
treef454f679117428575d639e5b386104495889fe85 /utils
parent388928f3aa1ecf1a4f930c27687e7d0d4a9fd824 (diff)
Avoid C-style casts in C++
Diffstat (limited to 'utils')
-rw-r--r--utils/makemhr/loaddef.cpp12
-rw-r--r--utils/makemhr/loadsofa.cpp2
-rw-r--r--utils/sofa-info.cpp2
3 files changed, 8 insertions, 8 deletions
diff --git a/utils/makemhr/loaddef.cpp b/utils/makemhr/loaddef.cpp
index 89893e38..5f6d76d8 100644
--- a/utils/makemhr/loaddef.cpp
+++ b/utils/makemhr/loaddef.cpp
@@ -1047,7 +1047,7 @@ static int LoadWaveSource(FILE *fp, SourceRefT *src, const uint hrirRate, const
// Load a Spatially Oriented Format for Accoustics (SOFA) file.
static MYSOFA_EASY* LoadSofaFile(SourceRefT *src, const uint hrirRate, const uint n)
{
- struct MYSOFA_EASY *sofa{mysofa_cache_lookup(src->mPath, (float)hrirRate)};
+ struct MYSOFA_EASY *sofa{mysofa_cache_lookup(src->mPath, static_cast<float>(hrirRate))};
if(sofa) return sofa;
sofa = static_cast<MYSOFA_EASY*>(calloc(1, sizeof(*sofa)));
@@ -1096,7 +1096,7 @@ static MYSOFA_EASY* LoadSofaFile(SourceRefT *src, const uint hrirRate, const uin
fprintf(stderr, "\nError: Out of memory.\n");
return nullptr;
}
- return mysofa_cache_store(sofa, src->mPath, (float)hrirRate);
+ return mysofa_cache_store(sofa, src->mPath, static_cast<float>(hrirRate));
}
// Copies the HRIR data from a particular SOFA measurement.
@@ -1532,7 +1532,7 @@ static int ReadSourceRef(TokenReaderT *tr, SourceRefT *src)
src->mType = ET_NONE;
src->mSize = 0;
src->mBits = 0;
- src->mChannel = (uint)intVal;
+ src->mChannel = static_cast<uint>(intVal);
src->mSkip = 0;
}
else if(src->mFormat == SF_WAVE)
@@ -1666,7 +1666,7 @@ static int ReadSofaRef(TokenReaderT *tr, SourceRefT *src)
TrReadOperator(tr, "@");
if(!TrReadInt(tr, 0, 0x7FFFFFFF, &intVal))
return 0;
- src->mOffset = (uint)intVal;
+ src->mOffset = static_cast<uint>(intVal);
}
else
src->mOffset = 0;
@@ -1834,13 +1834,13 @@ static int ProcessSources(TokenReaderT *tr, HrirDataT *hData)
continue;
double ef{(90.0 + aer[1]) * (hData->mFds[fi].mEvCount - 1) / 180.0};
- ei = (uint)std::round(ef);
+ ei = static_cast<uint>(std::round(ef));
ef = (ef - ei) * 180.0f / (hData->mFds[fi].mEvCount - 1);
if(std::abs(ef) >= 0.1)
continue;
double af{aer[0] * hData->mFds[fi].mEvs[ei].mAzCount / 360.0f};
- ai = (uint)std::round(af);
+ ai = static_cast<uint>(std::round(af));
af = (af - ai) * 360.0f / hData->mFds[fi].mEvs[ei].mAzCount;
ai = ai % hData->mFds[fi].mEvs[ei].mAzCount;
if(std::abs(af) >= 0.1)
diff --git a/utils/makemhr/loadsofa.cpp b/utils/makemhr/loadsofa.cpp
index 7fb169e2..e82376aa 100644
--- a/utils/makemhr/loadsofa.cpp
+++ b/utils/makemhr/loadsofa.cpp
@@ -221,7 +221,7 @@ static bool PrepareLayout(const uint m, const float *xyzs, HrirDataT *hData)
float ev{90.0f + elems[ei]};
float eif{std::round(ev / step)};
- if(std::fabs(eif - (uint)eif) < (0.1f / step))
+ if(std::fabs(eif - static_cast<uint>(eif)) < (0.1f / step))
{
evStart = static_cast<uint>(eif);
break;
diff --git a/utils/sofa-info.cpp b/utils/sofa-info.cpp
index 83e3d065..e9f2257c 100644
--- a/utils/sofa-info.cpp
+++ b/utils/sofa-info.cpp
@@ -242,7 +242,7 @@ static void PrintCompatibleLayout(const uint m, const float *xyzs)
float ev{90.0f + elems[ei]};
float eif{std::round(ev / step)};
- if(std::fabs(eif - (uint)eif) < (0.1f / step))
+ if(std::fabs(eif - static_cast<uint>(eif)) < (0.1f / step))
{
evStart = static_cast<uint>(eif);
break;