[PATCH v2] dmime: IDirectMusicSegment8 SetLoopPoints support zero start/end.

Michael Stefaniuc mstefani at winehq.org
Sat Jan 4 09:44:16 CST 2020


From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>

Both end and start set to zero loop the whole segement.

Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=25728

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
v2:
- Whitespace fixes
- Use nicer parameter names too if we already reindent the function
- Simplify part of the if condition



 dlls/dmime/segment.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c
index b6357b6f5f..0455b6c5dd 100644
--- a/dlls/dmime/segment.c
+++ b/dlls/dmime/segment.c
@@ -445,17 +445,20 @@ static HRESULT WINAPI IDirectMusicSegment8Impl_GetStartPoint(IDirectMusicSegment
 }
 
 static HRESULT WINAPI IDirectMusicSegment8Impl_SetLoopPoints(IDirectMusicSegment8 *iface,
-        MUSIC_TIME mtStart, MUSIC_TIME mtEnd)
+        MUSIC_TIME start, MUSIC_TIME end)
 {
-  IDirectMusicSegment8Impl *This = impl_from_IDirectMusicSegment8(iface);
+    IDirectMusicSegment8Impl *This = impl_from_IDirectMusicSegment8(iface);
 
-  TRACE("(%p, %d, %d)\n", This, mtStart, mtEnd);
-  if (mtStart >= This->header.mtLength || mtEnd > This->header.mtLength || mtStart > mtEnd) {
-    return DMUS_E_OUT_OF_RANGE;
-  }
-  This->header.mtLoopStart = mtStart;
-  This->header.mtLoopEnd   = mtEnd;
-  return S_OK;
+    TRACE("(%p, %d, %d)\n", This, start, end);
+
+    if ((end || start) &&
+            (start >= This->header.mtLength || end > This->header.mtLength || start > end))
+        return DMUS_E_OUT_OF_RANGE;
+
+    This->header.mtLoopStart = start;
+    This->header.mtLoopEnd = end;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI IDirectMusicSegment8Impl_GetLoopPoints(IDirectMusicSegment8 *iface,
-- 
2.24.1




More information about the wine-devel mailing list