Skip to content

Commit 5deaacb

Browse files
committed
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
1 parent 929c9a8 commit 5deaacb

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

ext/win32ole/win32ole_event.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct IEventSinkVtbl {
4848
};
4949

5050
typedef struct tagIEVENTSINKOBJ {
51-
IEventSinkVtbl *lpVtbl;
51+
const IEventSinkVtbl *lpVtbl;
5252
DWORD m_cRef;
5353
IID m_iid;
5454
long m_event_id;
@@ -67,9 +67,23 @@ static ID id_events;
6767

6868
VALUE cWIN32OLE_EVENT;
6969

70-
static BOOL g_IsEventSinkVtblInitialized = FALSE;
71-
72-
static IEventSinkVtbl vtEventSink;
70+
STDMETHODIMP EVENTSINK_QueryInterface(PEVENTSINK, REFIID, LPVOID*);
71+
STDMETHODIMP_(ULONG) EVENTSINK_AddRef(PEVENTSINK);
72+
STDMETHODIMP_(ULONG) EVENTSINK_Release(PEVENTSINK);
73+
STDMETHODIMP EVENTSINK_GetTypeInfoCount(PEVENTSINK, UINT*);
74+
STDMETHODIMP EVENTSINK_GetTypeInfo(PEVENTSINK, UINT, LCID, ITypeInfo**);
75+
STDMETHODIMP EVENTSINK_GetIDsOfNames(PEVENTSINK, REFIID, OLECHAR**, UINT, LCID, DISPID*);
76+
STDMETHODIMP EVENTSINK_Invoke(PEVENTSINK, DISPID, REFIID, LCID, WORD, DISPPARAMS*, VARIANT*, EXCEPINFO*, UINT*);
77+
78+
static const IEventSinkVtbl vtEventSink = {
79+
EVENTSINK_QueryInterface,
80+
EVENTSINK_AddRef,
81+
EVENTSINK_Release,
82+
EVENTSINK_GetTypeInfoCount,
83+
EVENTSINK_GetTypeInfo,
84+
EVENTSINK_GetIDsOfNames,
85+
EVENTSINK_Invoke,
86+
};
7387

7488
void EVENTSINK_Destructor(PIEVENTSINKOBJ);
7589
static void ole_val2ptr_variant(VALUE val, VARIANT *var);
@@ -294,17 +308,6 @@ PIEVENTSINKOBJ
294308
EVENTSINK_Constructor(void)
295309
{
296310
PIEVENTSINKOBJ pEv;
297-
if (!g_IsEventSinkVtblInitialized) {
298-
vtEventSink.QueryInterface=EVENTSINK_QueryInterface;
299-
vtEventSink.AddRef = EVENTSINK_AddRef;
300-
vtEventSink.Release = EVENTSINK_Release;
301-
vtEventSink.Invoke = EVENTSINK_Invoke;
302-
vtEventSink.GetIDsOfNames = EVENTSINK_GetIDsOfNames;
303-
vtEventSink.GetTypeInfoCount = EVENTSINK_GetTypeInfoCount;
304-
vtEventSink.GetTypeInfo = EVENTSINK_GetTypeInfo;
305-
306-
g_IsEventSinkVtblInitialized = TRUE;
307-
}
308311
pEv = ALLOC_N(IEVENTSINKOBJ, 1);
309312
if(pEv == NULL) return NULL;
310313
pEv->lpVtbl = &vtEventSink;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy