[PATCH v2 4/9] windows.media.speech: Rename async_operation to async_inspectable.

Bernhard Kölbl wine at gitlab.winehq.org
Thu May 12 15:28:07 CDT 2022


From: Bernhard Kölbl <besentv at gmail.com>

Signed-off-by: Bernhard Kölbl <besentv at gmail.com>
---
 dlls/windows.media.speech/async.c      | 125 +++++++++++++------------
 dlls/windows.media.speech/private.h    |   5 +-
 dlls/windows.media.speech/recognizer.c |   2 +-
 3 files changed, 68 insertions(+), 64 deletions(-)

diff --git a/dlls/windows.media.speech/async.c b/dlls/windows.media.speech/async.c
index e7547225c1c..79510d61dc7 100644
--- a/dlls/windows.media.speech/async.c
+++ b/dlls/windows.media.speech/async.c
@@ -32,7 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(speech);
  *
  */
 
-struct async_operation
+struct async_inspectable
 {
     IAsyncOperation_IInspectable IAsyncOperation_IInspectable_iface;
     IAsyncInfo IAsyncInfo_iface;
@@ -42,7 +42,7 @@ struct async_operation
     IAsyncOperationCompletedHandler_IInspectable *handler;
     IInspectable *result;
 
-    async_operation_callback callback;
+    async_operation_inspectable_callback callback;
     TP_WORK *async_run_work;
     IInspectable *invoker;
 
@@ -51,14 +51,14 @@ struct async_operation
     HRESULT hr;
 };
 
-static inline struct async_operation *impl_from_IAsyncOperation_IInspectable(IAsyncOperation_IInspectable *iface)
+static inline struct async_inspectable *impl_from_IAsyncOperation_IInspectable(IAsyncOperation_IInspectable *iface)
 {
-    return CONTAINING_RECORD(iface, struct async_operation, IAsyncOperation_IInspectable_iface);
+    return CONTAINING_RECORD(iface, struct async_inspectable, IAsyncOperation_IInspectable_iface);
 }
 
