← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~mxsscott/widelands/clang into lp:widelands

 

Mark Scott has proposed merging lp:~mxsscott/widelands/clang into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #913369 in widelands: "Warnings at compile-time (clang/llvm)"
  https://bugs.launchpad.net/widelands/+bug/913369

For more details, see:
https://code.launchpad.net/~mxsscott/widelands/clang/+merge/144001

Fix cause of warnings reported by clang/llvm.
-- 
https://code.launchpad.net/~mxsscott/widelands/clang/+merge/144001
Your team Widelands Developers is requested to review the proposed merge of lp:~mxsscott/widelands/clang into lp:widelands.
=== modified file 'src/compile_diagnostics.h'
--- src/compile_diagnostics.h	2013-01-06 12:55:31 +0000
+++ src/compile_diagnostics.h	2013-01-19 22:41:25 +0000
@@ -25,8 +25,6 @@
  * use in the middle of functions.
  */
 #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
-# define GCC_DIAG_STR(s) #s
-# define GCC_DIAG_JOINSTR(x, y) GCC_DIAG_STR(x ## y)
 # define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
 # define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
 # define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \
@@ -37,5 +35,23 @@
 # define GCC_DIAG_ON(x)
 #endif
 
+/* Macros for disabling Clang warnings and errors
+ * From https://svn.boost.org/trac/boost/wiki/Guidelines/WarningsGuidelines and
+ * slightly modified.
+ */
+#ifdef __clang__
+# define CLANG_DIAG_DO_PRAGMA(x) _Pragma (#x)
+// _Pragma is unary operator  #pragma ("")
+# define CLANG_DIAG_PRAGMA(x) CLANG_DIAG_DO_PRAGMA(clang diagnostic x)
+# define CLANG_DIAG_OFF(x) CLANG_DIAG_PRAGMA(push) \
+		 CLANG_DIAG_PRAGMA(ignored x)
+// For example: #pragma clang diagnostic ignored "-Wno-unused-variable"
+# define CLANG_DIAG_ON(x) CLANG_DIAG_PRAGMA(pop)
+// For example: #pragma clang diagnostic warning "-Wno-unused-variable"
+#else // Ensure these macros so nothing for other compilers.
+# define CLANG_DIAG_OFF(x)
+# define CLANG_DIAG_ON(x)
+# define CLANG_DIAG_PRAGMA(x)
+#endif
 
 #endif

=== modified file 'src/editor/editorinteractive.h'
--- src/editor/editorinteractive.h	2012-06-06 14:51:03 +0000
+++ src/editor/editorinteractive.h	2013-01-19 22:41:25 +0000
@@ -39,7 +39,7 @@
 
 
 class Editor;
-struct Editor_Tool;
+class Editor_Tool;
 
 /**
  * This is the EditorInteractive. It is like the InteractivePlayer class,

=== modified file 'src/editor/tools/editor_set_port_space_tool.cc'
--- src/editor/tools/editor_set_port_space_tool.cc	2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_set_port_space_tool.cc	2013-01-19 22:41:25 +0000
@@ -51,8 +51,7 @@
 Editor_Set_Port_Space_Tool::Editor_Set_Port_Space_Tool
 (Editor_Unset_Port_Space_Tool & the_unset_tool)
 	:
-	Editor_Tool(the_unset_tool, *this),
-	m_unset_tool(the_unset_tool)
+	Editor_Tool(the_unset_tool, *this)
 {}
 
 

=== modified file 'src/editor/tools/editor_set_port_space_tool.h'
--- src/editor/tools/editor_set_port_space_tool.h	2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_set_port_space_tool.h	2013-01-19 22:41:25 +0000
@@ -28,7 +28,8 @@
 #define FSEL_EUPS_FILENAME "pics/fsel_editor_unset_port_space.png"
 
 /// Unsets a buildspace for ports.
-struct Editor_Unset_Port_Space_Tool : public Editor_Tool {
+class Editor_Unset_Port_Space_Tool : public Editor_Tool {
+public:
 	Editor_Unset_Port_Space_Tool();
 
 	int32_t handle_click_impl
@@ -44,7 +45,8 @@
 
 
 /// Sets a buildspace for ports.
-struct Editor_Set_Port_Space_Tool : public Editor_Tool {
+class Editor_Set_Port_Space_Tool : public Editor_Tool {
+public:
 	Editor_Set_Port_Space_Tool(Editor_Unset_Port_Space_Tool &);
 
 	int32_t handle_click_impl
@@ -56,9 +58,6 @@
 		 Editor_Interactive & parent, Editor_Action_Args & args);
 
 	char const * get_sel_impl() const {return FSEL_ESPS_FILENAME;}
-
-private:
-	Editor_Unset_Port_Space_Tool & m_unset_tool;
 };
 
 int32_t Editor_Tool_Set_Port_Space_Callback

=== modified file 'src/editor/tools/editor_tool.h'
--- src/editor/tools/editor_tool.h	2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_tool.h	2013-01-19 22:41:25 +0000
@@ -36,7 +36,8 @@
  * one function (like delete_building, place building, modify building are 3
  * tools).
  */
