koffi 2.5.4 → 2.5.6
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/CHANGELOG.md +17 -2
- package/build/2.5.6/koffi_darwin_arm64/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_darwin_x64/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_freebsd_arm64/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_freebsd_ia32/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_freebsd_x64/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_linux_arm32hf/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_linux_arm64/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_linux_ia32/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_linux_riscv64hf64/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_linux_x64/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_openbsd_ia32/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_openbsd_x64/koffi.node +0 -0
- package/build/2.5.6/koffi_win32_arm64/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_win32_ia32/koffi.node +0 -0
- package/build/{2.5.4 → 2.5.6}/koffi_win32_x64/koffi.node +0 -0
- package/package.json +2 -2
- package/src/core/libcc/libcc.hh +1 -1
- package/src/koffi/src/call.hh +3 -3
- package/src/koffi/src/ffi.cc +4 -4
- package/src/koffi/src/ffi.hh +0 -1
- package/src/koffi/src/parser.cc +2 -2
- package/src/koffi/src/util.cc +8 -10
- package/build/2.5.4/koffi_darwin_arm64/koffi.node +0 -0
- package/build/2.5.4/koffi_win32_arm64/koffi.node +0 -0
- /package/build/{2.5.4 → 2.5.6}/koffi_win32_arm64/koffi.exp +0 -0
- /package/build/{2.5.4 → 2.5.6}/koffi_win32_arm64/koffi.lib +0 -0
- /package/build/{2.5.4 → 2.5.6}/koffi_win32_ia32/koffi.exp +0 -0
- /package/build/{2.5.4 → 2.5.6}/koffi_win32_ia32/koffi.lib +0 -0
- /package/build/{2.5.4 → 2.5.6}/koffi_win32_x64/koffi.exp +0 -0
- /package/build/{2.5.4 → 2.5.6}/koffi_win32_x64/koffi.lib +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,21 +4,36 @@
|
|
|
4
4
|
|
|
5
5
|
### Koffi 2.5
|
|
6
6
|
|
|
7
|
+
#### Koffi 2.5.6
|
|
8
|
+
|
|
9
|
+
**Main changes:**
|
|
10
|
+
|
|
11
|
+
- Increase limit of output parameters from 16 to 32
|
|
12
|
+
|
|
13
|
+
#### Koffi 2.5.5
|
|
14
|
+
|
|
15
|
+
**Main changes:**
|
|
16
|
+
|
|
17
|
+
- Support decoding non-char null-terminated arrays
|
|
18
|
+
|
|
7
19
|
#### Koffi 2.5.4
|
|
8
20
|
|
|
9
21
|
**Main changes:**
|
|
10
22
|
|
|
11
|
-
- Fix koffi.pointer() not accepting disposable types
|
|
23
|
+
- Fix `koffi.pointer()` not accepting disposable types
|
|
12
24
|
|
|
13
25
|
**Other changes:**
|
|
14
26
|
|
|
15
|
-
- Fix potential issues when making
|
|
27
|
+
- Fix potential issues when making pointers to anonymous types
|
|
16
28
|
|
|
17
29
|
#### Koffi 2.5.3
|
|
18
30
|
|
|
19
31
|
**Main changes:**
|
|
20
32
|
|
|
21
33
|
- Add missing union exports in TS definition file
|
|
34
|
+
|
|
35
|
+
**Other changes:**
|
|
36
|
+
|
|
22
37
|
- Fix some parameter names in TS definition file
|
|
23
38
|
|
|
24
39
|
#### Koffi 2.5.2
|
|
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/package.json
CHANGED
package/src/core/libcc/libcc.hh
CHANGED
|
@@ -1254,7 +1254,7 @@ public:
|
|
|
1254
1254
|
RemoveFrom(len - count);
|
|
1255
1255
|
}
|
|
1256
1256
|
|
|
1257
|
-
Span<T> Take() const { return Span<T>(data, len); }
|
|
1257
|
+
Span<T> Take() const { return Span<T>((T *)data, len); }
|
|
1258
1258
|
Span<T> Take(Size offset, Size len) const { return Span<T>((T *)data, N).Take(offset, len); }
|
|
1259
1259
|
Span<T> TakeAvailable() const { return Span<T>((T *)data + len, N - len); }
|
|
1260
1260
|
|
package/src/koffi/src/call.hh
CHANGED
|
@@ -61,9 +61,6 @@ class alignas(8) CallData {
|
|
|
61
61
|
Span<uint8_t> old_stack_mem;
|
|
62
62
|
Span<uint8_t> old_heap_mem;
|
|
63
63
|
|
|
64
|
-
LocalArray<int16_t, 16> used_trampolines;
|
|
65
|
-
LocalArray<OutArgument, MaxOutParameters> out_arguments;
|
|
66
|
-
|
|
67
64
|
uint8_t *new_sp;
|
|
68
65
|
uint8_t *old_sp;
|
|
69
66
|
|
|
@@ -83,6 +80,9 @@ class alignas(8) CallData {
|
|
|
83
80
|
} result;
|
|
84
81
|
uint8_t *return_ptr = nullptr;
|
|
85
82
|
|
|
83
|
+
LocalArray<int16_t, 16> used_trampolines;
|
|
84
|
+
LocalArray<OutArgument, MaxParameters> out_arguments;
|
|
85
|
+
|
|
86
86
|
BlockAllocator call_alloc;
|
|
87
87
|
|
|
88
88
|
public:
|
package/src/koffi/src/ffi.cc
CHANGED
|
@@ -904,8 +904,8 @@ static bool ParseClassicFunction(Napi::Env env, Napi::String name, Napi::Value r
|
|
|
904
904
|
ThrowError<Napi::TypeError>(env, "Functions cannot have more than %1 parameters", MaxParameters);
|
|
905
905
|
return false;
|
|
906
906
|
}
|
|
907
|
-
if ((param.directions & 2) && ++func->out_parameters >=
|
|
908
|
-
ThrowError<Napi::TypeError>(env, "Functions cannot have more than %1 output parameters",
|
|
907
|
+
if ((param.directions & 2) && ++func->out_parameters >= MaxParameters) {
|
|
908
|
+
ThrowError<Napi::TypeError>(env, "Functions cannot have more than %1 output parameters", MaxParameters);
|
|
909
909
|
return false;
|
|
910
910
|
}
|
|
911
911
|
|
|
@@ -1317,8 +1317,8 @@ static Napi::Value TranslateVariadicCall(const FunctionInfo *func, void *native,
|
|
|
1317
1317
|
ThrowError<Napi::TypeError>(env, "Functions cannot have more than %1 parameters", MaxParameters);
|
|
1318
1318
|
return env.Null();
|
|
1319
1319
|
}
|
|
1320
|
-
if ((param.directions & 2) && ++copy.out_parameters >=
|
|
1321
|
-
ThrowError<Napi::TypeError>(env, "Functions cannot have more than %1 output parameters",
|
|
1320
|
+
if ((param.directions & 2) && ++copy.out_parameters >= MaxParameters) [[unlikely]] {
|
|
1321
|
+
ThrowError<Napi::TypeError>(env, "Functions cannot have more than %1 output parameters", MaxParameters);
|
|
1322
1322
|
return env.Null();
|
|
1323
1323
|
}
|
|
1324
1324
|
|
package/src/koffi/src/ffi.hh
CHANGED
package/src/koffi/src/parser.cc
CHANGED
|
@@ -82,8 +82,8 @@ bool PrototypeParser::Parse(const char *str, FunctionInfo *out_func)
|
|
|
82
82
|
MarkError("Functions cannot have more than %1 parameters", MaxParameters);
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
85
|
-
if ((param.directions & 2) && ++out_func->out_parameters >=
|
|
86
|
-
MarkError("Functions cannot have more than out %1 parameters",
|
|
85
|
+
if ((param.directions & 2) && ++out_func->out_parameters >= MaxParameters) {
|
|
86
|
+
MarkError("Functions cannot have more than out %1 parameters", MaxParameters);
|
|
87
87
|
return false;
|
|
88
88
|
}
|
|
89
89
|
|
package/src/koffi/src/util.cc
CHANGED
|
@@ -1065,26 +1065,24 @@ Napi::Value Decode(Napi::Env env, const uint8_t *ptr, const TypeInfo *type, cons
|
|
|
1065
1065
|
if (*len >= 0) {
|
|
1066
1066
|
type = MakeArrayType(instance, type, *len);
|
|
1067
1067
|
} else {
|
|
1068
|
-
if (!(type->flags & (int)TypeFlag::IsCharLike)) [[unlikely]] {
|
|
1069
|
-
ThrowError<Napi::TypeError>(env, "Only char-like types can find their length automatically", type->name);
|
|
1070
|
-
return env.Null();
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
1068
|
switch (type->primitive) {
|
|
1074
|
-
case PrimitiveKind::Int8:
|
|
1069
|
+
case PrimitiveKind::Int8:
|
|
1070
|
+
case PrimitiveKind::UInt8: {
|
|
1075
1071
|
Size count = strlen((const char *)ptr);
|
|
1076
1072
|
type = MakeArrayType(instance, type, count);
|
|
1077
1073
|
} break;
|
|
1078
|
-
case PrimitiveKind::Int16:
|
|
1074
|
+
case PrimitiveKind::Int16:
|
|
1075
|
+
case PrimitiveKind::UInt16: {
|
|
1079
1076
|
Size count = WideStringLength((const char16_t *)ptr, RG_SIZE_MAX);
|
|
1080
1077
|
type = MakeArrayType(instance, type, count);
|
|
1081
1078
|
} break;
|
|
1082
1079
|
|
|
1083
|
-
default: {
|
|
1080
|
+
default: {
|
|
1081
|
+
ThrowError<Napi::TypeError>(env, "Cannot determine null-terminated length for type %1", type->name);
|
|
1082
|
+
return env.Null();
|
|
1083
|
+
} break;
|
|
1084
1084
|
}
|
|
1085
|
-
|
|
1086
1085
|
}
|
|
1087
|
-
|
|
1088
1086
|
}
|
|
1089
1087
|
|
|
1090
1088
|
#define RETURN_INT(Type, NewCall) \
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|