From: Kevin Clark Date: Wed, 18 Jun 2008 01:11:41 +0000 (+0000) Subject: Strip the rest of the empty () parens X-Git-Tag: 0.2.0~578 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=d389f54f0a9fa736c62911a5e16cdc77ab9dcd21;p=common%2Fthrift.git Strip the rest of the empty () parens git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668972 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/rb/lib/thrift/client.rb b/lib/rb/lib/thrift/client.rb index ab2bff7a..1a34543b 100644 --- a/lib/rb/lib/thrift/client.rb +++ b/lib/rb/lib/thrift/client.rb @@ -13,24 +13,24 @@ module Thrift data.send("#{k.to_s}=", v) end data.write(@oprot) - @oprot.write_message_end() - @oprot.trans.flush() + @oprot.write_message_end + @oprot.trans.flush end def receive_message(result_klass) - fname, mtype, rseqid = @iprot.read_message_begin() + fname, mtype, rseqid = @iprot.read_message_begin handle_exception(mtype) result = result_klass.new result.read(@iprot) - @iprot.read_message_end() + @iprot.read_message_end return result end def handle_exception(mtype) if mtype == MessageTypes::EXCEPTION - x = ApplicationException.new() + x = ApplicationException.new x.read(@iprot) - @iprot.read_message_end() + @iprot.read_message_end raise x end end diff --git a/lib/rb/lib/thrift/exceptions.rb b/lib/rb/lib/thrift/exceptions.rb index 20be9c37..eed06159 100644 --- a/lib/rb/lib/thrift/exceptions.rb +++ b/lib/rb/lib/thrift/exceptions.rb @@ -26,30 +26,30 @@ module Thrift end def read(iprot) - iprot.read_struct_begin() + iprot.read_struct_begin while true - fname, ftype, fid = iprot.read_field_begin() + fname, ftype, fid = iprot.read_field_begin if (ftype === Types::STOP) break end if (fid == 1) if (ftype === Types::STRING) - @message = iprot.read_string(); + @message = iprot.read_string; else iprot.skip(ftype) end elsif (fid == 2) if (ftype === Types::I32) - @type = iprot.read_i32(); + @type = iprot.read_i32; else iprot.skip(ftype) end else iprot.skip(ftype) end - iprot.read_field_end() + iprot.read_field_end end - iprot.read_struct_end() + iprot.read_struct_end end def write(oprot) @@ -57,15 +57,15 @@ module Thrift if (@message != nil) oprot.write_field_begin('message', Types::STRING, 1) oprot.write_string(@message) - oprot.write_field_end() + oprot.write_field_end end if (@type != nil) oprot.write_field_begin('type', Types::I32, 2) oprot.write_i32(@type) - oprot.write_field_end() + oprot.write_field_end end - oprot.write_field_stop() - oprot.write_struct_end() + oprot.write_field_stop + oprot.write_struct_end end end diff --git a/lib/rb/lib/thrift/processor.rb b/lib/rb/lib/thrift/processor.rb index 60d3ca8d..92a9a40f 100644 --- a/lib/rb/lib/thrift/processor.rb +++ b/lib/rb/lib/thrift/processor.rb @@ -5,18 +5,18 @@ module Thrift end def process(iprot, oprot) - name, type, seqid = iprot.read_message_begin() + name, type, seqid = iprot.read_message_begin if respond_to?("process_#{name}") send("process_#{name}", seqid, iprot, oprot) return true else iprot.skip(Types::STRUCT) - iprot.read_message_end() + iprot.read_message_end x = ApplicationException.new(ApplicationException::UNKNOWN_METHOD, 'Unknown function '+name) oprot.write_message_begin(name, MessageTypes::EXCEPTION, seqid) x.write(oprot) - oprot.write_message_end() - oprot.trans.flush() + oprot.write_message_end + oprot.trans.flush return end end @@ -31,8 +31,8 @@ module Thrift def write_result(result, oprot, name, seqid) oprot.write_message_begin(name, MessageTypes::REPLY, seqid) result.write(oprot) - oprot.write_message_end() - oprot.trans.flush() + oprot.write_message_end + oprot.trans.flush end end deprecate_module! :TProcessor => Processor diff --git a/lib/rb/lib/thrift/struct.rb b/lib/rb/lib/thrift/struct.rb index 92ce9375..934d0b7f 100644 --- a/lib/rb/lib/thrift/struct.rb +++ b/lib/rb/lib/thrift/struct.rb @@ -19,14 +19,14 @@ module Thrift end def read(iprot) - iprot.read_struct_begin() + iprot.read_struct_begin loop do - fname, ftype, fid = iprot.read_field_begin() + fname, ftype, fid = iprot.read_field_begin break if (ftype === Types::STOP) handle_message(iprot, fid, ftype) - iprot.read_field_end() + iprot.read_field_end end - iprot.read_struct_end() + iprot.read_struct_end end def write(oprot) @@ -42,8 +42,8 @@ module Thrift end end end - oprot.write_field_stop() - oprot.write_struct_end() + oprot.write_field_stop + oprot.write_struct_end end def ==(other) diff --git a/lib/rb/lib/thrift/transport/socket.rb b/lib/rb/lib/thrift/transport/socket.rb index fdd0bc05..317d62b5 100644 --- a/lib/rb/lib/thrift/transport/socket.rb +++ b/lib/rb/lib/thrift/transport/socket.rb @@ -23,7 +23,7 @@ module Thrift @handle = handle end - def open() + def open begin @handle = TCPSocket.new(@host, @port) rescue StandardError @@ -31,7 +31,7 @@ module Thrift end end - def open?() + def open? return !@handle.nil? end @@ -55,8 +55,8 @@ module Thrift end end - def close() - @handle.close() unless @handle.nil? + def close + @handle.close unless @handle.nil? @handle = nil end end @@ -68,22 +68,22 @@ module Thrift @handle = nil end - def listen() + def listen @handle = TCPServer.new(nil, @port) end - def accept() + def accept if (@handle != nil) - sock = @handle.accept() - trans = Socket.new() + sock = @handle.accept + trans = Socket.new trans.set_handle(sock) return trans end return nil end - def close() - @handle.close() unless @handle.nil? + def close + @handle.close unless @handle.nil? end end deprecate_class! :TServerSocket => ServerSocket