← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/gcc531 into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/gcc531 into lp:widelands.

Commit message:
Fixed some compiler warnings with gcc 5.3.1.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/gcc531/+merge/293478
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/gcc531 into lp:widelands.
=== modified file 'src/logic/queue_cmd_factory.cc'
--- src/logic/queue_cmd_factory.cc	2016-01-18 05:12:51 +0000
+++ src/logic/queue_cmd_factory.cc	2016-05-01 09:41:42 +0000
@@ -112,7 +112,7 @@
 	case QueueCommandTypes::kReplaySyncRead:
 	case QueueCommandTypes::kReplayEnd:
 	case QueueCommandTypes::kNone:
-		throw wexception("Unknown Queue_Cmd_Id in file: %u", id);
+		throw wexception("Unknown Queue_Cmd_Id in file: %u", static_cast<unsigned int>(id));
 	}
 	NEVER_HERE();
 }

=== modified file 'src/map_io/map_players_view_packet.cc'
--- src/map_io/map_players_view_packet.cc	2016-02-16 10:27:23 +0000
+++ src/map_io/map_players_view_packet.cc	2016-05-01 09:41:42 +0000
@@ -123,15 +123,15 @@
 	}                                                                                               \
 	catch (const FileError&) {                                                                     \
 		throw GameDataError("MapPlayersViewPacket::read: player %u:Could not open "        \
-		                      "\"%s\" for reading. This file should exist when \"%s\" exists",       \
-		                      plnum,                                                                 \
-		                      filename,                                                              \
-		                      unseen_times_filename);                                                \
+									 "\"%s\" for reading. This file should exist when \"%s\" exists",       \
+									 plnum,                                                                 \
+									 filename,                                                              \
+									 unseen_times_filename);                                                \
 	}
 
 // Try to find the file with newest fitting version number
 #define OPEN_INPUT_FILE_NEW_VERSION(                                                               \
-   filetype, file, filename, fileversion, filename_template, version)                              \
+	filetype, file, filename, fileversion, filename_template, version)                              \
 	uint8_t fileversion = version;                                                                  \
 	filetype file;                                                                                  \
 	char(filename)[FILENAME_SIZE];                                                                  \
@@ -144,10 +144,10 @@
 		catch (...) {                                                                                \
 			if (fileversion == 0)                                                                     \
 				throw GameDataError("MapPlayersViewPacket::read: player %u:Could not open "  \
-				                      "\"%s\" for reading. This file should exist when \"%s\" exists", \
-				                      plnum,                                                           \
-				                      filename,                                                        \
-				                      unseen_times_filename);                                          \
+											 "\"%s\" for reading. This file should exist when \"%s\" exists", \
+											 plnum,                                                           \
+											 filename,                                                        \
+											 unseen_times_filename);                                          \
 		}                                                                                            \
 	}
 
@@ -169,32 +169,32 @@
 #define CHECK_TRAILING_BYTES(file, filename)                                                       \
 	if (!(file).end_of_file())                                                                      \
 		throw GameDataError("MapPlayersViewPacket::read: player %u:"                       \
-		                      "Found %lu trailing bytes in \"%s\"",                                  \
-		                      plnum,                                                                 \
+									 "Found %lu trailing bytes in \"%s\"",                                  \
+									 plnum,                                                                 \
 									 static_cast<long unsigned int>((file).get_size() - (file).get_pos()),    \
-		                      filename);
+									 filename);
 
 
 // Errors for the Read* functions.
 struct TribeImmovableNonexistent : public FileRead::DataError {
 	TribeImmovableNonexistent(const std::string& Name)
-	   : DataError("immovable type \"%s\" does not seem to be a tribe immovable", Name.c_str()),
-	     name(Name) {
+		: DataError("immovable type \"%s\" does not seem to be a tribe immovable", Name.c_str()),
+		  name(Name) {
 	}
 
 	std::string name;
 };
 struct WorldImmovableNonexistent : public FileRead::DataError {
 	WorldImmovableNonexistent(char const* const Name)
-	   : DataError("world does not define immovable type \"%s\"",  Name),
-	     name(Name) {
+		: DataError("world does not define immovable type \"%s\"",  Name),
+		  name(Name) {
 	}
 	char const* const name;
 };
 struct BuildingNonexistent : public FileRead::DataError {
 	BuildingNonexistent(char const* const Name)
-	   : DataError("tribes do not define building type \"%s\"", Name),
-	     name(Name) {
+		: DataError("tribes do not define building type \"%s\"", Name),
+		  name(Name) {
 	}
 	char const* const name;
 };
@@ -888,7 +888,7 @@
 }
 
 #define WRITE(file, filename_template, version)                               \
-   snprintf(filename, sizeof(filename), filename_template, plnum, version);   \
+	snprintf(filename, sizeof(filename), filename_template, plnum, version);   \
 	(file).write(fs, filename);                                                \
 
 void MapPlayersViewPacket::write
@@ -991,12 +991,12 @@
 						}
 
 						//  edges
-						if (!bl_seen & (f_everseen | bl_everseen))
+						if (!(bl_seen) & (f_everseen | bl_everseen))
 							roads_file.unsigned_8(f_player_field.road_sw());
-						if (!br_seen & (f_everseen | br_everseen))
+						if (!(br_seen) & (f_everseen | br_everseen))
 							roads_file.unsigned_8(f_player_field.road_se());
-						if (!r_seen & (f_everseen |  r_everseen))
-							roads_file.unsigned_8(f_player_field.road_e ());
+						if (!(r_seen) & (f_everseen | r_everseen))
+							roads_file.unsigned_8(f_player_field.road_e());
 					}
 
 					//  geologic survey

