overte-org / overte

Overte open source virtual worlds platform.
https://overte.org/
Other
138 stars 50 forks source link

Compiler warnings in ScriptableAvatar.cpp #852

Closed ksuprynowicz closed 6 months ago

ksuprynowicz commented 7 months ago

They could be pointing to something interesting:

home/ksuprynowicz/overte/overte_v8/overte/assignment-client/src/avatars/ScriptableAvatar.cpp: In member function ‘void ScriptableAvatar::update(float)’:
/home/ksuprynowicz/overte/overte_v8/overte/assignment-client/src/avatars/ScriptableAvatar.cpp:179:38: warning: possibly dangling reference to a temporary [-Wdangling-reference]
  179 |             const HFMAnimationFrame& floorFrame = _animation->getFrames().at((int)glm::floor(currentFrame) % frameCount);
      |                                      ^~~~~~~~~~
/home/ksuprynowicz/overte/overte_v8/overte/assignment-client/src/avatars/ScriptableAvatar.cpp:179:77: note: the temporary was destroyed at the end of the full expression ‘Animation::getFrames() const().QVector<hfm::AnimationFrame>::at(((int)floor(float)(currentFrame) % ((int)frameCount)))’
  179 |             const HFMAnimationFrame& floorFrame = _animation->getFrames().at((int)glm::floor(currentFrame) % frameCount);
      |                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ksuprynowicz/overte/overte_v8/overte/assignment-client/src/avatars/ScriptableAvatar.cpp:180:38: warning: possibly dangling reference to a temporary [-Wdangling-reference]
  180 |             const HFMAnimationFrame& ceilFrame = _animation->getFrames().at((int)glm::ceil(currentFrame) % frameCount);
      |                                      ^~~~~~~~~
/home/ksuprynowicz/overte/overte_v8/overte/assignment-client/src/avatars/ScriptableAvatar.cpp:180:76: note: the temporary was destroyed at the end of the full expression ‘Animation::getFrames() const().QVector<hfm::AnimationFrame>::at(((int)ceil(float)(currentFrame) % ((int)frameCount)))’
  180 |             const HFMAnimationFrame& ceilFrame = _animation->getFrames().at((int)glm::ceil(currentFrame) % frameCount);