diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-21 14:35:33 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-21 14:35:33 +0000 |
commit | 5422ffb408e1169f260f7bcafb680f825d5f7f2a (patch) | |
tree | d5c8778a179e93ec9974efda672765210ac5e41c /ext/win32ole | |
parent | ff7cdf645b0544ad6d86f91671559db89a9a4763 (diff) | |
download | ruby-5422ffb408e1169f260f7bcafb680f825d5f7f2a.tar.gz |
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')
-rw-r--r-- | ext/win32ole/win32ole_event.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/ext/win32ole/win32ole_event.c b/ext/win32ole/win32ole_event.c index c918a2b341..8e30732592 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; |