protobuf 2.8.3 → 2.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99faa34dcab90672042c22bf0d26d6f4c0a4c744
4
- data.tar.gz: 20ebf82a6795eae334a29e5bcc1e8f6e4256bfd5
3
+ metadata.gz: ce09086e344463e2c1193ad642e5ddf90186a40b
4
+ data.tar.gz: e215cd2b66f2a290ed0193a4dae2ec7329780de5
5
5
  SHA512:
6
- metadata.gz: f28ad5326df4358721e6ffd7924f2acdfd6cd5931b8a2fff9b7d57bd44e8adb67e3617a79d03621437c7206c1f4c3e56b2e1bc64ff1ca85ae8158a7d7bb71cfb
7
- data.tar.gz: 88dcfaa540f8d5357eb0825cba17c60d4197cf57bd8345f39053f2e00a4fbe341fedb494e783e97ea722477cd4f789d30b4effb925df8e5bb945714b19d79554
6
+ metadata.gz: 51c1d0bea9a61d7d6b921ec859419ebbdac79a75efc54987b5cbaa7a378069d75755e6d04c47ab2c2d1b5f4fd71d206b2a89d5fe069db5e6b6e607b1cfc9428f
7
+ data.tar.gz: 172872992b14d0b53d1375789a4c2ea76519c4bc8b560fcc9b752fbc68822ada11cea4987ff2b5319a79bd68295d8fc7b71100510f73d49383ea8d79fe7af61b
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ 2.8.4
2
+ ----------
3
+
4
+ - Fix issue where frozen strings assigned in a repeated field would cause encoding runtime errors. (#117)
5
+
1
6
  2.8.3
2
7
  ----------
3
8
 
@@ -10,8 +10,9 @@ module Protobuf
10
10
  bytes
11
11
  end
12
12
 
13
+ # TODO: make replace character configurable?
13
14
  def encode(value)
14
- # TODO: make replace character configurable?
15
+ value = value.dup if value.frozen?
15
16
  value.encode!(::Protobuf::Field::StringField::ENCODING, :invalid => :replace, :undef => :replace, :replace => "")
16
17
  value.force_encoding(::Protobuf::Field::BytesField::BYTES_ENCODING)
17
18
 
@@ -1,4 +1,4 @@
1
1
  module Protobuf
2
- VERSION = '2.8.3'
2
+ VERSION = '2.8.4'
3
3
  PROTOC_VERSION = '2.5.0'
4
4
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe ::Protobuf::Field::StringField do
4
+ describe '#encode' do
5
+ context 'when a repeated string field contains frozen strings' do
6
+ it 'does not raise an encoding error' do
7
+ expect {
8
+ frozen_strings = [ "foo".freeze, "bar".freeze, "baz".freeze ]
9
+ ::Test::ResourceFindRequest.encode(:name => 'resource', :widgets => frozen_strings)
10
+ }.not_to raise_error
11
+ end
12
+ end
13
+
14
+ context 'when a repeated bytes field contains frozen strings' do
15
+ it 'does not raise an encoding error' do
16
+ expect {
17
+ frozen_strings = [ "foo".freeze, "bar".freeze, "baz".freeze ]
18
+ ::Test::ResourceFindRequest.encode(:name => 'resource', :widget_bytes => frozen_strings)
19
+ }.not_to raise_error
20
+ end
21
+ end
22
+ end
23
+ end
@@ -49,6 +49,8 @@ module Test
49
49
  class ResourceFindRequest
50
50
  required ::Protobuf::Field::StringField, :name, 1
51
51
  optional ::Protobuf::Field::BoolField, :active, 2
52
+ repeated ::Protobuf::Field::StringField, :widgets, 3
53
+ repeated ::Protobuf::Field::BytesField, :widget_bytes, 4
52
54
  end
53
55
 
54
56
  class ResourceSleepRequest
@@ -10,6 +10,8 @@ enum StatusType {
10
10
  message ResourceFindRequest {
11
11
  required string name = 1;
12
12
  optional bool active = 2;
13
+ repeated string widgets = 3;
14
+ repeated bytes widget_bytes = 4;
13
15
  }
14
16
 
15
17
  message ResourceSleepRequest {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.3
4
+ version: 2.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - BJ Neilsen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-09-04 00:00:00.000000000 Z
13
+ date: 2013-09-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -292,6 +292,7 @@ files:
292
292
  - spec/lib/protobuf/enum_spec.rb
293
293
  - spec/lib/protobuf/enum_value_spec.rb
294
294
  - spec/lib/protobuf/field/int32_field_spec.rb
295
+ - spec/lib/protobuf/field/string_field_spec.rb
295
296
  - spec/lib/protobuf/generators/base_spec.rb
296
297
  - spec/lib/protobuf/generators/enum_generator_spec.rb
297
298
  - spec/lib/protobuf/generators/extension_generator_spec.rb
@@ -385,6 +386,7 @@ test_files:
385
386
  - spec/lib/protobuf/enum_spec.rb
386
387
  - spec/lib/protobuf/enum_value_spec.rb
387
388
  - spec/lib/protobuf/field/int32_field_spec.rb
389
+ - spec/lib/protobuf/field/string_field_spec.rb
388
390
  - spec/lib/protobuf/generators/base_spec.rb
389
391
  - spec/lib/protobuf/generators/enum_generator_spec.rb
390
392
  - spec/lib/protobuf/generators/extension_generator_spec.rb