diff options
-rw-r--r-- | Alc/ambdec.cpp | 16 | ||||
-rw-r--r-- | Alc/backends/dsound.cpp | 6 | ||||
-rw-r--r-- | Alc/backends/wave.cpp | 8 | ||||
-rw-r--r-- | Alc/backends/winmm.cpp | 7 | ||||
-rw-r--r-- | Alc/effects/chorus.cpp | 10 | ||||
-rw-r--r-- | Alc/effects/echo.cpp | 10 | ||||
-rw-r--r-- | Alc/panning.cpp | 18 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 12 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.cpp | 6 | ||||
-rw-r--r-- | OpenAL32/alBuffer.cpp | 4 | ||||
-rw-r--r-- | OpenAL32/alEffect.cpp | 4 | ||||
-rw-r--r-- | OpenAL32/alFilter.cpp | 4 | ||||
-rw-r--r-- | OpenAL32/alSource.cpp | 5 | ||||
-rw-r--r-- | OpenAL32/event.cpp | 9 |
14 files changed, 61 insertions, 58 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, diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 0f65965a..d44671db 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -146,7 +146,7 @@ typedef ALuint64SOFT ALuint64; inline int msvc64_popcnt64(ALuint64 v) { - return __popcnt64(v); + return (int)__popcnt64(v); } #define POPCNT64 msvc64_popcnt64 @@ -162,7 +162,7 @@ inline int msvc64_ctz64(ALuint64 v) inline int msvc_popcnt64(ALuint64 v) { - return __popcnt((ALuint)v) + __popcnt((ALuint)(v>>32)); + return (int)(__popcnt((ALuint)v) + __popcnt((ALuint)(v>>32))); } #define POPCNT64 msvc_popcnt64 @@ -887,14 +887,14 @@ void SetRTPriority(void); void SetDefaultChannelOrder(ALCdevice *device); void SetDefaultWFXChannelOrder(ALCdevice *device); -const ALCchar *DevFmtTypeString(enum DevFmtType type); -const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans); +const ALCchar *DevFmtTypeString(DevFmtType type); +const ALCchar *DevFmtChannelsString(DevFmtChannels chans); -inline ALint GetChannelIndex(const enum Channel (&names)[MAX_OUTPUT_CHANNELS], enum Channel chan) +inline ALint GetChannelIndex(const Channel (&names)[MAX_OUTPUT_CHANNELS], Channel chan) { auto iter = std::find(std::begin(names), std::end(names), chan); if(iter == std::end(names)) return -1; - return std::distance(std::begin(names), iter); + return static_cast<ALint>(std::distance(std::begin(names), iter)); } /** * GetChannelIdxByName diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp index 1e841c43..db22ca4c 100644 --- a/OpenAL32/alAuxEffectSlot.cpp +++ b/OpenAL32/alAuxEffectSlot.cpp @@ -90,7 +90,7 @@ void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *cont if(start == last) break; ++start; } - newcount = std::distance(newarray->slot, last); + newcount = static_cast<ALsizei>(std::distance(newarray->slot, last)); /* Reallocate newarray if the new size ended up smaller from duplicate * removal. @@ -130,7 +130,7 @@ void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *c [slotids, slotids_end](const ALeffectslot *slot) -> bool { return std::find(slotids, slotids_end, slot->id) == slotids_end; } ); - newarray->count = std::distance(newarray->slot, slotiter); + newarray->count = static_cast<ALsizei>(std::distance(newarray->slot, slotiter)); /* TODO: Could reallocate newarray now that we know it's needed size. */ @@ -225,7 +225,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo } aluInitEffectPanning(iter->get()); - ALuint id = std::distance(context->EffectSlotList.begin(), iter) + 1; + auto id = static_cast<ALuint>(std::distance(context->EffectSlotList.begin(), iter) + 1); (*iter)->id = id; effectslots[cur] = id; } diff --git a/OpenAL32/alBuffer.cpp b/OpenAL32/alBuffer.cpp index dbd48ad0..6bc965c2 100644 --- a/OpenAL32/alBuffer.cpp +++ b/OpenAL32/alBuffer.cpp @@ -59,7 +59,7 @@ ALbuffer *AllocBuffer(ALCcontext *context) { return entry.FreeMask != 0; } ); - auto lidx = std::distance(device->BufferList.begin(), sublist); + auto lidx = static_cast<ALsizei>(std::distance(device->BufferList.begin(), sublist)); ALbuffer *buffer{nullptr}; ALsizei slidx{0}; if(LIKELY(sublist != device->BufferList.end())) @@ -442,7 +442,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) ALbuffer *buffer = AllocBuffer(context.get()); if(!buffer) { - alDeleteBuffers(ids.size(), ids.data()); + alDeleteBuffers(static_cast<ALsizei>(ids.size()), ids.data()); return; } diff --git a/OpenAL32/alEffect.cpp b/OpenAL32/alEffect.cpp index 1c08d402..dd16acfb 100644 --- a/OpenAL32/alEffect.cpp +++ b/OpenAL32/alEffect.cpp @@ -216,7 +216,7 @@ ALeffect *AllocEffect(ALCcontext *context) { return entry.FreeMask != 0; } ); - auto lidx = std::distance(device->EffectList.begin(), sublist); + auto lidx = static_cast<ALsizei>(std::distance(device->EffectList.begin(), sublist)); ALeffect *effect{nullptr}; ALsizei slidx{0}; if(LIKELY(sublist != device->EffectList.end())) @@ -314,7 +314,7 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) ALeffect *effect = AllocEffect(context.get()); if(!effect) { - alDeleteEffects(ids.size(), ids.data()); + alDeleteEffects(static_cast<ALsizei>(ids.size()), ids.data()); return; } diff --git a/OpenAL32/alFilter.cpp b/OpenAL32/alFilter.cpp index 52135569..c4416a38 100644 --- a/OpenAL32/alFilter.cpp +++ b/OpenAL32/alFilter.cpp @@ -276,7 +276,7 @@ ALfilter *AllocFilter(ALCcontext *context) { return entry.FreeMask != 0; } ); - auto lidx = std::distance(device->FilterList.begin(), sublist); + auto lidx = static_cast<ALsizei>(std::distance(device->FilterList.begin(), sublist)); ALfilter *filter{nullptr}; ALsizei slidx{0}; if(LIKELY(sublist != device->FilterList.end())) @@ -375,7 +375,7 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) ALfilter *filter = AllocFilter(context.get()); if(!filter) { - alDeleteFilters(ids.size(), ids.data()); + alDeleteFilters(static_cast<ALsizei>(ids.size()), ids.data()); return; } diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp index f257da83..3697b232 100644 --- a/OpenAL32/alSource.cpp +++ b/OpenAL32/alSource.cpp @@ -468,7 +468,7 @@ ALsource *AllocSource(ALCcontext *context) [](const SourceSubList &entry) -> bool { return entry.FreeMask != 0; } ); - ALsizei lidx = std::distance(context->SourceList.begin(), sublist); + auto lidx = static_cast<ALsizei>(std::distance(context->SourceList.begin(), sublist)); ALsource *source; ALsizei slidx; if(LIKELY(sublist != context->SourceList.end())) @@ -2122,7 +2122,8 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) } ); if(alloc_end != tempids.end()) - alDeleteSources(std::distance(tempids.begin(), alloc_end), tempids.data()); + alDeleteSources(static_cast<ALsizei>(std::distance(tempids.begin(), alloc_end)), + tempids.data()); else std::copy(tempids.cbegin(), tempids.cend(), sources); } diff --git a/OpenAL32/event.cpp b/OpenAL32/event.cpp index ad3fd4ab..6a3dc4bc 100644 --- a/OpenAL32/event.cpp +++ b/OpenAL32/event.cpp @@ -52,7 +52,8 @@ static int EventThread(ALCcontext *context) (evt.u.srcstate.state==AL_PAUSED) ? "AL_PAUSED" : (evt.u.srcstate.state==AL_STOPPED) ? "AL_STOPPED" : "<unknown>"; context->EventCb(AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT, evt.u.srcstate.id, - evt.u.srcstate.state, msg.length(), msg.c_str(), context->EventParam + evt.u.srcstate.state, static_cast<ALsizei>(msg.length()), msg.c_str(), + context->EventParam ); } else if(evt.EnumType == EventType_BufferCompleted) @@ -63,12 +64,14 @@ static int EventThread(ALCcontext *context) if(evt.u.bufcomp.count == 1) msg += " buffer completed"; else msg += " buffers completed"; context->EventCb(AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT, evt.u.bufcomp.id, - evt.u.bufcomp.count, msg.length(), msg.c_str(), context->EventParam + evt.u.bufcomp.count, static_cast<ALsizei>(msg.length()), msg.c_str(), + context->EventParam ); } else if((enabledevts&evt.EnumType) == evt.EnumType) context->EventCb(evt.u.user.type, evt.u.user.id, evt.u.user.param, - (ALsizei)strlen(evt.u.user.msg), evt.u.user.msg, context->EventParam + static_cast<ALsizei>(strlen(evt.u.user.msg)), evt.u.user.msg, + context->EventParam ); } while(ll_ringbuffer_read(context->AsyncEvents, &evt, 1) != 0); } |