Merge lp:~charlesk/indicator-transfer/fix-flint-and-clang-warnings into lp:indicator-transfer/15.04

Proposed by Charles Kerr
Status: Merged
Approved by: Ted Gould
Approved revision: 31
Merged at revision: 28
Proposed branch: lp:~charlesk/indicator-transfer/fix-flint-and-clang-warnings
Merge into: lp:indicator-transfer/15.04
Diff against target: 168 lines (+26/-20)
5 files modified
include/transfer/dbus-shared.h (+4/-0)
include/transfer/world-dbus.h (+1/-1)
src/world-dbus.cpp (+4/-11)
tests/glib-fixture.h (+9/-0)
tests/test-controller.cpp (+8/-8)
To merge this branch: bzr merge lp:~charlesk/indicator-transfer/fix-flint-and-clang-warnings
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+240784@code.launchpad.net

This proposal supersedes a proposal from 2014-10-22.

Commit message

Fixes warnings reported by flint++ and clang.

Description of the change

Fixes warnings reported by flint++ and clang.

No feature changes or end-user-visible changes.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Ted Gould (ted) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/transfer/dbus-shared.h'
2--- include/transfer/dbus-shared.h 2014-03-29 17:17:09 +0000
3+++ include/transfer/dbus-shared.h 2014-11-05 21:51:34 +0000
4@@ -17,7 +17,11 @@
5 * Charles Kerr <charles.kerr@canonical.com>
6 */
7
8+#ifndef INDICATOR_TRANFSFER_DBUS_SHARED_H
9+#define INDICATOR_TRANFSFER_DBUS_SHARED_H
10+
11 #define BUS_NAME "com.canonical.indicator.transfer"
12
13 #define BUS_PATH "/com/canonical/indicator/transfer"
14
15+#endif /* INDICATOR_TRANFSFER_DBUS_SHARED_H */
16
17=== modified file 'include/transfer/world-dbus.h'
18--- include/transfer/world-dbus.h 2014-08-25 20:39:23 +0000
19+++ include/transfer/world-dbus.h 2014-11-05 21:51:34 +0000
20@@ -36,7 +36,7 @@
21 class DBusWorld: public World
22 {
23 public:
24- DBusWorld(const std::shared_ptr<MutableModel>& model);
25+ explicit DBusWorld(const std::shared_ptr<MutableModel>& model);
26 ~DBusWorld();
27
28 void open(const Transfer::Id& id);
29
30=== modified file 'src/world-dbus.cpp'
31--- src/world-dbus.cpp 2014-10-08 20:41:32 +0000
32+++ src/world-dbus.cpp 2014-11-05 21:51:34 +0000
33@@ -298,10 +298,10 @@
34
35 void update_progress()
36 {
37- auto tmp_total_size = total_size;
38- auto tmp_progress = progress;
39- auto tmp_seconds_left = seconds_left;
40- auto tmp_speed_Bps = speed_Bps;
41+ uint64_t tmp_total_size = 0;
42+ float tmp_progress = 0.0f;
43+ int tmp_seconds_left = 0;
44+ uint64_t tmp_speed_Bps = 0;
45
46 if (m_total_size && m_received)
47 {
48@@ -316,13 +316,6 @@
49 tmp_progress = m_received / (float)m_total_size;
50 tmp_seconds_left = seconds;
51 }
52- else
53- {
54- tmp_total_size = 0;
55- tmp_speed_Bps = 0;
56- tmp_progress = 0.0;
57- tmp_seconds_left = -1;
58- }
59
60 bool changed = false;
61
62
63=== modified file 'tests/glib-fixture.h'
64--- tests/glib-fixture.h 2014-06-17 01:36:16 +0000
65+++ tests/glib-fixture.h 2014-11-05 21:51:34 +0000
66@@ -17,6 +17,9 @@
67 * Charles Kerr <charles.kerr@canonical.com>
68 */
69
70+#ifndef INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H
71+#define INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H
72+
73 #include <map>
74
75 #include <glib.h>
76@@ -29,6 +32,10 @@
77
78 class GlibFixture : public ::testing::Test
79 {
80+ public:
81+
82+ virtual ~GlibFixture() =default;
83+
84 private:
85
86 GLogFunc realLogHandler;
87@@ -139,3 +146,5 @@
88
89 GMainLoop * loop;
90 };
91+
92+#endif /* INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H */
93
94=== modified file 'tests/test-controller.cpp'
95--- tests/test-controller.cpp 2014-07-10 15:55:58 +0000
96+++ tests/test-controller.cpp 2014-11-05 21:51:34 +0000
97@@ -99,7 +99,7 @@
98
99 for (const auto& transfer : transfers)
100 {
101- std::shared_ptr<Transfer> t(new Transfer);
102+ auto t = std::make_shared<Transfer>();
103 t->state = transfer.state;
104 t->id = transfer.id;
105 m_model->add(t);
106@@ -142,7 +142,7 @@
107
108 for (const auto& transfer : transfers)
109 {
110- std::shared_ptr<Transfer> t(new Transfer);
111+ auto t = std::make_shared<Transfer>();
112 t->state = transfer.state;
113 t->id = transfer.id;
114 m_model->add(t);
115@@ -175,7 +175,7 @@
116
117 for (const auto& transfer : transfers)
118 {
119- std::shared_ptr<Transfer> t(new Transfer);
120+ auto t = std::make_shared<Transfer>();
121 t->state = transfer.state;
122 t->id = transfer.id;
123 m_model->add(t);
124@@ -193,7 +193,7 @@
125 {
126 const Transfer::Id id = "id";
127
128- std::shared_ptr<Transfer> t(new Transfer);
129+ auto t = std::make_shared<Transfer>();
130 t->state = Transfer::QUEUED;
131 t->id = id;
132 m_model->add(t);
133@@ -266,7 +266,7 @@
134 TEST_F(ControllerFixture, Start)
135 {
136 const Transfer::Id id = "id";
137- std::shared_ptr<Transfer> t(new Transfer);
138+ auto t = std::make_shared<Transfer>();
139 t->id = id;
140 t->state = Transfer::QUEUED;
141 m_model->add(t);
142@@ -286,7 +286,7 @@
143 TEST_F(ControllerFixture, Pause)
144 {
145 const Transfer::Id id = "id";
146- std::shared_ptr<Transfer> t(new Transfer);
147+ auto t = std::make_shared<Transfer>();
148 t->id = id;
149 t->state = Transfer::QUEUED;
150 m_model->add(t);
151@@ -306,7 +306,7 @@
152 TEST_F(ControllerFixture, Resume)
153 {
154 const Transfer::Id id = "id";
155- std::shared_ptr<Transfer> t(new Transfer);
156+ auto t = std::make_shared<Transfer>();
157 t->id = id;
158 t->state = Transfer::QUEUED;
159 m_model->add(t);
160@@ -326,7 +326,7 @@
161 TEST_F(ControllerFixture, Cancel)
162 {
163 const Transfer::Id id = "id";
164- std::shared_ptr<Transfer> t(new Transfer);
165+ auto t = std::make_shared<Transfer>();
166 t->id = id;
167 t->state = Transfer::QUEUED;
168 m_model->add(t);

Subscribers

People subscribed via source and target branches