← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~hjd/widelands/cppcheck-fixes into lp:widelands

 

Hans Joachim Desserud has proposed merging lp:~hjd/widelands/cppcheck-fixes into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~hjd/widelands/cppcheck-fixes/+merge/179580

Fix a couple of issues found by cppcheck.
-- 
https://code.launchpad.net/~hjd/widelands/cppcheck-fixes/+merge/179580
Your team Widelands Developers is requested to review the proposed merge of lp:~hjd/widelands/cppcheck-fixes into lp:widelands.
=== modified file 'src/logic/carrier.cc'
--- src/logic/carrier.cc	2013-07-26 20:19:36 +0000
+++ src/logic/carrier.cc	2013-08-10 18:56:13 +0000
@@ -506,9 +506,7 @@
 
 	CoordPath endpath;
 	int32_t startcost, endcost;
-	int32_t curidx = -1;
-
-	curidx = startpath.get_index(get_position());
+	int32_t curidx = startpath.get_index(get_position());
 
 	// Apparently, we're in a building
 	if (curidx < 0) {

=== modified file 'src/logic/notification.h'
--- src/logic/notification.h	2013-07-26 20:19:36 +0000
+++ src/logic/notification.h	2013-08-10 18:56:13 +0000
@@ -50,7 +50,7 @@
 
 public:
 	~NoteSender() {
-		while (m_links.size())
+		while (!m_links.empty())
 			(*m_links.rbegin())->disconnect(*this);
 	}
 
@@ -72,7 +72,7 @@
 
 public:
 	virtual ~NoteReceiver() {
-		while (m_links.size())
+		while (!m_links.empty())
 			disconnect(**m_links.rbegin());
 	}
 

=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc	2013-08-07 12:32:36 +0000
+++ src/wui/buildingwindow.cc	2013-08-10 18:56:13 +0000
@@ -302,7 +302,7 @@
 		} else {
 			wa_info = m_building.descr().m_workarea_info;
 		}
-		if (wa_info.size()) {
+		if (!wa_info.empty()) {
 			m_toggle_workarea = new UI::Button
 				(capsbuttons, "workarea",
 				 0, 0, 34, 34,