mirror of
https://github.com/taglib/taglib.git
synced 2026-02-14 20:23:03 -05:00
Merge pull request #422 from TsudaKageyu/detach
Added some missing detach()s to List<T>, ByteVector and String.
This commit is contained in:
@ -711,7 +711,8 @@ ByteVector &ByteVector::resize(uint size, char padding)
|
||||
|
||||
ByteVector::Iterator ByteVector::begin()
|
||||
{
|
||||
return d->data->data.begin() + d->offset;
|
||||
detach();
|
||||
return d->data->data.begin();
|
||||
}
|
||||
|
||||
ByteVector::ConstIterator ByteVector::begin() const
|
||||
@ -721,7 +722,8 @@ ByteVector::ConstIterator ByteVector::begin() const
|
||||
|
||||
ByteVector::Iterator ByteVector::end()
|
||||
{
|
||||
return d->data->data.begin() + d->offset + d->length;
|
||||
detach();
|
||||
return d->data->data.end();
|
||||
}
|
||||
|
||||
ByteVector::ConstIterator ByteVector::end() const
|
||||
@ -731,8 +733,8 @@ ByteVector::ConstIterator ByteVector::end() const
|
||||
|
||||
ByteVector::ReverseIterator ByteVector::rbegin()
|
||||
{
|
||||
std::vector<char> &v = d->data->data;
|
||||
return v.rbegin() + (v.size() - (d->offset + d->length));
|
||||
detach();
|
||||
return d->data->data.rbegin();
|
||||
}
|
||||
|
||||
ByteVector::ConstReverseIterator ByteVector::rbegin() const
|
||||
@ -743,8 +745,8 @@ ByteVector::ConstReverseIterator ByteVector::rbegin() const
|
||||
|
||||
ByteVector::ReverseIterator ByteVector::rend()
|
||||
{
|
||||
std::vector<char> &v = d->data->data;
|
||||
return v.rbegin() + (v.size() - d->offset);
|
||||
detach();
|
||||
return d->data->data.rend();
|
||||
}
|
||||
|
||||
ByteVector::ConstReverseIterator ByteVector::rend() const
|
||||
|
||||
@ -208,6 +208,7 @@ bool List<T>::isEmpty() const
|
||||
template <class T>
|
||||
typename List<T>::Iterator List<T>::find(const T &value)
|
||||
{
|
||||
detach();
|
||||
return std::find(d->list.begin(), d->list.end(), value);
|
||||
}
|
||||
|
||||
|
||||
@ -316,6 +316,7 @@ const wchar_t *String::toCWString() const
|
||||
|
||||
String::Iterator String::begin()
|
||||
{
|
||||
detach();
|
||||
return d->data.begin();
|
||||
}
|
||||
|
||||
@ -326,6 +327,7 @@ String::ConstIterator String::begin() const
|
||||
|
||||
String::Iterator String::end()
|
||||
{
|
||||
detach();
|
||||
return d->data.end();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user