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/Makefile.am b/lib/cpp/Makefile.am
index 92ccf99..9da970d 100644
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -63,7 +63,7 @@
include_thrift_HEADERS = \
$(top_srcdir)/config.h \
src/Thrift.h \
- src/TReflectionLocal.h \
+ src/TReflectionLocal.h \
src/reflection_limited_types.h \
src/TProcessor.h \
src/TLogging.h
@@ -127,7 +127,7 @@
concurrency_test_LDFLAGS = $(common_ldflags)
EXTRA_DIST = \
- README \
- thrift-nb.pc.in \
- thrift.pc.in \
- thrift-z.pc.in
+ README \
+ thrift-nb.pc.in \
+ thrift.pc.in \
+ thrift-z.pc.in
diff --git a/lib/cpp/src/TLogging.h b/lib/cpp/src/TLogging.h
index 4d3060d..6fb7484 100644
--- a/lib/cpp/src/TLogging.h
+++ b/lib/cpp/src/TLogging.h
@@ -29,37 +29,37 @@
/**
* T_GLOBAL_DEBUGGING_LEVEL = 0: all debugging turned off, debug macros undefined
- * T_GLOBAL_DEBUGGING_LEVEL = 1: all debugging turned on
+ * T_GLOBAL_DEBUGGING_LEVEL = 1: all debugging turned on
*/
#define T_GLOBAL_DEBUGGING_LEVEL 0
/**
* T_GLOBAL_LOGGING_LEVEL = 0: all logging turned off, logging macros undefined
- * T_GLOBAL_LOGGING_LEVEL = 1: all logging turned on
+ * T_GLOBAL_LOGGING_LEVEL = 1: all logging turned on
*/
#define T_GLOBAL_LOGGING_LEVEL 1
-/**
+/**
* Standard wrapper around fprintf what will prefix the file name and line
* number to the line. Uses T_GLOBAL_DEBUGGING_LEVEL to control whether it is
* turned on or off.
*
- * @param format_string
+ * @param format_string
*/
#if T_GLOBAL_DEBUGGING_LEVEL > 0
#define T_DEBUG(format_string,...) \
if (T_GLOBAL_DEBUGGING_LEVEL > 0) { \
fprintf(stderr,"[%s,%d] " #format_string " \n", __FILE__, __LINE__,##__VA_ARGS__); \
- }
+ }
#else
#define T_DEBUG(format_string,...)
#endif
-/**
- * analagous to T_DEBUG but also prints the time
+/**
+ * analagous to T_DEBUG but also prints the time
*
* @param string format_string input: printf style format string
*/
@@ -80,7 +80,7 @@
#endif
-/**
+/**
* analagous to T_DEBUG but uses input level to determine whether or not the string
* should be logged.
*
@@ -93,7 +93,7 @@
}
-/**
+/**
* Explicit error logging. Prints time, file name and line number
*
* @param string format_string input: printf style format string
@@ -109,7 +109,7 @@
}
-/**
+/**
* Analagous to T_ERROR, additionally aborting the process.
* WARNING: macro calls abort(), ending program execution
*
@@ -127,7 +127,7 @@
}
-/**
+/**
* Log input message
*
* @param string format_string input: printf style format string
@@ -143,7 +143,7 @@
dbgtime[24] = '\0'; \
fprintf(stderr,"[%s] " #format_string " \n", dbgtime,##__VA_ARGS__); \
} \
- }
+ }
#else
#define T_LOG_OPER(format_string,...)
#endif
diff --git a/lib/cpp/src/TProcessor.h b/lib/cpp/src/TProcessor.h
index affbe81..cba4a84 100644
--- a/lib/cpp/src/TProcessor.h
+++ b/lib/cpp/src/TProcessor.h
@@ -11,7 +11,7 @@
#include <protocol/TProtocol.h>
#include <boost/shared_ptr.hpp>
-namespace facebook { namespace thrift {
+namespace facebook { namespace thrift {
/**
* A processor is a generic object that acts upon two streams of data, one
diff --git a/lib/cpp/src/Thrift.cpp b/lib/cpp/src/Thrift.cpp
index 186c5af..88890d4 100644
--- a/lib/cpp/src/Thrift.cpp
+++ b/lib/cpp/src/Thrift.cpp
@@ -21,7 +21,7 @@
while (true) {
xfer += iprot->readFieldBegin(fname, ftype, fid);
- if (ftype == facebook::thrift::protocol::T_STOP) {
+ if (ftype == facebook::thrift::protocol::T_STOP) {
break;
}
switch (fid) {
diff --git a/lib/cpp/src/Thrift.h b/lib/cpp/src/Thrift.h
index 338dbde..8e93bb0 100644
--- a/lib/cpp/src/Thrift.h
+++ b/lib/cpp/src/Thrift.h
@@ -99,7 +99,7 @@
type_(UNKNOWN) {}
TApplicationException(TApplicationExceptionType type) :
- TException(),
+ TException(),
type_(type) {}
TApplicationException(const std::string& message) :
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
diff --git a/lib/cpp/src/processor/PeekProcessor.cpp b/lib/cpp/src/processor/PeekProcessor.cpp
index cff5edd..d864805 100644
--- a/lib/cpp/src/processor/PeekProcessor.cpp
+++ b/lib/cpp/src/processor/PeekProcessor.cpp
@@ -4,7 +4,7 @@
using namespace facebook::thrift::protocol;
using namespace facebook::thrift;
-namespace facebook { namespace thrift { namespace processor {
+namespace facebook { namespace thrift { namespace processor {
PeekProcessor::PeekProcessor() {
memoryBuffer_.reset(new TMemoryBuffer());
@@ -38,7 +38,7 @@
}
}
-bool PeekProcessor::process(boost::shared_ptr<TProtocol> in,
+bool PeekProcessor::process(boost::shared_ptr<TProtocol> in,
boost::shared_ptr<TProtocol> out) {
std::string fname;
@@ -77,7 +77,7 @@
uint32_t size;
memoryBuffer_->getBuffer(&buffer, &size);
peekBuffer(buffer, size);
-
+
// Done peeking at variables
peekEnd();
@@ -92,7 +92,7 @@
void PeekProcessor::peekBuffer(uint8_t* buffer, uint32_t size) {
}
-void PeekProcessor::peek(boost::shared_ptr<TProtocol> in,
+void PeekProcessor::peek(boost::shared_ptr<TProtocol> in,
TType ftype,
int16_t fid) {
in->skip(ftype);
diff --git a/lib/cpp/src/processor/PeekProcessor.h b/lib/cpp/src/processor/PeekProcessor.h
index 6b8414b..49e7cd9 100644
--- a/lib/cpp/src/processor/PeekProcessor.h
+++ b/lib/cpp/src/processor/PeekProcessor.h
@@ -13,7 +13,7 @@
#include <transport/TTransportUtils.h>
#include <boost/shared_ptr.hpp>
-namespace facebook { namespace thrift { namespace processor {
+namespace facebook { namespace thrift { namespace processor {
/*
* Class for peeking at the raw data that is being processed by another processor
@@ -22,7 +22,7 @@
* @author James Wang <jwang@facebook.com>
*/
class PeekProcessor : public facebook::thrift::TProcessor {
-
+
public:
PeekProcessor();
virtual ~PeekProcessor();
@@ -39,14 +39,14 @@
void setTargetTransport(boost::shared_ptr<facebook::thrift::transport::TTransport> targetTransport);
- virtual bool process(boost::shared_ptr<facebook::thrift::protocol::TProtocol> in,
+ virtual bool process(boost::shared_ptr<facebook::thrift::protocol::TProtocol> in,
boost::shared_ptr<facebook::thrift::protocol::TProtocol> out);
// The following three functions can be overloaded by child classes to
// achieve desired peeking behavior
virtual void peekName(const std::string& fname);
virtual void peekBuffer(uint8_t* buffer, uint32_t size);
- virtual void peek(boost::shared_ptr<facebook::thrift::protocol::TProtocol> in,
+ virtual void peek(boost::shared_ptr<facebook::thrift::protocol::TProtocol> in,
facebook::thrift::protocol::TType ftype,
int16_t fid);
virtual void peekEnd();
diff --git a/lib/cpp/src/processor/StatsProcessor.h b/lib/cpp/src/processor/StatsProcessor.h
index b1a4e63..140a1d4 100644
--- a/lib/cpp/src/processor/StatsProcessor.h
+++ b/lib/cpp/src/processor/StatsProcessor.h
@@ -12,7 +12,7 @@
#include <protocol/TProtocol.h>
#include <TProcessor.h>
-namespace facebook { namespace thrift { namespace processor {
+namespace facebook { namespace thrift { namespace processor {
/*
* Class for keeping track of function call statistics and printing them if desired
@@ -21,7 +21,7 @@
*/
class StatsProcessor : public facebook::thrift::TProcessor {
public:
- StatsProcessor(bool print, bool frequency)
+ StatsProcessor(bool print, bool frequency)
: print_(print),
frequency_(frequency)
{}
@@ -128,14 +128,14 @@
break;
case facebook::thrift::protocol::T_DOUBLE:
{
- double dub;
+ double dub;
piprot_->readDouble(dub);
if (print_) {
printf("%f", dub);
}
}
break;
- case facebook::thrift::protocol::T_STRING:
+ case facebook::thrift::protocol::T_STRING:
{
std::string str;
piprot_->readString(str);
@@ -144,7 +144,7 @@
}
}
break;
- case facebook::thrift::protocol::T_STRUCT:
+ case facebook::thrift::protocol::T_STRUCT:
{
std::string name;
int16_t fid;
diff --git a/lib/cpp/src/protocol/TBinaryProtocol.cpp b/lib/cpp/src/protocol/TBinaryProtocol.cpp
index 30bbde6..289d614 100644
--- a/lib/cpp/src/protocol/TBinaryProtocol.cpp
+++ b/lib/cpp/src/protocol/TBinaryProtocol.cpp
@@ -25,7 +25,7 @@
//return *reinterpret_cast<To*>(&from); // BAD!!!
//return *static_cast<To*>(static_cast<void*>(&from)); // BAD!!!
//return *(To*)(void*)&from; // BAD!!!
-
+
// Super clean and paritally blessed by section 3.9 of the standard.
//unsigned char c[sizeof(from)];
//memcpy(c, &from, sizeof(from));
@@ -50,7 +50,7 @@
}
-namespace facebook { namespace thrift { namespace protocol {
+namespace facebook { namespace thrift { namespace protocol {
uint32_t TBinaryProtocol::writeMessageBegin(const std::string& name,
const TMessageType messageType,
@@ -99,8 +99,8 @@
uint32_t TBinaryProtocol::writeFieldStop() {
return
writeByte((int8_t)T_STOP);
-}
-
+}
+
uint32_t TBinaryProtocol::writeMapBegin(const TType keyType,
const TType valType,
const uint32_t size) {
@@ -167,7 +167,7 @@
trans_->write((uint8_t*)&net, 8);
return 8;
}
-
+
uint32_t TBinaryProtocol::writeDouble(const double dub) {
BOOST_STATIC_ASSERT(sizeof(double) == sizeof(uint64_t));
BOOST_STATIC_ASSERT(std::numeric_limits<double>::is_iec559);
@@ -178,7 +178,7 @@
return 8;
}
-
+
uint32_t TBinaryProtocol::writeString(const string& str) {
uint32_t size = str.size();
uint32_t result = writeI32((int32_t)size);
@@ -250,11 +250,11 @@
result += readI16(fieldId);
return result;
}
-
+
uint32_t TBinaryProtocol::readFieldEnd() {
return 0;
}
-
+
uint32_t TBinaryProtocol::readMapBegin(TType& keyType,
TType& valType,
uint32_t& size) {
diff --git a/lib/cpp/src/protocol/TBinaryProtocol.h b/lib/cpp/src/protocol/TBinaryProtocol.h
index 89958ec..c7e2791 100644
--- a/lib/cpp/src/protocol/TBinaryProtocol.h
+++ b/lib/cpp/src/protocol/TBinaryProtocol.h
@@ -11,7 +11,7 @@
#include <boost/shared_ptr.hpp>
-namespace facebook { namespace thrift { namespace protocol {
+namespace facebook { namespace thrift { namespace protocol {
/**
* The default binary protocol for thrift. Writes all data in a very basic
@@ -90,7 +90,7 @@
uint32_t writeFieldEnd();
uint32_t writeFieldStop();
-
+
uint32_t writeMapBegin(const TType keyType,
const TType valType,
const uint32_t size);
@@ -140,9 +140,9 @@
uint32_t readFieldBegin(std::string& name,
TType& fieldType,
int16_t& fieldId);
-
+
uint32_t readFieldEnd();
-
+
uint32_t readMapBegin(TType& keyType,
TType& valType,
uint32_t& size);
@@ -151,7 +151,7 @@
uint32_t readListBegin(TType& elemType,
uint32_t& size);
-
+
uint32_t readListEnd();
uint32_t readSetBegin(TType& elemType,
diff --git a/lib/cpp/src/protocol/TDebugProtocol.cpp b/lib/cpp/src/protocol/TDebugProtocol.cpp
index 5d28b78..2f23b11 100644
--- a/lib/cpp/src/protocol/TDebugProtocol.cpp
+++ b/lib/cpp/src/protocol/TDebugProtocol.cpp
@@ -25,7 +25,7 @@
}
-namespace facebook { namespace thrift { namespace protocol {
+namespace facebook { namespace thrift { namespace protocol {
string TDebugProtocol::fieldTypeName(TType type) {
switch (type) {
@@ -171,7 +171,7 @@
return writeIndented(
id_str + ": " +
- name + " (" +
+ name + " (" +
fieldTypeName(fieldType) + ") = ");
}
@@ -183,8 +183,8 @@
uint32_t TDebugProtocol::writeFieldStop() {
return 0;
//writeIndented("***STOP***\n");
-}
-
+}
+
uint32_t TDebugProtocol::writeMapBegin(const TType keyType,
const TType valType,
const uint32_t size) {
@@ -273,12 +273,12 @@
uint32_t TDebugProtocol::writeI64(const int64_t i64) {
return writeItem(boost::lexical_cast<string>(i64));
}
-
+
uint32_t TDebugProtocol::writeDouble(const double dub) {
return writeItem(boost::lexical_cast<string>(dub));
}
-
+
uint32_t TDebugProtocol::writeString(const string& str) {
// XXX Raw/UTF-8?
diff --git a/lib/cpp/src/protocol/TDebugProtocol.h b/lib/cpp/src/protocol/TDebugProtocol.h
index 0dd60d8..90b7688 100644
--- a/lib/cpp/src/protocol/TDebugProtocol.h
+++ b/lib/cpp/src/protocol/TDebugProtocol.h
@@ -14,7 +14,7 @@
#include <transport/TTransportUtils.h>
-namespace facebook { namespace thrift { namespace protocol {
+namespace facebook { namespace thrift { namespace protocol {
/*
@@ -73,7 +73,7 @@
uint32_t writeFieldEnd();
uint32_t writeFieldStop();
-
+
uint32_t writeMapBegin(const TType keyType,
const TType valType,
const uint32_t size);
@@ -140,7 +140,7 @@
}}} // facebook::thrift::protocol
-namespace facebook { namespace thrift {
+namespace facebook { namespace thrift {
template<typename ThriftStruct>
std::string ThriftDebugString(const ThriftStruct& ts) {
diff --git a/lib/cpp/src/protocol/TDenseProtocol.h b/lib/cpp/src/protocol/TDenseProtocol.h
index 0902e15..dae2c18 100644
--- a/lib/cpp/src/protocol/TDenseProtocol.h
+++ b/lib/cpp/src/protocol/TDenseProtocol.h
@@ -20,7 +20,7 @@
* The dense protocol is designed to use as little space as possible.
*
* There are two types of dense protocol instances. Standalone instances
- * are not used for RPC and just encoded and decode structures of
+ * are not used for RPC and just encoded and decode structures of
* a predetermined type. Non-standalone instances are used for RPC.
* Currently, only standalone instances exist.
*
diff --git a/lib/cpp/src/protocol/TOneWayProtocol.h b/lib/cpp/src/protocol/TOneWayProtocol.h
index 635744c..245f830 100644
--- a/lib/cpp/src/protocol/TOneWayProtocol.h
+++ b/lib/cpp/src/protocol/TOneWayProtocol.h
@@ -9,7 +9,7 @@
#include "TProtocol.h"
-namespace facebook { namespace thrift { namespace protocol {
+namespace facebook { namespace thrift { namespace protocol {
/**
* Abstract class for implementing a protocol that can only be written,
@@ -62,12 +62,12 @@
throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
subclass_ + " does not support reading (yet).");
}
-
+
uint32_t readFieldEnd() {
throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
subclass_ + " does not support reading (yet).");
}
-
+
uint32_t readMapBegin(TType& keyType,
TType& valType,
uint32_t& size) {
@@ -85,7 +85,7 @@
throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
subclass_ + " does not support reading (yet).");
}
-
+
uint32_t readListEnd() {
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 7fa3de8..85cc48a 100644
--- a/lib/cpp/src/protocol/TProtocol.h
+++ b/lib/cpp/src/protocol/TProtocol.h
@@ -17,7 +17,7 @@
#include <string>
#include <map>
-namespace facebook { namespace thrift { namespace protocol {
+namespace facebook { namespace thrift { namespace protocol {
using facebook::thrift::transport::TTransport;
@@ -118,9 +118,9 @@
virtual uint32_t writeStructBegin(const std::string& name) = 0;
-
+
virtual uint32_t writeStructEnd() = 0;
-
+
virtual uint32_t writeFieldBegin(const std::string& name,
const TType fieldType,
const int16_t fieldId) = 0;
@@ -128,13 +128,13 @@
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;
virtual uint32_t writeMapEnd() = 0;
-
+
virtual uint32_t writeListBegin(const TType elemType,
const uint32_t size) = 0;
@@ -166,7 +166,7 @@
virtual uint32_t readMessageBegin(std::string& name,
TMessageType& messageType,
int32_t& seqid) = 0;
-
+
virtual uint32_t readMessageEnd() = 0;
virtual uint32_t readStructBegin(std::string& name) = 0;
@@ -176,9 +176,9 @@
virtual uint32_t readFieldBegin(std::string& name,
TType& fieldType,
int16_t& fieldId) = 0;
-
+
virtual uint32_t readFieldEnd() = 0;
-
+
virtual uint32_t readMapBegin(TType& keyType,
TType& valType,
uint32_t& size) = 0;
@@ -328,7 +328,7 @@
ptrans_(ptrans) {
trans_ = ptrans.get();
}
-
+
boost::shared_ptr<TTransport> ptrans_;
TTransport* trans_;
diff --git a/lib/cpp/src/protocol/TProtocolException.h b/lib/cpp/src/protocol/TProtocolException.h
index 4429a62..0532ec5 100644
--- a/lib/cpp/src/protocol/TProtocolException.h
+++ b/lib/cpp/src/protocol/TProtocolException.h
@@ -10,7 +10,7 @@
#include <boost/lexical_cast.hpp>
#include <string>
-namespace facebook { namespace thrift { namespace protocol {
+namespace facebook { namespace thrift { namespace protocol {
/**
* Class to encapsulate all the possible types of protocol errors that may
@@ -41,7 +41,7 @@
type_(UNKNOWN) {}
TProtocolException(TProtocolExceptionType type) :
- facebook::thrift::TException(),
+ facebook::thrift::TException(),
type_(type) {}
TProtocolException(const std::string& message) :
@@ -81,11 +81,11 @@
}
protected:
- /**
+ /**
* Error code
*/
TProtocolExceptionType type_;
-
+
};
}}} // facebook::thrift::protocol
diff --git a/lib/cpp/src/transport/TFileTransport.h b/lib/cpp/src/transport/TFileTransport.h
index f249ff9..c4c921e 100644
--- a/lib/cpp/src/transport/TFileTransport.h
+++ b/lib/cpp/src/transport/TFileTransport.h
@@ -16,7 +16,7 @@
#include <boost/shared_ptr.hpp>
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
using facebook::thrift::TProcessor;
using facebook::thrift::protocol::TProtocolFactory;
@@ -50,7 +50,7 @@
// last successful dispatch point
int32_t lastDispatchPtr_;
-
+
void resetState(uint32_t lastDispatchPtr) {
readingSize_ = true;
eventSizeBuffPos_ = 0;
@@ -79,7 +79,7 @@
}
} readState;
-
+
/**
* TFileTransportBuffer - buffer class used by TFileTransport for queueing up events
* to be written to disk. Should be used in the following way:
@@ -90,9 +90,9 @@
* 5) Go back to 2, or destroy buffer
*
* The buffer should never be written to after it is read from, unless it is reset first.
- * Note: The above rules are enforced mainly for debugging its sole client TFileTransport
+ * Note: The above rules are enforced mainly for debugging its sole client TFileTransport
* which uses the buffer in this way.
- *
+ *
* @author James Wang <jwang@facebook.com>
*/
class TFileTransportBuffer {
@@ -105,7 +105,7 @@
void reset();
bool isFull();
bool isEmpty();
-
+
private:
TFileTransportBuffer(); // should not be used
@@ -145,7 +145,7 @@
};
/**
- * File implementation of a transport. Reads and writes are done to a
+ * File implementation of a transport. Reads and writes are done to a
* file on disk.
*
* @author Aditya Agarwal <aditya@facebook.com>
@@ -161,7 +161,7 @@
bool isOpen() {
return true;
}
-
+
void write(const uint8_t* buf, uint32_t len);
void flush();
@@ -205,7 +205,7 @@
return chunkSize_;
}
- void setEventBufferSize(uint32_t bufferSize) {
+ void setEventBufferSize(uint32_t bufferSize) {
if (bufferAndThreadInitialized_) {
GlobalOutput("Cannot change the buffer size after writer thread started");
return;
@@ -316,7 +316,7 @@
// max number of corrupted events per chunk
uint32_t maxCorruptedEvents_;
static const uint32_t DEFAULT_MAX_CORRUPTED_EVENTS = 0;
-
+
// sleep duration when EOF is hit
uint32_t eofSleepTime_;
static const uint32_t DEFAULT_EOF_SLEEP_TIME_US = 500 * 1000;
@@ -324,15 +324,15 @@
// sleep duration when a corrupted event is encountered
uint32_t corruptedEventSleepTime_;
static const uint32_t DEFAULT_CORRUPTED_SLEEP_TIME_US = 1 * 1000 * 1000;
-
+
// writer thread id
pthread_t writerThreadId_;
- // buffers to hold data before it is flushed. Each element of the buffer stores a msg that
+ // buffers to hold data before it is flushed. Each element of the buffer stores a msg that
// needs to be written to the file. The buffers are swapped by the writer thread.
TFileTransportBuffer *dequeueBuffer_;
TFileTransportBuffer *enqueueBuffer_;
-
+
// conditions used to block when the buffer is full or empty
pthread_cond_t notFull_, notEmpty_;
volatile bool closing_;
@@ -372,9 +372,9 @@
// wrapper class to process events from a file containing thrift events
class TFileProcessor {
public:
- /**
+ /**
* Constructor that defaults output transport to null transport
- *
+ *
* @param processor processes log-file events
* @param protocolFactory protocol factory
* @param inputTransport file transport
@@ -388,14 +388,14 @@
boost::shared_ptr<TProtocolFactory> outputProtocolFactory,
boost::shared_ptr<TFileReaderTransport> inputTransport);
- /**
+ /**
* Constructor
- *
+ *
* @param processor processes log-file events
* @param protocolFactory protocol factory
* @param inputTransport input file transport
* @param output output transport
- */
+ */
TFileProcessor(boost::shared_ptr<TProcessor> processor,
boost::shared_ptr<TProtocolFactory> protocolFactory,
boost::shared_ptr<TFileReaderTransport> inputTransport,
@@ -414,7 +414,7 @@
*
*/
void processChunk();
-
+
private:
boost::shared_ptr<TProcessor> processor_;
boost::shared_ptr<TProtocolFactory> inputProtocolFactory_;
@@ -423,7 +423,7 @@
boost::shared_ptr<TTransport> outputTransport_;
};
-
+
}}} // facebook::thrift::transport
#endif // _THRIFT_TRANSPORT_TFILETRANSPORT_H_
diff --git a/lib/cpp/src/transport/THttpClient.cpp b/lib/cpp/src/transport/THttpClient.cpp
index b6d9d9e..c213ef0 100644
--- a/lib/cpp/src/transport/THttpClient.cpp
+++ b/lib/cpp/src/transport/THttpClient.cpp
@@ -7,7 +7,7 @@
#include "THttpClient.h"
#include "TSocket.h"
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
using namespace std;
@@ -148,7 +148,7 @@
httpPos_ = 0;
httpBufLen_ = 0;
refill();
-
+
// Now have available however much we read
avail = httpBufLen_;
}
@@ -162,7 +162,7 @@
}
return size;
}
-
+
char* THttpClient::readLine() {
while (true) {
char* eol = NULL;
@@ -207,12 +207,12 @@
throw TTransportException("Out of memory.");
}
}
-
+
// Read more data
uint32_t got = transport_->read((uint8_t*)(httpBuf_+httpBufLen_), httpBufSize_-httpBufLen_);
httpBufLen_ += got;
httpBuf_[httpBufLen_] = '\0';
-
+
if (got == 0) {
throw TTransportException("Could not refill buffer");
}
@@ -249,7 +249,7 @@
parseHeader(line);
}
}
- }
+ }
}
bool THttpClient::parseStatusLine(char* status) {
@@ -259,7 +259,7 @@
if (code == NULL) {
throw TTransportException(string("Bad Status: ") + status);
}
-
+
*code = '\0';
while (*(code++) == ' ');
diff --git a/lib/cpp/src/transport/THttpClient.h b/lib/cpp/src/transport/THttpClient.h
index acfcf1b..1ae3575 100644
--- a/lib/cpp/src/transport/THttpClient.h
+++ b/lib/cpp/src/transport/THttpClient.h
@@ -9,7 +9,7 @@
#include <transport/TTransportUtils.h>
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
/**
* HTTP client implementation of the thrift transport. This was irritating
@@ -35,8 +35,8 @@
bool isOpen() {
return transport_->isOpen();
}
-
- bool peek() {
+
+ bool peek() {
return transport_->peek();
}
@@ -49,7 +49,7 @@
void readEnd();
void write(const uint8_t* buf, uint32_t len);
-
+
void flush();
private:
diff --git a/lib/cpp/src/transport/TServerSocket.h b/lib/cpp/src/transport/TServerSocket.h
index 8d76fef..213d9d4 100644
--- a/lib/cpp/src/transport/TServerSocket.h
+++ b/lib/cpp/src/transport/TServerSocket.h
@@ -10,7 +10,7 @@
#include "TServerTransport.h"
#include <boost/shared_ptr.hpp>
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
class TSocket;
diff --git a/lib/cpp/src/transport/TServerTransport.h b/lib/cpp/src/transport/TServerTransport.h
index 9512372..b8e6b97 100644
--- a/lib/cpp/src/transport/TServerTransport.h
+++ b/lib/cpp/src/transport/TServerTransport.h
@@ -11,7 +11,7 @@
#include "TTransportException.h"
#include <boost/shared_ptr.hpp>
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
/**
* Server transport framework. A server needs to have some facility for
diff --git a/lib/cpp/src/transport/TSocketPool.cpp b/lib/cpp/src/transport/TSocketPool.cpp
index b6440fc..235d060 100644
--- a/lib/cpp/src/transport/TSocketPool.cpp
+++ b/lib/cpp/src/transport/TSocketPool.cpp
@@ -9,7 +9,7 @@
#include "TSocketPool.h"
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
using namespace std;
diff --git a/lib/cpp/src/transport/TSocketPool.h b/lib/cpp/src/transport/TSocketPool.h
index a197c72..847f67e 100644
--- a/lib/cpp/src/transport/TSocketPool.h
+++ b/lib/cpp/src/transport/TSocketPool.h
@@ -10,7 +10,7 @@
#include <vector>
#include "TSocket.h"
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
/**
* TCP Socket implementation of the TTransport interface.
diff --git a/lib/cpp/src/transport/TTransport.h b/lib/cpp/src/transport/TTransport.h
index 4e3c218..469acd2 100644
--- a/lib/cpp/src/transport/TTransport.h
+++ b/lib/cpp/src/transport/TTransport.h
@@ -12,7 +12,7 @@
#include <transport/TTransportException.h>
#include <string>
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
/**
* Generic interface for a method of transporting data. A TTransport may be
@@ -86,7 +86,7 @@
virtual uint32_t readAll(uint8_t* buf, uint32_t len) {
uint32_t have = 0;
uint32_t get = 0;
-
+
while (have < len) {
get = read(buf+have, len-have);
if (get <= 0) {
@@ -94,12 +94,12 @@
}
have += get;
}
-
+
return have;
}
/**
- * Called when read is completed.
+ * Called when read is completed.
* This can be over-ridden to perform a transport-specific action
* e.g. logging the request to a file
*
@@ -120,7 +120,7 @@
}
/**
- * Called when write is completed.
+ * Called when write is completed.
* This can be over-ridden to perform a transport-specific action
* at the end of a request.
*
diff --git a/lib/cpp/src/transport/TTransportException.cpp b/lib/cpp/src/transport/TTransportException.cpp
index 85b77b8..e632265 100644
--- a/lib/cpp/src/transport/TTransportException.cpp
+++ b/lib/cpp/src/transport/TTransportException.cpp
@@ -12,7 +12,7 @@
using std::string;
using boost::lexical_cast;
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
string TTransportException::strerror_s(int errno_copy) {
#ifndef HAVE_STRERROR_R
diff --git a/lib/cpp/src/transport/TTransportException.h b/lib/cpp/src/transport/TTransportException.h
index 39c65dd..73bad80 100644
--- a/lib/cpp/src/transport/TTransportException.h
+++ b/lib/cpp/src/transport/TTransportException.h
@@ -11,7 +11,7 @@
#include <string>
#include <Thrift.h>
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
/**
* Class to encapsulate all the possible types of transport errors that may
@@ -38,13 +38,13 @@
CORRUPTED_DATA = 7,
INTERNAL_ERROR = 8,
};
-
+
TTransportException() :
facebook::thrift::TException(),
type_(UNKNOWN) {}
TTransportException(TTransportExceptionType type) :
- facebook::thrift::TException(),
+ facebook::thrift::TException(),
type_(type) {}
TTransportException(const std::string& message) :
@@ -91,7 +91,7 @@
return message_.c_str();
}
}
-
+
protected:
/** Just like strerror_r but returns a C++ string object. */
std::string strerror_s(int errno_copy);
diff --git a/lib/cpp/src/transport/TTransportUtils.cpp b/lib/cpp/src/transport/TTransportUtils.cpp
index 556d5fa..e1f37b8 100644
--- a/lib/cpp/src/transport/TTransportUtils.cpp
+++ b/lib/cpp/src/transport/TTransportUtils.cpp
@@ -8,7 +8,7 @@
using std::string;
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
uint32_t TBufferedTransport::read(uint8_t* buf, uint32_t len) {
uint32_t need = len;
@@ -20,12 +20,12 @@
memcpy(buf, rBuf_+rPos_, rLen_-rPos_);
need -= rLen_-rPos_;
buf += rLen_-rPos_;
- }
+ }
// Get more from underlying transport up to buffer size
rLen_ = transport_->read(rBuf_, rBufSize_);
rPos_ = 0;
}
-
+
// Hand over whatever we have
uint32_t give = need;
if (rLen_-rPos_ < give) {
@@ -137,7 +137,7 @@
// Read another chunk
readFrame();
}
-
+
// Hand over whatever we have
uint32_t give = need;
if (rLen_-rPos_ < give) {
@@ -196,7 +196,7 @@
// Copy the old buffer to the new one
memcpy(wBuf2, wBuf_, wLen_);
-
+
// Now point buf to the new one
delete [] wBuf_;
wBuf_ = wBuf2;
@@ -218,7 +218,7 @@
sz = (int32_t)htonl(sz);
transport_->write((const uint8_t*)&sz, 4);
-
+
// Write frame body
if (wLen_ > 0) {
transport_->write(wBuf_, wLen_);
@@ -267,7 +267,7 @@
// Copy into buffer and increment rPos_
memcpy(buf, buffer_ + rPos_, give);
rPos_ += give;
-
+
return give;
}
@@ -293,7 +293,7 @@
str.reserve(str.length()+give);
str.append((char*)buffer_ + rPos_, give);
rPos_ += give;
-
+
return give;
}
@@ -340,7 +340,7 @@
uint32_t TPipedTransport::read(uint8_t* buf, uint32_t len) {
uint32_t need = len;
-
+
// We don't have enough data yet
if (rLen_-rPos_ < need) {
// Copy out whatever we have
@@ -356,7 +356,7 @@
rBufSize_ *=2;
rBuf_ = (uint8_t *)realloc(rBuf_, sizeof(uint8_t) * rBufSize_);
}
-
+
// try to fill up the buffer
rLen_ += srcTrans_->read(rBuf_+rPos_, rBufSize_ - rPos_);
}
@@ -407,7 +407,7 @@
srcTrans_->flush();
}
-TPipedFileReaderTransport::TPipedFileReaderTransport(boost::shared_ptr<TFileReaderTransport> srcTrans, boost::shared_ptr<TTransport> dstTrans)
+TPipedFileReaderTransport::TPipedFileReaderTransport(boost::shared_ptr<TFileReaderTransport> srcTrans, boost::shared_ptr<TTransport> dstTrans)
: TPipedTransport(srcTrans, dstTrans),
srcTrans_(srcTrans) {
}
@@ -438,7 +438,7 @@
uint32_t TPipedFileReaderTransport::readAll(uint8_t* buf, uint32_t len) {
uint32_t have = 0;
uint32_t get = 0;
-
+
while (have < len) {
get = read(buf+have, len-have);
if (get <= 0) {
@@ -446,7 +446,7 @@
}
have += get;
}
-
+
return have;
}
diff --git a/lib/cpp/src/transport/TZlibTransport.cpp b/lib/cpp/src/transport/TZlibTransport.cpp
index 27aa350..c9acc24 100644
--- a/lib/cpp/src/transport/TZlibTransport.cpp
+++ b/lib/cpp/src/transport/TZlibTransport.cpp
@@ -11,7 +11,7 @@
using std::string;
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
// Don't call this outside of the constructor.
void TZlibTransport::initZlib() {
diff --git a/lib/cpp/src/transport/TZlibTransport.h b/lib/cpp/src/transport/TZlibTransport.h
index dd8ae2f..c2c1849 100644
--- a/lib/cpp/src/transport/TZlibTransport.h
+++ b/lib/cpp/src/transport/TZlibTransport.h
@@ -12,7 +12,7 @@
struct z_stream_s;
-namespace facebook { namespace thrift { namespace transport {
+namespace facebook { namespace thrift { namespace transport {
class TZlibTransportException : public TTransportException {
public:
@@ -135,7 +135,7 @@
~TZlibTransport();
bool isOpen();
-
+
void open() {
transport_->open();
}
@@ -145,7 +145,7 @@
}
uint32_t read(uint8_t* buf, uint32_t len);
-
+
void write(const uint8_t* buf, uint32_t len);
void flush();