You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tubemq.apache.org by go...@apache.org on 2020/10/14 11:29:55 UTC

[incubator-tubemq] branch master updated: [TUBEMQ-374]Adjust some coding style issues (#286)

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

gosonzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tubemq.git


The following commit(s) were added to refs/heads/master by this push:
     new 13ac803  [TUBEMQ-374]Adjust some coding style issues (#286)
13ac803 is described below

commit 13ac8035d5bacbe1bcf0e200b60f84cb50d1501a
Author: gosonzhang <46...@qq.com>
AuthorDate: Wed Oct 14 19:29:45 2020 +0800

    [TUBEMQ-374]Adjust some coding style issues (#286)
    
    Co-authored-by: gosonzhang <go...@tencent.com>
---
 .../example/consumer/test_multithread_pull.cc                  |  4 ++--
 tubemq-client-twins/tubemq-client-cpp/release/release_linux.sh |  3 +--
 tubemq-client-twins/tubemq-client-cpp/src/any.h                | 10 +++++-----
 tubemq-client-twins/tubemq-client-cpp/src/buffer.h             |  1 -
 tubemq-client-twins/tubemq-client-cpp/src/executor_pool.cc     |  4 +---
 tubemq-client-twins/tubemq-client-cpp/src/executor_pool.h      |  4 ++--
 tubemq-client-twins/tubemq-client-cpp/src/logger.cc            |  4 ++--
 tubemq-client-twins/tubemq-client-cpp/src/tubemq_codec.h       |  3 ++-
 8 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_multithread_pull.cc b/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_multithread_pull.cc
index 1fdc5cd..f5a7d5a 100644
--- a/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_multithread_pull.cc
+++ b/tubemq-client-twins/tubemq-client-cpp/example/consumer/test_multithread_pull.cc
@@ -66,7 +66,6 @@ void calc_message_count(int64_t msg_count) {
   }
 }
 
-
 void thread_task_pull(int32_t thread_no) {
   bool result;
   int64_t msg_count = 0;
@@ -106,6 +105,8 @@ void thread_task_pull(int32_t thread_no) {
 }
 
 
+
+
 int main(int argc, char* argv[]) {
   bool result;
   string err_info;
@@ -122,7 +123,6 @@ int main(int argc, char* argv[]) {
   if (argc > 4) {
     conf_file = argv[4];
   }
-
   int32_t thread_num = 15;
   set<string> topic_list;
   topic_list.insert(topic_name);
diff --git a/tubemq-client-twins/tubemq-client-cpp/release/release_linux.sh b/tubemq-client-twins/tubemq-client-cpp/release/release_linux.sh
index 13a45e6..493c99d 100644
--- a/tubemq-client-twins/tubemq-client-cpp/release/release_linux.sh
+++ b/tubemq-client-twins/tubemq-client-cpp/release/release_linux.sh
@@ -33,7 +33,6 @@ mkdir lib
 
 cp ../build/src/libtubemq.a lib/
 cp ../build/third_party/lib/liblog4cplus.a lib/
-cp ../build/third_party/lib64/libsnappy.a lib/
 cp ../build/proto/libtubemq_proto.a lib/
 cp /usr/local/lib/libprotobuf.a lib/
 cp -rf ../include/*  tubemq/include/
@@ -53,7 +52,7 @@ cd ..
 
 cd tubemq/demo
 g++ -g -std=c++11 -c test_consumer.cc -I../include/
-#g++ -g -std=c++11 -o test_consumer test_consumer.o -L../lib/  -ltubemq -ltubemq_proto -lssl -lcrypto -lpthread -lprotobuf -llog4cplus -lsnappy -lrt
+#g++ -g -std=c++11 -o test_consumer test_consumer.o -L../lib/  -ltubemq -ltubemq_proto -lssl -lcrypto -lpthread -lprotobuf -llog4cplus -lrt
 g++ -g -std=c++11 -o test_consumer test_consumer.o -L../lib/  -ltubemq_rel -lssl -lcrypto -lpthread -lrt
 rm *.o
 cd -
diff --git a/tubemq-client-twins/tubemq-client-cpp/src/any.h b/tubemq-client-twins/tubemq-client-cpp/src/any.h
index 722d944..4bb2a15 100644
--- a/tubemq-client-twins/tubemq-client-cpp/src/any.h
+++ b/tubemq-client-twins/tubemq-client-cpp/src/any.h
@@ -20,8 +20,8 @@
 // Copy from evpp project
 // @see https://github.com/Qihoo360/evpp/blob/master/evpp/any.h
 
-#ifndef _TUBEMQ_ANY_H_
-#define _TUBEMQ_ANY_H_
+#ifndef TUBEMQ_CLIENT_CPP_SRC_ANY_H_
+#define TUBEMQ_CLIENT_CPP_SRC_ANY_H_
 
 #include <assert.h>
 
@@ -65,7 +65,7 @@ class Any {
   template <typename ValueType>
   explicit Any(const ValueType& value) : content_(new Holder<ValueType>(value)) {}
 
-  Any(const Any& other) : content_(other.content_ ? other.content_->clone() : nullptr) {}
+  explicit Any(const Any& other) : content_(other.content_ ? other.content_->clone() : nullptr) {}
 
  public:
   Any& swap(Any& rhs) {
@@ -115,7 +115,7 @@ class Any {
   template <typename ValueType>
   class Holder : public PlaceHolder {
    public:
-    Holder(const ValueType& value) : held_(value) {}
+    explicit Holder(const ValueType& value) : held_(value) {}
 
     virtual const std::type_info& GetType() const { return typeid(ValueType); }
 
@@ -157,4 +157,4 @@ ValueType any_cast(const Any& any) {
 }
 }  // namespace tubemq
 
-#endif /* _TUBEMQ_ANY_H_ */
+#endif /* TUBEMQ_CLIENT_CPP_SRC_ANY_H_ */
diff --git a/tubemq-client-twins/tubemq-client-cpp/src/buffer.h b/tubemq-client-twins/tubemq-client-cpp/src/buffer.h
index 0851375..da8c95b 100644
--- a/tubemq-client-twins/tubemq-client-cpp/src/buffer.h
+++ b/tubemq-client-twins/tubemq-client-cpp/src/buffer.h
@@ -123,7 +123,6 @@ class Buffer {
       return;
     }
 
-    // TODO add the implementation logic here
     grow(len + reserved_prepend_size_);
   }
 
diff --git a/tubemq-client-twins/tubemq-client-cpp/src/executor_pool.cc b/tubemq-client-twins/tubemq-client-cpp/src/executor_pool.cc
index 71a84ac..f88963e 100644
--- a/tubemq-client-twins/tubemq-client-cpp/src/executor_pool.cc
+++ b/tubemq-client-twins/tubemq-client-cpp/src/executor_pool.cc
@@ -19,11 +19,9 @@
 
 #include "executor_pool.h"
 
+#include <asio.hpp>
 #include <functional>
 #include <memory>
-#include <asio.hpp>
-
-
 
 namespace tubemq {
 
diff --git a/tubemq-client-twins/tubemq-client-cpp/src/executor_pool.h b/tubemq-client-twins/tubemq-client-cpp/src/executor_pool.h
index e858985..2c22fd8 100644
--- a/tubemq-client-twins/tubemq-client-cpp/src/executor_pool.h
+++ b/tubemq-client-twins/tubemq-client-cpp/src/executor_pool.h
@@ -22,14 +22,14 @@
 
 #include <stdlib.h>
 
+#include <asio.hpp>
+#include <asio/ssl.hpp>
 #include <functional>
 #include <memory>
 #include <mutex>
 #include <thread>
 #include <vector>
 
-#include <asio.hpp>
-#include <asio/ssl.hpp>
 #include "noncopyable.h"
 
 namespace tubemq {
diff --git a/tubemq-client-twins/tubemq-client-cpp/src/logger.cc b/tubemq-client-twins/tubemq-client-cpp/src/logger.cc
index 81c010b..eb03ad3 100644
--- a/tubemq-client-twins/tubemq-client-cpp/src/logger.cc
+++ b/tubemq-client-twins/tubemq-client-cpp/src/logger.cc
@@ -57,8 +57,8 @@ bool Logger::Write(const char* format, ...) {
 
 bool Logger::writeStream(const char* log) {
   auto logger = log4cplus::Logger::getInstance(instance_);
-  // log4cplus::tostringstream log4cplus_buf;
-  // log4cplus_buf << log;
+  // log4cplus::tostringstream _log4cplus_buf;
+  //_log4cplus_buf << log;
   logger.forcedLog(log4cplus::TRACE_LOG_LEVEL, log);
   return true;
 }
diff --git a/tubemq-client-twins/tubemq-client-cpp/src/tubemq_codec.h b/tubemq-client-twins/tubemq-client-cpp/src/tubemq_codec.h
index b3996df..b37902f 100644
--- a/tubemq-client-twins/tubemq-client-cpp/src/tubemq_codec.h
+++ b/tubemq-client-twins/tubemq-client-cpp/src/tubemq_codec.h
@@ -140,7 +140,8 @@ class TubeMQCodec final : public CodecProtocol {
         4 + rpc_header.ByteSizeLong() + 4 + req_header.ByteSizeLong() + 4 + req_body.ByteSizeLong();
     std::string step_buff;
     step_buff.resize(serial_len);
-    google::protobuf::io::ArrayOutputStream rawOutput((void *)step_buff.data(), serial_len);
+    google::protobuf::io::ArrayOutputStream rawOutput(
+      static_cast<void*>(const_cast<char*>(step_buff.data())), serial_len);
     bool result = writeDelimitedTo(rpc_header, &rawOutput);
     if (!result) {
       return result;