Skip to content

Commit

Permalink
Misc: Replace List<> with stl::list<>.
Browse files Browse the repository at this point in the history
  • Loading branch information
rokups committed Apr 17, 2019
1 parent d92415f commit 71a1ba5
Show file tree
Hide file tree
Showing 20 changed files with 119 additions and 642 deletions.
18 changes: 9 additions & 9 deletions Source/Urho3D/Audio/BufferedSoundStream.cpp
Expand Up @@ -42,10 +42,10 @@ unsigned BufferedSoundStream::GetData(signed char* dest, unsigned numBytes)

unsigned outBytes = 0;

while (numBytes && buffers_.Size())
while (numBytes && buffers_.size())
{
// Copy as much from the front buffer as possible, then discard it and move to the next
List<Pair<SharedArrayPtr<signed char>, unsigned> >::Iterator front = buffers_.Begin();
auto front = buffers_.begin();

unsigned copySize = front->second_ - position_;
if (copySize > numBytes)
Expand All @@ -55,7 +55,7 @@ unsigned BufferedSoundStream::GetData(signed char* dest, unsigned numBytes)
position_ += copySize;
if (position_ >= front->second_)
{
buffers_.PopFront();
buffers_.pop_front();
position_ = 0;
}

Expand All @@ -75,7 +75,7 @@ void BufferedSoundStream::AddData(void* data, unsigned numBytes)

SharedArrayPtr<signed char> newBuffer(new signed char[numBytes]);
memcpy(newBuffer.Get(), data, numBytes);
buffers_.Push(MakePair(newBuffer, numBytes));
buffers_.push_back(MakePair(newBuffer, numBytes));
}
}

Expand All @@ -85,7 +85,7 @@ void BufferedSoundStream::AddData(const SharedArrayPtr<signed char>& data, unsig
{
MutexLock lock(bufferMutex_);

buffers_.Push(MakePair(data, numBytes));
buffers_.push_back(MakePair(data, numBytes));
}
}

Expand All @@ -95,15 +95,15 @@ void BufferedSoundStream::AddData(const SharedArrayPtr<signed short>& data, unsi
{
MutexLock lock(bufferMutex_);

buffers_.Push(MakePair(ReinterpretCast<signed char>(data), numBytes));
buffers_.push_back(MakePair(ReinterpretCast<signed char>(data), numBytes));
}
}

void BufferedSoundStream::Clear()
{
MutexLock lock(bufferMutex_);

buffers_.Clear();
buffers_.clear();
position_ = 0;
}

Expand All @@ -112,8 +112,8 @@ unsigned BufferedSoundStream::GetBufferNumBytes() const
MutexLock lock(bufferMutex_);

unsigned ret = 0;
for (List<Pair<SharedArrayPtr<signed char>, unsigned> >::ConstIterator i = buffers_.Begin(); i != buffers_.End(); ++i)
ret += i->second_;
for (const auto& buffer : buffers_)
ret += buffer.second_;
// Subtract amount of sound data played from the front buffer
ret -= position_;

Expand Down
5 changes: 3 additions & 2 deletions Source/Urho3D/Audio/BufferedSoundStream.h
Expand Up @@ -22,9 +22,10 @@

#pragma once

#include <EASTL/list.h>

#include "../Audio/SoundStream.h"
#include "../Container/ArrayPtr.h"
#include "../Container/List.h"
#include "../Core/Mutex.h"
#include "../Container/Pair.h"

Expand Down Expand Up @@ -59,7 +60,7 @@ class URHO3D_API BufferedSoundStream : public SoundStream

private:
/// Buffers and their sizes.
List<Pair<SharedArrayPtr<signed char>, unsigned> > buffers_;
stl::list<Pair<SharedArrayPtr<signed char>, unsigned> > buffers_;
/// Byte position in the front most buffer.
unsigned position_;
/// Mutex for buffer data.
Expand Down
1 change: 0 additions & 1 deletion Source/Urho3D/Container/ForEach.h
Expand Up @@ -23,7 +23,6 @@
#pragma once

#include "../Container/Vector.h"
#include "../Container/List.h"
#include "../Container/HashSet.h"
#include "../Container/HashMap.h"

Expand Down

0 comments on commit 71a1ba5

Please sign in to comment.