aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-12 21:18:31 -0800
committerChris Robinson <[email protected]>2018-12-12 21:18:31 -0800
commitb779ebb512b840a325b32f258261c37bf36a1b7a (patch)
tree4f09621bb0f307601e8ffdfa9e2dc02bc9630421 /Alc
parentb37bc9f8b7c5ff5f25069ae307c0255ec4320458 (diff)
Fix some MSVC conversion warnings
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ambdec.cpp16
-rw-r--r--Alc/backends/dsound.cpp6
-rw-r--r--Alc/backends/wave.cpp8
-rw-r--r--Alc/backends/winmm.cpp7
-rw-r--r--Alc/effects/chorus.cpp10
-rw-r--r--Alc/effects/echo.cpp10
-rw-r--r--Alc/panning.cpp18
7 files changed, 37 insertions, 38 deletions
diff --git a/Alc/ambdec.cpp b/Alc/ambdec.cpp
index c408a2af..d25b8966 100644
--- a/Alc/ambdec.cpp
+++ b/Alc/ambdec.cpp
@@ -57,9 +57,7 @@ bool is_at_end(const std::string &buffer, std::size_t endpos)
{
while(endpos < buffer.length() && std::isspace(buffer[endpos]))
++endpos;
- if(endpos < buffer.length())
- return false;
- return true;
+ return !(endpos < buffer.length());
}
@@ -103,7 +101,7 @@ bool load_ambdec_speakers(AmbDecConf *conf, std::istream &f, std::string &buffer
}
istr.clear();
- std::istream::pos_type endpos{istr.tellg()};
+ const auto endpos = static_cast<std::size_t>(istr.tellg());
if(!is_at_end(buffer, endpos))
{
ERR("Unexpected junk on line: %s\n", buffer.c_str()+endpos);
@@ -182,7 +180,7 @@ bool load_ambdec_matrix(ALfloat *gains, ALfloat (*matrix)[MAX_AMBI_COEFFS], ALsi
}
istr.clear();
- std::istream::pos_type endpos{istr.tellg()};
+ const auto endpos = static_cast<std::size_t>(istr.tellg());
if(!is_at_end(buffer, endpos))
{
ERR("Unexpected junk on line: %s\n", buffer.c_str()+endpos);
@@ -314,7 +312,7 @@ int AmbDecConf::load(const char *fname) noexcept
}
else if(command == "/speakers/{")
{
- std::istream::pos_type endpos{istr.tellg()};
+ const auto endpos = static_cast<std::size_t>(istr.tellg());
if(!is_at_end(buffer, endpos))
{
ERR("Unexpected junk on line: %s\n", buffer.c_str()+endpos);
@@ -341,7 +339,7 @@ int AmbDecConf::load(const char *fname) noexcept
}
else if(command == "/lfmatrix/{" || command == "/hfmatrix/{" || command == "/matrix/{")
{
- std::istream::pos_type endpos{istr.tellg()};
+ const auto endpos = static_cast<std::size_t>(istr.tellg());
if(!is_at_end(buffer, endpos))
{
ERR("Unexpected junk on line: %s\n", buffer.c_str()+endpos);
@@ -394,7 +392,7 @@ int AmbDecConf::load(const char *fname) noexcept
}
else if(command == "/end")
{
- std::istream::pos_type endpos{istr.tellg()};
+ const auto endpos = static_cast<std::size_t>(istr.tellg());
if(!is_at_end(buffer, endpos))
{
ERR("Unexpected junk on end: %s\n", buffer.c_str()+endpos);
@@ -410,7 +408,7 @@ int AmbDecConf::load(const char *fname) noexcept
}
istr.clear();
- std::istream::pos_type endpos{istr.tellg()};
+ const auto endpos = static_cast<std::size_t>(istr.tellg());
if(!is_at_end(buffer, endpos))
{
ERR("Unexpected junk on line: %s\n", buffer.c_str()+endpos);
diff --git a/Alc/backends/dsound.cpp b/Alc/backends/dsound.cpp
index 2bb6048a..79e6b01e 100644
--- a/Alc/backends/dsound.cpp
+++ b/Alc/backends/dsound.cpp
@@ -902,7 +902,7 @@ ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self)
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
if(!device->Connected.load(std::memory_order_acquire))
- return ll_ringbuffer_read_space(self->Ring);
+ return static_cast<ALCuint>(ll_ringbuffer_read_space(self->Ring));
ALsizei FrameSize{FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder)};
DWORD BufferBytes{self->BufferBytes};
@@ -915,7 +915,7 @@ ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self)
if(SUCCEEDED(hr))
{
DWORD NumBytes{(ReadCursor-LastCursor + BufferBytes) % BufferBytes};
- if(!NumBytes) return ll_ringbuffer_read_space(self->Ring);
+ if(!NumBytes) return static_cast<ALCubyte>(ll_ringbuffer_read_space(self->Ring));
hr = self->DSCbuffer->Lock(LastCursor, NumBytes, &ReadPtr1, &ReadCnt1,
&ReadPtr2, &ReadCnt2, 0);
}
@@ -934,7 +934,7 @@ ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self)
aluHandleDisconnect(device, "Failure retrieving capture data: 0x%lx", hr);
}
- return ll_ringbuffer_read_space(self->Ring);
+ return static_cast<ALCuint>(ll_ringbuffer_read_space(self->Ring));
}
} // namespace
diff --git a/Alc/backends/wave.cpp b/Alc/backends/wave.cpp
index 25245a1b..afa948cb 100644
--- a/Alc/backends/wave.cpp
+++ b/Alc/backends/wave.cpp
@@ -155,13 +155,13 @@ int ALCwaveBackend_mixerProc(ALCwaveBackend *self)
if(!IS_LITTLE_ENDIAN)
{
- ALuint bytesize = BytesFromDevFmt(device->FmtType);
- ALuint i;
+ const ALsizei bytesize{BytesFromDevFmt(device->FmtType)};
+ ALsizei i;
if(bytesize == 2)
{
ALushort *samples = reinterpret_cast<ALushort*>(self->mBuffer.data());
- ALuint len = self->mBuffer.size() / 2;
+ const auto len = static_cast<ALsizei>(self->mBuffer.size() / 2);
for(i = 0;i < len;i++)
{
ALushort samp = samples[i];
@@ -171,7 +171,7 @@ int ALCwaveBackend_mixerProc(ALCwaveBackend *self)
else if(bytesize == 4)
{
ALuint *samples = reinterpret_cast<ALuint*>(self->mBuffer.data());
- ALuint len = self->mBuffer.size() / 4;
+ const auto len = static_cast<ALsizei>(self->mBuffer.size() / 4);
for(i = 0;i < len;i++)
{
ALuint samp = samples[i];
diff --git a/Alc/backends/winmm.cpp b/Alc/backends/winmm.cpp
index 32cabbde..0d353906 100644
--- a/Alc/backends/winmm.cpp
+++ b/Alc/backends/winmm.cpp
@@ -361,7 +361,7 @@ ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self)
try {
std::for_each(self->WaveBuffer.begin(), self->WaveBuffer.end(),
[self](WAVEHDR &waveHdr) -> void
- { waveOutPrepareHeader(self->OutHdl, &waveHdr, sizeof(WAVEHDR)); }
+ { waveOutPrepareHeader(self->OutHdl, &waveHdr, static_cast<UINT>(sizeof(WAVEHDR))); }
);
self->Writable.store(self->WaveBuffer.size(), std::memory_order_release);
@@ -581,8 +581,9 @@ ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *deviceName)
// Allocate circular memory buffer for the captured audio
// Make sure circular buffer is at least 100ms in size
- DWORD CapturedDataSize{std::max<DWORD>(device->UpdateSize*device->NumUpdates,
- BufferSize*self->WaveBuffer.size())};
+ auto CapturedDataSize = static_cast<DWORD>(
+ std::max<size_t>(device->UpdateSize*device->NumUpdates, BufferSize*self->WaveBuffer.size())
+ );
self->Ring = ll_ringbuffer_create(CapturedDataSize, self->Format.nBlockAlign, false);
if(!self->Ring) return ALC_INVALID_VALUE;
diff --git a/Alc/effects/chorus.cpp b/Alc/effects/chorus.cpp
index 95f47d36..e0878eb0 100644
--- a/Alc/effects/chorus.cpp
+++ b/Alc/effects/chorus.cpp
@@ -188,11 +188,11 @@ void ChorusState::update(const ALCcontext *Context, const ALeffectslot *Slot, co
void ChorusState::process(ALsizei SamplesToDo, const ALfloat (*RESTRICT SamplesIn)[BUFFERSIZE], ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE], ALsizei NumChannels)
{
- const ALsizei bufmask = mSampleBuffer.size()-1;
- const ALfloat feedback = mFeedback;
- const ALsizei avgdelay = (mDelay + (FRACTIONONE>>1)) >> FRACTIONBITS;
- ALfloat *RESTRICT delaybuf = mSampleBuffer.data();
- ALsizei offset = mOffset;
+ const auto bufmask = static_cast<ALsizei>(mSampleBuffer.size()-1);
+ const ALfloat feedback{mFeedback};
+ const ALsizei avgdelay{(mDelay + (FRACTIONONE>>1)) >> FRACTIONBITS};
+ ALfloat *RESTRICT delaybuf{mSampleBuffer.data()};
+ ALsizei offset{mOffset};
ALsizei i, c;
ALsizei base;
diff --git a/Alc/effects/echo.cpp b/Alc/effects/echo.cpp
index 91bdde9a..3604bed4 100644
--- a/Alc/effects/echo.cpp
+++ b/Alc/effects/echo.cpp
@@ -127,11 +127,11 @@ void ALechoState::update(const ALCcontext *context, const ALeffectslot *slot, co
void ALechoState::process(ALsizei SamplesToDo, const ALfloat (*RESTRICT SamplesIn)[BUFFERSIZE], ALfloat (*RESTRICT SamplesOut)[BUFFERSIZE], ALsizei NumChannels)
{
- const ALsizei mask = mSampleBuffer.size()-1;
- const ALsizei tap1 = mTap[0].delay;
- const ALsizei tap2 = mTap[1].delay;
- ALfloat *RESTRICT delaybuf = mSampleBuffer.data();
- ALsizei offset = mOffset;
+ const auto mask = static_cast<ALsizei>(mSampleBuffer.size()-1);
+ const ALsizei tap1{mTap[0].delay};
+ const ALsizei tap2{mTap[1].delay};
+ ALfloat *RESTRICT delaybuf{mSampleBuffer.data()};
+ ALsizei offset{mOffset};
ALfloat z1, z2;
ALsizei base;
ALsizei c, i;
diff --git a/Alc/panning.cpp b/Alc/panning.cpp
index 6a510e7b..075c6648 100644
--- a/Alc/panning.cpp
+++ b/Alc/panning.cpp
@@ -373,43 +373,43 @@ void InitPanning(ALCdevice *device)
switch(device->FmtChans)
{
case DevFmtMono:
- count = COUNTOF(MonoCfg);
+ count = static_cast<ALsizei>(COUNTOF(MonoCfg));
chanmap = MonoCfg;
coeffcount = 1;
break;
case DevFmtStereo:
- count = COUNTOF(StereoCfg);
+ count = static_cast<ALsizei>(COUNTOF(StereoCfg));
chanmap = StereoCfg;
coeffcount = 4;
break;
case DevFmtQuad:
- count = COUNTOF(QuadCfg);
+ count = static_cast<ALsizei>(COUNTOF(QuadCfg));
chanmap = QuadCfg;
coeffcount = 4;
break;
case DevFmtX51:
- count = COUNTOF(X51SideCfg);
+ count = static_cast<ALsizei>(COUNTOF(X51SideCfg));
chanmap = X51SideCfg;
coeffcount = 9;
break;
case DevFmtX51Rear:
- count = COUNTOF(X51RearCfg);
+ count = static_cast<ALsizei>(COUNTOF(X51RearCfg));
chanmap = X51RearCfg;
coeffcount = 9;
break;
case DevFmtX61:
- count = COUNTOF(X61Cfg);
+ count = static_cast<ALsizei>(COUNTOF(X61Cfg));
chanmap = X61Cfg;
coeffcount = 9;
break;
case DevFmtX71:
- count = COUNTOF(X71Cfg);
+ count = static_cast<ALsizei>(COUNTOF(X71Cfg));
chanmap = X71Cfg;
coeffcount = 16;
break;
@@ -739,7 +739,7 @@ void InitHrtfPanning(ALCdevice *device)
{
AmbiMatrix = AmbiMatrixHOA;
AmbiOrderHFGain = AmbiOrderHFGainHOA;
- count = COUNTOF(IndexMap);
+ count = static_cast<ALsizei>(COUNTOF(IndexMap));
}
device->mHrtfState.reset(
@@ -774,7 +774,7 @@ void InitHrtfPanning(ALCdevice *device)
BuildBFormatHrtf(device->HrtfHandle,
device->mHrtfState.get(), device->Dry.NumChannels, AmbiPoints, AmbiMatrix,
- COUNTOF(AmbiPoints), AmbiOrderHFGain
+ static_cast<ALsizei>(COUNTOF(AmbiPoints)), AmbiOrderHFGain
);
InitNearFieldCtrl(device, device->HrtfHandle->distance, device->AmbiUp ? 2 : 1,