From: Kevin Clark Date: Wed, 18 Jun 2008 01:06:56 +0000 (+0000) Subject: Remove dummy initialize method and empty () parens X-Git-Tag: 0.2.0~600 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=d6cb44437502358cc95a39d0d82e0850aa2cc59f;p=common%2Fthrift.git Remove dummy initialize method and empty () parens git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668949 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/rb/lib/thrift/protocol/binaryprotocol.rb b/lib/rb/lib/thrift/protocol/binaryprotocol.rb index aa2c9d2b..9339b94e 100644 --- a/lib/rb/lib/thrift/protocol/binaryprotocol.rb +++ b/lib/rb/lib/thrift/protocol/binaryprotocol.rb @@ -14,10 +14,6 @@ module Thrift VERSION_MASK = 0xffff0000 VERSION_1 = 0x80010000 - def initialize(trans) - super(trans) - end - def write_message_begin(name, type, seqid) write_i32(VERSION_1 | type) write_string(name) @@ -29,7 +25,7 @@ module Thrift write_i16(id) end - def write_field_stop() + def write_field_stop write_byte(Thrift::Types::STOP) end @@ -84,51 +80,51 @@ module Thrift trans.write(str) end - def read_message_begin() - version = read_i32() + def read_message_begin + version = read_i32 if (version & VERSION_MASK != VERSION_1) raise ProtocolException.new(ProtocolException::BAD_VERSION, 'Missing version identifier') end type = version & 0x000000ff - name = read_string() - seqid = read_i32() + name = read_string + seqid = read_i32 return name, type, seqid end - def read_field_begin() - type = read_byte() + def read_field_begin + type = read_byte if (type === Types::STOP) return nil, type, 0 end - id = read_i16() + id = read_i16 return nil, type, id end - def read_map_begin() - ktype = read_byte() - vtype = read_byte() - size = read_i32() + def read_map_begin + ktype = read_byte + vtype = read_byte + size = read_i32 return ktype, vtype, size end - def read_list_begin() - etype = read_byte() - size = read_i32() + def read_list_begin + etype = read_byte + size = read_i32 return etype, size end - def read_set_begin() - etype = read_byte() - size = read_i32() + def read_set_begin + etype = read_byte + size = read_i32 return etype, size end - def read_bool() - byte = read_byte() + def read_bool + byte = read_byte return byte != 0 end - def read_byte() + def read_byte dat = trans.read_all(1) val = dat[0] if (val > 0x7f) @@ -137,7 +133,7 @@ module Thrift return val end - def read_i16() + def read_i16 dat = trans.read_all(2) val, = dat.unpack('n') if (val > 0x7fff) @@ -146,7 +142,7 @@ module Thrift return val end - def read_i32() + def read_i32 dat = trans.read_all(4) val, = dat.unpack('N') if (val > 0x7fffffff) @@ -155,7 +151,7 @@ module Thrift return val end - def read_i64() + def read_i64 dat = trans.read_all(8) hi, lo = dat.unpack('N2') if (hi > 0x7fffffff) @@ -167,14 +163,14 @@ module Thrift end end - def read_double() + def read_double dat = trans.read_all(8) val, = dat.unpack('G') return val end - def read_string() - sz = read_i32() + def read_string + sz = read_i32 dat = trans.read_all(sz) return dat end