cobhan 0.1.3 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +10 -0
- data/lib/cobhan/version.rb +1 -1
- data/lib/cobhan.rb +4 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9db46be416695ae19f78d794bff7d26d5e6f73d03a5c89a35cd7ab6959d501ea
|
4
|
+
data.tar.gz: f73725bd8cade9ece9b11d159b3df1eb41482fbfe39d150d0e9ae3c967dc2eac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1245bb5be6d2a9d22d648a9be179a10444cd02719b937058bfbdee1ee82069b83e5dd4e5cfa554143d177fd0fd05d6be686acd0325e245fb8822829211dbe7ad
|
7
|
+
data.tar.gz: 0c32181b11382225ea5ac57951b9b5350574f0a341ccd197cf897041061d2188dee0c96a91b35ea9cd75b848e362b8fa4a14e7844771076df6bd2ab26f4cdc09
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.2.0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.1] - 2023-01-25
|
4
|
+
|
5
|
+
- Support non GNU Lib C library file names with `load_library`
|
6
|
+
- Add Ruby 3.2 to the test matrix
|
7
|
+
|
8
|
+
## [0.2.0] - 2022-03-18
|
9
|
+
|
10
|
+
- Remove default `MINIMUM_ALLOCATION` to allow for smaller buffers
|
11
|
+
- Force encoding to UTF-8 when converting C buffer to Ruby string
|
12
|
+
|
3
13
|
## [0.1.3] - 2022-03-14
|
4
14
|
|
5
15
|
- Switch from `centos/7` to `ubuntu/focal64` vagrant box
|
data/lib/cobhan/version.rb
CHANGED
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]
|
@@ -24,7 +23,9 @@ module Cobhan
|
|
24
23
|
cpu_arch = CPU_ARCHS[FFI::Platform::ARCH]
|
25
24
|
raise UnsupportedPlatformError, "Unsupported CPU: #{FFI::Platform::ARCH}" unless cpu_arch
|
26
25
|
|
27
|
-
|
26
|
+
libc_suffix = RbConfig::CONFIG['host_os'] == 'linux-musl' ? '-musl' : ''
|
27
|
+
|
28
|
+
"#{name}-#{cpu_arch}#{libc_suffix}.#{ext}"
|
28
29
|
end
|
29
30
|
|
30
31
|
def load_library(lib_root_path, name, functions)
|
@@ -52,7 +53,7 @@ module Cobhan
|
|
52
53
|
buffer.get_bytes(BUFFER_HEADER_SIZE, length)
|
53
54
|
else
|
54
55
|
temp_to_string(buffer, length)
|
55
|
-
end
|
56
|
+
end.force_encoding(Encoding::UTF_8)
|
56
57
|
end
|
57
58
|
|
58
59
|
def temp_to_string(buffer, length)
|
@@ -65,7 +66,6 @@ module Cobhan
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def allocate_cbuffer(size)
|
68
|
-
size = [size, MINIMUM_ALLOCATION].max
|
69
69
|
buffer_ptr = FFI::MemoryPointer.new(1, BUFFER_HEADER_SIZE + size, false)
|
70
70
|
buffer_ptr.put_int32(0, size)
|
71
71
|
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
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoDaddy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
131
|
+
rubygems_version: 3.4.1
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Ruby wrapper library for the Cobhan FFI system
|