fast_osc 0.0.10 → 0.0.11

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: 508967c0e5e99fef79f7f3cc09bbe81fa82e0ee3
4
- data.tar.gz: 281e6bae19a455de611780448a9238afde2f66d7
3
+ metadata.gz: 3615d5a4fa5494a0ad2cfafe7c7bb143d5a277a4
4
+ data.tar.gz: 38ebafa5000ef23eacf2dfefd99808958483f3ba
5
5
  SHA512:
6
- metadata.gz: bc96c488b7ea7b0c7e357e692efdc16351c2596731307ea51bc57d4ea52b2369d0367102170a73ab2c57f8bce6fbf27485e6123b71ea99a3f4f8cd94b53b8c5b
7
- data.tar.gz: f2b0e4f6104a27077c48dafe65584e42628c6ab88e6def545cc1f6bfdf2a46e50977df2acef945b7f5dae77503c2e8ad80cbd374c07e089ab50d7672971fba22
6
+ metadata.gz: 83a69f85ba11e17f26731b7eec9e439686a44ec757ab631841916de3044fbadea7ca03299588ff4d7f59b4f8f0eb7afe499e55d1b5f5164365b2da7385c76cf7
7
+ data.tar.gz: 2a00b2f5615da6bdd7c7e5eb69fb06a3e3b44014a78e29c539969789a29a143a040b9f19f2b39976306fd8b6171b81b0f2019faa9311a7b0cde978a5e67a3231
@@ -1,7 +1,9 @@
1
1
  #include <ruby.h>
2
+ #include <ruby/encoding.h>
2
3
  #include <rtosc.h>
3
4
  #include <rtosc.c>
4
5
 
6
+
5
7
  // Allocate VALUE variables to hold the modules we'll create. Ruby values
6
8
  // are all of type VALUE. Qnil is the C representation of Ruby's nil.
7
9
  VALUE FastOsc = Qnil;
@@ -73,6 +75,8 @@ VALUE method_fast_osc_decode_single_message(VALUE self, VALUE msg) {
73
75
  itr = rtosc_itr_begin(data);
74
76
  VALUE output = rb_ary_new();
75
77
  VALUE args_output = rb_ary_new();
78
+ VALUE string_arg;
79
+ int enc;
76
80
 
77
81
  VALUE path = rb_str_new2(rtosc_path(data));
78
82
 
@@ -94,7 +98,11 @@ VALUE method_fast_osc_decode_single_message(VALUE self, VALUE msg) {
94
98
  rb_ary_push(args_output, rb_float_new(next_val.val.f));
95
99
  break;
96
100
  case 's' :
97
- rb_ary_push(args_output, rb_str_new2(next_val.val.s));
101
+ string_arg = rb_str_new2(next_val.val.s);
102
+ enc = rb_enc_find_index("UTF-8");
103
+ rb_enc_associate_index(string_arg, enc);
104
+
105
+ rb_ary_push(args_output, string_arg);
98
106
  break;
99
107
  case 'b' :
100
108
  rb_ary_push(args_output, rb_str_new((const char*)next_val.val.b.data, next_val.val.b.len));
@@ -237,7 +245,7 @@ VALUE method_fast_osc_encode_single_message(int argc, VALUE* argv, VALUE self) {
237
245
 
238
246
  char buffer[max_buffer_size];
239
247
 
240
- int len;
248
+ unsigned long int len;
241
249
  if(RSTRING_LEN(tagstring)) {
242
250
  len = rtosc_amessage(buffer, sizeof(buffer), c_address, StringValueCStr(tagstring), output_args);
243
251
  } else {
@@ -267,7 +275,7 @@ VALUE method_fast_osc_encode_single_bundle(int argc, VALUE* argv, VALUE self) {
267
275
  uint64_t tt = ruby_time_to_osc_timetag(timetag);
268
276
  char output_buffer[bufsize];
269
277
 
270
- int len = rtosc_bundle(output_buffer, bufsize, tt, no_of_elems, StringValuePtr(message));
278
+ unsigned long int len = rtosc_bundle(output_buffer, bufsize, tt, no_of_elems, StringValuePtr(message));
271
279
 
272
280
  VALUE output = rb_str_new(output_buffer, len);
273
281
 
@@ -1,3 +1,3 @@
1
1
  module FastOsc
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -5,7 +5,7 @@ require 'date'
5
5
  class FastOscTest < Minitest::Test
6
6
  def setup
7
7
  @path = "/thisisatest"
8
- @args = ["", 1, 2.0, "baz"]
8
+ @args = ["", 1, 2.0, "baz", "▁▃▅▇"]
9
9
  @timestamp = Date.parse("1st Jan 1990").to_time
10
10
 
11
11
  @msg0 = OSC::Message.new(@path).encode
@@ -40,8 +40,8 @@ class FastOscTest < Minitest::Test
40
40
  def test_that_it_decodes_a_single_message_with_args
41
41
  path, args = FastOsc.decode_single_message(@encoded_msg1)
42
42
 
43
- assert path == @path
44
- assert args == @args
43
+ assert_equal path, @path
44
+ assert_equal args, @args
45
45
  end
46
46
 
47
47
  def test_that_it_encodes_a_single_bundle
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_osc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xavier Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-22 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler