Crystal Space
Welcome, Guest. Please login or register.
November 19, 2017, 04:03:25 am

Login with username, password and session length
Search:     Advanced search
9081 Posts in 2051 Topics by 80433 Members
Latest Member: Sdfoer
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Unused variable error at compile time
« previous next »
Pages: [1] Print
Author Topic: Unused variable error at compile time  (Read 3083 times)
Posts: 2

View Profile Email
« on: October 13, 2013, 12:42:35 am »

I'm getting an unused variable error when I try to compile CS, in cs/include/iutil, in the following section: (please bear with me, I've only recently started learning C++)

/home/rogue_mouser/workspace/crystal/libs/csutil/event.cpp: In static member function ‘static bool csMouseEventHelper::GetEventData(const iEvent*, csMouseEventData&)’:
/home/rogue_mouser/workspace/crystal/libs/csutil/event.cpp:252:16: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]

bool csMouseEventHelper::GetEventData (const iEvent* event,
       csMouseEventData& data)
  // if (!CS_IS_MOUSE_EVENT (*event)) return false; // Need an iObjectRegistry* to do this...

  const void *_ax = 0; size_t _ax_sz = 0;
  uint8 ui8;
  [b]csEventError ok = csEventErrNone;[/b]
  ok = event->Retrieve("mAxes", _ax, _ax_sz);
  CS_ASSERT(ok == csEventErrNone);
  ok = event->Retrieve("mNumAxes", ui8);
  CS_ASSERT(ok == csEventErrNone);
  data.numAxes = ui8;
  for (uint iter=0 ; iter<CS_MAX_MOUSE_AXES ; iter++)
    if (iter<data.numAxes)
      data.axes[iter] = ((int32*)_ax)[iter];
      data.axes[iter] = 0;
  data.x = data.axes[0];
  data.y = data.axes[1];
  int i8;
  ok = event->Retrieve("mButton", i8);
  CS_ASSERT(ok == csEventErrNone);
  data.Button = i8;
  const void* m;
  size_t mSize;
  ok = event->Retrieve("keyModifiers", m, mSize);
  CS_ASSERT(ok == csEventErrNone);
  CS_ASSERT(mSize == sizeof (csKeyModifiers));
  data.Modifiers = csKeyEventHelper::GetModifiersBits (*((csKeyModifiers*)m));
  return true;

As I stated, I've only recently started learning C++, but it looks to me as if the variable "ok" is being used. The same error occurs a few other places in the file, but in theory I only need one answer. I hope.
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 3.136 seconds with 14 queries.