Fix lots of warnings

Review Request #120169 - Created Sept. 12, 2014 and submitted - Latest diff uploaded

Information
Martin Walch
kblocks
master
Reviewers
Kdegames

krazy2 complains:

  1. Check for code that should be considered crashy. [crashy]...
    ./KBlocksWin.cpp: line#242 (1)

Fix as described in http://blogs.kde.org/node/3919

  1. Check for C++ ctors that should be declared 'explicit' [explicit]
    ./KBlocksPieceGenerator.h: line#16 (1)
    ./KBlocksGameMessage.h: line#18 (1)
    ./KBlocksGameLogic.h: line#29 (1)
    ./KBlocksAppThread.h: line#19 (1)
    ./KBlocksPiece.h: line#90 (1)
    ./AI/PlannerInterface.h: line#21 (1)
    ./AI/KBlocksAIPlayer.h: line#30 (1)
    ./AI/KBlocksAIPlanner.h: line#24 (1)
    ./AI/KBlocksAIPlannerExtend.h: line#25,51 (2)

Fix all by putting "explicit" in front of the constructor, except for KBlocksPiece.h:90, which is sort of a copy constructor (just ignoring it, not suppressing the krazy2 warning).

  1. Check for proper include directives [includes]...
    ./GamePlayerInterface.h: missing or improper include guard in header

cosmetic change: GAMEPLAYINTERFACE_H -> GAMEPLAYERINTERFACE_H

./KBlocksConfigManager.cpp: include own header first line#18

Moved up.

./main.cpp: duplicate includes line#31,38(KBlocksPlayNetwork.h)

Second occurrence removed.

./KBlocksPieceGenerator.cpp: include own header first line#13

Moved up.

  1. Check for postfix usage of ++ and -- [postfixop]...
    ./KBlocksNetServer.cpp: line#262 (1)
    ./KBlocksNetPlayer.cpp: line#121 (1)
    ./KBlocksGameRecorder.cpp: line#53,66 (2)

Easy fix as all are standalone expressions. So just replace.

  1. Check for spelling errors [spelling]... 2 issues found
    ./AI/KBlocksAIPlanner.cpp: line#53[coloumn],78[coloumn] (2)
    Trivial fix as both occurrences are in code comments.

gcc complains at AI/KBlocksAILog.cpp:80:

warning: ignoring return value of 'int system(const char*)'

This is part of a function "clrscr()". Does not seem to have ever been
in use anywhere. Drop that function.

  • compiles fine
  • those krazy2 warnings that this patch addresses are gone (and no new warnings introduced)
  • gcc warning about return value is gone
  • runs fine
Loading...