msgpack 0.4.0-x86-mingw32 → 0.4.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/unpack.c +28 -14
- data/lib/1.8/msgpack.so +0 -0
- data/lib/1.9/msgpack.so +0 -0
- metadata +3 -3
data/ext/unpack.c
CHANGED
@@ -156,15 +156,27 @@ static inline int template_callback_raw(unpack_user* u, const char* b, const cha
|
|
156
156
|
rb_raise(rb_eTypeError, "instance of String needed"); \
|
157
157
|
}
|
158
158
|
|
159
|
+
#ifdef RUBY_VM
|
160
|
+
#define RERAISE rb_exc_raise(rb_errinfo())
|
161
|
+
#else
|
162
|
+
#define RERAISE rb_exc_raise(ruby_errinfo)
|
163
|
+
#endif
|
159
164
|
|
160
|
-
|
165
|
+
|
166
|
+
#ifdef HAVE_RUBY_ENCODING_H
|
167
|
+
static VALUE template_execute_rescue_enc(VALUE data)
|
161
168
|
{
|
162
169
|
rb_gc_enable();
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
170
|
+
VALUE* resc = (VALUE*)data;
|
171
|
+
rb_enc_set_index(resc[0], (int)resc[1]);
|
172
|
+
RERAISE;
|
173
|
+
}
|
167
174
|
#endif
|
175
|
+
|
176
|
+
static VALUE template_execute_rescue(VALUE nouse)
|
177
|
+
{
|
178
|
+
rb_gc_enable();
|
179
|
+
RERAISE;
|
168
180
|
}
|
169
181
|
|
170
182
|
static VALUE template_execute_do(VALUE argv)
|
@@ -192,7 +204,6 @@ static int template_execute_wrap(msgpack_unpack_t* mp,
|
|
192
204
|
};
|
193
205
|
|
194
206
|
#ifdef HAVE_RUBY_ENCODING_H
|
195
|
-
// FIXME encodingをASCII-8BITにする
|
196
207
|
int enc_orig = rb_enc_get_index(str);
|
197
208
|
rb_enc_set_index(str, s_ascii_8bit);
|
198
209
|
#endif
|
@@ -202,10 +213,14 @@ static int template_execute_wrap(msgpack_unpack_t* mp,
|
|
202
213
|
|
203
214
|
mp->user.source = str;
|
204
215
|
|
216
|
+
#ifdef HAVE_RUBY_ENCODING_H
|
217
|
+
VALUE resc[2] = {str, enc_orig};
|
218
|
+
int ret = (int)rb_rescue(template_execute_do, (VALUE)args,
|
219
|
+
template_execute_rescue_enc, (VALUE)resc);
|
220
|
+
#else
|
205
221
|
int ret = (int)rb_rescue(template_execute_do, (VALUE)args,
|
206
222
|
template_execute_rescue, Qnil);
|
207
|
-
|
208
|
-
mp->user.source = Qnil;
|
223
|
+
#endif
|
209
224
|
|
210
225
|
rb_gc_enable();
|
211
226
|
|
@@ -229,6 +244,8 @@ static int template_execute_wrap_each(msgpack_unpack_t* mp,
|
|
229
244
|
// FIXME execute実行中はmp->topが更新されないのでGC markが機能しない
|
230
245
|
rb_gc_disable();
|
231
246
|
|
247
|
+
mp->user.source = Qnil;
|
248
|
+
|
232
249
|
int ret = (int)rb_rescue(template_execute_do, (VALUE)args,
|
233
250
|
template_execute_rescue, Qnil);
|
234
251
|
|
@@ -401,8 +418,7 @@ static void feed_buffer(msgpack_unpack_t* mp, const char* ptr, size_t len)
|
|
401
418
|
struct unpack_buffer* buffer = &mp->user.buffer;
|
402
419
|
|
403
420
|
if(buffer->size == 0) {
|
404
|
-
char* tmp = (char
|
405
|
-
// FIXME check tmp == NULL
|
421
|
+
char* tmp = ALLOC_N(char, MSGPACK_UNPACKER_BUFFER_INIT_SIZE);
|
406
422
|
buffer->ptr = tmp;
|
407
423
|
buffer->free = MSGPACK_UNPACKER_BUFFER_INIT_SIZE;
|
408
424
|
buffer->size = 0;
|
@@ -430,8 +446,7 @@ static void feed_buffer(msgpack_unpack_t* mp, const char* ptr, size_t len)
|
|
430
446
|
while(csize < buffer->size + len) {
|
431
447
|
csize *= 2;
|
432
448
|
}
|
433
|
-
char* tmp = (
|
434
|
-
// FIXME check tmp == NULL
|
449
|
+
char* tmp = REALLOC_N(buffer->ptr, char, csize);
|
435
450
|
memcpy(tmp + buffer->size, ptr, len);
|
436
451
|
buffer->ptr = tmp;
|
437
452
|
buffer->free = csize - buffer->size;
|
@@ -446,8 +461,7 @@ static void feed_buffer(msgpack_unpack_t* mp, const char* ptr, size_t len)
|
|
446
461
|
while(csize < not_parsed + len) {
|
447
462
|
csize *= 2;
|
448
463
|
}
|
449
|
-
char* tmp = (
|
450
|
-
// FIXME check tmp == NULL
|
464
|
+
char* tmp = REALLOC_N(buffer->ptr, char, csize);
|
451
465
|
buffer->ptr = tmp;
|
452
466
|
}
|
453
467
|
|
data/lib/1.8/msgpack.so
CHANGED
Binary file
|
data/lib/1.9/msgpack.so
CHANGED
Binary file
|
metadata
CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
segments:
|
5
5
|
- 0
|
6
6
|
- 4
|
7
|
-
-
|
8
|
-
version: 0.4.
|
7
|
+
- 1
|
8
|
+
version: 0.4.1
|
9
9
|
platform: x86-mingw32
|
10
10
|
authors:
|
11
11
|
- FURUHASHI Sadayuki
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2010-05-
|
16
|
+
date: 2010-05-27 00:00:00 +09:00
|
17
17
|
default_executable:
|
18
18
|
dependencies: []
|
19
19
|
|