Thrift: Whitespace cleanup.
Summary:
- Expanded tabs to spaces where spaces were the norm.
- Deleted almost all trailing whitespace.
- Added newlines to the ends of a few files.
- Ran dos2unix on one file or two.
Reviewed By: mcslee
Test Plan: git diff -b
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665467 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/Exception.h b/lib/cpp/src/concurrency/Exception.h
index 575a3ed..00e2649 100644
--- a/lib/cpp/src/concurrency/Exception.h
+++ b/lib/cpp/src/concurrency/Exception.h
@@ -21,16 +21,16 @@
class IllegalStateException : public facebook::thrift::TException {};
class TimedOutException : public facebook::thrift::TException {
-public:
+public:
TimedOutException():TException("TimedOutException"){};
- TimedOutException(const std::string& message ) :
+ TimedOutException(const std::string& message ) :
TException(message) {}
};
class TooManyPendingTasksException : public facebook::thrift::TException {
-public:
+public:
TooManyPendingTasksException():TException("TooManyPendingTasksException"){};
- TooManyPendingTasksException(const std::string& message ) :
+ TooManyPendingTasksException(const std::string& message ) :
TException(message) {}
};
diff --git a/lib/cpp/src/concurrency/Mutex.cpp b/lib/cpp/src/concurrency/Mutex.cpp
index a055656..87bfd35 100644
--- a/lib/cpp/src/concurrency/Mutex.cpp
+++ b/lib/cpp/src/concurrency/Mutex.cpp
@@ -11,9 +11,9 @@
using boost::shared_ptr;
-namespace facebook { namespace thrift { namespace concurrency {
+namespace facebook { namespace thrift { namespace concurrency {
-/**
+/**
* Implementation of Mutex class using POSIX mutex
*
* @author marc
@@ -54,7 +54,7 @@
void Mutex::unlock() const { impl_->unlock(); }
-/**
+/**
* Implementation of ReadWriteMutex class using POSIX rw lock
*
* @author boz
@@ -86,7 +86,7 @@
void release() const { pthread_rwlock_unlock(&rw_lock_); }
-private:
+private:
mutable pthread_rwlock_t rw_lock_;
mutable bool initialized_;
};
diff --git a/lib/cpp/src/concurrency/Mutex.h b/lib/cpp/src/concurrency/Mutex.h
index f3c7cd0..e176628 100644
--- a/lib/cpp/src/concurrency/Mutex.h
+++ b/lib/cpp/src/concurrency/Mutex.h
@@ -9,7 +9,7 @@
#include <boost/shared_ptr.hpp>
-namespace facebook { namespace thrift { namespace concurrency {
+namespace facebook { namespace thrift { namespace concurrency {
/**
* A simple mutex class
@@ -46,7 +46,7 @@
// this releases both read and write locks
virtual void release() const;
-
+
private:
class impl;
@@ -54,7 +54,7 @@
};
class Guard {
- public:
+ public:
Guard(const Mutex& value) : mutex_(value) {
mutex_.lock();
}
@@ -67,20 +67,20 @@
};
class RWGuard {
- public:
+ public:
RWGuard(const ReadWriteMutex& value, bool write = 0) : rw_mutex_(value) {
if (write) {
rw_mutex_.acquireWrite();
} else {
rw_mutex_.acquireRead();
}
- }
+ }
~RWGuard() {
rw_mutex_.release();
- }
- private:
+ }
+ private:
const ReadWriteMutex& rw_mutex_;
-};
+};
// A little hack to prevent someone from trying to do "Guard(m);"
diff --git a/lib/cpp/src/concurrency/TimerManager.cpp b/lib/cpp/src/concurrency/TimerManager.cpp
index 4f77b2f..e3b7a89 100644
--- a/lib/cpp/src/concurrency/TimerManager.cpp
+++ b/lib/cpp/src/concurrency/TimerManager.cpp
@@ -12,7 +12,7 @@
#include <iostream>
#include <set>
-namespace facebook { namespace thrift { namespace concurrency {
+namespace facebook { namespace thrift { namespace concurrency {
using boost::shared_ptr;
@@ -38,10 +38,10 @@
Task(shared_ptr<Runnable> runnable) :
runnable_(runnable),
state_(WAITING) {}
-
+
~Task() {
}
-
+
void run() {
if (state_ == EXECUTING) {
runnable_->run();
@@ -59,11 +59,11 @@
class TimerManager::Dispatcher: public Runnable {
public:
- Dispatcher(TimerManager* manager) :
+ Dispatcher(TimerManager* manager) :
manager_(manager) {}
-
+
~Dispatcher() {}
-
+
/**
* Dispatcher entry point
*
@@ -85,7 +85,7 @@
Synchronized s(manager_->monitor_);
task_iterator expiredTaskEnd;
int64_t now = Util::currentTime();
- while (manager_->state_ == TimerManager::STARTED &&
+ while (manager_->state_ == TimerManager::STARTED &&
(expiredTaskEnd = manager_->taskMap_.upper_bound(now)) == manager_->taskMap_.begin()) {
int64_t timeout = 0LL;
if (!manager_->taskMap_.empty()) {
@@ -97,7 +97,7 @@
} catch (TimedOutException &e) {}
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;
@@ -110,17 +110,17 @@
manager_->taskMap_.erase(manager_->taskMap_.begin(), expiredTaskEnd);
}
}
-
+
for (std::set<shared_ptr<Task> >::iterator ix = expiredTasks.begin(); ix != expiredTasks.end(); ix++) {
(*ix)->run();
}
-
+
} while (manager_->state_ == TimerManager::STARTED);
{
Synchronized s(manager_->monitor_);
if (manager_->state_ == TimerManager::STOPPING) {
- manager_->state_ = TimerManager::STOPPED;
+ manager_->state_ = TimerManager::STOPPED;
manager_->monitor_.notify();
}
}
@@ -143,7 +143,7 @@
// If we haven't been explicitly stopped, do so now. We don't need to grab
// the monitor here, since stop already takes care of reentrancy.
-
+
if (state_ != STOPPED) {
try {
stop();
@@ -203,31 +203,31 @@
taskMap_.erase(ix);
}
- // Remove dispatcher's reference to us.
+ // Remove dispatcher's reference to us.
dispatcher_->manager_ = NULL;
}
}
shared_ptr<const ThreadFactory> TimerManager::threadFactory() const {
- Synchronized s(monitor_);
+ Synchronized s(monitor_);
return threadFactory_;
}
-
+
void TimerManager::threadFactory(shared_ptr<const ThreadFactory> value) {
- Synchronized s(monitor_);
+ Synchronized s(monitor_);
threadFactory_ = value;
}
size_t TimerManager::taskCount() const {
return taskCount_;
}
-
+
void TimerManager::add(shared_ptr<Runnable> task, int64_t timeout) {
int64_t now = Util::currentTime();
timeout += now;
{
- Synchronized s(monitor_);
+ Synchronized s(monitor_);
if (state_ != TimerManager::STARTED) {
throw IllegalStateException();
}
@@ -260,7 +260,7 @@
void TimerManager::remove(shared_ptr<Runnable> task) {
- Synchronized s(monitor_);
+ Synchronized s(monitor_);
if (state_ != TimerManager::STARTED) {
throw IllegalStateException();
}
diff --git a/lib/cpp/src/concurrency/TimerManager.h b/lib/cpp/src/concurrency/TimerManager.h
index 86900ce..6d2eae9 100644
--- a/lib/cpp/src/concurrency/TimerManager.h
+++ b/lib/cpp/src/concurrency/TimerManager.h
@@ -15,13 +15,13 @@
#include <map>
#include <time.h>
-namespace facebook { namespace thrift { namespace concurrency {
+namespace facebook { namespace thrift { namespace concurrency {
/**
- * Timer Manager
- *
+ * Timer Manager
+ *
* This class dispatches timer tasks when they fall due.
- *
+ *
* @author marc
* @version $Id:$
*/
@@ -38,7 +38,7 @@
virtual void threadFactory(boost::shared_ptr<const ThreadFactory> value);
/**
- * Starts the timer manager service
+ * Starts the timer manager service
*
* @throws IllegalArgumentException Missing thread factory attribute
*/
@@ -53,7 +53,7 @@
/**
* Adds a task to be executed at some time in the future by a worker thread.
- *
+ *
* @param task The task to execute
* @param timeout Time in milliseconds to delay before executing task
*/
@@ -61,14 +61,14 @@
/**
* Adds a task to be executed at some time in the future by a worker thread.
- *
+ *
* @param task The task to execute
* @param timeout Absolute time in the future to execute task.
- */
+ */
virtual void add(boost::shared_ptr<Runnable> task, const struct timespec& timeout);
/**
- * Removes a pending task
+ * Removes a pending task
*
* @throws NoSuchTaskException Specified task doesn't exist. It was either
* processed already or this call was made for a
@@ -86,7 +86,7 @@
STOPPING,
STOPPED
};
-
+
virtual const STATE state() const;
private:
diff --git a/lib/cpp/src/concurrency/Util.h b/lib/cpp/src/concurrency/Util.h
index 8a1ead3..3ebc0b1 100644
--- a/lib/cpp/src/concurrency/Util.h
+++ b/lib/cpp/src/concurrency/Util.h
@@ -17,7 +17,7 @@
#include <sys/time.h>
#endif // defined(HAVE_CLOCK_GETTIME)
-namespace facebook { namespace thrift { namespace concurrency {
+namespace facebook { namespace thrift { namespace concurrency {
/**
* Utility methods
@@ -26,7 +26,7 @@
* and other common platform-dependent concurrency operations.
* It should not be included in API headers for other concurrency library
* headers, since it will, by definition, pull in all sorts of horrid
- * platform dependent crap. Rather it should be inluded directly in
+ * platform dependent crap. Rather it should be inluded directly in
* concurrency library implementation source.
*
* @author marc
@@ -47,7 +47,7 @@
* @param time or duration in milliseconds
*/
static void toTimespec(struct timespec& result, int64_t value) {
- result.tv_sec = value / MS_PER_S; // ms to s
+ result.tv_sec = value / MS_PER_S; // ms to s
result.tv_nsec = (value % MS_PER_S) * NS_PER_MS; // ms to ns
}
diff --git a/lib/cpp/src/concurrency/test/TimerManagerTests.h b/lib/cpp/src/concurrency/test/TimerManagerTests.h
index bd959cd..13e3ef8 100644
--- a/lib/cpp/src/concurrency/test/TimerManagerTests.h
+++ b/lib/cpp/src/concurrency/test/TimerManagerTests.h
@@ -17,7 +17,7 @@
using namespace facebook::thrift::concurrency;
/**
- * ThreadManagerTests class
+ * ThreadManagerTests class
*
* @author marc
* @version $Id:$
@@ -30,8 +30,8 @@
class Task: public Runnable {
public:
-
- Task(Monitor& monitor, int64_t timeout) :
+
+ Task(Monitor& monitor, int64_t timeout) :
_timeout(timeout),
_startTime(Util::currentTime()),
_monitor(monitor),
@@ -56,15 +56,15 @@
if(error < ERROR) {
_success = true;
}
-
+
_done = true;
- std::cout << "\t\t\tTimerManagerTests::Task[" << this << "] done" << std::endl; //debug
+ std::cout << "\t\t\tTimerManagerTests::Task[" << this << "] done" << std::endl; //debug
{Synchronized s(_monitor);
_monitor.notifyAll();
}
- }
+ }
int64_t _timeout;
int64_t _startTime;
@@ -87,11 +87,11 @@
{
TimerManager timerManager;
-
+
timerManager.threadFactory(shared_ptr<PosixThreadFactory>(new PosixThreadFactory()));
-
+
timerManager.start();
-
+
assert(timerManager.state() == TimerManager::STARTED);
shared_ptr<TimerManagerTests::Task> task = shared_ptr<TimerManagerTests::Task>(new TimerManagerTests::Task(_monitor, timeout));
@@ -125,6 +125,6 @@
};
const double TimerManagerTests::ERROR = .20;
-
+
}}}} // facebook::thrift::concurrency