Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/buffer.c | 6 +++--- dlls/mfplat/main.c | 10 +++++----- dlls/mfplat/mfplat_private.h | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c index ea89bcb1f5..4bbb36b683 100644 --- a/dlls/mfplat/buffer.c +++ b/dlls/mfplat/buffer.c @@ -663,7 +663,7 @@ HRESULT WINAPI MFCreateMediaBufferFromMediaType(IMFMediaType *media_type, LONGLO HRESULT hr; GUID major;
- TRACE("%p, %s, %u, %u, %p.\n", media_type, wine_dbgstr_longlong(duration), min_length, alignment, buffer); + TRACE("%p, %s, %u, %u, %p.\n", media_type, debugstr_time(duration), min_length, alignment, buffer);
if (!media_type) return E_INVALIDARG; @@ -1075,7 +1075,7 @@ static HRESULT WINAPI sample_SetSampleTime(IMFSample *iface, LONGLONG timestamp) { struct sample *sample = impl_from_IMFSample(iface);
- TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(timestamp)); + TRACE("%p, %s.\n", iface, debugstr_time(timestamp));
EnterCriticalSection(&sample->attributes.cs); sample->timestamp = timestamp; @@ -1106,7 +1106,7 @@ static HRESULT WINAPI sample_SetSampleDuration(IMFSample *iface, LONGLONG durati { struct sample *sample = impl_from_IMFSample(iface);
- TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(duration)); + TRACE("%p, %s.\n", iface, debugstr_time(duration));
EnterCriticalSection(&sample->attributes.cs); sample->duration = duration; diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 3368ab0969..66bdc505f0 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -8015,7 +8015,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockStart(IMFClockStateSink *if struct system_time_source *source = impl_from_IMFClockStateSink(iface); HRESULT hr;
- TRACE("%p, %s, %s.\n", iface, wine_dbgstr_longlong(system_time), wine_dbgstr_longlong(start_offset)); + TRACE("%p, %s, %s.\n", iface, debugstr_time(system_time), debugstr_time(start_offset));
EnterCriticalSection(&source->cs); if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_START))) @@ -8033,7 +8033,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockStop(IMFClockStateSink *ifa struct system_time_source *source = impl_from_IMFClockStateSink(iface); HRESULT hr;
- TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(system_time)); + TRACE("%p, %s.\n", iface, debugstr_time(system_time));
EnterCriticalSection(&source->cs); if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_STOP))) @@ -8048,7 +8048,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockPause(IMFClockStateSink *if struct system_time_source *source = impl_from_IMFClockStateSink(iface); HRESULT hr;
- TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(system_time)); + TRACE("%p, %s.\n", iface, debugstr_time(system_time));
EnterCriticalSection(&source->cs); if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_PAUSE))) @@ -8066,7 +8066,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockRestart(IMFClockStateSink * struct system_time_source *source = impl_from_IMFClockStateSink(iface); HRESULT hr;
- TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(system_time)); + TRACE("%p, %s.\n", iface, debugstr_time(system_time));
EnterCriticalSection(&source->cs); if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_RESTART))) @@ -8084,7 +8084,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockSetRate(IMFClockStateSink * struct system_time_source *source = impl_from_IMFClockStateSink(iface); double intpart;
- TRACE("%p, %s, %f.\n", iface, wine_dbgstr_longlong(system_time), rate); + TRACE("%p, %s, %f.\n", iface, debugstr_time(system_time), rate);
if (rate == 0.0f) return MF_E_UNSUPPORTED_RATE; diff --git a/dlls/mfplat/mfplat_private.h b/dlls/mfplat/mfplat_private.h index ad4958465a..0f1c5479e6 100644 --- a/dlls/mfplat/mfplat_private.h +++ b/dlls/mfplat/mfplat_private.h @@ -182,3 +182,23 @@ static inline const char *debugstr_fourcc(DWORD format)
return wine_dbgstr_an((char *)&format, 4); } + +static inline const char *debugstr_time(LONGLONG time) +{ + ULONGLONG abstime = time >= 0 ? time : -time; + unsigned int i = 0, j = 0; + char buffer[23], rev[23]; + + while (abstime || i <= 8) + { + buffer[i++] = '0' + (abstime % 10); + abstime /= 10; + if (i == 7) buffer[i++] = '.'; + } + if (time < 0) buffer[i++] = '-'; + + while (i--) rev[j++] = buffer[i]; + rev[j] = 0; + + return wine_dbg_sprintf("%s", rev); +}
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/main.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 66bdc505f0..8d9dffe075 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -1002,8 +1002,6 @@ MFTIME WINAPI MFGetSystemTime(void) { MFTIME mf;
- TRACE("()\n"); - GetSystemTimeAsFileTime( (FILETIME*)&mf );
return mf;
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/main.c | 2 +- dlls/mf/mf_private.h | 21 +++++++++++++++++++++ dlls/mf/samplegrabber.c | 10 +++++----- dlls/mf/session.c | 6 ++++-- 4 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/dlls/mf/main.c b/dlls/mf/main.c index 20b587e413..8e42837b46 100644 --- a/dlls/mf/main.c +++ b/dlls/mf/main.c @@ -1894,7 +1894,7 @@ static HRESULT WINAPI sample_copier_transform_GetOutputStatus(IMFTransform *ifac
static HRESULT WINAPI sample_copier_transform_SetOutputBounds(IMFTransform *iface, LONGLONG lower, LONGLONG upper) { - TRACE("%p, %s, %s.\n", iface, wine_dbgstr_longlong(lower), wine_dbgstr_longlong(upper)); + TRACE("%p, %s, %s.\n", iface, debugstr_time(lower), debugstr_time(upper));
return E_NOTIMPL; } diff --git a/dlls/mf/mf_private.h b/dlls/mf/mf_private.h index f68c7d8d4c..dd8f49e1bc 100644 --- a/dlls/mf/mf_private.h +++ b/dlls/mf/mf_private.h @@ -19,6 +19,7 @@ #include "mfidl.h"
#include "wine/heap.h" +#include "wine/debug.h"
static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t count, size_t size) { @@ -55,3 +56,23 @@ struct activate_funcs };
HRESULT create_activation_object(void *context, const struct activate_funcs *funcs, IMFActivate **ret) DECLSPEC_HIDDEN; + +static inline const char *debugstr_time(LONGLONG time) +{ + ULONGLONG abstime = time >= 0 ? time : -time; + unsigned int i = 0, j = 0; + char buffer[23], rev[23]; + + while (abstime || i <= 8) + { + buffer[i++] = '0' + (abstime % 10); + abstime /= 10; + if (i == 7) buffer[i++] = '.'; + } + if (time < 0) buffer[i++] = '-'; + + while (i--) rev[j++] = buffer[i]; + rev[j] = 0; + + return wine_dbg_sprintf("%s", rev); +} diff --git a/dlls/mf/samplegrabber.c b/dlls/mf/samplegrabber.c index ea0d596f7e..205298501d 100644 --- a/dlls/mf/samplegrabber.c +++ b/dlls/mf/samplegrabber.c @@ -1151,7 +1151,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockStart(IMFClockStateSink * { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s, %s.\n", iface, wine_dbgstr_longlong(systime), wine_dbgstr_longlong(offset)); + TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), debugstr_time(offset));
sample_grabber_set_state(grabber, SINK_STATE_RUNNING);
@@ -1162,7 +1162,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockStop(IMFClockStateSink *i { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(systime)); + TRACE("%p, %s.\n", iface, debugstr_time(systime));
sample_grabber_set_state(grabber, SINK_STATE_STOPPED);
@@ -1173,7 +1173,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockPause(IMFClockStateSink * { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(systime)); + TRACE("%p, %s.\n", iface, debugstr_time(systime));
return IMFSampleGrabberSinkCallback_OnClockPause(sample_grabber_get_callback(grabber), systime); } @@ -1182,7 +1182,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockRestart(IMFClockStateSink { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(systime)); + TRACE("%p, %s.\n", iface, debugstr_time(systime));
sample_grabber_set_state(grabber, SINK_STATE_RUNNING);
@@ -1193,7 +1193,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockSetRate(IMFClockStateSink { struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
- TRACE("%p, %s, %f.\n", iface, wine_dbgstr_longlong(systime), rate); + TRACE("%p, %s, %f.\n", iface, debugstr_time(systime), rate);
return IMFSampleGrabberSinkCallback_OnClockSetRate(sample_grabber_get_callback(grabber), systime, rate); } diff --git a/dlls/mf/session.c b/dlls/mf/session.c index db1e5e4fe5..50f011dc52 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -31,6 +31,8 @@ #include "wine/heap.h" #include "wine/list.h"
+#include "mf_private.h" + WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
enum session_command @@ -3547,7 +3549,7 @@ static HRESULT WINAPI present_clock_Start(IMFPresentationClock *iface, LONGLONG struct clock_state_change_param param = {{0}}; HRESULT hr;
- TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(start_offset)); + TRACE("%p, %s.\n", iface, debugstr_time(start_offset));
EnterCriticalSection(&clock->cs); clock->start_offset = param.u.offset = start_offset; @@ -3772,7 +3774,7 @@ static HRESULT WINAPI present_clock_timer_SetTimer(IMFTimer *iface, DWORD flags, struct clock_timer *clock_timer; HRESULT hr;
- TRACE("%p, %#x, %s, %p, %p, %p.\n", iface, flags, wine_dbgstr_longlong(time), callback, state, cancel_key); + TRACE("%p, %#x, %s, %p, %p, %p.\n", iface, flags, debugstr_time(time), callback, state, cancel_key);
if (!(clock_timer = heap_alloc_zero(sizeof(*clock_timer)))) return E_OUTOFMEMORY;
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/dlls/mf/main.c b/dlls/mf/main.c index 8e42837b46..ac80c51016 100644 --- a/dlls/mf/main.c +++ b/dlls/mf/main.c @@ -1090,7 +1090,7 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) return TRUE; }
-static HRESULT prop_string_vector_append(PROPVARIANT *vector, unsigned int *count, BOOL unique, const WCHAR *str) +static HRESULT prop_string_vector_append(PROPVARIANT *vector, unsigned int *capacity, BOOL unique, const WCHAR *str) { WCHAR *ptrW; int len, i; @@ -1104,17 +1104,17 @@ static HRESULT prop_string_vector_append(PROPVARIANT *vector, unsigned int *coun } }
- if (!vector->calpwstr.cElems || *count > vector->calpwstr.cElems - 1) + if (!*capacity || *capacity - 1 < vector->calpwstr.cElems) { unsigned int new_count; WCHAR **ptr;
- new_count = *count ? *count * 2 : 10; + new_count = *capacity ? *capacity * 2 : 10; ptr = CoTaskMemRealloc(vector->calpwstr.pElems, new_count * sizeof(*vector->calpwstr.pElems)); if (!ptr) return E_OUTOFMEMORY; vector->calpwstr.pElems = ptr; - *count = new_count; + *capacity = new_count; }
len = lstrlenW(str); @@ -1129,12 +1129,14 @@ static HRESULT prop_string_vector_append(PROPVARIANT *vector, unsigned int *coun
static int __cdecl qsort_string_compare(const void *a, const void *b) { - return lstrcmpW(a, b); + const WCHAR *left = *(const WCHAR **)a, *right = *(const WCHAR **)b; + return lstrcmpW(left, right); }
static HRESULT mf_get_handler_strings(const WCHAR *path, WCHAR filter, unsigned int maxlen, PROPVARIANT *dst) { static const HKEY hkey_roots[2] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE }; + unsigned int capacity = 0, count, size; HRESULT hr = S_OK; int i, index; WCHAR *buffW; @@ -1148,8 +1150,6 @@ static HRESULT mf_get_handler_strings(const WCHAR *path, WCHAR filter, unsigned
for (i = 0; i < ARRAY_SIZE(hkey_roots); ++i) { - unsigned int count; - DWORD size; HKEY hkey;
if (RegOpenKeyW(hkey_roots[i], path, &hkey)) @@ -1162,7 +1162,8 @@ static HRESULT mf_get_handler_strings(const WCHAR *path, WCHAR filter, unsigned { if (filter && !wcschr(buffW, filter)) continue; - if (FAILED(hr = prop_string_vector_append(dst, &count, i > 0, buffW))) + + if (FAILED(hr = prop_string_vector_append(dst, &capacity, i > 0, buffW))) break; size = maxlen; }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=68093
Your paranoid android.
=== debiant (32 bit Chinese:China report) ===
mfplat: Unhandled exception: page fault on read access to 0x00000008 in 32-bit code (0x658820f7).