Thrift: Cleaned up whitespace.
Summary:
Replaced a lot of tabs with spaces in the thrift codebase.
Removed a lot of trailing whitespace from thrift-generated c++.
Added a few things to cleanup.sh.
Trac Bug: #
Blame Rev:
Reviewed By: mcslee
Test Plan:
Recompiled thrift.
Re-thrifted some test .thrifts.
Compiled the genrated c++.
Ran cleanup.sh.
Revert Plan: ok
Notes:
EImportant:
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665176 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/Mutex.h b/lib/cpp/src/concurrency/Mutex.h
index bb2a606..02accf9 100644
--- a/lib/cpp/src/concurrency/Mutex.h
+++ b/lib/cpp/src/concurrency/Mutex.h
@@ -66,9 +66,9 @@
RWGuard(const ReadWriteMutex& value, bool write = 0) : rw_mutex_(value) {
if (write) {
rw_mutex_.acquireWrite();
- } else {
+ } else {
rw_mutex_.acquireRead();
- }
+ }
}
~RWGuard() {
rw_mutex_.release();
diff --git a/lib/cpp/src/concurrency/ThreadManager.cpp b/lib/cpp/src/concurrency/ThreadManager.cpp
index 3d87724..d8b1e8c 100644
--- a/lib/cpp/src/concurrency/ThreadManager.cpp
+++ b/lib/cpp/src/concurrency/ThreadManager.cpp
@@ -202,8 +202,8 @@
Synchronized s(manager_->monitor_);
active = manager_->workerCount_ < manager_->workerMaxCount_;
if (active) {
- manager_->workerCount_++;
- notifyManager = manager_->workerCount_ == manager_->workerMaxCount_;
+ manager_->workerCount_++;
+ notifyManager = manager_->workerCount_ == manager_->workerMaxCount_;
}
}
@@ -227,24 +227,24 @@
*/
{
Synchronized s(manager_->monitor_);
- active = isActive();
+ active = isActive();
- while (active && manager_->tasks_.empty()) {
+ while (active && manager_->tasks_.empty()) {
manager_->idleCount_++;
idle_ = true;
manager_->monitor_.wait();
active = isActive();
idle_ = false;
manager_->idleCount_--;
- }
+ }
- if (active) {
+ if (active) {
if (!manager_->tasks_.empty()) {
task = manager_->tasks_.front();
manager_->tasks_.pop();
if (task->state_ == ThreadManager::Task::WAITING) {
task->state_ = ThreadManager::Task::EXECUTING;
- }
+ }
/* If we have a pending task max and we just dropped below it, wakeup any
thread that might be blocked on add. */
@@ -252,22 +252,22 @@
manager_->tasks_.size() == manager_->pendingTaskCountMax_ - 1) {
manager_->workerMonitor_.notify();
}
- }
- } else {
- idle_ = true;
- manager_->workerCount_--;
+ }
+ } else {
+ idle_ = true;
+ manager_->workerCount_--;
notifyManager = (manager_->workerCount_ == manager_->workerMaxCount_);
- }
+ }
}
if (task != NULL) {
- if (task->state_ == ThreadManager::Task::EXECUTING) {
- try {
+ if (task->state_ == ThreadManager::Task::EXECUTING) {
+ try {
task->run();
} catch(...) {
// XXX need to log this
- }
- }
+ }
+ }
}
}
@@ -384,7 +384,7 @@
if (idleCount_ < value) {
for (size_t ix = 0; ix < idleCount_; ix++) {
- monitor_.notify();
+ monitor_.notify();
}
} else {
monitor_.notifyAll();
diff --git a/lib/cpp/src/concurrency/TimerManager.cpp b/lib/cpp/src/concurrency/TimerManager.cpp
index b9e604c..4f77b2f 100644
--- a/lib/cpp/src/concurrency/TimerManager.cpp
+++ b/lib/cpp/src/concurrency/TimerManager.cpp
@@ -74,8 +74,8 @@
{
Synchronized s(manager_->monitor_);
if (manager_->state_ == TimerManager::STARTING) {
- manager_->state_ = TimerManager::STARTED;
- manager_->monitor_.notifyAll();
+ manager_->state_ = TimerManager::STARTED;
+ manager_->monitor_.notifyAll();
}
}
@@ -83,32 +83,32 @@
std::set<shared_ptr<TimerManager::Task> > expiredTasks;
{
Synchronized s(manager_->monitor_);
- task_iterator expiredTaskEnd;
- int64_t now = Util::currentTime();
- while (manager_->state_ == TimerManager::STARTED &&
+ task_iterator expiredTaskEnd;
+ int64_t now = Util::currentTime();
+ while (manager_->state_ == TimerManager::STARTED &&
(expiredTaskEnd = manager_->taskMap_.upper_bound(now)) == manager_->taskMap_.begin()) {
- int64_t timeout = 0LL;
- if (!manager_->taskMap_.empty()) {
+ int64_t timeout = 0LL;
+ if (!manager_->taskMap_.empty()) {
timeout = manager_->taskMap_.begin()->first - now;
- }
+ }
assert((timeout != 0 && manager_->taskCount_ > 0) || (timeout == 0 && manager_->taskCount_ == 0));
try {
manager_->monitor_.wait(timeout);
} catch (TimedOutException &e) {}
- now = Util::currentTime();
- }
-
- if (manager_->state_ == TimerManager::STARTED) {
+ now = Util::currentTime();
+ }
+
+ if (manager_->state_ == TimerManager::STARTED) {
for (task_iterator ix = manager_->taskMap_.begin(); ix != expiredTaskEnd; ix++) {
- shared_ptr<TimerManager::Task> task = ix->second;
+ shared_ptr<TimerManager::Task> task = ix->second;
expiredTasks.insert(task);
- if (task->state_ == TimerManager::Task::WAITING) {
- task->state_ = TimerManager::Task::EXECUTING;
- }
+ if (task->state_ == TimerManager::Task::WAITING) {
+ task->state_ = TimerManager::Task::EXECUTING;
+ }
manager_->taskCount_--;
- }
+ }
manager_->taskMap_.erase(manager_->taskMap_.begin(), expiredTaskEnd);
- }
+ }
}
for (std::set<shared_ptr<Task> >::iterator ix = expiredTasks.begin(); ix != expiredTasks.end(); ix++) {
@@ -120,8 +120,8 @@
{
Synchronized s(manager_->monitor_);
if (manager_->state_ == TimerManager::STOPPING) {
- manager_->state_ = TimerManager::STOPPED;
- manager_->monitor_.notify();
+ manager_->state_ = TimerManager::STOPPED;
+ manager_->monitor_.notify();
}
}
return;
diff --git a/lib/cpp/src/concurrency/test/Tests.cpp b/lib/cpp/src/concurrency/test/Tests.cpp
index a160472..2b7b7f3 100644
--- a/lib/cpp/src/concurrency/test/Tests.cpp
+++ b/lib/cpp/src/concurrency/test/Tests.cpp
@@ -129,13 +129,13 @@
for (size_t workerCount = minWorkerCount; workerCount < maxWorkerCount; workerCount*= 2) {
- size_t taskCount = workerCount * tasksPerWorker;
+ size_t taskCount = workerCount * tasksPerWorker;
- std::cout << "\t\tThreadManager load test: worker count: " << workerCount << " task count: " << taskCount << " delay: " << delay << std::endl;
+ std::cout << "\t\tThreadManager load test: worker count: " << workerCount << " task count: " << taskCount << " delay: " << delay << std::endl;
- ThreadManagerTests threadManagerTests;
+ ThreadManagerTests threadManagerTests;
- threadManagerTests.loadTest(taskCount, delay, workerCount);
+ threadManagerTests.loadTest(taskCount, delay, workerCount);
}
}
}
diff --git a/lib/cpp/src/concurrency/test/ThreadFactoryTests.h b/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
index 99bc94e..0dcf0bb 100644
--- a/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
+++ b/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
@@ -162,22 +162,22 @@
void run() {
{
Synchronized s(_monitor);
- if (_state == SynchStartTask::STARTING) {
- _state = SynchStartTask::STARTED;
- _monitor.notify();
- }
+ if (_state == SynchStartTask::STARTING) {
+ _state = SynchStartTask::STARTED;
+ _monitor.notify();
+ }
}
{
Synchronized s(_monitor);
while (_state == SynchStartTask::STARTED) {
- _monitor.wait();
- }
+ _monitor.wait();
+ }
- if (_state == SynchStartTask::STOPPING) {
+ if (_state == SynchStartTask::STOPPING) {
_state = SynchStartTask::STOPPED;
_monitor.notifyAll();
- }
+ }
}
}
@@ -208,7 +208,7 @@
{
Synchronized s(monitor);
while (state == SynchStartTask::STARTING) {
- monitor.wait();
+ monitor.wait();
}
}
@@ -224,13 +224,13 @@
if (state == SynchStartTask::STARTED) {
- state = SynchStartTask::STOPPING;
+ state = SynchStartTask::STOPPING;
- monitor.notify();
+ monitor.notify();
}
while (state == SynchStartTask::STOPPING) {
- monitor.wait();
+ monitor.wait();
}
}
diff --git a/lib/cpp/src/concurrency/test/ThreadManagerTests.h b/lib/cpp/src/concurrency/test/ThreadManagerTests.h
index a8fdcda..261ad5e 100644
--- a/lib/cpp/src/concurrency/test/ThreadManagerTests.h
+++ b/lib/cpp/src/concurrency/test/ThreadManagerTests.h
@@ -65,14 +65,14 @@
{
Synchronized s(_monitor);
- // std::cout << "Thread " << _count << " completed " << std::endl;
+ // std::cout << "Thread " << _count << " completed " << std::endl;
- _count--;
+ _count--;
- if (_count == 0) {
+ if (_count == 0) {
- _monitor.notify();
- }
+ _monitor.notify();
+ }
}
}
@@ -117,7 +117,7 @@
for (std::set<shared_ptr<ThreadManagerTests::Task> >::iterator ix = tasks.begin(); ix != tasks.end(); ix++) {
- threadManager->add(*ix);
+ threadManager->add(*ix);
}
{
@@ -125,7 +125,7 @@
while(activeCount > 0) {
- monitor.wait();
+ monitor.wait();
}
}
@@ -147,19 +147,19 @@
assert(delta > 0);
if (task->_startTime < firstTime) {
- firstTime = task->_startTime;
+ firstTime = task->_startTime;
}
if (task->_endTime > lastTime) {
- lastTime = task->_endTime;
+ lastTime = task->_endTime;
}
if (delta < minTime) {
- minTime = delta;
+ minTime = delta;
}
if (delta > maxTime) {
- maxTime = delta;
+ maxTime = delta;
}
averageTime+= delta;
@@ -258,7 +258,7 @@
}
for (std::set<shared_ptr<ThreadManagerTests::BlockTask> >::iterator ix = tasks.begin(); ix != tasks.end(); ix++) {
- threadManager->add(*ix);
+ threadManager->add(*ix);
}
if(!(success = (threadManager->totalTaskCount() == pendingTaskMaxCount + workerCount))) {
diff --git a/lib/cpp/src/concurrency/test/TimerManagerTests.h b/lib/cpp/src/concurrency/test/TimerManagerTests.h
index e7948e4..bd959cd 100644
--- a/lib/cpp/src/concurrency/test/TimerManagerTests.h
+++ b/lib/cpp/src/concurrency/test/TimerManagerTests.h
@@ -54,7 +54,7 @@
float error = delta / _timeout;
if(error < ERROR) {
- _success = true;
+ _success = true;
}
_done = true;
@@ -62,7 +62,7 @@
std::cout << "\t\t\tTimerManagerTests::Task[" << this << "] done" << std::endl; //debug
{Synchronized s(_monitor);
- _monitor.notifyAll();
+ _monitor.notifyAll();
}
}
@@ -99,11 +99,11 @@
{
Synchronized s(_monitor);
- timerManager.add(orphanTask, 10 * timeout);
+ timerManager.add(orphanTask, 10 * timeout);
- timerManager.add(task, timeout);
+ timerManager.add(task, timeout);
- _monitor.wait();
+ _monitor.wait();
}
assert(task->_done);
diff --git a/lib/cpp/src/protocol/TBinaryProtocol.cpp b/lib/cpp/src/protocol/TBinaryProtocol.cpp
index 6945851..30bbde6 100644
--- a/lib/cpp/src/protocol/TBinaryProtocol.cpp
+++ b/lib/cpp/src/protocol/TBinaryProtocol.cpp
@@ -193,8 +193,8 @@
*/
uint32_t TBinaryProtocol::readMessageBegin(std::string& name,
- TMessageType& messageType,
- int32_t& seqid) {
+ TMessageType& messageType,
+ int32_t& seqid) {
uint32_t result = 0;
int32_t sz;
result += readI32(sz);
diff --git a/lib/cpp/src/protocol/TBinaryProtocol.h b/lib/cpp/src/protocol/TBinaryProtocol.h
index 5047e02..01f7c3b 100644
--- a/lib/cpp/src/protocol/TBinaryProtocol.h
+++ b/lib/cpp/src/protocol/TBinaryProtocol.h
@@ -127,8 +127,8 @@
uint32_t readMessageBegin(std::string& name,
- TMessageType& messageType,
- int32_t& seqid);
+ TMessageType& messageType,
+ int32_t& seqid);
uint32_t readMessageEnd();
@@ -137,14 +137,14 @@
uint32_t readStructEnd();
uint32_t readFieldBegin(std::string& name,
- TType& fieldType,
- int16_t& fieldId);
+ TType& fieldType,
+ int16_t& fieldId);
uint32_t readFieldEnd();
uint32_t readMapBegin(TType& keyType,
- TType& valType,
- uint32_t& size);
+ TType& valType,
+ uint32_t& size);
uint32_t readMapEnd();
@@ -154,7 +154,7 @@
uint32_t readListEnd();
uint32_t readSetBegin(TType& elemType,
- uint32_t& size);
+ uint32_t& size);
uint32_t readSetEnd();
diff --git a/lib/cpp/src/protocol/TOneWayProtocol.h b/lib/cpp/src/protocol/TOneWayProtocol.h
index c928058..635744c 100644
--- a/lib/cpp/src/protocol/TOneWayProtocol.h
+++ b/lib/cpp/src/protocol/TOneWayProtocol.h
@@ -35,8 +35,8 @@
*/
uint32_t readMessageBegin(std::string& name,
- TMessageType& messageType,
- int32_t& seqid) {
+ TMessageType& messageType,
+ int32_t& seqid) {
throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
subclass_ + " does not support reading (yet).");
}
@@ -57,8 +57,8 @@
}
uint32_t readFieldBegin(std::string& name,
- TType& fieldType,
- int16_t& fieldId) {
+ TType& fieldType,
+ int16_t& fieldId) {
throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
subclass_ + " does not support reading (yet).");
}
@@ -69,8 +69,8 @@
}
uint32_t readMapBegin(TType& keyType,
- TType& valType,
- uint32_t& size) {
+ TType& valType,
+ uint32_t& size) {
throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
subclass_ + " does not support reading (yet).");
}
@@ -92,7 +92,7 @@
}
uint32_t readSetBegin(TType& elemType,
- uint32_t& size) {
+ uint32_t& size) {
throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
subclass_ + " does not support reading (yet).");
}
diff --git a/lib/cpp/src/protocol/TProtocol.h b/lib/cpp/src/protocol/TProtocol.h
index a7560ca..7fa3de8 100644
--- a/lib/cpp/src/protocol/TProtocol.h
+++ b/lib/cpp/src/protocol/TProtocol.h
@@ -122,26 +122,26 @@
virtual uint32_t writeStructEnd() = 0;
virtual uint32_t writeFieldBegin(const std::string& name,
- const TType fieldType,
- const int16_t fieldId) = 0;
+ const TType fieldType,
+ const int16_t fieldId) = 0;
virtual uint32_t writeFieldEnd() = 0;
virtual uint32_t writeFieldStop() = 0;
virtual uint32_t writeMapBegin(const TType keyType,
- const TType valType,
- const uint32_t size) = 0;
+ const TType valType,
+ const uint32_t size) = 0;
virtual uint32_t writeMapEnd() = 0;
virtual uint32_t writeListBegin(const TType elemType,
- const uint32_t size) = 0;
+ const uint32_t size) = 0;
virtual uint32_t writeListEnd() = 0;
virtual uint32_t writeSetBegin(const TType elemType,
- const uint32_t size) = 0;
+ const uint32_t size) = 0;
virtual uint32_t writeSetEnd() = 0;
@@ -164,8 +164,8 @@
*/
virtual uint32_t readMessageBegin(std::string& name,
- TMessageType& messageType,
- int32_t& seqid) = 0;
+ TMessageType& messageType,
+ int32_t& seqid) = 0;
virtual uint32_t readMessageEnd() = 0;
@@ -174,24 +174,24 @@
virtual uint32_t readStructEnd() = 0;
virtual uint32_t readFieldBegin(std::string& name,
- TType& fieldType,
- int16_t& fieldId) = 0;
+ TType& fieldType,
+ int16_t& fieldId) = 0;
virtual uint32_t readFieldEnd() = 0;
virtual uint32_t readMapBegin(TType& keyType,
- TType& valType,
- uint32_t& size) = 0;
+ TType& valType,
+ uint32_t& size) = 0;
virtual uint32_t readMapEnd() = 0;
virtual uint32_t readListBegin(TType& elemType,
- uint32_t& size) = 0;
+ uint32_t& size) = 0;
virtual uint32_t readListEnd() = 0;
virtual uint32_t readSetBegin(TType& elemType,
- uint32_t& size) = 0;
+ uint32_t& size) = 0;
virtual uint32_t readSetEnd() = 0;