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/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();