Skip to content

Commit 0a93c69

Browse files
rbernonjulliard
authored andcommitted
dmime: Rename DMUS_PMSGToItem to message_from_DMUS_PMSG.
1 parent 61ebdbc commit 0a93c69

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

dlls/dmime/performance.c

+15-15
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,13 @@ struct performance
7272
struct message
7373
{
7474
struct list entry;
75-
DMUS_PMSG pMsg;
75+
DMUS_PMSG msg;
7676
};
7777

78-
#define DMUS_PMSGToItem(pMSG) ((struct message *)(((unsigned char *)pMSG) - offsetof(struct message, pMsg)))
78+
static inline struct message *message_from_DMUS_PMSG(DMUS_PMSG *msg)
79+
{
80+
return msg ? CONTAINING_RECORD(msg, struct message, msg) : NULL;
81+
}
7982

8083
#define PROCESSMSG_START (WM_APP + 0)
8184
#define PROCESSMSG_EXIT (WM_APP + 1)
@@ -85,17 +88,17 @@ struct message
8588

8689
static struct message *ProceedMsg(struct performance *This, struct message *cur)
8790
{
88-
if (cur->pMsg.dwType == DMUS_PMSGT_NOTIFICATION) {
91+
if (cur->msg.dwType == DMUS_PMSGT_NOTIFICATION) {
8992
SetEvent(This->hNotification);
9093
}
9194
list_remove(&cur->entry);
9295
list_init(&cur->entry);
93-
switch (cur->pMsg.dwType) {
96+
switch (cur->msg.dwType) {
9497
case DMUS_PMSGT_WAVE:
9598
case DMUS_PMSGT_TEMPO:
9699
case DMUS_PMSGT_STOP:
97100
default:
98-
FIXME("Unhandled PMsg Type: %#lx\n", cur->pMsg.dwType);
101+
FIXME("Unhandled PMsg Type: %#lx\n", cur->msg.dwType);
99102
break;
100103
}
101104
return cur;
@@ -130,8 +133,8 @@ static DWORD WINAPI ProcessMsgThread(LPVOID lpParam) {
130133

131134
LIST_FOR_EACH_ENTRY_SAFE(message, next, &This->queued_messages, struct message, entry)
132135
{
133-
timeOut = (message->pMsg.rtTime - rtCurTime) + This->rtLatencyTime;
134-
if (message->pMsg.rtTime >= rtCurTime + dwDec) break;
136+
timeOut = (message->msg.rtTime - rtCurTime) + This->rtLatencyTime;
137+
if (message->msg.rtTime >= rtCurTime + dwDec) break;
135138
cur = ProceedMsg(This, message);
136139
free(cur);
137140
}
@@ -393,15 +396,13 @@ static HRESULT WINAPI performance_SendPMsg(IDirectMusicPerformance8 *iface, DMUS
393396

394397
FIXME("(%p, %p): semi-stub\n", This, msg);
395398

396-
if (!msg) return E_POINTER;
399+
if (!(message = message_from_DMUS_PMSG(msg))) return E_POINTER;
397400
if (!This->dmusic) return DMUS_E_NO_MASTER_CLOCK;
398401
if (!(msg->dwFlags & (DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_REFTIME))) return E_INVALIDARG;
399402

400403
if (msg->dwFlags & DMUS_PMSGF_TOOL_IMMEDIATE) queue = &This->immediate_messages;
401404
else queue = &This->queued_messages;
402405

403-
message = DMUS_PMSGToItem(msg);
404-
405406
EnterCriticalSection(&This->safe);
406407

407408
if (!list_empty(&message->entry))
@@ -424,7 +425,7 @@ static HRESULT WINAPI performance_SendPMsg(IDirectMusicPerformance8 *iface, DMUS
424425
}
425426

426427
LIST_FOR_EACH_ENTRY(next, queue, struct message, entry)
427-
if (next->pMsg.rtTime >= message->pMsg.rtTime) break;
428+
if (next->msg.rtTime >= message->msg.rtTime) break;
428429
list_add_before(&next->entry, &message->entry);
429430

430431
hr = S_OK;
@@ -511,9 +512,9 @@ static HRESULT WINAPI performance_AllocPMsg(IDirectMusicPerformance8 *iface, ULO
511512
if (size < sizeof(DMUS_PMSG)) return E_INVALIDARG;
512513

513514
if (!(message = calloc(1, size - sizeof(DMUS_PMSG) + sizeof(struct message)))) return E_OUTOFMEMORY;
514-
message->pMsg.dwSize = size;
515+
message->msg.dwSize = size;
515516
list_init(&message->entry);
516-
*msg = &message->pMsg;
517+
*msg = &message->msg;
517518

518519
return S_OK;
519520
}
@@ -526,8 +527,7 @@ static HRESULT WINAPI performance_FreePMsg(IDirectMusicPerformance8 *iface, DMUS
526527

527528
TRACE("(%p, %p)\n", This, msg);
528529

529-
if (!msg) return E_POINTER;
530-
message = DMUS_PMSGToItem(msg);
530+
if (!(message = message_from_DMUS_PMSG(msg))) return E_POINTER;
531531

532532
EnterCriticalSection(&This->safe);
533533
hr = !list_empty(&message->entry) ? DMUS_E_CANNOT_FREE : S_OK;

0 commit comments

Comments
 (0)