-static HRESULT WINAPI async_operation_QueryInterface( IAsyncOperation_IInspectable *iface, REFIID iid, void **out )
+static HRESULT WINAPI async_inspectable_QueryInterface( IAsyncOperation_IInspectable *iface, REFIID iid, void **out )
 {
-    struct async_operation *impl = impl_from_IAsyncOperation_IInspectable(iface);
+    struct async_inspectable *impl = impl_from_IAsyncOperation_IInspectable(iface);
 
     TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
 
@@ -82,17 +82,17 @@ static HRESULT WINAPI async_operation_QueryInterface( IAsyncOperation_IInspectab
     return E_NOINTERFACE;
 }
 
-static ULONG WINAPI async_operation_AddRef( IAsyncOperation_IInspectable *iface )
+static ULONG WINAPI async_inspectable_AddRef( IAsyncOperation_IInspectable *iface )
 {
-    struct async_operation *impl = impl_from_IAsyncOperation_IInspectable(iface);
+    struct async_inspectable *impl = impl_from_IAsyncOperation_IInspectable(iface);
     ULONG ref = InterlockedIncrement(&impl->ref);
     TRACE("iface %p, ref %lu.\n", iface, ref);
     return ref;
 }
 
-static ULONG WINAPI async_operation_Release( IAsyncOperation_IInspectable *iface )
+static ULONG WINAPI async_inspectable_Release( IAsyncOperation_IInspectable *iface )
 {
-    struct async_operation *impl = impl_from_IAsyncOperation_IInspectable(iface);
+    struct async_inspectable *impl = impl_from_IAsyncOperation_IInspectable(iface);
 
     ULONG ref = InterlockedDecrement(&impl->ref);
     TRACE("iface %p, ref %lu.\n", iface, ref);
@@ -115,28 +115,28 @@ static ULONG WINAPI async_operation_Release( IAsyncOperation_IInspectable *iface
     return ref;
 }
 
-static HRESULT WINAPI async_operation_GetIids( IAsyncOperation_IInspectable *iface, ULONG *iid_count, IID **iids )
+static HRESULT WINAPI async_inspectable_GetIids( IAsyncOperation_IInspectable *iface, ULONG *iid_count, IID **iids )
 {
     FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids);
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI async_operation_GetRuntimeClassName( IAsyncOperation_IInspectable *iface, HSTRING *class_name )
+static HRESULT WINAPI async_inspectable_GetRuntimeClassName( IAsyncOperation_IInspectable *iface, HSTRING *class_name )
 {
     FIXME("iface %p, class_name %p stub!\n", iface, class_name);
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI async_operation_GetTrustLevel( IAsyncOperation_IInspectable *iface, TrustLevel *trust_level )
+static HRESULT WINAPI async_inspectable_GetTrustLevel( IAsyncOperation_IInspectable *iface, TrustLevel *trust_level )
 {
     FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI async_operation_put_Completed( IAsyncOperation_IInspectable *iface,
-                                                     IAsyncOperationCompletedHandler_IInspectable *handler )
+static HRESULT WINAPI async_inspectable_put_Completed( IAsyncOperation_IInspectable *iface,
+                                                       IAsyncOperationCompletedHandler_IInspectable *handler )
 {
-    struct async_operation *impl = impl_from_IAsyncOperation_IInspectable(iface);
+    struct async_inspectable *impl = impl_from_IAsyncOperation_IInspectable(iface);
     HRESULT hr = S_OK;
 
     TRACE("iface %p, handler %p.\n", iface, handler);
@@ -147,7 +147,7 @@ static HRESULT WINAPI async_operation_put_Completed( IAsyncOperation_IInspectabl
     else if (impl->handler != HANDLER_NOT_SET)
         hr = E_ILLEGAL_DELEGATE_ASSIGNMENT;
     /*
-        impl->handler can only be set once with async_operation_put_Completed,
+        impl->handler can only be set once with async_inspectable_put_Completed,
         so by default we set a non HANDLER_NOT_SET value, in this case handler.
     */
     else if ((impl->handler = handler))
@@ -172,10 +172,10 @@ static HRESULT WINAPI async_operation_put_Completed( IAsyncOperation_IInspectabl
     return hr;
 }
 
-static HRESULT WINAPI async_operation_get_Completed( IAsyncOperation_IInspectable *iface,
-                                                     IAsyncOperationCompletedHandler_IInspectable **handler )
+static HRESULT WINAPI async_inspectable_get_Completed( IAsyncOperation_IInspectable *iface,
+                                                       IAsyncOperationCompletedHandler_IInspectable **handler )
 {
-    struct async_operation *impl = impl_from_IAsyncOperation_IInspectable(iface);
+    struct async_inspectable *impl = impl_from_IAsyncOperation_IInspectable(iface);
     HRESULT hr = S_OK;
 
     FIXME("iface %p, handler %p semi stub!\n", iface, handler);
@@ -189,10 +189,10 @@ static HRESULT WINAPI async_operation_get_Completed( IAsyncOperation_IInspectabl
     return hr;
 }
 
-static HRESULT WINAPI async_operation_GetResults( IAsyncOperation_IInspectable *iface, IInspectable **results )
+static HRESULT WINAPI async_inspectable_GetResults( IAsyncOperation_IInspectable *iface, IInspectable **results )
 {
     /* NOTE: Despite the name, this function only returns one result! */
-    struct async_operation *impl = impl_from_IAsyncOperation_IInspectable(iface);
+    struct async_inspectable *impl = impl_from_IAsyncOperation_IInspectable(iface);
     HRESULT hr;
 
     TRACE("iface %p, results %p.\n", iface, results);
@@ -213,20 +213,20 @@ static HRESULT WINAPI async_operation_GetResults( IAsyncOperation_IInspectable *
     return hr;
 }
 
-static const struct IAsyncOperation_IInspectableVtbl async_operation_vtbl =
+static const struct IAsyncOperation_IInspectableVtbl async_inspectable_vtbl =
 {
     /* IUnknown methods */
-    async_operation_QueryInterface,
-    async_operation_AddRef,
-    async_operation_Release,
+    async_inspectable_QueryInterface,
+    async_inspectable_AddRef,
+    async_inspectable_Release,
     /* IInspectable methods */
-    async_operation_GetIids,
-    async_operation_GetRuntimeClassName,
-    async_operation_GetTrustLevel,
+    async_inspectable_GetIids,
+    async_inspectable_GetRuntimeClassName,
+    async_inspectable_GetTrustLevel,
     /* IAsyncOperation<IInspectable*> */
-    async_operation_put_Completed,
-    async_operation_get_Completed,
-    async_operation_GetResults
+    async_inspectable_put_Completed,
+    async_inspectable_get_Completed,
+    async_inspectable_GetResults
 };
 
 /*
@@ -235,17 +235,17 @@ static const struct IAsyncOperation_IInspectableVtbl async_operation_vtbl =
  *
  */
 
-DEFINE_IINSPECTABLE(async_operation_info, IAsyncInfo, struct async_operation, IAsyncOperation_IInspectable_iface)
+DEFINE_IINSPECTABLE(async_inspectable_info, IAsyncInfo, struct async_inspectable, IAsyncOperation_IInspectable_iface)
 
-static HRESULT WINAPI async_operation_info_get_Id( IAsyncInfo *iface, UINT32 *id )
+static HRESULT WINAPI async_inspectable_info_get_Id( IAsyncInfo *iface, UINT32 *id )
 {
     FIXME("iface %p, id %p stub!\n", iface, id);
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI async_operation_info_get_Status( IAsyncInfo *iface, AsyncStatus *status )
+static HRESULT WINAPI async_inspectable_info_get_Status( IAsyncInfo *iface, AsyncStatus *status )
 {
-    struct async_operation *impl = impl_from_IAsyncInfo(iface);
+    struct async_inspectable *impl = impl_from_IAsyncInfo(iface);
     HRESULT hr = S_OK;
 
     TRACE("iface %p, status %p.\n", iface, status);
@@ -259,9 +259,9 @@ static HRESULT WINAPI async_operation_info_get_Status( IAsyncInfo *iface, AsyncS
     return hr;
 }
 
-static HRESULT WINAPI async_operation_info_get_ErrorCode( IAsyncInfo *iface, HRESULT *error_code )
+static HRESULT WINAPI async_inspectable_info_get_ErrorCode( IAsyncInfo *iface, HRESULT *error_code )
 {
-    struct async_operation *impl = impl_from_IAsyncInfo(iface);
+    struct async_inspectable *impl = impl_from_IAsyncInfo(iface);
     HRESULT hr = S_OK;
 
     TRACE("iface %p, error_code %p.\n", iface, error_code);
@@ -276,9 +276,9 @@ static HRESULT WINAPI async_operation_info_get_ErrorCode( IAsyncInfo *iface, HRE
     return hr;
 }
 
-static HRESULT WINAPI async_operation_info_Cancel( IAsyncInfo *iface )
+static HRESULT WINAPI async_inspectable_info_Cancel( IAsyncInfo *iface )
 {
-    struct async_operation *impl = impl_from_IAsyncInfo(iface);
+    struct async_inspectable *impl = impl_from_IAsyncInfo(iface);
     HRESULT hr = S_OK;
 
     TRACE("iface %p.\n", iface);
@@ -293,9 +293,9 @@ static HRESULT WINAPI async_operation_info_Cancel( IAsyncInfo *iface )
     return hr;
 }
 
-static HRESULT WINAPI async_operation_info_Close( IAsyncInfo *iface )
+static HRESULT WINAPI async_inspectable_info_Close( IAsyncInfo *iface )
 {
-    struct async_operation *impl = impl_from_IAsyncInfo(iface);
+    struct async_inspectable *impl = impl_from_IAsyncInfo(iface);
     HRESULT hr = S_OK;
 
     TRACE("iface %p.\n", iface);
@@ -314,29 +314,29 @@ static HRESULT WINAPI async_operation_info_Close( IAsyncInfo *iface )
     return hr;
 }
 
-static const struct IAsyncInfoVtbl async_operation_info_vtbl =
+static const struct IAsyncInfoVtbl async_inspectable_info_vtbl =
 {
     /* IUnknown methods */
-    async_operation_info_QueryInterface,
-    async_operation_info_AddRef,
-    async_operation_info_Release,
+    async_inspectable_info_QueryInterface,
+    async_inspectable_info_AddRef,
+    async_inspectable_info_Release,
     /* IInspectable methods */
-    async_operation_info_GetIids,
-    async_operation_info_GetRuntimeClassName,
-    async_operation_info_GetTrustLevel,
+    async_inspectable_info_GetIids,
+    async_inspectable_info_GetRuntimeClassName,
+    async_inspectable_info_GetTrustLevel,
     /* IAsyncInfo */
-    async_operation_info_get_Id,
-    async_operation_info_get_Status,
-    async_operation_info_get_ErrorCode,
-    async_operation_info_Cancel,
-    async_operation_info_Close
+    async_inspectable_info_get_Id,
+    async_inspectable_info_get_Status,
+    async_inspectable_info_get_ErrorCode,
+    async_inspectable_info_Cancel,
+    async_inspectable_info_Close
 };
 
-static void CALLBACK async_run_cb(TP_CALLBACK_INSTANCE *instance, void *data, TP_WORK *work)
+static void CALLBACK async_inspectable_run_cb(TP_CALLBACK_INSTANCE *instance, void *data, TP_WORK *work)
 {
     IAsyncOperation_IInspectable *operation = data;
     IInspectable *result = NULL;
-    struct async_operation *impl = impl_from_IAsyncOperation_IInspectable(operation);
+    struct async_inspectable *impl = impl_from_IAsyncOperation_IInspectable(operation);
     HRESULT hr;
 
     hr = impl->callback(impl->invoker, &result);
@@ -363,16 +363,19 @@ static void CALLBACK async_run_cb(TP_CALLBACK_INSTANCE *instance, void *data, TP
     IAsyncOperation_IInspectable_Release(operation);
 }
 
-HRESULT async_operation_create( const GUID *iid, IInspectable *invoker, async_operation_callback callback, IAsyncOperation_IInspectable **out )
+HRESULT async_operation_inspectable_create( const GUID *iid,
+                                            IInspectable *invoker,
+                                            async_operation_inspectable_callback callback,
+                                            IAsyncOperation_IInspectable **out )
 {
-    struct async_operation *impl;
+    struct async_inspectable *impl;
 
     TRACE("iid %s, invoker %p, callback %p, out %p.\n", debugstr_guid(iid), invoker, callback, out);
 
     *out = NULL;
     if (!(impl = calloc(1, sizeof(*impl)))) return E_OUTOFMEMORY;
-    impl->IAsyncOperation_IInspectable_iface.lpVtbl = &async_operation_vtbl;
-    impl->IAsyncInfo_iface.lpVtbl = &async_operation_info_vtbl;
+    impl->IAsyncOperation_IInspectable_iface.lpVtbl = &async_inspectable_vtbl;
+    impl->IAsyncInfo_iface.lpVtbl = &async_inspectable_info_vtbl;
     impl->iid = iid;
     impl->ref = 1;
 
@@ -380,7 +383,7 @@ HRESULT async_operation_create( const GUID *iid, IInspectable *invoker, async_op
     impl->callback = callback;
     impl->status = Started;
 
-    if (!(impl->async_run_work = CreateThreadpoolWork(async_run_cb, &impl->IAsyncOperation_IInspectable_iface, NULL)))
+    if (!(impl->async_run_work = CreateThreadpoolWork(async_inspectable_run_cb, &impl->IAsyncOperation_IInspectable_iface, NULL)))
     {
         free(impl);
         return HRESULT_FROM_WIN32(GetLastError());
diff --git a/dlls/windows.media.speech/private.h b/dlls/windows.media.speech/private.h
index 4b55a5cbfa7..97afa4d3499 100644
--- a/dlls/windows.media.speech/private.h
+++ b/dlls/windows.media.speech/private.h
@@ -69,9 +69,10 @@ struct vector_iids
     const GUID *view;
 };
 
-typedef HRESULT (WINAPI *async_operation_callback)( IInspectable *invoker, IInspectable **result );
+typedef HRESULT (WINAPI *async_operation_inspectable_callback)( IInspectable *invoker, IInspectable **result );
 
-HRESULT async_operation_create( const GUID *iid, IInspectable *invoker, async_operation_callback callback, IAsyncOperation_IInspectable **out );
+HRESULT async_operation_inspectable_create( const GUID *iid, IInspectable *invoker, async_operation_inspectable_callback callback,
+                                            IAsyncOperation_IInspectable **out );
 
 HRESULT typed_event_handlers_append( struct list *list, ITypedEventHandler_IInspectable_IInspectable *handler, EventRegistrationToken *token );
 HRESULT typed_event_handlers_remove( struct list *list, EventRegistrationToken *token );
diff --git a/dlls/windows.media.speech/recognizer.c b/dlls/windows.media.speech/recognizer.c
index 39813ef5607..c78f69b0a67 100644
--- a/dlls/windows.media.speech/recognizer.c
+++ b/dlls/windows.media.speech/recognizer.c
@@ -480,7 +480,7 @@ static HRESULT WINAPI recognizer_CompileConstraintsAsync( ISpeechRecognizer *ifa
 {
     IAsyncOperation_IInspectable **value = (IAsyncOperation_IInspectable **)operation;
     FIXME("iface %p, operation %p semi-stub!\n", iface, operation);
-    return async_operation_create(&IID_IAsyncOperation_SpeechRecognitionCompilationResult, NULL, compile_callback, value);
+    return async_operation_inspectable_create(&IID_IAsyncOperation_SpeechRecognitionCompilationResult, NULL, compile_callback, value);
 }
 
 static HRESULT WINAPI recognizer_RecognizeAsync( ISpeechRecognizer *iface,
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/34



More information about the wine-devel mailing list