summaryrefslogtreecommitdiff
path: root/ext/win32ole/win32ole_event.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-21 14:35:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-21 14:35:33 +0000
commit5deaacb0f16d83fa8a0f45dfc95487e4cfddae8e (patch)
treed5c8778a179e93ec9974efda672765210ac5e41c /ext/win32ole/win32ole_event.c
parent929c9a81b0bccc0d6862382e6c17f393fc25cb00 (diff)
win32ole.c: constified
* ext/win32ole/win32ole.c (vtEventSink): constified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/win32ole/win32ole_event.c')
-rw-r--r--ext/win32ole/win32ole_event.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/ext/win32ole/win32ole_event.c b/ext/win32ole/win32ole_event.c
index c918a2b..8e30732 100644
--- a/ext/win32ole/win32ole_event.c
+++ b/ext/win32ole/win32ole_event.c
@@ -48,7 +48,7 @@ struct IEventSinkVtbl {
};
typedef struct tagIEVENTSINKOBJ {
- IEventSinkVtbl *lpVtbl;
+ const IEventSinkVtbl *lpVtbl;
DWORD m_cRef;
IID m_iid;
long m_event_id;
@@ -67,9 +67,23 @@ static ID id_events;
VALUE cWIN32OLE_EVENT;
-static BOOL g_IsEventSinkVtblInitialized = FALSE;
-
-static IEventSinkVtbl vtEventSink;
+STDMETHODIMP EVENTSINK_QueryInterface(PEVENTSINK, REFIID, LPVOID*);
+STDMETHODIMP_(ULONG) EVENTSINK_AddRef(PEVENTSINK);
+STDMETHODIMP_(ULONG) EVENTSINK_Release(PEVENTSINK);
+STDMETHODIMP EVENTSINK_GetTypeInfoCount(PEVENTSINK, UINT*);
+STDMETHODIMP EVENTSINK_GetTypeInfo(PEVENTSINK, UINT, LCID, ITypeInfo**);
+STDMETHODIMP EVENTSINK_GetIDsOfNames(PEVENTSINK, REFIID, OLECHAR**, UINT, LCID, DISPID*);
+STDMETHODIMP EVENTSINK_Invoke(PEVENTSINK, DISPID, REFIID, LCID, WORD, DISPPARAMS*, VARIANT*, EXCEPINFO*, UINT*);
+
+static const IEventSinkVtbl vtEventSink = {
+ EVENTSINK_QueryInterface,
+ EVENTSINK_AddRef,
+ EVENTSINK_Release,
+ EVENTSINK_GetTypeInfoCount,
+ EVENTSINK_GetTypeInfo,
+ EVENTSINK_GetIDsOfNames,
+ EVENTSINK_Invoke,
+};
void EVENTSINK_Destructor(PIEVENTSINKOBJ);
static void ole_val2ptr_variant(VALUE val, VARIANT *var);
@@ -294,17 +308,6 @@ PIEVENTSINKOBJ
EVENTSINK_Constructor(void)
{
PIEVENTSINKOBJ pEv;
- if (!g_IsEventSinkVtblInitialized) {
- vtEventSink.QueryInterface=EVENTSINK_QueryInterface;
- vtEventSink.AddRef = EVENTSINK_AddRef;
- vtEventSink.Release = EVENTSINK_Release;
- vtEventSink.Invoke = EVENTSINK_Invoke;
- vtEventSink.GetIDsOfNames = EVENTSINK_GetIDsOfNames;
- vtEventSink.GetTypeInfoCount = EVENTSINK_GetTypeInfoCount;
- vtEventSink.GetTypeInfo = EVENTSINK_GetTypeInfo;
-
- g_IsEventSinkVtblInitialized = TRUE;
- }
pEv = ALLOC_N(IEVENTSINKOBJ, 1);
if(pEv == NULL) return NULL;
pEv->lpVtbl = &vtEventSink;