ffi 1.14.0 → 1.14.1

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: 2c0a1872f48b6db1c64ae5390e0e76455fa27ae7016e5a0426753e4973b53751
4
- data.tar.gz: 2e9a65f7e151185182a42848eebbd0709fee683d3513e096c7552a669a5326a6
3
+ metadata.gz: f68e0ecc4224facba03b0beca4e4c4ffd6faf1623c4ec9504385b58a0924de7b
4
+ data.tar.gz: 5f12a1c79784adab54bc4bb4e8f535942b089d1114ab00ea5ffecfda357d6794
5
5
  SHA512:
6
- metadata.gz: 9c78c1d0e46f1bcc9e0ff29dafadb660970ff86f54fb5326dc63e81eecee307e9e22e187c07dc2f9982ffff7c3a3c913caaeb2136683f5990466d452b87ec23c
7
- data.tar.gz: a5c06fa33eb31dd59f26ee10796609bfee821d076107e5f6ac2ab131f39fbb4979d00f84d98e1e556268ee55f310f8bbda1c770d0af5b98d72b314c1fdd9b0a1
6
+ metadata.gz: 593a0a50659343c3d0d21b26ea8d53d76bf10f36c40274746f77c85b5d2d6088c199ca904134c9c094172beaa8461caf8bd101d2f8cda0fb7e90d1838c3b14a7
7
+ data.tar.gz: 5d18bb9ed0fb4284613ea107745aa987a5f7545e6fc4e30db1232aabd9418c6af9c0f4916f1eafba95d6911454524841ae108485c5862a3db255488e58fa63fb
@@ -1,3 +1,11 @@
1
+ 1.14.1 / 2020-12-19
2
+ -------------------
3
+
4
+ Changed:
5
+ * Revert changes to FFI::Pointer#write_string made in ffi-1.14.0.
6
+ It turned out that it can cause hard to find errors. #857
7
+
8
+
1
9
  1.14.0 / 2020-12-18
2
10
  -------------------
3
11
 
@@ -499,7 +499,7 @@ memory_read_array_of_string(int argc, VALUE* argv, VALUE self)
499
499
  * @raise {SecurityError} when writing unsafe string to memory
500
500
  * @raise {IndexError} if +offset+ is too great
501
501
  * @raise {NullPointerError} if memory not initialized
502
- * Put a string in memory. Writes a final \0 byte.
502
+ * Put a string in memory.
503
503
  */
504
504
  static VALUE
505
505
  memory_put_string(VALUE self, VALUE offset, VALUE str)
@@ -85,37 +85,23 @@ module FFI
85
85
  # @param [String] str string to write
86
86
  # @param [Numeric] len length of string to return
87
87
  # @return [self]
88
- # Write +len+ first bytes of +str+ in pointer's contents and a final \0 byte.
88
+ # Write +len+ first bytes of +str+ in pointer's contents.
89
89
  #
90
90
  # Same as:
91
91
  # ptr.write_string(str, len) # with len not nil
92
92
  def write_string_length(str, len)
93
- write_string(str, len)
93
+ put_bytes(0, str, 0, len)
94
94
  end unless method_defined?(:write_string_length)
95
95
 
96
96
  # @param [String] str string to write
97
97
  # @param [Numeric] len length of string to return
98
98
  # @return [self]
99
- # Write +str+ in pointer's contents.
100
- # If +len+ is given, write the first +len+ bytes of +str+.
101
- # In both cases a final \0 byte is written after the string.
99
+ # Write +str+ in pointer's contents, or first +len+ bytes if
100
+ # +len+ is not +nil+.
102
101
  def write_string(str, len=nil)
103
- if len
104
- if len == size
105
- warn "[DEPRECATION] Memory too small to write a final 0-byte in #{caller(1, 1)[0]}. This will raise an error in ffi-2.0. Please use write_bytes instead or enlarge the memory region."
106
- write_bytes(str, 0, len)
107
- else
108
- put_char(len, 0) # Check size before writing str
109
- write_bytes(str, 0, len)
110
- end
111
- else
112
- if str.bytesize == size
113
- warn "[DEPRECATION] Memory too small to write a final 0-byte in #{caller(1, 1)[0]}. This will raise an error in ffi-2.0. Please use write_bytes instead or enlarge the memory region."
114
- write_bytes(str)
115
- else
116
- put_string(0, str)
117
- end
118
- end
102
+ len = str.bytesize unless len
103
+ # Write the string data without NUL termination
104
+ put_bytes(0, str, 0, len)
119
105
  end unless method_defined?(:write_string)
120
106
 
121
107
  # @param [Type] type type of data to read from pointer's contents
@@ -1,3 +1,3 @@
1
1
  module FFI
2
- VERSION = '1.14.0'
2
+ VERSION = '1.14.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne Meissner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-18 00:00:00.000000000 Z
11
+ date: 2020-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake