diff options
author | Konrad Grochowski <hcorg@apache.org> | 2015-11-05 20:23:11 +0100 |
---|---|---|
committer | Konrad Grochowski <hcorg@apache.org> | 2015-11-05 20:23:11 +0100 |
commit | 7f4be5f188409cfe80059f501cc59ad40c6b969d (patch) | |
tree | 0ce42b173d64aaeaa6b1195f629f2ede82a4f459 /lib/cpp/src/thrift | |
parent | 673c94137aa91e3efc2ee08bbd88f6ba1bbf3a2f (diff) | |
download | thrift-7f4be5f188409cfe80059f501cc59ad40c6b969d.tar.gz |
some 'some make style' suggestions applied to C++ files
Diffstat (limited to 'lib/cpp/src/thrift')
-rw-r--r-- | lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.h | 71 | ||||
-rw-r--r-- | lib/cpp/src/thrift/concurrency/ThreadManager.cpp | 4 | ||||
-rw-r--r-- | lib/cpp/src/thrift/protocol/TBinaryProtocol.h | 22 | ||||
-rw-r--r-- | lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc | 30 | ||||
-rw-r--r-- | lib/cpp/src/thrift/protocol/TProtocolTypes.h | 10 | ||||
-rw-r--r-- | lib/cpp/src/thrift/server/TNonblockingServer.cpp | 5 | ||||
-rw-r--r-- | lib/cpp/src/thrift/transport/THeaderTransport.h | 2 | ||||
-rw-r--r-- | lib/cpp/src/thrift/transport/TPipe.h | 4 | ||||
-rw-r--r-- | lib/cpp/src/thrift/windows/config.h | 2 |
9 files changed, 75 insertions, 75 deletions
diff --git a/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.h b/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.h index 8997a230b..7afcbc2da 100644 --- a/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.h +++ b/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.h @@ -27,76 +27,75 @@ #include <string> #include <map> -namespace apache { namespace thrift { namespace async { +namespace apache { +namespace thrift { +namespace async { class TConcurrentClientSyncInfo; -class TConcurrentSendSentry -{ +class TConcurrentSendSentry { public: - explicit TConcurrentSendSentry(TConcurrentClientSyncInfo *sync); + explicit TConcurrentSendSentry(TConcurrentClientSyncInfo* sync); ~TConcurrentSendSentry(); void commit(); + private: - TConcurrentClientSyncInfo &sync_; + TConcurrentClientSyncInfo& sync_; bool committed_; }; -class TConcurrentRecvSentry -{ +class TConcurrentRecvSentry { public: - TConcurrentRecvSentry(TConcurrentClientSyncInfo *sync, int32_t seqid); + TConcurrentRecvSentry(TConcurrentClientSyncInfo* sync, int32_t seqid); ~TConcurrentRecvSentry(); void commit(); + private: - TConcurrentClientSyncInfo &sync_; + TConcurrentClientSyncInfo& sync_; int32_t seqid_; bool committed_; }; -class TConcurrentClientSyncInfo -{ -private: //typedefs +class TConcurrentClientSyncInfo { +private: // typedefs typedef boost::shared_ptr< ::apache::thrift::concurrency::Monitor> MonitorPtr; typedef std::map<int32_t, MonitorPtr> MonitorMap; + public: TConcurrentClientSyncInfo(); int32_t generateSeqId(); - bool getPending( - std::string &fname, - ::apache::thrift::protocol::TMessageType &mtype, - int32_t &rseqid); /* requires readMutex_ */ + bool getPending(std::string& fname, + ::apache::thrift::protocol::TMessageType& mtype, + int32_t& rseqid); /* requires readMutex_ */ - void updatePending( - const std::string &fname, - ::apache::thrift::protocol::TMessageType mtype, - int32_t rseqid); /* requires readMutex_ */ + void updatePending(const std::string& fname, + ::apache::thrift::protocol::TMessageType mtype, + int32_t rseqid); /* requires readMutex_ */ void waitForWork(int32_t seqid); /* requires readMutex_ */ - ::apache::thrift::concurrency::Mutex &getReadMutex() {return readMutex_;} - ::apache::thrift::concurrency::Mutex &getWriteMutex() {return writeMutex_;} + ::apache::thrift::concurrency::Mutex& getReadMutex() { return readMutex_; } + ::apache::thrift::concurrency::Mutex& getWriteMutex() { return writeMutex_; } -private: //constants - enum {MONITOR_CACHE_SIZE = 10}; -private: //functions +private: // constants + enum { MONITOR_CACHE_SIZE = 10 }; + +private: // functions MonitorPtr newMonitor_( - const ::apache::thrift::concurrency::Guard &seqidGuard); /* requires seqidMutex_ */ - void deleteMonitor_( - const ::apache::thrift::concurrency::Guard &seqidGuard, - MonitorPtr &m); /*noexcept*/ /* requires seqidMutex_ */ + const ::apache::thrift::concurrency::Guard& seqidGuard); /* requires seqidMutex_ */ + void deleteMonitor_(const ::apache::thrift::concurrency::Guard& seqidGuard, MonitorPtr& m); + /*noexcept*/ /* requires seqidMutex_ */ void wakeupAnyone_( - const ::apache::thrift::concurrency::Guard &seqidGuard); /* requires seqidMutex_ */ - void markBad_( - const ::apache::thrift::concurrency::Guard &seqidGuard); /* requires seqidMutex_ */ + const ::apache::thrift::concurrency::Guard& seqidGuard); /* requires seqidMutex_ */ + void markBad_(const ::apache::thrift::concurrency::Guard& seqidGuard); /* requires seqidMutex_ */ void throwBadSeqId_(); void throwDeadConnection_(); -private: //data members +private: // data members volatile bool stop_; ::apache::thrift::concurrency::Mutex seqidMutex_; @@ -117,11 +116,11 @@ private: //data members ::apache::thrift::protocol::TMessageType mtypePending_; // end readMutex_ protected members - friend class TConcurrentSendSentry; friend class TConcurrentRecvSentry; }; - -}}} // apache::thrift::async +} +} +} // apache::thrift::async #endif // _THRIFT_TCONCURRENTCLIENTSYNCINFO_H_ diff --git a/lib/cpp/src/thrift/concurrency/ThreadManager.cpp b/lib/cpp/src/thrift/concurrency/ThreadManager.cpp index a2b44d4ff..71b8fec57 100644 --- a/lib/cpp/src/thrift/concurrency/ThreadManager.cpp +++ b/lib/cpp/src/thrift/concurrency/ThreadManager.cpp @@ -276,8 +276,8 @@ public: /* If we have a pending task max and we just dropped below it, wakeup any thread that might be blocked on add. */ if (manager_->pendingTaskCountMax_ != 0 - && manager_->tasks_.size() <= manager_->pendingTaskCountMax_ - 1) { - manager_->maxMonitor_.notify(); + && manager_->tasks_.size() <= manager_->pendingTaskCountMax_ - 1) { + manager_->maxMonitor_.notify(); } } else { idle_ = true; diff --git a/lib/cpp/src/thrift/protocol/TBinaryProtocol.h b/lib/cpp/src/thrift/protocol/TBinaryProtocol.h index 92491b0f0..87c53f78e 100644 --- a/lib/cpp/src/thrift/protocol/TBinaryProtocol.h +++ b/lib/cpp/src/thrift/protocol/TBinaryProtocol.h @@ -216,19 +216,17 @@ public: boost::shared_ptr<Transport_> specific_trans = boost::dynamic_pointer_cast<Transport_>(trans); TProtocol* prot; if (specific_trans) { - prot = new TBinaryProtocolT<Transport_, ByteOrder_>( - specific_trans, - string_limit_, - container_limit_, - strict_read_, - strict_write_); + prot = new TBinaryProtocolT<Transport_, ByteOrder_>(specific_trans, + string_limit_, + container_limit_, + strict_read_, + strict_write_); } else { - prot = new TBinaryProtocolT<TTransport, ByteOrder_>( - trans, - string_limit_, - container_limit_, - strict_read_, - strict_write_); + prot = new TBinaryProtocolT<TTransport, ByteOrder_>(trans, + string_limit_, + container_limit_, + strict_read_, + strict_write_); } return boost::shared_ptr<TProtocol>(prot); diff --git a/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc b/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc index ae350df15..d6f6dbb3d 100644 --- a/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc +++ b/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc @@ -30,8 +30,8 @@ namespace protocol { template <class Transport_, class ByteOrder_> uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeMessageBegin(const std::string& name, - const TMessageType messageType, - const int32_t seqid) { + const TMessageType messageType, + const int32_t seqid) { if (this->strict_write_) { int32_t version = (VERSION_1) | ((int32_t)messageType); uint32_t wsize = 0; @@ -66,8 +66,8 @@ uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeStructEnd() { template <class Transport_, class ByteOrder_> uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeFieldBegin(const char* name, - const TType fieldType, - const int16_t fieldId) { + const TType fieldType, + const int16_t fieldId) { (void)name; uint32_t wsize = 0; wsize += writeByte((int8_t)fieldType); @@ -87,8 +87,8 @@ uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeFieldStop() { template <class Transport_, class ByteOrder_> uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeMapBegin(const TType keyType, - const TType valType, - const uint32_t size) { + const TType valType, + const uint32_t size) { uint32_t wsize = 0; wsize += writeByte((int8_t)keyType); wsize += writeByte((int8_t)valType); @@ -102,7 +102,8 @@ uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeMapEnd() { } template <class Transport_, class ByteOrder_> -uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeListBegin(const TType elemType, const uint32_t size) { +uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeListBegin(const TType elemType, + const uint32_t size) { uint32_t wsize = 0; wsize += writeByte((int8_t)elemType); wsize += writeI32((int32_t)size); @@ -115,7 +116,8 @@ uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeListEnd() { } template <class Transport_, class ByteOrder_> -uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeSetBegin(const TType elemType, const uint32_t size) { +uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeSetBegin(const TType elemType, + const uint32_t size) { uint32_t wsize = 0; wsize += writeByte((int8_t)elemType); wsize += writeI32((int32_t)size); @@ -196,8 +198,8 @@ uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeBinary(const std::string template <class Transport_, class ByteOrder_> uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::readMessageBegin(std::string& name, - TMessageType& messageType, - int32_t& seqid) { + TMessageType& messageType, + int32_t& seqid) { uint32_t result = 0; int32_t sz; result += readI32(sz); @@ -245,8 +247,8 @@ uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::readStructEnd() { template <class Transport_, class ByteOrder_> uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::readFieldBegin(std::string& name, - TType& fieldType, - int16_t& fieldId) { + TType& fieldType, + int16_t& fieldId) { (void)name; uint32_t result = 0; int8_t type; @@ -267,8 +269,8 @@ uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::readFieldEnd() { template <class Transport_, class ByteOrder_> uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::readMapBegin(TType& keyType, - TType& valType, - uint32_t& size) { + TType& valType, + uint32_t& size) { int8_t k, v; uint32_t result = 0; int32_t sizei; diff --git a/lib/cpp/src/thrift/protocol/TProtocolTypes.h b/lib/cpp/src/thrift/protocol/TProtocolTypes.h index ca22b545f..6898b24eb 100644 --- a/lib/cpp/src/thrift/protocol/TProtocolTypes.h +++ b/lib/cpp/src/thrift/protocol/TProtocolTypes.h @@ -20,15 +20,17 @@ #ifndef THRIFT_PROTOCOL_TPROTOCOLTYPES_H_ #define THRIFT_PROTOCOL_TPROTOCOLTYPES_H_ 1 -namespace apache { namespace thrift { namespace protocol { +namespace apache { +namespace thrift { +namespace protocol { enum PROTOCOL_TYPES { T_BINARY_PROTOCOL = 0, T_JSON_PROTOCOL = 1, T_COMPACT_PROTOCOL = 2, }; - -}}} // apache::thrift::protocol +} +} +} // apache::thrift::protocol #endif // #define _THRIFT_PROTOCOL_TPROTOCOLTYPES_H_ 1 - diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.cpp b/lib/cpp/src/thrift/server/TNonblockingServer.cpp index ede34c434..7344b8be2 100644 --- a/lib/cpp/src/thrift/server/TNonblockingServer.cpp +++ b/lib/cpp/src/thrift/server/TNonblockingServer.cpp @@ -394,7 +394,7 @@ void TNonblockingServer::TConnection::init(THRIFT_SOCKET socket, // Create protocol if (server_->getHeaderTransport()) { inputProtocol_ = server_->getInputProtocolFactory()->getProtocol(factoryInputTransport_, - factoryOutputTransport_); + factoryOutputTransport_); outputProtocol_ = inputProtocol_; } else { inputProtocol_ = server_->getInputProtocolFactory()->getProtocol(factoryInputTransport_); @@ -542,13 +542,12 @@ void TNonblockingServer::TConnection::workSocket() { } bool TNonblockingServer::getHeaderTransport() { - // Currently if there is no output protocol factory, + // Currently if there is no output protocol factory, // we assume header transport (without having to create // a new transport and check) return getOutputProtocolFactory() == NULL; } - /** * This is called when the application transitions from one state into * another. This means that it has finished writing the data that it needed diff --git a/lib/cpp/src/thrift/transport/THeaderTransport.h b/lib/cpp/src/thrift/transport/THeaderTransport.h index 0cef56dde..d3b851e9e 100644 --- a/lib/cpp/src/thrift/transport/THeaderTransport.h +++ b/lib/cpp/src/thrift/transport/THeaderTransport.h @@ -130,7 +130,7 @@ public: void readHeaderFormat(uint16_t headerSize, uint32_t sz); /** - * Untransform the data based on the recieved header flags + * Untransform the data based on the received header flags * On conclusion of function, setReadBuffer is called with the * untransformed data. * diff --git a/lib/cpp/src/thrift/transport/TPipe.h b/lib/cpp/src/thrift/transport/TPipe.h index fdb17ee22..5dd8f9a24 100644 --- a/lib/cpp/src/thrift/transport/TPipe.h +++ b/lib/cpp/src/thrift/transport/TPipe.h @@ -51,8 +51,8 @@ public: // Constructs a new pipe object. TPipe(); // Named pipe constructors - - explicit TPipe(HANDLE Pipe); // HANDLE is a void* - explicit TPipe(TAutoHandle &Pipe); // this ctor will clear out / move from Pipe + explicit TPipe(HANDLE Pipe); // HANDLE is a void* + explicit TPipe(TAutoHandle& Pipe); // this ctor will clear out / move from Pipe // need a const char * overload so string literals don't go to the HANDLE overload explicit TPipe(const char* pipename); explicit TPipe(const std::string& pipename); diff --git a/lib/cpp/src/thrift/windows/config.h b/lib/cpp/src/thrift/windows/config.h index 24a94f86f..108e05b29 100644 --- a/lib/cpp/src/thrift/windows/config.h +++ b/lib/cpp/src/thrift/windows/config.h @@ -94,6 +94,6 @@ typedef boost::uint8_t uint8_t; #else #pragma comment(lib, "Ws2_32.lib") #pragma comment(lib, "advapi32.lib") // For security APIs in TPipeServer -#pragma comment(lib, "Shlwapi.lib") // For StrStrIA in TPipeServer +#pragma comment(lib, "Shlwapi.lib") // For StrStrIA in TPipeServer #endif #endif // _THRIFT_WINDOWS_CONFIG_H_ |