ffi 1.14.0-java → 1.14.1-java

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: e1ab4d534f9cb242444b3ec7042f1b368b8e3d71f54f9503c831b3fa49da5d1b
4
- data.tar.gz: 57ba63261c35e46d782160767a6b8239152f5978d5cc2ef66cde3ee76c3974e4
3
+ metadata.gz: bc00f46ffa7407da24b4a50b20c560916f2ff516661e4c4d95640b7a2fb3d762
4
+ data.tar.gz: 5029640e78efceeea442c74220053dddfe4a42b37086ae4b06d2f08f63a71bc3
5
5
  SHA512:
6
- metadata.gz: 044cbed458a7b7fa99ee830a7db1c708cfad04da10b62d28c2f1189e6c251f80c02e614e98fc98c9ab1bac3ffce895eb72bc4114291e648ac698781b694bd99a
7
- data.tar.gz: 007624f31a236f1658a957835b377d62bafce078a1a0f19cdffa176a8630db36e8e1c6eefd59ed72ac7266a04d3da2be9519c833073b19f9aa9aad64dba10f1c
6
+ metadata.gz: 9d992bb52e70d6c41bfab57c1cf8206cd3d4a0de52f694c6aa95454d2e92c866cabfb1670d6a8555c4fe4270f55d866d474fbc300d1d0315e78aab1036cfa6e2
7
+ data.tar.gz: 12392b64d7f9d3ae06b88eb1e02b66c92cf58b1883811ded8c41c032e6510096aad0a03e8762744e89caa98de4a07c01b7978614950f07e93267b8ea8e146102
data/CHANGELOG.md CHANGED
@@ -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
 
data/lib/ffi/pointer.rb CHANGED
@@ -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
data/lib/ffi/version.rb CHANGED
@@ -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: java
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