[PATCH 7/7] mf: Avoid warning for 'notification' maybe being used uninitialized.
Nikolay Sivov
bunglehead at gmail.com
Sun Jan 26 04:51:21 CST 2020
Does this work?
On Sun, Jan 26, 2020 at 1:02 PM Mathew Hodson <mathew.hodson at gmail.com>
wrote:
> gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
>
> On Sun, Jan 26, 2020 at 4:39 AM Nikolay Sivov <bunglehead at gmail.com>
> wrote:
> >
> > Out-of-range 'command' will cause more problems earlier than this part.
> This should be fixed differently. Which compiler gives this warning?
>
>
>
> --
> Sincerely,
>
> Mathew Hodson
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200126/95b211e9/attachment.htm>
-------------- next part --------------
From f4b4cc6f628c2b394f2d3b1406278f832e7674d3 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun, 26 Jan 2020 13:50:39 +0300
Subject: [PATCH] mf: Simplify clock notifaction handling.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/mf/session.c | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c
index 7a49401d83..1f790a6ed3 100644
--- a/dlls/mf/session.c
+++ b/dlls/mf/session.c
@@ -1976,6 +1976,13 @@ static HRESULT clock_change_state(struct presentation_clock *clock, enum clock_c
/* CLOCK_CMD_PAUSE */ MFCLOCK_STATE_PAUSED,
/* CLOCK_CMD_SET_RATE */ 0, /* Unused */
};
+ static const enum clock_notification notifications[CLOCK_CMD_MAX] =
+ {
+ /* CLOCK_CMD_START */ CLOCK_NOTIFY_START,
+ /* CLOCK_CMD_STOP */ CLOCK_NOTIFY_STOP,
+ /* CLOCK_CMD_PAUSE */ CLOCK_NOTIFY_PAUSE,
+ /* CLOCK_CMD_SET_RATE */ CLOCK_NOTIFY_SET_RATE,
+ };
enum clock_notification notification;
struct clock_sink *sink;
IUnknown *notify_object;
@@ -1994,26 +2001,13 @@ static HRESULT clock_change_state(struct presentation_clock *clock, enum clock_c
system_time = MFGetSystemTime();
- switch (command)
+ if (command == CLOCK_CMD_START && clock->state == MFCLOCK_STATE_PAUSED &&
+ param.u.offset == PRESENTATION_CURRENT_POSITION)
{
- case CLOCK_CMD_START:
- if (clock->state == MFCLOCK_STATE_PAUSED && param.u.offset == PRESENTATION_CURRENT_POSITION)
- notification = CLOCK_NOTIFY_RESTART;
- else
- notification = CLOCK_NOTIFY_START;
- break;
- case CLOCK_CMD_STOP:
- notification = CLOCK_NOTIFY_STOP;
- break;
- case CLOCK_CMD_PAUSE:
- notification = CLOCK_NOTIFY_PAUSE;
- break;
- case CLOCK_CMD_SET_RATE:
- notification = CLOCK_NOTIFY_SET_RATE;
- break;
- default:
- ;
+ notification = CLOCK_NOTIFY_RESTART;
}
+ else
+ notification = notifications[command];
if (FAILED(hr = clock_call_state_change(system_time, param, notification, clock->time_source_sink)))
return hr;
--
2.24.1
More information about the wine-devel
mailing list