msgpack 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,7 @@
1
1
  require 'mkmf'
2
2
  require './version.rb'
3
3
  $CFLAGS << %[ -I.. -Wall -O3 -DMESSAGEPACK_VERSION=\\"#{MessagePack::VERSION}\\" -g]
4
+ have_header("ruby/st.h")
5
+ have_header("st.h")
4
6
  create_makefile('msgpack')
5
7
 
data/ext/pack.c CHANGED
@@ -15,6 +15,7 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
+ #define RSTRING_NOT_MODIFIED
18
19
  #include "ruby.h"
19
20
  #include "compat.h"
20
21
 
@@ -39,8 +40,10 @@ static ID s_append;
39
40
  #include "msgpack/pack_template.h"
40
41
 
41
42
 
42
- #ifndef RUBY_VM
43
- #include "st.h" // ruby hash
43
+ #if defined(HAVE_RUBY_ST_H)
44
+ #include "ruby/st.h" // ruby hash on Ruby 1.9
45
+ #elif defined(HAVE_ST_H)
46
+ #include "st.h" // ruby hash on Ruby 1.8
44
47
  #endif
45
48
 
46
49
  #define ARG_BUFFER(name, argc, argv) \
@@ -219,11 +222,12 @@ static VALUE MessagePack_Array_to_msgpack(int argc, VALUE *argv, VALUE self)
219
222
  {
220
223
  ARG_BUFFER(out, argc, argv);
221
224
  // FIXME check sizeof(long) > sizeof(unsigned int) && RARRAY_LEN(self) > UINT_MAX
222
- msgpack_pack_array(out, (unsigned int)RARRAY_LEN(self));
223
- VALUE* p = RARRAY_PTR(self);
224
- VALUE* const pend = p + RARRAY_LEN(self);
225
- for(;p != pend; ++p) {
226
- rb_funcall(*p, s_to_msgpack, 1, out);
225
+ unsigned int ary_length = (unsigned int)RARRAY_LEN(self);
226
+ unsigned int i = 0;
227
+ msgpack_pack_array(out, ary_length);
228
+ for(; i < ary_length; ++i) {
229
+ VALUE p = rb_ary_entry(self, i);
230
+ rb_funcall(p, s_to_msgpack, 1, out);
227
231
  }
228
232
  return out;
229
233
  }
@@ -112,7 +112,7 @@ static inline int template_callback_array(unpack_user* u, unsigned int n, VALUE*
112
112
  { *o = rb_ary_new2(n); return 0; }
113
113
 
114
114
  static inline int template_callback_array_item(unpack_user* u, VALUE* c, VALUE o)
115
- { rb_ary_push(*c, o); return 0; } // FIXME set value directry RARRAY_PTR(obj)[RARRAY_LEN(obj)++]
115
+ { rb_ary_push(*c, o); return 0; }
116
116
 
117
117
  static inline int template_callback_map(unpack_user* u, unsigned int n, VALUE* o)
118
118
  { *o = rb_hash_new(); return 0; }
@@ -1,3 +1,3 @@
1
1
  module MessagePack
2
- VERSION = "0.4.6"
2
+ VERSION = "0.4.7"
3
3
  end
@@ -646,7 +646,12 @@ msgpack_pack_inline_func(_double)(msgpack_pack_user x, double d)
646
646
  union { double f; uint64_t i; } mem;
647
647
  mem.f = d;
648
648
  unsigned char buf[9];
649
- buf[0] = 0xcb; _msgpack_store64(&buf[1], mem.i);
649
+ buf[0] = 0xcb;
650
+ #if defined(__arm__) && !(__ARM_EABI__) // arm-oabi
651
+ // https://github.com/msgpack/msgpack-perl/pull/1
652
+ mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
653
+ #endif
654
+ _msgpack_store64(&buf[1], mem.i);
650
655
  msgpack_pack_append_buffer(x, buf, 9);
651
656
  }
652
657
 
@@ -153,24 +153,24 @@ typedef unsigned int _msgpack_atomic_counter_t;
153
153
  #define _msgpack_be64(x) (x)
154
154
 
155
155
  #define _msgpack_load16(cast, from) ((cast)( \
156
- (((uint16_t)((uint8_t*)from)[1]) << 8) | \
157
- (((uint16_t)((uint8_t*)from)[0]) ) ))
156
+ (((uint16_t)((uint8_t*)from)[0]) << 8) | \
157
+ (((uint16_t)((uint8_t*)from)[1]) ) ))
158
158
 
159
159
  #define _msgpack_load32(cast, from) ((cast)( \
160
- (((uint32_t)((uint8_t*)from)[3]) << 24) | \
161
- (((uint32_t)((uint8_t*)from)[2]) << 16) | \
162
- (((uint32_t)((uint8_t*)from)[1]) << 8) | \
163
- (((uint32_t)((uint8_t*)from)[0]) ) ))
160
+ (((uint32_t)((uint8_t*)from)[0]) << 24) | \
161
+ (((uint32_t)((uint8_t*)from)[1]) << 16) | \
162
+ (((uint32_t)((uint8_t*)from)[2]) << 8) | \
163
+ (((uint32_t)((uint8_t*)from)[3]) ) ))
164
164
 
165
165
  #define _msgpack_load64(cast, from) ((cast)( \
166
- (((uint64_t)((uint8_t*)from)[7]) << 56) | \
167
- (((uint64_t)((uint8_t*)from)[6]) << 48) | \
168
- (((uint64_t)((uint8_t*)from)[5]) << 40) | \
169
- (((uint64_t)((uint8_t*)from)[4]) << 32) | \
170
- (((uint64_t)((uint8_t*)from)[3]) << 24) | \
171
- (((uint64_t)((uint8_t*)from)[2]) << 16) | \
172
- (((uint64_t)((uint8_t*)from)[1]) << 8) | \
173
- (((uint64_t)((uint8_t*)from)[0]) ) ))
166
+ (((uint64_t)((uint8_t*)from)[0]) << 56) | \
167
+ (((uint64_t)((uint8_t*)from)[1]) << 48) | \
168
+ (((uint64_t)((uint8_t*)from)[2]) << 40) | \
169
+ (((uint64_t)((uint8_t*)from)[3]) << 32) | \
170
+ (((uint64_t)((uint8_t*)from)[4]) << 24) | \
171
+ (((uint64_t)((uint8_t*)from)[5]) << 16) | \
172
+ (((uint64_t)((uint8_t*)from)[6]) << 8) | \
173
+ (((uint64_t)((uint8_t*)from)[7]) ) ))
174
174
  #endif
175
175
 
176
176
 
@@ -263,6 +263,10 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
263
263
  case CS_DOUBLE: {
264
264
  union { uint64_t i; double f; } mem;
265
265
  mem.i = _msgpack_load64(uint64_t,n);
266
+ #if defined(__arm__) && !(__ARM_EABI__) // arm-oabi
267
+ // https://github.com/msgpack/msgpack-perl/pull/1
268
+ mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
269
+ #endif
266
270
  push_fixed_value(_double, mem.f); }
267
271
  case CS_UINT_8:
268
272
  push_fixed_value(_uint8, *(uint8_t*)n);
metadata CHANGED
@@ -1,33 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
- version: !ruby/object:Gem::Version
4
- hash: 3
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 4
9
- - 6
10
- version: 0.4.6
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.7
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - FURUHASHI Sadayuki
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-08-09 00:00:00 +09:00
19
- default_executable:
12
+ date: 2012-05-06 00:00:00.000000000Z
20
13
  dependencies: []
21
-
22
14
  description:
23
15
  email: frsyuki@users.sourceforge.jp
24
16
  executables: []
25
-
26
- extensions:
17
+ extensions:
27
18
  - ext/extconf.rb
28
19
  extra_rdoc_files: []
29
-
30
- files:
20
+ files:
31
21
  - ext/compat.h
32
22
  - ext/extconf.rb
33
23
  - ext/pack.c
@@ -48,42 +38,34 @@ files:
48
38
  - test/test_encoding.rb
49
39
  - test/test_helper.rb
50
40
  - test/test_pack_unpack.rb
51
- has_rdoc: true
52
41
  homepage: http://msgpack.org/
53
42
  licenses: []
54
-
55
43
  post_install_message:
56
- rdoc_options:
44
+ rdoc_options:
57
45
  - ext
58
- require_paths:
46
+ require_paths:
59
47
  - lib
60
- required_ruby_version: !ruby/object:Gem::Requirement
48
+ required_ruby_version: !ruby/object:Gem::Requirement
61
49
  none: false
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- hash: 3
66
- segments:
67
- - 0
68
- version: "0"
69
- required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
55
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
78
60
  requirements: []
79
-
80
61
  rubyforge_project: msgpack
81
- rubygems_version: 1.3.7
62
+ rubygems_version: 1.8.12
82
63
  signing_key:
83
64
  specification_version: 3
84
65
  summary: MessagePack, a binary-based efficient data interchange format.
85
- test_files:
66
+ test_files:
86
67
  - test/test_cases.rb
87
68
  - test/test_encoding.rb
88
69
  - test/test_helper.rb
89
70
  - test/test_pack_unpack.rb
71
+ has_rdoc: true