Apply code review changes, auto*

This commit is contained in:
Ted John 2022-05-16 23:02:03 +01:00
parent 2effca59d1
commit 6465d42b57
3 changed files with 12 additions and 12 deletions

View File

@ -80,7 +80,7 @@ namespace OpenRCT2::Audio
IAudioSource* CreateStreamFromCSS(std::unique_ptr<IStream> stream, uint32_t index) override
{
auto rw = StreamToSDL2(std::move(stream));
auto* rw = StreamToSDL2(std::move(stream));
if (rw == nullptr)
{
return nullptr;
@ -94,7 +94,7 @@ namespace OpenRCT2::Audio
{
constexpr size_t STREAM_MIN_SIZE = 2 * 1024 * 1024; // 2 MiB
auto loadIntoRAM = stream->GetLength() < STREAM_MIN_SIZE;
auto rw = StreamToSDL2(std::move(stream));
auto* rw = StreamToSDL2(std::move(stream));
if (rw == nullptr)
{
return nullptr;
@ -159,7 +159,7 @@ namespace OpenRCT2::Audio
static SDL_RWops* StreamToSDL2(std::unique_ptr<IStream> stream)
{
auto rw = SDL_AllocRW();
auto* rw = SDL_AllocRW();
if (rw == nullptr)
return nullptr;
*rw = {};
@ -180,7 +180,7 @@ namespace OpenRCT2::Audio
return static_cast<Sint64>(ptr->GetLength());
};
rw->close = [](SDL_RWops* ctx) {
auto ptr = static_cast<IStream*>(ctx->hidden.unknown.data1);
auto* ptr = static_cast<IStream*>(ctx->hidden.unknown.data1);
delete ptr;
ctx->hidden.unknown.data1 = nullptr;
delete ctx;

View File

@ -38,7 +38,7 @@ void AudioMixer::Init(const char* device)
want.channels = 2;
want.samples = 2048;
want.callback = [](void* arg, uint8_t* dst, int32_t length) -> void {
auto mixer = static_cast<AudioMixer*>(arg);
auto* mixer = static_cast<AudioMixer*>(arg);
mixer->GetNextAudioChunk(dst, static_cast<size_t>(length));
mixer->RemoveReleasedSources();
};
@ -88,7 +88,7 @@ void AudioMixer::Unlock()
IAudioChannel* AudioMixer::Play(IAudioSource* source, int32_t loop, bool deleteondone)
{
Lock();
ISDLAudioChannel* channel = AudioChannel::Create();
auto* channel = AudioChannel::Create();
if (channel != nullptr)
{
channel->Play(source, loop);

View File

@ -90,7 +90,7 @@ namespace OpenRCT2::Audio
}
auto& objManager = GetContext()->GetObjectManager();
auto baseAudio = objManager.LoadObject(AudioObjectIdentifiers::Rct2Base);
auto* baseAudio = objManager.LoadObject(AudioObjectIdentifiers::Rct2Base);
if (baseAudio != nullptr)
{
_soundsAudioObjectEntryIndex = objManager.GetLoadedObjectEntryIndex(baseAudio);
@ -170,7 +170,7 @@ namespace OpenRCT2::Audio
AudioObject* GetBaseAudioObject()
{
auto& objManager = GetContext()->GetObjectManager();
auto baseAudioObject = static_cast<AudioObject*>(
auto* baseAudioObject = static_cast<AudioObject*>(
objManager.GetLoadedObject(ObjectType::Audio, _soundsAudioObjectEntryIndex));
return baseAudioObject;
}
@ -194,7 +194,7 @@ namespace OpenRCT2::Audio
return;
// Get sound from base object
auto baseAudioObject = GetBaseAudioObject();
auto* baseAudioObject = GetBaseAudioObject();
if (baseAudioObject != nullptr)
{
auto params = GetParametersFromLocation(baseAudioObject, EnumValue(soundId), loc);
@ -215,7 +215,7 @@ namespace OpenRCT2::Audio
return;
// Get sound from base object
auto baseAudioObject = GetBaseAudioObject();
auto* baseAudioObject = GetBaseAudioObject();
if (baseAudioObject != nullptr)
{
auto source = baseAudioObject->GetSample(EnumValue(soundId));
@ -259,7 +259,7 @@ namespace OpenRCT2::Audio
// Load title sequence audio object
auto descriptor = GetTitleMusicDescriptor();
auto& objManager = GetContext()->GetObjectManager();
auto audioObject = static_cast<AudioObject*>(objManager.LoadObject(descriptor));
auto* audioObject = static_cast<AudioObject*>(objManager.LoadObject(descriptor));
if (audioObject != nullptr)
{
_titleAudioObjectEntryIndex = objManager.GetLoadedObjectEntryIndex(audioObject);
@ -318,7 +318,7 @@ namespace OpenRCT2::Audio
if (_titleAudioObjectEntryIndex != OBJECT_ENTRY_INDEX_NULL)
{
auto& objManager = GetContext()->GetObjectManager();
auto obj = objManager.GetLoadedObject(ObjectType::Audio, _titleAudioObjectEntryIndex);
auto* obj = objManager.GetLoadedObject(ObjectType::Audio, _titleAudioObjectEntryIndex);
if (obj != nullptr)
{
objManager.UnloadObjects({ obj->GetDescriptor() });