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

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Sat Jan 4 01:08:50 CST 2020


End is allowed to be zero only when start is zero.

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

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/dmime/segment.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c
index b6357b6f5f3..fb5d58ac457 100644
--- a/dlls/dmime/segment.c
+++ b/dlls/dmime/segment.c
@@ -447,15 +447,18 @@ static HRESULT WINAPI IDirectMusicSegment8Impl_GetStartPoint(IDirectMusicSegment
 static HRESULT WINAPI IDirectMusicSegment8Impl_SetLoopPoints(IDirectMusicSegment8 *iface,
         MUSIC_TIME mtStart, MUSIC_TIME mtEnd)
 {
-  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, mtStart, mtEnd);
+
+    if ( !(mtEnd == 0 && mtStart == mtEnd) &&
+        (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;
 }
 
 static HRESULT WINAPI IDirectMusicSegment8Impl_GetLoopPoints(IDirectMusicSegment8 *iface,
-- 
2.24.1




More information about the wine-devel mailing list