ruby-protocol-buffers 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -18,3 +18,6 @@ matrix:
18
18
  gemfile: Gemfile
19
19
  - rvm: jruby-19mode
20
20
  gemfile: Gemfile
21
+ allow_failures:
22
+ # https://github.com/rubinius/rubinius/issues/2215
23
+ - rvm: rbx-19mode
@@ -1,5 +1,4 @@
1
1
  class LimitedIO < Struct.new(:parent, :limit)
2
-
3
2
  def read(length = nil, buffer = nil)
4
3
  length = length || limit
5
4
  length = limit if length > limit
@@ -23,11 +22,4 @@ class LimitedIO < Struct.new(:parent, :limit)
23
22
  self.limit -= 1
24
23
  parent.getbyte
25
24
  end
26
-
27
- def getc
28
- return nil if limit == 0
29
- self.limit -= 1
30
- parent.getc
31
- end
32
-
33
25
  end
@@ -23,11 +23,7 @@ module ProtocolBuffers
23
23
  shift = 0
24
24
  loop do
25
25
  raise(DecodeError, "too many bytes when decoding varint") if shift >= 64
26
- # this works in 1.8.7 and 1.9.x, but for different reasons
27
- # in 1.8.7 io.getc returns the int representation of the char, and .ord is a noop. String#ord doesn't exist.
28
- # in 1.9.3 io.getc returns a String, and .ord returns the int representation of the first char.
29
- # this fails in 1.8.6, which is no longer supported by ruby-protocol-buffers.
30
- byte = io.getc.ord
26
+ byte = io.getbyte
31
27
  int_val |= (byte & 0b0111_1111) << shift
32
28
  shift += 7
33
29
  return int_val if (byte & 0b1000_0000) == 0
@@ -1,3 +1,3 @@
1
1
  module ProtocolBuffers
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
  end
data/spec/runtime_spec.rb CHANGED
@@ -614,4 +614,15 @@ describe ProtocolBuffers, "runtime" do
614
614
  end
615
615
  end
616
616
 
617
+ it "should work with IO streams not set to binary" do
618
+ pending("requires encoding support") unless "".respond_to?(:encoding)
619
+ class IntMsg < ProtocolBuffers::Message
620
+ required :int32, :i, 1
621
+ end
622
+ sio = StringIO.new("\b\xc3\x911")
623
+ sio.set_encoding('utf-8')
624
+ msg = IntMsg.parse(sio)
625
+ msg.i.should == 805059
626
+ end
627
+
617
628
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-protocol-buffers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-02-26 00:00:00.000000000 Z
15
+ date: 2013-03-22 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: autotest-standalone