FFI: FFI-Kernel-mt.148.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FFI: FFI-Kernel-mt.148.mcz

commits-2
Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI:
http://source.squeak.org/FFI/FFI-Kernel-mt.148.mcz

==================== Summary ====================

Name: FFI-Kernel-mt.148
Author: mt
Time: 15 May 2021, 5:12:44.817141 pm
UUID: bb40c1ac-0172-1f4a-b0d8-fe7f8ef24e0e
Ancestors: FFI-Kernel-mt.147

Adds support method to write CStrings into external data.

=============== Diff against FFI-Kernel-mt.147 ===============

Item was added:
+ ----- Method: ExternalData>>toCString: (in category 'accessing - unsafe') -----
+ toCString: aString
+ "Write a NUL-terminated string"
+
+ self
+ assert: [self contentType = ExternalType char]
+ description: 'Wrong content type'.
+
+ self
+ assert: [self size = (aString size + 1)]
+ description: 'Wrong size'.
+
+ aString withIndexDo: [:char :index |
+ self at: index put: char].
+ self at: aString size + 1 put: Character null.
+
+ self setSize: nil. "See #mightBeCString."!