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/test/cpp/Makefile.thrift b/test/cpp/Makefile.thrift
index 9eb1dce..fa412aa 100644
--- a/test/cpp/Makefile.thrift
+++ b/test/cpp/Makefile.thrift
@@ -1,5 +1,5 @@
 # Makefile for Thrift test project.
-# 
+#
 # Author:
 #   Mark Slee <mcslee@facebook.com>
 
@@ -44,7 +44,7 @@
 	$(THRIFT) --cpp ../ThriftTest.thrift
 
 server-debug: stubs
-	g++ -o TestServer $(DCFL) src/TestServer.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp 
+	g++ -o TestServer $(DCFL) src/TestServer.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp
 
 client-debug: stubs
 	g++ -o TestClient $(DCFL) src/TestClient.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index c2efb1a..9b350b0 100644
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -25,7 +25,7 @@
 {
   long long ret;
   struct timeval tv;
-  
+
   gettimeofday(&tv, NULL);
   ret = tv.tv_sec;
   ret = ret*1000*1000 + tv.tv_usec;
@@ -63,7 +63,7 @@
   shared_ptr<TTransport> transport;
 
   shared_ptr<TSocket> socket(new TSocket(host, port));
-  
+
   if (framed) {
     shared_ptr<TFramedTransport> framedSocket(new TFramedTransport(socket));
     framedSocket->setRead(frameInput);
@@ -84,7 +84,7 @@
   uint64_t time_min = 0;
   uint64_t time_max = 0;
   uint64_t time_tot = 0;
- 
+
   int test = 0;
   for (test = 0; test < numTests; ++test) {
 
@@ -94,14 +94,14 @@
       printf("Connect failed: %s\n", ttx.what());
       continue;
     }
-    
+
     /**
      * CONNECT TEST
      */
     printf("Test #%d, connect %s:%d\n", test+1, host.c_str(), port);
 
     uint64_t start = now();
-    
+
     /**
      * VOID TEST
      */
@@ -112,7 +112,7 @@
     } catch (TApplicationException tax) {
       printf("%s\n", tax.what());
     }
-    
+
     /**
      * STRING TEST
      */
@@ -120,14 +120,14 @@
     string s;
     testClient.testString(s, "Test");
     printf(" = \"%s\"\n", s.c_str());
-   
+
     /**
      * BYTE TEST
      */
     printf("testByte(1)");
     uint8_t u8 = testClient.testByte(1);
     printf(" = %d\n", (int)u8);
- 
+
     /**
      * I32 TEST
      */
@@ -148,7 +148,7 @@
     printf("testDouble(-5.2098523)");
     double dub = testClient.testDouble(-5.2098523);
     printf(" = %lf\n", dub);
-    
+
     /**
      * STRUCT TEST
      */
@@ -165,7 +165,7 @@
            (int)in.byte_thing,
            in.i32_thing,
            in.i64_thing);
-    
+
     /**
      * NESTED STRUCT TEST
      */
@@ -183,7 +183,7 @@
            (int)in.byte_thing,
            in.i32_thing,
            in.i64_thing,
-           in2.i32_thing);   
+           in2.i32_thing);
 
     /**
      * MAP TEST
@@ -387,11 +387,11 @@
       printf("testClient.testException(\"Xception\") =>");
       testClient.testException("Xception");
       printf("  void\nFAILURE\n");
-      
+
     } catch(Xception& e) {
       printf("  {%u, \"%s\"}\n", e.errorCode, e.message.c_str());
     }
-    
+
     try {
       printf("testClient.testException(\"success\") =>");
       testClient.testException("success");
@@ -399,9 +399,9 @@
     } catch(...) {
       printf("  exception\nFAILURE\n");
     }
-    
+
     /* test multi exception */
-    
+
     try {
       printf("testClient.testMultiException(\"Xception\", \"test 1\") =>");
       Xtruct result;
@@ -416,11 +416,11 @@
       Xtruct result;
       testClient.testMultiException(result, "Xception2", "test 2");
       printf("  result\nFAILURE\n");
-      
+
     } catch(Xception2& e) {
       printf("  {%u, {\"%s\"}}\n", e.errorCode, e.struct_thing.string_thing.c_str());
     }
-    
+
     try {
       printf("testClient.testMultiException(\"success\", \"test 3\") =>");
       Xtruct result;
@@ -429,12 +429,12 @@
     } catch(...) {
       printf("  exception\nFAILURE\n");
     }
-    
+
     uint64_t stop = now();
     uint64_t tot = stop-start;
 
     printf("Total time: %"PRIu64" us\n", stop-start);
-    
+
     time_tot += tot;
     if (time_min == 0 || tot < time_min) {
       time_min = tot;
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index 3afc955..773225e 100644
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -146,7 +146,7 @@
 
   void testInsanity(map<UserId, map<Numberz,Insanity> > &insane, const Insanity &argument) {
     printf("testInsanity()\n");
-    
+
     Xtruct hello;
     hello.string_thing = "Hello2";
     hello.byte_thing = 2;
@@ -210,12 +210,12 @@
     }
     printf("}\n");
 
-    
+
   }
 
   void testMulti(Xtruct &hello, const int8_t arg0, const int32_t arg1, const int64_t arg2, const std::map<int16_t, std::string>  &arg3, const Numberz arg4, const UserId arg5) {
     printf("testMulti()\n");
-    
+
     hello.string_thing = "Hello2";
     hello.byte_thing = arg0;
     hello.i32_thing = arg1;
@@ -235,7 +235,7 @@
       return;
     }
   }
-  
+
   void testMultiException(Xtruct &result, const std::string &arg0, const std::string &arg1) throw(Xception, Xception2) {
 
     printf("testMultiException(%s, %s)\n", arg0.c_str(), arg1.c_str());
@@ -275,9 +275,9 @@
     "\t\tprotocol-type\t\ttype of protocol, \"binary\", \"ascii\", or \"xml\".  Default is " << protocolType << endl <<
 
     "\t\tworkers\t\tNumber of thread pools workers.  Only valid for thread-pool server type.  Default is " << workerCount << endl;
-    
+
   map<string, string>  args;
-  
+
   for (int ix = 1; ix < argc; ix++) {
     string arg(argv[ix]);
     if (arg.compare(0,2, "--") == 0) {
@@ -303,7 +303,7 @@
     }
 
     if (!args["server-type"].empty()) {
-      serverType = args["server-type"];     
+      serverType = args["server-type"];
       if (serverType == "simple") {
       } else if (serverType == "thread-pool") {
       } else if (serverType == "threaded") {
@@ -323,7 +323,7 @@
       } else {
 	throw invalid_argument("Unknown protocol type "+protocolType);
       }
-    } 
+    }
 
     if (!args["workers"].empty()) {
       workerCount = atoi(args["workers"].c_str());
@@ -379,7 +379,7 @@
     threadPoolServer.serve();
 
   } else if (serverType == "threaded") {
-    
+
     TThreadedServer threadedServer(testProcessor,
                                    serverSocket,
                                    transportFactory,
diff --git a/test/cpp/src/main.cpp b/test/cpp/src/main.cpp
index 160ca8f..78491d6 100644
--- a/test/cpp/src/main.cpp
+++ b/test/cpp/src/main.cpp
@@ -49,8 +49,8 @@
 };
 
 
-// typedef hash_map<const char*, int, hash<const char*>, eqstr> count_map; 
-typedef map<const char*, int, ltstr> count_map; 
+// typedef hash_map<const char*, int, hash<const char*>, eqstr> count_map;
+typedef map<const char*, int, ltstr> count_map;
 
 class Server : public ServiceIf {
  public:
@@ -105,12 +105,12 @@
 
   void run() {
 
-    // Wait for all worker threads to start 
+    // Wait for all worker threads to start
 
     {Synchronized s(_monitor);
-	while(_workerCount == 0) {
-	  _monitor.wait();
-	}
+      while(_workerCount == 0) {
+        _monitor.wait();
+      }
     }
 
     _startTime = Util::currentTime();
@@ -125,20 +125,20 @@
     case T_STRING: loopEchoString(); break;
     default: cerr << "Unexpected loop type" << _loopType << endl; break;
     }
-    
+
     _endTime = Util::currentTime();
 
     _transport->close();
-    
+
     _done = true;
-      
+
     {Synchronized s(_monitor);
 
       _workerCount--;
-	  
+
       if (_workerCount == 0) {
-	
-	_monitor.notify();
+
+        _monitor.notify();
       }
     }
   }
@@ -157,7 +157,7 @@
       assert(result == arg);
     }
   }
-  
+
   void loopEchoI32() {
     for (size_t ix = 0; ix < _loopCount; ix++) {
       int32_t arg = 1;
@@ -175,7 +175,7 @@
       assert(result == arg);
     }
   }
-    
+
   void loopEchoString() {
     for (size_t ix = 0; ix < _loopCount; ix++) {
       string arg = "hello";
@@ -184,7 +184,7 @@
       assert(result == arg);
     }
   }
-  
+
   shared_ptr<TTransport> _transport;
   shared_ptr<ServiceClient> _client;
   Monitor& _monitor;
@@ -228,10 +228,10 @@
     "\tlog-request    Log all request to ./requestlog.tlog. Default is " << logRequests << endl <<
     "\treplay-request Replay requests from log file (./requestlog.tlog) Default is " << replayRequests << endl <<
     "\tworkers        Number of thread pools workers.  Only valid for thread-pool server type.  Default is " << workerCount << endl;
-    
-        
+
+
   map<string, string>  args;
-  
+
   for (int ix = 1; ix < argc; ix++) {
 
     string arg(argv[ix]);
@@ -243,9 +243,9 @@
       string key = string(arg, 2, end - 2);
 
       if (end != string::npos) {
-	args[key] = string(arg, end + 1);
+        args[key] = string(arg, end + 1);
       } else {
-	args[key] = "true";
+        args[key] = "true";
       }
     } else {
       throw invalid_argument("Unexcepted command line token: "+arg);
@@ -289,7 +289,7 @@
 
     if (!args["server-type"].empty()) {
       serverType = args["server-type"];
-      
+
       if (serverType == "simple") {
 
       } else if (serverType == "thread-pool") {
@@ -298,7 +298,7 @@
 
       } else {
 
-	throw invalid_argument("Unknown server type "+serverType);
+        throw invalid_argument("Unknown server type "+serverType);
       }
     }
 
@@ -319,7 +319,7 @@
   if (replayRequests) {
     shared_ptr<Server> serviceHandler(new Server());
     shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
-  
+
     // Transports
     shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
     fileTransport->setChunkSize(2 * 1024 * 1024);
@@ -333,7 +333,7 @@
                                  protocolFactory,
                                  fileTransport);
 
-    fileProcessor.process(0, true);                                     
+    fileProcessor.process(0, true);
     exit(0);
   }
 
@@ -356,34 +356,34 @@
       shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
       fileTransport->setChunkSize(2 * 1024 * 1024);
       fileTransport->setMaxEventSize(1024 * 16);
-      
-      transportFactory = 
+
+      transportFactory =
         shared_ptr<TTransportFactory>(new TPipedTransportFactory(fileTransport));
     }
 
     shared_ptr<Thread> serverThread;
 
     if (serverType == "simple") {
-      
+
       serverThread = threadFactory->newThread(shared_ptr<TServer>(new TSimpleServer(serviceProcessor, serverSocket, transportFactory, protocolFactory)));
-      
+
     } else if (serverType == "threaded") {
 
       serverThread = threadFactory->newThread(shared_ptr<TServer>(new TThreadedServer(serviceProcessor, serverSocket, transportFactory, protocolFactory)));
-      
+
     } else if (serverType == "thread-pool") {
 
       shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(workerCount);
 
       threadManager->threadFactory(threadFactory);
-      threadManager->start();     
+      threadManager->start();
       serverThread = threadFactory->newThread(shared_ptr<TServer>(new TThreadPoolServer(serviceProcessor, serverSocket, transportFactory, protocolFactory, threadManager)));
     }
 
     cerr << "Starting the server on port " << port << endl;
 
     serverThread->start();
-    
+
     // If we aren't running clients, just wait forever for external clients
 
     if (clientCount == 0) {
@@ -407,77 +407,77 @@
     else {throw invalid_argument("Unknown service call "+callName);}
 
     for (size_t ix = 0; ix < clientCount; ix++) {
-    
+
       shared_ptr<TSocket> socket(new TSocket("127.0.01", port));
       shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket, 2048));
       shared_ptr<TProtocol> protocol(new TBinaryProtocol(bufferedSocket));
       shared_ptr<ServiceClient> serviceClient(new ServiceClient(protocol));
-    
+
       clientThreads.insert(threadFactory->newThread(shared_ptr<ClientThread>(new ClientThread(socket, serviceClient, monitor, threadCount, loopCount, loopType))));
     }
-  
+
     for (std::set<shared_ptr<Thread> >::const_iterator thread = clientThreads.begin(); thread != clientThreads.end(); thread++) {
       (*thread)->start();
     }
 
     long long time00;
     long long time01;
-  
+
     {Synchronized s(monitor);
       threadCount = clientCount;
-    
+
       cerr << "Launch "<< clientCount << " client threads" << endl;
-    
+
       time00 =  Util::currentTime();
-    
+
       monitor.notifyAll();
-      
+
       while(threadCount > 0) {
-	monitor.wait();
+        monitor.wait();
       }
-    
+
       time01 =  Util::currentTime();
     }
-  
+
     long long firstTime = 9223372036854775807LL;
     long long lastTime = 0;
 
     double averageTime = 0;
     long long minTime = 9223372036854775807LL;
     long long maxTime = 0;
-  
+
     for (set<shared_ptr<Thread> >::iterator ix = clientThreads.begin(); ix != clientThreads.end(); ix++) {
-      
+
       shared_ptr<ClientThread> client = dynamic_pointer_cast<ClientThread>((*ix)->runnable());
-      
+
       long long delta = client->_endTime - client->_startTime;
-      
+
       assert(delta > 0);
 
       if (client->_startTime < firstTime) {
-	firstTime = client->_startTime;
+        firstTime = client->_startTime;
       }
-      
+
       if (client->_endTime > lastTime) {
-	lastTime = client->_endTime;
+        lastTime = client->_endTime;
       }
-      
+
       if (delta < minTime) {
-	minTime = delta;
+        minTime = delta;
       }
-      
+
       if (delta > maxTime) {
-	maxTime = delta;
+        maxTime = delta;
       }
-      
+
       averageTime+= delta;
     }
-    
+
     averageTime /= clientCount;
-    
-    
+
+
     cout <<  "workers :" << workerCount << ", client : " << clientCount << ", loops : " << loopCount << ", rate : " << (clientCount * loopCount * 1000) / ((double)(time01 - time00)) << endl;
-    
+
     count_map count = serviceHandler->getCount();
     count_map::iterator iter;
     for (iter = count.begin(); iter != count.end(); ++iter) {