Merge lp:~dobey/pay-service/compile-fixes into lp:pay-service/15.04
- compile-fixes
- Merge into trunk.15.04
Proposed by
dobey
Status: | Merged |
---|---|
Approved by: | Kyle Fazzari |
Approved revision: | 51 |
Merged at revision: | 50 |
Proposed branch: | lp:~dobey/pay-service/compile-fixes |
Merge into: | lp:pay-service/15.04 |
Prerequisite: | lp:~dobey/pay-service/backport-ual-session |
Diff against target: |
990 lines (+153/-167) 24 files modified
common/CMakeLists.txt (+1/-1) common/glib-thread.cpp (+16/-18) common/glib-thread.h (+15/-15) service/CMakeLists.txt (+1/-1) service/click-purchases-api.cpp (+1/-1) service/click-purchases-api.h (+1/-1) service/dbus-interface.cpp (+64/-65) service/dbus-interface.h (+1/-3) service/exec-tool.c (+0/-2) service/item-interface.h (+4/-4) service/item-memory.cpp (+12/-16) service/item-memory.h (+3/-3) service/item-null.h (+4/-4) service/purchase-ual.cpp (+4/-5) service/qtbridge.cpp (+2/-2) service/refund-http.h (+1/-1) service/refund-null.cpp (+1/-1) service/token-grabber-u1.cpp (+5/-6) service/verification-http.h (+1/-1) service/verification-null.cpp (+1/-1) service/webclient-curl.cpp (+1/-2) service/webclient-curl.h (+1/-1) service/webclient-null.cpp (+5/-5) tests/item-test.h (+8/-8) |
To merge this branch: | bzr merge lp:~dobey/pay-service/compile-fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Kyle Fazzari (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+270072@code.launchpad.net |
Commit message
Fix usage of warnings flags and the warnings resulting.
Use -fPIC instead of -fPIE where appropriate.
Description of the change
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Approve
(continuous-integration)
Revision history for this message
Kyle Fazzari (kyrofa) wrote : | # |
Correction: "Use -fPIC instead of -fPIE where GCC5 seems to think it's appropriate." Looks good.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'common/CMakeLists.txt' |
2 | --- common/CMakeLists.txt 2015-07-06 16:52:08 +0000 |
3 | +++ common/CMakeLists.txt 2015-09-03 14:42:58 +0000 |
4 | @@ -1,6 +1,6 @@ |
5 | |
6 | |
7 | -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -fPIE ${GCOV_FLAGS}") |
8 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARNING_ARGS} -std=c++11 -g -fPIC ${GCOV_FLAGS}") |
9 | |
10 | set(COMMON_SOURCES |
11 | glib-thread.cpp |
12 | |
13 | === modified file 'common/glib-thread.cpp' |
14 | --- common/glib-thread.cpp 2015-04-03 15:55:21 +0000 |
15 | +++ common/glib-thread.cpp 2015-09-03 14:42:58 +0000 |
16 | @@ -23,9 +23,7 @@ |
17 | { |
18 | |
19 | |
20 | -ContextThread::ContextThread (std::function<void(void)> beforeLoop, std::function<void(void)> afterLoop) |
21 | - : _context(nullptr) |
22 | - , _loop(nullptr) |
23 | +ContextThread::ContextThread (std::function<void()> beforeLoop, std::function<void()> afterLoop) |
24 | { |
25 | _cancel = std::shared_ptr<GCancellable>(g_cancellable_new(), [](GCancellable * cancel) |
26 | { |
27 | @@ -40,7 +38,7 @@ |
28 | /* NOTE: We copy afterLoop but reference beforeLoop. We're blocking so we |
29 | know that beforeLoop will stay valid long enough, but we can't say the |
30 | same for afterLoop */ |
31 | - _thread = std::thread([&context_promise, &beforeLoop, afterLoop, this](void) -> void |
32 | + _thread = std::thread([&context_promise, &beforeLoop, afterLoop, this]() |
33 | { |
34 | /* Build up the context and loop for the async events and a place |
35 | for GDBus to send its events back to */ |
36 | @@ -79,21 +77,21 @@ |
37 | _context = context_value.first; |
38 | _loop = context_value.second; |
39 | |
40 | - if (_context == nullptr || _loop == nullptr) |
41 | + if (!_context || !_loop) |
42 | { |
43 | throw std::runtime_error("Unable to create GLib Thread"); |
44 | } |
45 | } |
46 | |
47 | -ContextThread::~ContextThread (void) |
48 | +ContextThread::~ContextThread () |
49 | { |
50 | quit(); |
51 | } |
52 | |
53 | -void ContextThread::quit (void) |
54 | +void ContextThread::quit () |
55 | { |
56 | g_cancellable_cancel(_cancel.get()); /* Force the cancellation on ongoing tasks */ |
57 | - if (_loop != nullptr) |
58 | + if (_loop) |
59 | { |
60 | g_main_loop_quit(_loop.get()); /* Quit the loop */ |
61 | } |
62 | @@ -109,17 +107,17 @@ |
63 | } |
64 | } |
65 | |
66 | -bool ContextThread::isCancelled (void) |
67 | +bool ContextThread::isCancelled () |
68 | { |
69 | return g_cancellable_is_cancelled(_cancel.get()) == TRUE; |
70 | } |
71 | |
72 | -std::shared_ptr<GCancellable> ContextThread::getCancellable (void) |
73 | +std::shared_ptr<GCancellable> ContextThread::getCancellable () |
74 | { |
75 | return _cancel; |
76 | } |
77 | |
78 | -void ContextThread::simpleSource (std::function<GSource * (void)> srcBuilder, std::function<void(void)> work) |
79 | +void ContextThread::simpleSource (std::function<GSource * ()> srcBuilder, std::function<void()> work) |
80 | { |
81 | if (isCancelled()) |
82 | { |
83 | @@ -129,7 +127,7 @@ |
84 | /* Copy the work so that we can reuse it */ |
85 | /* Lifecycle is handled with the source pointer when we attach |
86 | it to the context. */ |
87 | - auto heapWork = new std::function<void(void)>(work); |
88 | + auto heapWork = new std::function<void()>(work); |
89 | |
90 | auto source = std::shared_ptr<GSource>(srcBuilder(), |
91 | [](GSource * src) |
92 | @@ -138,28 +136,28 @@ |
93 | } |
94 | ); |
95 | g_source_set_callback(source.get(), |
96 | - [](gpointer data) -> gboolean |
97 | + [](gpointer data) |
98 | { |
99 | - std::function<void(void)>* heapWork = reinterpret_cast<std::function<void(void)> *>(data); |
100 | + auto heapWork = static_cast<std::function<void()> *>(data); |
101 | (*heapWork)(); |
102 | return G_SOURCE_REMOVE; |
103 | }, heapWork, |
104 | [](gpointer data) |
105 | { |
106 | - std::function<void(void)>* heapWork = reinterpret_cast<std::function<void(void)> *>(data); |
107 | + auto heapWork = static_cast<std::function<void()> *>(data); |
108 | delete heapWork; |
109 | }); |
110 | |
111 | g_source_attach(source.get(), _context.get()); |
112 | } |
113 | |
114 | -void ContextThread::executeOnThread (std::function<void(void)> work) |
115 | +void ContextThread::executeOnThread (std::function<void()> work) |
116 | { |
117 | simpleSource(g_idle_source_new, work); |
118 | } |
119 | |
120 | void ContextThread::timeout (const std::chrono::milliseconds& length, |
121 | - std::function<void(void)> work) |
122 | + std::function<void()> work) |
123 | { |
124 | simpleSource([length]() |
125 | { |
126 | @@ -168,7 +166,7 @@ |
127 | } |
128 | |
129 | void ContextThread::timeoutSeconds (const std::chrono::seconds& length, |
130 | - std::function<void(void)> work) |
131 | + std::function<void()> work) |
132 | { |
133 | simpleSource([length]() |
134 | { |
135 | |
136 | === modified file 'common/glib-thread.h' |
137 | --- common/glib-thread.h 2015-03-27 17:17:03 +0000 |
138 | +++ common/glib-thread.h 2015-09-03 14:42:58 +0000 |
139 | @@ -33,15 +33,15 @@ |
140 | std::shared_ptr<GCancellable> _cancel; |
141 | |
142 | public: |
143 | - ContextThread (std::function<void(void)> beforeLoop = [] {}, std::function<void(void)> afterLoop = [] {}); |
144 | - ~ContextThread (void); |
145 | - |
146 | - void quit (void); |
147 | - bool isCancelled (void); |
148 | - std::shared_ptr<GCancellable> getCancellable (void); |
149 | - |
150 | - void executeOnThread (std::function<void(void)> work); |
151 | - template<typename T> auto executeOnThread (std::function<T(void)> work) -> T |
152 | + ContextThread (std::function<void()> beforeLoop = [] {}, std::function<void()> afterLoop = [] {}); |
153 | + ~ContextThread (); |
154 | + |
155 | + void quit (); |
156 | + bool isCancelled (); |
157 | + std::shared_ptr<GCancellable> getCancellable (); |
158 | + |
159 | + void executeOnThread (std::function<void()> work); |
160 | + template<typename T> auto executeOnThread (std::function<T()> work) -> T |
161 | { |
162 | if (std::this_thread::get_id() == _thread.get_id()) |
163 | { |
164 | @@ -50,7 +50,7 @@ |
165 | } |
166 | |
167 | std::promise<T> promise; |
168 | - std::function<void(void)> magicFunc = [&promise, &work] (void) -> void { |
169 | + std::function<void()> magicFunc = [&promise, &work] () { |
170 | promise.set_value(work()); |
171 | }; |
172 | |
173 | @@ -61,21 +61,21 @@ |
174 | return future.get(); |
175 | } |
176 | |
177 | - void timeout (const std::chrono::milliseconds& length, std::function<void(void)> work); |
178 | + void timeout (const std::chrono::milliseconds& length, std::function<void()> work); |
179 | template<class Rep, class Period> void timeout (const std::chrono::duration<Rep, Period>& length, |
180 | - std::function<void(void)> work) |
181 | + std::function<void()> work) |
182 | { |
183 | return timeout(std::chrono::duration_cast<std::chrono::milliseconds>(length), work); |
184 | } |
185 | |
186 | - void timeoutSeconds (const std::chrono::seconds& length, std::function<void(void)> work); |
187 | + void timeoutSeconds (const std::chrono::seconds& length, std::function<void()> work); |
188 | template<class Rep, class Period> void timeoutSeconds (const std::chrono::duration<Rep, Period>& length, |
189 | - std::function<void(void)> work) |
190 | + std::function<void()> work) |
191 | { |
192 | return timeoutSeconds(std::chrono::duration_cast<std::chrono::seconds>(length), work); |
193 | } |
194 | |
195 | private: |
196 | - void simpleSource (std::function<GSource * (void)> srcBuilder, std::function<void(void)> work); |
197 | + void simpleSource (std::function<GSource * ()> srcBuilder, std::function<void()> work); |
198 | }; |
199 | } |
200 | |
201 | === modified file 'service/CMakeLists.txt' |
202 | --- service/CMakeLists.txt 2015-09-03 14:42:58 +0000 |
203 | +++ service/CMakeLists.txt 2015-09-03 14:42:58 +0000 |
204 | @@ -1,5 +1,5 @@ |
205 | |
206 | -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -fPIE ${GCOV_FLAGS}") |
207 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARNING_ARGS} -std=c++11 -g -fPIC ${GCOV_FLAGS}") |
208 | include_directories(${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_SOURCE_DIR}/common") |
209 | |
210 | |
211 | |
212 | === modified file 'service/click-purchases-api.cpp' |
213 | --- service/click-purchases-api.cpp 2015-07-01 17:43:55 +0000 |
214 | +++ service/click-purchases-api.cpp 2015-09-03 14:42:58 +0000 |
215 | @@ -26,7 +26,7 @@ |
216 | { |
217 | public: |
218 | |
219 | - Impl(Factory::Ptr wfactory): |
220 | + explicit Impl(Factory::Ptr wfactory): |
221 | m_wfactory(wfactory) |
222 | { |
223 | } |
224 | |
225 | === modified file 'service/click-purchases-api.h' |
226 | --- service/click-purchases-api.h 2015-07-01 17:41:51 +0000 |
227 | +++ service/click-purchases-api.h 2015-09-03 14:42:58 +0000 |
228 | @@ -31,7 +31,7 @@ |
229 | class ClickPurchasesApi |
230 | { |
231 | public: |
232 | - ClickPurchasesApi(Web::Factory::Ptr wfactory); |
233 | + explicit ClickPurchasesApi(Web::Factory::Ptr wfactory); |
234 | virtual ~ClickPurchasesApi(); |
235 | bool running(); |
236 | |
237 | |
238 | === modified file 'service/dbus-interface.cpp' |
239 | --- service/dbus-interface.cpp 2015-07-06 16:52:58 +0000 |
240 | +++ service/dbus-interface.cpp 2015-09-03 14:42:58 +0000 |
241 | @@ -33,26 +33,20 @@ |
242 | Item::Store::Ptr items; |
243 | std::thread t; |
244 | core::Signal<> connectionReady; |
245 | - GQuark errorQuark; |
246 | + const GQuark errorQuark = g_quark_from_static_string("dbus-interface-impl"); |
247 | |
248 | /* Allocated on thread, and cleaned up there */ |
249 | - GMainLoop* loop; |
250 | - proxyPay* serviceProxy; |
251 | - proxyPayPackage* packageProxy; |
252 | - GDBusConnection* bus; |
253 | - GCancellable* cancel; |
254 | - guint subtree_registration; |
255 | + GMainLoop* loop = nullptr; |
256 | + proxyPay* serviceProxy = nullptr; |
257 | + proxyPayPackage* packageProxy = nullptr; |
258 | + GDBusConnection* bus = nullptr; |
259 | + GCancellable* cancel = nullptr; |
260 | + guint subtree_registration = 0; |
261 | |
262 | /* Allocates a thread to do dbus work */ |
263 | - DBusInterfaceImpl (const Item::Store::Ptr& in_items) : |
264 | + explicit DBusInterfaceImpl (const Item::Store::Ptr& in_items) : |
265 | items(in_items), |
266 | - cancel(g_cancellable_new()), |
267 | - loop(nullptr), |
268 | - bus(nullptr), |
269 | - serviceProxy(nullptr), |
270 | - packageProxy(nullptr), |
271 | - errorQuark(g_quark_from_static_string("dbus-interface-impl")), |
272 | - subtree_registration(0) |
273 | + cancel(g_cancellable_new()) |
274 | { } |
275 | |
276 | void run () |
277 | @@ -74,9 +68,7 @@ |
278 | return; |
279 | } |
280 | |
281 | - std::string encodedpkg = DBusInterface::encodePath(pkg); |
282 | - std::string path("/com/canonical/pay/"); |
283 | - path += encodedpkg; |
284 | + const auto path = getPathFromPackage(pkg); |
285 | |
286 | auto mitem = items->getItem(pkg, item); |
287 | const char* strstatus = Item::Item::statusString(status); |
288 | @@ -147,6 +139,24 @@ |
289 | } |
290 | } |
291 | |
292 | + static constexpr char const * baseObjectPath{"/com/canonical/pay"}; |
293 | + |
294 | + static std::string getPathFromPackage(const std::string& pkg) |
295 | + { |
296 | + std::string path = baseObjectPath; |
297 | + path += '/'; |
298 | + path += DBusInterface::encodePath(pkg); |
299 | + return path; |
300 | + } |
301 | + |
302 | + static std::string getPackageFromPath(const std::string& path) |
303 | + { |
304 | + std::string pkg = path; |
305 | + pkg.erase(0, strlen(baseObjectPath) + 1/*strlen("/")*/); |
306 | + pkg = DBusInterface::decodePath(pkg); |
307 | + return pkg; |
308 | + } |
309 | + |
310 | void busAcquired (GDBusConnection* bus); |
311 | |
312 | /* Signal up that we're ready on the interface side of things */ |
313 | @@ -171,14 +181,10 @@ |
314 | g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE); |
315 | g_variant_builder_open(&builder, G_VARIANT_TYPE("ao")); |
316 | |
317 | - for (auto package : packages) |
318 | + for (const auto& pkg : packages) |
319 | { |
320 | - std::string prefix("/com/canonical/pay/"); |
321 | - std::string encoded = DBusInterface::encodePath(package); |
322 | - |
323 | - prefix += encoded; |
324 | - |
325 | - g_variant_builder_add_value(&builder, g_variant_new_object_path(prefix.c_str())); |
326 | + const auto path = getPathFromPackage(pkg); |
327 | + g_variant_builder_add_value(&builder, g_variant_new_object_path(path.c_str())); |
328 | } |
329 | |
330 | g_variant_builder_close(&builder); // tuple |
331 | @@ -189,7 +195,7 @@ |
332 | /************************************** |
333 | * Subtree Functions |
334 | **************************************/ |
335 | - gchar** subtreeEnumerate (const gchar* path) |
336 | + gchar** subtreeEnumerate (const gchar* /*path*/) |
337 | { |
338 | GArray* nodes = g_array_new(TRUE, FALSE, sizeof(gchar*)); |
339 | auto packages = items->listApplications(); |
340 | @@ -203,7 +209,7 @@ |
341 | return reinterpret_cast<gchar**>(g_array_free(nodes, FALSE)); |
342 | } |
343 | |
344 | - GDBusInterfaceInfo** subtreeIntrospect (const gchar* path, const gchar* node) |
345 | + GDBusInterfaceInfo** subtreeIntrospect (const gchar* /*path*/, const gchar* /*node*/) |
346 | { |
347 | GDBusInterfaceInfo* skelInfo = nullptr; |
348 | |
349 | @@ -218,8 +224,7 @@ |
350 | void packageCall(const gchar* sender, const gchar* path, const gchar* method, GVariant* params, |
351 | GDBusMethodInvocation* invocation) |
352 | { |
353 | - const gchar* encoded_package = path + std::strlen("/com/canonical/pay/"); |
354 | - std::string package = DBusInterface::decodePath(std::string(encoded_package)); |
355 | + const auto package = getPackageFromPath(path); |
356 | |
357 | auto params_str = g_variant_print(params, true); |
358 | g_debug("%s sender(%s) path(%s) method(%s) package(%s) params(%s)", |
359 | @@ -300,41 +305,41 @@ |
360 | /************************************** |
361 | * Static Helpers, C language binding |
362 | **************************************/ |
363 | - static void busAcquired_staticHelper (GDBusConnection* inbus, const gchar* name, gpointer user_data) |
364 | + static void busAcquired_staticHelper (GDBusConnection* inbus, const gchar* /*name*/, gpointer user_data) |
365 | { |
366 | - DBusInterfaceImpl* notthis = static_cast<DBusInterfaceImpl*>(user_data); |
367 | + auto notthis = static_cast<DBusInterfaceImpl*>(user_data); |
368 | notthis->busAcquired(inbus); |
369 | } |
370 | |
371 | - static void nameAcquired_staticHelper (GDBusConnection* bus, const gchar* name, gpointer user_data) |
372 | + static void nameAcquired_staticHelper (GDBusConnection* /*bus*/, const gchar* /*name*/, gpointer user_data) |
373 | { |
374 | - DBusInterfaceImpl* notthis = static_cast<DBusInterfaceImpl*>(user_data); |
375 | + auto notthis = static_cast<DBusInterfaceImpl*>(user_data); |
376 | notthis->nameAcquired(); |
377 | } |
378 | |
379 | - static void nameLost_staticHelper (GDBusConnection* bus, const gchar* name, gpointer user_data) |
380 | + static void nameLost_staticHelper (GDBusConnection* /*bus*/, const gchar* /*name*/, gpointer user_data) |
381 | { |
382 | - DBusInterfaceImpl* notthis = static_cast<DBusInterfaceImpl*>(user_data); |
383 | + auto notthis = static_cast<DBusInterfaceImpl*>(user_data); |
384 | notthis->nameLost(); |
385 | } |
386 | |
387 | - static gboolean listPackages_staticHelper (proxyPay* proxy, GDBusMethodInvocation* invocation, gpointer user_data) |
388 | + static gboolean listPackages_staticHelper (proxyPay* /*proxy*/, GDBusMethodInvocation* invocation, gpointer user_data) |
389 | { |
390 | - DBusInterfaceImpl* notthis = static_cast<DBusInterfaceImpl*>(user_data); |
391 | + auto notthis = static_cast<DBusInterfaceImpl*>(user_data); |
392 | return notthis->listPackages(invocation); |
393 | } |
394 | |
395 | - static gchar** subtreeEnumerate_staticHelper (GDBusConnection* bus, const gchar* sender, const gchar* object_path, |
396 | + static gchar** subtreeEnumerate_staticHelper (GDBusConnection* /*bus*/, const gchar* /*sender*/, const gchar* object_path, |
397 | gpointer user_data) |
398 | { |
399 | - DBusInterfaceImpl* notthis = static_cast<DBusInterfaceImpl*>(user_data); |
400 | + auto notthis = static_cast<DBusInterfaceImpl*>(user_data); |
401 | return notthis->subtreeEnumerate(object_path); |
402 | } |
403 | |
404 | - static GDBusInterfaceInfo** subtreeIntrospect_staticHelper (GDBusConnection* bus, const gchar* sender, |
405 | + static GDBusInterfaceInfo** subtreeIntrospect_staticHelper (GDBusConnection* /*bus*/, const gchar* /*sender*/, |
406 | const gchar* object_path, const gchar* node, gpointer user_data) |
407 | { |
408 | - DBusInterfaceImpl* notthis = static_cast<DBusInterfaceImpl*>(user_data); |
409 | + auto notthis = static_cast<DBusInterfaceImpl*>(user_data); |
410 | return notthis->subtreeIntrospect(object_path, node); |
411 | } |
412 | |
413 | @@ -346,19 +351,19 @@ |
414 | gpointer* out_user_data, |
415 | gpointer user_data); |
416 | |
417 | - static void packageCall_staticHelper (GDBusConnection* connection, const gchar* sender, const gchar* path, |
418 | - const gchar* interface, const gchar* method, GVariant* params, GDBusMethodInvocation* invocation, gpointer user_data) |
419 | + static void packageCall_staticHelper (GDBusConnection* /*connection*/, const gchar* sender, const gchar* path, |
420 | + const gchar* /*interface*/, const gchar* method, GVariant* params, GDBusMethodInvocation* invocation, gpointer user_data) |
421 | { |
422 | - DBusInterfaceImpl* notthis = static_cast<DBusInterfaceImpl*>(user_data); |
423 | + auto notthis = static_cast<DBusInterfaceImpl*>(user_data); |
424 | return notthis->packageCall(sender, path, method, params, invocation); |
425 | } |
426 | }; |
427 | |
428 | static const GDBusSubtreeVTable subtreeVtable = |
429 | { |
430 | - .enumerate = DBusInterfaceImpl::subtreeEnumerate_staticHelper, |
431 | - .introspect = DBusInterfaceImpl::subtreeIntrospect_staticHelper, |
432 | - .dispatch= DBusInterfaceImpl::subtreeDispatch_staticHelper |
433 | + DBusInterfaceImpl::subtreeEnumerate_staticHelper, |
434 | + DBusInterfaceImpl::subtreeIntrospect_staticHelper, |
435 | + DBusInterfaceImpl::subtreeDispatch_staticHelper |
436 | }; |
437 | |
438 | /* Export objects into the bus before we get a name */ |
439 | @@ -381,11 +386,11 @@ |
440 | |
441 | g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(serviceProxy), |
442 | bus, |
443 | - "/com/canonical/pay", |
444 | + baseObjectPath, |
445 | NULL); |
446 | |
447 | subtree_registration = g_dbus_connection_register_subtree(bus, |
448 | - "/com/canonical/pay", |
449 | + baseObjectPath, |
450 | &subtreeVtable, |
451 | G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES, |
452 | this, |
453 | @@ -395,16 +400,16 @@ |
454 | |
455 | static const GDBusInterfaceVTable packageVtable = |
456 | { |
457 | - .method_call = DBusInterfaceImpl::packageCall_staticHelper, |
458 | - .get_property = nullptr, |
459 | - .set_property = nullptr |
460 | + DBusInterfaceImpl::packageCall_staticHelper, |
461 | + nullptr, |
462 | + nullptr |
463 | }; |
464 | |
465 | -const GDBusInterfaceVTable* DBusInterfaceImpl::subtreeDispatch_staticHelper (GDBusConnection* bus, |
466 | - const gchar* sender, |
467 | - const gchar* path, |
468 | +const GDBusInterfaceVTable* DBusInterfaceImpl::subtreeDispatch_staticHelper (GDBusConnection* /*bus*/, |
469 | + const gchar* /*sender*/, |
470 | + const gchar* /*path*/, |
471 | const gchar* interface, |
472 | - const gchar* node, |
473 | + const gchar* /*node*/, |
474 | gpointer* out_user_data, |
475 | gpointer user_data) |
476 | { |
477 | @@ -421,9 +426,9 @@ |
478 | |
479 | |
480 | |
481 | -DBusInterface::DBusInterface (const Item::Store::Ptr& in_items) |
482 | +DBusInterface::DBusInterface (const Item::Store::Ptr& in_items): |
483 | + impl(std::make_shared<DBusInterfaceImpl>(in_items)) |
484 | { |
485 | - impl = std::make_shared<DBusInterfaceImpl>(in_items); |
486 | impl->connectionReady.connect([this]() |
487 | { |
488 | connectionReady(); |
489 | @@ -432,12 +437,6 @@ |
490 | impl->run(); |
491 | } |
492 | |
493 | -bool |
494 | -DBusInterface::busStatus () |
495 | -{ |
496 | - return true; |
497 | -} |
498 | - |
499 | std::string |
500 | DBusInterface::encodePath (const std::string& input) |
501 | { |
502 | @@ -475,7 +474,7 @@ |
503 | |
504 | try |
505 | { |
506 | - for (int i = 0; i < input.size(); i++) |
507 | + for (unsigned i = 0; i < input.size(); i++) |
508 | { |
509 | if (input[i] == '_') |
510 | { |
511 | |
512 | === modified file 'service/dbus-interface.h' |
513 | --- service/dbus-interface.h 2014-06-13 18:43:47 +0000 |
514 | +++ service/dbus-interface.h 2015-09-03 14:42:58 +0000 |
515 | @@ -29,11 +29,9 @@ |
516 | class DBusInterface |
517 | { |
518 | public: |
519 | - DBusInterface (const Item::Store::Ptr& in_items); |
520 | + explicit DBusInterface (const Item::Store::Ptr& in_items); |
521 | ~DBusInterface () { }; |
522 | |
523 | - bool busStatus (); |
524 | - |
525 | static std::string encodePath (const std::string& input); |
526 | static std::string decodePath (const std::string& input); |
527 | |
528 | |
529 | === modified file 'service/exec-tool.c' |
530 | --- service/exec-tool.c 2015-09-03 14:42:58 +0000 |
531 | +++ service/exec-tool.c 2015-09-03 14:42:58 +0000 |
532 | @@ -112,8 +112,6 @@ |
533 | int |
534 | main (int argc, char * argv[]) |
535 | { |
536 | - GError * error = NULL; |
537 | - |
538 | /* Build up our exec */ |
539 | const gchar * appid = g_getenv("APP_ID"); |
540 | if (appid == NULL) { |
541 | |
542 | === modified file 'service/item-interface.h' |
543 | --- service/item-interface.h 2015-07-06 16:52:58 +0000 |
544 | +++ service/item-interface.h 2015-09-03 14:42:58 +0000 |
545 | @@ -66,7 +66,7 @@ |
546 | return "error"; |
547 | } |
548 | |
549 | - virtual std::string& getId (void) = 0; |
550 | + virtual const std::string& getId (void) = 0; |
551 | virtual Status getStatus (void) = 0; |
552 | virtual uint64_t getRefundExpiry (void) = 0; |
553 | virtual bool verify (void) = 0; |
554 | @@ -80,12 +80,12 @@ |
555 | { |
556 | public: |
557 | virtual std::list<std::string> listApplications (void) = 0; |
558 | - virtual std::shared_ptr<std::map<std::string, Item::Ptr>> getItems (std::string& application) = 0; |
559 | - virtual Item::Ptr getItem (std::string& application, std::string& item) = 0; |
560 | + virtual std::shared_ptr<std::map<std::string, Item::Ptr>> getItems (const std::string& application) = 0; |
561 | + virtual Item::Ptr getItem (const std::string& application, const std::string& item) = 0; |
562 | |
563 | typedef std::shared_ptr<Store> Ptr; |
564 | |
565 | - core::Signal<std::string&, std::string&, Item::Status, uint64_t> itemChanged; |
566 | + core::Signal<const std::string&, const std::string&, Item::Status, uint64_t> itemChanged; |
567 | }; |
568 | |
569 | } // namespace Item |
570 | |
571 | === modified file 'service/item-memory.cpp' |
572 | --- service/item-memory.cpp 2015-07-06 16:52:58 +0000 |
573 | +++ service/item-memory.cpp 2015-09-03 14:42:58 +0000 |
574 | @@ -31,8 +31,8 @@ |
575 | class MemoryItem : public Item |
576 | { |
577 | public: |
578 | - MemoryItem (std::string& in_app, |
579 | - std::string& in_id, |
580 | + MemoryItem (const std::string& in_app, |
581 | + const std::string& in_id, |
582 | Verification::Factory::Ptr& in_vfactory, |
583 | Refund::Factory::Ptr& in_rfactory, |
584 | Purchase::Factory::Ptr& in_pfactory) : |
585 | @@ -40,22 +40,18 @@ |
586 | id(in_id), |
587 | vfactory(in_vfactory), |
588 | rfactory(in_rfactory), |
589 | - pfactory(in_pfactory), |
590 | - vitem(nullptr), |
591 | - pitem(nullptr), |
592 | - status(Item::Status::UNKNOWN), |
593 | - refund_timeout(0) |
594 | + pfactory(in_pfactory) |
595 | { |
596 | /* We init into the unknown state and then wait for someone |
597 | to ask us to do something about it. */ |
598 | } |
599 | |
600 | - std::string& getApp (void) |
601 | + const std::string& getApp (void) |
602 | { |
603 | return app; |
604 | } |
605 | |
606 | - std::string& getId (void) override |
607 | + const std::string& getId (void) override |
608 | { |
609 | return id; |
610 | } |
611 | @@ -170,7 +166,7 @@ |
612 | return false; |
613 | } |
614 | |
615 | - pitem->purchaseComplete.connect([this](Purchase::Item::Status status) |
616 | + pitem->purchaseComplete.connect([this](Purchase::Item::Status /*status*/) |
617 | { |
618 | /* Verifying on each time the purchase UI runs right now because |
619 | we're not getting reliable status back from them. */ |
620 | @@ -216,10 +212,10 @@ |
621 | } |
622 | |
623 | /***** Only set at init *********/ |
624 | + /* Application ID */ |
625 | + std::string app; |
626 | /* Item ID */ |
627 | std::string id; |
628 | - /* Application ID */ |
629 | - std::string app; |
630 | Verification::Factory::Ptr vfactory; |
631 | Refund::Factory::Ptr rfactory; |
632 | Purchase::Factory::Ptr pfactory; |
633 | @@ -234,11 +230,11 @@ |
634 | |
635 | /****** status is protected with it's own mutex *******/ |
636 | std::mutex status_mutex; |
637 | - Item::Status status; |
638 | + Item::Status status = Item::Status::UNKNOWN; |
639 | |
640 | /****** refund_timeout is protected with it's own mutex *******/ |
641 | std::mutex refund_mutex; |
642 | - uint64_t refund_timeout; |
643 | + uint64_t refund_timeout = 0; |
644 | }; |
645 | |
646 | std::list<std::string> |
647 | @@ -258,7 +254,7 @@ |
648 | } |
649 | |
650 | std::shared_ptr<std::map<std::string, Item::Ptr>> |
651 | -MemoryStore::getItems (std::string& application) |
652 | +MemoryStore::getItems (const std::string& application) |
653 | { |
654 | auto app = data[application]; |
655 | |
656 | @@ -272,7 +268,7 @@ |
657 | } |
658 | |
659 | Item::Ptr |
660 | -MemoryStore::getItem (std::string& application, std::string& itemid) |
661 | +MemoryStore::getItem (const std::string& application, const std::string& itemid) |
662 | { |
663 | if (verificationFactory == nullptr) |
664 | { |
665 | |
666 | === modified file 'service/item-memory.h' |
667 | --- service/item-memory.h 2015-07-01 17:41:51 +0000 |
668 | +++ service/item-memory.h 2015-09-03 14:42:58 +0000 |
669 | @@ -43,9 +43,9 @@ |
670 | throw std::invalid_argument("factory"); |
671 | } |
672 | } |
673 | - std::list<std::string> listApplications (void); |
674 | - std::shared_ptr<std::map<std::string, Item::Ptr>> getItems (std::string& application); |
675 | - Item::Ptr getItem (std::string& application, std::string& itemid); |
676 | + std::list<std::string> listApplications (void) override; |
677 | + std::shared_ptr<std::map<std::string, Item::Ptr>> getItems (const std::string& application) override; |
678 | + Item::Ptr getItem (const std::string& application, const std::string& itemid) override; |
679 | |
680 | private: |
681 | std::map<std::string, std::shared_ptr<std::map<std::string, Item::Ptr>>> data; |
682 | |
683 | === modified file 'service/item-null.h' |
684 | --- service/item-null.h 2015-07-06 16:52:58 +0000 |
685 | +++ service/item-null.h 2015-09-03 14:42:58 +0000 |
686 | @@ -30,7 +30,7 @@ |
687 | public: |
688 | NullItem (std::string id) : _id(id) {}; |
689 | |
690 | - std::string& getId (void) override |
691 | + const std::string& getId (void) override |
692 | { |
693 | return _id; |
694 | } |
695 | @@ -64,17 +64,17 @@ |
696 | class NullStore : public Store |
697 | { |
698 | public: |
699 | - std::list<std::string> listApplications (void) |
700 | + std::list<std::string> listApplications (void) override |
701 | { |
702 | return std::list<std::string>(); |
703 | } |
704 | |
705 | - std::shared_ptr<std::map<std::string, Item::Ptr>> getItems (std::string& application) |
706 | + std::shared_ptr<std::map<std::string, Item::Ptr>> getItems (const std::string& application) override |
707 | { |
708 | return std::make_shared<std::map<std::string, Item::Ptr>>(); |
709 | } |
710 | |
711 | - Item::Ptr getItem (std::string& application, std::string& itemid) |
712 | + Item::Ptr getItem (const std::string& application, const std::string& itemid) override |
713 | { |
714 | auto retval = std::make_shared<NullItem>(itemid); |
715 | return retval; |
716 | |
717 | === modified file 'service/purchase-ual.cpp' |
718 | --- service/purchase-ual.cpp 2015-09-03 14:42:58 +0000 |
719 | +++ service/purchase-ual.cpp 2015-09-03 14:42:58 +0000 |
720 | @@ -41,7 +41,6 @@ |
721 | typedef std::shared_ptr<Item> Ptr; |
722 | |
723 | UalItem (const std::string& in_appid, const std::string& in_itemid, const std::shared_ptr<MirConnection>& mir) : |
724 | - status(Item::ERROR), |
725 | appid(in_appid), |
726 | itemid(in_itemid), |
727 | connection(mir) |
728 | @@ -136,7 +135,7 @@ |
729 | std::string instanceid; |
730 | std::shared_ptr<GLib::ContextThread> thread; |
731 | std::shared_ptr<MirPromptSession> session; |
732 | - Item::Status status; |
733 | + Item::Status status = Item::ERROR; |
734 | |
735 | /* Given to us by our parents */ |
736 | std::shared_ptr<MirConnection> connection; |
737 | @@ -336,7 +335,7 @@ |
738 | } |
739 | } |
740 | |
741 | - static void stateChanged (MirPromptSession* session, MirPromptSessionState state, void* user_data) |
742 | + static void stateChanged (MirPromptSession* /*session*/, MirPromptSessionState state, void* /*user_data*/) |
743 | { |
744 | g_debug("Mir Prompt session is in state: %d", state); |
745 | } |
746 | @@ -413,9 +412,9 @@ |
747 | return impl->purchaseItem(appid, itemid); |
748 | } |
749 | |
750 | -UalFactory::UalFactory () |
751 | +UalFactory::UalFactory (): |
752 | + impl(std::make_shared<Impl>()) |
753 | { |
754 | - impl = std::make_shared<Impl>(); |
755 | if (!impl) |
756 | { |
757 | throw std::runtime_error("Unable to build implementation of UAL Factory"); |
758 | |
759 | === modified file 'service/qtbridge.cpp' |
760 | --- service/qtbridge.cpp 2014-06-04 20:23:21 +0000 |
761 | +++ service/qtbridge.cpp 2015-09-03 14:42:58 +0000 |
762 | @@ -50,7 +50,7 @@ |
763 | class TaskEvent : public QEvent |
764 | { |
765 | public: |
766 | - TaskEvent(const std::function<void()>& task) |
767 | + explicit TaskEvent(const std::function<void()>& task) |
768 | : QEvent(qt_core_world_task_event_type()), |
769 | task(task) |
770 | { |
771 | @@ -84,7 +84,7 @@ |
772 | Q_OBJECT |
773 | |
774 | public: |
775 | - TaskHandler(QObject* parent) : QObject(parent) |
776 | + explicit TaskHandler(QObject* parent) : QObject(parent) |
777 | { |
778 | } |
779 | |
780 | |
781 | === modified file 'service/refund-http.h' |
782 | --- service/refund-http.h 2015-07-01 17:41:51 +0000 |
783 | +++ service/refund-http.h 2015-09-03 14:42:58 +0000 |
784 | @@ -28,7 +28,7 @@ |
785 | class HttpFactory : public Factory |
786 | { |
787 | public: |
788 | - HttpFactory (Web::ClickPurchasesApi::Ptr cpa_in); |
789 | + explicit HttpFactory (Web::ClickPurchasesApi::Ptr cpa_in); |
790 | bool running () override; |
791 | Item::Ptr refund (const std::string& appid, const std::string& itemid) override; |
792 | |
793 | |
794 | === modified file 'service/refund-null.cpp' |
795 | --- service/refund-null.cpp 2015-07-01 17:41:51 +0000 |
796 | +++ service/refund-null.cpp 2015-09-03 14:42:58 +0000 |
797 | @@ -40,7 +40,7 @@ |
798 | } |
799 | |
800 | Item::Ptr |
801 | -NullFactory::refund (const std::string& appid, const std::string& itemid) |
802 | +NullFactory::refund (const std::string& /*appid*/, const std::string& /*itemid*/) |
803 | { |
804 | return std::make_shared<NullItem>(); |
805 | } |
806 | |
807 | === modified file 'service/token-grabber-u1.cpp' |
808 | --- service/token-grabber-u1.cpp 2014-08-07 15:17:21 +0000 |
809 | +++ service/token-grabber-u1.cpp 2015-09-03 14:42:58 +0000 |
810 | @@ -96,7 +96,7 @@ |
811 | service.getCredentials(); |
812 | } |
813 | |
814 | -void TokenGrabberU1Qt::accountChanged(Accounts::AccountId id) |
815 | +void TokenGrabberU1Qt::accountChanged(Accounts::AccountId /*id*/) |
816 | { |
817 | /* We don't need to worry about @id here because there |
818 | can only be one U1 account for the user at a time, so |
819 | @@ -135,16 +135,15 @@ |
820 | return retval; |
821 | } |
822 | |
823 | -TokenGrabberU1::TokenGrabberU1 (void) : |
824 | - grabber(nullptr) |
825 | -{ |
826 | +TokenGrabberU1::TokenGrabberU1 (): |
827 | //qt = std::make_shared<TokenGrabberU1Qt>(); |
828 | - qtfuture = qt::core::world::enter_with_task_and_expect_result<std::shared_ptr<TokenGrabberU1Qt>>([]() |
829 | + qtfuture(qt::core::world::enter_with_task_and_expect_result<std::shared_ptr<TokenGrabberU1Qt>>([]() |
830 | { |
831 | auto qtgrabber = std::make_shared<TokenGrabberU1Qt>(); |
832 | qtgrabber->run(); |
833 | return qtgrabber; |
834 | - }); |
835 | + })) |
836 | +{ |
837 | } |
838 | |
839 | TokenGrabberU1::~TokenGrabberU1 (void) |
840 | |
841 | === modified file 'service/verification-http.h' |
842 | --- service/verification-http.h 2015-07-06 16:52:08 +0000 |
843 | +++ service/verification-http.h 2015-09-03 14:42:58 +0000 |
844 | @@ -29,7 +29,7 @@ |
845 | |
846 | class HttpFactory : public Factory { |
847 | public: |
848 | - HttpFactory (Web::ClickPurchasesApi::Ptr cpa_in); |
849 | + explicit HttpFactory (Web::ClickPurchasesApi::Ptr cpa_in); |
850 | virtual bool running () override; |
851 | virtual Item::Ptr verifyItem (const std::string& appid, const std::string& itemid) override; |
852 | |
853 | |
854 | === modified file 'service/verification-null.cpp' |
855 | --- service/verification-null.cpp 2015-04-30 08:54:31 +0000 |
856 | +++ service/verification-null.cpp 2015-09-03 14:42:58 +0000 |
857 | @@ -47,7 +47,7 @@ |
858 | } |
859 | |
860 | Item::Ptr |
861 | -NullFactory::verifyItem (const std::string& appid, const std::string& itemid) |
862 | +NullFactory::verifyItem (const std::string& /*appid*/, const std::string& /*itemid*/) |
863 | { |
864 | return std::make_shared<NullItem>(); |
865 | } |
866 | |
867 | === modified file 'service/webclient-curl.cpp' |
868 | --- service/webclient-curl.cpp 2015-07-01 17:41:51 +0000 |
869 | +++ service/webclient-curl.cpp 2015-09-03 14:42:58 +0000 |
870 | @@ -101,11 +101,10 @@ |
871 | network socket. */ |
872 | exec = std::thread([this]() |
873 | { |
874 | - std::string authheader; |
875 | CURL* handle = curl_easy_init(); |
876 | |
877 | /* Helps with threads */ |
878 | - curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1); |
879 | + curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1L); |
880 | curl_easy_setopt(handle, CURLOPT_URL, _url.c_str()); |
881 | curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, curlWrite); |
882 | curl_easy_setopt(handle, CURLOPT_WRITEDATA, this); |
883 | |
884 | === modified file 'service/webclient-curl.h' |
885 | --- service/webclient-curl.h 2015-07-06 16:52:08 +0000 |
886 | +++ service/webclient-curl.h 2015-09-03 14:42:58 +0000 |
887 | @@ -27,7 +27,7 @@ |
888 | |
889 | class CurlFactory : public Factory { |
890 | public: |
891 | - CurlFactory (TokenGrabber::Ptr token); |
892 | + explicit CurlFactory (TokenGrabber::Ptr token); |
893 | ~CurlFactory (); |
894 | |
895 | virtual bool running () override; |
896 | |
897 | === modified file 'service/webclient-null.cpp' |
898 | --- service/webclient-null.cpp 2015-07-01 17:41:51 +0000 |
899 | +++ service/webclient-null.cpp 2015-09-03 14:42:58 +0000 |
900 | @@ -35,12 +35,12 @@ |
901 | return false; |
902 | } |
903 | |
904 | - virtual void set_header (const std::string& key, |
905 | - const std::string& value) override |
906 | + virtual void set_header (const std::string& /*key*/, |
907 | + const std::string& /*value*/) override |
908 | { |
909 | } |
910 | |
911 | - virtual void set_post (const std::vector<char>& body) override |
912 | + virtual void set_post (const std::vector<char>& /*body*/) override |
913 | { |
914 | } |
915 | }; |
916 | @@ -53,8 +53,8 @@ |
917 | } |
918 | |
919 | Request::Ptr |
920 | -NullFactory::create_request (const std::string& url, |
921 | - bool sign) |
922 | +NullFactory::create_request (const std::string& /*url*/, |
923 | + bool /*sign*/) |
924 | { |
925 | return std::make_shared<NullRequest>(); |
926 | } |
927 | |
928 | === modified file 'tests/item-test.h' |
929 | --- tests/item-test.h 2015-07-06 16:52:58 +0000 |
930 | +++ tests/item-test.h 2015-09-03 14:42:58 +0000 |
931 | @@ -26,8 +26,8 @@ |
932 | |
933 | class TestItem : public Item |
934 | { |
935 | - std::string _id; |
936 | - std::string _app; |
937 | + const std::string _id; |
938 | + const std::string _app; |
939 | uint64_t refund_timeout; |
940 | Status status = Status::UNKNOWN; |
941 | bool verifyResult = false; |
942 | @@ -35,18 +35,18 @@ |
943 | bool purchaseResult = false; |
944 | |
945 | public: |
946 | - TestItem (std::string& app, std::string& id) : |
947 | + TestItem (const std::string& app, const std::string& id) : |
948 | _id(id), |
949 | _app(app) |
950 | { |
951 | } |
952 | |
953 | - std::string& getId (void) override |
954 | + const std::string& getId (void) override |
955 | { |
956 | return _id; |
957 | } |
958 | |
959 | - std::string& getApp (void) |
960 | + const std::string& getApp (void) |
961 | { |
962 | return _app; |
963 | } |
964 | @@ -92,7 +92,7 @@ |
965 | { |
966 | std::map<std::string, std::shared_ptr<std::map<std::string, Item::Ptr>>> data; |
967 | public: |
968 | - std::list<std::string> listApplications (void) |
969 | + std::list<std::string> listApplications (void) override |
970 | { |
971 | std::list<std::string> apps; |
972 | |
973 | @@ -107,7 +107,7 @@ |
974 | return apps; |
975 | } |
976 | |
977 | - std::shared_ptr<std::map<std::string, Item::Ptr>> getItems (std::string& application) |
978 | + std::shared_ptr<std::map<std::string, Item::Ptr>> getItems (const std::string& application) override |
979 | { |
980 | auto app = data[application]; |
981 | |
982 | @@ -120,7 +120,7 @@ |
983 | return app; |
984 | } |
985 | |
986 | - Item::Ptr getItem (std::string& application, std::string& itemid) |
987 | + Item::Ptr getItem (const std::string& application, const std::string& itemid) override |
988 | { |
989 | auto app = getItems(application); |
990 | Item::Ptr item = (*app)[itemid]; |
PASSED: Continuous integration, rev:51 jenkins. qa.ubuntu. com/job/ pay-service- 15.04-ci/ 5/ jenkins. qa.ubuntu. com/job/ pay-service- 15.04-vivid- amd64-ci/ 5 jenkins. qa.ubuntu. com/job/ pay-service- 15.04-vivid- armhf-ci/ 5 jenkins. qa.ubuntu. com/job/ pay-service- 15.04-vivid- armhf-ci/ 5/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/pay- service- 15.04-ci/ 5/rebuild
http://