-struct Editor_Tool : boost::noncopyable {
+class Editor_Tool : boost::noncopyable {
+public:
 	Editor_Tool(Editor_Tool & second, Editor_Tool & third, bool uda = true) :
 		m_second(second), m_third(third), undoable(uda)
 	{}

=== modified file 'src/editor/tools/editor_tool_action.h'
--- src/editor/tools/editor_tool_action.h	2012-02-21 13:52:14 +0000
+++ src/editor/tools/editor_tool_action.h	2013-01-19 22:41:25 +0000
@@ -23,7 +23,7 @@
 #include "logic/widelands_geometry.h"
 #include "editor_action_args.h"
 
-struct Editor_Tool;
+class Editor_Tool;
 namespace Widelands {class map;}
 struct Editor_Interactive;
 

=== modified file 'src/editor/ui_menus/editor_player_menu.h'
--- src/editor/ui_menus/editor_player_menu.h	2012-02-15 21:25:34 +0000
+++ src/editor/ui_menus/editor_player_menu.h	2013-01-19 22:41:25 +0000
@@ -38,7 +38,8 @@
 struct Button;
 }
 
-struct Editor_Player_Menu : public UI::UniqueWindow {
+class Editor_Player_Menu : public UI::UniqueWindow {
+public:
 	Editor_Player_Menu
 		(Editor_Interactive &, UI::UniqueWindow::Registry &);
 	virtual ~Editor_Player_Menu() {}
@@ -55,9 +56,6 @@
 		* m_plr_set_tribes_buts         [MAX_PLAYERS];
 	std::vector<std::string> m_tribes;
 
-	int32_t m_spt_index;
-	int32_t m_mis_index;
-
 	int32_t m_posy;
 
 	void name_changed(int32_t);

=== modified file 'src/gamecontroller.h'
--- src/gamecontroller.h	2012-04-28 10:57:54 +0000
+++ src/gamecontroller.h	2013-01-19 22:41:25 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2011 by the Widelands Development Team
+ * Copyright (C) 2008-2011, 2013 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -26,7 +26,7 @@
 
 namespace Widelands {
 struct Game;
-struct PlayerCommand;
+class PlayerCommand;
 }
 
 

=== modified file 'src/graphic/text/rt_render.cc'
--- src/graphic/text/rt_render.cc	2013-01-06 15:23:45 +0000
+++ src/graphic/text/rt_render.cc	2013-01-19 22:41:25 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2012 by the Widelands Development Team
+ * Copyright (C) 2006-2013 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -402,9 +402,6 @@
 		assert(false); // This should never be called
 	}
 	virtual bool is_non_mandatory_space() {return true;}
-
-private:
-	uint32_t m_w;
 };
 
 /*

=== modified file 'src/io/filesystem/filesystem.cc'
--- src/io/filesystem/filesystem.cc	2012-09-21 21:36:07 +0000
+++ src/io/filesystem/filesystem.cc	2013-01-19 22:41:25 +0000
@@ -46,7 +46,7 @@
 #include "log.h"
 #include <windows.h>
 #include <io.h>
-#include <direct.h>
+#include <direct.h>
 #else
 #include <glob.h>
 #include <sys/types.h>
@@ -321,8 +321,8 @@
  * Returns the filename of this path, everything after the last
  * / or \  (or the whole string)
  */
-char const * FileSystem::FS_Filename(char const * p) {
-	char const * result = p;
+const char * FileSystem::FS_Filename(const char * p) {
+	const char * result = p;
 
 	while (*p != '\0') {
 		if (*p == '/' || *p == '\\')
@@ -333,10 +333,10 @@
 	return result;
 }
 
-char const * FileSystem::FS_Filename(char const * p, char const * & extension)
+const char * FileSystem::FS_Filename(const char * p, const char * & extension)
 {
 	extension = 0;
-	char const * result = p;
+	const char * result = p;
 
 	while (*p != '\0') {
 		if (*p == '/' || *p == '\\') {
@@ -353,9 +353,9 @@
 	return result;
 }
 
-std::string FileSystem::FS_FilenameWoExt(char const * const p)
+std::string FileSystem::FS_FilenameWoExt(const char * const p)
 {
-	char const * extension;
+	const char * extension = 0;
 	std::string fname(p ? FileSystem::FS_Filename(p, extension) : "");
 	return
 		extension ? fname.substr(0, fname.length() - strlen(extension)) : fname;

=== modified file 'src/io/filesystem/filesystem.h'
--- src/io/filesystem/filesystem.h	2013-01-08 17:05:51 +0000
+++ src/io/filesystem/filesystem.h	2013-01-19 22:41:25 +0000
@@ -114,9 +114,9 @@
 	std::string getWorkingDirectory() const;
 	std::string FS_CanonicalizeName(std::string path) const;
 	bool pathIsAbsolute(std::string const & path) const;
-	static char const * FS_Filename(char const *);
-	static char const * FS_Filename(char const *, char const * & extension);
-	static std::string FS_FilenameWoExt(char const *);
+	static const char * FS_Filename(const char *);
+	static const char * FS_Filename(const char *, const char * & extension);
+	static std::string FS_FilenameWoExt(const char *);
 	static std::string GetHomedir();
 
 	virtual unsigned long long DiskSpace() = 0;

=== modified file 'src/logic/building.h'
--- src/logic/building.h	2012-11-24 16:22:10 +0000
+++ src/logic/building.h	2013-01-19 22:41:25 +0000
@@ -35,7 +35,7 @@
 #include <cstring>
 #include <vector>
 
-namespace UI {struct Window;}
+namespace UI {class Window;}
 struct BuildingHints;
 struct Interactive_GameBase;
 struct Profile;

=== modified file 'src/logic/game.h'
--- src/logic/game.h	2012-02-15 21:25:34 +0000
+++ src/logic/game.h	2013-01-19 22:41:25 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011, 2013 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -58,9 +58,9 @@
 
 struct Player;
 struct Map_Loader;
-struct PlayerCommand;
-struct ReplayReader;
-struct ReplayWriter;
+class PlayerCommand;
+class ReplayReader;
+class ReplayWriter;
 
 struct Game : Editor_Game_Base {
 	struct General_Stats {

=== modified file 'src/logic/player.cc'
--- src/logic/player.cc	2012-09-21 21:36:07 +0000
+++ src/logic/player.cc	2013-01-19 22:41:25 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002-2003, 2006-2012 by the Widelands Development Team
+ * Copyright (C) 2002-2003, 2006-2013 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -109,7 +109,7 @@
 
 void Player::create_default_infrastructure() {
 	const Map & map = egbase().map();
-	if (Coords const starting_pos = map.get_starting_pos(m_plnum)) {
+	if (/* const Coords starting_pos = */map.get_starting_pos(m_plnum)) {
 		try {
 			Tribe_Descr::Initialization const & initialization =
 				tribe().initialization(m_initialization_index);

=== modified file 'src/logic/playercommand.cc'
--- src/logic/playercommand.cc	2012-09-21 21:36:07 +0000
+++ src/logic/playercommand.cc	2013-01-19 22:41:25 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2007-2011 by the Widelands Development Team
+ * Copyright (C) 2004, 2007-2011, 2013 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -903,8 +903,7 @@
 	 uint32_t const _economy,
 	 Ware_Index const _ware_type)
 	:
-	Cmd_ChangeTargetQuantity(_duetime, _sender, _economy, _ware_type),
-	m_economy(0)
+	Cmd_ChangeTargetQuantity(_duetime, _sender, _economy, _ware_type)
 {}
 
 void Cmd_ResetWareTargetQuantity::execute(Game & game)
@@ -947,7 +946,7 @@
 }
 
 Cmd_ResetWareTargetQuantity::Cmd_ResetWareTargetQuantity(StreamRead & des)
-	: Cmd_ChangeTargetQuantity(des), m_economy(0)
+	: Cmd_ChangeTargetQuantity(des)
 {}
 
 void Cmd_ResetWareTargetQuantity::serialize(StreamWrite & ser)
@@ -1026,8 +1025,7 @@
 	 uint32_t const _economy,
 	 Ware_Index const _ware_type)
 	:
-	Cmd_ChangeTargetQuantity(_duetime, _sender, _economy, _ware_type),
-	m_economy(0)
+	Cmd_ChangeTargetQuantity(_duetime, _sender, _economy, _ware_type)
 {}
 
 void Cmd_ResetWorkerTargetQuantity::execute(Game & game)
@@ -1070,7 +1068,7 @@
 }
 
 Cmd_ResetWorkerTargetQuantity::Cmd_ResetWorkerTargetQuantity(StreamRead & des)
-	: Cmd_ChangeTargetQuantity(des), m_economy(0)
+	: Cmd_ChangeTargetQuantity(des)
 {}
 
 void Cmd_ResetWorkerTargetQuantity::serialize(StreamWrite & ser)
@@ -1395,8 +1393,7 @@
 
 Cmd_ChangeMilitaryConfig::Cmd_ChangeMilitaryConfig(StreamRead & des)
 :
-PlayerCommand (0, des.Unsigned8()),
-serial(0)
+PlayerCommand (0, des.Unsigned8())
 {
 	retreat = des.Unsigned8();
 	/// Read reserved data

=== modified file 'src/logic/playercommand.h'
--- src/logic/playercommand.h	2012-09-21 21:36:07 +0000
+++ src/logic/playercommand.h	2013-01-19 22:41:25 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2006-2011 by the Widelands Development Team
+ * Copyright (C) 2004, 2006-2011, 2013 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -38,7 +38,8 @@
  * reasonably unique (to be precise, they must be unique per duetime) and
  * the same across all hosts, to ensure parallel simulation.
  */
-struct PlayerCommand : public GameLogicCommand {
+class PlayerCommand : public GameLogicCommand {
+public:
 	PlayerCommand (int32_t time, Player_Number);
 
 	/// For savegame loading
@@ -344,7 +345,7 @@
 };
 
 struct Cmd_ResetWareTargetQuantity : public Cmd_ChangeTargetQuantity {
-	Cmd_ResetWareTargetQuantity() : Cmd_ChangeTargetQuantity(), m_economy(0), m_ware_type() {}
+	Cmd_ResetWareTargetQuantity() : Cmd_ChangeTargetQuantity(), m_ware_type() {}
 	Cmd_ResetWareTargetQuantity
 		(int32_t duetime, Player_Number sender,
 		 uint32_t economy, Ware_Index index);
@@ -361,7 +362,6 @@
 	virtual void serialize (StreamWrite &);
 
 private:
-	uint32_t m_economy;
 	Ware_Index m_ware_type;
 };
 
@@ -388,7 +388,7 @@
 };
 
 struct Cmd_ResetWorkerTargetQuantity : public Cmd_ChangeTargetQuantity {
-	Cmd_ResetWorkerTargetQuantity() : Cmd_ChangeTargetQuantity(), m_economy(0), m_ware_type() {}
+	Cmd_ResetWorkerTargetQuantity() : Cmd_ChangeTargetQuantity(), m_ware_type() {}
 	Cmd_ResetWorkerTargetQuantity
 		(int32_t duetime, Player_Number sender,
 		 uint32_t economy, Ware_Index index);
@@ -405,7 +405,6 @@
 	virtual void serialize (StreamWrite &);
 
 private:
-	uint32_t m_economy;
 	Ware_Index m_ware_type;
 };
 
@@ -517,12 +516,12 @@
 
 // This is at very early stage, more vars should be added
 struct Cmd_ChangeMilitaryConfig : public PlayerCommand {
-	Cmd_ChangeMilitaryConfig() : PlayerCommand(), serial(0), retreat(0) {} // For savegame loading
+	Cmd_ChangeMilitaryConfig() : PlayerCommand(), retreat(0) {} // For savegame loading
 	Cmd_ChangeMilitaryConfig
 		(int32_t      const t,
 		 int32_t      const p,
 		 uint32_t     const ret)
-		: PlayerCommand(t, p), serial(0), retreat(ret)
+		: PlayerCommand(t, p), retreat(ret)
 	{}
 
 	// Write these commands to a file (for savegames)
@@ -537,7 +536,6 @@
 	virtual void serialize (StreamWrite &);
 
 private:
-	Serial        serial;
 	// By now only retreat info is stored
 	uint8_t       retreat;
 };

=== modified file 'src/logic/replay.cc'
--- src/logic/replay.cc	2012-09-21 21:36:07 +0000
+++ src/logic/replay.cc	2013-01-19 22:41:25 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 by the Widelands Development Team
+ * Copyright (C) 2007-2009,2013 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -48,8 +48,9 @@
 #define SYNC_INTERVAL 200
 
 
-struct Cmd_ReplaySyncRead : public Command {
-	Cmd_ReplaySyncRead(uint32_t const _duetime, md5_checksum const & hash)
+class Cmd_ReplaySyncRead : public Command {
+public:
+	Cmd_ReplaySyncRead(const uint32_t _duetime, const md5_checksum & hash)
 		: Command(_duetime), m_hash(hash)
 	{}
 
@@ -57,7 +58,7 @@
 
 	void execute(Game & game)
 	{
-		md5_checksum const myhash = game.get_sync_hash();
+		const md5_checksum myhash = game.get_sync_hash();
 
 		if (m_hash != myhash) {
 			log
@@ -84,8 +85,7 @@
 /**
  * Load the savegame part of the given replay and open the command log.
  */
-ReplayReader::ReplayReader(Game & game, std::string const & filename)
-	: m_game(game)
+ReplayReader::ReplayReader(Game & game, const std::string & filename)
 {
 	m_replaytime = 0;
 
@@ -98,7 +98,7 @@
 		static_cast<Widelands::StreamRead *>(g_fs->OpenStreamRead(filename));
 
 	try {
-		uint32_t const magic = m_cmdlog->Unsigned32();
+		const uint32_t magic = m_cmdlog->Unsigned32();
 		if (magic == 0x2E21A100)
 			// Note: This was never released as part of a build
 			throw wexception
@@ -109,7 +109,7 @@
 			throw wexception
 				("%s apparently not a valid replay file", filename.c_str());
 
-		uint8_t const version = m_cmdlog->Unsigned8();
+		const uint8_t version = m_cmdlog->Unsigned8();
 		if (version < REPLAY_VERSION)
 			throw wexception
 				("Replay of version %u is known to have desync problems", version);
@@ -141,7 +141,7 @@
  * \return a \ref Command that should be enqueued in the command queue
  * or 0 if there are no remaining commands before the given time.
  */
-Command * ReplayReader::GetNextCommand(uint32_t const time)
+Command * ReplayReader::GetNextCommand(const uint32_t time)
 {
 	if (!m_cmdlog)
 		return 0;
@@ -208,8 +208,9 @@
  * Command / timer that regularly inserts synchronization hashes into
  * the replay.
  */
-struct Cmd_ReplaySyncWrite : public Command {
-	Cmd_ReplaySyncWrite(uint32_t const _duetime) : Command(_duetime) {}
+class Cmd_ReplaySyncWrite : public Command {
+public:
+	Cmd_ReplaySyncWrite(const uint32_t _duetime) : Command(_duetime) {}
 
 	virtual uint8_t id() const {return QUEUE_CMD_REPLAYSYNCWRITE;}
 
@@ -230,7 +231,7 @@
  * This is expected to be called just after game load has completed
  * and the game has changed into running state.
  */
-ReplayWriter::ReplayWriter(Game & game, std::string const & filename)
+ReplayWriter::ReplayWriter(Game & game, const std::string & filename)
 	: m_game(game), m_filename(filename)
 {
 	g_fs->EnsureDirectoryExists(REPLAY_DIR);
@@ -295,7 +296,7 @@
 /**
  * Store a synchronization hash for the current game time in the replay.
  */
-void ReplayWriter::SendSync(md5_checksum const & hash)
+void ReplayWriter::SendSync(const md5_checksum & hash)
 {
 	m_cmdlog->Unsigned8(pkt_syncreport);
 	m_cmdlog->Unsigned32(m_game.get_gametime());

=== modified file 'src/logic/replay.h'
--- src/logic/replay.h	2012-02-15 21:25:34 +0000
+++ src/logic/replay.h	2013-01-19 22:41:25 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 by the Widelands Development Team
+ * Copyright (C) 2007-2009,2013 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -40,22 +40,22 @@
 namespace Widelands {
 struct Command;
 struct Game;
-struct PlayerCommand;
+class PlayerCommand;
 struct StreamRead;
 struct StreamWrite;
 
 /**
  * Read game replays from disk.
  */
-struct ReplayReader {
-	ReplayReader(Game &, std::string const & filename);
+class ReplayReader {
+public:
+	ReplayReader(Game & game, const std::string & filename);
 	~ReplayReader();
 
 	Command * GetNextCommand(uint32_t time);
 	bool EndOfReplay();
 
 private:
-	Game       & m_game;
 	StreamRead * m_cmdlog;
 
 	uint32_t m_replaytime;
@@ -64,12 +64,13 @@
 /**
  * Write game replays to disk.
  */
-struct ReplayWriter {
-	ReplayWriter(Game &, std::string const & filename);
+class ReplayWriter {
+public:
+	ReplayWriter(Game &, const std::string & filename);
 	~ReplayWriter();
 
 	void SendPlayerCommand(PlayerCommand *);
-	void SendSync(md5_checksum const &);
+	void SendSync(const md5_checksum &);
 
 private:
 	Game        & m_game;

=== modified file 'src/logic/ship.h'
--- src/logic/ship.h	2012-02-15 21:25:34 +0000
+++ src/logic/ship.h	2013-01-19 22:41:25 +0000
@@ -24,7 +24,7 @@
 #include "economy/shippingitem.h"
 #include "graphic/diranimations.h"
 
-namespace UI {struct Window;}
+namespace UI {class Window;}
 struct Interactive_GameBase;
 
 namespace Widelands {

=== modified file 'src/map_io/widelands_map_players_view_data_packet.cc'
--- src/map_io/widelands_map_players_view_data_packet.cc	2012-09-21 21:36:07 +0000
+++ src/map_io/widelands_map_players_view_data_packet.cc	2013-01-19 22:41:25 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2008, 2010-2012 by the Widelands Development Team
+ * Copyright (C) 2007-2008, 2010-2013 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -439,12 +439,12 @@
 				//  Store the player's view of roads and ownership in these
 				//  temporary variables and save it in the player when set.
 				uint8_t         roads = 0;
-				Player_Number owner;
+				Player_Number owner = 0;
 
 				switch (f_vision) { //  owner and map_object_descr
 				case 0:
 					//  The player has never seen this node, so he has no
-					//  information about it. Neither should he be be informed about
+					//  information about it. Neither should he be informed about
 					//  it now.
 					break;
 				case 1: {

=== modified file 'src/md5.h'
--- src/md5.h	2012-12-15 14:40:29 +0000
+++ src/md5.h	2013-01-19 22:41:25 +0000
@@ -69,9 +69,10 @@
  *
  * Instances of this class can be copied.
  */
-template <typename Base> struct MD5Checksum : public Base {
+template <typename Base> class MD5Checksum : public Base {
+public:
 	MD5Checksum() {Reset();}
-	explicit MD5Checksum(MD5Checksum const & other)
+	explicit MD5Checksum(const MD5Checksum & other)
 		:
 		Base(),
 		can_handle_data(other.can_handle_data), sum(other.sum), ctx(other.ctx)
@@ -91,7 +92,7 @@
 	///
 	/// \param data data to compute chksum for
 	/// \param size size of data
-	void Data(void const * const newdata, size_t const size) {
+	void Data(const void * const newdata, const size_t size) {
 		assert(can_handle_data);
 		md5_process_bytes(newdata, size, &ctx);
 	}
@@ -108,7 +109,7 @@
 	/// before this function.
 	///
 	/// \return a pointer to an array of 16 bytes containing the checksum.
-	md5_checksum const & GetChecksum() const {
+	const md5_checksum & GetChecksum() const {
 		assert(!can_handle_data);
 		return sum;
 	}

=== modified file 'src/network/netclient.cc'
--- src/network/netclient.cc	2013-01-01 15:25:07 +0000
+++ src/network/netclient.cc	2013-01-19 22:41:25 +0000
@@ -753,7 +753,7 @@
 					char * complete = complete_buf.get();
 #endif
 					fr.DataComplete(complete, bytes);
-					MD5Checksum<FileRead> md5sum;
+					SimpleMD5Checksum md5sum;
 					md5sum.Data(complete, bytes);
 					md5sum.FinishChecksum();
 					std::string localmd5 = md5sum.GetChecksum().str();
@@ -844,7 +844,7 @@
 			char * complete = complete_buf.get();
 #endif
 			fr.DataComplete(complete, file->bytes);
-			MD5Checksum<FileRead> md5sum;
+			SimpleMD5Checksum md5sum;
 			md5sum.Data(complete, file->bytes);
 			md5sum.FinishChecksum();
 			std::string localmd5 = md5sum.GetChecksum().str();

=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc	2013-01-06 11:10:00 +0000
+++ src/network/nethost.cc	2013-01-19 22:41:25 +0000
@@ -1533,7 +1533,7 @@
 		std::vector<char> complete(file->bytes);
 		fr.SetFilePos(0);
 		fr.DataComplete(&complete[0], file->bytes);
-		MD5Checksum<FileRead> md5sum;
+		SimpleMD5Checksum md5sum;
 		md5sum.Data(&complete[0], file->bytes);
 		md5sum.FinishChecksum();
 		file->md5sum = md5sum.GetChecksum().str();

=== modified file 'src/network/network.cc'
--- src/network/network.cc	2012-02-15 21:25:34 +0000
+++ src/network/network.cc	2013-01-19 22:41:25 +0000
@@ -186,10 +186,10 @@
 	return m_index < buffer.size();
 }
 
-bool Deserializer::read (TCPsocket sock)
+bool Deserializer::read(TCPsocket sock)
 {
 	uint8_t buffer[512];
-	int32_t const bytes = SDLNet_TCP_Recv(sock, buffer, sizeof(buffer));
+	const int32_t bytes = SDLNet_TCP_Recv(sock, buffer, sizeof(buffer));
 	if (bytes <= 0)
 		return false;
 
@@ -206,7 +206,7 @@
 	if (queue.size() < 2)
 		return false;
 
-	uint16_t const size = queue[0] << 8 | queue[1];
+	const uint16_t size = queue[0] << 8 | queue[1];
 	if (size < 2)
 		return false;
 

=== modified file 'src/network/network.h'
--- src/network/network.h	2012-02-15 21:25:34 +0000
+++ src/network/network.h	2013-01-19 22:41:25 +0000
@@ -31,7 +31,7 @@
 #include <string>
 #include <vector>
 
-struct Deserializer;
+class Deserializer;
 
 struct SyncCallback {
 	virtual ~SyncCallback() {}
@@ -130,7 +130,8 @@
 	std::vector<FilePart> parts;
 };
 
-struct Deserializer {
+class Deserializer {
+public:
 	/**
 	 * Read data from the given socket.
 	 * \return \c false if the socket was disconnected or another error
@@ -138,17 +139,16 @@
 	 * \c true if some data could be read (this does not imply that \ref avail
 	 * will return \c true !)
 	 */
-	bool read (TCPsocket);
+	bool read(TCPsocket sock);
 
 	/**
 	 * \return \c true if an entire packet has been received.
 	 */
-	bool avail () const;
+	bool avail() const;
 
 private:
 	friend struct RecvPacket;
 	std::vector<uint8_t> queue;
-	size_t index;
 };
 
 

=== modified file 'src/scripting/pluto.cc'
--- src/scripting/pluto.cc	2013-01-06 11:05:01 +0000
+++ src/scripting/pluto.cc	2013-01-19 22:41:25 +0000
@@ -31,7 +31,7 @@
 //are only used in conditional asserts
 #include "compile_diagnostics.h"
 GCC_DIAG_OFF("-Wunused-variable")
-
+CLANG_DIAG_OFF("-Wunused-variable")
 
 // Forward declarated from lua_impl.h. So we do not need to include it
 int luna_restore_object(lua_State * L);

=== modified file 'src/ui_basic/table.cc'
--- src/ui_basic/table.cc	2012-12-14 20:09:35 +0000
+++ src/ui_basic/table.cc	2013-01-19 22:41:25 +0000
@@ -48,7 +48,6 @@
 :
 	Panel             (parent, x, y, w, h),
 	m_total_width     (0),
-	m_max_pic_width   (0),
 	m_fontname        (UI_FONT_NAME),
 	m_fontsize        (UI_FONT_SIZE_SMALL),
 	m_headerheight    (15),

=== modified file 'src/ui_basic/table.h'
--- src/ui_basic/table.h	2012-12-14 20:09:35 +0000
+++ src/ui_basic/table.h	2013-01-19 22:41:25 +0000
@@ -42,8 +42,8 @@
 ///   1. a reference type,
 ///   2. a pointer type or
 ///   3. uintptr_t.
-template<typename Entry> struct Table {
-
+template<typename Entry> class Table {
+public:
 	struct Entry_Record {
 	};
 
@@ -108,8 +108,8 @@
 	virtual bool handle_key(bool down, SDL_keysym code);
 };
 
-template <> struct Table<void *> : public Panel {
-
+template <> class Table<void *> : public Panel {
+public:
 	struct Entry_Record {
 		Entry_Record(void * entry);
 
@@ -132,7 +132,7 @@
 		bool  is_checked(uint8_t col) const;
 
 	private:
-		friend struct Table<void *>;
+		friend class Table<void *>;
 		void *   m_entry;
 		bool     use_clr;
 		RGBColor clr;
@@ -261,7 +261,6 @@
 
 	Columns            m_columns;
 	uint32_t           m_total_width;
-	uint32_t           m_max_pic_width;
 	std::string        m_fontname;
 	uint32_t           m_fontsize;
 	uint32_t           m_headerheight;
@@ -281,8 +280,10 @@
 };
 
 template <typename Entry>
-	struct Table<const Entry * const> : public Table<void *>
+	class Table<const Entry * const> : public Table<void *>
 {
+public:
+
 	typedef Table<void *> Base;
 	Table
 		(Panel * parent,
@@ -310,7 +311,8 @@
 	}
 };
 
-template <typename Entry> struct Table<Entry * const> : public Table<void *> {
+template <typename Entry> class Table<Entry * const> : public Table<void *> {
+public:
 	typedef Table<void *> Base;
 	Table
 		(Panel * parent,
@@ -337,7 +339,8 @@
 	}
 };
 
-template <typename Entry> struct Table<const Entry &> : public Table<void *> {
+template <typename Entry> class Table<const Entry &> : public Table<void *> {
+public:
 	typedef Table<void *> Base;
 	Table
 		(Panel * parent,
@@ -367,7 +370,8 @@
 	}
 };
 
-template <typename Entry> struct Table<Entry &> : public Table<void *> {
+template <typename Entry> class Table<Entry &> : public Table<void *> {
+public:
 	typedef Table<void *> Base;
 	Table
 		(Panel * parent,
@@ -396,7 +400,8 @@
 };
 
 compile_assert(sizeof(void *) == sizeof(uintptr_t));
-template <> struct Table<uintptr_t> : public Table<void *> {
+template <> class Table<uintptr_t> : public Table<void *> {
+public:
 	typedef Table<void *> Base;
 	Table
 		(Panel * parent,
@@ -424,7 +429,8 @@
 		return reinterpret_cast<uintptr_t>(Base::get_selected());
 	}
 };
-template <> struct Table<uintptr_t const> : public Table<uintptr_t> {
+template <> class Table<uintptr_t const> : public Table<uintptr_t> {
+public:
 	typedef Table<uintptr_t> Base;
 	Table
 		(Panel * parent,

=== modified file 'src/ui_basic/window.h'
--- src/ui_basic/window.h	2012-12-17 20:01:04 +0000
+++ src/ui_basic/window.h	2013-01-19 22:41:25 +0000
@@ -50,7 +50,8 @@
  * Minimize means, that the window is only the caption bar, nothing inside.
  * Another click on this bar resizes the window again
  */
-struct Window : public NamedPanel {
+class Window : public NamedPanel {
+public:
 	Window
 		(Panel      * parent,
 		 const std::string& name,
@@ -61,7 +62,7 @@
 		 const std::string& title);
 
 	void set_title(const std::string &);
-	std::string const & get_title() const {return m_title;}
+	const std::string & get_title() const {return m_title;}
 
 	void set_center_panel(Panel * panel);
 	void move_out_of_the_way();
@@ -93,7 +94,7 @@
 
 private:
 	bool _is_minimal;
-	uint32_t _oldw, _oldh;  // if it is, these are the old formats
+	uint32_t _oldh;  // if it is, this is the old height
 	bool _dragging, _docked_left, _docked_right, _docked_bottom;
 	int32_t _drag_start_win_x, _drag_start_win_y;
 	int32_t _drag_start_mouse_x, _drag_start_mouse_y;

=== modified file 'src/wui/warehousewindow.cc'
--- src/wui/warehousewindow.cc	2012-12-14 20:09:35 +0000
+++ src/wui/warehousewindow.cc	2013-01-19 22:41:25 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011, 2013 by the Widelands Development Team
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -40,25 +40,24 @@
 /**
  * Extends the wares display to show and modify stock policy of items.
  */
-struct WarehouseWaresDisplay : WaresDisplay {
+class WarehouseWaresDisplay : public WaresDisplay {
+public:
 	WarehouseWaresDisplay
 		(UI::Panel * parent, uint32_t width,
-		 Interactive_GameBase &, Warehouse &, Widelands::WareWorker type, bool selectable);
+		 Warehouse & wh, Widelands::WareWorker type, bool selectable);
 
 protected:
 	virtual void draw_ware(RenderTarget & dst, Widelands::Ware_Index ware);
 
 private:
-	Interactive_GameBase & m_igbase;
 	Warehouse & m_warehouse;
 };
 
 WarehouseWaresDisplay::WarehouseWaresDisplay
-	(UI::Panel * parent, uint32_t width, Interactive_GameBase & igbase,
+	(UI::Panel * parent, uint32_t width,
 	 Warehouse & wh, Widelands::WareWorker type, bool selectable)
 :
 WaresDisplay(parent, 0, 0, wh.owner().tribe(), type, selectable),
-m_igbase(igbase),
 m_warehouse(wh)
 {
 	set_inner_size(width, 0);
@@ -110,7 +109,7 @@
 	m_wh(wh),
 	m_can_act(m_gb.can_act(m_wh.owner().player_number())),
 	m_type(type),
-	m_display(this, width, m_gb, m_wh, m_type, m_can_act)
+	m_display(this, width, m_wh, m_type, m_can_act)
 {
 	add(&m_display, UI::Box::AlignLeft, true);