koffi 2.3.0-beta.1 → 2.3.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/doc/callbacks.md +4 -0
- package/package.json +1 -1
- package/src/koffi/build/2.3.0-beta.2/koffi_darwin_arm64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_darwin_x64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_freebsd_arm64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_freebsd_ia32.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_freebsd_x64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_linux_arm32hf.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_linux_arm64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_linux_ia32.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_linux_x64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_openbsd_ia32.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_openbsd_x64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_win32_arm64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_win32_ia32.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.2/koffi_win32_x64.tar.gz +0 -0
- package/src/koffi/src/call.cc +6 -4
- package/src/koffi/build/2.3.0-beta.1/koffi_darwin_arm64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_darwin_x64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_freebsd_arm64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_freebsd_ia32.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_freebsd_x64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_linux_arm32hf.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_linux_arm64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_linux_ia32.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_linux_x64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_openbsd_ia32.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_openbsd_x64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_win32_arm64.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_win32_ia32.tar.gz +0 -0
- package/src/koffi/build/2.3.0-beta.1/koffi_win32_x64.tar.gz +0 -0
package/doc/callbacks.md
CHANGED
|
@@ -173,6 +173,10 @@ There is also an optional ending `length` argument that you can use in two cases
|
|
|
173
173
|
- Use it to give the number of bytes to decode in non-NUL terminated strings: `koffi.decode(value, 'char *', 5)`
|
|
174
174
|
- Decode consecutive values into an array. For example, here is how you can decode an array with 3 float values: `koffi.decode(value, 'float', 3)`. This is equivalent to `koffi.decode(value, koffi.array('float', 3))`.
|
|
175
175
|
|
|
176
|
+
```{note}
|
|
177
|
+
In Koffi 2.2 and earlier versions, the length argument is only used to decode strings and is ignored otherwise.
|
|
178
|
+
```
|
|
179
|
+
|
|
176
180
|
## Asynchronous callbacks
|
|
177
181
|
|
|
178
182
|
*New in Koffi 2.2.2*
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/koffi/src/call.cc
CHANGED
|
@@ -923,15 +923,17 @@ bool CallData::PushPointer(Napi::Value value, const TypeInfo *type, int directio
|
|
|
923
923
|
memset_safe(ptr, 0, size);
|
|
924
924
|
}
|
|
925
925
|
} else if (IsRawBuffer(value)) {
|
|
926
|
-
Span<
|
|
926
|
+
Span<uint8_t> buffer = GetRawBuffer(value);
|
|
927
927
|
|
|
928
|
-
|
|
928
|
+
if (directions == 1) {
|
|
929
|
+
ptr = AllocHeap(buffer.len, 16);
|
|
929
930
|
|
|
930
|
-
if (directions & 1) {
|
|
931
931
|
if (!PushBuffer(buffer, buffer.len, type, ptr))
|
|
932
932
|
return false;
|
|
933
933
|
} else {
|
|
934
|
-
|
|
934
|
+
// Fast no-copy path
|
|
935
|
+
ptr = buffer.ptr;
|
|
936
|
+
directions = 1;
|
|
935
937
|
}
|
|
936
938
|
} else if (RG_LIKELY(type->ref.type->primitive == PrimitiveKind::Record)) {
|
|
937
939
|
Napi::Object obj = value.As<Napi::Object>();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|