Skip to content

Commit

Permalink
dmime: Rewrite segment IDirectMusicSegment_RemoveTrack.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbernon authored and julliard committed Sep 19, 2023
1 parent f04976e commit 0bdc248
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions dlls/dmime/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,29 +285,24 @@ static HRESULT WINAPI segment_InsertTrack(IDirectMusicSegment8 *iface, IDirectMu
return segment_append_track(This, track, group, 0);
}

static HRESULT WINAPI segment_RemoveTrack(IDirectMusicSegment8 *iface, IDirectMusicTrack *pTrack)
static HRESULT WINAPI segment_RemoveTrack(IDirectMusicSegment8 *iface, IDirectMusicTrack *track)
{
struct segment *This = impl_from_IDirectMusicSegment8(iface);
struct list* pEntry = NULL;
struct track_entry *pIt = NULL;

TRACE("(%p, %p)\n", This, pTrack);

LIST_FOR_EACH (pEntry, &This->tracks) {
pIt = LIST_ENTRY(pEntry, struct track_entry, entry);
if (pIt->pTrack == pTrack) {
TRACE("(%p, %p): track in list\n", This, pTrack);

list_remove(&pIt->entry);
IDirectMusicTrack_Init(pIt->pTrack, NULL);
IDirectMusicTrack_Release(pIt->pTrack);
free(pIt);

return S_OK;
struct segment *This = impl_from_IDirectMusicSegment8(iface);
struct track_entry *entry;

TRACE("(%p, %p)\n", This, track);

LIST_FOR_EACH_ENTRY(entry, &This->tracks, struct track_entry, entry)
{
if (entry->pTrack == track)
{
list_remove(&entry->entry);
track_entry_destroy(entry);
return S_OK;
}
}
}

return S_FALSE;

return S_FALSE;
}

static HRESULT WINAPI segment_InitPlay(IDirectMusicSegment8 *iface,
Expand Down

0 comments on commit 0bdc248

Please sign in to comment.