Thrift: Whitespace cleanup.
authorDavid Reiss <dreiss@apache.org>
Wed, 6 Feb 2008 22:18:40 +0000 (22:18 +0000)
committerDavid Reiss <dreiss@apache.org>
Wed, 6 Feb 2008 22:18:40 +0000 (22:18 +0000)
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

206 files changed:
COPYING
LICENSE
bootstrap.sh
compiler/cpp/src/generate/t_cocoa_generator.h
compiler/cpp/src/generate/t_csharp_generator.cc
compiler/cpp/src/generate/t_hs_generator.cc
compiler/cpp/src/generate/t_hs_generator.h
compiler/cpp/src/generate/t_java_generator.h
compiler/cpp/src/generate/t_ocaml_generator.cc
compiler/cpp/src/generate/t_ocaml_generator.h
compiler/cpp/src/generate/t_perl_generator.h
compiler/cpp/src/generate/t_py_generator.cc
compiler/cpp/src/generate/t_rb_generator.h
compiler/cpp/src/generate/t_st_generator.cc
compiler/cpp/src/generate/t_xsd_generator.cc
compiler/cpp/src/parse/t_const_value.h
compiler/cpp/src/parse/t_doc.h
compiler/cpp/src/parse/t_enum_value.h
compiler/cpp/src/parse/t_list.h
compiler/cpp/src/parse/t_scope.h
compiler/cpp/src/platform.h
doc/thrift.tex
lib/cocoa/src/TApplicationException.m
lib/cocoa/src/TException.m
lib/cocoa/src/protocol/TBinaryProtocol.h
lib/cocoa/src/protocol/TBinaryProtocol.m
lib/cocoa/src/server/TSocketServer.h
lib/cocoa/src/server/TSocketServer.m
lib/cocoa/src/transport/THTTPClient.h
lib/cocoa/src/transport/THTTPClient.m
lib/cocoa/src/transport/TNSFileHandleTransport.m
lib/cocoa/src/transport/TNSStreamTransport.m
lib/cocoa/src/transport/TSocketClient.m
lib/cpp/Makefile.am
lib/cpp/src/TLogging.h
lib/cpp/src/TProcessor.h
lib/cpp/src/Thrift.cpp
lib/cpp/src/Thrift.h
lib/cpp/src/concurrency/Exception.h
lib/cpp/src/concurrency/Mutex.cpp
lib/cpp/src/concurrency/Mutex.h
lib/cpp/src/concurrency/TimerManager.cpp
lib/cpp/src/concurrency/TimerManager.h
lib/cpp/src/concurrency/Util.h
lib/cpp/src/concurrency/test/TimerManagerTests.h
lib/cpp/src/processor/PeekProcessor.cpp
lib/cpp/src/processor/PeekProcessor.h
lib/cpp/src/processor/StatsProcessor.h
lib/cpp/src/protocol/TBinaryProtocol.cpp
lib/cpp/src/protocol/TBinaryProtocol.h
lib/cpp/src/protocol/TDebugProtocol.cpp
lib/cpp/src/protocol/TDebugProtocol.h
lib/cpp/src/protocol/TDenseProtocol.h
lib/cpp/src/protocol/TOneWayProtocol.h
lib/cpp/src/protocol/TProtocol.h
lib/cpp/src/protocol/TProtocolException.h
lib/cpp/src/transport/TFileTransport.h
lib/cpp/src/transport/THttpClient.cpp
lib/cpp/src/transport/THttpClient.h
lib/cpp/src/transport/TServerSocket.h
lib/cpp/src/transport/TServerTransport.h
lib/cpp/src/transport/TSocketPool.cpp
lib/cpp/src/transport/TSocketPool.h
lib/cpp/src/transport/TTransport.h
lib/cpp/src/transport/TTransportException.cpp
lib/cpp/src/transport/TTransportException.h
lib/cpp/src/transport/TTransportUtils.cpp
lib/cpp/src/transport/TZlibTransport.cpp
lib/cpp/src/transport/TZlibTransport.h
lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs
lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj
lib/csharp/src/Protocol/TBinaryProtocol.cs
lib/csharp/src/Protocol/TField.cs
lib/csharp/src/Protocol/TList.cs
lib/csharp/src/Protocol/TMap.cs
lib/csharp/src/Protocol/TMessage.cs
lib/csharp/src/Protocol/TMessageType.cs
lib/csharp/src/Protocol/TProtocol.cs
lib/csharp/src/Protocol/TProtocolFactory.cs
lib/csharp/src/Protocol/TProtocolUtil.cs
lib/csharp/src/Protocol/TSet.cs
lib/csharp/src/Protocol/TStruct.cs
lib/csharp/src/Protocol/TType.cs
lib/csharp/src/Server/TServer.cs
lib/csharp/src/Server/TSimpleServer.cs
lib/csharp/src/Server/TThreadPoolServer.cs
lib/csharp/src/TApplicationException.cs
lib/csharp/src/TProcessor.cs
lib/csharp/src/Transport/TServerSocket.cs
lib/csharp/src/Transport/TServerTransport.cs
lib/csharp/src/Transport/TSocket.cs
lib/csharp/src/Transport/TStreamTransport.cs
lib/csharp/src/Transport/TTransport.cs
lib/csharp/src/Transport/TTransportException.cs
lib/csharp/src/Transport/TTransportFactory.cs
lib/erl/COPYING
lib/erl/LICENSE
lib/erl/build/beamver
lib/erl/build/otp.mk
lib/erl/build/otp_subdir.mk
lib/erl/build/raw_test.mk
lib/erl/include/protocol/tBinaryProtocol.hrl
lib/erl/include/protocol/tBinaryProtocolFactory.hrl
lib/erl/include/protocol/tProtocol.hrl
lib/erl/include/protocol/tProtocolFactory.hrl
lib/erl/include/server/tErlServer.hrl
lib/erl/include/server/tServer.hrl
lib/erl/include/server/tSimpleServer.hrl
lib/erl/include/tErlProcessor.hrl
lib/erl/include/tProcessor.hrl
lib/erl/include/transport/tBufferedTransport.hrl
lib/erl/include/transport/tBufferedTransportFactory.hrl
lib/erl/include/transport/tErlAcceptor.hrl
lib/erl/include/transport/tServerSocket.hrl
lib/erl/include/transport/tServerTransport.hrl
lib/erl/include/transport/tSocket.hrl
lib/erl/include/transport/tTransport.hrl
lib/erl/include/transport/tTransportFactory.hrl
lib/erl/src/Makefile
lib/erl/src/protocol/tBinaryProtocolFactory.erl
lib/erl/src/protocol/tProtocolFactory.erl
lib/erl/src/server/tServer.erl
lib/erl/src/server/tSimpleServer.erl
lib/erl/src/tProcessor.erl
lib/erl/src/thrift_app.erl
lib/erl/src/thrift_app_sup.erl
lib/hs/src/TBinaryProtocol.hs
lib/hs/src/TChannelTransport.hs
lib/hs/src/TServer.hs
lib/hs/src/TSocket.hs
lib/hs/src/Thrift.hs
lib/java/COPYING
lib/java/LICENSE
lib/java/src/TApplicationException.java
lib/java/src/TException.java
lib/java/src/TProcessorFactory.java
lib/java/src/protocol/TBinaryProtocol.java
lib/java/src/protocol/TList.java
lib/java/src/protocol/TMap.java
lib/java/src/protocol/TProtocol.java
lib/java/src/protocol/TProtocolUtil.java
lib/java/src/reflection/limited/Argument.java
lib/java/src/reflection/limited/ContainerType.java
lib/java/src/reflection/limited/Method.java
lib/java/src/reflection/limited/Service.java
lib/java/src/reflection/limited/SimpleType.java
lib/java/src/reflection/limited/ThriftType.java
lib/java/src/server/TServer.java
lib/java/src/server/TSimpleServer.java
lib/java/src/transport/TIOStreamTransport.java
lib/java/src/transport/TServerSocket.java
lib/java/src/transport/TSocket.java
lib/ocaml/README
lib/ocaml/src/TBinaryProtocol.ml
lib/ocaml/src/TChannelTransport.ml
lib/ocaml/src/TServer.ml
lib/ocaml/src/TServerSocket.ml
lib/ocaml/src/TSocket.ml
lib/ocaml/src/TThreadedServer.ml
lib/ocaml/src/Thrift.ml
lib/perl/COPYING
lib/perl/LICENSE
lib/perl/lib/Thrift/HttpClient.pm
lib/php/COPYING
lib/php/LICENSE
lib/php/src/ext/thrift_protocol/trunk/php_thrift_protocol.cpp
lib/php/src/protocol/TBinaryProtocol.php
lib/py/src/reflection/limited/ttypes.py
lib/py/src/server/TServer.py
lib/py/src/transport/THttpClient.py
lib/py/src/transport/TSocket.py
lib/rb/COPYING
lib/rb/LICENSE
lib/rb/lib/thrift/protocol/tbinaryprotocol.rb
lib/rb/lib/thrift/protocol/tprotocol.rb
lib/rb/lib/thrift/server/tserver.rb
lib/rb/setup.rb
test/DocTest.thrift
test/FastbinaryTest.py
test/SmallTest.thrift
test/cpp/Makefile.thrift
test/cpp/src/TestClient.cpp
test/cpp/src/TestServer.cpp
test/cpp/src/main.cpp
test/hs/Client.hs
test/java/src/TestServer.java
test/ocaml/server/TestServer.ml
test/perl/Makefile
test/py/Makefile
test/py/RunClientServer.py
test/py/TestClient.py
test/py/TestServer.py
test/py/TestSocket.py
test/rb/Makefile
test/rb/TestSmallService.rb
test/rb/TestThrift.rb
test/threads/Makefile
test/threads/ThreadsServer.cpp
thrift.el
tutorial/cpp/CppClient.cpp
tutorial/java/src/JavaClient.java
tutorial/php/PhpClient.php
tutorial/py/PythonClient.py
tutorial/py/PythonServer.py
tutorial/rb/RubyClient.rb
tutorial/tutorial.thrift

diff --git a/COPYING b/COPYING
index 039f21e..0101a7d 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
diff --git a/LICENSE b/LICENSE
index 039f21e..0101a7d 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
index 84ea481..92535fc 100755 (executable)
@@ -18,8 +18,8 @@ fi
 autoconf
 automake -ac --add-missing --foreign || exit 1
 
-for subdir in ${subdirs}; do 
-    if [ -x "${subdir}/bootstrap.sh" ]; then 
+for subdir in ${subdirs}; do
+    if [ -x "${subdir}/bootstrap.sh" ]; then
       cwd="`pwd`"
       cd "${subdir}"
       ./bootstrap.sh
