lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

I sent this privately to a possibly out-of-date email address. If this is a double-posting I apologise in advance.

...

I downloaded luacom today (version 1.3) and when compiling I got this warning:

tLuaControl.cpp(756) : warning C4700: local variable 'hr' used without having been initialized


This seems to be correct:


STDMETHODIMP tLuaControl::DoVerb(LONG lVerb, LPMSG pMsg, IOleClientSite *pActiveSite,
  LONG lIndex, HWND hwndParent, LPCRECT prcPosRect)
{
  HRESULT hr;

  switch (lVerb) {
    case OLEIVERB_SHOW:
    case OLEIVERB_INPLACEACTIVATE:
    case OLEIVERB_UIACTIVATE:
      hr = InPlaceActivate(lVerb==OLEIVERB_UIACTIVATE);
      return (hr);

    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) {
          if (hr == OLEOBJ_S_INVALIDVERB) {       // <------------------ HERE! line 756
              // 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.");
          return E_NOTIMPL;
      }
      break;
  }

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




Since hr is indeed undefined at this point, do you have a suggested fix?

- Nick Gammon