Skip to content

Commit

Permalink
track/serato: Dump empty QByteArrays when parsed tags are empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Mar 1, 2020
1 parent 2491a6e commit 27871cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/track/serato/markers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ bool SeratoMarkers::parse(SeratoMarkers* seratoMarkers, const QByteArray& data)

QByteArray SeratoMarkers::dump() const {
QByteArray data;
if (isEmpty()) {
// Return empty QByteArray
return data;
}

data.resize(sizeof(quint16) + 2 * sizeof(quint32) + kEntrySize * m_entries.size());

QDataStream stream(&data, QIODevice::WriteOnly);
Expand Down
5 changes: 5 additions & 0 deletions src/track/serato/markers2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ bool SeratoMarkers2::parse(SeratoMarkers2* seratoMarkers2, const QByteArray& out

QByteArray SeratoMarkers2::dump() const {
QByteArray data;
if (isEmpty() && getAllocatedSize() == 0) {
// Return empty QByteArray
return data;
}

QDataStream stream(&data, QIODevice::WriteOnly);
stream.setVersion(QDataStream::Qt_5_0);
stream.setByteOrder(QDataStream::BigEndian);
Expand Down

0 comments on commit 27871cb

Please sign in to comment.