scon 0.1.0 → 0.2.0

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: 1c2d9ac985fa59d6375f9315587cb79a1a21f65e
4
- data.tar.gz: ab452a608097d43291f47abaa819c83f7c27693d
3
+ metadata.gz: 442e89803ca4cb396738c8c85eb6df9e5fe88e90
4
+ data.tar.gz: 630d42f52459ea20390177eb70e0d5c40f62cdf4
5
5
  SHA512:
6
- metadata.gz: 5d4f49d939c0d02488a28975a19f0d89211ef3fcd8136875ec26ff7954273fc079d9381f6a55bfb08459983cd28289b5499a4e7387a3c2f05d04343e30e73210
7
- data.tar.gz: 2889b3ca49a2358eb7360d6f0ab92aa434f4cd04b81cb2e4a9aaa8d91acace3fd43497e8ce082fbb3a10a01c26af314f64852f55ca0e2ac2a3d8bcaeb62f68d2
6
+ metadata.gz: 4bce748a277d73d7baf69714183320acf431d733481fa1be8f04ad4cad335dd50a31e86b7382eeaeeec5401c99aa9981101024d8ef4a5cf7278273bcc536804a
7
+ data.tar.gz: 7274b3cca619869575a57113adb768c712eb3ab016f328c48a5564b70b6b5d7c0befb4dfd05786d6d939b2c69de522b7189dd47460efe709bf52fb9ebcd23d5d
data/lib/scon.rb CHANGED
@@ -28,12 +28,12 @@ module SCON
28
28
  end
29
29
 
30
30
  def self.string_bytes str
31
- bytes = str.bytes
31
+ bytes = str.encode("utf-8").bytes
32
32
  instr = 0xD0
33
33
  if bytes.length < 32
34
34
  instr += bytes.length
35
35
  else
36
- bytes << 0x03
36
+ bytes << 0xFF
37
37
  end
38
38
  [instr, bytes]
39
39
  end
@@ -161,10 +161,10 @@ private
161
161
  returnval = []
162
162
  if value <= 0x99 && value >= 0 # Byte, no following data bytes
163
163
  returnval[0] = value
164
- elsif value <= ((2**16)/2-1) && value >= -(((2**16)/2-1)) # Short, following bytes
164
+ elsif value <= ((2**16)/2-1) && value >= -(((2**16)/2+1)) # Short, following bytes
165
165
  returnval[0] = Constants::DATA[:short]
166
166
  returnval[1] = Conversions.short_bytes(value)
167
- elsif value <= ((2**32)/2-1) && value >= -(((2**32)/2-1)) # Integer, following bytes
167
+ elsif value <= ((2**32)/2-1) && value >= -(((2**32)/2+1)) # Integer, following bytes
168
168
  returnval[0] = Constants::DATA[:integer]
169
169
  returnval[1] = Conversions.int_bytes(value)
170
170
  else # Long, following bytes
data/lib/scon/parser.rb CHANGED
@@ -32,10 +32,10 @@ private
32
32
  elsif data[0] == 0xD0
33
33
  data.shift
34
34
  str = []
35
- while (tmp = data.shift) != 0x03
35
+ while (tmp = data.shift) != 0xFF
36
36
  str << tmp
37
37
  end
38
- return str.pack("c*")
38
+ return str.pack("c*").force_encoding("utf-8")
39
39
  else
40
40
  return false
41
41
  end
@@ -46,10 +46,10 @@ private
46
46
  return @data.shift(instruct - 0xD0).pack("c*")
47
47
  elsif instruct == 0xD0
48
48
  str = []
49
- while (tmp = @data.shift) != 0x03
49
+ while (tmp = @data.shift) != 0xFF
50
50
  str << tmp
51
51
  end
52
- return str.pack("c*")
52
+ return str.pack("c*").force_encoding("utf-8")
53
53
  else
54
54
  return false
55
55
  end
data/lib/scon/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SCON
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JacisNonsense