← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~borim/widelands/fixWarnings into lp:widelands

 

Borim has proposed merging lp:~borim/widelands/fixWarnings into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~borim/widelands/fixWarnings/+merge/107547

fix some warnings:
* fix use of warning constructor
* add missing check when redirect stderr
-- 
https://code.launchpad.net/~borim/widelands/fixWarnings/+merge/107547
Your team Widelands Developers is requested to review the proposed merge of lp:~borim/widelands/fixWarnings into lp:widelands.
=== modified file 'src/network/internet_gaming.cc'
--- src/network/internet_gaming.cc	2012-04-26 10:45:31 +0000
+++ src/network/internet_gaming.cc	2012-05-27 09:06:21 +0000
@@ -115,7 +115,7 @@
 			 _
 			 	("Widelands could not establish a connection to the given address.\n"
 			 	 "Either there was no metaserver running at the supposed port or\n"
-			 	 "your network setup is broken."));
+			 	 "your snetwork setup is broken."));
 
 	m_sockset = SDLNet_AllocSocketSet(1);
 	SDLNet_TCP_AddSocket (m_sockset, m_sock);
@@ -399,7 +399,8 @@
 			logout();
 			setError();
 			throw warning
-				(_
+				(_("Unexpected packet"),
+				 _
 				 	("Expected a LOGIN, RELOGIN or REJECTED packet from server, but received command "
 				 	 "%s. Maybe the metaserver is using a different protocol version ?"),
 				 cmd.c_str());
@@ -442,7 +443,7 @@
 			std::string type     = packet.String();
 
 			if (type != "public" && type != "private" && type != "system")
-				throw warning("Invalid chat message type \"%s\".", type.c_str());
+				throw warning(_("Invalid message type"), _("Invalid chat message type \"%s\"."), type.c_str());
 
 			bool        personal = type == "private";
 			bool        system   = type == "system";
@@ -747,7 +748,10 @@
  */
 bool InternetGaming::str2bool(std::string str) {
 	if ((str != "true") && (str != "false"))
-		throw warning("Conversion from std::string to bool failed. String was \"%s\"", str.c_str());
+		throw warning
+			(_("Conversion error"),
+			_("Conversion from std::string to bool failed. String was \"%s\""), str.c_str());
+
 	return str == "true";
 }
 

=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc	2012-04-28 17:43:58 +0000
+++ src/wlapplication.cc	2012-05-27 09:06:21 +0000
@@ -2296,7 +2296,8 @@
 	if (!newfp) return false;
 	/* Redirect standard error */
 	std::string stderrfile = path + "/stderr.txt";
-	freopen(stderrfile.c_str(), "w", stderr);
+	newfp = freopen(stderrfile.c_str(), "w", stderr);
+	if (!newfp) return false;
 
 	/* Line buffered */
 	setvbuf(stdout, NULL, _IOLBF, BUFSIZ);


Follow ups