index 9ceac31..79f3007 100644 (file)
@@ -65,10 +65,10 @@ class t_cocoa_generator : public t_oop_generator {
   void generate_cocoa_struct_result_writer(std::ofstream& out, t_struct* tstruct);
   void generate_cocoa_struct_writer(std::ofstream& out, t_struct* tstruct);
   void generate_cocoa_struct_description(std::ofstream& out, t_struct* tstruct);
-  
+
   std::string function_result_helper_struct_type(t_function* tfunction);
   void generate_function_helpers(t_function* tfunction);
-  
+
   /**
    * Service-level generation functions
    */
@@ -86,17 +86,17 @@ class t_cocoa_generator : public t_oop_generator {
    */
 
   void generate_deserialize_field        (std::ofstream& out,
-                                          t_field*    tfield, 
+                                          t_field*    tfield,
                                           std::string fieldName);
-  
+
   void generate_deserialize_struct       (std::ofstream& out,
                                           t_struct*   tstruct,
                                           std::string prefix="");
-  
+
   void generate_deserialize_container    (std::ofstream& out,
                                           t_type*     ttype,
                                           std::string prefix="");
-  
+
   void generate_deserialize_set_element  (std::ofstream& out,
                                           t_set*      tset,
                                           std::string prefix="");
@@ -157,7 +157,7 @@ class t_cocoa_generator : public t_oop_generator {
     ttype = get_true_type(ttype);
 
     return
-      ttype->is_container() || 
+      ttype->is_container() ||
       ttype->is_struct() ||
       ttype->is_xception() ||
       ttype->is_string();
index fceec84..676125c 100644 (file)
@@ -49,9 +49,9 @@ void t_csharp_generator::end_csharp_namespace(ofstream& out) {
 string t_csharp_generator::csharp_type_usings() {
   return string() +
     "using System;\n" +
-    "using System.Collections;\n" + 
+    "using System.Collections;\n" +
     "using System.Collections.Generic;\n" +
-    "using System.Text;\n" + 
+    "using System.Text;\n" +
     "using Thrift;\n";
 }
 
@@ -95,7 +95,7 @@ void t_csharp_generator::generate_enum(t_enum* tenum) {
   }
 
   scope_down(f_enum);
-  
+
   end_csharp_namespace(f_enum);
 
   f_enum.close();
@@ -332,7 +332,7 @@ void t_csharp_generator::generate_csharp_struct_definition(ofstream &out, t_stru
     indent_down();
     indent(out) << "}" << endl << endl;
   }
-  
+
   indent(out) <<
     "public " << tstruct->get_name() << "() {" << endl;
   indent_up();
@@ -376,7 +376,7 @@ void t_csharp_generator::generate_csharp_struct_reader(ofstream& out, t_struct*
   indent(out) <<
     "TField field;" << endl <<
     indent() << "TStruct struc = iprot.ReadStructBegin();" << endl;
-  
+
   indent(out) <<
     "while (true)" << endl;
   scope_up(out);
@@ -1070,7 +1070,7 @@ void t_csharp_generator::generate_deserialize_field(ofstream& out, t_field* tfie
   } else if (type->is_base_type() || type->is_enum()) {
     indent(out) <<
       name << " = ";
-    
+
     if (type->is_enum())
     {
       out << "(" << type_name(type, false, true) << ")";
@@ -1157,7 +1157,7 @@ void t_csharp_generator::generate_deserialize_container(ofstream& out, t_type* t
   indent(out) <<
     "for( int " << i << " = 0; " << i << " < " << obj << ".Count" << "; " << "++" << i << ")" << endl;
   scope_up(out);
-  
+
   if (ttype->is_map()) {
     generate_deserialize_map_element(out, (t_map*)ttype, prefix);
   } else if (ttype->is_set()) {
index 6ef7a95..3be56b1 100644 (file)
@@ -126,7 +126,7 @@ void t_hs_generator::close_generator() {
   f_types_.close();
   f_consts_.close();
 }
+
 /**
  * Generates a typedef. Ez.
  *
@@ -138,7 +138,7 @@ void t_hs_generator::generate_typedef(t_typedef* ttypedef) {
 }
 
 /**
- * Generates code for an enumerated type. 
+ * Generates code for an enumerated type.
  * the values.
  *
  * @param tenum The enumeration
@@ -172,7 +172,7 @@ void t_hs_generator::generate_enum(t_enum* tenum) {
       ++value;
     }
     string name = capitalize((*c_iter)->get_name());
-    
+
     f_types_ <<
       indent() << name << " -> " << value << endl;
   }
@@ -187,7 +187,7 @@ void t_hs_generator::generate_enum(t_enum* tenum) {
       ++value;
     }
     string name = capitalize((*c_iter)->get_name());
-    
+
     f_types_ <<
       indent() << value << " -> " << name << endl;
   }
@@ -318,10 +318,10 @@ string t_hs_generator::render_const_value(t_type* type, t_const_value* value) {
     t_type* etype = ((t_set*)type)->get_elem_type();
     const vector<t_const_value*>& val = value->get_list();
     vector<t_const_value*>::const_iterator v_iter;
-    out << "(mkSet [";    
+    out << "(mkSet [";
     for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
       string val = render_const_value(etype, *v_iter);
-      out << val; 
+      out << val;
     }
     out << "])";
   }
@@ -342,7 +342,7 @@ void t_hs_generator::generate_struct(t_struct* tstruct) {
  * @param txception The struct definition
  */
 void t_hs_generator::generate_xception(t_struct* txception) {
-  generate_hs_struct(txception, true);  
+  generate_hs_struct(txception, true);
 }
 
 /**
@@ -354,7 +354,7 @@ void t_hs_generator::generate_hs_struct(t_struct* tstruct,
 }
 
 /**
- * Generates a struct definition for a thrift data type. 
+ * Generates a struct definition for a thrift data type.
  *
  * @param tstruct The struct definition
  */
@@ -365,7 +365,7 @@ void t_hs_generator::generate_hs_struct_definition(ofstream& out,
   string tname = type_name(tstruct);
   string name = tstruct->get_name();
   const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter; 
+  vector<t_field*>::const_iterator m_iter;
 
   indent(out) << "data "<<tname<<" = "<<tname;
   if (members.size() > 0) {
@@ -405,7 +405,7 @@ void t_hs_generator::generate_hs_struct_reader(ofstream& out, t_struct* tstruct)
 
   indent(out) << "read_" << sname << "_fields iprot rec = do" << endl;
   indent_up(); // do
-    
+
   // Read beginning field marker
   indent(out) << "(_," << t <<","<<id<<") <- readFieldBegin iprot" << endl;
   // Check for field STOP marker and break
@@ -443,7 +443,7 @@ void t_hs_generator::generate_hs_struct_reader(ofstream& out, t_struct* tstruct)
   indent_down(); // -case
   indent_down(); // -if
   indent_down(); // -do
-  indent_down(); 
+  indent_down();
 
   // read
   indent(out) << "read_"<<sname<<" iprot = do" << endl;
@@ -526,11 +526,11 @@ void t_hs_generator::generate_service(t_service* tservice) {
 
 
   f_service_ <<
-     "import " << capitalize(program_name_) << "_Types" << endl << 
+     "import " << capitalize(program_name_) << "_Types" << endl <<
     "import qualified " << capitalize(service_name_) << "_Iface as Iface" << endl;
 
-  // Generate the three main parts of the service 
+
+  // Generate the three main parts of the service
   generate_service_helpers(tservice);
   generate_service_interface(tservice);
   generate_service_client(tservice);
@@ -592,10 +592,10 @@ void t_hs_generator::generate_service_interface(t_service* tservice) {
   indent(f_iface_) << "module " << capitalize(service_name_) << "_Iface where" << endl;
 
   indent(f_iface_) <<
-    hs_imports() << endl << 
-    "import " << capitalize(program_name_) << "_Types" << endl << 
+    hs_imports() << endl <<
+    "import " << capitalize(program_name_) << "_Types" << endl <<
     endl;
-  
+
   if (tservice->get_extends() != NULL) {
     string extends = type_name(tservice->get_extends());
     indent(f_iface_) << "import " << extends <<"_Iface" << endl;
@@ -606,7 +606,7 @@ void t_hs_generator::generate_service_interface(t_service* tservice) {
   indent_up();
 
   vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::iterator f_iter; 
+  vector<t_function*>::iterator f_iter;
   for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
     string ft = function_type(*f_iter,true,true,true);
     f_iface_ <<
@@ -628,7 +628,7 @@ void t_hs_generator::generate_service_client(t_service* tservice) {
   f_client_.open(f_client_name.c_str());
 
   vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::const_iterator f_iter;    
+  vector<t_function*>::const_iterator f_iter;
 
   string extends = "";
   string exports="";
@@ -653,7 +653,7 @@ void t_hs_generator::generate_service_client(t_service* tservice) {
   indent(f_client_) << "import " << capitalize(service_name_) << endl;
   // DATS RITE A GLOBAL VAR
   indent(f_client_) << "seqid = newIORef 0" << endl;
-   
+
 
   // Generate client method implementations
 
@@ -674,24 +674,24 @@ void t_hs_generator::generate_service_client(t_service* tservice) {
     indent(f_client_) <<  "send_" << funname << " op" << fargs;
 
     f_client_ << endl;
-    
+
     if (!(*f_iter)->is_async()) {
       f_client_ << indent();
       f_client_ <<
         "recv_" << funname << " ip" << endl;
     }
     indent_down();
-    
+
     indent(f_client_) <<
       "send_" << funname << " op" << fargs << " = do" << endl;
     indent_up();
     indent(f_client_) << "seq <- seqid" << endl;
     indent(f_client_) << "seqn <- readIORef seq" << endl;
     std::string argsname = capitalize((*f_iter)->get_name() + "_args");
-    
+
     // Serialize the request header
     f_client_ <<
-      indent() << "writeMessageBegin op (\"" << (*f_iter)->get_name() << "\", M_CALL, seqn)" << endl; 
+      indent() << "writeMessageBegin op (\"" << (*f_iter)->get_name() << "\", M_CALL, seqn)" << endl;
     f_client_ << indent() << "write_" << argsname << " op ("<<argsname<<"{";
     bool first = true;
     for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
@@ -702,12 +702,12 @@ void t_hs_generator::generate_service_client(t_service* tservice) {
       f_client_ << "f_" << argsname <<"_" << (*fld_iter)->get_name() << "=Just arg_" << (*fld_iter)->get_name();
     }
     f_client_ << "})" << endl;
-    
+
     // Write to the stream
     f_client_ <<
       indent() << "writeMessageEnd op" << endl <<
-      indent() << "pflush op" << endl;  
-    
+      indent() << "pflush op" << endl;
+
     indent_down();
 
     if (!(*f_iter)->is_async()) {
@@ -715,7 +715,7 @@ void t_hs_generator::generate_service_client(t_service* tservice) {
       t_struct noargs(program_);
 
       std::string funname = string("recv_") + (*f_iter)->get_name();
-      
+
       t_function recv_function((*f_iter)->get_returntype(),
                                funname,
                                &noargs);
@@ -753,8 +753,8 @@ void t_hs_generator::generate_service_client(t_service* tservice) {
         indent(f_client_) << "Nothing -> do" << endl;
         indent_up(); // none
       }
-      
-      
+
+
       vector<t_field*>::const_iterator x_iter;
       for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
         f_client_ <<
@@ -764,7 +764,7 @@ void t_hs_generator::generate_service_client(t_service* tservice) {
         indent(f_client_) << "Just _v -> throwDyn _v" << endl;
         indent_down(); //-case
       }
-      
+
       // Careful, only return _result if not a void function
       if ((*f_iter)->get_returntype()->is_void()) {
         indent(f_client_) <<
@@ -793,7 +793,7 @@ void t_hs_generator::generate_service_client(t_service* tservice) {
 void t_hs_generator::generate_service_server(t_service* tservice) {
   // Generate the dispatch methods
   vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::iterator f_iter; 
+  vector<t_function*>::iterator f_iter;
 
   // Generate the process subfunctions
   for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
@@ -871,7 +871,7 @@ void t_hs_generator::generate_process_function(t_service* tservice,
       n++;
     }
     indent(f_service_) << "rs <- return (" << resultname;
-      
+
     for(int i=0; i<n;i++){
       f_service_ << " Nothing";
     }
@@ -909,7 +909,7 @@ void t_hs_generator::generate_process_function(t_service* tservice,
   }
   f_service_ << ")" << endl;
   indent_down();
-  
+
   if (xceptions.size() > 0 && !tfunction->is_async()) {
     for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
       indent(f_service_) << "(\\e  -> " <<endl;
@@ -980,7 +980,7 @@ void t_hs_generator::generate_deserialize_type(ofstream &out,
     case t_base_type::TYPE_VOID:
       throw "compiler error: cannot serialize void field in a struct";
       break;
-    case t_base_type::TYPE_STRING:        
+    case t_base_type::TYPE_STRING:
       out << "readString";
       break;
     case t_base_type::TYPE_BOOL:
@@ -1013,7 +1013,7 @@ void t_hs_generator::generate_deserialize_type(ofstream &out,
            type->get_name().c_str());
   }
 }
-  
+
 
 /**
  * Generates an unserializer for a struct, calling read()
@@ -1036,7 +1036,7 @@ void t_hs_generator::generate_deserialize_container(ofstream &out,
   string vtype = tmp("_vtype");
   string etype = tmp("_etype");
   string con = tmp("_con");
-  
+
   t_field fsize(g_type_i32, size);
   t_field fktype(g_type_byte, ktype);
   t_field fvtype(g_type_byte, vtype);
@@ -1080,7 +1080,7 @@ void t_hs_generator::generate_serialize_field(ofstream &out,
 
   if(name.length() == 0){
     name = decapitalize(tfield->get_name());
-  }  
+  }
 
   if (type->is_struct() || type->is_xception()) {
     generate_serialize_struct(out,
@@ -1122,12 +1122,12 @@ void t_hs_generator::generate_serialize_field(ofstream &out,
       default:
         throw "compiler error: no hs name for base type " + t_base_type::t_base_name(tbase);
       }
-    
+
     } else if (type->is_enum()) {
       string ename = capitalize(type->get_name());
       out << "writeI32 oprot (fromEnum "<< name << ")";
     }
-    
+
   } else {
     printf("DO NOT KNOW HOW TO SERIALIZE FIELD '%s' TYPE '%s'\n",
            tfield->get_name().c_str(),
@@ -1210,7 +1210,7 @@ void t_hs_generator::generate_serialize_list_element(ofstream &out,
 
 string t_hs_generator::function_type(t_function* tfunc, bool options, bool io, bool method){
   string result="";
-  
+
   const vector<t_field*>& fields = tfunc->get_arglist()->get_members();
   vector<t_field*>::const_iterator f_iter;
   for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
@@ -1254,7 +1254,7 @@ string t_hs_generator::type_name(t_type* ttype) {
  */
 string t_hs_generator::type_to_enum(t_type* type) {
   type = get_true_type(type);
-  
+
   if (type->is_base_type()) {
     t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
     switch (tbase) {
@@ -1295,7 +1295,7 @@ string t_hs_generator::type_to_enum(t_type* type) {
  */
 string t_hs_generator::render_hs_type(t_type* type) {
   type = get_true_type(type);
-  
+
   if (type->is_base_type()) {
     t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
     switch (tbase) {
index bae507b..facefbe 100644 (file)
@@ -74,13 +74,13 @@ class t_hs_generator : public t_oop_generator {
   void generate_deserialize_field        (std::ofstream &out,
                                           t_field*    tfield,
                                           std::string prefix);
-  
+
   void generate_deserialize_struct       (std::ofstream &out,
                                           t_struct*   tstruct);
-  
+
   void generate_deserialize_container    (std::ofstream &out,
                                           t_type*     ttype);
-  
+
   void generate_deserialize_set_element  (std::ofstream &out,
                                           t_set*      tset);
 
index d3b85d5..fe0a481 100644 (file)
@@ -77,17 +77,17 @@ class t_java_generator : public t_oop_generator {
    */
 
   void generate_deserialize_field        (std::ofstream& out,
-                                          t_field*    tfield, 
+                                          t_field*    tfield,
                                           std::string prefix="");
-  
+
   void generate_deserialize_struct       (std::ofstream& out,
                                           t_struct*   tstruct,
                                           std::string prefix="");
-  
+
   void generate_deserialize_container    (std::ofstream& out,
                                           t_type*     ttype,
                                           std::string prefix="");
-  
+
   void generate_deserialize_set_element  (std::ofstream& out,
                                           t_set*      tset,
                                           std::string prefix="");
@@ -147,7 +147,7 @@ class t_java_generator : public t_oop_generator {
     ttype = get_true_type(ttype);
 
     return
-      ttype->is_container() || 
+      ttype->is_container() ||
       ttype->is_struct() ||
       ttype->is_xception() ||
       ttype->is_string();
index f4f5c4a..eafda46 100644 (file)
@@ -124,7 +124,7 @@ void t_ocaml_generator::close_generator() {
   // Close types file
   f_types_.close();
 }
+
 /**
  * Generates a typedef. Ez.
  *
@@ -138,7 +138,7 @@ void t_ocaml_generator::generate_typedef(t_typedef* ttypedef) {
 }
 
 /**
- * Generates code for an enumerated type. 
+ * Generates code for an enumerated type.
  * the values.
  *
  * @param tenum The enumeration
@@ -170,7 +170,7 @@ void t_ocaml_generator::generate_enum(t_enum* tenum) {
       ++value;
     }
     string name = capitalize((*c_iter)->get_name());
-    
+
     f_types_ <<
       indent() << "| " << name << " -> " << value << endl;
   }
@@ -186,7 +186,7 @@ void t_ocaml_generator::generate_enum(t_enum* tenum) {
       ++value;
     }
     string name = capitalize((*c_iter)->get_name());
-    
+
     f_types_ <<
       indent() << "| " << value << " -> " << name << endl;
   }
@@ -352,7 +352,7 @@ void t_ocaml_generator::generate_struct(t_struct* tstruct) {
  * @param txception The struct definition
  */
 void t_ocaml_generator::generate_xception(t_struct* txception) {
-  generate_ocaml_struct(txception, true);  
+  generate_ocaml_struct(txception, true);
 }
 
 /**
@@ -365,7 +365,7 @@ void t_ocaml_generator::generate_ocaml_struct(t_struct* tstruct,
 }
 
 /**
- * Generates a struct definition for a thrift data type. 
+ * Generates a struct definition for a thrift data type.
  *
  * @param tstruct The struct definition
  */
@@ -373,7 +373,7 @@ void t_ocaml_generator::generate_ocaml_struct_definition(ofstream& out,
                                                          t_struct* tstruct,
                                                          bool is_exception) {
   const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter; 
+  vector<t_field*>::const_iterator m_iter;
   string tname = type_name(tstruct);
   indent(out) << "class " << tname << " =" << endl;
   indent(out) << "object (self)" << endl;
@@ -402,7 +402,7 @@ void t_ocaml_generator::generate_ocaml_struct_definition(ofstream& out,
 }
 
 /**
- * Generates a struct definition for a thrift data type. 
+ * Generates a struct definition for a thrift data type.
  *
  * @param tstruct The struct definition
  */
@@ -410,7 +410,7 @@ void t_ocaml_generator::generate_ocaml_struct_sig(ofstream& out,
                                                   t_struct* tstruct,
                                                   bool is_exception) {
   const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter; 
+  vector<t_field*>::const_iterator m_iter;
   string tname = type_name(tstruct);
   indent(out) << "class " << tname << " :" << endl;
   indent(out) << "object" << endl;
@@ -454,18 +454,18 @@ void t_ocaml_generator::generate_ocaml_struct_reader(ofstream& out, t_struct* ts
   indent(out) << "let " << str << " = new " << sname << " in" << endl;
   indent_up();
   indent(out) <<
-    "ignore(iprot#readStructBegin);" << endl;   
+    "ignore(iprot#readStructBegin);" << endl;
 
   // Loop over reading in fields
   indent(out) <<
     "(try while true do" << endl;
   indent_up();
   indent_up();
-    
+
   // Read beginning field marker
   indent(out) <<
     "let (_," << t <<","<<id<<") = iprot#readFieldBegin in" << endl;
-  
+
   // Check for field STOP marker and break
   indent(out) <<
     "if " << t <<" = Protocol.T_STOP then" << endl;
@@ -474,7 +474,7 @@ void t_ocaml_generator::generate_ocaml_struct_reader(ofstream& out, t_struct* ts
       "raise Break" << endl;
     indent_down();
     indent(out) << "else ();" << endl;
-    
+
     indent(out) << "(match " << id<<" with " << endl;
     indent_up();
     // Generate deserialization code for known cases
@@ -494,7 +494,7 @@ void t_ocaml_generator::generate_ocaml_struct_reader(ofstream& out, t_struct* ts
     // In the default case we skip the field
     out <<
       indent() << "| _ -> " << "iprot#skip "<<t<<");" << endl;
-    indent_down();      
+    indent_down();
     // Read field end marker
     indent(out) << "iprot#readFieldEnd;" << endl;
     indent_down();
@@ -578,14 +578,14 @@ void t_ocaml_generator::generate_service(t_service* tservice) {
   }
   */
   f_service_ <<
-     "open " << capitalize(program_name_) << "_types" << endl << 
+     "open " << capitalize(program_name_) << "_types" << endl <<
     endl;
 
   f_service_i_ <<
-     "open " << capitalize(program_name_) << "_types" << endl << 
+     "open " << capitalize(program_name_) << "_types" << endl <<
     endl;
 
-  // Generate the three main parts of the service 
+  // Generate the three main parts of the service
   generate_service_helpers(tservice);
   generate_service_interface(tservice);
   generate_service_client(tservice);
@@ -657,7 +657,7 @@ void t_ocaml_generator::generate_service_interface(t_service* tservice) {
   }
 
   vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::iterator f_iter; 
+  vector<t_function*>::iterator f_iter;
   for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
     string ft = function_type(*f_iter,true,true);
     f_service_ <<
@@ -691,11 +691,11 @@ void t_ocaml_generator::generate_service_client(t_service* tservice) {
     indent(f_service_i_) << "inherit " << extends << ".client" << endl;
   }
   indent(f_service_) << "val mutable seqid = 0" << endl;
-   
+
 
   // Generate client method implementations
   vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::const_iterator f_iter;    
+  vector<t_function*>::const_iterator f_iter;
   for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
     t_struct* arg_struct = (*f_iter)->get_arglist();
     const vector<t_field*>& fields = arg_struct->get_members();
@@ -711,51 +711,51 @@ void t_ocaml_generator::generate_service_client(t_service* tservice) {
     indent(f_service_) <<
       "self#send_" << funname;
 
+
     for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
       f_service_ << " " << decapitalize((*fld_iter)->get_name());
     }
     f_service_ << ";" << endl;
-    
+
     if (!(*f_iter)->is_async()) {
       f_service_ << indent();
       f_service_ <<
         "self#recv_" << funname << endl;
     }
     indent_down();
-    
+
     indent(f_service_) <<
       "method private send_" << function_signature(*f_iter) << " = " << endl;
     indent_up();
-    
+
     std::string argsname = decapitalize((*f_iter)->get_name() + "_args");
-    
+
     // Serialize the request header
     f_service_ <<
       indent() << "oprot#writeMessageBegin (\"" << (*f_iter)->get_name() << "\", Protocol.CALL, seqid);" << endl;
-    
+
     f_service_ <<
       indent() << "let args = new " << argsname << " in" << endl;
     indent_up();
-    
+
     for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
       f_service_ <<
         indent() << "args#set_" << (*fld_iter)->get_name() << " " << (*fld_iter)->get_name() << ";" << endl;
     }
-    
+
     // Write to the stream
     f_service_ <<
       indent() << "args#write oprot;" << endl <<
       indent() << "oprot#writeMessageEnd;" << endl <<
-      indent() << "oprot#getTransport#flush" << endl;  
-    
+      indent() << "oprot#getTransport#flush" << endl;
+
     indent_down();
     indent_down();
 
     if (!(*f_iter)->is_async()) {
       std::string resultname = decapitalize((*f_iter)->get_name() + "_result");
       t_struct noargs(program_);
-      
+
       t_function recv_function((*f_iter)->get_returntype(),
                                string("recv_") + (*f_iter)->get_name(),
                                &noargs);
@@ -798,15 +798,15 @@ void t_ocaml_generator::generate_service_client(t_service* tservice) {
           indent() << "match result#get_success with Some v -> v | None -> (" << endl;
         indent_up();
       }
-      
-      
+
+
       vector<t_field*>::const_iterator x_iter;
       for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
         f_service_ <<
           indent() << "(match result#get_" << (*x_iter)->get_name() << " with None -> () | Some _v ->" << endl;
         indent(f_service_) << "  raise (" << capitalize(type_name((*x_iter)->get_type())) << " _v));" << endl;
       }
-      
+
       // Careful, only return _result if not a void function
       if ((*f_iter)->get_returntype()->is_void()) {
         indent(f_service_) <<
@@ -815,7 +815,7 @@ void t_ocaml_generator::generate_service_client(t_service* tservice) {
         f_service_ <<
           indent() << "raise (Application_Exn.E (Application_Exn.create Application_Exn.MISSING_RESULT \"" << (*f_iter)->get_name() << " failed: unknown result\")))" << endl;
         indent_down();
-      }     
+      }
 
       // Close function
       indent_down();
@@ -837,7 +837,7 @@ void t_ocaml_generator::generate_service_client(t_service* tservice) {
 void t_ocaml_generator::generate_service_server(t_service* tservice) {
   // Generate the dispatch methods
   vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::iterator f_iter; 
+  vector<t_function*>::iterator f_iter;
 
 
   // Generate the header portion
@@ -854,7 +854,7 @@ void t_ocaml_generator::generate_service_server(t_service* tservice) {
      indent() << "inherit Processor.t" << endl <<
     endl;
   string extends = "";
+
   if (tservice->get_extends() != NULL) {
     extends = type_name(tservice->get_extends());
     indent(f_service_) << "inherit " + extends + ".processor (handler :> " + extends + ".iface)" << endl;
@@ -865,7 +865,7 @@ void t_ocaml_generator::generate_service_server(t_service* tservice) {
     indent(f_service_) << "val processMap = Hashtbl.create " << functions.size() << endl;
   }
   indent(f_service_i_) << "val processMap : (string, int * Protocol.t * Protocol.t -> unit) Hashtbl.t" << endl;
+
   // Generate the server implementation
   indent(f_service_) <<
     "method process iprot oprot =" << endl;
@@ -907,7 +907,7 @@ void t_ocaml_generator::generate_service_server(t_service* tservice) {
   for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
     f_service_ <<
       indent() << "Hashtbl.add processMap \"" << (*f_iter)->get_name() << "\" self#process_" << (*f_iter)->get_name() << ";" << endl;
-  } 
+  }
   indent_down();
 
   indent_down();
@@ -964,10 +964,10 @@ void t_ocaml_generator::generate_process_function(t_service* tservice,
       indent() << "(try" << endl;
     indent_up();
   }
 
 
+
+
   f_service_ << indent();
   if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()) {
     f_service_ << "result#set_success ";
@@ -979,7 +979,7 @@ void t_ocaml_generator::generate_process_function(t_service* tservice,
   }
   f_service_ << ");" << endl;
 
-  
+
   if (xceptions.size() > 0) {
     indent_down();
     indent(f_service_) << "with" <<endl;
@@ -1065,7 +1065,7 @@ void t_ocaml_generator::generate_deserialize_type(ofstream &out,
     case t_base_type::TYPE_VOID:
       throw "compiler error: cannot serialize void field in a struct";
       break;
-    case t_base_type::TYPE_STRING:        
+    case t_base_type::TYPE_STRING:
       out << "readString";
       break;
     case t_base_type::TYPE_BOOL:
@@ -1097,7 +1097,7 @@ void t_ocaml_generator::generate_deserialize_type(ofstream &out,
            type->get_name().c_str());
   }
 }
-  
+
 
 /**
  * Generates an unserializer for a struct, calling read()
@@ -1120,7 +1120,7 @@ void t_ocaml_generator::generate_deserialize_container(ofstream &out,
   string vtype = tmp("_vtype");
   string etype = tmp("_etype");
   string con = tmp("_con");
-  
+
   t_field fsize(g_type_i32, size);
   t_field fktype(g_type_byte, ktype);
   t_field fvtype(g_type_byte, vtype);
@@ -1132,7 +1132,7 @@ void t_ocaml_generator::generate_deserialize_container(ofstream &out,
   if (ttype->is_map()) {
     indent(out) << "(let ("<<ktype<<","<<vtype<<","<<size<<") = iprot#readMapBegin in" << endl;
     indent(out) << "let "<<con<<" = Hashtbl.create "<<size<<" in" << endl;
-    indent_up(); 
+    indent_up();
     indent(out) << "for i = 1 to "<<size<<" do" <<endl;
     indent_up();
     indent(out) << "let _k = ";
@@ -1150,7 +1150,7 @@ void t_ocaml_generator::generate_deserialize_container(ofstream &out,
   } else if (ttype->is_set()) {
     indent(out) << "(let ("<<etype<<","<<size<<") = iprot#readSetBegin in" << endl;
     indent(out) << "let "<<con<<" = Hashtbl.create "<<size<<" in" << endl;
-    indent_up(); 
+    indent_up();
     indent(out) << "for i = 1 to "<<size<<" do" <<endl;
     indent_up();
     indent(out) << "Hashtbl.add "<<con<<" ";
@@ -1162,7 +1162,7 @@ void t_ocaml_generator::generate_deserialize_container(ofstream &out,
   } else if (ttype->is_list()) {
     indent(out) << "(let ("<<etype<<","<<size<<") = iprot#readListBegin in" << endl;
     indent_up();
-    indent(out) << "let "<<con<<" = (Array.to_list (Array.init "<<size<<" (fun _ -> "; 
+    indent(out) << "let "<<con<<" = (Array.to_list (Array.init "<<size<<" (fun _ -> ";
     generate_deserialize_type(out,((t_list*)ttype)->get_elem_type());
     out << "))) in" << endl;
     indent_up();
@@ -1194,7 +1194,7 @@ void t_ocaml_generator::generate_serialize_field(ofstream &out,
 
   if(name.length() == 0){
     name = decapitalize(tfield->get_name());
-  }  
+  }
 
   if (type->is_struct() || type->is_xception()) {
     generate_serialize_struct(out,
@@ -1209,7 +1209,7 @@ void t_ocaml_generator::generate_serialize_field(ofstream &out,
 
     indent(out) <<
       "oprot#";
-    
+
     if (type->is_base_type()) {
       t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
       switch (tbase) {
@@ -1245,7 +1245,7 @@ void t_ocaml_generator::generate_serialize_field(ofstream &out,
       string ename = capitalize(type->get_name());
       out << "writeI32("<<ename<<".to_i " << name << ")";
     }
-    
+
   } else {
     printf("DO NOT KNOW HOW TO SERIALIZE FIELD '%s' TYPE '%s'\n",
            tfield->get_name().c_str(),
@@ -1306,7 +1306,7 @@ void t_ocaml_generator::generate_serialize_container(ofstream &out,
     indent_down();
     indent(out) << ") " << prefix << ";" <<  endl;
   }
-    
+
   if (ttype->is_map()) {
     indent(out) <<
       "oprot#writeMapEnd";
@@ -1371,7 +1371,7 @@ string t_ocaml_generator::function_signature(t_function* tfunction,
 
 string t_ocaml_generator::function_type(t_function* tfunc, bool method, bool options){
   string result="";
-  
+
   const vector<t_field*>& fields = tfunc->get_arglist()->get_members();
   vector<t_field*>::const_iterator f_iter;
   for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
@@ -1430,7 +1430,7 @@ string t_ocaml_generator::type_name(t_type* ttype) {
  */
 string t_ocaml_generator::type_to_enum(t_type* type) {
   type = get_true_type(type);
-  
+
   if (type->is_base_type()) {
     t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
     switch (tbase) {
@@ -1471,7 +1471,7 @@ string t_ocaml_generator::type_to_enum(t_type* type) {
  */
 string t_ocaml_generator::render_ocaml_type(t_type* type) {
   type = get_true_type(type);
-  
+
   if (type->is_base_type()) {
     t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
     switch (tbase) {
index 331cf22..56f2a89 100644 (file)
@@ -74,13 +74,13 @@ class t_ocaml_generator : public t_oop_generator {
   void generate_deserialize_field        (std::ofstream &out,
                                           t_field*    tfield,
                                           std::string prefix);
-  
+
   void generate_deserialize_struct       (std::ofstream &out,
                                           t_struct*   tstruct);
-  
+
   void generate_deserialize_container    (std::ofstream &out,
                                           t_type*     ttype);
-  
+
   void generate_deserialize_set_element  (std::ofstream &out,
                                           t_set*      tset);
 
index dcb2e5e..689cf1c 100644 (file)
@@ -23,7 +23,7 @@ class t_perl_generator : public t_oop_generator {
  public:
   t_perl_generator(t_program* program) :
     t_oop_generator(program) {
-    
+
     out_dir_base_ = "gen-perl";
   }
 
index ca192ce..febeafd 100644 (file)
@@ -1040,7 +1040,7 @@ void t_py_generator::generate_service_remote(t_service* tservice) {
         | S_IROTH
         | S_IXOTH
 #endif
-               );
+  );
 }
 
 /**
index d2b7265..e0463ef 100644 (file)
@@ -77,18 +77,18 @@ class t_rb_generator : public t_oop_generator {
    */
 
   void generate_deserialize_field        (std::ofstream &out,
-                                          t_field*    tfield, 
+                                          t_field*    tfield,
                                           std::string prefix="",
                                           bool inclass=false);
-  
+
   void generate_deserialize_struct       (std::ofstream &out,
                                           t_struct*   tstruct,
                                           std::string prefix="");
-  
+
   void generate_deserialize_container    (std::ofstream &out,
                                           t_type*     ttype,
                                           std::string prefix="");
-  
+
   void generate_deserialize_set_element  (std::ofstream &out,
                                           t_set*      tset,
                                           std::string prefix="");
@@ -140,24 +140,24 @@ class t_rb_generator : public t_oop_generator {
   std::string type_to_enum(t_type* ttype);
 
 
-  
+
   std::string ruby_namespace(t_program* p) {
     std::string ns = p->get_ruby_namespace();
     return ns.size() ? ns : "";
   }
-  
+
   std::vector<std::string> ruby_modules(t_program* p) {
     std::string ns = p->get_ruby_namespace();
     boost::tokenizer<> tok(ns);
     std::vector<std::string> modules;
-    
+
     for(boost::tokenizer<>::iterator beg=tok.begin(); beg != tok.end(); ++beg) {
       modules.push_back(*beg);
     }
-    
+
     return modules;
   }
-  
+
   void begin_namespace(std::ofstream&, std::vector<std::string>);
   void end_namespace(std::ofstream&, std::vector<std::string>);
 
@@ -168,7 +168,7 @@ class t_rb_generator : public t_oop_generator {
    */
 
   std::ofstream f_types_;
-  std::ofstream f_consts_; 
+  std::ofstream f_consts_;
   std::ofstream f_service_;
 
 };
index fa7d851..34da15b 100644 (file)
@@ -609,7 +609,7 @@ string t_st_generator::struct_reader(t_struct *tstruct, string clsName = "") {
   //This is nasty, but without it we'll break things by prefixing TResult.
   string name = ((capitalize(clsName) == "TResult") ? capitalize(clsName) : prefix(clsName));
   out << indent() << val << " := " << name << " new." << endl;
-    
+
   out << indent() << "iprot readStructBegin." << endl <<
     indent() << "[" << desc << " := iprot readFieldBegin." << endl <<
     indent() << desc << " type = TType stop] whileFalse: [|" << found << "|" << endl;
index 7bab56d..3b67f1a 100644 (file)
@@ -56,10 +56,10 @@ void t_xsd_generator::generate_typedef(t_typedef* ttypedef) {
 }
 
 void t_xsd_generator::generate_struct(t_struct* tstruct) {
-  vector<t_field*>::const_iterator m_iter; 
+  vector<t_field*>::const_iterator m_iter;
   const vector<t_field*>& members = tstruct->get_members();
   bool xsd_all = tstruct->get_xsd_all();
-  
+
   indent(s_xsd_types_) << "<xsd:complexType name=\"" << tstruct->get_name() << "\">" << endl;
   indent_up();
   if (xsd_all) {
@@ -68,10 +68,10 @@ void t_xsd_generator::generate_struct(t_struct* tstruct) {
     indent(s_xsd_types_) << "<xsd:sequence>" << endl;
   }
   indent_up();
-  
+
   for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
     generate_element(s_xsd_types_, (*m_iter)->get_name(), (*m_iter)->get_type(), (*m_iter)->get_xsd_attrs(), (*m_iter)->get_xsd_optional() || xsd_all, (*m_iter)->get_xsd_nillable());
-  } 
+  }
 
   indent_down();
   if (xsd_all) {
@@ -102,12 +102,12 @@ void t_xsd_generator::generate_element(ostream& out,
       "<xsd:element name=\"" << name << "\"" << soptional << snillable << ">" << endl;
     indent_up();
     if (attrs == NULL && ttype->is_void()) {
-      indent(out) << 
+      indent(out) <<
         "<xsd:complexType />" << endl;
     } else {
       indent(out) <<
         "<xsd:complexType>" << endl;
-      indent_up();    
+      indent_up();
       if (ttype->is_list()) {
         indent(out) << "<xsd:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">" << endl;
         indent_up();
@@ -176,7 +176,7 @@ void t_xsd_generator::generate_service(t_service* tservice) {
 
   string ns = program_->get_xsd_namespace();
   if (ns.size() > 0) {
-    ns = " targetNamespace=\"" + ns + "\" xmlns=\"" + ns + "\" " + 
+    ns = " targetNamespace=\"" + ns + "\" xmlns=\"" + ns + "\" " +
       "elementFormDefault=\"qualified\"";
   }
 
@@ -196,7 +196,7 @@ void t_xsd_generator::generate_service(t_service* tservice) {
 
   // List the elements that you might actually get
   vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::iterator f_iter; 
+  vector<t_function*>::iterator f_iter;
   for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
     string elemname = (*f_iter)->get_name() + "_response";
     t_type* returntype = (*f_iter)->get_returntype();
@@ -237,7 +237,7 @@ string t_xsd_generator::type_name(t_type* ttype) {
   if (ttype->is_struct() || ttype->is_xception()) {
     return ttype->get_name();
   }
-  
+
   return "container";
 }
 
index fec2acc..ee658f0 100644 (file)
@@ -75,7 +75,7 @@ class t_const_value {
 
   const std::map<t_const_value*, t_const_value*>& get_map() const {
     return mapVal_;
-  } 
+  }
 
   void set_list() {
     valType_ = CV_LIST;
index bfa66ef..6bdcc29 100644 (file)
@@ -21,15 +21,15 @@ class t_doc {
     doc_ = doc;
     has_doc_ = true;
   }
-  
+
   const std::string& get_doc() const {
     return doc_;
   }
-  
+
   bool has_doc() {
     return has_doc_;
   }
-  
+
  private:
   std::string doc_;
   bool has_doc_;
index aa332c7..c732656 100644 (file)
@@ -34,19 +34,19 @@ class t_enum_value : public t_doc {
   const std::string& get_name() {
     return name_;
   }
-  
+
   bool has_value() {
     return has_value_;
   }
-  
+
   int get_value() {
     return value_;
   }
-  
+
  private:
   std::string name_;
   bool has_value_;
   int value_;
-};  
+};
 
 #endif
index 23a006a..0ff83c5 100644 (file)
@@ -22,7 +22,7 @@ class t_list : public t_container {
   t_type* get_elem_type() const {
     return elem_type_;
   }
-  
+
   bool is_list() const {
     return true;
   }
index c97f2d6..e03956e 100644 (file)
@@ -59,7 +59,7 @@ class t_scope {
   }
 
  private:
-  
+
   // Map of names to types
   std::map<std::string, t_type*> types_;
 
@@ -67,8 +67,8 @@ class t_scope {
   std::map<std::string, t_const*> constants_;
 
   // Map of names to services
-  std::map<std::string, t_service*> services_; 
+  std::map<std::string, t_service*> services_;
+
 };
 
 #endif
index df64e9a..38a4aa1 100644 (file)
@@ -1,22 +1,22 @@
-// Distributed under the Thrift Software License\r
-//\r
-// See accompanying file LICENSE or visit the Thrift site at:\r
-// http://developers.facebook.com/thrift/\r
-\r
-/**\r
- * define for mkdir,since the method signature \r
- * is different for the non-POSIX MinGW\r
- */\r
-\r
-#ifdef MINGW\r
-#include <io.h>\r
-#else\r
-#include <sys/types.h>\r
-#include <sys/stat.h>\r
-#endif\r
-\r
-#if defined MINGW\r
-#define MKDIR(x) mkdir(x)\r
-#else\r
-#define MKDIR(x) mkdir(x, S_IRWXU | S_IRWXG | S_IRWXO)\r
-#endif\r
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+/**
+ * define for mkdir,since the method signature
+ * is different for the non-POSIX MinGW
+ */
+
+#ifdef MINGW
+#include <io.h>
+#else
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
+#if defined MINGW
+#define MKDIR(x) mkdir(x)
+#else
+#define MKDIR(x) mkdir(x, S_IRWXU | S_IRWXG | S_IRWXO)
+#endif
index fc1e6ba..17766b5 100644 (file)
@@ -20,9 +20,9 @@
 
 \begin{document}
 
-% \conferenceinfo{WXYZ '05}{date, City.} 
+% \conferenceinfo{WXYZ '05}{date, City.}
 % \copyrightyear{2007}
-% \copyrightdata{[to be supplied]} 
+% \copyrightdata{[to be supplied]}
 
 % \titlebanner{banner above paper title}        % These are ignored unless
 % \preprintfooter{short description of paper}   % 'preprint' option specified.
@@ -62,7 +62,7 @@ and why.
 
 \section{Introduction}
 As Facebook's traffic and network structure have scaled, the resource
-demands of many operations on the site (i.e. search, 
+demands of many operations on the site (i.e. search,
 ad selection and delivery, event logging) have presented technical requirements
 drastically outside the scope of the LAMP framework. In our implementation of
 these services, various programming languages have been selected to
@@ -102,7 +102,7 @@ or write their own serialization code. That is,
 a C++ programmer should be able to transparently exchange a strongly typed
 STL map for a dynamic Python dictionary. Neither
 programmer should be forced to write any code below the application layer
-to achieve this. Section 2 details the Thrift type system. 
+to achieve this. Section 2 details the Thrift type system.
 
 \textit{Transport.} Each language must have a common interface to
 bidirectional raw data transport. The specifics of how a given
@@ -195,7 +195,7 @@ an STL \texttt{vector}, Java \texttt{ArrayList}, or native array in scripting la
 contain duplicates.
 \item \texttt{set<type>} An unordered set of unique elements. Translates into
 an STL \texttt{set}, Java \texttt{HashSet}, \texttt{set} in Python, or native
-dictionary in PHP/Ruby. 
+dictionary in PHP/Ruby.
 \item \texttt{map<type1,type2>} A map of strictly unique keys to values
 Translates into an STL \texttt{map}, Java \texttt{HashMap}, PHP associative
 array, or Python/Ruby dictionary.
@@ -254,7 +254,7 @@ An example:
 service StringCache {
   void set(1:i32 key, 2:string value),
   string get(1:i32 key) throws (1:KeyNotFound knf),
-  void delete(1:i32 key) 
+  void delete(1:i32 key)
 }
 \end{verbatim}
 
@@ -283,7 +283,7 @@ The transport layer is used by the generated code to facilitate data transfer.
 A key design choice in the implementation of Thrift was to decouple the
 transport layer from the code generation layer. Though Thrift is typically
 used on top of the TCP/IP stack with streaming sockets as the base layer of
-communication, there was no compelling reason to build that constraint into 
+communication, there was no compelling reason to build that constraint into
 the system. The performance tradeoff incurred by an abstracted I/O layer
 (roughly one virtual method lookup / function call per operation) was
 immaterial compared to the cost of actual I/O operations (typically invoking
@@ -509,7 +509,7 @@ allows for version-safe modification of method parameters
 service StringCache {
   void set(1:i32 key, 2:string value),
   string get(1:i32 key) throws (1:KeyNotFound knf),
-  void delete(1:i32 key) 
+  void delete(1:i32 key)
 }
 \end{verbatim}
 
@@ -540,7 +540,7 @@ class Example {
     number(10),
     bigNumber(0),
     decimals(0),
-    name("thrifty") {} 
+    name("thrifty") {}
 
   int32_t number;
   int64_t bigNumber;
@@ -560,7 +560,7 @@ class Example {
   } __isset;
 ...
 }
-\end{verbatim} 
+\end{verbatim}
 
 \subsection{Case Analysis}
 
@@ -778,16 +778,16 @@ Thrift services require basic multithreading to handle simultaneous
 requests from multiple clients. For the Python and Java implementations of
 Thrift server logic, the standard threading libraries distributed with the
 languages provide adequate support. For the C++ implementation, no standard multithread runtime
-library exists. Specifically, robust, lightweight, and portable 
+library exists. Specifically, robust, lightweight, and portable
 thread manager and timer class implementations do not exist. We investigated
-existing implementations, namely \texttt{boost::thread}, 
+existing implementations, namely \texttt{boost::thread},
 \texttt{boost::threadpool}, \texttt{ACE\_Thread\_Manager} and
-\texttt{ACE\_Timer}.  
+\texttt{ACE\_Timer}.
 
 While \texttt{boost::threads}\cite{boost.threads}  provides clean,
 lightweight and robust implementations of multi-thread primitives (mutexes,
 conditions, threads) it does not provide a thread manager or timer
-implementation.  
+implementation.
 
 \texttt{boost::threadpool}\cite{boost.threadpool} also looked promising but
 was not far enough along for our purposes. We wanted to limit the dependency on
@@ -801,7 +801,7 @@ added to the Boost distribution we may reconsider our decision to not use it.
 ACE has both a thread manager and timer class in addition to multi-thread
 primitives. The biggest problem with ACE is that it is ACE. Unlike Boost, ACE
 API quality is poor. Everything in ACE has large numbers of dependencies on
-everything else in ACE - thus forcing developers to throw out standard 
+everything else in ACE - thus forcing developers to throw out standard
 classes, such as STL collections, in favor of ACE's homebrewed implementations. In
 addition, unlike Boost, ACE implementations demonstrate little understanding
 of the power and pitfalls of C++ programming and take no advantage of modern
@@ -820,17 +820,17 @@ The Thrift thread libraries are implemented in the namespace\\
 \end{itemize}
 
 As mentioned above, we were hesitant to introduce any additional dependencies
-on Thrift. We decided to use \texttt{boost::shared\_ptr} because it is so 
+on Thrift. We decided to use \texttt{boost::shared\_ptr} because it is so
 useful for multithreaded application, it requires no link-time or
 runtime libraries (i.e. it is a pure template library) and it is due
 to become part of the C++0x standard.
 
 We implement standard \texttt{Mutex} and \texttt{Condition} classes, and a
- \texttt{Monitor} class. The latter is simply a combination of a mutex and 
+ \texttt{Monitor} class. The latter is simply a combination of a mutex and
 condition variable and is analogous to the \texttt{Monitor} implementation provided for
-the Java \texttt{Object} class. This is also sometimes referred to as a barrier. We 
+the Java \texttt{Object} class. This is also sometimes referred to as a barrier. We
 provide a \texttt{Synchronized} guard class to allow Java-like synchronized blocks.
-This is just a bit of syntactic sugar, but, like its Java counterpart, clearly 
+This is just a bit of syntactic sugar, but, like its Java counterpart, clearly
 delimits critical sections of code. Unlike its Java counterpart, we still
 have the ability to programmatically lock, unlock, block, and signal monitors.
 
@@ -847,11 +847,11 @@ void run() {
 
 We again borrowed from Java the distinction between a thread and a runnable
 class. A \texttt{Thread} is the actual schedulable object. The
-\texttt{Runnable} is the logic to execute within the thread. 
-The \texttt{Thread} implementation deals with all the platform-specific thread 
+\texttt{Runnable} is the logic to execute within the thread.
+The \texttt{Thread} implementation deals with all the platform-specific thread
 creation and destruction issues, while the \texttt{Runnable} implementation deals
 with the application-specific per-thread logic. The benefit of this approach
-is that developers can easily subclass the Runnable class without pulling in 
+is that developers can easily subclass the Runnable class without pulling in
 platform-specific super-classes.
 
 \subsection{Thread, Runnable, and shared\_ptr}
@@ -875,7 +875,7 @@ itself in its \texttt{start} method.
 With the weak reference in hand the \texttt{ThreadMain} function can attempt to get
 a strong reference before entering the \texttt{Runnable::run} method of the
 \texttt{Runnable} object bound to the \texttt{Thread}. If no strong references to the
-thread are obtained between exiting \texttt{Thread::start} and entering \texttt{ThreadMain}, the weak reference returns \texttt{null} and the function 
+thread are obtained between exiting \texttt{Thread::start} and entering \texttt{ThreadMain}, the weak reference returns \texttt{null} and the function
 exits immediately.
 
 The need for the \texttt{Thread} to make a weak reference to itself has a
@@ -894,7 +894,7 @@ object may need to know about the thread in which it is executing, and a Thread,
 needs to know what \texttt{Runnable} object it is hosting. This interdependency is
 further complicated because the lifecycle of each object is independent of the
 other. An application may create a set of \texttt{Runnable} object to be reused in different threads, or it may create and forget a \texttt{Runnable} object
-once a thread has been created and started for it. 
+once a thread has been created and started for it.
 
 The \texttt{Thread} class takes a \texttt{boost::shared\_ptr} reference to the hosted
 \texttt{Runnable} object in its constructor, while the \texttt{Runnable} class has an
@@ -903,30 +903,30 @@ explicit \texttt{thread} method to allow explicit binding of the hosted thread.
 
 \subsection{ThreadManager}
 
-\texttt{ThreadManager} creates a pool of worker threads and 
+\texttt{ThreadManager} creates a pool of worker threads and
 allows applications to schedule tasks for execution as free worker threads
-become available. The \texttt{ThreadManager} does not implement dynamic 
+become available. The \texttt{ThreadManager} does not implement dynamic
 thread pool resizing, but provides primitives so that applications can add
-and remove threads based on load. This approach was chosen because 
-implementing load metrics and thread pool size is very application 
+and remove threads based on load. This approach was chosen because
+implementing load metrics and thread pool size is very application
 specific. For example some applications may want to adjust pool size based
 on running-average of work arrival rates that are measured via polled
 samples. Others may simply wish to react immediately to work-queue
 depth high and low water marks. Rather than trying to create a complex
-API abstract enough to capture these different approaches, we 
-simply leave it up to the particular application and provide the 
+API abstract enough to capture these different approaches, we
+simply leave it up to the particular application and provide the
 primitives to enact the desired policy and sample current status.
 
 \subsection{TimerManager}
 
 \texttt{TimerManager} allows applications to schedule
- \texttt{Runnable} objects for execution at some point in the future. Its specific task 
+ \texttt{Runnable} objects for execution at some point in the future. Its specific task
 is to allows applications to sample \texttt{ThreadManager} load at regular
 intervals and make changes to the thread pool size based on application policy.
 Of course, it can be used to generate any number of timer or alarm events.
 
 The default implementation of \texttt{TimerManager} uses a single thread to
-execute expired \texttt{Runnable} objects. Thus, if a timer operation needs to 
+execute expired \texttt{Runnable} objects. Thus, if a timer operation needs to
 do a large amount of work and especially if it needs to do blocking I/O,
 that should be done in a separate thread.
 
@@ -962,18 +962,18 @@ each contain an instance of the other. (Since we do not allow \texttt{null}
 struct instances in the generated C++ code, this would actually be impossible.)
 
 \subsection{TFileTransport}
-The \texttt{TFileTransport} logs Thrift requests/structs by 
-framing incoming data with its length and writing it out to disk. 
-Using a framed on-disk format allows for better error checking and 
+The \texttt{TFileTransport} logs Thrift requests/structs by
+framing incoming data with its length and writing it out to disk.
+Using a framed on-disk format allows for better error checking and
 helps with the processing of a finite number of discrete events. The\\
-\texttt{TFileWriterTransport} uses a system of swapping in-memory buffers 
-to ensure good performance while logging large amounts of data. 
+\texttt{TFileWriterTransport} uses a system of swapping in-memory buffers
+to ensure good performance while logging large amounts of data.
 A Thrift log file is split up into chunks of a specified size; logged messages
-are not allowed to cross chunk boundaries. A message that would cross a chunk 
-boundary will cause padding to be added until the end of the chunk and the 
+are not allowed to cross chunk boundaries. A message that would cross a chunk
+boundary will cause padding to be added until the end of the chunk and the
 first byte of the message are aligned to the beginning of the next chunk.
-Partitioning the file into chunks makes it possible to read and interpret data 
-from a particular point in the file. 
+Partitioning the file into chunks makes it possible to read and interpret data
+from a particular point in the file.
 
 \section{Facebook Thrift Services}
 Thrift has been employed in a large number of applications at Facebook, including
@@ -984,15 +984,15 @@ Thrift is used as the underlying protocol and transport layer for the Facebook S
 The multi-language code generation is well suited for search because it allows for application
 development in an efficient server side language (C++) and allows the Facebook PHP-based web application
 to make calls to the search service using Thrift PHP libraries. There is also a large
-variety of search stats, deployment and testing functionality that is built on top 
+variety of search stats, deployment and testing functionality that is built on top
 of generated Python code. Additionally, the Thrift log file format is
-used as a redo log for providing real-time search index updates. Thrift has allowed the 
-search team to leverage each language for its strengths and to develop code at a rapid pace. 
+used as a redo log for providing real-time search index updates. Thrift has allowed the
+search team to leverage each language for its strengths and to develop code at a rapid pace.
 
 \subsection{Logging}
 The Thrift \texttt{TFileTransport} functionality is used for structured logging. Each
 service function definition along with its parameters can be considered to be
-a structured log entry identified by the function name. This log can then be used for 
+a structured log entry identified by the function name. This log can then be used for
 a variety of purposes, including inline and offline processing, stats aggregation and as a redo log.
 
 \section{Conclusions}
index bace360..9187087 100644 (file)
     [protocol readFieldBeginReturningName: NULL
               type: &fieldType
               fieldID: &fieldID];
-    if (fieldType == TType_STOP) { 
+    if (fieldType == TType_STOP) {
       break;
     }
     switch (fieldID) {
     case 1:
       if (fieldType == TType_STRING) {
         reason = [protocol readString];
-      } else { 
+      } else {
         [TProtocolUtil skipType: fieldType onProtocol: protocol];
       }
       break;
     case 2:
       if (fieldType == TType_I32) {
         type = [protocol readI32];
-      } else { 
+      } else {
         [TProtocolUtil skipType: fieldType onProtocol: protocol];
       }
       break;
index 33ed7b5..48d9090 100644 (file)
@@ -37,7 +37,7 @@
   if ([self userInfo] != nil) {
     [result appendFormat: @"\n  userInfo = %@", [self userInfo]];
   }
-  
+
   return result;
 }
 
index 7e288fa..975af97 100644 (file)
@@ -12,7 +12,7 @@
 
 - (id) initWithTransport: (id <TTransport>) transport;
 
-- (id) initWithTransport: (id <TTransport>) transport 
+- (id) initWithTransport: (id <TTransport>) transport
               strictRead: (BOOL) strictRead
              strictWrite: (BOOL) strictWrite;
 
@@ -29,4 +29,4 @@
 
 - (TBinaryProtocol *) newProtocolOnTransport: (id <TTransport>) transport;
 
-@end
\ No newline at end of file
+@end
index 7564f5d..e196138 100644 (file)
@@ -7,13 +7,13 @@ int32_t VERSION_MASK = 0xffff0000;
 
 static TBinaryProtocolFactory * gSharedFactory = nil;
 
-@implementation TBinaryProtocolFactory 
+@implementation TBinaryProtocolFactory
 
 + (TBinaryProtocolFactory *) sharedFactory {
   if (gSharedFactory == nil) {
     gSharedFactory = [[TBinaryProtocolFactory alloc] init];
   }
-  
+
   return gSharedFactory;
 }
 
@@ -32,7 +32,7 @@ static TBinaryProtocolFactory * gSharedFactory = nil;
   return [self initWithTransport: transport strictRead: NO strictWrite: NO];
 }
 
-- (id) initWithTransport: (id <TTransport>) transport 
+- (id) initWithTransport: (id <TTransport>) transport
               strictRead: (BOOL) strictRead
              strictWrite: (BOOL) strictWrite
 {
@@ -109,7 +109,7 @@ static TBinaryProtocolFactory * gSharedFactory = nil;
       @throw [TProtocolException exceptionWithName: @"TProtocolException"
                                             reason: [NSString stringWithFormat: @"Message too big.  Size limit is: %d Message size is: %d",
                                                      mMessageSizeLimit,
-                                                     size]];      
+                                                     size]];
     }
     NSString * messageName = [self readStringBody: size];
     if (name != NULL) {
@@ -151,7 +151,7 @@ static TBinaryProtocolFactory * gSharedFactory = nil;
   int ft = [self readByte];
   if (fieldType != NULL) {
     *fieldType = ft;
-  }    
+  }
   if (ft != TType_STOP) {
     int fid = [self readI16];
     if (fieldID != NULL) {
@@ -233,7 +233,7 @@ static TBinaryProtocolFactory * gSharedFactory = nil;
   int32_t size = [self readI32];
   uint8_t * buff = malloc(size);
   if (buff == NULL) {
-    @throw [TProtocolException 
+    @throw [TProtocolException
              exceptionWithName: @"TProtocolException"
              reason: [NSString stringWithFormat: @"Out of memory.  Unable to allocate %d bytes trying to read binary data.",
                                size]];
@@ -395,7 +395,7 @@ static TBinaryProtocolFactory * gSharedFactory = nil;
 }
 
 
-- (void) writeBinary: (NSData *) data 
+- (void) writeBinary: (NSData *) data
 {
   [self writeI32: [data length]];
   [mTransport write: [data bytes] offset: 0 length: [data length]];
index 4b8e8d0..2ab21c7 100644 (file)
@@ -7,7 +7,7 @@
   NSSocketPort * mServerSocket;
   NSFileHandle * mSocketFileHandle;
   id <TProtocolFactory> mInputProtocolFactory;
-  id <TProtocolFactory> mOutputProtocolFactory;  
+  id <TProtocolFactory> mOutputProtocolFactory;
   id <TProcessor> mProcessor;
 }
 
index d9d24e1..1108428 100644 (file)
   mInputProtocolFactory = [protocolFactory retain];
   mOutputProtocolFactory = [protocolFactory retain];
   mProcessor = [processor retain];
-  
+
   // create a socket
   mServerSocket = [[NSSocketPort alloc] initWithTCPPort: port];
   // FIXME - move this separate start method and add method to close
   // and cleanup any open ports
-  
+
   if (mServerSocket == nil) {
     NSLog(@"Unable to listen on TCP port %d", port);
   } else {
     // wrap it in a file handle so we can get messages from it
     mSocketFileHandle = [[NSFileHandle alloc] initWithFileDescriptor: [mServerSocket socket]
                                                       closeOnDealloc: YES];
-    
+
     // register for notifications of accepted incoming connections
-    [[NSNotificationCenter defaultCenter] addObserver: self 
-                                             selector: @selector(connectionAccepted:) 
+    [[NSNotificationCenter defaultCenter] addObserver: self
+                                             selector: @selector(connectionAccepted:)
                                                  name: NSFileHandleConnectionAcceptedNotification
                                                object: mSocketFileHandle];
-    
+
     // tell socket to listen
     [mSocketFileHandle acceptConnectionInBackgroundAndNotify];
   }
-  
+
   return self;
 }
 
 - (void) connectionAccepted: (NSNotification *) aNotification
 {
   NSFileHandle * socket = [[aNotification userInfo] objectForKey: NSFileHandleNotificationFileHandleItem];
-  
+
   // now that we have a client connected, spin off a thread to handle activity
   [NSThread detachNewThreadSelector: @selector(handleClientConnection:)
                            toTarget: self
                          withObject: socket];
-  
+
   [[aNotification object] acceptConnectionInBackgroundAndNotify];
 }
 
 
   id <TProtocol> inProtocol = [mInputProtocolFactory newProtocolOnTransport: transport];
   id <TProtocol> outProtocol = [mOutputProtocolFactory newProtocolOnTransport: transport];
-  
+
   @try {
     while ([mProcessor processOnInputProtocol: inProtocol outputProtocol: outProtocol]);
   }
   @catch (TTransportException * te) {
     NSLog(@"%@", te);
   }
-  
+
   [pool release];
 }
 
index d9ea1a9..0aabb46 100644 (file)
@@ -13,7 +13,7 @@
 
 - (id) initWithURL: (NSURL *) aURL;
 
-- (id) initWithURL: (NSURL *) aURL 
+- (id) initWithURL: (NSURL *) aURL
          userAgent: (NSString *) userAgent
            timeout: (int) timeout;
 
index f5186e2..4bad09c 100644 (file)
@@ -9,7 +9,7 @@
   if (mRequest != nil) {
     [mRequest release];
   }
-  
+
   // set up our request object that we'll use for each request
   mRequest = [[NSMutableURLRequest alloc] initWithURL: mURL];
   [mRequest setHTTPMethod: @"POST"];
@@ -37,7 +37,7 @@
 }
 
 
-- (id) initWithURL: (NSURL *) aURL 
+- (id) initWithURL: (NSURL *) aURL
          userAgent: (NSString *) userAgent
            timeout: (int) timeout
 {
@@ -45,7 +45,7 @@
   if (!self) {
     return nil;
   }
-  
+
   mTimeout = timeout;
   if (userAgent) {
     mUserAgent = [userAgent retain];
@@ -56,7 +56,7 @@
 
   // create our request data buffer
   mRequestData = [[NSMutableData alloc] initWithCapacity: 1024];
-    
+
   return self;
 }
 
@@ -66,7 +66,7 @@
   [aURL retain];
   [mURL release];
   mURL = aURL;
-  
+
   [self setupRequest];
 }
 
   // make the HTTP request
   NSURLResponse * response;
   NSError * error;
-  NSData * responseData = 
+  NSData * responseData =
     [NSURLConnection sendSynchronousRequest: mRequest returningResponse: &response error: &error];
 
   [mRequestData setLength: 0];
   NSHTTPURLResponse * httpResponse = (NSHTTPURLResponse *) response;
   if ([httpResponse statusCode] != 200) {
     @throw [TTransportException exceptionWithName: @"TTransportException"
-                                           reason: [NSString stringWithFormat: @"Bad response from HTTP server: %d", 
+                                           reason: [NSString stringWithFormat: @"Bad response from HTTP server: %d",
                                                     [httpResponse statusCode]]];
   }
-                                
+
   // phew!
   [mResponseData release];
   mResponseData = [responseData retain];
index 79a9e8d..c97b6c9 100644 (file)
               outputFileHandle: (NSFileHandle *) outputFileHandle
 {
   self = [super init];
-  
+
   mInputFileHandle = [inputFileHandle retain];
   mOutputFileHandle = [outputFileHandle retain];
-  
+
   return self;
 }
 
 
 - (void) write: (uint8_t *) data offset: (unsigned int) offset length: (unsigned int) length
 {
-  NSData * dataObject = [[NSData alloc] initWithBytesNoCopy: data+offset 
+  NSData * dataObject = [[NSData alloc] initWithBytesNoCopy: data+offset
                                                      length: length
                                                freeWhenDone: NO];
+
   [mOutputFileHandle writeData: dataObject];
 
-  
+
   [dataObject release];
 }
-  
+
 
 - (void) flush
 {
index 42a197e..92da5b3 100644 (file)
@@ -51,7 +51,7 @@
   } else if (result != length) {
     @throw [TTransportException exceptionWithReason: @"Output stream did not write all of our data."];
   }
-} 
+}
 
 - (void) flush
 {
index e8ae6e9..e3da164 100644 (file)
@@ -8,16 +8,16 @@
 {
   NSInputStream * input = nil;
   NSOutputStream * output = nil;
-  
+
   [NSStream getStreamsToHost: [NSHost hostWithName: hostname]
             port: port
-            inputStream: &input 
+            inputStream: &input
             outputStream: &output];
 
   self = [super initWithInputStream: input outputStream: output];
   [input open];
   [output open];
-  
+
   return self;
 }
 
index 92ccf99..9da970d 100644 (file)
@@ -63,7 +63,7 @@ include_thriftdir = $(includedir)/thrift
 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_CXXFLAGS =  $(common_cxxflags)
 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
index 4d3060d..6fb7484 100644 (file)
 
 /**
  * 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
   }
 
 
-/** 
+/**
  * Analagous to T_ERROR, additionally aborting the process.
  * WARNING: macro calls abort(), ending program execution
  *
   }
 
 
-/** 
+/**
  * Log input message
  *
  * @param string  format_string input: printf style format string
         dbgtime[24] = '\0';                                                   \
         fprintf(stderr,"[%s] " #format_string " \n", dbgtime,##__VA_ARGS__);  \
       }                                                                       \
-    } 
+    }
 #else
   #define T_LOG_OPER(format_string,...)
 #endif
index affbe81..cba4a84 100644 (file)
@@ -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
index 186c5af..88890d4 100644 (file)
@@ -21,7 +21,7 @@ uint32_t TApplicationException::read(facebook::thrift::protocol::TProtocol* ipro
 
   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) {
index 338dbde..8e93bb0 100644 (file)
@@ -99,7 +99,7 @@ class TApplicationException : public TException {
     type_(UNKNOWN) {}
 
   TApplicationException(TApplicationExceptionType type) :
-    TException(), 
+    TException(),
     type_(type) {}
 
   TApplicationException(const std::string& message) :
index 575a3ed..00e2649 100644 (file)
@@ -21,16 +21,16 @@ class InvalidArgumentException : public facebook::thrift::TException {};
 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) {}
 };
 
index a055656..87bfd35 100644 (file)
@@ -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 @@ bool Mutex::trylock() const { return impl_->trylock(); }
 
 void Mutex::unlock() const { impl_->unlock(); }
 
-/** 
+/**
  * Implementation of ReadWriteMutex class using POSIX rw lock
  *
  * @author boz
@@ -86,7 +86,7 @@ public:
 
   void release() const { pthread_rwlock_unlock(&rw_lock_); }
 
-private: 
+private:
   mutable pthread_rwlock_t rw_lock_;
   mutable bool initialized_;
 };
index f3c7cd0..e176628 100644 (file)
@@ -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 @@ public:
 
   // this releases both read and write locks
   virtual void release() const;
-   
+
 private:
 
   class impl;
@@ -54,7 +54,7 @@ private:
 };
 
 class Guard {
- public: 
+ public:
   Guard(const Mutex& value) : mutex_(value) {
     mutex_.lock();
   }
@@ -67,20 +67,20 @@ class Guard {
 };
 
 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);"
index 4f77b2f..e3b7a89 100644 (file)
@@ -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 @@ class TimerManager::Task : public Runnable {
   Task(shared_ptr<Runnable> runnable) :
     runnable_(runnable),
     state_(WAITING) {}
-  
+
   ~Task() {
   }
-  
+
   void run() {
     if (state_ == EXECUTING) {
       runnable_->run();
@@ -59,11 +59,11 @@ class TimerManager::Task : public Runnable {
 class TimerManager::Dispatcher: public Runnable {
 
  public:
-  Dispatcher(TimerManager* manager) : 
+  Dispatcher(TimerManager* manager) :
     manager_(manager) {}
-  
+
   ~Dispatcher() {}
-  
+
   /**
    * Dispatcher entry point
    *
@@ -85,7 +85,7 @@ class TimerManager::Dispatcher: public Runnable {
         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 @@ class TimerManager::Dispatcher: public Runnable {
           } 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 @@ class TimerManager::Dispatcher: public Runnable {
           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 @@ TimerManager::~TimerManager() {
 
   // 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 @@ void TimerManager::stop() {
       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::add(shared_ptr<Runnable> task, const struct timespec& value)
 
 
 void TimerManager::remove(shared_ptr<Runnable> task) {
-  Synchronized s(monitor_); 
+  Synchronized s(monitor_);
   if (state_ != TimerManager::STARTED) {
     throw IllegalStateException();
   }
index 86900ce..6d2eae9 100644 (file)
 #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 @@ class TimerManager {
   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 @@ class TimerManager {
 
   /**
    * 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 @@ class TimerManager {
 
   /**
    * 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 @@ class TimerManager {
     STOPPING,
     STOPPED
   };
-  
+
   virtual const STATE state() const;
 
  private:
index 8a1ead3..3ebc0b1 100644 (file)
@@ -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 @@ namespace facebook { namespace thrift { namespace concurrency {
  * 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 @@ class Util {
    * @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
   }
 
index bd959cd..13e3ef8 100644 (file)
@@ -17,7 +17,7 @@ namespace facebook { namespace thrift { namespace concurrency { namespace test {
 using namespace facebook::thrift::concurrency;
 
 /**
- * ThreadManagerTests class 
+ * ThreadManagerTests class
  *
  * @author marc
  * @version $Id:$
@@ -30,8 +30,8 @@ class TimerManagerTests {
 
   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 @@ class TimerManagerTests {
       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 @@ class TimerManagerTests {
     {
 
       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 @@ class TimerManagerTests {
 };
 
 const double TimerManagerTests::ERROR = .20;
-  
+
 }}}} // facebook::thrift::concurrency
 
index cff5edd..d864805 100644 (file)
@@ -4,7 +4,7 @@ using namespace facebook::thrift::transport;
 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 @@ void PeekProcessor::setTargetTransport(boost::shared_ptr<TTransport> targetTrans
   }
 }
 
-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 @@ bool PeekProcessor::process(boost::shared_ptr<TProtocol> in,
   uint32_t size;
   memoryBuffer_->getBuffer(&buffer, &size);
   peekBuffer(buffer, size);
-  
+
   // Done peeking at variables
   peekEnd();
 
@@ -92,7 +92,7 @@ void PeekProcessor::peekName(const std::string& fname) {
 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);
index 6b8414b..49e7cd9 100644 (file)
@@ -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 @@ namespace facebook { namespace thrift { namespace processor {
  * @author James Wang <jwang@facebook.com>
  */
 class PeekProcessor : public facebook::thrift::TProcessor {
-  
+
  public:
   PeekProcessor();
   virtual ~PeekProcessor();
@@ -39,14 +39,14 @@ class PeekProcessor : public facebook::thrift::TProcessor {
 
   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();
index b1a4e63..140a1d4 100644 (file)
@@ -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 @@ namespace facebook { namespace thrift { namespace processor {
  */
 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 @@ protected:
         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 @@ protected:
           }
         }
         break;
-      case facebook::thrift::protocol::T_STRUCT: 
+      case facebook::thrift::protocol::T_STRUCT:
         {
           std::string name;
           int16_t fid;
index 30bbde6..289d614 100644 (file)
@@ -25,7 +25,7 @@ static inline To bitwise_cast(From from) {
   //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 @@ static inline To bitwise_cast(From from) {
 }
 
 
-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::writeFieldEnd() {
 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 @@ uint32_t TBinaryProtocol::writeI64(const int64_t i64) {
   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 @@ uint32_t TBinaryProtocol::writeDouble(const double dub) {
   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 @@ uint32_t TBinaryProtocol::readFieldBegin(string& name,
   result += readI16(fieldId);
   return result;
 }
-  
+
 uint32_t TBinaryProtocol::readFieldEnd() {
   return 0;
 }
+
 uint32_t TBinaryProtocol::readMapBegin(TType& keyType,
                                        TType& valType,
                                        uint32_t& size) {
index 89958ec..c7e2791 100644 (file)
@@ -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 @@ class TBinaryProtocol : public TProtocol {
   uint32_t writeFieldEnd();
 
   uint32_t writeFieldStop();
-                                       
+
   uint32_t writeMapBegin(const TType keyType,
                          const TType valType,
                          const uint32_t size);
@@ -140,9 +140,9 @@ class TBinaryProtocol : public TProtocol {
   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 @@ class TBinaryProtocol : public TProtocol {
 
   uint32_t readListBegin(TType& elemType,
                          uint32_t& size);
-  
+
   uint32_t readListEnd();
 
   uint32_t readSetBegin(TType& elemType,
index 5d28b78..2f23b11 100644 (file)
@@ -25,7 +25,7 @@ static string byte_to_hex(const uint8_t byte) {
 }
 
 
-namespace facebook { namespace thrift { namespace protocol { 
+namespace facebook { namespace thrift { namespace protocol {
 
 string TDebugProtocol::fieldTypeName(TType type) {
   switch (type) {
@@ -171,7 +171,7 @@ uint32_t TDebugProtocol::writeFieldBegin(const string& name,
 
   return writeIndented(
       id_str + ": " +
-      name + " (" + 
+      name + " (" +
       fieldTypeName(fieldType) + ") = ");
 }
 
@@ -183,8 +183,8 @@ uint32_t TDebugProtocol::writeFieldEnd() {
 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::writeI32(const int32_t i32) {
 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?
 
index 0dd60d8..90b7688 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <transport/TTransportUtils.h>
 
-namespace facebook { namespace thrift { namespace protocol { 
+namespace facebook { namespace thrift { namespace protocol {
 
 /*
 
@@ -73,7 +73,7 @@ class TDebugProtocol : public TWriteOnlyProtocol {
   uint32_t writeFieldEnd();
 
   uint32_t writeFieldStop();
-                                       
+
   uint32_t writeMapBegin(const TType keyType,
                          const TType valType,
                          const uint32_t size);
@@ -140,7 +140,7 @@ class TDebugProtocolFactory : public TProtocolFactory {
 }}} // facebook::thrift::protocol
 
 
-namespace facebook { namespace thrift { 
+namespace facebook { namespace thrift {
 
 template<typename ThriftStruct>
 std::string ThriftDebugString(const ThriftStruct& ts) {
index 0902e15..dae2c18 100644 (file)
@@ -20,7 +20,7 @@ namespace facebook { namespace thrift { namespace protocol {
  * 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.
  *
index 635744c..245f830 100644 (file)
@@ -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 @@ class TWriteOnlyProtocol : public TProtocol {
     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 @@ class TWriteOnlyProtocol : public TProtocol {
     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).");
index 7fa3de8..85cc48a 100644 (file)
@@ -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 @@ class TProtocol {
 
 
   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 @@ class TProtocol {
   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 @@ class TProtocol {
   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 @@ class TProtocol {
   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 @@ class TProtocol {
     ptrans_(ptrans) {
     trans_ = ptrans.get();
   }
-    
+
   boost::shared_ptr<TTransport> ptrans_;
   TTransport* trans_;
 
index 4429a62..0532ec5 100644 (file)
@@ -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 @@ class TProtocolException : public facebook::thrift::TException {
     type_(UNKNOWN) {}
 
   TProtocolException(TProtocolExceptionType type) :
-    facebook::thrift::TException(), 
+    facebook::thrift::TException(),
     type_(type) {}
 
   TProtocolException(const std::string& message) :
@@ -81,11 +81,11 @@ class TProtocolException : public facebook::thrift::TException {
   }
 
  protected:
-  /** 
+  /**
    * Error code
    */
   TProtocolExceptionType type_;
+
 };
 
 }}} // facebook::thrift::protocol
index f249ff9..c4c921e 100644 (file)
@@ -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 @@ typedef struct readState {
 
   // last successful dispatch point
   int32_t lastDispatchPtr_;
-  
+
   void resetState(uint32_t lastDispatchPtr) {
     readingSize_ = true;
     eventSizeBuffPos_ = 0;
@@ -79,7 +79,7 @@ typedef struct readState {
   }
 
 } 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 @@ typedef struct readState {
  *  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 @@ class TFileTransportBuffer {
     void reset();
     bool isFull();
     bool isEmpty();
-    
+
   private:
     TFileTransportBuffer(); // should not be used
 
@@ -145,7 +145,7 @@ class TFileWriterTransport : virtual public TTransport {
 };
 
 /**
- * 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 @@ class TFileTransport : public TFileReaderTransport,
   bool isOpen() {
     return true;
   }
-  
+
   void write(const uint8_t* buf, uint32_t len);
   void flush();
 
@@ -205,7 +205,7 @@ class TFileTransport : public TFileReaderTransport,
     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 @@ class TFileTransport : public TFileReaderTransport,
   // 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 @@ class TFileTransport : public TFileReaderTransport,
   // 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 @@ class TEOFException : public TTransportException {
 // 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 @@ class TFileProcessor {
                  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 @@ class TFileProcessor {
    *
    */
   void processChunk();
-  
+
  private:
   boost::shared_ptr<TProcessor> processor_;
   boost::shared_ptr<TProtocolFactory> inputProtocolFactory_;
@@ -423,7 +423,7 @@ class TFileProcessor {
   boost::shared_ptr<TTransport> outputTransport_;
 };
 
+
 }}} // facebook::thrift::transport
 
 #endif // _THRIFT_TRANSPORT_TFILETRANSPORT_H_
index b6d9d9e..c213ef0 100644 (file)
@@ -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 @@ uint32_t THttpClient::readContent(uint32_t size) {
       httpPos_ = 0;
       httpBufLen_ = 0;
       refill();
-      
+
       // Now have available however much we read
       avail = httpBufLen_;
     }
@@ -162,7 +162,7 @@ uint32_t THttpClient::readContent(uint32_t size) {
   }
   return size;
 }
-  
+
 char* THttpClient::readLine() {
   while (true) {
     char* eol = NULL;
@@ -207,12 +207,12 @@ void THttpClient::refill() {
       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 @@ void THttpClient::readHeaders() {
         parseHeader(line);
       }
     }
-  }  
+  }
 }
 
 bool THttpClient::parseStatusLine(char* status) {
@@ -259,7 +259,7 @@ bool THttpClient::parseStatusLine(char* status) {
   if (code == NULL) {
     throw TTransportException(string("Bad Status: ") + status);
   }
-  
+
   *code = '\0';
   while (*(code++) == ' ');
 
index acfcf1b..1ae3575 100644 (file)
@@ -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 @@ class THttpClient : public TTransport {
   bool isOpen() {
     return transport_->isOpen();
   }
-  
-  bool peek() {    
+
+  bool peek() {
     return transport_->peek();
   }
 
@@ -49,7 +49,7 @@ class THttpClient : public TTransport {
   void readEnd();
 
   void write(const uint8_t* buf, uint32_t len);
-  
+
   void flush();
 
  private:
index 8d76fef..213d9d4 100644 (file)
@@ -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;
 
index 9512372..b8e6b97 100644 (file)
@@ -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
index b6440fc..235d060 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "TSocketPool.h"
 
-namespace facebook { namespace thrift { namespace transport { 
+namespace facebook { namespace thrift { namespace transport {
 
 using namespace std;
 
index a197c72..847f67e 100644 (file)
@@ -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.
index 4e3c218..469acd2 100644 (file)
@@ -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 @@ class TTransport {
   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 @@ class TTransport {
       }
       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 @@ class TTransport {
   }
 
   /**
-   * 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.
    *
index 85b77b8..e632265 100644 (file)
@@ -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
index 39c65dd..73bad80 100644 (file)
@@ -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 @@ class TTransportException : public facebook::thrift::TException {
     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 @@ class TTransportException : public facebook::thrift::TException {
       return message_.c_str();
     }
   }
+
  protected:
   /** Just like strerror_r but returns a C++ string object. */
   std::string strerror_s(int errno_copy);
index 556d5fa..e1f37b8 100644 (file)
@@ -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 @@ uint32_t TBufferedTransport::read(uint8_t* buf, uint32_t len) {
       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 @@ uint32_t TFramedTransport::read(uint8_t* buf, uint32_t len) {
     // Read another chunk
     readFrame();
   }
-  
+
   // Hand over whatever we have
   uint32_t give = need;
   if (rLen_-rPos_ < give) {
@@ -196,7 +196,7 @@ void TFramedTransport::write(const uint8_t* buf, uint32_t len) {
 
     // 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 @@ void TFramedTransport::flush()  {
   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 @@ uint32_t TMemoryBuffer::read(uint8_t* buf, uint32_t len) {
   // Copy into buffer and increment rPos_
   memcpy(buf, buffer_ + rPos_, give);
   rPos_ += give;
-  
+
   return give;
 }
 
@@ -293,7 +293,7 @@ uint32_t TMemoryBuffer::readAppendToString(std::string& str, uint32_t len) {
   str.reserve(str.length()+give);
   str.append((char*)buffer_ + rPos_, give);
   rPos_ += give;
-  
+
   return give;
 }
 
@@ -340,7 +340,7 @@ void TMemoryBuffer::consume(uint32_t len) {
 
 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 @@ uint32_t TPipedTransport::read(uint8_t* buf, uint32_t len) {
       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 @@ void TPipedTransport::flush()  {
   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::read(uint8_t* buf, uint32_t len) {
 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 @@ uint32_t TPipedFileReaderTransport::readAll(uint8_t* buf, uint32_t len) {
     }
     have += get;
   }
-  
+
   return have;
 }
 
index 27aa350..c9acc24 100644 (file)
@@ -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() {
index dd8ae2f..c2c1849 100644 (file)
@@ -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 @@ class TZlibTransport : public TTransport {
   ~TZlibTransport();
 
   bool isOpen();
-  
+
   void open() {
     transport_->open();
   }
@@ -145,7 +145,7 @@ class TZlibTransport : public TTransport {
   }
 
   uint32_t read(uint8_t* buf, uint32_t len);
-  
+
   void write(const uint8_t* buf, uint32_t len);
 
   void flush();
index 4375a52..e91a156 100644 (file)
@@ -2,7 +2,7 @@ using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
-// General Information about an assembly is controlled through the following 
+// General Information about an assembly is controlled through the following
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
 [assembly: AssemblyTitle("ThriftMSBuildTask")]
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
-// Setting ComVisible to false makes the types in this assembly not visible 
-// to COM components.  If you need to access a type in this assembly from 
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
 // COM, set the ComVisible attribute to true on that type.
 [assembly: ComVisible(false)]
 
@@ -25,11 +25,11 @@ using System.Runtime.InteropServices;
 // Version information for an assembly consists of the following four values:
 //
 //      Major Version
-//      Minor Version 
+//      Minor Version
 //      Build Number
 //      Revision
 //
-// You can specify all the values or you can default the Build and Revision Numbers 
+// You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0.0")]
index 68c6bd1..02110ea 100644 (file)
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
   </Target>
   <Target Name="AfterBuild">
   </Target>
   -->
-</Project>
\ No newline at end of file
+</Project>
index c2eb81f..5df2021 100644 (file)
@@ -2,7 +2,7 @@
 //  TBinaryProtocol.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //             Will Palmeri <will@imeem.com>
 //
index 9329530..c294253 100644 (file)
@@ -2,7 +2,7 @@
 //  TField.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index 72056cb..eb307ce 100644 (file)
@@ -2,7 +2,7 @@
 //  TList.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index 586aa4f..53c7833 100644 (file)
@@ -2,7 +2,7 @@
 //  TMap.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index a9522ff..92176f3 100644 (file)
@@ -2,7 +2,7 @@
 //  TMessage.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index 1cadf31..6e6ead7 100644 (file)
@@ -2,7 +2,7 @@
 //  TMessageType.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index d4b0829..2702ad8 100644 (file)
@@ -2,7 +2,7 @@
 //  TProtocol.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index 5434da9..756bb5e 100644 (file)
@@ -2,7 +2,7 @@
 //  TProtocolFactory.cs
 //
 //  Begin:  Dec 3, 2007
-//  Authors: 
+//  Authors:
 //             Will Palmeri <wpalmeri@imeem.com>
 //
 //  Distributed under the Thrift Software License
index ae5a107..a65ea0f 100644 (file)
@@ -2,7 +2,7 @@
 //  TProtocolUtil.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index 1f172e4..0dea8cb 100644 (file)
@@ -2,7 +2,7 @@
 //  TSet.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index 000ebf1..3833695 100644 (file)
@@ -2,7 +2,7 @@
 //  TStruct.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index 0badb33..257ac6b 100644 (file)
@@ -2,7 +2,7 @@
 //  TType.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index 3e70b11..b168d99 100644 (file)
@@ -2,7 +2,7 @@
 //  TServer.cs
 //
 //  Begin:  Dec 3, 2007
-//  Authors: 
+//  Authors:
 //             Will Palmeri <wpalmeri@imeem.com>
 //
 //  Distributed under the Thrift Software License
index c3461ef..b2a70fe 100644 (file)
@@ -2,7 +2,7 @@
 //  TSimpleServer.cs
 //
 //  Begin:  Dec 3, 2007
-//  Authors: 
+//  Authors:
 //             Will Palmeri <wpalmeri@imeem.com>
 //
 //  Distributed under the Thrift Software License
index c42d348..b62de81 100644 (file)
@@ -2,7 +2,7 @@
 //  TThreadPoolServer.cs
 //
 //  Begin:  Dec 3, 2007
-//  Authors: 
+//  Authors:
 //             Will Palmeri <wpalmeri@imeem.com>
 //
 //  Distributed under the Thrift Software License
@@ -115,7 +115,7 @@ namespace Thrift.Server
                                outputTransport = outputTransportFactory.GetTransport(client);
                                inputProtocol = inputProtocolFactory.GetProtocol(inputTransport);
                                outputProtocol = outputProtocolFactory.GetProtocol(outputTransport);
-                               while (processor.Process(inputProtocol, outputProtocol)) 
+                               while (processor.Process(inputProtocol, outputProtocol))
                                {
                                        //keep processing requests until client disconnects
                                }
index e4f3acf..e9d200a 100644 (file)
@@ -2,7 +2,7 @@
 //  TApplicationException.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index 7567820..2cbddd7 100644 (file)
@@ -2,7 +2,7 @@
 //  TProcessor.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Distributed under the Thrift Software License
index cb4a84f..3b5c8dd 100644 (file)
@@ -2,7 +2,7 @@
 //  TServerTransport.cs
 //
 //  Begin:  Dec 3, 2007
-//  Authors: 
+//  Authors:
 //             Will Palmeri <wpalmeri@imeem.com>
 //
 //  Copyright (C) 2007 imeem, inc. <http://www.imeem.com>
index b4f5f07..6b05a15 100644 (file)
@@ -2,7 +2,7 @@
 //  TServerTransport.cs
 //
 //  Begin:  Dec 3, 2007
-//  Authors: 
+//  Authors:
 //             Will Palmeri <wpalmeri@imeem.com>
 //
 //  Copyright (C) 2007 imeem, inc. <http://www.imeem.com>
index c05d587..a3f3623 100644 (file)
@@ -2,7 +2,7 @@
 //  TSocket.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Copyright (C) 2007 imeem, inc. <http://www.imeem.com>
index 1715b6a..dbbec19 100644 (file)
@@ -2,7 +2,7 @@
 //  TStreamTransport.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Copyright (C) 2007 imeem, inc. <http://www.imeem.com>
index 90f7e74..915cbc9 100644 (file)
@@ -2,7 +2,7 @@
 //  TTransport.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Copyright (C) 2007 imeem, inc. <http://www.imeem.com>
index d59c46e..daf21d8 100644 (file)
@@ -2,7 +2,7 @@
 //  TTransportException.cs
 //
 //  Begin:  Aug 19, 2007
-//  Authors: 
+//  Authors:
 //             Todd Berman <tberman@imeem.com>
 //
 //  Copyright (C) 2007 imeem, inc. <http://www.imeem.com>
index 456140d..1cb5c92 100644 (file)
@@ -2,7 +2,7 @@
 //  TTransportFactory.cs
 //
 //  Begin:  Dec 3, 2007
-//  Authors: 
+//  Authors:
 //             Will Palmeri <wpalmeri@imeem.com>
 //
 //  Copyright (C) 2007 imeem, inc. <http://www.imeem.com>
index 039f21e..0101a7d 100644 (file)
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
index 039f21e..0101a7d 100644 (file)
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
index fe448b9..2b5f77b 100644 (file)
@@ -11,7 +11,7 @@
 #
 # 5> code:which(acca_inets).
 # "/home/martin/work/otp/releases/<app>/../../acca/ebin/<app>.beam"
-# 
+#
 # 8> beam_lib:version(code:which(<app>)).
 # {ok,{<app>,['$Id: beamver,v 1.1.1.1 2003/06/13 21:43:21 mlogan Exp $ ']}}
 
index 4e93ea8..1d16e2c 100644 (file)
@@ -17,10 +17,10 @@ ERLANGDEV_GROUP=erlangdev
 
 # ERL_TOP is root of Erlang source tree
 # ERL_RUN_TOP is root of Erlang target tree (some Ericsson Makefiles use $ROOT)
-# ERLANG_OTP is target root for Erlang code 
+# ERLANG_OTP is target root for Erlang code
 # - see sasl/systools reference manual page; grep "TEST"
 
-# OS_TYPE is FreeBSD, NetBSD, OpenBSD, Linux, SCO_SV, SunOS. 
+# OS_TYPE is FreeBSD, NetBSD, OpenBSD, Linux, SCO_SV, SunOS.
 OS_TYPE=${shell uname}
 
 # MHOST is the host where this Makefile runs.
@@ -36,11 +36,11 @@ endif
 # Edit to reflect local environment.
 # ifeq (${OS_TYPE},Linux)
 # ERL_RUN_TOP=/usr/local/lib/erlang
-#  Note* ERL_RUN_TOP can be determined by starting an 
+#  Note* ERL_RUN_TOP can be determined by starting an
 #        erlang shell and typing code:root_dir().
 # ERL_TOP=a symbolic link to the actual source top, which changes from version to version
-#  Note* ERL_TOP is the directory where the erlang 
-#        source files reside. Make sure to run ./configure there. 
+#  Note* ERL_TOP is the directory where the erlang
+#        source files reside. Make sure to run ./configure there.
 # TARGET=i686-pc-linux-gnu
 #  Note* Target can be found in $ERL_TOP/erts
 # endif
@@ -72,7 +72,7 @@ ifeq (${OS_TYPE},SunOS)
     LD=/usr/ccs/bin/ld
     RANLIB=/usr/ccs/bin/ranlib
 
-CFLAGS+=-Wall -pedantic -ansi -O 
+CFLAGS+=-Wall -pedantic -ansi -O
 CORE=*.core
 endif
 
index 7333969..2a36c65 100644 (file)
 # compliance with the License. You should have received a copy of the
 # Erlang Public License along with this software. If not, it can be
 # retrieved via the world wide web at http://www.erlang.org/.
-# 
+#
 # Software distributed under the License is distributed on an "AS IS"
 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 # the License for the specific language governing rights and limitations
 # under the License.
-# 
+#
 # The Initial Developer of the Original Code is Ericsson Utvecklings AB.
 # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
 # AB. All Rights Reserved.''
-# 
+#
 #     $Id: otp_subdir.mk,v 1.5 2004/07/12 15:12:23 jeinhorn Exp $
 #
 #
index dbacf18..bf8535d 100644 (file)
@@ -1,6 +1,6 @@
 # for testing erlang files directly. The set up for a
-# this type of test would be 
-# files to test reside in lib/<app_name>/src and the test files which are 
+# this type of test would be
+# files to test reside in lib/<app_name>/src and the test files which are
 # just plain erlang code reside in lib/<app_name>/test
 #
 # This color codes emitted while the tests run assume that you are using
@@ -25,5 +25,5 @@ test:
                        echo $${MY_LRED:-$(LRED)}"$$d Test Failed"; \
                fi; \
                echo -n $(OFF)$(NO_COLOR); \
-        done  
+       done
 
index c976839..dea2e29 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 266932c..cf8c92b 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 3e42d67..d393f35 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 56c7fee..6335dd9 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 0a66993..b60df71 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 502a137..9488438 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index f115d0b..e6d257d 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 78b91f1..65e5cd0 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 3d138cd..1883397 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 05c738e..0aa1a91 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 3a4cdc5..69081b4 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 333feb5..43babb5 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index a2c25ac..2f85b8a 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 207bbf6..ccb75e4 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index 0317d5a..95d8d87 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index ca89413..8d74289 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index d488140..05aa820 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index b42e005..452cfee 100644 (file)
@@ -52,13 +52,13 @@ WEB_TARGET=/var/yaws/www/$(APP_NAME)
 # ----------------------------------------------------
 
 ERL_FLAGS +=
-ERL_COMPILE_FLAGS += -I../include -I../../fslib/include -I../../system_status/include 
+ERL_COMPILE_FLAGS += -I../include -I../../fslib/include -I../../system_status/include
 
 # ----------------------------------------------------
 # Targets
 # ----------------------------------------------------
 
-all debug opt: $(EBIN) $(TARGET_FILES) 
+all debug opt: $(EBIN) $(TARGET_FILES)
 
 #$(EBIN)/rm_logger.beam: $(APP_NAME).hrl
 include ../build/docs.mk
@@ -84,24 +84,24 @@ $(APP_TARGET): $(APP_SRC) ../vsn.mk $(BEAMS)
                -e 's;%PFX%;$(PFX);' \
                -e 's;%APP_NAME%;$(APP_NAME);' \
                -e 's;%MODULES%;%MODULES%$(MODULES_STRING_LIST);' \
-               $< > $<".tmp" 
+               $< > $<".tmp"
        sed -e 's/%MODULES%\(.*\),/\1/' \
-               $<".tmp" > $@ 
+               $<".tmp" > $@
        rm $<".tmp"
 
 
 $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
        sed -e 's;%VSN%;$(VSN);' $< > $@
 
-$(WEB_TARGET): ../markup/* 
-       rm -rf $(WEB_TARGET) 
-       mkdir $(WEB_TARGET) 
+$(WEB_TARGET): ../markup/*
+       rm -rf $(WEB_TARGET)
+       mkdir $(WEB_TARGET)
        cp -r ../markup/ $(WEB_TARGET)
        cp -r ../skins/ $(WEB_TARGET)
 
 # ----------------------------------------------------
 # Install Target
-# ---------------------------------------------------- 
+# ----------------------------------------------------
 
 install: all $(WEB_TARGET)
 #      $(INSTALL_DIR) $(INSTALL_DST)/src
index ff7fa56..c525cdb 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
 %%%
 
 ?DEFINE_ATTR(super).
-   
+
 %%%
 %%% behavior callbacks
 %%%
+
 %%% super() -> SuperModule = atom()
 %%%             |  none
 
index d697263..f756a29 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
@@ -27,7 +27,7 @@
 %%%
 %%% behavior callbacks
 %%%
+
 %%% super() -> SuperModule = atom()
 %%%             |  none
 
index 23aef22..fc03331 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
 ?DEFINE_ATTR(serverTransport);
 ?DEFINE_ATTR(transportFactory);
 ?DEFINE_ATTR(protocolFactory).
-   
+
 %%%
 %%% behavior callbacks
 %%%
+
 %%% super() -> SuperModule = atom()
 %%%             |  none
 
@@ -58,17 +58,17 @@ new(Handler, Processor, ServerTransport, TransportFactory, ProtocolFactory) ->
 
             %% much ado about nothing but
             %% subclasses pass nil too
-            transportFactory = 
+            transportFactory =
             case TransportFactory of
                 nil -> tTransportFactory:new();
                 _   -> TransportFactory
             end,
-            
-            protocolFactory = 
+       
+            protocolFactory =
             case ProtocolFactory of
                 nil -> tBinaryProtocolFactory:new();
                 _   -> ProtocolFactory
-            end     
+            end
 }.
 
 new(Handler, Processor, ServerTransport) ->
index 6dcc723..833fe5d 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
 %%%
 
 ?DEFINE_ATTR(super).
-   
+
 %%%
 %%% behavior callbacks
 %%%
+
 %%% super() -> SuperModule = atom()
 %%%             |  none
 
@@ -86,16 +86,16 @@ serve_loop(This) ->
     ?R0(Trans, effectful_close),
 
     serve_loop(This).
-    
+
 serve_loop_loop(This, Prot) ->
-    Next = 
+    Next =
        try
            Handler   = oop:get(This, handler),
            Processor = oop:get(This, processor),
            Val = apply(Processor, process, [Handler, Prot, Prot]), %% TODO(cpiro): make processor a gen_server instance
            error_logger:info_msg("request processed: rv=~p", [Val]),
            loop
-       catch 
+       catch
            %% TODO(cpiro) case when is_record(...) to pick out our exception
            %% records vs. normal erlang throws
            E when is_record(E, tTransportException) ->
@@ -105,7 +105,7 @@ serve_loop_loop(This, Prot) ->
                error_logger:info_msg("EXCEPTION: ~p", [F]),
                close
        end,
-    case Next of 
+    case Next of
        loop -> serve_loop_loop(This, Prot);
        close -> ok
     end.
index 003748a..b62e5ad 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
@@ -25,7 +25,7 @@
 %%%
 %%% behavior callbacks
 %%%
+
 %%% super() -> SuperModule = atom()
 %%%             |  none
 
index dabc7ed..17a14cf 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
@@ -15,7 +15,7 @@
 %%% behavior definition
 %%%
 
-start(_Type, _StartArgs) ->  
+start(_Type, _StartArgs) ->
     io:format("starting thrift~n"),
     thrift_logger:install(),
     {ok, Sup} = thrift_app_sup:start_link(),
index 3a44c3f..545ffa8 100644 (file)
@@ -1,6 +1,6 @@
 %%% Copyright (c) 2007- Facebook
 %%% Distributed under the Thrift Software License
-%%% 
+%%%
 %%% See accompanying file LICENSE or visit the Thrift site at:
 %%% http://developers.facebook.com/thrift/
 
index dd5212d..e02a0ee 100644 (file)
@@ -11,11 +11,11 @@ module TBinaryProtocol (TBinaryProtocol(..)) where
 
     version_mask = 0xffff0000
     version_1 = 0x80010000;
-    
+
     getByte i b= 255 .&. (shiftR i (8*b))
     getBytes i 0 = []
     getBytes i n = (toEnum (getByte i (n-1)) :: Char):(getBytes i (n-1))
-    
+
     floatBits :: Double -> Word64
     floatBits (D# d#) = W64# (unsafeCoerce# d#)
 
@@ -44,7 +44,7 @@ module TBinaryProtocol (TBinaryProtocol(..)) where
                                                                twrite tr s
                        writeBinary = writeString
                        writeMessageBegin (TBinaryProtocol tr) (n,t,s) = do writeI32 (TBinaryProtocol tr) (version_1 .|. (fromEnum t))
-                                                                           writeString (TBinaryProtocol tr) n                                                                           
+                                                                           writeString (TBinaryProtocol tr) n
                                                                            writeI32 (TBinaryProtocol tr) s
                        writeMessageEnd (TBinaryProtocol tr) = return ()
                        writeStructBegin (TBinaryProtocol tr) s = return ()
@@ -81,7 +81,7 @@ module TBinaryProtocol (TBinaryProtocol(..)) where
                                                                   if (ver .&. version_mask /= version_1) then
                                                                       throwDyn (ProtocolExn PE_BAD_VERSION "Missing version identifier")
                                                                       else do
-                                                                        s <- readString (TBinaryProtocol tr)                                                                  
+                                                                        s <- readString (TBinaryProtocol tr)
                                                                         sz <- readI32 (TBinaryProtocol tr)
                                                                         return (s,toEnum (ver .&. 0xFF) :: Message_type,fromIntegral sz :: Int)
                        readMessageEnd (TBinaryProtocol tr) = return ()
@@ -106,5 +106,5 @@ module TBinaryProtocol (TBinaryProtocol(..)) where
                        readSetEnd = readListEnd
                        pflush (TBinaryProtocol tr) = tflush tr
 
-                                                           
+
 
index df1aedc..bf2e8a6 100644 (file)
@@ -10,7 +10,7 @@ instance TTransport TChannelTrans where
     topen a = return a
     tclose a = return a
     tread a 0 = return []
-    tread (TChannelTrans h) i = Prelude.catch 
+    tread (TChannelTrans h) i = Prelude.catch
                                  (do c <- hGetChar h
                                      t <- tread (TChannelTrans h) (i-1)
                                      return $ c:t)
index 83a6ee3..4676fc1 100644 (file)
@@ -11,19 +11,19 @@ proc_loop hand proc ps = do v <-proc hand ps
                             if v then proc_loop hand proc ps
                                 else return ()
 
-accept_loop accepter hand sock proc transgen iprotgen oprotgen = 
+accept_loop accepter hand sock proc transgen iprotgen oprotgen =
     do (h,hn,_) <- accepter sock
-       let t = transgen h 
+       let t = transgen h
        let ip = iprotgen t
        let op = oprotgen t
        forkIO (handle (\e -> return ()) (proc_loop hand proc (ip,op)))
        accept_loop accepter hand sock proc transgen iprotgen oprotgen
-       
-run_threaded_server accepter listener hand proc port transgen iprotgen oprotgen = 
+
+run_threaded_server accepter listener hand proc port transgen iprotgen oprotgen =
     do sock <- listener
        accept_loop accepter hand sock proc transgen iprotgen oprotgen
        return ()
-       
+
 
 -- A basic threaded binary protocol socket server.
 run_basic_server hand proc port = run_threaded_server accept (listenOn (PortNumber port)) hand proc port TChannelTrans TBinaryProtocol TBinaryProtocol
index 7e72878..ea23345 100644 (file)
@@ -11,15 +11,15 @@ instance TTransport TSocket where
                   Just _ -> True
                   Nothing -> False
     topen a = do h <- connectTo (host a) (PortNumber (port a))
-                 return $ (a{chan = Just h}) 
-    tclose a = case chan a of 
+                 return $ (a{chan = Just h})
+    tclose a = case chan a of
                  Just h -> do hClose h
                               return $ a{chan=Nothing}
                  Nothing -> return a
     tread a 0 = return []
-    tread a n = case chan a of 
+    tread a n = case chan a of
                   Just h -> handle (\e -> throwDyn (TransportExn "TSocket: Could not read." TE_UNKNOWN))
-                      (do c <- hGetChar h 
+                      (do c <- hGetChar h
                           l <- tread a (n-1)
                           return $ c:l)
                   Nothing -> return []
index 4087b2b..6b94626 100644 (file)
@@ -33,25 +33,25 @@ module Thrift (TransportExn(..),TransportExn_Type(..),TTransport(..), T_type(..)
                        return ret
                        else do r <- treadAll a (len-rl)
                                return (ret++r)
-            
-  
-  data T_type = T_STOP 
-              | T_VOID     
+
+
+  data T_type = T_STOP
+              | T_VOID
               | T_BOOL
               | T_BYTE
-              | T_I08 
-              | T_I16 
-              | T_I32 
-              | T_U64 
-              | T_I64 
-              | T_DOUBLE 
-              | T_STRING 
-              | T_UTF7   
-              | T_STRUCT    
-              | T_MAP       
-              | T_SET       
-              | T_LIST      
-              | T_UTF8      
+              | T_I08
+              | T_I16
+              | T_I32
+              | T_U64
+              | T_I64
+              | T_DOUBLE
+              | T_STRING
+              | T_UTF7
+              | T_STRUCT
+              | T_MAP
+              | T_SET
+              | T_LIST
+              | T_UTF8
               | T_UTF16
               | T_UNKNOWN
                 deriving (Eq)
@@ -75,49 +75,49 @@ module Thrift (TransportExn(..),TransportExn_Type(..),TTransport(..), T_type(..)
                      T_LIST       -> 15
                      T_UTF8       -> 16
                      T_UTF16      -> 17
-                     T_UNKNOWN    -> -1                       
-      toEnum t = case t of 
-                   0 -> T_STOP      
-                   1 -> T_VOID      
+                     T_UNKNOWN    -> -1
+      toEnum t = case t of
+                   0 -> T_STOP
+                   1 -> T_VOID
                    2 -> T_BOOL
                    3 -> T_BYTE
-                   6->  T_I16       
-                   8 -> T_I32      
-                   9 -> T_U64      
-                   10 -> T_I64     
-                   4 -> T_DOUBLE   
+                   6->  T_I16
+                   8 -> T_I32
+                   9 -> T_U64
+                   10 -> T_I64
+                   4 -> T_DOUBLE
                    11 -> T_STRING
                    12 -> T_STRUCT
-                   13 -> T_MAP   
-                   14 -> T_SET   
-                   15 -> T_LIST  
-                   16 -> T_UTF8  
+                   13 -> T_MAP
+                   14 -> T_SET
+                   15 -> T_LIST
+                   16 -> T_UTF8
                    17 -> T_UTF16
                    _ -> T_UNKNOWN
-  
-  
+
+
   data Message_type = M_CALL
                     | M_REPLY
                     | M_EXCEPTION
                     | M_UNKNOWN
                       deriving Eq
   instance Enum Message_type where
-                      
+
       fromEnum t = case t of
                      M_CALL -> 1
                      M_REPLY -> 2
                      M_EXCEPTION -> 3
                      M_UNKNOWN -> -1
-                          
+
       toEnum t = case t of
                    1 -> M_CALL
                    2 -> M_REPLY
                    3 -> M_EXCEPTION
                    _ -> M_UNKNOWN
-  
-  
-  
-  
+
+
+
+
   class Protocol a where
       pflush ::  a -> IO ()
       writeMessageBegin :: a -> ([Char],Message_type,Int) -> IO ()
@@ -221,9 +221,9 @@ module Thrift (TransportExn(..),TransportExn_Type(..),TTransport(..), T_type(..)
                        T_UTF8       -> return ()
                        T_UTF16      -> return ()
                        T_UNKNOWN    -> return ()
-  
-  
-  data PE_type = PE_UNKNOWN      
+
+
+  data PE_type = PE_UNKNOWN
                | PE_INVALID_DATA
                | PE_NEGATIVE_SIZE
                | PE_SIZE_LIMIT
@@ -231,7 +231,7 @@ module Thrift (TransportExn(..),TransportExn_Type(..),TTransport(..), T_type(..)
                  deriving (Eq, Data, Typeable)
 
   data ProtocolExn = ProtocolExn PE_type [Char] deriving (Typeable, Data)
-  
+
   data AE_type = AE_UNKNOWN
                | AE_UNKNOWN_METHOD
                | AE_INVALID_MESSAGE_TYPE
@@ -239,7 +239,7 @@ module Thrift (TransportExn(..),TransportExn_Type(..),TTransport(..), T_type(..)
                | AE_BAD_SEQUENCE_ID
                | AE_MISSING_RESULT
                  deriving (Eq, Data, Typeable)
-  
+
   instance Enum AE_type where
       toEnum i = case i of
                    0 -> AE_UNKNOWN
@@ -256,9 +256,9 @@ module Thrift (TransportExn(..),TransportExn_Type(..),TTransport(..), T_type(..)
                      AE_WRONG_METHOD_NAME -> 3
                      AE_BAD_SEQUENCE_ID -> 4
                      AE_MISSING_RESULT -> 5
-  
+
   data AppExn = AppExn {ae_type :: AE_type, ae_message :: [Char]} deriving (Typeable, Data)
-  
+
   readAppExnFields pt rec = do (n,ft,id) <- readFieldBegin pt
                                if ft == T_STOP then return rec
                                       else
@@ -276,13 +276,13 @@ module Thrift (TransportExn(..),TransportExn_Type(..),TTransport(..), T_type(..)
                                           _ -> do skip pt ft
                                                   readFieldEnd pt
                                                   readAppExnFields pt rec
-  
+
   readAppExn pt = do readStructBegin pt
                      rec <- readAppExnFields pt (AppExn {ae_type = undefined, ae_message = undefined})
                      readStructEnd pt
                      return rec
-  
-  
+
+
   writeAppExn pt ae = do writeStructBegin pt "TApplicationException"
                          if ae_message ae /= "" then
                              do writeFieldBegin pt ("message",T_STRING,1)
@@ -295,4 +295,4 @@ module Thrift (TransportExn(..),TransportExn_Type(..),TTransport(..), T_type(..)
                          writeFieldStop pt
                          writeStructEnd pt
 
-                                          
+
index 039f21e..0101a7d 100644 (file)
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
index 039f21e..0101a7d 100644 (file)
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
index fdce9f5..893a389 100644 (file)
@@ -59,21 +59,21 @@ public class TApplicationException extends TException {
 
     while (true) {
       field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) { 
+      if (field.type == TType.STOP) {
         break;
       }
       switch (field.id) {
       case 1:
         if (field.type == TType.STRING) {
           message = iprot.readString();
-        } else { 
+        } else {
           TProtocolUtil.skip(iprot, field.type);
         }
         break;
       case 2:
         if (field.type == TType.I32) {
           type = iprot.readI32();
-        } else { 
+        } else {
           TProtocolUtil.skip(iprot, field.type);
         }
         break;
index 77eed3e..a328bfd 100644 (file)
@@ -19,7 +19,7 @@ public class TException extends Exception {
   public TException(String message) {
     super(message);
   }
+
   public TException(Throwable cause) {
     super(cause);
   }
index ace90a2..5bac1ba 100644 (file)
@@ -15,11 +15,11 @@ import com.facebook.thrift.transport.TTransport;
 public class TProcessorFactory {
 
   private final TProcessor processor_;
-  
+
   public TProcessorFactory(TProcessor processor) {
     processor_ = processor;
   }
-  
+
   public TProcessor getProcessor(TTransport trans) {
     return processor_;
   }
index b9167d2..750dce1 100644 (file)
@@ -27,7 +27,7 @@ public class TBinaryProtocol extends TProtocol {
 
   protected int readLength_;
   protected boolean checkReadLength_ = false;
-  
+
   /**
    * Factory
    */
@@ -321,7 +321,7 @@ public class TBinaryProtocol extends TProtocol {
     checkReadLength(len);
     return trans_.readAll(buf, off, len);
   }
-  
+
   public void setReadLength(int readLength) {
     readLength_ = readLength;
     checkReadLength_ = true;
@@ -335,5 +335,5 @@ public class TBinaryProtocol extends TProtocol {
       }
     }
   }
-  
+
 }
index d1c7642..3fe8599 100644 (file)
@@ -13,7 +13,7 @@ package com.facebook.thrift.protocol;
  */
 public class TList {
   public TList() {}
-  
+
   public TList(byte t, int s) {
     elemType = t;
     size = s;
index 0a0e4df..9b7126e 100644 (file)
@@ -13,7 +13,7 @@ package com.facebook.thrift.protocol;
  */
 public class TMap {
   public TMap() {}
-  
+
   public TMap(byte k, byte v, int s) {
     keyType = k;
     valueType = v;
index 08a7ef3..3e7e7f0 100644 (file)
@@ -23,7 +23,7 @@ public abstract class TProtocol {
 
   /**
    * Transport
-   */ 
+   */
   protected TTransport trans_;
 
   /**
@@ -32,7 +32,7 @@ public abstract class TProtocol {
   protected TProtocol(TTransport trans) {
     trans_ = trans;
   }
-  
+
   /**
    * Transport accessor
    */
@@ -47,7 +47,7 @@ public abstract class TProtocol {
   public abstract void writeMessageBegin(TMessage message) throws TException;
 
   public abstract void writeMessageEnd() throws TException;
-  
+
   public abstract void writeStructBegin(TStruct struct) throws TException;
 
   public abstract void writeStructEnd() throws TException;
@@ -99,9 +99,9 @@ public abstract class TProtocol {
   public abstract void readStructEnd() throws TException;
 
   public abstract TField readFieldBegin() throws TException;
-  
+
   public abstract void readFieldEnd() throws TException;
+
   public abstract TMap readMapBegin() throws TException;
 
   public abstract void readMapEnd() throws TException;
@@ -121,7 +121,7 @@ public abstract class TProtocol {
   public abstract short readI16() throws TException;
 
   public abstract int readI32() throws TException;
+
   public abstract long readI64() throws TException;
 
   public abstract double readDouble() throws TException;
index ad333bc..0b85d38 100644 (file)
@@ -80,7 +80,7 @@ public class TProtocolUtil {
         break;
       }
     case TType.SET:
-      {        
+      {
         TSet set = prot.readSetBegin();
         for (int i = 0; i < set.size; i++) {
           skip(prot, set.elemType);
index c24e07e..2a485e8 100644 (file)
@@ -49,7 +49,7 @@ public class Argument implements java.io.Serializable {
     while (true)
     {
       field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) { 
+      if (field.type == TType.STOP) {
         break;
       }
       switch (field.id)
@@ -58,7 +58,7 @@ public class Argument implements java.io.Serializable {
           if (field.type == TType.I16) {
             this.key = iprot.readI16();
             this.__isset.key = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
@@ -66,7 +66,7 @@ public class Argument implements java.io.Serializable {
           if (field.type == TType.STRING) {
             this.name = iprot.readString();
             this.__isset.name = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
@@ -75,7 +75,7 @@ public class Argument implements java.io.Serializable {
             this.type = new ThriftType();
             this.type.read(iprot);
             this.__isset.type = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
index 11d3872..6c8bcc3 100644 (file)
@@ -49,7 +49,7 @@ public class ContainerType implements java.io.Serializable {
     while (true)
     {
       field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) { 
+      if (field.type == TType.STOP) {
         break;
       }
       switch (field.id)
@@ -58,7 +58,7 @@ public class ContainerType implements java.io.Serializable {
           if (field.type == TType.I32) {
             this.ttype = iprot.readI32();
             this.__isset.ttype = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
@@ -67,7 +67,7 @@ public class ContainerType implements java.io.Serializable {
             this.subtype1 = new SimpleType();
             this.subtype1.read(iprot);
             this.__isset.subtype1 = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
@@ -76,7 +76,7 @@ public class ContainerType implements java.io.Serializable {
             this.subtype2 = new SimpleType();
             this.subtype2.read(iprot);
             this.__isset.subtype2 = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
index 64ba21d..41fa6ca 100644 (file)
@@ -49,7 +49,7 @@ public class Method implements java.io.Serializable {
     while (true)
     {
       field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) { 
+      if (field.type == TType.STOP) {
         break;
       }
       switch (field.id)
@@ -58,7 +58,7 @@ public class Method implements java.io.Serializable {
           if (field.type == TType.STRING) {
             this.name = iprot.readString();
             this.__isset.name = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
@@ -67,7 +67,7 @@ public class Method implements java.io.Serializable {
             this.return_type = new ThriftType();
             this.return_type.read(iprot);
             this.__isset.return_type = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
@@ -86,7 +86,7 @@ public class Method implements java.io.Serializable {
               iprot.readListEnd();
             }
             this.__isset.arguments = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
index f3a9481..fcbd09c 100644 (file)
@@ -49,7 +49,7 @@ public class Service implements java.io.Serializable {
     while (true)
     {
       field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) { 
+      if (field.type == TType.STOP) {
         break;
       }
       switch (field.id)
@@ -58,7 +58,7 @@ public class Service implements java.io.Serializable {
           if (field.type == TType.STRING) {
             this.name = iprot.readString();
             this.__isset.name = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
@@ -77,7 +77,7 @@ public class Service implements java.io.Serializable {
               iprot.readListEnd();
             }
             this.__isset.methods = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
@@ -85,7 +85,7 @@ public class Service implements java.io.Serializable {
           if (field.type == TType.BOOL) {
             this.fully_reflected = iprot.readBool();
             this.__isset.fully_reflected = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
index c0feae6..2a69e39 100644 (file)
@@ -44,7 +44,7 @@ public class SimpleType implements java.io.Serializable {
     while (true)
     {
       field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) { 
+      if (field.type == TType.STOP) {
         break;
       }
       switch (field.id)
@@ -53,7 +53,7 @@ public class SimpleType implements java.io.Serializable {
           if (field.type == TType.I32) {
             this.ttype = iprot.readI32();
             this.__isset.ttype = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
@@ -61,7 +61,7 @@ public class SimpleType implements java.io.Serializable {
           if (field.type == TType.STRING) {
             this.name = iprot.readString();
             this.__isset.name = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
index d3bb3eb..63022ec 100644 (file)
@@ -49,7 +49,7 @@ public class ThriftType implements java.io.Serializable {
     while (true)
     {
       field = iprot.readFieldBegin();
-      if (field.type == TType.STOP) { 
+      if (field.type == TType.STOP) {
         break;
       }
       switch (field.id)
@@ -58,7 +58,7 @@ public class ThriftType implements java.io.Serializable {
           if (field.type == TType.BOOL) {
             this.is_container = iprot.readBool();
             this.__isset.is_container = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
@@ -67,7 +67,7 @@ public class ThriftType implements java.io.Serializable {
             this.simple_type = new SimpleType();
             this.simple_type.read(iprot);
             this.__isset.simple_type = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
@@ -76,7 +76,7 @@ public class ThriftType implements java.io.Serializable {
             this.container_type = new ContainerType();
             this.container_type.read(iprot);
             this.__isset.container_type = true;
-          } else { 
+          } else {
             TProtocolUtil.skip(iprot, field.type);
           }
           break;
index 2ac322a..c066607 100644 (file)
@@ -56,7 +56,7 @@ public abstract class TServer {
   protected TServer(TProcessorFactory processorFactory,
                     TServerTransport serverTransport) {
     this(processorFactory,
-         serverTransport,         
+         serverTransport,
          new TTransportFactory(),
          new TTransportFactory(),
          new TBinaryProtocol.Factory(),
@@ -99,7 +99,7 @@ public abstract class TServer {
     inputProtocolFactory_ = inputProtocolFactory;
     outputProtocolFactory_ = outputProtocolFactory;
   }
-  
+
   /**
    * The run method fires up the server and gets things going.
    */
index cb127c7..bf66843 100644 (file)
@@ -42,8 +42,8 @@ public class TSimpleServer extends TServer {
                        TTransportFactory inputTransportFactory,
                        TTransportFactory outputTransportFactory,
                        TProtocolFactory inputProtocolFactory,
-                       TProtocolFactory outputProtocolFactory) {                       
-    super(new TProcessorFactory(processor), serverTransport, 
+                       TProtocolFactory outputProtocolFactory) {
+    super(new TProcessorFactory(processor), serverTransport,
           inputTransportFactory, outputTransportFactory,
           inputProtocolFactory, outputProtocolFactory);
   }
@@ -65,13 +65,13 @@ public class TSimpleServer extends TServer {
           TTransportFactory inputTransportFactory,
           TTransportFactory outputTransportFactory,
           TProtocolFactory inputProtocolFactory,
-          TProtocolFactory outputProtocolFactory) {                       
-    super(processorFactory, serverTransport, 
+          TProtocolFactory outputProtocolFactory) {
+    super(processorFactory, serverTransport,
           inputTransportFactory, outputTransportFactory,
           inputProtocolFactory, outputProtocolFactory);
   }
-  
+
+
   public void serve() {
     stopped_ = false;
     try {
index e9998b9..5fef3b7 100644 (file)
@@ -55,7 +55,7 @@ public class TIOStreamTransport extends TTransport {
    *
    * @param is Input stream to read from
    * @param os Output stream to read from
-   */ 
+   */
   public TIOStreamTransport(InputStream is, OutputStream os) {
     inputStream_ = is;
     outputStream_ = os;
index cc6d900..2692ac4 100644 (file)
@@ -18,7 +18,7 @@ import java.net.SocketException;
  * @author Mark Slee <mcslee@facebook.com>
  */
 public class TServerSocket extends TServerTransport {
-  
+
   /**
    * Underlying serversocket object
    */
@@ -85,7 +85,7 @@ public class TServerSocket extends TServerTransport {
       }
     }
   }
-  
+
   protected TSocket acceptImpl() throws TTransportException {
     if (serverSocket_ == null) {
       throw new TTransportException(TTransportException.NOT_OPEN, "No underlying server socket.");
index 2c17e43..2053850 100644 (file)
@@ -24,7 +24,7 @@ public class TSocket extends TIOStreamTransport {
    * Wrapped Socket object
    */
   private Socket socket_ = null;
-  
+
   /**
    * Remote host
    */
index b304367..222a4b9 100644 (file)
@@ -2,7 +2,7 @@ Library
 -------
 The library abstract classes, exceptions, and general use functions
 are mostly jammed in Thrift.ml (an exception being
-TServer). 
+TServer).
 
 Generally, classes are used, however they are often put in their own
 module along with other relevant types and functions. The classes
@@ -24,7 +24,7 @@ class). The class type is t and is in a module with the name of the
 struct.
 
 
-enum format 
+enum format
 -----------
 Enums are put in their own module along with
 functions to_i and of_i which convert the ocaml types into ints. For
index fa84e71..109eeaa 100644 (file)
@@ -10,7 +10,7 @@ let tv = P.t_type_to_i
 let vt = P.t_type_of_i
 
 
-let comp_int b n = 
+let comp_int b n =
   let s = ref 0l in
   let sb = 32 - 8*n in
     for i=0 to (n-1) do
@@ -32,7 +32,7 @@ class t trans =
 object (self)
   inherit P.t trans
   val ibyte = String.create 8
-  method writeBool b = 
+  method writeBool b =
     ibyte.[0] <- char_of_int (if b then 1 else 0);
     trans#write ibyte 0 1
   method writeByte i =
@@ -88,7 +88,7 @@ object (self)
     self#writeByte (tv t);
     self#writeI32 s
   method writeSetEnd = ()
-  method readByte = 
+  method readByte =
     ignore (trans#readAll ibyte 0 1);
     (comp_int ibyte 1)
   method readI16 =
@@ -124,7 +124,7 @@ object (self)
     ""
   method readStructEnd = ()
   method readFieldBegin =
-    let t = (vt (self#readByte)) 
+    let t = (vt (self#readByte))
     in
       if t != P.T_STOP then
         ("",t,self#readI16)
index 5407a8e..9678e5a 100644 (file)
@@ -8,12 +8,12 @@ object (self)
   method isOpen = opened
   method opn = ()
   method close = close_in i; opened <- false
-  method read buf off len = 
+  method read buf off len =
     if opened then
-      try 
+      try
         really_input i buf off len; len
       with _ -> raise (T.E (T.UNKNOWN, ("TChannelTransport: Could not read "^(string_of_int len))))
-    else 
+    else
       raise (T.E (T.NOT_OPEN, "TChannelTransport: Channel was closed"))
   method write buf off len = output o buf off len
   method flush = flush o
index 5fb8089..bd97ab9 100644 (file)
@@ -1,7 +1,7 @@
 open Thrift
 
 class virtual t
-    (pf : Processor.t) 
+    (pf : Processor.t)
     (st : Transport.server_t)
     (tf : Transport.factory)
     (ipf : Protocol.factory)
index 9e79706..1e82609 100644 (file)
@@ -11,7 +11,7 @@ object
       Unix.listen s 256
   method close =
     match sock with
-        Some s -> Unix.shutdown s Unix.SHUTDOWN_ALL; Unix.close s; 
+        Some s -> Unix.shutdown s Unix.SHUTDOWN_ALL; Unix.close s;
           sock <- None
       | _ -> ()
   method acceptImpl =
index 20c8613..2d82437 100644 (file)
@@ -7,34 +7,34 @@ object (self)
   inherit T.t
   val mutable chans = None
   method isOpen = chans != None
-  method opn = 
+  method opn =
     try
       let addr = (let {Unix.h_addr_list=x} = Unix.gethostbyname host in x.(0)) in
         chans <- Some(Unix.open_connection (Unix.ADDR_INET (addr,port)))
-    with 
+    with
         Unix.Unix_error (e,fn,_) -> raise (T.E (T.NOT_OPEN, ("TSocket: Could not connect to "^host^":"^(string_of_int port)^" because: "^fn^":"^(Unix.error_message e))))
       | _ -> raise (T.E (T.NOT_OPEN, ("TSocket: Could not connect to "^host^":"^(string_of_int port))))
 
-  method close = 
-    match chans with 
-        None -> () 
-      | Some(inc,out) -> (Unix.shutdown_connection inc; 
-                          close_in inc;  
+  method close =
+    match chans with
+        None -> ()
+      | Some(inc,out) -> (Unix.shutdown_connection inc;
+                          close_in inc;
                           chans <- None)
   method read buf off len = match chans with
       None -> raise (T.E (T.NOT_OPEN, "TSocket: Socket not open"))
-    | Some(i,o) -> 
-        try 
+    | Some(i,o) ->
+        try
           really_input i buf off len; len
         with
             Unix.Unix_error (e,fn,_) -> raise (T.E (T.UNKNOWN, ("TSocket: Could not read "^(string_of_int len)^" from "^host^":"^(string_of_int port)^" because: "^fn^":"^(Unix.error_message e))))
           | _ -> raise (T.E (T.UNKNOWN, ("TSocket: Could not read "^(string_of_int len)^" from "^host^":"^(string_of_int port))))
-  method write buf off len = match chans with 
+  method write buf off len = match chans with
       None -> raise (T.E (T.NOT_OPEN, "TSocket: Socket not open"))
     | Some(i,o) -> output o buf off len
   method flush = match chans with
       None -> raise (T.E (T.NOT_OPEN, "TSocket: Socket not open"))
     | Some(i,o) -> flush o
 end
-        
-    
+
+
index 10f1614..702cb22 100644 (file)
@@ -1,7 +1,7 @@
 open Thrift
 
-class t 
-  (pf : Processor.t) 
+class t
+  (pf : Processor.t)
   (st : Transport.server_t)
   (tf : Transport.factory)
   (ipf : Protocol.factory)
@@ -12,8 +12,8 @@ object
     st#listen;
     while true do
       let tr = tf#getTransport (st#accept) in
-        ignore (Thread.create 
-          (fun _ ->          
+        ignore (Thread.create
+          (fun _ ->
              let ip = ipf#getProtocol tr in
              let op = opf#getProtocol tr in
                try
@@ -23,4 +23,4 @@ object
                with _ -> ()) ())
     done
 end
-      
+
index 92c015b..1a9130f 100644 (file)
@@ -2,7 +2,7 @@ exception Break;;
 exception Thrift_error;;
 exception Field_empty of string;;
 
-class t_exn = 
+class t_exn =
 object
   val mutable message = ""
   method get_message = message
@@ -11,7 +11,7 @@ end;;
 
 module Transport =
 struct
-  type exn_type = 
+  type exn_type =
       | UNKNOWN
       | NOT_OPEN
       | ALREADY_OPEN
@@ -52,31 +52,31 @@ struct
     method virtual close : unit
     method virtual acceptImpl : t
   end
-        
+
 end;;
 
 
 
 module Protocol =
 struct
-  type t_type =   
-      | T_STOP     
-      | T_VOID     
+  type t_type =
+      | T_STOP
+      | T_VOID
       | T_BOOL
       | T_BYTE
-      | T_I08 
-      | T_I16 
-      | T_I32 
-      | T_U64 
-      | T_I64 
-      | T_DOUBLE 
-      | T_STRING 
-      | T_UTF7   
-      | T_STRUCT    
-      | T_MAP       
-      | T_SET       
-      | T_LIST      
-      | T_UTF8      
+      | T_I08
+      | T_I16
+      | T_I32
+      | T_U64
+      | T_I64
+      | T_DOUBLE
+      | T_STRING
+      | T_UTF7
+      | T_STRUCT
+      | T_MAP
+      | T_SET
+      | T_LIST
+      | T_UTF8
       | T_UTF16
 
   let t_type_to_i = function
@@ -98,25 +98,25 @@ struct
     | T_LIST       -> 15
     | T_UTF8       -> 16
     | T_UTF16      -> 17
-        
+
   let t_type_of_i = function
-      0 -> T_STOP      
-    | 1 -> T_VOID      
+      0 -> T_STOP
+    | 1 -> T_VOID
     | 2 -> T_BOOL
     | 3 ->  T_BYTE
-    | 6-> T_I16       
-    | 8 -> T_I32      
-    | 9 -> T_U64      
-    | 10 -> T_I64     
-    | 4 -> T_DOUBLE   
+    | 6-> T_I16
+    | 8 -> T_I32
+    | 9 -> T_U64
+    | 10 -> T_I64
+    | 4 -> T_DOUBLE
     | 11 -> T_STRING
     | 12 -> T_STRUCT
-    | 13 -> T_MAP   
-    | 14 -> T_SET   
-    | 15 -> T_LIST  
-    | 16 -> T_UTF8  
+    | 13 -> T_MAP
+    | 14 -> T_SET
+    | 15 -> T_LIST
+    | 16 -> T_UTF8
     | 17 -> T_UTF16
-    | _ -> raise Thrift_error 
+    | _ -> raise Thrift_error
 
   type message_type =
     | CALL
@@ -128,7 +128,7 @@ struct
     | REPLY -> 2
     | EXCEPTION -> 3
 
-  let message_type_of_i = function 
+  let message_type_of_i = function
     | 1 -> CALL
     | 2 -> REPLY
     | 3 -> EXCEPTION
@@ -182,7 +182,7 @@ struct
     method virtual readString : string
     method virtual readBinary : string
         (* skippage *)
-    method skip typ = 
+    method skip typ =
       match typ with
         | T_STOP -> ()
         | T_VOID -> ()
@@ -192,7 +192,7 @@ struct
         | T_I16 -> ignore self#readI16
         | T_I32 -> ignore self#readI32
         | T_U64
-        | T_I64 -> ignore self#readI64 
+        | T_I64 -> ignore self#readI64
         | T_DOUBLE -> ignore self#readDouble
         | T_STRING -> ignore self#readString
         | T_UTF7 -> ()
@@ -202,7 +202,7 @@ struct
                                      let (_,t,_) = self#readFieldBegin in
                                        if t = T_STOP then
                                          raise Break
-                                       else 
+                                       else
                                          (self#skip t;
                                           self#readFieldEnd)
                                    done
@@ -241,8 +241,8 @@ struct
       | BAD_VERSION
 
   exception E of exn_type * string;;
-           
-end;;   
+
+end;;
 
 
 module Processor =
@@ -251,10 +251,10 @@ struct
   object
     method virtual process : Protocol.t -> Protocol.t -> bool
   end;;
-  
+
   class factory (processor : t) =
   object
-    val processor_ = processor 
+    val processor_ = processor
     method getProcessor (trans : Transport.t) = processor_
   end;;
 end
@@ -306,18 +306,18 @@ struct
       oprot#writeFieldStop;
       oprot#writeStructEnd
   end;;
-  
+
   let create typ msg =
     let e = new t in
       e#set_type typ;
     e#set_message msg;
     e
-      
+
   let read (iprot : Protocol.t) =
     let msg = ref "" in
     let typ = ref 0 in
       ignore iprot#readStructBegin;
-      (try 
+      (try
            while true do
              let (name,ft,id) =iprot#readFieldBegin in
                if ft = Protocol.T_STOP then
@@ -341,6 +341,6 @@ struct
         e#set_type (typ_of_i !typ);
         e#set_message !msg;
         e;;
-  
+
   exception E of t
 end;;
index 039f21e..0101a7d 100644 (file)
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
index 039f21e..0101a7d 100644 (file)
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
index 854149b..9f79838 100644 (file)
@@ -30,10 +30,10 @@ sub new
     my $classname = shift;
     my $url       = shift || 'http://localhost:9090';
     my $debugHandler = shift;
-    
+
     my $out = IO::String->new;
     binmode($out);
-    
+
     my $self = {
         url          => $url,
         out          => $out,
@@ -111,9 +111,9 @@ sub readAll
 {
     my $self = shift;
     my $len  = shift;
-    
+
     my $buf = $self->read($len);
-    
+
     if (!defined($buf)) {
       die new Thrift::TException('TSocket: Could not read '.$len.' bytes from input buffer');
     }
@@ -127,9 +127,9 @@ sub read
 {
     my $self = shift;
     my $len  = shift;
-    
+
     my $buf;
-    
+
     my $in = $self->{in};
 
     if (!defined($in)) {
@@ -170,20 +170,20 @@ sub flush
     $ua->default_header('Accept' => 'application/x-thrift');
     $ua->default_header('Content-Type' => 'application/x-thrift');
     $ua->cookie_jar({}); # hash to remember cookies between redirects
-    
+
     my $out = $self->{out};
     $out->setpos(0); # rewind
     my $buf = join('', <$out>);
-      
+
     my $request = new HTTP::Request(POST => $self->{url}, undef, $buf);
     my $response = $ua->request($request);
     my $content_ref = $response->content_ref;
-    
+
     my $in = IO::String->new($content_ref);
     binmode($in);
     $self->{in} = $in;
     $in->setpos(0); # rewind
-    
+
     # reset write buffer
     $out = IO::String->new;
     binmode($out);
index 039f21e..0101a7d 100644 (file)
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
index 039f21e..0101a7d 100644 (file)
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
index 1df54d5..a666128 100644 (file)
@@ -148,7 +148,7 @@ protected:
   size_t buffer_remaining;
   size_t buffer_size;
 
-  zval* p; 
+  zval* p;
   zval* t;
   zval funcname;
 };
@@ -161,7 +161,7 @@ void createObject(char* obj_typename, zval* return_value) {
   if (! ce) {
     php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s does not exist", obj_typename);
     RETURN_NULL();
-  } 
+  }
 
   object_and_properties_init(return_value, ce, NULL);
 }
@@ -173,7 +173,7 @@ void binary_deserialize(long thrift_typeID, PHPTransport& transport, zval* retur
     case T_STOP:
     case T_VOID:
       RETURN_NULL();
-      return; 
+      return;
     case T_STRUCT: {
       assert(structType);
       createObject(structType, return_value);
@@ -195,10 +195,10 @@ void binary_deserialize(long thrift_typeID, PHPTransport& transport, zval* retur
       RETURN_BOOL(c != 0);
     }
   //case T_I08: // same numeric value as T_BYTE
-    case T_BYTE: { 
+    case T_BYTE: {
       uint8_t c;
       transport.readBytes(&c, 1);
-      RETURN_LONG(c); 
+      RETURN_LONG(c);
     }
     case T_I16: {
       uint16_t c;
@@ -338,7 +338,7 @@ PHP_FUNCTION(thrift_protocol_binary_deserialize) {
     efree(args);
     RETURN_NULL();
   }
+
   char* structType = NULL;
   if (argc >= 3) {
     if (Z_TYPE_PP(args[2]) == IS_STRING) {
index f66f8ee..874a548 100644 (file)
@@ -314,34 +314,34 @@ class TBinaryProtocol extends TProtocol {
 
       // Check for a negative
       if ($isNeg) {
-       $hi = ~$hi & (int)0xffffffff;
-       $lo = ~$lo & (int)0xffffffff;
-
-       if ($lo == (int)0xffffffff) {
-         $hi++;
-         $lo = 0;
-       } else {
-         $lo++;
-       }
+        $hi = ~$hi & (int)0xffffffff;
+        $lo = ~$lo & (int)0xffffffff;
+
+        if ($lo == (int)0xffffffff) {
+          $hi++;
+          $lo = 0;
+        } else {
+          $lo++;
+        }
       }
 
       // Force 32bit words in excess of 2G to pe positive - we deal wigh sign
       // explicitly below
 
       if ($hi & (int)0x80000000) {
-       $hi &= (int)0x7fffffff;
-       $hi += 0x80000000;
+        $hi &= (int)0x7fffffff;
+        $hi += 0x80000000;
       }
 
       if ($lo & (int)0x80000000) {
-       $lo &= (int)0x7fffffff;
-       $lo += 0x80000000;
+        $lo &= (int)0x7fffffff;
+        $lo += 0x80000000;
       }
 
       $value = $hi * 4294967296 + $lo;
 
       if ($isNeg) {
-       $value = 0 - $value;
+        $value = 0 - $value;
       }
     } else {
 
index ec58f66..f6e6398 100644 (file)
@@ -87,10 +87,10 @@ class SimpleType:
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 
-  def __str__(self): 
+  def __str__(self):
     return str(self.__dict__)
 
-  def __repr__(self): 
+  def __repr__(self):
     return repr(self.__dict__)
 
   def __eq__(self, other):
@@ -171,10 +171,10 @@ class ContainerType:
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 
-  def __str__(self): 
+  def __str__(self):
     return str(self.__dict__)
 
-  def __repr__(self): 
+  def __repr__(self):
     return repr(self.__dict__)
 
   def __eq__(self, other):
@@ -255,10 +255,10 @@ class ThriftType:
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 
-  def __str__(self): 
+  def __str__(self):
     return str(self.__dict__)
 
-  def __repr__(self): 
+  def __repr__(self):
     return repr(self.__dict__)
 
   def __eq__(self, other):
@@ -338,10 +338,10 @@ class Argument:
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 
-  def __str__(self): 
+  def __str__(self):
     return str(self.__dict__)
 
-  def __repr__(self): 
+  def __repr__(self):
     return repr(self.__dict__)
 
   def __eq__(self, other):
@@ -430,10 +430,10 @@ class Method:
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 
-  def __str__(self): 
+  def __str__(self):
     return str(self.__dict__)
 
-  def __repr__(self): 
+  def __repr__(self):
     return repr(self.__dict__)
 
   def __eq__(self, other):
@@ -521,10 +521,10 @@ class Service:
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 
-  def __str__(self): 
+  def __str__(self):
     return str(self.__dict__)
 
-  def __repr__(self): 
+  def __repr__(self):
     return repr(self.__dict__)
 
   def __eq__(self, other):
index 74bb93e..b6738f7 100644 (file)
@@ -132,7 +132,7 @@ class TThreadPoolServer(TServer):
         self.serveClient(client)
       except Exception, x:
         print '%s, %s, %s' % (type(x), x, traceback.format_exc())
-      
+
   def serveClient(self, client):
     """Process input/output from a client for as long as possible"""
     itrans = self.inputTransportFactory.getTransport(client)
@@ -158,7 +158,7 @@ class TThreadPoolServer(TServer):
         t.start()
       except Exception, x:
         print '%s, %s, %s,' % (type(x), x, traceback.format_exc())
-    
+
     # Pump the socket for clients
     self.serverTransport.listen()
     while True:
index 7410fa4..9cf4039 100644 (file)
@@ -28,7 +28,7 @@ class THttpClient(TTransportBase):
   def close(self):
     self.__http.close()
     self.__http = None
-    
+
   def isOpen(self):
     return self.__http != None
 
index 146820d..732dbd7 100644 (file)
@@ -27,7 +27,7 @@ class TSocket(TTransportBase):
     self.handle = None
     self._unix_socket = unix_socket
     self._timeout = None
-    
+
   def setHandle(self, h):
     self.handle = h
 
@@ -39,7 +39,7 @@ class TSocket(TTransportBase):
       self._timeout = None
     else:
       self._timeout = ms/1000.0
-    
+
     if (self.handle != None):
       self.handle.settimeout(self._timeout)
 
@@ -48,7 +48,7 @@ class TSocket(TTransportBase):
       return [(socket.AF_UNIX, socket.SOCK_STREAM, None, None, self._unix_socket)]
     else:
       return socket.getaddrinfo(self.host, self.port, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, socket.AI_PASSIVE | socket.AI_ADDRCONFIG)
-    
+
   def open(self):
     try:
       res0 = self._resolveAddr()
index 039f21e..0101a7d 100644 (file)
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
index 039f21e..0101a7d 100644 (file)
@@ -1,5 +1,5 @@
 Thrift Software License
-Copyright (c) 2006- Facebook, Inc. 
+Copyright (c) 2006- Facebook, Inc.
 
 Permission is hereby granted, free of charge, to any person or organization
 obtaining a copy of the software and accompanying documentation covered by
index a152bf2..ce0b1bb 100644 (file)
@@ -29,7 +29,7 @@ class TBinaryProtocol < TProtocol
     writeByte(type)
     writeI16(id)
   end
-  
+
   def writeFieldStop()
     writeByte(TType::STOP)
   end
@@ -39,17 +39,17 @@ class TBinaryProtocol < TProtocol
     writeByte(vtype)
     writeI32(size)
   end
-  
+
   def writeListBegin(etype, size)
     writeByte(etype)
     writeI32(size)
   end
-  
+
   def writeSetBegin(etype, size)
     writeByte(etype)
     writeI32(size)
   end
-  
+
   def writeBool(bool)
     if (bool)
       writeByte(1)
@@ -69,7 +69,7 @@ class TBinaryProtocol < TProtocol
   def writeI32(i32)
     trans.write([i32].pack('N'))
   end
-  
+
   def writeI64(i64)
     hi = i64 >> 32
     lo = i64 & 0xffffffff
@@ -79,7 +79,7 @@ class TBinaryProtocol < TProtocol
   def writeDouble(dub)
     trans.write([dub].pack('G'))
   end
-  
+
   def writeString(str)
     writeI32(str.length)
     trans.write(str)
@@ -95,7 +95,7 @@ class TBinaryProtocol < TProtocol
     seqid = readI32()
     return name, type, seqid
   end
-  
+
   def readFieldBegin()
     type = readByte()
     if (type === TType::STOP)
@@ -104,7 +104,7 @@ class TBinaryProtocol < TProtocol
     id = readI16()
     return nil, type, id
   end
-  
+
   def readMapBegin()
     ktype = readByte()
     vtype = readByte()
@@ -122,8 +122,8 @@ class TBinaryProtocol < TProtocol
     etype = readByte()
     size = readI32()
     return etype, size
-  end  
-  
+  end
+
   def readBool()
     byte = readByte()
     return byte != 0
@@ -146,7 +146,7 @@ class TBinaryProtocol < TProtocol
     end
     return val
   end
-  
+
   def readI32()
     dat = trans.readAll(4)
     val, = dat.unpack('N')
index fb43705..a06b4cd 100644 (file)
@@ -29,7 +29,7 @@ class TProtocolException < TException
 end
 
 class TProtocol
-  
+
   attr_reader :trans
 
   def initialize(trans)
@@ -39,87 +39,87 @@ class TProtocol
   def writeMessageBegin(name, type, seqid); nil; end
 
   def writeMessageEnd; nil; end
-  
+
   def writeStructBegin(name); nil; end
-  
+
   def writeStructEnd(); nil; end
-  
+
   def writeFieldBegin(name, type, id); nil; end
-  
+
   def writeFieldEnd(); nil; end
-  
+
   def writeFieldStop(); nil; end
 
   def writeMapBegin(ktype, vtype, size); nil; end
-  
+
   def writeMapEnd(); nil; end
 
   def writeListBegin(etype, size); nil; end
-  
+
   def writeListEnd(); nil; end
-  
+
   def writeSetBegin(etype, size); nil; end
 
   def writeSetEnd(); nil; end
-  
+
   def writeBool(bool); nil; end
-  
+
   def writeByte(byte); nil; end
-  
+
   def writeI16(i16); nil; end
-  
+
   def writeI32(i32); nil; end
-  
+
   def writeI64(i64); nil; end
-  
+
   def writeDouble(dub); nil; end
-  
+
   def writeString(str); nil; end
-  
+
   def readMessageBegin(); nil; end
-  
+
   def readMessageEnd(); nil; end
-  
+
   def readStructBegin(); nil; end
-  
+
   def readStructEnd(); nil; end
-  
+
   def readFieldBegin(); nil; end
-  
+
   def readFieldEnd(); nil; end
-  
+
   def readMapBegin(); nil; end
-  
+
   def readMapEnd(); nil; end
-  
+
   def readListBegin(); nil; end
-  
+
   def readListEnd(); nil; end
 
   def readSetBegin(); nil; end
-  
+
   def readSetEnd(); nil; end
-  
+
   def readBool(); nil; end
-  
+
   def readByte(); nil; end
 
   def readI16(); nil; end
-  
+
   def readI32(); nil; end
-  
+
   def readI64(); nil; end
-  
+
   def readDouble(); nil; end
-  
+
   def readString(); nil; end
-  
+
   def write_field(name, type, fid, value)
     writeFieldBegin(name, type, fid)
     write_type(type, value)
     writeFieldEnd
   end
-  
+
   def write_type(type, value)
     case type
     when TType::BOOL
@@ -142,7 +142,7 @@ class TProtocol
       raise NotImplementedError
     end
   end
-  
+
   def read_type(type)
     case type
     when TType::BOOL
@@ -163,7 +163,7 @@ class TProtocol
       raise NotImplementedError
     end
   end
-  
+
   def skip(type)
     if type === TType::STOP
       nil
index d9ff621..43b2bdd 100644 (file)
@@ -20,7 +20,7 @@ class TServer
     @transportFactory = transportFactory ? transportFactory : TTransportFactory.new()
     @protocolFactory = protocolFactory ? protocolFactory : TBinaryProtocolFactory.new()
   end
-  
+
   def serve(); nil; end
 
 end
index 424a5f3..9f0c826 100644 (file)
@@ -659,7 +659,7 @@ module FileOperations
   def ruby(*args)
     command config('rubyprog'), *args
   end
-  
+
   def make(task = nil)
     command(*[config('makeprog'), task].compact)
   end
@@ -722,7 +722,7 @@ module HookScriptAPI
   def srcdirectory?(path)
     File.dir?(srcfile(path))
   end
-  
+
   def srcfile?(path)
     File.file?(srcfile(path))
   end
@@ -826,7 +826,7 @@ class ToplevelInstaller
       __send__ "exec_#{task}"
     end
   end
-  
+
   def run_metaconfigs
     @config.load_script "#{@ardir}/metaconfig"
   end
@@ -1404,7 +1404,7 @@ class Installer
   end
 
   # picked up many entries from cvs-1.11.1/src/ignore.c
-  JUNK_FILES = %w( 
+  JUNK_FILES = %w(
     core RCSLOG tags TAGS .make.state
     .nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
     *~ *.old *.bak *.BAK *.orig *.rej _$* *$
index c94d426..5749fda 100755 (executable)
@@ -29,7 +29,7 @@ enum Numberz
 }
 
 /** This is how you would do a typedef doc */
-typedef i64 UserId 
+typedef i64 UserId
 
 /** And this is where you would document a struct */
 struct Xtruct
@@ -68,7 +68,7 @@ struct Insanity
   1: map<Numberz, UserId> userMap,
 
   /** And this is doc for field 2 */
-  2: list<Xtruct> xtructs 
+  2: list<Xtruct> xtructs
 }
 
 exception Xception {
@@ -80,7 +80,7 @@ exception Xception2 {
   1: i32 errorCode,
   2: Xtruct struct_thing
 }
+
 /* C1 */
 /** Doc */
 /* C2 */
index f6a8699..b27612b 100755 (executable)
@@ -104,7 +104,7 @@ def checkRead(o):
   o.write(prot)
 
   slow_version_binary = prot.trans.getvalue()
-  
+
   prot = TBinaryProtocol.TBinaryProtocolAccelerated(
            TTransport.TMemoryBuffer(slow_version_binary))
   c = o.__class__()
index 58357fe..bded87a 100644 (file)
@@ -24,7 +24,7 @@ const Hello WHOA = {'simple' : 532}
 exception Goodbye {
   1: i32 simple,
   2: map<i32,i32> complex,
-  3: map<i32, map<i32,i32>> complexer,  
+  3: map<i32, map<i32,i32>> complexer,
 }
 
 service SmallService {
index 9eb1dce..fa412aa 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for Thrift test project.
-# 
+#
 # Author:
 #   Mark Slee <mcslee@facebook.com>
 
@@ -44,7 +44,7 @@ stubs: ../ThriftTest.thrift
        $(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
index c2efb1a..9b350b0 100644 (file)
@@ -25,7 +25,7 @@ uint64_t now()
 {
   long long ret;
   struct timeval tv;
-  
+
   gettimeofday(&tv, NULL);
   ret = tv.tv_sec;
   ret = ret*1000*1000 + tv.tv_usec;
@@ -63,7 +63,7 @@ int main(int argc, char** argv) {
   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 @@ int main(int argc, char** argv) {
   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 @@ int main(int argc, char** argv) {
       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 @@ int main(int argc, char** argv) {
     } catch (TApplicationException tax) {
       printf("%s\n", tax.what());
     }
-    
+
     /**
      * STRING TEST
      */
@@ -120,14 +120,14 @@ int main(int argc, char** argv) {
     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 @@ int main(int argc, char** argv) {
     printf("testDouble(-5.2098523)");
     double dub = testClient.testDouble(-5.2098523);
     printf(" = %lf\n", dub);
-    
+
     /**
      * STRUCT TEST
      */
@@ -165,7 +165,7 @@ int main(int argc, char** argv) {
            (int)in.byte_thing,
            in.i32_thing,
            in.i64_thing);
-    
+
     /**
      * NESTED STRUCT TEST
      */
@@ -183,7 +183,7 @@ int main(int argc, char** argv) {
            (int)in.byte_thing,
            in.i32_thing,
            in.i64_thing,
-           in2.i32_thing);   
+           in2.i32_thing);
 
     /**
      * MAP TEST
@@ -387,11 +387,11 @@ int main(int argc, char** argv) {
       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 @@ int main(int argc, char** argv) {
     } catch(...) {
       printf("  exception\nFAILURE\n");
     }
-    
+
     /* test multi exception */
-    
+
     try {
       printf("testClient.testMultiException(\"Xception\", \"test 1\") =>");
       Xtruct result;
@@ -416,11 +416,11 @@ int main(int argc, char** argv) {
       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 @@ int main(int argc, char** argv) {
     } 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;
index 3afc955..773225e 100644 (file)
@@ -146,7 +146,7 @@ class TestHandler : public ThriftTestIf {
 
   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 @@ class TestHandler : public ThriftTestIf {
     }
     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 @@ class TestHandler : public ThriftTestIf {
       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 @@ int main(int argc, char **argv) {
     "\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 @@ int main(int argc, char **argv) {
     }
 
     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 @@ int main(int argc, char **argv) {
       } else {
        throw invalid_argument("Unknown protocol type "+protocolType);
       }
-    } 
+    }
 
     if (!args["workers"].empty()) {
       workerCount = atoi(args["workers"].c_str());
@@ -379,7 +379,7 @@ int main(int argc, char **argv) {
     threadPoolServer.serve();
 
   } else if (serverType == "threaded") {
-    
+
     TThreadedServer threadedServer(testProcessor,
                                    serverSocket,
                                    transportFactory,
index 160ca8f..78491d6 100644 (file)
@@ -49,8 +49,8 @@ struct ltstr {
 };
 
 
-// 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 @@ public:
 
   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 @@ public:
     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 @@ public:
       assert(result == arg);
     }
   }
-  
+
   void loopEchoI32() {
     for (size_t ix = 0; ix < _loopCount; ix++) {
       int32_t arg = 1;
@@ -175,7 +175,7 @@ public:
       assert(result == arg);
     }
   }
-    
+
   void loopEchoString() {
     for (size_t ix = 0; ix < _loopCount; ix++) {
       string arg = "hello";
@@ -184,7 +184,7 @@ public:
       assert(result == arg);
     }
   }
-  
+
   shared_ptr<TTransport> _transport;
   shared_ptr<ServiceClient> _client;
   Monitor& _monitor;
@@ -228,10 +228,10 @@ int main(int argc, char **argv) {
     "\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 @@ int main(int argc, char **argv) {
       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 @@ int main(int argc, char **argv) {
 
     if (!args["server-type"].empty()) {
       serverType = args["server-type"];
-      
+
       if (serverType == "simple") {
 
       } else if (serverType == "thread-pool") {
@@ -298,7 +298,7 @@ int main(int argc, char **argv) {
 
       } else {
 
-       throw invalid_argument("Unknown server type "+serverType);
+        throw invalid_argument("Unknown server type "+serverType);
       }
     }
 
@@ -319,7 +319,7 @@ int main(int argc, char **argv) {
   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 @@ int main(int argc, char **argv) {
                                  protocolFactory,
                                  fileTransport);
 
-    fileProcessor.process(0, true);                                     
+    fileProcessor.process(0, true);
     exit(0);
   }
 
@@ -356,34 +356,34 @@ int main(int argc, char **argv) {
       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 @@ int main(int argc, char **argv) {
     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) {
index 10e5929..fa9c8e7 100644 (file)
@@ -26,4 +26,4 @@ main = do to <- topen t
           print =<< testSet ps (Set.fromList [1,2,3,4,5])
           print =<< testStruct ps (Xtruct (Just "hi") (Just 4) (Just 5) Nothing)
           tclose to
-          
+
index 0d01be9..5a844a3 100644 (file)
@@ -24,7 +24,7 @@ public class TestServer {
   public static class TestHandler implements ThriftTest.Iface {
 
     public TestHandler() {}
-  
+
     public void testVoid() {
       System.out.print("testVoid()\n");
     }
@@ -53,7 +53,7 @@ public class TestServer {
       System.out.print("testDouble(" + thing + ")\n");
       return thing;
     }
-  
+
     public Xtruct testStruct(Xtruct thing) {
       System.out.print("testStruct({" +
                        "\"" + thing.string_thing + "\", " +
@@ -62,7 +62,7 @@ public class TestServer {
                        thing.i64_thing + "})\n");
       return thing;
     }
-  
+
     public Xtruct2 testNest(Xtruct2 nest) {
       Xtruct thing = nest.struct_thing;
       System.out.print("testNest({" +
@@ -74,7 +74,7 @@ public class TestServer {
                        nest.i32_thing + "})\n");
       return nest;
     }
-  
+
     public AbstractMap<Integer,Integer> testMap(AbstractMap<Integer,Integer> thing) {
       System.out.print("testMap({");
       boolean first = true;
@@ -150,7 +150,7 @@ public class TestServer {
 
     public AbstractMap<Long, AbstractMap<Integer,Insanity>> testInsanity(Insanity argument) {
       System.out.print("testInsanity()\n");
-    
+
       Xtruct hello = new Xtruct();
       hello.string_thing = "Hello2";
       hello.byte_thing = 2;
@@ -192,7 +192,7 @@ public class TestServer {
 
     public Xtruct testMulti(byte arg0, int arg1, long arg2, AbstractMap<Short,String> arg3, int arg4, long arg5) {
       System.out.print("testMulti()\n");
-    
+
       Xtruct hello = new Xtruct();;
       hello.string_thing = "Hello2";
       hello.byte_thing = arg0;
@@ -226,7 +226,7 @@ public class TestServer {
         x.struct_thing.string_thing = "This is an Xception2";
         throw x;
       }
-     
+
       Xtruct result = new Xtruct();
       result.string_thing = arg1;
       return result;
@@ -240,7 +240,7 @@ public class TestServer {
       if (args.length > 1) {
         port = Integer.valueOf(args[0]);
       }
-      
+
       // Processor
       TestHandler testHandler =
         new TestHandler();
index afcd789..3768f5d 100644 (file)
@@ -24,7 +24,7 @@ object (self)
   method testList x = p "testList(---)\n"; (sod x)
   method testEnum x = p "testEnum(---)\n"; (sod x)
   method testTypedef x = p "testTypedef(---)\n"; (sod x)
-  method testMapMap x = p "testMapMap(%d)\n" (sod x); 
+  method testMapMap x = p "testMapMap(%d)\n" (sod x);
     let mm = Hashtbl.create 3 in
     let pos = Hashtbl.create 7 in
     let neg = Hashtbl.create 7 in
@@ -63,7 +63,7 @@ object (self)
       Hashtbl.add insane 1L firstmap;
       Hashtbl.add insane 2L secondmap;
       insane
-  method testMulti a0 a1 a2 a3 a4 a5 = 
+  method testMulti a0 a1 a2 a3 a4 a5 =
     p "testMulti()\n";
     let hello = new xtruct in
       hello#set_string_thing "Hello2";
@@ -103,13 +103,13 @@ let h = new test_handler in
 let proc = new ThriftTest.processor h in
 let port = 9090 in
 let pf = new TBinaryProtocol.factory in
-let server = new TThreadedServer.t 
-  proc 
-  (new TServerSocket.t port) 
-  (new Transport.factory) 
-  pf 
-  pf 
+let server = new TThreadedServer.t
+  proc
+  (new TServerSocket.t port)
+  (new Transport.factory)
+  pf
+  pf
 in
   server#serve
-                                             
-                                 
+
+
index 0e99a73..128bbe8 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for Thrift test project.
-# 
+#
 # Author:
 #   Mark Slee <mcslee@facebook.com>
 
index b4b2718..2049663 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for Thrift test project.
-# 
+#
 # Author:
 #   Mark Slee <mcslee@facebook.com>
 
index 0f5c46f..21f4531 100644 (file)
@@ -7,7 +7,7 @@ import signal
 
 serverproc = subprocess.Popen([sys.executable, "TestServer.py"])
 try:
-    
+
     ret = subprocess.call([sys.executable, "TestClient.py"])
     if ret != 0:
         raise Exception("subprocess failed")
index 63ec1d0..7e58dfe 100755 (executable)
@@ -15,7 +15,7 @@ from optparse import OptionParser
 
 
 parser = OptionParser()
-    
+
 parser.add_option("--port", type="int", dest="port", default=9090)
 parser.add_option("--host", type="string", dest="host", default='localhost')
 parser.add_option("--framed-input", action="store_true", dest="framed_input")
@@ -24,12 +24,12 @@ parser.add_option("--framed-output", action="store_false", dest="framed_output")
 (options, args) = parser.parse_args()
 
 class AbstractTest(unittest.TestCase):
-  
+
   def setUp(self):
     global options
-    
+
     socket = TSocket.TSocket(options.host, options.port)
-    
+
     # Frame or buffer depending upon args
     if options.framed_input or options.framed_output:
       self.transport = TTransport.TFramedTransport(socket, options.framed_input, options.framed_output)
@@ -37,17 +37,17 @@ class AbstractTest(unittest.TestCase):
       self.transport = TTransport.TBufferedTransport(socket)
 
     self.transport.open()
-    
+
     protocol = self.protocol_factory.getProtocol(self.transport)
     self.client = ThriftTest.Client(protocol)
-    
+
   def tearDown(self):
     # Close!
     self.transport.close()
 
   def testVoid(self):
     self.client.testVoid()
-    
+
   def testString(self):
     self.assertEqual(self.client.testString('Python'), 'Python')
 
index 6cd9f58..94a81c0 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-import sys, glob 
+import sys, glob
 sys.path.insert(0, './gen-py')
 sys.path.insert(0, glob.glob('../../lib/py/build/lib.*')[0])
 
index 7cbdf5c..b693d18 100755 (executable)
@@ -31,7 +31,7 @@ class TimeoutTest(unittest.TestCase):
 
     def testConnectTimeout(self):
         starttime = time.time()
-        
+
         try:
             leaky = []
             for i in xrange(100):
@@ -44,7 +44,7 @@ class TimeoutTest(unittest.TestCase):
 
     def testWriteTimeout(self):
         starttime = time.time()
-        
+
         try:
             socket = TSocket.TSocket('localhost', self.port)
             socket.setTimeout(10)
@@ -52,10 +52,10 @@ class TimeoutTest(unittest.TestCase):
             lsock = self.listen_sock.accept()
             while True:
                 socket.write("hi" * 100)
-            
+
         except:
             assert time.time() - starttime < 5.0
-            
+
 suite = unittest.TestSuite()
 loader = unittest.TestLoader()
 
index 5ea5305..502a981 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for Thrift test project.
-# 
+#
 # Author:
 #   Mark Slee <mcslee@facebook.com>
 
index 9ac287a..277b54c 100644 (file)
@@ -14,7 +14,7 @@ class TestSmallService < Test::Unit::TestCase
 
     assert_kind_of(Hello, hello)
     assert_nil(hello.complexer)
-    
+
     assert_equal(hello.simple, 53)
     assert_equal(hello.words, 'words')
 
index 2b59fa9..e35e808 100644 (file)
@@ -126,7 +126,7 @@ class TestThrift < Test::Unit::TestCase
   def test_insane
     insane = Thrift::Test::Insanity.new({
       'userMap' => { Thrift::Test::Numberz::ONE => 44 },
-      'xtructs' => [get_struct, 
+      'xtructs' => [get_struct,
         Thrift::Test::Xtruct.new({
           'string_thing' => 'hi again',
           'i32_thing' => 12
index 58aebef..58cdf18 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for Thrift test project.
-# 
+#
 # Author:
 #   Mark Slee <mcslee@facebook.com>
 
index a293cfb..826bbdb 100644 (file)
@@ -90,13 +90,13 @@ int main(int argc, char **argv) {
   shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
 
   /*
-  shared_ptr<ThreadManager> threadManager = 
+  shared_ptr<ThreadManager> threadManager =
     ThreadManager::newSimpleThreadManager(10);
   shared_ptr<PosixThreadFactory> threadFactory =
     shared_ptr<PosixThreadFactory>(new PosixThreadFactory());
   threadManager->threadFactory(threadFactory);
   threadManager->start();
+
   shared_ptr<TServer> server =
     shared_ptr<TServer>(new TThreadPoolServer(processor,
                                               serverTransport,
index cff0589..bb0968a 100644 (file)
--- a/thrift.el
+++ b/thrift.el
@@ -92,7 +92,7 @@
     (modify-syntax-entry ?\n "> b" thrift-mode-syntax-table)
     thrift-mode-syntax-table)
   "Syntax table for thrift-mode")
+
 (defun thrift-mode ()
   "Mode for editing Thrift files"
   (interactive)
index b971160..a21125b 100644 (file)
@@ -26,10 +26,10 @@ int main(int argc, char** argv) {
 
   try {
     transport->open();
-    
+
     client.ping();
     printf("ping()\n");
-    
+
     int32_t sum = client.add(1,1);
     printf("1+1=%d\n", sum);
 
@@ -50,7 +50,7 @@ int main(int argc, char** argv) {
     work.num2 = 10;
     int32_t diff = client.calculate(1, work);
     printf("15-10=%d\n", diff);
-    
+
     // Note that C++ uses return by reference for complex types to avoid
     // costly copy construction
     SharedStruct ss;
index 6667d6f..753f0c6 100644 (file)
@@ -17,8 +17,8 @@ import java.util.ArrayList;
 public class JavaClient {
   public static void main(String [] args) {
     try {
-   
-      TTransport transport = new TSocket("localhost", 9090); 
+
+      TTransport transport = new TSocket("localhost", 9090);
       TProtocol protocol = new TBinaryProtocol(transport);
       Calculator.Client client = new Calculator.Client(protocol);
 
@@ -51,12 +51,12 @@ public class JavaClient {
       } catch (InvalidOperation io) {
         System.out.println("Invalid operation: " + io.why);
       }
-      
+
       SharedStruct log = client.getStruct(1);
       System.out.println("Check log: " + log.value);
 
       transport.close();
-                  
+
     } catch (TException x) {
       x.printStackTrace();
     }
index fdd12ac..dc36f6d 100755 (executable)
@@ -29,17 +29,17 @@ try {
   $transport = new TBufferedTransport($socket, 1024, 1024);
   $protocol = new TBinaryProtocol($transport);
   $client = new CalculatorClient($protocol);
-  
+
   $transport->open();
-  
+
   $client->ping();
   print "ping()\n";
+
   $sum = $client->add(1,1);
   print "1+1=$sum\n";
-  
+
   $work = new tutorial_Work();
-  
+
   $work->op = tutorial_Operation::DIVIDE;
   $work->num1 = 1;
   $work->num2 = 0;
@@ -50,18 +50,18 @@ try {
   } catch (tutorial_InvalidOperation $io) {
     print "InvalidOperation: $io->why\n";
   }
-  
+
   $work->op = tutorial_Operation::SUBTRACT;
   $work->num1 = 15;
   $work->num2 = 10;
   $diff = $client->calculate(1, $work);
   print "15-10=$diff\n";
-  
+
   $log = $client->getStruct(1);
   print "Log: $log->value\n";
-  
+
   $transport->close();
-  
+
 } catch (TException $tx) {
   print 'TException: '.$tx->getMessage()."\n";
 }
index 9dcecd9..05f1719 100755 (executable)
@@ -35,7 +35,7 @@ try:
   print '1+1=%d' % (sum)
 
   work = Work()
-  
+
   work.op = Operation.DIVIDE
   work.num1 = 1
   work.num2 = 0
@@ -45,11 +45,11 @@ try:
     print 'Whoa? You know how to divide by zero?'
   except InvalidOperation, io:
     print 'InvalidOperation: %s' % (io.__str__())
-    
+
   work.op = Operation.SUBTRACT
   work.num1 = 15
   work.num2 = 10
-    
+
   diff = client.calculate(1, work)
   print '15-10=%d' % (diff)
 
index 3324bbd..111c44e 100755 (executable)
@@ -16,7 +16,7 @@ from thrift.server import TServer
 class CalculatorHandler:
   def __init__(self):
     self.log = {}
-    
+
   def ping(self):
     print 'ping()'
 
@@ -26,7 +26,7 @@ class CalculatorHandler:
 
   def calculate(self, logid, work):
     print 'calculate(%d, %s)' % (logid, work.__str__())
-    
+
     if work.op == Operation.ADD:
       val = work.num1 + work.num2
     elif work.op == Operation.SUBTRACT:
@@ -59,7 +59,7 @@ class CalculatorHandler:
 
   def zip(self):
     print 'zip()'
-    
+
 handler = CalculatorHandler()
 processor = Calculator.Processor(handler)
 transport = TSocket.TServerSocket(9090)
index 9ee6e79..d40ff49 100755 (executable)
@@ -9,7 +9,7 @@ require 'Calculator'
 
 begin
   port = ARGV[0] || 9090
-  
+
   transport = TBufferedTransport.new(TSocket.new('localhost', port))
   protocol = TBinaryProtocol.new(transport)
   client = Calculator::Client.new(protocol)
index f5e5836..323c96a 100755 (executable)
@@ -98,7 +98,7 @@ exception InvalidOperation {
  * and can optionally inherit from another service using the extends keyword.
  */
 service Calculator extends shared.SharedService {
-  
+
   /**
    * A method definition looks like C code. It has a return type, arguments,
    * and optionally a list of exceptions that it may throw. Note that argument