[Kde-games-devel] Review Request 120072: Fix some warnings from Kapman

Martin Walch walch.martin at web.de
Fri Sep 5 19:41:35 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/120072/
-----------------------------------------------------------

Review request for KDE Games.


Repository: kapman


Description
-------

These are three commits, but for reviewboard, I merged them into one:

* Make single parameter constructors explicit

krazy2 complained:
> Check for C++ ctors that should be declared 'explicit' [explicit]...
> OOPS! 7 issues found!
>
> gameview.h: line# 40 (1)
> ghostitem.h: line# 43 (1)
> characteritem.h: line# 47 (1)
> kapmanparser.h: line# 47 (1)
> kapmanitem.h: line# 55 (1)
> gamescene.h: line# 83 (1)
> elementitem.h: line# 47 (1)

Fix it by making them explicit.

This is a minor change in a public API and I guess it could potentially
break code that uses those constructors implicitely, but as Kapman
compiles fine, there seems not to be any such code in Kapman itself
and I doubt that there is any other project that uses classes of Kapman.

* Fix doxygen for void setRotationFlag(bool rotate) in kapmanitem.h

It accidentally read

> @param 0 or 1

instead of

> @param rotate 0 or 1

Trivial fix. Silences two warnings from doxygen log.


* Fix gcc warning -Wunused-but-set-variable: remove bool halfTurnRequired

gcc reported this warning:
ghost.cpp: In member function 'virtual void Ghost::updateMove()':
ghost.cpp:71:7: warning: variable 'halfTurnRequired' set but not
used [-Wunused-but-set-variable]

This is due to a bool variable "halfTurnRequired" which has a value
assigned in five places, but is never read nor returned.

When looking through the commit history, this seems to have never been
in use at all. I guess in the first place it was meant to replace

> if (directionsList.size() == 0) {

with

> if (halfTurnRequired) {

but I do not think it is worth it. So, just remove it completely.

(Also fix a typo in a comment: turnning -> turning)


Diffs
-----

  kapmanparser.h 129a798 
  gameview.h a4969ac 
  ghost.cpp 79e0ea8 
  ghostitem.h d739a2b 
  kapmanitem.h e403272 
  characteritem.h 336b637 
  elementitem.h 27a5e08 
  gamescene.h 2666c07 

Diff: https://git.reviewboard.kde.org/r/120072/diff/


Testing
-------

* compiling
* running the game
* checking doxygen output for param "rotate" in KapmanItem class


Thanks,

Martin Walch

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20140905/87199f82/attachment.html>


More information about the kde-games-devel mailing list