forked from Mirrors/wine-wine
quartz/systemclock: Use the global HeapAlloc() wrappers.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>stable
parent
b789c44bea
commit
fa26231748
|
@ -31,6 +31,7 @@
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "dshow.h"
|
#include "dshow.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
#include "wine/heap.h"
|
||||||
#include "wine/strmbase.h"
|
#include "wine/strmbase.h"
|
||||||
#include "wine/list.h"
|
#include "wine/list.h"
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ static DWORD WINAPI SystemClockAdviseThread(LPVOID lpParam) {
|
||||||
SetEvent(it->hEvent);
|
SetEvent(it->hEvent);
|
||||||
/** ... and Release it */
|
/** ... and Release it */
|
||||||
QUARTZ_RemoveAviseEntryFromQueue(This, it);
|
QUARTZ_RemoveAviseEntryFromQueue(This, it);
|
||||||
CoTaskMemFree(it);
|
heap_free(it);
|
||||||
it = nextit;
|
it = nextit;
|
||||||
}
|
}
|
||||||
if (NULL != it) timeOut = (DWORD) ((it->rtBaseTime + it->rtIntervalTime) - curTime) / (REFERENCE_TIME)10000;
|
if (NULL != it) timeOut = (DWORD) ((it->rtBaseTime + it->rtIntervalTime) - curTime) / (REFERENCE_TIME)10000;
|
||||||
|
@ -234,7 +234,7 @@ static ULONG WINAPI SystemClockImpl_Release(IReferenceClock* iface) {
|
||||||
}
|
}
|
||||||
This->safe.DebugInfo->Spare[0] = 0;
|
This->safe.DebugInfo->Spare[0] = 0;
|
||||||
DeleteCriticalSection(&This->safe);
|
DeleteCriticalSection(&This->safe);
|
||||||
CoTaskMemFree(This);
|
heap_free(This);
|
||||||
}
|
}
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
@ -279,11 +279,9 @@ static HRESULT WINAPI SystemClockImpl_AdviseTime(IReferenceClock* iface, REFEREN
|
||||||
if (NULL == pdwAdviseCookie) {
|
if (NULL == pdwAdviseCookie) {
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
}
|
}
|
||||||
pEntry = CoTaskMemAlloc(sizeof(SystemClockAdviseEntry));
|
|
||||||
if (NULL == pEntry) {
|
if (!(pEntry = heap_alloc_zero(sizeof(*pEntry))))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
|
||||||
ZeroMemory(pEntry, sizeof(SystemClockAdviseEntry));
|
|
||||||
|
|
||||||
pEntry->hEvent = (HANDLE) hEvent;
|
pEntry->hEvent = (HANDLE) hEvent;
|
||||||
pEntry->rtBaseTime = rtBaseTime + rtStreamTime;
|
pEntry->rtBaseTime = rtBaseTime + rtStreamTime;
|
||||||
|
@ -315,11 +313,9 @@ static HRESULT WINAPI SystemClockImpl_AdvisePeriodic(IReferenceClock* iface, REF
|
||||||
if (NULL == pdwAdviseCookie) {
|
if (NULL == pdwAdviseCookie) {
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
}
|
}
|
||||||
pEntry = CoTaskMemAlloc(sizeof(SystemClockAdviseEntry));
|
|
||||||
if (NULL == pEntry) {
|
if (!(pEntry = heap_alloc_zero(sizeof(*pEntry))))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
|
||||||
ZeroMemory(pEntry, sizeof(SystemClockAdviseEntry));
|
|
||||||
|
|
||||||
pEntry->hEvent = (HANDLE) hSemaphore;
|
pEntry->hEvent = (HANDLE) hSemaphore;
|
||||||
pEntry->rtBaseTime = rtStartTime;
|
pEntry->rtBaseTime = rtStartTime;
|
||||||
|
@ -355,7 +351,7 @@ static HRESULT WINAPI SystemClockImpl_Unadvise(IReferenceClock* iface, DWORD_PTR
|
||||||
}
|
}
|
||||||
|
|
||||||
QUARTZ_RemoveAviseEntryFromQueue(This, pEntry);
|
QUARTZ_RemoveAviseEntryFromQueue(This, pEntry);
|
||||||
CoTaskMemFree(pEntry);
|
heap_free(pEntry);
|
||||||
|
|
||||||
SystemClockPostMessageToAdviseThread(This, ADVISE_REMOVE);
|
SystemClockPostMessageToAdviseThread(This, ADVISE_REMOVE);
|
||||||
|
|
||||||
|
@ -375,23 +371,22 @@ static const IReferenceClockVtbl SystemClock_Vtbl =
|
||||||
SystemClockImpl_Unadvise
|
SystemClockImpl_Unadvise
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv) {
|
HRESULT QUARTZ_CreateSystemClock(IUnknown *outer, void **out)
|
||||||
SystemClockImpl* obj = NULL;
|
{
|
||||||
|
SystemClockImpl *object;
|
||||||
|
|
||||||
TRACE("(%p,%p)\n", ppv, pUnkOuter);
|
TRACE("outer %p, out %p.\n", outer, out);
|
||||||
|
|
||||||
obj = CoTaskMemAlloc(sizeof(SystemClockImpl));
|
|
||||||
if (NULL == obj) {
|
|
||||||
*ppv = NULL;
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
}
|
|
||||||
ZeroMemory(obj, sizeof(SystemClockImpl));
|
|
||||||
|
|
||||||
obj->IReferenceClock_iface.lpVtbl = &SystemClock_Vtbl;
|
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||||
obj->ref = 0; /* will be inited by QueryInterface */
|
{
|
||||||
|
*out = NULL;
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
InitializeCriticalSection(&obj->safe);
|
object->IReferenceClock_iface.lpVtbl = &SystemClock_Vtbl;
|
||||||
obj->safe.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SystemClockImpl.safe");
|
|
||||||
|
|
||||||
return SystemClockImpl_QueryInterface(&obj->IReferenceClock_iface, &IID_IReferenceClock, ppv);
|
InitializeCriticalSection(&object->safe);
|
||||||
|
object->safe.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SystemClockImpl.safe");
|
||||||
|
|
||||||
|
return SystemClockImpl_QueryInterface(&object->IReferenceClock_iface, &IID_IReferenceClock, out);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue