You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2019/04/24 02:48:23 UTC

[trafficserver] branch master updated: cppcheck: Fixes issues found in async_http_fetch_streaming

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 65adc6e  cppcheck: Fixes issues found in async_http_fetch_streaming
65adc6e is described below

commit 65adc6e49891e0b2afafbf8b50e8ca4af3e63da9
Author: Randall Meyer <ra...@yahoo.com>
AuthorDate: Wed Apr 24 09:10:23 2019 +0800

    cppcheck: Fixes issues found in async_http_fetch_streaming
    
    (style) Class 'Intercept' has a constructor with 1 argument that is not explicit.
    (performance) Variable 'main_url_' is assigned in constructor body. Consider performing initialization in initialization list.
---
 .../cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc b/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
index 1389e9c..f953ab0 100644
--- a/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
+++ b/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
@@ -42,11 +42,14 @@ GlobalPlugin *plugin;
 class Intercept : public InterceptPlugin, public AsyncReceiver<AsyncHttpFetch>
 {
 public:
-  Intercept(Transaction &transaction)
-    : InterceptPlugin(transaction, InterceptPlugin::SERVER_INTERCEPT), transaction_(transaction), num_fetches_(0)
+  explicit Intercept(Transaction &transaction)
+    : InterceptPlugin(transaction, InterceptPlugin::SERVER_INTERCEPT),
+      transaction_(transaction),
+      main_url_(transaction.getClientRequest().getUrl().getUrlString()),
+      num_fetches_(0)
   {
-    main_url_ = transaction.getClientRequest().getUrl().getUrlString();
   }
+
   void consume(const string &data, InterceptPlugin::RequestDataType type) override;
   void handleInputComplete() override;
   void handleAsyncComplete(AsyncHttpFetch &async_http_fetch) override;