sereal 0.0.14 → 0.0.15

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: be6217bfe2c81f0f7d3629fa097268a8f2c6733d
4
- data.tar.gz: 9fe57e2249069b77131d74a804690bb1c7c552b3
3
+ metadata.gz: e9c00595b7b2a08fc9b2357c3b052ff8a189f2e4
4
+ data.tar.gz: baac3f20a92210853ee70a77472343509a025fb5
5
5
  SHA512:
6
- metadata.gz: cc6658e1080248464d912bfc794c7d0d42a1e825ff25f5ef513b39a9b1e00861278fec81089c2d0a940afd446f827ada673c906b5e4c1628d6b2d5c3d96efe68
7
- data.tar.gz: 220da226733dcb0ef43a96f5505d0de35165468685a3cbf592a8df523cc035b2ce106117cd3f3026451019fff249587551d579ba12d97f0868af04504ac25ca7
6
+ metadata.gz: f9c467d56b2ee8386059b5799da6d40f3aa4dffdb81025ebdc02325593478f34b4ae08ea41a6498a0fb61f680645ef1c8b3e2f2f292158b1a818bb3434c25c72
7
+ data.tar.gz: 85e7ed8c617e392617fa6adbf78bc04e7e758eb20e964a6e452eeff81045eb3dff2601b73a0c61548ea91e0fbae3df7ef8ad0bd87d0abcb383739880f32cf5e3
data/ext/sereal/decode.c CHANGED
@@ -47,7 +47,7 @@ static VALUE s_read_double(sereal_t *s, u8 tag) {
47
47
 
48
48
  /* LONG DOUBLE */
49
49
  static VALUE s_read_long_double(sereal_t *s, u8 tag) {
50
- return DBL2NUM((double) s_get_long_double(s));
50
+ return DBL2NUM((double) s_get_long_double_bang(s));
51
51
  }
52
52
 
53
53
  /* POS */
@@ -105,13 +105,13 @@ static VALUE s_read_rb_string_bang(sereal_t *s,u8 t) {
105
105
  u32 len = 0;
106
106
  VALUE string;
107
107
  // len - 1: we also use the current byte, similar to u32,float.. casts
108
- #define RETURN_STRING(fx_l,fx_gen) \
109
- do { \
110
- len = fx_l; \
111
- u8 *ptr = len == 0 ? 0 : s_get_p_req_inclusive(s,len); \
112
- string = fx_gen; \
113
- s_shift_position_bang(s,len); \
114
- return string; \
108
+ #define RETURN_STRING(fx_l,fx_gen) \
109
+ do { \
110
+ len = fx_l; \
111
+ char *ptr = (char *) (len == 0 ? 0 : s_get_p_req_inclusive(s,len)); \
112
+ string = fx_gen; \
113
+ s_shift_position_bang(s,len); \
114
+ return string; \
115
115
  } while(0);
116
116
 
117
117
  if (t == SRL_HDR_STR_UTF8) {
@@ -180,7 +180,7 @@ static VALUE s_read_ref(sereal_t *s, u8 tag) {
180
180
  s_raise(s,rb_eArgError,"there are no references stored");
181
181
  u64 off = s_get_varint_bang(s);
182
182
  VALUE object = rb_hash_lookup(s->tracked,INT2FIX(off + s->hdr_end));
183
- SD(s,"reading reference from offset: %d, id: %d",off + s->hdr_end,FIX2INT(rb_obj_id(object)));
183
+ SD(s,"reading reference from offset: %llu, id: %d",off + s->hdr_end,FIX2INT(rb_obj_id(object)));
184
184
  return object;
185
185
  }
186
186
 
@@ -338,15 +338,15 @@ again:
338
338
  return Qnil;
339
339
  }
340
340
  if (size < __MIN_SIZE)
341
- s_raise(s,rb_eTypeError,"size(%d) is less then min packet size %d, offset: %d",size,__MIN_SIZE,offset);
341
+ s_raise(s,rb_eTypeError,"size(%d) is less then min packet size %d, offset: %llu",size,__MIN_SIZE,offset);
342
342
 
343
343
  s->flags |= __NOT_MINE;
344
- s->data = RSTRING_PTR(payload) + offset;
344
+ s->data = (u8 *) RSTRING_PTR(payload) + offset;
345
345
  s->size = size;
346
346
  }
347
347
 
348
348
  u32 magic = s_get_u32_bang(s);
349
- if (magic != SRL_MAGIC_STRING_LILIPUTIAN)
349
+ if (magic != SRL_MAGIC_STRING_UINT_LE)
350
350
  s_raise(s,rb_eTypeError,"invalid header: %d (%x)",magic,magic);
351
351
 
352
352
  u8 version = s_get_u8_bang(s);
@@ -388,7 +388,7 @@ again:
388
388
  u8 *uncompressed = s_alloc_or_raise(s,uncompressed_len);
389
389
  int done = csnappy_decompress(s_get_p_req_inclusive(s,compressed_len),
390
390
  compressed_len,
391
- uncompressed,
391
+ (char *) uncompressed,
392
392
  uncompressed_len) == CSNAPPY_E_OK ? 1 : 0;
393
393
  if (!done)
394
394
  s_raise(s,rb_eTypeError, "decompression failed error: %d type: %d, unompressed size: %d compressed size: %d",
data/ext/sereal/encode.c CHANGED
@@ -116,7 +116,7 @@ static inline void s_append_string(sereal_t *s,u8 *string, u32 len,u8 is_utf8) {
116
116
  }
117
117
 
118
118
  static void s_append_rb_string(sereal_t *s, VALUE object) {
119
- s_append_string(s,RSTRING_PTR(object),
119
+ s_append_string(s,(u8 *)RSTRING_PTR(object),
120
120
  RSTRING_LEN(object),
121
121
  (is_ascii_string(object) ? FALSE : TRUE));
122
122
  }
@@ -377,7 +377,7 @@ method_sereal_encode(VALUE self, VALUE args) {
377
377
  }
378
378
 
379
379
  // setup header
380
- s_append_u32(s,SRL_MAGIC_STRING_LILIPUTIAN);
380
+ s_append_u32(s,SRL_MAGIC_STRING_UINT_LE);
381
381
  s_append_u8(s,version);
382
382
  s_append_u8(s,0x0);
383
383
  u32 s_header_len = s->pos;
@@ -421,9 +421,9 @@ method_sereal_encode(VALUE self, VALUE args) {
421
421
 
422
422
  u8 *start = s_get_p_at_pos(s,s_header_len,0);
423
423
  u8 *working_buf = s_alloc_or_raise(s,CSNAPPY_WORKMEM_BYTES);
424
- csnappy_compress(start,
424
+ csnappy_compress((char *)start,
425
425
  s_body_len,
426
- (compressed + s_header_len + compressed_len_varint + un_compressed_len_varint),
426
+ (char *)(compressed + s_header_len + compressed_len_varint + un_compressed_len_varint),
427
427
  &compressed_len,
428
428
  working_buf,
429
429
  CSNAPPY_WORKMEM_BYTES_POWER_OF_TWO);
@@ -441,7 +441,7 @@ method_sereal_encode(VALUE self, VALUE args) {
441
441
  s->pos = s->size;
442
442
  }
443
443
 
444
- VALUE result = rb_str_new(s->data,s->size);
444
+ VALUE result = rb_str_new((char *) s->data,s->size);
445
445
  s_destroy(s);
446
446
  return result;
447
447
  }
data/ext/sereal/proto.h CHANGED
@@ -1,5 +1,5 @@
1
1
  #define SRL_MAGIC_STRING "=srl" /* Magic string for header. Every packet starts with this */
2
- #define SRL_MAGIC_STRING_LILIPUTIAN 0x6c72733d /* SRL_MAGIC_STRING as a little endian integer */
2
+ #define SRL_MAGIC_STRING_UINT_LE 0x6c72733d /* SRL_MAGIC_STRING as a little endian integer */
3
3
 
4
4
  #define SRL_PROTOCOL_VERSION ( 2 ) /* this is the first. for some reason we did not use 0 */
5
5
  #define SRL_PROTOCOL_VERSION_BITS ( 4 ) /* how many bits we use for the version, the rest go to the encoding */
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sereal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Borislav Nikolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-03 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project:
73
- rubygems_version: 2.2.0
73
+ rubygems_version: 2.2.2
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Sereal encoder/decoder