mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use appropriate integer types
This commit is contained in:
parent
683fc90ea7
commit
a277419855
|
@ -28,7 +28,7 @@ private:
|
|||
|
||||
int _group = MIXER_GROUP_SOUND;
|
||||
double _rate = 0;
|
||||
size_t _offset = 0;
|
||||
uint64 _offset = 0;
|
||||
int _loop = 0;
|
||||
|
||||
int _volume = 1;
|
||||
|
@ -100,12 +100,12 @@ public:
|
|||
_rate = Math::Max(0.001, rate);
|
||||
}
|
||||
|
||||
unsigned long GetOffset() const override
|
||||
uint64 GetOffset() const override
|
||||
{
|
||||
return (unsigned long)_offset;
|
||||
return _offset;
|
||||
}
|
||||
|
||||
bool SetOffset(unsigned long offset) override
|
||||
bool SetOffset(uint64 offset) override
|
||||
{
|
||||
if (_source != nullptr && offset < _source->GetLength())
|
||||
{
|
||||
|
|
|
@ -42,8 +42,8 @@ interface IAudioChannel
|
|||
virtual double GetRate() const abstract;
|
||||
virtual void SetRate(double rate) abstract;
|
||||
|
||||
virtual unsigned long GetOffset() const abstract;
|
||||
virtual bool SetOffset(unsigned long offset) abstract;
|
||||
virtual uint64 GetOffset() const abstract;
|
||||
virtual bool SetOffset(uint64 offset) abstract;
|
||||
|
||||
virtual int GetLoop() const abstract;
|
||||
virtual void SetLoop(int value) abstract;
|
||||
|
|
|
@ -27,9 +27,9 @@ interface IAudioSource
|
|||
{
|
||||
virtual ~IAudioSource() = default;
|
||||
|
||||
virtual size_t GetLength() abstract;
|
||||
virtual uint64 GetLength() abstract;
|
||||
virtual AudioFormat GetFormat() abstract;
|
||||
virtual size_t Read(void * dst, size_t offset, size_t len) abstract;
|
||||
virtual size_t Read(void * dst, uint64 offset, size_t len) abstract;
|
||||
};
|
||||
|
||||
namespace AudioSource
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
Unload();
|
||||
}
|
||||
|
||||
size_t GetLength() override
|
||||
uint64 GetLength() override
|
||||
{
|
||||
return _dataLength;
|
||||
}
|
||||
|
@ -58,13 +58,13 @@ public:
|
|||
return _format;
|
||||
}
|
||||
|
||||
size_t Read(void * dst, size_t offset, size_t len) override
|
||||
size_t Read(void * dst, uint64 offset, size_t len) override
|
||||
{
|
||||
size_t bytesRead = 0;
|
||||
sint64 currentPosition = SDL_RWtell(_rw);
|
||||
if (currentPosition != -1)
|
||||
{
|
||||
size_t bytesToRead = Math::Min<size_t>(len, _dataLength - offset);
|
||||
size_t bytesToRead = (size_t)Math::Min<uint64>(len, _dataLength - offset);
|
||||
sint64 dataOffset = _dataBegin + offset;
|
||||
if (currentPosition != dataOffset)
|
||||
{
|
||||
|
@ -95,8 +95,8 @@ public:
|
|||
}
|
||||
_rw = rw;
|
||||
|
||||
Uint32 chunk_id = SDL_ReadLE32(rw);
|
||||
if (chunk_id != RIFF)
|
||||
Uint32 chunkId = SDL_ReadLE32(rw);
|
||||
if (chunkId != RIFF)
|
||||
{
|
||||
log_verbose("Not a WAV file");
|
||||
return false;
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
Unload();
|
||||
}
|
||||
|
||||
size_t GetLength() override
|
||||
uint64 GetLength() override
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
|
@ -61,12 +61,12 @@ public:
|
|||
return _format;
|
||||
}
|
||||
|
||||
size_t Read(void * dst, size_t offset, size_t len) override
|
||||
size_t Read(void * dst, uint64 offset, size_t len) override
|
||||
{
|
||||
size_t bytesToRead = 0;
|
||||
if (offset < _length)
|
||||
{
|
||||
bytesToRead = Math::Min(len, _length - offset);
|
||||
bytesToRead = (size_t)Math::Min<uint64>(len, _length - offset);
|
||||
Memory::Copy<void>(dst, _data + offset, bytesToRead);
|
||||
}
|
||||
return bytesToRead;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
class NullAudioSource : public IAudioSource
|
||||
{
|
||||
public:
|
||||
size_t GetLength() override
|
||||
uint64 GetLength() override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public:
|
|||
return { 0 };
|
||||
}
|
||||
|
||||
size_t Read(void * dst, size_t offset, size_t len) override
|
||||
size_t Read(void * dst, uint64 offset, size_t len) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -594,9 +594,9 @@ int Mixer_Channel_IsPlaying(void * channel)
|
|||
return isPlaying;
|
||||
}
|
||||
|
||||
unsigned long Mixer_Channel_GetOffset(void * channel)
|
||||
uint64 Mixer_Channel_GetOffset(void * channel)
|
||||
{
|
||||
unsigned long offset = 0;
|
||||
uint64 offset = 0;
|
||||
if (!gOpenRCT2Headless)
|
||||
{
|
||||
offset = static_cast<IAudioChannel*>(channel)->GetOffset();
|
||||
|
@ -604,7 +604,7 @@ unsigned long Mixer_Channel_GetOffset(void * channel)
|
|||
return offset;
|
||||
}
|
||||
|
||||
int Mixer_Channel_SetOffset(void * channel, unsigned long offset)
|
||||
int Mixer_Channel_SetOffset(void * channel, uint64 offset)
|
||||
{
|
||||
int result = 0;
|
||||
if (!gOpenRCT2Headless)
|
||||
|
|
|
@ -83,8 +83,8 @@ void Mixer_Channel_Volume(void* channel, int volume);
|
|||
void Mixer_Channel_Pan(void* channel, float pan);
|
||||
void Mixer_Channel_Rate(void* channel, double rate);
|
||||
int Mixer_Channel_IsPlaying(void* channel);
|
||||
unsigned long Mixer_Channel_GetOffset(void* channel);
|
||||
int Mixer_Channel_SetOffset(void* channel, unsigned long offset);
|
||||
uint64 Mixer_Channel_GetOffset(void* channel);
|
||||
int Mixer_Channel_SetOffset(void* channel, uint64 offset);
|
||||
void Mixer_Channel_SetGroup(void* channel, int group);
|
||||
void* Mixer_Play_Music(int pathId, int loop, int streaming);
|
||||
void Mixer_SetVolume(float volume);
|
||||
|
|
|
@ -3547,7 +3547,7 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint
|
|||
*tuneId = 0xFF;
|
||||
return 0;
|
||||
}
|
||||
a1 = Mixer_Channel_GetOffset(gRideMusicList[channel].sound_channel);
|
||||
a1 = (uint32)Mixer_Channel_GetOffset(gRideMusicList[channel].sound_channel);
|
||||
label51:
|
||||
if (a1 < gRideMusicInfoList[*tuneId]->length) {
|
||||
position = a1;
|
||||
|
|
Loading…
Reference in New Issue