msgpack-inspect 0.1.0 → 0.1.1

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: 9a5cf0e5a244873a5044ae948a088da716bd90e0
4
- data.tar.gz: 661802f26ee3610e488309e7598421639fd06b9b
3
+ metadata.gz: d5a3c533c3c23728a626a5f6a92b0ded176cf1cb
4
+ data.tar.gz: 2a5d4ed28d7d5d02886d3a80ae88571ea966b450
5
5
  SHA512:
6
- metadata.gz: 40ccb02a952f8a28d232dd350a0960df82c7ebfea8acd27a348c8c1240567c6be4ae3fb754ac51f6fc61601d514f7b0127c754830f37aa2a920300065bf35466
7
- data.tar.gz: 77475e7f3304c92bdb02e8b80720432da64433c1c411deb26ea2f5e476275d7a690b9297c3189d03da3c0333144fbce5834ea2d1cab5f27bc45c2eaf75df0839
6
+ metadata.gz: f0748e0b795f82c17b95e44a065e59cea0a7cb23347d1503af7b551320f5c221e5440f468ef023075b460b643aaf9b5871acb63b9dacb1c82d033924d05433da
7
+ data.tar.gz: d827254fb029595163b033a211bdda005be4fc3eea5b41beb016f8d46f1c690d0284964057113c1d1416e7efb0ee072249a22e2a204dece8a1e62332f75cdf4c
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.3
5
+
6
+ os:
7
+ - linux
8
+ - osx
9
+
10
+ sudo: false
11
+
12
+ branches:
13
+ only:
14
+ - master
15
+
16
+ gemfile:
17
+ - Gemfile
@@ -204,7 +204,7 @@ module MessagePack
204
204
  MAX_INT64 = 2 ** 64
205
205
 
206
206
  def generate_int(io, fmt, header, current)
207
- if :fixint
207
+ if fmt == :fixint
208
208
  current[:data] = hex(header)
209
209
  v = header.unpack('C').first
210
210
  if v & 0b11100000 > 0 # negative fixint
@@ -232,24 +232,39 @@ module MessagePack
232
232
  v1 = io.read(4)
233
233
  v2 = io.read(4)
234
234
  current[:data] = hex(v1) + hex(v2)
235
- current[:value] = (v1.unpack('N').first << 32) & v2.unpack('N').first
235
+ current[:value] = (v1.unpack('N').first << 32) | v2.unpack('N').first
236
236
  when :int8
237
237
  v = io.read(1)
238
238
  current[:data] = hex(v)
239
239
  current[:value] = v.unpack('c').first
240
240
  when :int16
241
- v = io.read(1)
241
+ v = io.read(2)
242
242
  current[:data] = hex(v)
243
- current[:value] = v.unpack('n').first - MAX_INT16
243
+ n = v.unpack('n').first
244
+ if (n & 0x8000) > 0 # negative
245
+ current[:value] = n - MAX_INT16
246
+ else
247
+ current[:value] = n
248
+ end
244
249
  when :int32
245
- v = io.read(2)
250
+ v = io.read(4)
246
251
  current[:data] = hex(v)
247
- current[:value] = v.unpack('N').first - MAX_INT32
252
+ n = v.unpack('N').first
253
+ if n & 0x80000000 > 0 # negative
254
+ current[:value] = n - MAX_INT32
255
+ else
256
+ current[:value] = n
257
+ end
248
258
  when :int64
249
259
  v1 = io.read(4)
250
260
  v2 = io.read(4)
251
261
  current[:data] = hex(v1) + hex(v2)
252
- current[:value] = (v1.unpack('N').first << 32) & v2.unpack('N').first - MAX_INT64
262
+ n = (v1.unpack('N').first << 32) | v2.unpack('N').first
263
+ if n & 0x8000_0000_0000_0000 > 0 # negative
264
+ current[:value] = n - MAX_INT64
265
+ else
266
+ current[:value] = n
267
+ end
253
268
  else
254
269
  raise "unknown int format #{fmt}"
255
270
  end
@@ -290,7 +305,7 @@ module MessagePack
290
305
  current[:data] = hex(v)
291
306
  if [:fixstr, :str8, :str16, :str32].include?(fmt)
292
307
  begin
293
- current[:value] = v.encode('UTF-8')
308
+ current[:value] = v.force_encoding('UTF-8')
294
309
  rescue
295
310
  current[:error] = $!.message
296
311
  end
@@ -1,5 +1,5 @@
1
1
  module MessagePack
2
2
  module Inspect
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack-inspect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TAGOMORI Satoshi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-09 00:00:00.000000000 Z
11
+ date: 2016-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -76,6 +76,7 @@ extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
78
  - ".gitignore"
79
+ - ".travis.yml"
79
80
  - Gemfile
80
81
  - LICENSE
81
82
  - README.md