Skip to content

Commit

Permalink
[!] fix/tLuaControl - cleanup DoVerb, which tested undefined variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidm committed Sep 3, 2010
1 parent 91fc072 commit d746ebf
Showing 1 changed file with 11 additions and 24 deletions.
35 changes: 11 additions & 24 deletions src/library/tLuaControl.cpp
Expand Up @@ -37,6 +37,7 @@ const OLEVERB verbs[] = {
{ OLEIVERB_PRIMARY, 0, 0, 0},
{ OLEIVERB_UIACTIVATE, 0, 0, 0}
};
//unused: OLEIVERB_PRIMARY, OLEIVERB_OPEN, OLEIVERB_DISCARDUNDOSTATE

#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
Expand Down Expand Up @@ -749,40 +750,26 @@ STDMETHODIMP tLuaControl::DoVerb(LONG lVerb, LPMSG pMsg, IOleClientSite *pActive
case OLEIVERB_SHOW:
case OLEIVERB_INPLACEACTIVATE:
case OLEIVERB_UIACTIVATE:
hr = InPlaceActivate(lVerb==OLEIVERB_UIACTIVATE);
return (hr);

hr = InPlaceActivate(lVerb == OLEIVERB_UIACTIVATE);
return hr;
//FIX: handle cases for in-place activatable v.s. nonactivatable objects?
// e.g. for OLEIVERB_UIACTIVATE, "If the object does not support in-place
// activation, it should return E_NOTIMPL" (msdn)
case OLEIVERB_HIDE:
UIDeactivate();
if (m_fInPlaceVisible) SetInPlaceVisible(FALSE);
return S_OK;

default:
// if it's a derived-control defined verb, pass it on to them
//
if (lVerb > 0) {

// FIX-TODO!!! hr is undefined here.
// http://lua-users.org/lists/lua-l/2006-09/msg00030.html
#pragma message("FIX - luacom bug http://lua-users.org/lists/lua-l/2006-09/msg00030.html")
FAIL("FIX - luacom bug lua-l/2006-09/msg00030.html");

if (hr == OLEOBJ_S_INVALIDVERB) {
// unrecognised verb -- just do the primary verb and
// activate the sucker.
//
hr = InPlaceActivate(0);
return (FAILED(hr)) ? hr : OLEOBJ_S_INVALIDVERB;
} else
return hr;
} else {
FAIL("Unrecognized Negative verb in DoVerb(). bad.");
if (lVerb > 0) { // derived control defined verb
// treat unrecognized verb as OLEIVERB_PRIMARY (i.e. just activate in some way)
hr = InPlaceActivate(0);
return FAILED(hr) ? hr : OLEOBJ_S_INVALIDVERB;
} else { // unrecognized negative verb
return E_NOTIMPL;
}
break;
}

// dead code
FAIL("this should be dead code!");
}

Expand Down

0 comments on commit d746ebf

Please sign in to comment.