summaryrefslogtreecommitdiff
path: root/src/music
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2018-09-23 12:23:54 +0100
committerPeterN <peter@fuzzle.org>2019-03-26 20:15:57 +0000
commita690936ed75e96627be0e2ecafee2360a71e8d3c (patch)
tree1221c131b8fe3a51cf43a6bd7d89a51c431c559d /src/music
parent56ae855dc20b27593c9a454d5a09d8f892a6c71f (diff)
downloadopenttd-a690936ed75e96627be0e2ecafee2360a71e8d3c.tar.xz
Codechange: Replace SmallVector::Length() with std::vector::size()
Diffstat (limited to 'src/music')
-rw-r--r--src/music/dmusic.cpp4
-rw-r--r--src/music/midifile.cpp6
-rw-r--r--src/music/win32_m.cpp4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp
index fece709fd..a03a6ec57 100644
--- a/src/music/dmusic.cpp
+++ b/src/music/dmusic.cpp
@@ -686,7 +686,7 @@ static void MidiThreadProc(void *)
size_t preload_bytes = 0;
for (size_t bl = 0; bl < current_file.blocks.size(); bl++) {
MidiFile::DataBlock &block = current_file.blocks[bl];
- preload_bytes += block.data.Length();
+ preload_bytes += block.data.size();
if (block.ticktime >= current_segment.start) {
if (current_segment.loop) {
DEBUG(driver, 2, "DMusic: timer: loop from block %d (ticktime %d, realtime %.3f, bytes %d)", (int)bl, (int)block.ticktime, ((int)block.realtime) / 1000.0, (int)preload_bytes);
@@ -752,7 +752,7 @@ static void MidiThreadProc(void *)
DEBUG(driver, 9, "DMusic thread: Streaming block " PRINTF_SIZE " (cur=" OTTD_PRINTF64 ", block=" OTTD_PRINTF64 ")", current_block, (long long)(current_time / MS_TO_REFTIME), (long long)(block_time / MS_TO_REFTIME));
byte *data = block.data.Begin();
- size_t remaining = block.data.Length();
+ size_t remaining = block.data.size();
byte last_status = 0;
while (remaining > 0) {
/* MidiFile ought to have converted everything out of running status,
diff --git a/src/music/midifile.cpp b/src/music/midifile.cpp
index 91f83c529..fb3c187c0 100644
--- a/src/music/midifile.cpp
+++ b/src/music/midifile.cpp
@@ -330,14 +330,14 @@ static bool FixupMidiData(MidiFile &target)
uint32 last_ticktime = 0;
for (size_t i = 0; i < target.blocks.size(); i++) {
MidiFile::DataBlock &block = target.blocks[i];
- if (block.data.Length() == 0) {
+ if (block.data.size() == 0) {
continue;
} else if (block.ticktime > last_ticktime || merged_blocks.size() == 0) {
merged_blocks.push_back(block);
last_ticktime = block.ticktime;
} else {
- byte *datadest = merged_blocks.back().data.Append(block.data.Length());
- memcpy(datadest, block.data.Begin(), block.data.Length());
+ byte *datadest = merged_blocks.back().data.Append(block.data.size());
+ memcpy(datadest, block.data.Begin(), block.data.size());
}
}
std::swap(merged_blocks, target.blocks);
diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp
index a32318db1..6d88af4a3 100644
--- a/src/music/win32_m.cpp
+++ b/src/music/win32_m.cpp
@@ -187,7 +187,7 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DW
uint preload_bytes = 0;
for (size_t bl = 0; bl < _midi.current_file.blocks.size(); bl++) {
MidiFile::DataBlock &block = _midi.current_file.blocks[bl];
- preload_bytes += block.data.Length();
+ preload_bytes += block.data.size();
if (block.ticktime >= _midi.current_segment.start) {
if (_midi.current_segment.loop) {
DEBUG(driver, 2, "Win32-MIDI: timer: loop from block %d (ticktime %d, realtime %.3f, bytes %d)", (int)bl, (int)block.ticktime, ((int)block.realtime)/1000.0, (int)preload_bytes);
@@ -230,7 +230,7 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DW
}
byte *data = block.data.Begin();
- size_t remaining = block.data.Length();
+ size_t remaining = block.data.size();
byte last_status = 0;
while (remaining > 0) {
/* MidiFile ought to have converted everything out of running status,