Merge lp:~hjd/widelands/size-to-empty into lp:widelands

Proposed by Hans Joachim Desserud
Status: Merged
Merged at revision: 7238
Proposed branch: lp:~hjd/widelands/size-to-empty
Merge into: lp:widelands
Diff against target: 64 lines (+6/-5)
3 files modified
cmake/codecheck/rules/testing_size_compared_with_zero (+2/-1)
src/ai/defaultai.cc (+2/-2)
src/network/nethost.cc (+2/-2)
To merge this branch: bzr merge lp:~hjd/widelands/size-to-empty
Reviewer Review Type Date Requested Status
GunChleoc Approve
Review via email: mp+240323@code.launchpad.net

Description of the change

(Note that the test suite for codecheck rules will currently fail. Unrelated to my changes, see bug 1388228 for details.)

To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote :

Tested and LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'cmake/codecheck/rules/testing_size_greater_than_zero' => 'cmake/codecheck/rules/testing_size_compared_with_zero'
2--- cmake/codecheck/rules/testing_size_greater_than_zero 2014-07-06 17:30:41 +0000
3+++ cmake/codecheck/rules/testing_size_compared_with_zero 2014-10-31 19:11:49 +0000
4@@ -8,7 +8,7 @@
5
6 error_msg = "Do not use a.size() to check for emptiness, use a.empty() instead."
7
8-regexp=r""" *[a-zA-Z_][a-zA-Z_0-9]* *(\.|->) *size *\(\) *> *0 *"""
9+regexp=r""" *[a-zA-Z_][a-zA-Z_0-9]* *(\.|->) *size *\(\) *(> *0 *|== *0 *)"""
10
11 forbidden = [
12 ' something.size() > 0',
13@@ -16,6 +16,7 @@
14 ' something.size() > 0 ',
15 ' !(something.size() > 0)',
16 ' something.size() > 0 && something_else',
17+ ' something.size() == 0',
18 ]
19
20 allowed = [
21
22=== modified file 'src/ai/defaultai.cc'
23--- src/ai/defaultai.cc 2014-10-17 09:18:58 +0000
24+++ src/ai/defaultai.cc 2014-10-31 19:11:49 +0000
25@@ -1769,7 +1769,7 @@
26 }
27
28 // now we rotate economies and flags to get one flag to go on with
29- if (economies.size() == 0) {
30+ if (economies.empty()) {
31 return check_economies();
32 }
33
34@@ -2405,7 +2405,7 @@
35 // remaining buildings without inputs and not supporting ones (fishers only left probably and
36 // huters)
37
38- if (site.bo->inputs_.size() == 0 && site.bo->production_hint_ < 0 &&
39+ if (site.bo->inputs_.empty() && site.bo->production_hint_ < 0 &&
40 site.site->can_start_working() && !site.bo->space_consumer_ &&
41 site.site->get_statistics_percent() < 10 &&
42 ((game().get_gametime() - site.built_time_) > 10 * 60 * 1000)) {
43
44=== modified file 'src/network/nethost.cc'
45--- src/network/nethost.cc 2014-10-28 08:16:53 +0000
46+++ src/network/nethost.cc 2014-10-31 19:11:49 +0000
47@@ -1273,7 +1273,7 @@
48 }
49
50 } else if (cmd == "pwd") {
51- if (m_password.size() == 0) {
52+ if (m_password.empty()) {
53 c.msg = _("This server is not password protected!");
54 send(c);
55 } else if (arg1 != m_password) {
56@@ -2043,7 +2043,7 @@
57 // The client gets its own initial data set.
58 client.playernum = UserSettings::none();
59 // only used at password protected dedicated server, but better initialize always
60- client.dedicated_access = m_is_dedicated ? (m_password.size() == 0) : false;
61+ client.dedicated_access = m_is_dedicated ? (m_password.empty()) : false;
62
63 if (!d->game) // just in case we allow connection of spectators/players after game start
64 for (uint32_t i = 0; i < d->settings.users.size(); ++i)

Subscribers

People subscribed via source and target branches

to status/vote changes: