msgpack 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/extconf.rb +1 -1
- data/ext/version.rb +1 -1
- data/msgpack/pack_template.h +1 -1
- data/msgpack/sysdep.h +69 -24
- metadata +17 -17
data/ext/extconf.rb
CHANGED
data/ext/version.rb
CHANGED
data/msgpack/pack_template.h
CHANGED
@@ -728,7 +728,7 @@ msgpack_pack_inline_func(_map)(msgpack_pack_user x, unsigned int n)
|
|
728
728
|
msgpack_pack_inline_func(_raw)(msgpack_pack_user x, size_t l)
|
729
729
|
{
|
730
730
|
if(l < 32) {
|
731
|
-
unsigned char d = 0xa0 | l;
|
731
|
+
unsigned char d = 0xa0 | (uint8_t)l;
|
732
732
|
msgpack_pack_append_buffer(x, &TAKE8_8(d), 1);
|
733
733
|
} else if(l < 65536) {
|
734
734
|
unsigned char buf[3];
|
data/msgpack/sysdep.h
CHANGED
@@ -36,19 +36,19 @@ typedef unsigned __int64 uint64_t;
|
|
36
36
|
#include <stdbool.h>
|
37
37
|
#endif
|
38
38
|
|
39
|
-
|
40
39
|
#ifdef _WIN32
|
41
40
|
#define _msgpack_atomic_counter_header <windows.h>
|
42
41
|
typedef long _msgpack_atomic_counter_t;
|
43
42
|
#define _msgpack_sync_decr_and_fetch(ptr) InterlockedDecrement(ptr)
|
44
43
|
#define _msgpack_sync_incr_and_fetch(ptr) InterlockedIncrement(ptr)
|
44
|
+
#elif defined(__GNUC__) && ((__GNUC__*10 + __GNUC_MINOR__) < 41)
|
45
|
+
#define _msgpack_atomic_counter_header "gcc_atomic.h"
|
45
46
|
#else
|
46
47
|
typedef unsigned int _msgpack_atomic_counter_t;
|
47
48
|
#define _msgpack_sync_decr_and_fetch(ptr) __sync_sub_and_fetch(ptr, 1)
|
48
49
|
#define _msgpack_sync_incr_and_fetch(ptr) __sync_add_and_fetch(ptr, 1)
|
49
50
|
#endif
|
50
51
|
|
51
|
-
|
52
52
|
#ifdef _WIN32
|
53
53
|
|
54
54
|
#ifdef __cplusplus
|
@@ -84,9 +84,9 @@ typedef unsigned int _msgpack_atomic_counter_t;
|
|
84
84
|
# elif defined(_byteswap_ushort) || (defined(_MSC_VER) && _MSC_VER >= 1400)
|
85
85
|
# define _msgpack_be16(x) ((uint16_t)_byteswap_ushort((unsigned short)x))
|
86
86
|
# else
|
87
|
-
# define _msgpack_be16(x) \
|
88
|
-
|
89
|
-
|
87
|
+
# define _msgpack_be16(x) ( \
|
88
|
+
((((uint16_t)x) << 8) ) | \
|
89
|
+
((((uint16_t)x) >> 8) ) )
|
90
90
|
# endif
|
91
91
|
#else
|
92
92
|
# define _msgpack_be16(x) ntohs(x)
|
@@ -99,10 +99,10 @@ typedef unsigned int _msgpack_atomic_counter_t;
|
|
99
99
|
# define _msgpack_be32(x) ((uint32_t)_byteswap_ulong((unsigned long)x))
|
100
100
|
# else
|
101
101
|
# define _msgpack_be32(x) \
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
102
|
+
( ((((uint32_t)x) << 24) ) | \
|
103
|
+
((((uint32_t)x) << 8) & 0x00ff0000U ) | \
|
104
|
+
((((uint32_t)x) >> 8) & 0x0000ff00U ) | \
|
105
|
+
((((uint32_t)x) >> 24) ) )
|
106
106
|
# endif
|
107
107
|
#else
|
108
108
|
# define _msgpack_be32(x) ntohl(x)
|
@@ -116,34 +116,79 @@ typedef unsigned int _msgpack_atomic_counter_t;
|
|
116
116
|
# define _msgpack_be64(x) __DARWIN_OSSwapInt64(x)
|
117
117
|
#else
|
118
118
|
#define _msgpack_be64(x) \
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
119
|
+
( ((((uint64_t)x) << 56) ) | \
|
120
|
+
((((uint64_t)x) << 40) & 0x00ff000000000000ULL ) | \
|
121
|
+
((((uint64_t)x) << 24) & 0x0000ff0000000000ULL ) | \
|
122
|
+
((((uint64_t)x) << 8) & 0x000000ff00000000ULL ) | \
|
123
|
+
((((uint64_t)x) >> 8) & 0x00000000ff000000ULL ) | \
|
124
|
+
((((uint64_t)x) >> 24) & 0x0000000000ff0000ULL ) | \
|
125
|
+
((((uint64_t)x) >> 40) & 0x000000000000ff00ULL ) | \
|
126
|
+
((((uint64_t)x) >> 56) ) )
|
127
127
|
#endif
|
128
128
|
|
129
|
+
#define _msgpack_load16(cast, from) ((cast)( \
|
130
|
+
(((uint16_t)((uint8_t*)(from))[0]) << 8) | \
|
131
|
+
(((uint16_t)((uint8_t*)(from))[1]) ) ))
|
132
|
+
|
133
|
+
#define _msgpack_load32(cast, from) ((cast)( \
|
134
|
+
(((uint32_t)((uint8_t*)(from))[0]) << 24) | \
|
135
|
+
(((uint32_t)((uint8_t*)(from))[1]) << 16) | \
|
136
|
+
(((uint32_t)((uint8_t*)(from))[2]) << 8) | \
|
137
|
+
(((uint32_t)((uint8_t*)(from))[3]) ) ))
|
138
|
+
|
139
|
+
#define _msgpack_load64(cast, from) ((cast)( \
|
140
|
+
(((uint64_t)((uint8_t*)(from))[0]) << 56) | \
|
141
|
+
(((uint64_t)((uint8_t*)(from))[1]) << 48) | \
|
142
|
+
(((uint64_t)((uint8_t*)(from))[2]) << 40) | \
|
143
|
+
(((uint64_t)((uint8_t*)(from))[3]) << 32) | \
|
144
|
+
(((uint64_t)((uint8_t*)(from))[4]) << 24) | \
|
145
|
+
(((uint64_t)((uint8_t*)(from))[5]) << 16) | \
|
146
|
+
(((uint64_t)((uint8_t*)(from))[6]) << 8) | \
|
147
|
+
(((uint64_t)((uint8_t*)(from))[7]) ) ))
|
148
|
+
|
129
149
|
#else
|
150
|
+
|
130
151
|
#define _msgpack_be16(x) (x)
|
131
152
|
#define _msgpack_be32(x) (x)
|
132
153
|
#define _msgpack_be64(x) (x)
|
154
|
+
|
155
|
+
#define _msgpack_load16(cast, from) ((cast)( \
|
156
|
+
(((uint16_t)((uint8_t*)from)[1]) << 8) | \
|
157
|
+
(((uint16_t)((uint8_t*)from)[0]) ) ))
|
158
|
+
|
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]) ) ))
|
164
|
+
|
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]) ) ))
|
133
174
|
#endif
|
134
175
|
|
135
176
|
|
136
177
|
#define _msgpack_store16(to, num) \
|
137
|
-
|
178
|
+
do { uint16_t val = _msgpack_be16(num); memcpy(to, &val, 2); } while(0)
|
138
179
|
#define _msgpack_store32(to, num) \
|
139
|
-
|
180
|
+
do { uint32_t val = _msgpack_be32(num); memcpy(to, &val, 4); } while(0)
|
140
181
|
#define _msgpack_store64(to, num) \
|
141
|
-
|
142
|
-
|
182
|
+
do { uint64_t val = _msgpack_be64(num); memcpy(to, &val, 8); } while(0)
|
143
183
|
|
144
|
-
|
145
|
-
#define
|
146
|
-
|
184
|
+
/*
|
185
|
+
#define _msgpack_load16(cast, from) \
|
186
|
+
({ cast val; memcpy(&val, (char*)from, 2); _msgpack_be16(val); })
|
187
|
+
#define _msgpack_load32(cast, from) \
|
188
|
+
({ cast val; memcpy(&val, (char*)from, 4); _msgpack_be32(val); })
|
189
|
+
#define _msgpack_load64(cast, from) \
|
190
|
+
({ cast val; memcpy(&val, (char*)from, 8); _msgpack_be64(val); })
|
191
|
+
*/
|
147
192
|
|
148
193
|
|
149
194
|
#endif /* msgpack/sysdep.h */
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msgpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 6
|
10
|
+
version: 0.4.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- FURUHASHI Sadayuki
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-09 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -28,28 +28,28 @@ extensions:
|
|
28
28
|
extra_rdoc_files: []
|
29
29
|
|
30
30
|
files:
|
31
|
+
- ext/compat.h
|
31
32
|
- ext/extconf.rb
|
33
|
+
- ext/pack.c
|
32
34
|
- ext/pack.h
|
35
|
+
- ext/rbinit.c
|
33
36
|
- ext/unpack.c
|
34
|
-
- ext/pack.c
|
35
|
-
- ext/compat.h
|
36
37
|
- ext/unpack.h
|
37
|
-
- ext/rbinit.c
|
38
38
|
- ext/version.rb
|
39
|
-
- msgpack/pack_template.h
|
40
39
|
- msgpack/pack_define.h
|
40
|
+
- msgpack/pack_template.h
|
41
41
|
- msgpack/sysdep.h
|
42
42
|
- msgpack/unpack_define.h
|
43
43
|
- msgpack/unpack_template.h
|
44
|
-
- test/test_pack_unpack.rb
|
45
|
-
- test/test_helper.rb
|
46
|
-
- test/test_encoding.rb
|
47
|
-
- test/test_cases.rb
|
48
|
-
- test/cases.mpac
|
49
44
|
- test/cases.json
|
45
|
+
- test/cases.mpac
|
50
46
|
- test/cases_compact.mpac
|
47
|
+
- test/test_cases.rb
|
48
|
+
- test/test_encoding.rb
|
49
|
+
- test/test_helper.rb
|
50
|
+
- test/test_pack_unpack.rb
|
51
51
|
has_rdoc: true
|
52
|
-
homepage: http://msgpack.
|
52
|
+
homepage: http://msgpack.org/
|
53
53
|
licenses: []
|
54
54
|
|
55
55
|
post_install_message:
|
@@ -83,7 +83,7 @@ signing_key:
|
|
83
83
|
specification_version: 3
|
84
84
|
summary: MessagePack, a binary-based efficient data interchange format.
|
85
85
|
test_files:
|
86
|
-
- test/test_pack_unpack.rb
|
87
|
-
- test/test_helper.rb
|
88
|
-
- test/test_encoding.rb
|
89
86
|
- test/test_cases.rb
|
87
|
+
- test/test_encoding.rb
|
88
|
+
- test/test_helper.rb
|
89
|
+
- test/test_pack_unpack.rb
|