blake3-rb 1.5.4.1 → 1.5.4.2

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
  SHA256:
3
- metadata.gz: 79bfa02f801439d4336e9cc5d1c6f66b3fea5ee900fa327c98a76006289610cb
4
- data.tar.gz: a84aff893fc9fb311103464071c2628fe398feb370f8afb2092c8a72663fd473
3
+ metadata.gz: 4ab3f1082c343de16df3d08889bde6ef229bb70889a6e6587e56fbb85e16489d
4
+ data.tar.gz: aaf3164981b071fe3c06897c67bbc76503c564adf98170048350589b3008a323
5
5
  SHA512:
6
- metadata.gz: f55aad4696d2c13f956472e3193c68501fef7f1a698d86757bb251d533c6a44d2799d24842053e49ddab0f2ca01462d34583daf8fd9a61513a0341ac0bfde95c
7
- data.tar.gz: 06ffcdbc95270b3ae7b3b7a9ff242cd5cb9388aef94d8e7fcfc669d24e357d2913b09f1566eb24785c55e39044fa971c342eb97dfee343f16bc8161e13434e06
6
+ metadata.gz: 77561b2a749a2f8fd5d80d1a603ff36657bbb3263089a6d832810ccd1a25c5444373d9c7d1bc3c8b7a782794ef099cc021b363952bca657496f44558850fc19c
7
+ data.tar.gz: 7335f1d78da1f485ca638a5b3cb60ccbf805642293555bfd37a8fad72bdf45ad1cc8ee5b7dad19e71b2a69ab61908375ae206c8c432e8cf363099cd60a8cbf42
@@ -1,7 +1,6 @@
1
+ use rb_sys::{size_t, VALUE};
1
2
  use std::ffi::{c_int, c_uchar, c_void};
2
3
 
3
- use rb_sys::{rb_data_object_wrap, rb_obj_freeze, size_t, VALUE};
4
-
5
4
  pub const RUBY_DIGEST_API_VERSION: c_int = 3;
6
5
 
7
6
  pub type RbDigestHashInitFuncT = unsafe extern "C" fn(*mut c_void) -> c_int;
@@ -20,7 +19,40 @@ pub struct RbDigestMetadataT {
20
19
  pub finish_func: RbDigestHashFinishFuncT,
21
20
  }
22
21
 
22
+ #[cfg(ruby_gt_3_3)]
23
+ pub unsafe fn rb_digest_make_metadata(meta: &'static RbDigestMetadataT) -> VALUE {
24
+ static mut WRAPPER: Option<unsafe extern "C" fn(&'static RbDigestMetadataT) -> VALUE> = None;
25
+
26
+ unsafe fn load_wrapper() {
27
+ use rb_sys::rb_ext_resolve_symbol;
28
+ use std::ffi::c_char;
29
+ use std::sync::Once;
30
+
31
+ static INIT: Once = Once::new();
32
+
33
+ INIT.call_once(|| {
34
+ let lib_name = "digest.so\0".as_ptr() as *const c_char;
35
+ let symbol_name = "rb_digest_wrap_metadata\0".as_ptr() as *const c_char;
36
+ let symbol_ptr = rb_ext_resolve_symbol(lib_name, symbol_name);
37
+
38
+ if !symbol_ptr.is_null() {
39
+ WRAPPER = Some(std::mem::transmute(symbol_ptr));
40
+ } else {
41
+ panic!("Failed to resolve rb_digest_wrap_metadata");
42
+ }
43
+ });
44
+ }
45
+
46
+ load_wrapper();
47
+ if let Some(wrapper) = WRAPPER {
48
+ return wrapper(meta);
49
+ }
50
+ panic!("Failed to resolve rb_digest_wrap_metadata");
51
+ }
52
+
53
+ #[cfg(not(ruby_gt_3_3))]
23
54
  pub unsafe fn rb_digest_make_metadata(meta: &'static RbDigestMetadataT) -> VALUE {
55
+ use rb_sys::{rb_data_object_wrap, rb_obj_freeze};
24
56
  let data = rb_data_object_wrap(
25
57
  0 as VALUE,
26
58
  meta as *const RbDigestMetadataT as *mut c_void,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blake3-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4.1
4
+ version: 1.5.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-16 00:00:00.000000000 Z
11
+ date: 2024-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0'
66
66
  requirements: []
67
- rubygems_version: 3.4.19
67
+ rubygems_version: 3.5.3
68
68
  signing_key:
69
69
  specification_version: 4
70
70
  summary: Blake3 hash function bindings for Ruby.