=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc	2016-04-23 08:14:51 +0000
+++ src/network/nethost.cc	2016-05-01 09:41:42 +0000
@@ -222,7 +222,7 @@
 			 ||
 			 settings().players.at(number).state == PlayerSettings::stateShared
 			 ||
-		    settings().players.at(number).state == PlayerSettings::stateOpen)  // For savegame loading
+			 settings().players.at(number).state == PlayerSettings::stateOpen)  // For savegame loading
 			host_->set_player_tribe(number, tribe, random_tribe);
 	}
 
@@ -354,25 +354,25 @@
 			// Help
 			if (cmd == "help") {
 				c.msg = (boost::format("<br>%s<br>%s<br>%s<br>%s<br>%s<br>%s<br>%s") %
-				         _("Available host commands are:")
-				         %
-							/** TRANSLATORS: Available host command */
-				         _("/help  -  Shows this help")
-				         %
-							/** TRANSLATORS: Available host command */
-				         _("/announce <msg>  -  Send a chatmessage as announcement (system chat)")
-				         %
-							/** TRANSLATORS: Available host command */
-				         _("/warn <name> <reason>  -  Warn the user <name> because of <reason>")
-				         %
-							/** TRANSLATORS: Available host command */
-				         _("/kick <name> <reason>  -  Kick the user <name> because of <reason>")
-				         %
-							/** TRANSLATORS: Available host command */
-				         _("/forcePause            -  Force the game to pause.")
-				         %
-							/** TRANSLATORS: Available host command */
-				         _("/endForcedPause        -  Return game to normal speed.")).str();
+							_("Available host commands are:")
+							%
+							/** TRANSLATORS: Available host command */
+							_("/help  -  Shows this help")
+							%
+							/** TRANSLATORS: Available host command */
+							_("/announce <msg>  -  Send a chatmessage as announcement (system chat)")
+							%
+							/** TRANSLATORS: Available host command */
+							_("/warn <name> <reason>  -  Warn the user <name> because of <reason>")
+							%
+							/** TRANSLATORS: Available host command */
+							_("/kick <name> <reason>  -  Kick the user <name> because of <reason>")
+							%
+							/** TRANSLATORS: Available host command */
+							_("/forcePause            -  Force the game to pause.")
+							%
+							/** TRANSLATORS: Available host command */
+							_("/endForcedPause        -  Return game to normal speed.")).str();
 			}
 
 			// Announce
@@ -420,9 +420,9 @@
 					} else {
 						kickClient = num;
 						c.msg =
-						   (boost::format(_("Are you sure you want to kick %s?")) % arg1).str() + "<br>";
+							(boost::format(_("Are you sure you want to kick %s?")) % arg1).str() + "<br>";
 						c.msg +=
-						   (boost::format(_("The stated reason was: %s")) % kickReason).str() + "<br>";
+							(boost::format(_("The stated reason was: %s")) % kickReason).str() + "<br>";
 						c.msg += (boost::format(_("If yes, type: /ack_kick %s")) % arg1).str();
 					}
 				}
@@ -2118,8 +2118,8 @@
 		}
 	}
 
-    // If a pause was forced or if the players all pause, send a ping regularly
-    // to keep the sockets up and running
+	 // If a pause was forced or if the players all pause, send a ping regularly
+	 // to keep the sockets up and running
 	if ((forced_pause_ || real_speed() == 0) && (time(nullptr) > (d->lastpauseping + 20))) {
 		d->lastpauseping = time(nullptr);
 
@@ -2282,8 +2282,8 @@
 		int32_t time = r.signed_32();
 		Widelands::PlayerCommand & plcmd = *Widelands::PlayerCommand::deserialize(r);
 		log
-			("[Host]: Client %u (%u) sent player command %i for %i, time = %i\n",
-			 i, client.playernum, plcmd.id(), plcmd.sender(), time);
+			("[Host]: Client %u (%u) sent player command %u for %u, time = %i\n",
+			 i, client.playernum, static_cast<unsigned int>(plcmd.id()), plcmd.sender(), time);
 		receive_client_time(i, time);
 		if (plcmd.sender() != client.playernum + 1)
 			throw DisconnectException("PLAYERCMD_FOR_OTHER");


Follow ups