cobhan 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 236a2f8255bfff1d864296be21eeb788aa7e2eda4b6ec351c2acc5c1fdfea8b3
4
- data.tar.gz: c7a666719c503f2ab16b72cd5c1e26973aba29a410445de80376703213c1b397
3
+ metadata.gz: de115383ac17b1f26cf51d547451b9ac0502406f8247df342d3ae45e350b9fec
4
+ data.tar.gz: ea09ce6f5a399abff9d19180d35f4c38526705628d6bdf6f2ab9d502ef5d3424
5
5
  SHA512:
6
- metadata.gz: 18447be1bb9676bfd0d66ad6c84d91c229181a75775c16b174e52241659ccc43a9083001bf3e0ed2db1bb3d6542c489d1201582a5ae01903084bb1ee189e9079
7
- data.tar.gz: ec03eb376934045aec087c9b72ce9a831aee5c74f75fbf185c6a89c51569e798e238686e9737489eeafa9720dfc5ba8885c69570ed93082cc003a1233bd61247
6
+ metadata.gz: 0acd4b526b6a827f8fe620a91bb34903cfe1616b618ddf2f9b53995e0b5fc46e575b716d2155f8fdb11fffc0322778fc60c88d3a241df8e88522fdc9d744922c
7
+ data.tar.gz: 906ba58beb6a95711a8142f728a9c2a5a01010fee3efdb1565be4168c5386c83d6b566c6a48706c45b86d023b27d21d33b6760961fb47822acd37a5b21e1ece2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2022-03-18
4
+
5
+ - Remove default `MINIMUM_ALLOCATION` to allow for smaller buffers
6
+ - Force encoding to UTF-8 when converting C buffer to Ruby string
7
+
3
8
  ## [0.1.3] - 2022-03-14
4
9
 
5
10
  - Switch from `centos/7` to `ubuntu/focal64` vagrant box
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cobhan
4
- VERSION = '0.1.3'
4
+ VERSION = '0.2.0'
5
5
  end
data/lib/cobhan.rb CHANGED
@@ -15,7 +15,6 @@ module Cobhan
15
15
 
16
16
  SIZEOF_INT32 = 32 / 8
17
17
  BUFFER_HEADER_SIZE = SIZEOF_INT32 * 2
18
- MINIMUM_ALLOCATION = 1024
19
18
 
20
19
  def library_file_name(name)
21
20
  ext = EXTS[FFI::Platform::OS]
@@ -52,7 +51,7 @@ module Cobhan
52
51
  buffer.get_bytes(BUFFER_HEADER_SIZE, length)
53
52
  else
54
53
  temp_to_string(buffer, length)
55
- end
54
+ end.force_encoding(Encoding::UTF_8)
56
55
  end
57
56
 
58
57
  def temp_to_string(buffer, length)
@@ -65,7 +64,6 @@ module Cobhan
65
64
  end
66
65
 
67
66
  def allocate_cbuffer(size)
68
- size = [size, MINIMUM_ALLOCATION].max
69
67
  buffer_ptr = FFI::MemoryPointer.new(1, BUFFER_HEADER_SIZE + size, false)
70
68
  buffer_ptr.put_int32(0, size)
71
69
  buffer_ptr.put_int32(SIZEOF_INT32, 0) # Reserved - must be zero
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cobhan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoDaddy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-14 00:00:00.000000000 Z
11
+ date: 2022-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi