From 0c90f6f8af1d64ec9272bb2f6092336f3d0b8df8 Mon Sep 17 00:00:00 2001 From: David Reiss Date: Wed, 6 Feb 2008 22:18:40 +0000 Subject: [PATCH] Thrift: Whitespace cleanup. Summary: - Expanded tabs to spaces where spaces were the norm. - Deleted almost all trailing whitespace. - Added newlines to the ends of a few files. - Ran dos2unix on one file or two. Reviewed By: mcslee Test Plan: git diff -b Revert Plan: ok git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665467 13f79535-47bb-0310-9956-ffa450edef68 --- COPYING | 2 +- LICENSE | 2 +- bootstrap.sh | 4 +- compiler/cpp/src/generate/t_cocoa_generator.h | 14 +-- .../cpp/src/generate/t_csharp_generator.cc | 14 +-- compiler/cpp/src/generate/t_hs_generator.cc | 86 ++++++------- compiler/cpp/src/generate/t_hs_generator.h | 6 +- compiler/cpp/src/generate/t_java_generator.h | 10 +- .../cpp/src/generate/t_ocaml_generator.cc | 110 ++++++++--------- compiler/cpp/src/generate/t_ocaml_generator.h | 6 +- compiler/cpp/src/generate/t_perl_generator.h | 2 +- compiler/cpp/src/generate/t_py_generator.cc | 2 +- compiler/cpp/src/generate/t_rb_generator.h | 20 +-- compiler/cpp/src/generate/t_st_generator.cc | 2 +- compiler/cpp/src/generate/t_xsd_generator.cc | 18 +-- compiler/cpp/src/parse/t_const_value.h | 2 +- compiler/cpp/src/parse/t_doc.h | 6 +- compiler/cpp/src/parse/t_enum_value.h | 8 +- compiler/cpp/src/parse/t_list.h | 2 +- compiler/cpp/src/parse/t_scope.h | 6 +- compiler/cpp/src/platform.h | 44 +++---- doc/thrift.tex | 90 +++++++------- lib/cocoa/src/TApplicationException.m | 6 +- lib/cocoa/src/TException.m | 2 +- lib/cocoa/src/protocol/TBinaryProtocol.h | 4 +- lib/cocoa/src/protocol/TBinaryProtocol.m | 14 +-- lib/cocoa/src/server/TSocketServer.h | 2 +- lib/cocoa/src/server/TSocketServer.m | 22 ++-- lib/cocoa/src/transport/THTTPClient.h | 2 +- lib/cocoa/src/transport/THTTPClient.m | 16 +-- .../src/transport/TNSFileHandleTransport.m | 12 +- lib/cocoa/src/transport/TNSStreamTransport.m | 2 +- lib/cocoa/src/transport/TSocketClient.m | 6 +- lib/cpp/Makefile.am | 10 +- lib/cpp/src/TLogging.h | 24 ++-- lib/cpp/src/TProcessor.h | 2 +- lib/cpp/src/Thrift.cpp | 2 +- lib/cpp/src/Thrift.h | 2 +- lib/cpp/src/concurrency/Exception.h | 8 +- lib/cpp/src/concurrency/Mutex.cpp | 8 +- lib/cpp/src/concurrency/Mutex.h | 16 +-- lib/cpp/src/concurrency/TimerManager.cpp | 38 +++--- lib/cpp/src/concurrency/TimerManager.h | 20 +-- lib/cpp/src/concurrency/Util.h | 6 +- .../src/concurrency/test/TimerManagerTests.h | 20 +-- lib/cpp/src/processor/PeekProcessor.cpp | 8 +- lib/cpp/src/processor/PeekProcessor.h | 8 +- lib/cpp/src/processor/StatsProcessor.h | 10 +- lib/cpp/src/protocol/TBinaryProtocol.cpp | 16 +-- lib/cpp/src/protocol/TBinaryProtocol.h | 10 +- lib/cpp/src/protocol/TDebugProtocol.cpp | 12 +- lib/cpp/src/protocol/TDebugProtocol.h | 6 +- lib/cpp/src/protocol/TDenseProtocol.h | 2 +- lib/cpp/src/protocol/TOneWayProtocol.h | 8 +- lib/cpp/src/protocol/TProtocol.h | 18 +-- lib/cpp/src/protocol/TProtocolException.h | 8 +- lib/cpp/src/transport/TFileTransport.h | 40 +++--- lib/cpp/src/transport/THttpClient.cpp | 14 +-- lib/cpp/src/transport/THttpClient.h | 8 +- lib/cpp/src/transport/TServerSocket.h | 2 +- lib/cpp/src/transport/TServerTransport.h | 2 +- lib/cpp/src/transport/TSocketPool.cpp | 2 +- lib/cpp/src/transport/TSocketPool.h | 2 +- lib/cpp/src/transport/TTransport.h | 10 +- lib/cpp/src/transport/TTransportException.cpp | 2 +- lib/cpp/src/transport/TTransportException.h | 8 +- lib/cpp/src/transport/TTransportUtils.cpp | 26 ++-- lib/cpp/src/transport/TZlibTransport.cpp | 2 +- lib/cpp/src/transport/TZlibTransport.h | 6 +- .../Properties/AssemblyInfo.cs | 10 +- .../ThriftMSBuildTask.csproj | 4 +- lib/csharp/src/Protocol/TBinaryProtocol.cs | 2 +- lib/csharp/src/Protocol/TField.cs | 2 +- lib/csharp/src/Protocol/TList.cs | 2 +- lib/csharp/src/Protocol/TMap.cs | 2 +- lib/csharp/src/Protocol/TMessage.cs | 2 +- lib/csharp/src/Protocol/TMessageType.cs | 2 +- lib/csharp/src/Protocol/TProtocol.cs | 2 +- lib/csharp/src/Protocol/TProtocolFactory.cs | 2 +- lib/csharp/src/Protocol/TProtocolUtil.cs | 2 +- lib/csharp/src/Protocol/TSet.cs | 2 +- lib/csharp/src/Protocol/TStruct.cs | 2 +- lib/csharp/src/Protocol/TType.cs | 2 +- lib/csharp/src/Server/TServer.cs | 2 +- lib/csharp/src/Server/TSimpleServer.cs | 2 +- lib/csharp/src/Server/TThreadPoolServer.cs | 4 +- lib/csharp/src/TApplicationException.cs | 2 +- lib/csharp/src/TProcessor.cs | 2 +- lib/csharp/src/Transport/TServerSocket.cs | 2 +- lib/csharp/src/Transport/TServerTransport.cs | 2 +- lib/csharp/src/Transport/TSocket.cs | 2 +- lib/csharp/src/Transport/TStreamTransport.cs | 2 +- lib/csharp/src/Transport/TTransport.cs | 2 +- .../src/Transport/TTransportException.cs | 2 +- lib/csharp/src/Transport/TTransportFactory.cs | 2 +- lib/erl/COPYING | 2 +- lib/erl/LICENSE | 2 +- lib/erl/build/beamver | 2 +- lib/erl/build/otp.mk | 12 +- lib/erl/build/otp_subdir.mk | 6 +- lib/erl/build/raw_test.mk | 6 +- lib/erl/include/protocol/tBinaryProtocol.hrl | 2 +- .../protocol/tBinaryProtocolFactory.hrl | 2 +- lib/erl/include/protocol/tProtocol.hrl | 2 +- lib/erl/include/protocol/tProtocolFactory.hrl | 2 +- lib/erl/include/server/tErlServer.hrl | 2 +- lib/erl/include/server/tServer.hrl | 2 +- lib/erl/include/server/tSimpleServer.hrl | 2 +- lib/erl/include/tErlProcessor.hrl | 2 +- lib/erl/include/tProcessor.hrl | 2 +- .../include/transport/tBufferedTransport.hrl | 2 +- .../transport/tBufferedTransportFactory.hrl | 2 +- lib/erl/include/transport/tErlAcceptor.hrl | 2 +- lib/erl/include/transport/tServerSocket.hrl | 2 +- .../include/transport/tServerTransport.hrl | 2 +- lib/erl/include/transport/tSocket.hrl | 2 +- lib/erl/include/transport/tTransport.hrl | 2 +- .../include/transport/tTransportFactory.hrl | 2 +- lib/erl/src/Makefile | 16 +-- .../src/protocol/tBinaryProtocolFactory.erl | 6 +- lib/erl/src/protocol/tProtocolFactory.erl | 4 +- lib/erl/src/server/tServer.erl | 14 +-- lib/erl/src/server/tSimpleServer.erl | 14 +-- lib/erl/src/tProcessor.erl | 4 +- lib/erl/src/thrift_app.erl | 4 +- lib/erl/src/thrift_app_sup.erl | 2 +- lib/hs/src/TBinaryProtocol.hs | 10 +- lib/hs/src/TChannelTransport.hs | 2 +- lib/hs/src/TServer.hs | 10 +- lib/hs/src/TSocket.hs | 8 +- lib/hs/src/Thrift.hs | 98 +++++++-------- lib/java/COPYING | 2 +- lib/java/LICENSE | 2 +- lib/java/src/TApplicationException.java | 6 +- lib/java/src/TException.java | 2 +- lib/java/src/TProcessorFactory.java | 4 +- lib/java/src/protocol/TBinaryProtocol.java | 6 +- lib/java/src/protocol/TList.java | 2 +- lib/java/src/protocol/TMap.java | 2 +- lib/java/src/protocol/TProtocol.java | 12 +- lib/java/src/protocol/TProtocolUtil.java | 2 +- lib/java/src/reflection/limited/Argument.java | 8 +- .../src/reflection/limited/ContainerType.java | 8 +- lib/java/src/reflection/limited/Method.java | 8 +- lib/java/src/reflection/limited/Service.java | 8 +- .../src/reflection/limited/SimpleType.java | 6 +- .../src/reflection/limited/ThriftType.java | 8 +- lib/java/src/server/TServer.java | 4 +- lib/java/src/server/TSimpleServer.java | 12 +- .../src/transport/TIOStreamTransport.java | 2 +- lib/java/src/transport/TServerSocket.java | 4 +- lib/java/src/transport/TSocket.java | 2 +- lib/ocaml/README | 4 +- lib/ocaml/src/TBinaryProtocol.ml | 8 +- lib/ocaml/src/TChannelTransport.ml | 6 +- lib/ocaml/src/TServer.ml | 2 +- lib/ocaml/src/TServerSocket.ml | 2 +- lib/ocaml/src/TSocket.ml | 24 ++-- lib/ocaml/src/TThreadedServer.ml | 10 +- lib/ocaml/src/Thrift.ml | 88 ++++++------- lib/perl/COPYING | 2 +- lib/perl/LICENSE | 2 +- lib/perl/lib/Thrift/HttpClient.pm | 20 +-- lib/php/COPYING | 2 +- lib/php/LICENSE | 2 +- .../trunk/php_thrift_protocol.cpp | 12 +- lib/php/src/protocol/TBinaryProtocol.php | 28 ++--- lib/py/src/reflection/limited/ttypes.py | 24 ++-- lib/py/src/server/TServer.py | 4 +- lib/py/src/transport/THttpClient.py | 2 +- lib/py/src/transport/TSocket.py | 6 +- lib/rb/COPYING | 2 +- lib/rb/LICENSE | 2 +- lib/rb/lib/thrift/protocol/tbinaryprotocol.rb | 22 ++-- lib/rb/lib/thrift/protocol/tprotocol.rb | 74 +++++------ lib/rb/lib/thrift/server/tserver.rb | 2 +- lib/rb/setup.rb | 8 +- test/DocTest.thrift | 6 +- test/FastbinaryTest.py | 2 +- test/SmallTest.thrift | 2 +- test/cpp/Makefile.thrift | 4 +- test/cpp/src/TestClient.cpp | 38 +++--- test/cpp/src/TestServer.cpp | 18 +-- test/cpp/src/main.cpp | 116 +++++++++--------- test/hs/Client.hs | 2 +- test/java/src/TestServer.java | 16 +-- test/ocaml/server/TestServer.ml | 20 +-- test/perl/Makefile | 2 +- test/py/Makefile | 2 +- test/py/RunClientServer.py | 2 +- test/py/TestClient.py | 14 +-- test/py/TestServer.py | 2 +- test/py/TestSocket.py | 8 +- test/rb/Makefile | 2 +- test/rb/TestSmallService.rb | 2 +- test/rb/TestThrift.rb | 2 +- test/threads/Makefile | 2 +- test/threads/ThreadsServer.cpp | 4 +- thrift.el | 2 +- tutorial/cpp/CppClient.cpp | 6 +- tutorial/java/src/JavaClient.java | 8 +- tutorial/php/PhpClient.php | 18 +-- tutorial/py/PythonClient.py | 6 +- tutorial/py/PythonServer.py | 6 +- tutorial/rb/RubyClient.rb | 2 +- tutorial/tutorial.thrift | 2 +- 206 files changed, 1017 insertions(+), 1017 deletions(-) diff --git a/COPYING b/COPYING index 039f21e3..0101a7dc 100644 --- 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 039f21e3..0101a7dc 100644 --- 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 diff --git a/bootstrap.sh b/bootstrap.sh index 84ea481b..92535fca 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -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 diff --git a/compiler/cpp/src/generate/t_cocoa_generator.h b/compiler/cpp/src/generate/t_cocoa_generator.h index 9ceac31c..79f3007e 100644 --- a/compiler/cpp/src/generate/t_cocoa_generator.h +++ b/compiler/cpp/src/generate/t_cocoa_generator.h @@ -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(); diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/generate/t_csharp_generator.cc index fceec849..676125c6 100644 --- a/compiler/cpp/src/generate/t_csharp_generator.cc +++ b/compiler/cpp/src/generate/t_csharp_generator.cc @@ -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()) { diff --git a/compiler/cpp/src/generate/t_hs_generator.cc b/compiler/cpp/src/generate/t_hs_generator.cc index 6ef7a953..3be56b15 100644 --- a/compiler/cpp/src/generate/t_hs_generator.cc +++ b/compiler/cpp/src/generate/t_hs_generator.cc @@ -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& val = value->get_list(); vector::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& members = tstruct->get_members(); - vector::const_iterator m_iter; + vector::const_iterator m_iter; indent(out) << "data "< 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 <<","<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 functions = tservice->get_functions(); - vector::iterator f_iter; + vector::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 functions = tservice->get_functions(); - vector::const_iterator f_iter; + vector::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 ("<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::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 functions = tservice->get_functions(); - vector::iterator f_iter; + vector::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 0 && !tfunction->is_async()) { for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { indent(f_service_) << "(\\e -> " <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& fields = tfunc->get_arglist()->get_members(); vector::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) { diff --git a/compiler/cpp/src/generate/t_hs_generator.h b/compiler/cpp/src/generate/t_hs_generator.h index bae507ba..facefbea 100644 --- a/compiler/cpp/src/generate/t_hs_generator.h +++ b/compiler/cpp/src/generate/t_hs_generator.h @@ -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); diff --git a/compiler/cpp/src/generate/t_java_generator.h b/compiler/cpp/src/generate/t_java_generator.h index d3b85d5d..fe0a4813 100644 --- a/compiler/cpp/src/generate/t_java_generator.h +++ b/compiler/cpp/src/generate/t_java_generator.h @@ -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(); diff --git a/compiler/cpp/src/generate/t_ocaml_generator.cc b/compiler/cpp/src/generate/t_ocaml_generator.cc index f4f5c4ad..eafda464 100644 --- a/compiler/cpp/src/generate/t_ocaml_generator.cc +++ b/compiler/cpp/src/generate/t_ocaml_generator.cc @@ -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& members = tstruct->get_members(); - vector::const_iterator m_iter; + vector::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& members = tstruct->get_members(); - vector::const_iterator m_iter; + vector::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 <<","< " << "iprot#skip "< functions = tservice->get_functions(); - vector::iterator f_iter; + vector::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 functions = tservice->get_functions(); - vector::const_iterator f_iter; + vector::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& 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::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 functions = tservice->get_functions(); - vector::iterator f_iter; + vector::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" <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 ("<is_list()) { indent(out) << "(let ("< "; + indent(out) << "let "< "; 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("<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& fields = tfunc->get_arglist()->get_members(); vector::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) { diff --git a/compiler/cpp/src/generate/t_ocaml_generator.h b/compiler/cpp/src/generate/t_ocaml_generator.h index 331cf224..56f2a897 100644 --- a/compiler/cpp/src/generate/t_ocaml_generator.h +++ b/compiler/cpp/src/generate/t_ocaml_generator.h @@ -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); diff --git a/compiler/cpp/src/generate/t_perl_generator.h b/compiler/cpp/src/generate/t_perl_generator.h index dcb2e5e3..689cf1ce 100644 --- a/compiler/cpp/src/generate/t_perl_generator.h +++ b/compiler/cpp/src/generate/t_perl_generator.h @@ -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"; } diff --git a/compiler/cpp/src/generate/t_py_generator.cc b/compiler/cpp/src/generate/t_py_generator.cc index ca192ceb..febeafd4 100644 --- a/compiler/cpp/src/generate/t_py_generator.cc +++ b/compiler/cpp/src/generate/t_py_generator.cc @@ -1040,7 +1040,7 @@ void t_py_generator::generate_service_remote(t_service* tservice) { | S_IROTH | S_IXOTH #endif - ); + ); } /** diff --git a/compiler/cpp/src/generate/t_rb_generator.h b/compiler/cpp/src/generate/t_rb_generator.h index d2b7265d..e0463efd 100644 --- a/compiler/cpp/src/generate/t_rb_generator.h +++ b/compiler/cpp/src/generate/t_rb_generator.h @@ -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 ruby_modules(t_program* p) { std::string ns = p->get_ruby_namespace(); boost::tokenizer<> tok(ns); std::vector 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); void end_namespace(std::ofstream&, std::vector); @@ -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_; }; diff --git a/compiler/cpp/src/generate/t_st_generator.cc b/compiler/cpp/src/generate/t_st_generator.cc index fa7d851c..34da15ba 100644 --- a/compiler/cpp/src/generate/t_st_generator.cc +++ b/compiler/cpp/src/generate/t_st_generator.cc @@ -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; diff --git a/compiler/cpp/src/generate/t_xsd_generator.cc b/compiler/cpp/src/generate/t_xsd_generator.cc index 7bab56d1..3b67f1a2 100644 --- a/compiler/cpp/src/generate/t_xsd_generator.cc +++ b/compiler/cpp/src/generate/t_xsd_generator.cc @@ -56,10 +56,10 @@ void t_xsd_generator::generate_typedef(t_typedef* ttypedef) { } void t_xsd_generator::generate_struct(t_struct* tstruct) { - vector::const_iterator m_iter; + vector::const_iterator m_iter; const vector& members = tstruct->get_members(); bool xsd_all = tstruct->get_xsd_all(); - + indent(s_xsd_types_) << "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_) << "" << 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, "" << endl; indent_up(); if (attrs == NULL && ttype->is_void()) { - indent(out) << + indent(out) << "" << endl; } else { indent(out) << "" << endl; - indent_up(); + indent_up(); if (ttype->is_list()) { indent(out) << "" << 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 functions = tservice->get_functions(); - vector::iterator f_iter; + vector::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"; } diff --git a/compiler/cpp/src/parse/t_const_value.h b/compiler/cpp/src/parse/t_const_value.h index fec2acc4..ee658f05 100644 --- a/compiler/cpp/src/parse/t_const_value.h +++ b/compiler/cpp/src/parse/t_const_value.h @@ -75,7 +75,7 @@ class t_const_value { const std::map& get_map() const { return mapVal_; - } + } void set_list() { valType_ = CV_LIST; diff --git a/compiler/cpp/src/parse/t_doc.h b/compiler/cpp/src/parse/t_doc.h index bfa66eff..6bdcc298 100644 --- a/compiler/cpp/src/parse/t_doc.h +++ b/compiler/cpp/src/parse/t_doc.h @@ -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_; diff --git a/compiler/cpp/src/parse/t_enum_value.h b/compiler/cpp/src/parse/t_enum_value.h index aa332c7c..c7326567 100644 --- a/compiler/cpp/src/parse/t_enum_value.h +++ b/compiler/cpp/src/parse/t_enum_value.h @@ -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 diff --git a/compiler/cpp/src/parse/t_list.h b/compiler/cpp/src/parse/t_list.h index 23a006ab..0ff83c51 100644 --- a/compiler/cpp/src/parse/t_list.h +++ b/compiler/cpp/src/parse/t_list.h @@ -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; } diff --git a/compiler/cpp/src/parse/t_scope.h b/compiler/cpp/src/parse/t_scope.h index c97f2d62..e03956e5 100644 --- a/compiler/cpp/src/parse/t_scope.h +++ b/compiler/cpp/src/parse/t_scope.h @@ -59,7 +59,7 @@ class t_scope { } private: - + // Map of names to types std::map types_; @@ -67,8 +67,8 @@ class t_scope { std::map constants_; // Map of names to services - std::map services_; - + std::map services_; + }; #endif diff --git a/compiler/cpp/src/platform.h b/compiler/cpp/src/platform.h index df64e9a3..38a4aa1d 100644 --- a/compiler/cpp/src/platform.h +++ b/compiler/cpp/src/platform.h @@ -1,22 +1,22 @@ -// 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 -#else -#include -#include -#endif - -#if defined MINGW -#define MKDIR(x) mkdir(x) -#else -#define MKDIR(x) mkdir(x, S_IRWXU | S_IRWXG | S_IRWXO) -#endif +// 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 +#else +#include +#include +#endif + +#if defined MINGW +#define MKDIR(x) mkdir(x) +#else +#define MKDIR(x) mkdir(x, S_IRWXU | S_IRWXG | S_IRWXO) +#endif diff --git a/doc/thrift.tex b/doc/thrift.tex index fc1e6ba1..17766b59 100644 --- a/doc/thrift.tex +++ b/doc/thrift.tex @@ -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} 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} 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} diff --git a/lib/cocoa/src/TApplicationException.m b/lib/cocoa/src/TApplicationException.m index bace3606..91870878 100644 --- a/lib/cocoa/src/TApplicationException.m +++ b/lib/cocoa/src/TApplicationException.m @@ -48,21 +48,21 @@ [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; diff --git a/lib/cocoa/src/TException.m b/lib/cocoa/src/TException.m index 33ed7b58..48d90905 100644 --- a/lib/cocoa/src/TException.m +++ b/lib/cocoa/src/TException.m @@ -37,7 +37,7 @@ if ([self userInfo] != nil) { [result appendFormat: @"\n userInfo = %@", [self userInfo]]; } - + return result; } diff --git a/lib/cocoa/src/protocol/TBinaryProtocol.h b/lib/cocoa/src/protocol/TBinaryProtocol.h index 7e288fa0..975af97b 100644 --- a/lib/cocoa/src/protocol/TBinaryProtocol.h +++ b/lib/cocoa/src/protocol/TBinaryProtocol.h @@ -12,7 +12,7 @@ - (id) initWithTransport: (id ) transport; -- (id) initWithTransport: (id ) transport +- (id) initWithTransport: (id ) transport strictRead: (BOOL) strictRead strictWrite: (BOOL) strictWrite; @@ -29,4 +29,4 @@ - (TBinaryProtocol *) newProtocolOnTransport: (id ) transport; -@end \ No newline at end of file +@end diff --git a/lib/cocoa/src/protocol/TBinaryProtocol.m b/lib/cocoa/src/protocol/TBinaryProtocol.m index 7564f5de..e1961388 100644 --- a/lib/cocoa/src/protocol/TBinaryProtocol.m +++ b/lib/cocoa/src/protocol/TBinaryProtocol.m @@ -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 ) transport +- (id) initWithTransport: (id ) 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]]; diff --git a/lib/cocoa/src/server/TSocketServer.h b/lib/cocoa/src/server/TSocketServer.h index 4b8e8d07..2ab21c72 100644 --- a/lib/cocoa/src/server/TSocketServer.h +++ b/lib/cocoa/src/server/TSocketServer.h @@ -7,7 +7,7 @@ NSSocketPort * mServerSocket; NSFileHandle * mSocketFileHandle; id mInputProtocolFactory; - id mOutputProtocolFactory; + id mOutputProtocolFactory; id mProcessor; } diff --git a/lib/cocoa/src/server/TSocketServer.m b/lib/cocoa/src/server/TSocketServer.m index d9d24e11..1108428c 100644 --- a/lib/cocoa/src/server/TSocketServer.m +++ b/lib/cocoa/src/server/TSocketServer.m @@ -16,12 +16,12 @@ 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 { @@ -30,17 +30,17 @@ // 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; } @@ -58,12 +58,12 @@ - (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]; } @@ -76,14 +76,14 @@ id inProtocol = [mInputProtocolFactory newProtocolOnTransport: transport]; id outProtocol = [mOutputProtocolFactory newProtocolOnTransport: transport]; - + @try { while ([mProcessor processOnInputProtocol: inProtocol outputProtocol: outProtocol]); } @catch (TTransportException * te) { NSLog(@"%@", te); } - + [pool release]; } diff --git a/lib/cocoa/src/transport/THTTPClient.h b/lib/cocoa/src/transport/THTTPClient.h index d9ea1a95..0aabb466 100644 --- a/lib/cocoa/src/transport/THTTPClient.h +++ b/lib/cocoa/src/transport/THTTPClient.h @@ -13,7 +13,7 @@ - (id) initWithURL: (NSURL *) aURL; -- (id) initWithURL: (NSURL *) aURL +- (id) initWithURL: (NSURL *) aURL userAgent: (NSString *) userAgent timeout: (int) timeout; diff --git a/lib/cocoa/src/transport/THTTPClient.m b/lib/cocoa/src/transport/THTTPClient.m index f5186e20..4bad09cf 100644 --- a/lib/cocoa/src/transport/THTTPClient.m +++ b/lib/cocoa/src/transport/THTTPClient.m @@ -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]; } @@ -108,7 +108,7 @@ // make the HTTP request NSURLResponse * response; NSError * error; - NSData * responseData = + NSData * responseData = [NSURLConnection sendSynchronousRequest: mRequest returningResponse: &response error: &error]; [mRequestData setLength: 0]; @@ -126,10 +126,10 @@ 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]; diff --git a/lib/cocoa/src/transport/TNSFileHandleTransport.m b/lib/cocoa/src/transport/TNSFileHandleTransport.m index 79a9e8d9..c97b6c9e 100644 --- a/lib/cocoa/src/transport/TNSFileHandleTransport.m +++ b/lib/cocoa/src/transport/TNSFileHandleTransport.m @@ -16,10 +16,10 @@ outputFileHandle: (NSFileHandle *) outputFileHandle { self = [super init]; - + mInputFileHandle = [inputFileHandle retain]; mOutputFileHandle = [outputFileHandle retain]; - + return self; } @@ -49,16 +49,16 @@ - (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 { diff --git a/lib/cocoa/src/transport/TNSStreamTransport.m b/lib/cocoa/src/transport/TNSStreamTransport.m index 42a197e1..92da5b3a 100644 --- a/lib/cocoa/src/transport/TNSStreamTransport.m +++ b/lib/cocoa/src/transport/TNSStreamTransport.m @@ -51,7 +51,7 @@ } else if (result != length) { @throw [TTransportException exceptionWithReason: @"Output stream did not write all of our data."]; } -} +} - (void) flush { diff --git a/lib/cocoa/src/transport/TSocketClient.m b/lib/cocoa/src/transport/TSocketClient.m index e8ae6e9e..e3da164e 100644 --- a/lib/cocoa/src/transport/TSocketClient.m +++ b/lib/cocoa/src/transport/TSocketClient.m @@ -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; } diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am index 92ccf994..9da970d7 100644 --- a/lib/cpp/Makefile.am +++ b/lib/cpp/Makefile.am @@ -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 diff --git a/lib/cpp/src/TLogging.h b/lib/cpp/src/TLogging.h index 4d3060d8..6fb74840 100644 --- a/lib/cpp/src/TLogging.h +++ b/lib/cpp/src/TLogging.h @@ -29,37 +29,37 @@ /** * T_GLOBAL_DEBUGGING_LEVEL = 0: all debugging turned off, debug macros undefined - * T_GLOBAL_DEBUGGING_LEVEL = 1: all debugging turned on + * T_GLOBAL_DEBUGGING_LEVEL = 1: all debugging turned on */ #define T_GLOBAL_DEBUGGING_LEVEL 0 /** * T_GLOBAL_LOGGING_LEVEL = 0: all logging turned off, logging macros undefined - * T_GLOBAL_LOGGING_LEVEL = 1: all logging turned on + * T_GLOBAL_LOGGING_LEVEL = 1: all logging turned on */ #define T_GLOBAL_LOGGING_LEVEL 1 -/** +/** * Standard wrapper around fprintf what will prefix the file name and line * number to the line. Uses T_GLOBAL_DEBUGGING_LEVEL to control whether it is * turned on or off. * - * @param format_string + * @param format_string */ #if T_GLOBAL_DEBUGGING_LEVEL > 0 #define T_DEBUG(format_string,...) \ if (T_GLOBAL_DEBUGGING_LEVEL > 0) { \ fprintf(stderr,"[%s,%d] " #format_string " \n", __FILE__, __LINE__,##__VA_ARGS__); \ - } + } #else #define T_DEBUG(format_string,...) #endif -/** - * analagous to T_DEBUG but also prints the time +/** + * analagous to T_DEBUG but also prints the time * * @param string format_string input: printf style format string */ @@ -80,7 +80,7 @@ #endif -/** +/** * analagous to T_DEBUG but uses input level to determine whether or not the string * should be logged. * @@ -93,7 +93,7 @@ } -/** +/** * Explicit error logging. Prints time, file name and line number * * @param string format_string input: printf style format string @@ -109,7 +109,7 @@ } -/** +/** * Analagous to T_ERROR, additionally aborting the process. * WARNING: macro calls abort(), ending program execution * @@ -127,7 +127,7 @@ } -/** +/** * Log input message * * @param string format_string input: printf style format string @@ -143,7 +143,7 @@ dbgtime[24] = '\0'; \ fprintf(stderr,"[%s] " #format_string " \n", dbgtime,##__VA_ARGS__); \ } \ - } + } #else #define T_LOG_OPER(format_string,...) #endif diff --git a/lib/cpp/src/TProcessor.h b/lib/cpp/src/TProcessor.h index affbe812..cba4a844 100644 --- a/lib/cpp/src/TProcessor.h +++ b/lib/cpp/src/TProcessor.h @@ -11,7 +11,7 @@ #include #include -namespace facebook { namespace thrift { +namespace facebook { namespace thrift { /** * A processor is a generic object that acts upon two streams of data, one diff --git a/lib/cpp/src/Thrift.cpp b/lib/cpp/src/Thrift.cpp index 186c5af4..88890d49 100644 --- a/lib/cpp/src/Thrift.cpp +++ b/lib/cpp/src/Thrift.cpp @@ -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) { diff --git a/lib/cpp/src/Thrift.h b/lib/cpp/src/Thrift.h index 338dbdeb..8e93bb0b 100644 --- a/lib/cpp/src/Thrift.h +++ b/lib/cpp/src/Thrift.h @@ -99,7 +99,7 @@ class TApplicationException : public TException { type_(UNKNOWN) {} TApplicationException(TApplicationExceptionType type) : - TException(), + TException(), type_(type) {} TApplicationException(const std::string& message) : diff --git a/lib/cpp/src/concurrency/Exception.h b/lib/cpp/src/concurrency/Exception.h index 575a3edd..00e26497 100644 --- a/lib/cpp/src/concurrency/Exception.h +++ b/lib/cpp/src/concurrency/Exception.h @@ -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) {} }; diff --git a/lib/cpp/src/concurrency/Mutex.cpp b/lib/cpp/src/concurrency/Mutex.cpp index a0556562..87bfd354 100644 --- a/lib/cpp/src/concurrency/Mutex.cpp +++ b/lib/cpp/src/concurrency/Mutex.cpp @@ -11,9 +11,9 @@ using boost::shared_ptr; -namespace facebook { namespace thrift { namespace concurrency { +namespace facebook { namespace thrift { namespace concurrency { -/** +/** * Implementation of Mutex class using POSIX mutex * * @author marc @@ -54,7 +54,7 @@ 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_; }; diff --git a/lib/cpp/src/concurrency/Mutex.h b/lib/cpp/src/concurrency/Mutex.h index f3c7cd0c..e176628a 100644 --- a/lib/cpp/src/concurrency/Mutex.h +++ b/lib/cpp/src/concurrency/Mutex.h @@ -9,7 +9,7 @@ #include -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);" diff --git a/lib/cpp/src/concurrency/TimerManager.cpp b/lib/cpp/src/concurrency/TimerManager.cpp index 4f77b2f5..e3b7a89f 100644 --- a/lib/cpp/src/concurrency/TimerManager.cpp +++ b/lib/cpp/src/concurrency/TimerManager.cpp @@ -12,7 +12,7 @@ #include #include -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), 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 task = ix->second; @@ -110,17 +110,17 @@ class TimerManager::Dispatcher: public Runnable { manager_->taskMap_.erase(manager_->taskMap_.begin(), expiredTaskEnd); } } - + for (std::set >::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 TimerManager::threadFactory() const { - Synchronized s(monitor_); + Synchronized s(monitor_); return threadFactory_; } - + void TimerManager::threadFactory(shared_ptr value) { - Synchronized s(monitor_); + Synchronized s(monitor_); threadFactory_ = value; } size_t TimerManager::taskCount() const { return taskCount_; } - + void TimerManager::add(shared_ptr 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 task, const struct timespec& value) void TimerManager::remove(shared_ptr task) { - Synchronized s(monitor_); + Synchronized s(monitor_); if (state_ != TimerManager::STARTED) { throw IllegalStateException(); } diff --git a/lib/cpp/src/concurrency/TimerManager.h b/lib/cpp/src/concurrency/TimerManager.h index 86900ce5..6d2eae95 100644 --- a/lib/cpp/src/concurrency/TimerManager.h +++ b/lib/cpp/src/concurrency/TimerManager.h @@ -15,13 +15,13 @@ #include #include -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 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 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: diff --git a/lib/cpp/src/concurrency/Util.h b/lib/cpp/src/concurrency/Util.h index 8a1ead31..3ebc0b14 100644 --- a/lib/cpp/src/concurrency/Util.h +++ b/lib/cpp/src/concurrency/Util.h @@ -17,7 +17,7 @@ #include #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 } diff --git a/lib/cpp/src/concurrency/test/TimerManagerTests.h b/lib/cpp/src/concurrency/test/TimerManagerTests.h index bd959cdd..13e3ef89 100644 --- a/lib/cpp/src/concurrency/test/TimerManagerTests.h +++ b/lib/cpp/src/concurrency/test/TimerManagerTests.h @@ -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(new PosixThreadFactory())); - + timerManager.start(); - + assert(timerManager.state() == TimerManager::STARTED); shared_ptr task = shared_ptr(new TimerManagerTests::Task(_monitor, timeout)); @@ -125,6 +125,6 @@ class TimerManagerTests { }; const double TimerManagerTests::ERROR = .20; - + }}}} // facebook::thrift::concurrency diff --git a/lib/cpp/src/processor/PeekProcessor.cpp b/lib/cpp/src/processor/PeekProcessor.cpp index cff5edd6..d8648059 100644 --- a/lib/cpp/src/processor/PeekProcessor.cpp +++ b/lib/cpp/src/processor/PeekProcessor.cpp @@ -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 targetTrans } } -bool PeekProcessor::process(boost::shared_ptr in, +bool PeekProcessor::process(boost::shared_ptr in, boost::shared_ptr out) { std::string fname; @@ -77,7 +77,7 @@ bool PeekProcessor::process(boost::shared_ptr 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 in, +void PeekProcessor::peek(boost::shared_ptr in, TType ftype, int16_t fid) { in->skip(ftype); diff --git a/lib/cpp/src/processor/PeekProcessor.h b/lib/cpp/src/processor/PeekProcessor.h index 6b8414b5..49e7cd9e 100644 --- a/lib/cpp/src/processor/PeekProcessor.h +++ b/lib/cpp/src/processor/PeekProcessor.h @@ -13,7 +13,7 @@ #include #include -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 */ 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 targetTransport); - virtual bool process(boost::shared_ptr in, + virtual bool process(boost::shared_ptr in, boost::shared_ptr 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 in, + virtual void peek(boost::shared_ptr in, facebook::thrift::protocol::TType ftype, int16_t fid); virtual void peekEnd(); diff --git a/lib/cpp/src/processor/StatsProcessor.h b/lib/cpp/src/processor/StatsProcessor.h index b1a4e63a..140a1d49 100644 --- a/lib/cpp/src/processor/StatsProcessor.h +++ b/lib/cpp/src/processor/StatsProcessor.h @@ -12,7 +12,7 @@ #include #include -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; diff --git a/lib/cpp/src/protocol/TBinaryProtocol.cpp b/lib/cpp/src/protocol/TBinaryProtocol.cpp index 30bbde62..289d6147 100644 --- a/lib/cpp/src/protocol/TBinaryProtocol.cpp +++ b/lib/cpp/src/protocol/TBinaryProtocol.cpp @@ -25,7 +25,7 @@ static inline To bitwise_cast(From from) { //return *reinterpret_cast(&from); // BAD!!! //return *static_cast(static_cast(&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::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) { diff --git a/lib/cpp/src/protocol/TBinaryProtocol.h b/lib/cpp/src/protocol/TBinaryProtocol.h index 89958ec5..c7e2791a 100644 --- a/lib/cpp/src/protocol/TBinaryProtocol.h +++ b/lib/cpp/src/protocol/TBinaryProtocol.h @@ -11,7 +11,7 @@ #include -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, diff --git a/lib/cpp/src/protocol/TDebugProtocol.cpp b/lib/cpp/src/protocol/TDebugProtocol.cpp index 5d28b783..2f23b112 100644 --- a/lib/cpp/src/protocol/TDebugProtocol.cpp +++ b/lib/cpp/src/protocol/TDebugProtocol.cpp @@ -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(i64)); } - + uint32_t TDebugProtocol::writeDouble(const double dub) { return writeItem(boost::lexical_cast(dub)); } - + uint32_t TDebugProtocol::writeString(const string& str) { // XXX Raw/UTF-8? diff --git a/lib/cpp/src/protocol/TDebugProtocol.h b/lib/cpp/src/protocol/TDebugProtocol.h index 0dd60d81..90b7688e 100644 --- a/lib/cpp/src/protocol/TDebugProtocol.h +++ b/lib/cpp/src/protocol/TDebugProtocol.h @@ -14,7 +14,7 @@ #include -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 std::string ThriftDebugString(const ThriftStruct& ts) { diff --git a/lib/cpp/src/protocol/TDenseProtocol.h b/lib/cpp/src/protocol/TDenseProtocol.h index 0902e15f..dae2c18b 100644 --- a/lib/cpp/src/protocol/TDenseProtocol.h +++ b/lib/cpp/src/protocol/TDenseProtocol.h @@ -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. * diff --git a/lib/cpp/src/protocol/TOneWayProtocol.h b/lib/cpp/src/protocol/TOneWayProtocol.h index 635744c8..245f8305 100644 --- a/lib/cpp/src/protocol/TOneWayProtocol.h +++ b/lib/cpp/src/protocol/TOneWayProtocol.h @@ -9,7 +9,7 @@ #include "TProtocol.h" -namespace facebook { namespace thrift { namespace protocol { +namespace facebook { namespace thrift { namespace protocol { /** * Abstract class for implementing a protocol that can only be written, @@ -62,12 +62,12 @@ 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)."); diff --git a/lib/cpp/src/protocol/TProtocol.h b/lib/cpp/src/protocol/TProtocol.h index 7fa3de85..85cc48a9 100644 --- a/lib/cpp/src/protocol/TProtocol.h +++ b/lib/cpp/src/protocol/TProtocol.h @@ -17,7 +17,7 @@ #include #include -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 ptrans_; TTransport* trans_; diff --git a/lib/cpp/src/protocol/TProtocolException.h b/lib/cpp/src/protocol/TProtocolException.h index 4429a623..0532ec55 100644 --- a/lib/cpp/src/protocol/TProtocolException.h +++ b/lib/cpp/src/protocol/TProtocolException.h @@ -10,7 +10,7 @@ #include #include -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 diff --git a/lib/cpp/src/transport/TFileTransport.h b/lib/cpp/src/transport/TFileTransport.h index f249ff91..c4c921e2 100644 --- a/lib/cpp/src/transport/TFileTransport.h +++ b/lib/cpp/src/transport/TFileTransport.h @@ -16,7 +16,7 @@ #include -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 */ 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 @@ -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 outputProtocolFactory, boost::shared_ptr 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 processor, boost::shared_ptr protocolFactory, boost::shared_ptr inputTransport, @@ -414,7 +414,7 @@ class TFileProcessor { * */ void processChunk(); - + private: boost::shared_ptr processor_; boost::shared_ptr inputProtocolFactory_; @@ -423,7 +423,7 @@ class TFileProcessor { boost::shared_ptr outputTransport_; }; - + }}} // facebook::thrift::transport #endif // _THRIFT_TRANSPORT_TFILETRANSPORT_H_ diff --git a/lib/cpp/src/transport/THttpClient.cpp b/lib/cpp/src/transport/THttpClient.cpp index b6d9d9e7..c213ef09 100644 --- a/lib/cpp/src/transport/THttpClient.cpp +++ b/lib/cpp/src/transport/THttpClient.cpp @@ -7,7 +7,7 @@ #include "THttpClient.h" #include "TSocket.h" -namespace facebook { namespace thrift { namespace transport { +namespace facebook { namespace thrift { namespace transport { using namespace std; @@ -148,7 +148,7 @@ 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++) == ' '); diff --git a/lib/cpp/src/transport/THttpClient.h b/lib/cpp/src/transport/THttpClient.h index acfcf1b1..1ae3575c 100644 --- a/lib/cpp/src/transport/THttpClient.h +++ b/lib/cpp/src/transport/THttpClient.h @@ -9,7 +9,7 @@ #include -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: diff --git a/lib/cpp/src/transport/TServerSocket.h b/lib/cpp/src/transport/TServerSocket.h index 8d76fef7..213d9d44 100644 --- a/lib/cpp/src/transport/TServerSocket.h +++ b/lib/cpp/src/transport/TServerSocket.h @@ -10,7 +10,7 @@ #include "TServerTransport.h" #include -namespace facebook { namespace thrift { namespace transport { +namespace facebook { namespace thrift { namespace transport { class TSocket; diff --git a/lib/cpp/src/transport/TServerTransport.h b/lib/cpp/src/transport/TServerTransport.h index 9512372e..b8e6b97d 100644 --- a/lib/cpp/src/transport/TServerTransport.h +++ b/lib/cpp/src/transport/TServerTransport.h @@ -11,7 +11,7 @@ #include "TTransportException.h" #include -namespace facebook { namespace thrift { namespace transport { +namespace facebook { namespace thrift { namespace transport { /** * Server transport framework. A server needs to have some facility for diff --git a/lib/cpp/src/transport/TSocketPool.cpp b/lib/cpp/src/transport/TSocketPool.cpp index b6440fc8..235d060e 100644 --- a/lib/cpp/src/transport/TSocketPool.cpp +++ b/lib/cpp/src/transport/TSocketPool.cpp @@ -9,7 +9,7 @@ #include "TSocketPool.h" -namespace facebook { namespace thrift { namespace transport { +namespace facebook { namespace thrift { namespace transport { using namespace std; diff --git a/lib/cpp/src/transport/TSocketPool.h b/lib/cpp/src/transport/TSocketPool.h index a197c72b..847f67e2 100644 --- a/lib/cpp/src/transport/TSocketPool.h +++ b/lib/cpp/src/transport/TSocketPool.h @@ -10,7 +10,7 @@ #include #include "TSocket.h" -namespace facebook { namespace thrift { namespace transport { +namespace facebook { namespace thrift { namespace transport { /** * TCP Socket implementation of the TTransport interface. diff --git a/lib/cpp/src/transport/TTransport.h b/lib/cpp/src/transport/TTransport.h index 4e3c218b..469acd23 100644 --- a/lib/cpp/src/transport/TTransport.h +++ b/lib/cpp/src/transport/TTransport.h @@ -12,7 +12,7 @@ #include #include -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. * diff --git a/lib/cpp/src/transport/TTransportException.cpp b/lib/cpp/src/transport/TTransportException.cpp index 85b77b84..e6322657 100644 --- a/lib/cpp/src/transport/TTransportException.cpp +++ b/lib/cpp/src/transport/TTransportException.cpp @@ -12,7 +12,7 @@ using std::string; using boost::lexical_cast; -namespace facebook { namespace thrift { namespace transport { +namespace facebook { namespace thrift { namespace transport { string TTransportException::strerror_s(int errno_copy) { #ifndef HAVE_STRERROR_R diff --git a/lib/cpp/src/transport/TTransportException.h b/lib/cpp/src/transport/TTransportException.h index 39c65ddd..73bad805 100644 --- a/lib/cpp/src/transport/TTransportException.h +++ b/lib/cpp/src/transport/TTransportException.h @@ -11,7 +11,7 @@ #include #include -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); diff --git a/lib/cpp/src/transport/TTransportUtils.cpp b/lib/cpp/src/transport/TTransportUtils.cpp index 556d5fa6..e1f37b84 100644 --- a/lib/cpp/src/transport/TTransportUtils.cpp +++ b/lib/cpp/src/transport/TTransportUtils.cpp @@ -8,7 +8,7 @@ using std::string; -namespace facebook { namespace thrift { namespace transport { +namespace facebook { namespace thrift { namespace transport { uint32_t TBufferedTransport::read(uint8_t* buf, uint32_t len) { uint32_t need = len; @@ -20,12 +20,12 @@ 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 srcTrans, boost::shared_ptr dstTrans) +TPipedFileReaderTransport::TPipedFileReaderTransport(boost::shared_ptr srcTrans, boost::shared_ptr 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; } diff --git a/lib/cpp/src/transport/TZlibTransport.cpp b/lib/cpp/src/transport/TZlibTransport.cpp index 27aa350c..c9acc248 100644 --- a/lib/cpp/src/transport/TZlibTransport.cpp +++ b/lib/cpp/src/transport/TZlibTransport.cpp @@ -11,7 +11,7 @@ using std::string; -namespace facebook { namespace thrift { namespace transport { +namespace facebook { namespace thrift { namespace transport { // Don't call this outside of the constructor. void TZlibTransport::initZlib() { diff --git a/lib/cpp/src/transport/TZlibTransport.h b/lib/cpp/src/transport/TZlibTransport.h index dd8ae2f0..c2c18495 100644 --- a/lib/cpp/src/transport/TZlibTransport.h +++ b/lib/cpp/src/transport/TZlibTransport.h @@ -12,7 +12,7 @@ struct z_stream_s; -namespace facebook { namespace thrift { namespace transport { +namespace facebook { namespace thrift { namespace transport { class TZlibTransportException : public TTransportException { public: @@ -135,7 +135,7 @@ 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(); diff --git a/lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs b/lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs index 4375a525..e91a156b 100644 --- a/lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs +++ b/lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs @@ -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")] diff --git a/lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj b/lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj index 68c6bd1a..02110eae 100644 --- a/lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj +++ b/lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj @@ -56,11 +56,11 @@ - - \ No newline at end of file + diff --git a/lib/csharp/src/Protocol/TBinaryProtocol.cs b/lib/csharp/src/Protocol/TBinaryProtocol.cs index c2eb81fc..5df20210 100644 --- a/lib/csharp/src/Protocol/TBinaryProtocol.cs +++ b/lib/csharp/src/Protocol/TBinaryProtocol.cs @@ -2,7 +2,7 @@ // TBinaryProtocol.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // Will Palmeri // diff --git a/lib/csharp/src/Protocol/TField.cs b/lib/csharp/src/Protocol/TField.cs index 93295309..c2942535 100644 --- a/lib/csharp/src/Protocol/TField.cs +++ b/lib/csharp/src/Protocol/TField.cs @@ -2,7 +2,7 @@ // TField.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Protocol/TList.cs b/lib/csharp/src/Protocol/TList.cs index 72056cb8..eb307ce2 100644 --- a/lib/csharp/src/Protocol/TList.cs +++ b/lib/csharp/src/Protocol/TList.cs @@ -2,7 +2,7 @@ // TList.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Protocol/TMap.cs b/lib/csharp/src/Protocol/TMap.cs index 586aa4f6..53c78334 100644 --- a/lib/csharp/src/Protocol/TMap.cs +++ b/lib/csharp/src/Protocol/TMap.cs @@ -2,7 +2,7 @@ // TMap.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Protocol/TMessage.cs b/lib/csharp/src/Protocol/TMessage.cs index a9522ff0..92176f36 100644 --- a/lib/csharp/src/Protocol/TMessage.cs +++ b/lib/csharp/src/Protocol/TMessage.cs @@ -2,7 +2,7 @@ // TMessage.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Protocol/TMessageType.cs b/lib/csharp/src/Protocol/TMessageType.cs index 1cadf314..6e6ead76 100644 --- a/lib/csharp/src/Protocol/TMessageType.cs +++ b/lib/csharp/src/Protocol/TMessageType.cs @@ -2,7 +2,7 @@ // TMessageType.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Protocol/TProtocol.cs b/lib/csharp/src/Protocol/TProtocol.cs index d4b08297..2702ad80 100644 --- a/lib/csharp/src/Protocol/TProtocol.cs +++ b/lib/csharp/src/Protocol/TProtocol.cs @@ -2,7 +2,7 @@ // TProtocol.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Protocol/TProtocolFactory.cs b/lib/csharp/src/Protocol/TProtocolFactory.cs index 5434da91..756bb5e3 100644 --- a/lib/csharp/src/Protocol/TProtocolFactory.cs +++ b/lib/csharp/src/Protocol/TProtocolFactory.cs @@ -2,7 +2,7 @@ // TProtocolFactory.cs // // Begin: Dec 3, 2007 -// Authors: +// Authors: // Will Palmeri // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Protocol/TProtocolUtil.cs b/lib/csharp/src/Protocol/TProtocolUtil.cs index ae5a1078..a65ea0fa 100644 --- a/lib/csharp/src/Protocol/TProtocolUtil.cs +++ b/lib/csharp/src/Protocol/TProtocolUtil.cs @@ -2,7 +2,7 @@ // TProtocolUtil.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Protocol/TSet.cs b/lib/csharp/src/Protocol/TSet.cs index 1f172e47..0dea8cb5 100644 --- a/lib/csharp/src/Protocol/TSet.cs +++ b/lib/csharp/src/Protocol/TSet.cs @@ -2,7 +2,7 @@ // TSet.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Protocol/TStruct.cs b/lib/csharp/src/Protocol/TStruct.cs index 000ebf11..38336957 100644 --- a/lib/csharp/src/Protocol/TStruct.cs +++ b/lib/csharp/src/Protocol/TStruct.cs @@ -2,7 +2,7 @@ // TStruct.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Protocol/TType.cs b/lib/csharp/src/Protocol/TType.cs index 0badb335..257ac6bc 100644 --- a/lib/csharp/src/Protocol/TType.cs +++ b/lib/csharp/src/Protocol/TType.cs @@ -2,7 +2,7 @@ // TType.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Server/TServer.cs b/lib/csharp/src/Server/TServer.cs index 3e70b11e..b168d993 100644 --- a/lib/csharp/src/Server/TServer.cs +++ b/lib/csharp/src/Server/TServer.cs @@ -2,7 +2,7 @@ // TServer.cs // // Begin: Dec 3, 2007 -// Authors: +// Authors: // Will Palmeri // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Server/TSimpleServer.cs b/lib/csharp/src/Server/TSimpleServer.cs index c3461ef8..b2a70fe9 100644 --- a/lib/csharp/src/Server/TSimpleServer.cs +++ b/lib/csharp/src/Server/TSimpleServer.cs @@ -2,7 +2,7 @@ // TSimpleServer.cs // // Begin: Dec 3, 2007 -// Authors: +// Authors: // Will Palmeri // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Server/TThreadPoolServer.cs b/lib/csharp/src/Server/TThreadPoolServer.cs index c42d348a..b62de814 100644 --- a/lib/csharp/src/Server/TThreadPoolServer.cs +++ b/lib/csharp/src/Server/TThreadPoolServer.cs @@ -2,7 +2,7 @@ // TThreadPoolServer.cs // // Begin: Dec 3, 2007 -// Authors: +// Authors: // Will Palmeri // // 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 } diff --git a/lib/csharp/src/TApplicationException.cs b/lib/csharp/src/TApplicationException.cs index e4f3acf8..e9d200a9 100644 --- a/lib/csharp/src/TApplicationException.cs +++ b/lib/csharp/src/TApplicationException.cs @@ -2,7 +2,7 @@ // TApplicationException.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/TProcessor.cs b/lib/csharp/src/TProcessor.cs index 7567820c..2cbddd72 100644 --- a/lib/csharp/src/TProcessor.cs +++ b/lib/csharp/src/TProcessor.cs @@ -2,7 +2,7 @@ // TProcessor.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Distributed under the Thrift Software License diff --git a/lib/csharp/src/Transport/TServerSocket.cs b/lib/csharp/src/Transport/TServerSocket.cs index cb4a84fa..3b5c8dd0 100644 --- a/lib/csharp/src/Transport/TServerSocket.cs +++ b/lib/csharp/src/Transport/TServerSocket.cs @@ -2,7 +2,7 @@ // TServerTransport.cs // // Begin: Dec 3, 2007 -// Authors: +// Authors: // Will Palmeri // // Copyright (C) 2007 imeem, inc. diff --git a/lib/csharp/src/Transport/TServerTransport.cs b/lib/csharp/src/Transport/TServerTransport.cs index b4f5f07d..6b05a158 100644 --- a/lib/csharp/src/Transport/TServerTransport.cs +++ b/lib/csharp/src/Transport/TServerTransport.cs @@ -2,7 +2,7 @@ // TServerTransport.cs // // Begin: Dec 3, 2007 -// Authors: +// Authors: // Will Palmeri // // Copyright (C) 2007 imeem, inc. diff --git a/lib/csharp/src/Transport/TSocket.cs b/lib/csharp/src/Transport/TSocket.cs index c05d5871..a3f36238 100644 --- a/lib/csharp/src/Transport/TSocket.cs +++ b/lib/csharp/src/Transport/TSocket.cs @@ -2,7 +2,7 @@ // TSocket.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Copyright (C) 2007 imeem, inc. diff --git a/lib/csharp/src/Transport/TStreamTransport.cs b/lib/csharp/src/Transport/TStreamTransport.cs index 1715b6aa..dbbec191 100644 --- a/lib/csharp/src/Transport/TStreamTransport.cs +++ b/lib/csharp/src/Transport/TStreamTransport.cs @@ -2,7 +2,7 @@ // TStreamTransport.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Copyright (C) 2007 imeem, inc. diff --git a/lib/csharp/src/Transport/TTransport.cs b/lib/csharp/src/Transport/TTransport.cs index 90f7e74f..915cbc93 100644 --- a/lib/csharp/src/Transport/TTransport.cs +++ b/lib/csharp/src/Transport/TTransport.cs @@ -2,7 +2,7 @@ // TTransport.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Copyright (C) 2007 imeem, inc. diff --git a/lib/csharp/src/Transport/TTransportException.cs b/lib/csharp/src/Transport/TTransportException.cs index d59c46e6..daf21d8f 100644 --- a/lib/csharp/src/Transport/TTransportException.cs +++ b/lib/csharp/src/Transport/TTransportException.cs @@ -2,7 +2,7 @@ // TTransportException.cs // // Begin: Aug 19, 2007 -// Authors: +// Authors: // Todd Berman // // Copyright (C) 2007 imeem, inc. diff --git a/lib/csharp/src/Transport/TTransportFactory.cs b/lib/csharp/src/Transport/TTransportFactory.cs index 456140d5..1cb5c920 100644 --- a/lib/csharp/src/Transport/TTransportFactory.cs +++ b/lib/csharp/src/Transport/TTransportFactory.cs @@ -2,7 +2,7 @@ // TTransportFactory.cs // // Begin: Dec 3, 2007 -// Authors: +// Authors: // Will Palmeri // // Copyright (C) 2007 imeem, inc. diff --git a/lib/erl/COPYING b/lib/erl/COPYING index 039f21e3..0101a7dc 100644 --- a/lib/erl/COPYING +++ b/lib/erl/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/lib/erl/LICENSE b/lib/erl/LICENSE index 039f21e3..0101a7dc 100644 --- a/lib/erl/LICENSE +++ b/lib/erl/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 diff --git a/lib/erl/build/beamver b/lib/erl/build/beamver index fe448b96..2b5f77b3 100644 --- a/lib/erl/build/beamver +++ b/lib/erl/build/beamver @@ -11,7 +11,7 @@ # # 5> code:which(acca_inets). # "/home/martin/work/otp/releases//../../acca/ebin/.beam" -# +# # 8> beam_lib:version(code:which()). # {ok,{,['$Id: beamver,v 1.1.1.1 2003/06/13 21:43:21 mlogan Exp $ ']}} diff --git a/lib/erl/build/otp.mk b/lib/erl/build/otp.mk index 4e93ea8c..1d16e2c8 100644 --- a/lib/erl/build/otp.mk +++ b/lib/erl/build/otp.mk @@ -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 diff --git a/lib/erl/build/otp_subdir.mk b/lib/erl/build/otp_subdir.mk index 73339693..2a36c658 100644 --- a/lib/erl/build/otp_subdir.mk +++ b/lib/erl/build/otp_subdir.mk @@ -25,16 +25,16 @@ # 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 $ # # diff --git a/lib/erl/build/raw_test.mk b/lib/erl/build/raw_test.mk index dbacf18f..bf8535d1 100644 --- a/lib/erl/build/raw_test.mk +++ b/lib/erl/build/raw_test.mk @@ -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//src and the test files which are +# this type of test would be +# files to test reside in lib//src and the test files which are # just plain erlang code reside in lib//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 diff --git a/lib/erl/include/protocol/tBinaryProtocol.hrl b/lib/erl/include/protocol/tBinaryProtocol.hrl index c9768398..dea2e29c 100644 --- a/lib/erl/include/protocol/tBinaryProtocol.hrl +++ b/lib/erl/include/protocol/tBinaryProtocol.hrl @@ -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/ diff --git a/lib/erl/include/protocol/tBinaryProtocolFactory.hrl b/lib/erl/include/protocol/tBinaryProtocolFactory.hrl index 266932c7..cf8c92b0 100644 --- a/lib/erl/include/protocol/tBinaryProtocolFactory.hrl +++ b/lib/erl/include/protocol/tBinaryProtocolFactory.hrl @@ -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/ diff --git a/lib/erl/include/protocol/tProtocol.hrl b/lib/erl/include/protocol/tProtocol.hrl index 3e42d67a..d393f352 100644 --- a/lib/erl/include/protocol/tProtocol.hrl +++ b/lib/erl/include/protocol/tProtocol.hrl @@ -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/ diff --git a/lib/erl/include/protocol/tProtocolFactory.hrl b/lib/erl/include/protocol/tProtocolFactory.hrl index 56c7fee4..6335dd96 100644 --- a/lib/erl/include/protocol/tProtocolFactory.hrl +++ b/lib/erl/include/protocol/tProtocolFactory.hrl @@ -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/ diff --git a/lib/erl/include/server/tErlServer.hrl b/lib/erl/include/server/tErlServer.hrl index 0a669932..b60df710 100644 --- a/lib/erl/include/server/tErlServer.hrl +++ b/lib/erl/include/server/tErlServer.hrl @@ -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/ diff --git a/lib/erl/include/server/tServer.hrl b/lib/erl/include/server/tServer.hrl index 502a137f..9488438a 100644 --- a/lib/erl/include/server/tServer.hrl +++ b/lib/erl/include/server/tServer.hrl @@ -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/ diff --git a/lib/erl/include/server/tSimpleServer.hrl b/lib/erl/include/server/tSimpleServer.hrl index f115d0bd..e6d257d3 100644 --- a/lib/erl/include/server/tSimpleServer.hrl +++ b/lib/erl/include/server/tSimpleServer.hrl @@ -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/ diff --git a/lib/erl/include/tErlProcessor.hrl b/lib/erl/include/tErlProcessor.hrl index 78b91f15..65e5cd07 100644 --- a/lib/erl/include/tErlProcessor.hrl +++ b/lib/erl/include/tErlProcessor.hrl @@ -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/ diff --git a/lib/erl/include/tProcessor.hrl b/lib/erl/include/tProcessor.hrl index 3d138cde..18833975 100644 --- a/lib/erl/include/tProcessor.hrl +++ b/lib/erl/include/tProcessor.hrl @@ -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/ diff --git a/lib/erl/include/transport/tBufferedTransport.hrl b/lib/erl/include/transport/tBufferedTransport.hrl index 05c738e3..0aa1a914 100644 --- a/lib/erl/include/transport/tBufferedTransport.hrl +++ b/lib/erl/include/transport/tBufferedTransport.hrl @@ -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/ diff --git a/lib/erl/include/transport/tBufferedTransportFactory.hrl b/lib/erl/include/transport/tBufferedTransportFactory.hrl index 3a4cdc5e..69081b4f 100644 --- a/lib/erl/include/transport/tBufferedTransportFactory.hrl +++ b/lib/erl/include/transport/tBufferedTransportFactory.hrl @@ -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/ diff --git a/lib/erl/include/transport/tErlAcceptor.hrl b/lib/erl/include/transport/tErlAcceptor.hrl index 333feb5d..43babb53 100644 --- a/lib/erl/include/transport/tErlAcceptor.hrl +++ b/lib/erl/include/transport/tErlAcceptor.hrl @@ -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/ diff --git a/lib/erl/include/transport/tServerSocket.hrl b/lib/erl/include/transport/tServerSocket.hrl index a2c25acb..2f85b8ac 100644 --- a/lib/erl/include/transport/tServerSocket.hrl +++ b/lib/erl/include/transport/tServerSocket.hrl @@ -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/ diff --git a/lib/erl/include/transport/tServerTransport.hrl b/lib/erl/include/transport/tServerTransport.hrl index 207bbf63..ccb75e49 100644 --- a/lib/erl/include/transport/tServerTransport.hrl +++ b/lib/erl/include/transport/tServerTransport.hrl @@ -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/ diff --git a/lib/erl/include/transport/tSocket.hrl b/lib/erl/include/transport/tSocket.hrl index 0317d5aa..95d8d875 100644 --- a/lib/erl/include/transport/tSocket.hrl +++ b/lib/erl/include/transport/tSocket.hrl @@ -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/ diff --git a/lib/erl/include/transport/tTransport.hrl b/lib/erl/include/transport/tTransport.hrl index ca89413d..8d742898 100644 --- a/lib/erl/include/transport/tTransport.hrl +++ b/lib/erl/include/transport/tTransport.hrl @@ -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/ diff --git a/lib/erl/include/transport/tTransportFactory.hrl b/lib/erl/include/transport/tTransportFactory.hrl index d4881408..05aa8203 100644 --- a/lib/erl/include/transport/tTransportFactory.hrl +++ b/lib/erl/include/transport/tTransportFactory.hrl @@ -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/ diff --git a/lib/erl/src/Makefile b/lib/erl/src/Makefile index b42e0056..452cfee2 100644 --- a/lib/erl/src/Makefile +++ b/lib/erl/src/Makefile @@ -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 diff --git a/lib/erl/src/protocol/tBinaryProtocolFactory.erl b/lib/erl/src/protocol/tBinaryProtocolFactory.erl index ff7fa565..c525cdb0 100644 --- a/lib/erl/src/protocol/tBinaryProtocolFactory.erl +++ b/lib/erl/src/protocol/tBinaryProtocolFactory.erl @@ -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/ @@ -24,11 +24,11 @@ %%% ?DEFINE_ATTR(super). - + %%% %%% behavior callbacks %%% - + %%% super() -> SuperModule = atom() %%% | none diff --git a/lib/erl/src/protocol/tProtocolFactory.erl b/lib/erl/src/protocol/tProtocolFactory.erl index d697263c..f756a293 100644 --- a/lib/erl/src/protocol/tProtocolFactory.erl +++ b/lib/erl/src/protocol/tProtocolFactory.erl @@ -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 diff --git a/lib/erl/src/server/tServer.erl b/lib/erl/src/server/tServer.erl index 23aef22e..fc033310 100644 --- a/lib/erl/src/server/tServer.erl +++ b/lib/erl/src/server/tServer.erl @@ -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/ @@ -29,11 +29,11 @@ ?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) -> diff --git a/lib/erl/src/server/tSimpleServer.erl b/lib/erl/src/server/tSimpleServer.erl index 6dcc7236..833fe5db 100644 --- a/lib/erl/src/server/tSimpleServer.erl +++ b/lib/erl/src/server/tSimpleServer.erl @@ -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,11 +27,11 @@ %%% ?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. diff --git a/lib/erl/src/tProcessor.erl b/lib/erl/src/tProcessor.erl index 003748a7..b62e5ad0 100644 --- a/lib/erl/src/tProcessor.erl +++ b/lib/erl/src/tProcessor.erl @@ -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 diff --git a/lib/erl/src/thrift_app.erl b/lib/erl/src/thrift_app.erl index dabc7ed4..17a14cf1 100644 --- a/lib/erl/src/thrift_app.erl +++ b/lib/erl/src/thrift_app.erl @@ -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(), diff --git a/lib/erl/src/thrift_app_sup.erl b/lib/erl/src/thrift_app_sup.erl index 3a44c3f4..545ffa87 100644 --- a/lib/erl/src/thrift_app_sup.erl +++ b/lib/erl/src/thrift_app_sup.erl @@ -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/ diff --git a/lib/hs/src/TBinaryProtocol.hs b/lib/hs/src/TBinaryProtocol.hs index dd5212d2..e02a0ee8 100644 --- a/lib/hs/src/TBinaryProtocol.hs +++ b/lib/hs/src/TBinaryProtocol.hs @@ -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 - + diff --git a/lib/hs/src/TChannelTransport.hs b/lib/hs/src/TChannelTransport.hs index df1aedc3..bf2e8a6a 100644 --- a/lib/hs/src/TChannelTransport.hs +++ b/lib/hs/src/TChannelTransport.hs @@ -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) diff --git a/lib/hs/src/TServer.hs b/lib/hs/src/TServer.hs index 83a6ee3f..4676fc1a 100644 --- a/lib/hs/src/TServer.hs +++ b/lib/hs/src/TServer.hs @@ -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 diff --git a/lib/hs/src/TSocket.hs b/lib/hs/src/TSocket.hs index 7e728786..ea23345d 100644 --- a/lib/hs/src/TSocket.hs +++ b/lib/hs/src/TSocket.hs @@ -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 [] diff --git a/lib/hs/src/Thrift.hs b/lib/hs/src/Thrift.hs index 4087b2ba..6b946266 100644 --- a/lib/hs/src/Thrift.hs +++ b/lib/hs/src/Thrift.hs @@ -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 - + diff --git a/lib/java/COPYING b/lib/java/COPYING index 039f21e3..0101a7dc 100644 --- a/lib/java/COPYING +++ b/lib/java/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/lib/java/LICENSE b/lib/java/LICENSE index 039f21e3..0101a7dc 100644 --- a/lib/java/LICENSE +++ b/lib/java/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 diff --git a/lib/java/src/TApplicationException.java b/lib/java/src/TApplicationException.java index fdce9f5c..893a3896 100644 --- a/lib/java/src/TApplicationException.java +++ b/lib/java/src/TApplicationException.java @@ -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; diff --git a/lib/java/src/TException.java b/lib/java/src/TException.java index 77eed3e8..a328bfd9 100644 --- a/lib/java/src/TException.java +++ b/lib/java/src/TException.java @@ -19,7 +19,7 @@ public class TException extends Exception { public TException(String message) { super(message); } - + public TException(Throwable cause) { super(cause); } diff --git a/lib/java/src/TProcessorFactory.java b/lib/java/src/TProcessorFactory.java index ace90a23..5bac1ba5 100644 --- a/lib/java/src/TProcessorFactory.java +++ b/lib/java/src/TProcessorFactory.java @@ -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_; } diff --git a/lib/java/src/protocol/TBinaryProtocol.java b/lib/java/src/protocol/TBinaryProtocol.java index b9167d24..750dce11 100644 --- a/lib/java/src/protocol/TBinaryProtocol.java +++ b/lib/java/src/protocol/TBinaryProtocol.java @@ -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 { } } } - + } diff --git a/lib/java/src/protocol/TList.java b/lib/java/src/protocol/TList.java index d1c76420..3fe85990 100644 --- a/lib/java/src/protocol/TList.java +++ b/lib/java/src/protocol/TList.java @@ -13,7 +13,7 @@ package com.facebook.thrift.protocol; */ public class TList { public TList() {} - + public TList(byte t, int s) { elemType = t; size = s; diff --git a/lib/java/src/protocol/TMap.java b/lib/java/src/protocol/TMap.java index 0a0e4df1..9b7126e0 100644 --- a/lib/java/src/protocol/TMap.java +++ b/lib/java/src/protocol/TMap.java @@ -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; diff --git a/lib/java/src/protocol/TProtocol.java b/lib/java/src/protocol/TProtocol.java index 08a7ef31..3e7e7f05 100644 --- a/lib/java/src/protocol/TProtocol.java +++ b/lib/java/src/protocol/TProtocol.java @@ -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; diff --git a/lib/java/src/protocol/TProtocolUtil.java b/lib/java/src/protocol/TProtocolUtil.java index ad333bc2..0b85d38b 100644 --- a/lib/java/src/protocol/TProtocolUtil.java +++ b/lib/java/src/protocol/TProtocolUtil.java @@ -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); diff --git a/lib/java/src/reflection/limited/Argument.java b/lib/java/src/reflection/limited/Argument.java index c24e07e3..2a485e82 100644 --- a/lib/java/src/reflection/limited/Argument.java +++ b/lib/java/src/reflection/limited/Argument.java @@ -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; diff --git a/lib/java/src/reflection/limited/ContainerType.java b/lib/java/src/reflection/limited/ContainerType.java index 11d38729..6c8bcc31 100644 --- a/lib/java/src/reflection/limited/ContainerType.java +++ b/lib/java/src/reflection/limited/ContainerType.java @@ -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; diff --git a/lib/java/src/reflection/limited/Method.java b/lib/java/src/reflection/limited/Method.java index 64ba21d7..41fa6ca1 100644 --- a/lib/java/src/reflection/limited/Method.java +++ b/lib/java/src/reflection/limited/Method.java @@ -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; diff --git a/lib/java/src/reflection/limited/Service.java b/lib/java/src/reflection/limited/Service.java index f3a9481c..fcbd09ce 100644 --- a/lib/java/src/reflection/limited/Service.java +++ b/lib/java/src/reflection/limited/Service.java @@ -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; diff --git a/lib/java/src/reflection/limited/SimpleType.java b/lib/java/src/reflection/limited/SimpleType.java index c0feae63..2a69e392 100644 --- a/lib/java/src/reflection/limited/SimpleType.java +++ b/lib/java/src/reflection/limited/SimpleType.java @@ -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; diff --git a/lib/java/src/reflection/limited/ThriftType.java b/lib/java/src/reflection/limited/ThriftType.java index d3bb3eb9..63022ec0 100644 --- a/lib/java/src/reflection/limited/ThriftType.java +++ b/lib/java/src/reflection/limited/ThriftType.java @@ -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; diff --git a/lib/java/src/server/TServer.java b/lib/java/src/server/TServer.java index 2ac322ae..c066607c 100644 --- a/lib/java/src/server/TServer.java +++ b/lib/java/src/server/TServer.java @@ -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. */ diff --git a/lib/java/src/server/TSimpleServer.java b/lib/java/src/server/TSimpleServer.java index cb127c72..bf66843c 100644 --- a/lib/java/src/server/TSimpleServer.java +++ b/lib/java/src/server/TSimpleServer.java @@ -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 { diff --git a/lib/java/src/transport/TIOStreamTransport.java b/lib/java/src/transport/TIOStreamTransport.java index e9998b90..5fef3b74 100644 --- a/lib/java/src/transport/TIOStreamTransport.java +++ b/lib/java/src/transport/TIOStreamTransport.java @@ -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; diff --git a/lib/java/src/transport/TServerSocket.java b/lib/java/src/transport/TServerSocket.java index cc6d9004..2692ac43 100644 --- a/lib/java/src/transport/TServerSocket.java +++ b/lib/java/src/transport/TServerSocket.java @@ -18,7 +18,7 @@ import java.net.SocketException; * @author Mark Slee */ 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."); diff --git a/lib/java/src/transport/TSocket.java b/lib/java/src/transport/TSocket.java index 2c17e436..20538502 100644 --- a/lib/java/src/transport/TSocket.java +++ b/lib/java/src/transport/TSocket.java @@ -24,7 +24,7 @@ public class TSocket extends TIOStreamTransport { * Wrapped Socket object */ private Socket socket_ = null; - + /** * Remote host */ diff --git a/lib/ocaml/README b/lib/ocaml/README index b3043676..222a4b90 100644 --- a/lib/ocaml/README +++ b/lib/ocaml/README @@ -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 diff --git a/lib/ocaml/src/TBinaryProtocol.ml b/lib/ocaml/src/TBinaryProtocol.ml index fa84e712..109eeaaf 100644 --- a/lib/ocaml/src/TBinaryProtocol.ml +++ b/lib/ocaml/src/TBinaryProtocol.ml @@ -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) diff --git a/lib/ocaml/src/TChannelTransport.ml b/lib/ocaml/src/TChannelTransport.ml index 5407a8e8..9678e5ab 100644 --- a/lib/ocaml/src/TChannelTransport.ml +++ b/lib/ocaml/src/TChannelTransport.ml @@ -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 diff --git a/lib/ocaml/src/TServer.ml b/lib/ocaml/src/TServer.ml index 5fb8089b..bd97ab97 100644 --- a/lib/ocaml/src/TServer.ml +++ b/lib/ocaml/src/TServer.ml @@ -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) diff --git a/lib/ocaml/src/TServerSocket.ml b/lib/ocaml/src/TServerSocket.ml index 9e797060..1e826096 100644 --- a/lib/ocaml/src/TServerSocket.ml +++ b/lib/ocaml/src/TServerSocket.ml @@ -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 = diff --git a/lib/ocaml/src/TSocket.ml b/lib/ocaml/src/TSocket.ml index 20c86132..2d824377 100644 --- a/lib/ocaml/src/TSocket.ml +++ b/lib/ocaml/src/TSocket.ml @@ -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 - - + + diff --git a/lib/ocaml/src/TThreadedServer.ml b/lib/ocaml/src/TThreadedServer.ml index 10f16141..702cb226 100644 --- a/lib/ocaml/src/TThreadedServer.ml +++ b/lib/ocaml/src/TThreadedServer.ml @@ -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 - + diff --git a/lib/ocaml/src/Thrift.ml b/lib/ocaml/src/Thrift.ml index 92c015b6..1a9130f3 100644 --- a/lib/ocaml/src/Thrift.ml +++ b/lib/ocaml/src/Thrift.ml @@ -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;; diff --git a/lib/perl/COPYING b/lib/perl/COPYING index 039f21e3..0101a7dc 100644 --- a/lib/perl/COPYING +++ b/lib/perl/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/lib/perl/LICENSE b/lib/perl/LICENSE index 039f21e3..0101a7dc 100644 --- a/lib/perl/LICENSE +++ b/lib/perl/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 diff --git a/lib/perl/lib/Thrift/HttpClient.pm b/lib/perl/lib/Thrift/HttpClient.pm index 854149b1..9f79838c 100644 --- a/lib/perl/lib/Thrift/HttpClient.pm +++ b/lib/perl/lib/Thrift/HttpClient.pm @@ -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); diff --git a/lib/php/COPYING b/lib/php/COPYING index 039f21e3..0101a7dc 100644 --- a/lib/php/COPYING +++ b/lib/php/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/lib/php/LICENSE b/lib/php/LICENSE index 039f21e3..0101a7dc 100644 --- a/lib/php/LICENSE +++ b/lib/php/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 diff --git a/lib/php/src/ext/thrift_protocol/trunk/php_thrift_protocol.cpp b/lib/php/src/ext/thrift_protocol/trunk/php_thrift_protocol.cpp index 1df54d54..a6661281 100644 --- a/lib/php/src/ext/thrift_protocol/trunk/php_thrift_protocol.cpp +++ b/lib/php/src/ext/thrift_protocol/trunk/php_thrift_protocol.cpp @@ -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) { diff --git a/lib/php/src/protocol/TBinaryProtocol.php b/lib/php/src/protocol/TBinaryProtocol.php index f66f8eec..874a5485 100644 --- a/lib/php/src/protocol/TBinaryProtocol.php +++ b/lib/php/src/protocol/TBinaryProtocol.php @@ -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 { diff --git a/lib/py/src/reflection/limited/ttypes.py b/lib/py/src/reflection/limited/ttypes.py index ec58f668..f6e63986 100644 --- a/lib/py/src/reflection/limited/ttypes.py +++ b/lib/py/src/reflection/limited/ttypes.py @@ -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): diff --git a/lib/py/src/server/TServer.py b/lib/py/src/server/TServer.py index 74bb93e5..b6738f76 100644 --- a/lib/py/src/server/TServer.py +++ b/lib/py/src/server/TServer.py @@ -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: diff --git a/lib/py/src/transport/THttpClient.py b/lib/py/src/transport/THttpClient.py index 7410fa4f..9cf4039a 100644 --- a/lib/py/src/transport/THttpClient.py +++ b/lib/py/src/transport/THttpClient.py @@ -28,7 +28,7 @@ class THttpClient(TTransportBase): def close(self): self.__http.close() self.__http = None - + def isOpen(self): return self.__http != None diff --git a/lib/py/src/transport/TSocket.py b/lib/py/src/transport/TSocket.py index 146820d8..732dbd7d 100644 --- a/lib/py/src/transport/TSocket.py +++ b/lib/py/src/transport/TSocket.py @@ -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() diff --git a/lib/rb/COPYING b/lib/rb/COPYING index 039f21e3..0101a7dc 100644 --- a/lib/rb/COPYING +++ b/lib/rb/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/lib/rb/LICENSE b/lib/rb/LICENSE index 039f21e3..0101a7dc 100644 --- a/lib/rb/LICENSE +++ b/lib/rb/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 diff --git a/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb b/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb index a152bf27..ce0b1bb7 100644 --- a/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb +++ b/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb @@ -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') diff --git a/lib/rb/lib/thrift/protocol/tprotocol.rb b/lib/rb/lib/thrift/protocol/tprotocol.rb index fb43705b..a06b4cd1 100644 --- a/lib/rb/lib/thrift/protocol/tprotocol.rb +++ b/lib/rb/lib/thrift/protocol/tprotocol.rb @@ -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 diff --git a/lib/rb/lib/thrift/server/tserver.rb b/lib/rb/lib/thrift/server/tserver.rb index d9ff621e..43b2bdd9 100644 --- a/lib/rb/lib/thrift/server/tserver.rb +++ b/lib/rb/lib/thrift/server/tserver.rb @@ -20,7 +20,7 @@ class TServer @transportFactory = transportFactory ? transportFactory : TTransportFactory.new() @protocolFactory = protocolFactory ? protocolFactory : TBinaryProtocolFactory.new() end - + def serve(); nil; end end diff --git a/lib/rb/setup.rb b/lib/rb/setup.rb index 424a5f37..9f0c8267 100644 --- a/lib/rb/setup.rb +++ b/lib/rb/setup.rb @@ -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 _$* *$ diff --git a/test/DocTest.thrift b/test/DocTest.thrift index c94d426b..5749fdab 100755 --- a/test/DocTest.thrift +++ b/test/DocTest.thrift @@ -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 userMap, /** And this is doc for field 2 */ - 2: list xtructs + 2: list xtructs } exception Xception { @@ -80,7 +80,7 @@ exception Xception2 { 1: i32 errorCode, 2: Xtruct struct_thing } - + /* C1 */ /** Doc */ /* C2 */ diff --git a/test/FastbinaryTest.py b/test/FastbinaryTest.py index f6a86995..b27612bc 100755 --- a/test/FastbinaryTest.py +++ b/test/FastbinaryTest.py @@ -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__() diff --git a/test/SmallTest.thrift b/test/SmallTest.thrift index 58357fe3..bded87ab 100644 --- a/test/SmallTest.thrift +++ b/test/SmallTest.thrift @@ -24,7 +24,7 @@ const Hello WHOA = {'simple' : 532} exception Goodbye { 1: i32 simple, 2: map complex, - 3: map> complexer, + 3: map> complexer, } service SmallService { diff --git a/test/cpp/Makefile.thrift b/test/cpp/Makefile.thrift index 9eb1dcee..fa412aa1 100644 --- a/test/cpp/Makefile.thrift +++ b/test/cpp/Makefile.thrift @@ -1,5 +1,5 @@ # Makefile for Thrift test project. -# +# # Author: # Mark Slee @@ -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 diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp index c2efb1ac..9b350b0b 100644 --- a/test/cpp/src/TestClient.cpp +++ b/test/cpp/src/TestClient.cpp @@ -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 transport; shared_ptr socket(new TSocket(host, port)); - + if (framed) { shared_ptr 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; diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp index 3afc955e..773225e1 100644 --- a/test/cpp/src/TestServer.cpp +++ b/test/cpp/src/TestServer.cpp @@ -146,7 +146,7 @@ class TestHandler : public ThriftTestIf { void testInsanity(map > &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 &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 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, diff --git a/test/cpp/src/main.cpp b/test/cpp/src/main.cpp index 160ca8ff..78491d62 100644 --- a/test/cpp/src/main.cpp +++ b/test/cpp/src/main.cpp @@ -49,8 +49,8 @@ struct ltstr { }; -// typedef hash_map, eqstr> count_map; -typedef map count_map; +// typedef hash_map, eqstr> count_map; +typedef map 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 _transport; shared_ptr _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 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 serviceHandler(new Server()); shared_ptr serviceProcessor(new ServiceProcessor(serviceHandler)); - + // Transports shared_ptr 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 fileTransport(new TFileTransport(requestLogPath)); fileTransport->setChunkSize(2 * 1024 * 1024); fileTransport->setMaxEventSize(1024 * 16); - - transportFactory = + + transportFactory = shared_ptr(new TPipedTransportFactory(fileTransport)); } shared_ptr serverThread; if (serverType == "simple") { - + serverThread = threadFactory->newThread(shared_ptr(new TSimpleServer(serviceProcessor, serverSocket, transportFactory, protocolFactory))); - + } else if (serverType == "threaded") { serverThread = threadFactory->newThread(shared_ptr(new TThreadedServer(serviceProcessor, serverSocket, transportFactory, protocolFactory))); - + } else if (serverType == "thread-pool") { shared_ptr threadManager = ThreadManager::newSimpleThreadManager(workerCount); threadManager->threadFactory(threadFactory); - threadManager->start(); + threadManager->start(); serverThread = threadFactory->newThread(shared_ptr(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 socket(new TSocket("127.0.01", port)); shared_ptr bufferedSocket(new TBufferedTransport(socket, 2048)); shared_ptr protocol(new TBinaryProtocol(bufferedSocket)); shared_ptr serviceClient(new ServiceClient(protocol)); - + clientThreads.insert(threadFactory->newThread(shared_ptr(new ClientThread(socket, serviceClient, monitor, threadCount, loopCount, loopType)))); } - + for (std::set >::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 >::iterator ix = clientThreads.begin(); ix != clientThreads.end(); ix++) { - + shared_ptr client = dynamic_pointer_cast((*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) { diff --git a/test/hs/Client.hs b/test/hs/Client.hs index 10e59296..fa9c8e7b 100644 --- a/test/hs/Client.hs +++ b/test/hs/Client.hs @@ -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 - + diff --git a/test/java/src/TestServer.java b/test/java/src/TestServer.java index 0d01be92..5a844a38 100644 --- a/test/java/src/TestServer.java +++ b/test/java/src/TestServer.java @@ -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 testMap(AbstractMap thing) { System.out.print("testMap({"); boolean first = true; @@ -150,7 +150,7 @@ public class TestServer { public AbstractMap> 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 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(); diff --git a/test/ocaml/server/TestServer.ml b/test/ocaml/server/TestServer.ml index afcd7895..3768f5dc 100644 --- a/test/ocaml/server/TestServer.ml +++ b/test/ocaml/server/TestServer.ml @@ -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 - - + + diff --git a/test/perl/Makefile b/test/perl/Makefile index 0e99a733..128bbe8d 100644 --- a/test/perl/Makefile +++ b/test/perl/Makefile @@ -1,5 +1,5 @@ # Makefile for Thrift test project. -# +# # Author: # Mark Slee diff --git a/test/py/Makefile b/test/py/Makefile index b4b27188..20496631 100644 --- a/test/py/Makefile +++ b/test/py/Makefile @@ -1,5 +1,5 @@ # Makefile for Thrift test project. -# +# # Author: # Mark Slee diff --git a/test/py/RunClientServer.py b/test/py/RunClientServer.py index 0f5c46fa..21f45310 100644 --- a/test/py/RunClientServer.py +++ b/test/py/RunClientServer.py @@ -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") diff --git a/test/py/TestClient.py b/test/py/TestClient.py index 63ec1d01..7e58dfe6 100755 --- a/test/py/TestClient.py +++ b/test/py/TestClient.py @@ -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') diff --git a/test/py/TestServer.py b/test/py/TestServer.py index 6cd9f583..94a81c05 100755 --- a/test/py/TestServer.py +++ b/test/py/TestServer.py @@ -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]) diff --git a/test/py/TestSocket.py b/test/py/TestSocket.py index 7cbdf5ca..b693d182 100755 --- a/test/py/TestSocket.py +++ b/test/py/TestSocket.py @@ -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() diff --git a/test/rb/Makefile b/test/rb/Makefile index 5ea5305c..502a9819 100644 --- a/test/rb/Makefile +++ b/test/rb/Makefile @@ -1,5 +1,5 @@ # Makefile for Thrift test project. -# +# # Author: # Mark Slee diff --git a/test/rb/TestSmallService.rb b/test/rb/TestSmallService.rb index 9ac287a7..277b54cc 100644 --- a/test/rb/TestSmallService.rb +++ b/test/rb/TestSmallService.rb @@ -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') diff --git a/test/rb/TestThrift.rb b/test/rb/TestThrift.rb index 2b59fa93..e35e808b 100644 --- a/test/rb/TestThrift.rb +++ b/test/rb/TestThrift.rb @@ -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 diff --git a/test/threads/Makefile b/test/threads/Makefile index 58aebefb..58cdf18e 100644 --- a/test/threads/Makefile +++ b/test/threads/Makefile @@ -1,5 +1,5 @@ # Makefile for Thrift test project. -# +# # Author: # Mark Slee diff --git a/test/threads/ThreadsServer.cpp b/test/threads/ThreadsServer.cpp index a293cfbd..826bbdb8 100644 --- a/test/threads/ThreadsServer.cpp +++ b/test/threads/ThreadsServer.cpp @@ -90,13 +90,13 @@ int main(int argc, char **argv) { shared_ptr protocolFactory(new TBinaryProtocolFactory()); /* - shared_ptr threadManager = + shared_ptr threadManager = ThreadManager::newSimpleThreadManager(10); shared_ptr threadFactory = shared_ptr(new PosixThreadFactory()); threadManager->threadFactory(threadFactory); threadManager->start(); - + shared_ptr server = shared_ptr(new TThreadPoolServer(processor, serverTransport, diff --git a/thrift.el b/thrift.el index cff05890..bb0968ae 100644 --- 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) diff --git a/tutorial/cpp/CppClient.cpp b/tutorial/cpp/CppClient.cpp index b9711606..a21125b2 100644 --- a/tutorial/cpp/CppClient.cpp +++ b/tutorial/cpp/CppClient.cpp @@ -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; diff --git a/tutorial/java/src/JavaClient.java b/tutorial/java/src/JavaClient.java index 6667d6f6..753f0c62 100644 --- a/tutorial/java/src/JavaClient.java +++ b/tutorial/java/src/JavaClient.java @@ -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(); } diff --git a/tutorial/php/PhpClient.php b/tutorial/php/PhpClient.php index fdd12ac5..dc36f6da 100755 --- a/tutorial/php/PhpClient.php +++ b/tutorial/php/PhpClient.php @@ -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"; } diff --git a/tutorial/py/PythonClient.py b/tutorial/py/PythonClient.py index 9dcecd97..05f17197 100755 --- a/tutorial/py/PythonClient.py +++ b/tutorial/py/PythonClient.py @@ -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) diff --git a/tutorial/py/PythonServer.py b/tutorial/py/PythonServer.py index 3324bbd5..111c44eb 100755 --- a/tutorial/py/PythonServer.py +++ b/tutorial/py/PythonServer.py @@ -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) diff --git a/tutorial/rb/RubyClient.rb b/tutorial/rb/RubyClient.rb index 9ee6e794..d40ff496 100755 --- a/tutorial/rb/RubyClient.rb +++ b/tutorial/rb/RubyClient.rb @@ -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) diff --git a/tutorial/tutorial.thrift b/tutorial/tutorial.thrift index f5e58364..323c96ab 100755 --- a/tutorial/tutorial.thrift +++ b/tutorial/tutorial.thrift @@ -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 -- 2.17.1