ffi-libfuse 0.4.3 → 0.4.4

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: d36608baae92eda701f3753033158652393ed9972a5c4d4bd19486656d17d6da
4
- data.tar.gz: 7ce05ab72dc66540af8aec386512eed405c3f47f21940d4fc24dc9fd4889b899
3
+ metadata.gz: ec6fbc45e44267c8b9a5515e5c504c132d8bc3f84155beeeb4b53832fda8add6
4
+ data.tar.gz: ef54c7d9820fe3449419e9880f2959f4c9524c0136f2a9d570038fe150efcb9d
5
5
  SHA512:
6
- metadata.gz: 5fc7a9272a90e28f80f9c603901778a34bf950568381636d64b35d268d25c560b896a8bbe5fb2b779add81f0ca53c1977d647be06f32c28b7d3b06db976e854c
7
- data.tar.gz: 1e6e7861a65795a1d2511c1c625e789e0c3d3b8cf068e0f3471ffb6246ed02c8bd71ade75acfa4bcd955690f7ecb328548ff15788fdd5839ff02e915cf2d67de
6
+ metadata.gz: bc88763ee5ad1bc5a47b0314c78adbb4c28b531647f2b074f143302dfa1ea26ea724d83a5340c4ea54aeaeb00c6ef6b0d5a4a8dd383f02db697a65b8eed32780
7
+ data.tar.gz: f2090ddf215602e5b3b7f5ef7a09607b4dfd30e7e4ac661487b1c2ca5d6bdf39fa9aa85bb19d8e04c39a9f1c96be7d324a0a5d31676f6144fff9751dbb8175d1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.4](https://github.com/lwoggardner/ffi-libfuse/compare/v0.4.3...v0.4.4) (2024-12-29)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * fuse buffer adding NUL character when creating from a String ([#35](https://github.com/lwoggardner/ffi-libfuse/issues/35)) ([e07ebfe](https://github.com/lwoggardner/ffi-libfuse/commit/e07ebfeff4001a7d48ad457604e9f5f9191f96de)), closes [#34](https://github.com/lwoggardner/ffi-libfuse/issues/34)
9
+
3
10
  ## [0.4.3](https://github.com/lwoggardner/ffi-libfuse/compare/v0.4.2...v0.4.3) (2024-12-25)
4
11
 
5
12
 
@@ -59,7 +59,7 @@ module FFI
59
59
 
60
60
  # @overload fill(str:)
61
61
  # Create a memory buffer from str
62
- # @param [String,#to_s] str
62
+ # @param [String] str
63
63
  #
64
64
  # @overload fill(size:)
65
65
  # Allocate an empty memory buffer of size bytes
@@ -86,11 +86,11 @@ module FFI
86
86
  # @return [self]
87
87
  def fill(
88
88
  str: nil,
89
- mem: str ? FFI::MemoryPointer.from_string(str.to_s) : FFI::Pointer::NULL, size: mem.null? ? 0 : mem.size,
89
+ mem: mem_from_bytes(str),
90
+ size: mem.null? ? 0 : mem.size,
90
91
  fd: -1, fd_retry: false, pos: nil # rubocop:disable Naming/MethodParameterName
91
-
92
92
  )
93
- # Allocate size bytes if we've been given a null pointer
93
+ # Allocate size bytes if we've been given a null pointer and size is > 0
94
94
  mem = FFI::MemoryPointer.new(:char, size, true) if fd == -1 && mem.null? && size.positive?
95
95
 
96
96
  mem.autorelease = to_ptr.autorelease? unless mem.null?
@@ -106,6 +106,15 @@ module FFI
106
106
  self[:pos] = pos || 0
107
107
  self
108
108
  end
109
+
110
+ private
111
+
112
+ def mem_from_bytes(str)
113
+ return FFI::Pointer::NULL unless str
114
+ return FFI::Pointer::NULL if str.empty?
115
+
116
+ FFI::MemoryPointer.new(:char, str.bytesize).write_bytes(str)
117
+ end
109
118
  end
110
119
  end
111
120
  end
@@ -3,6 +3,6 @@
3
3
  module FFI
4
4
  # Ruby FFI Binding for [libfuse](https://github.com/libfuse/libfuse)
5
5
  module Libfuse
6
- VERSION = '0.4.3'
6
+ VERSION = '0.4.4'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-libfuse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Gardner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-25 00:00:00.000000000 Z
11
+ date: 2024-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi