koffi 2.5.5 → 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.
Files changed (30) hide show
  1. package/CHANGELOG.md +12 -3
  2. package/build/2.5.6/koffi_darwin_arm64/koffi.node +0 -0
  3. package/build/{2.5.5 → 2.5.6}/koffi_darwin_x64/koffi.node +0 -0
  4. package/build/{2.5.5 → 2.5.6}/koffi_freebsd_arm64/koffi.node +0 -0
  5. package/build/{2.5.5 → 2.5.6}/koffi_freebsd_ia32/koffi.node +0 -0
  6. package/build/{2.5.5 → 2.5.6}/koffi_freebsd_x64/koffi.node +0 -0
  7. package/build/{2.5.5 → 2.5.6}/koffi_linux_arm32hf/koffi.node +0 -0
  8. package/build/{2.5.5 → 2.5.6}/koffi_linux_arm64/koffi.node +0 -0
  9. package/build/{2.5.5 → 2.5.6}/koffi_linux_ia32/koffi.node +0 -0
  10. package/build/{2.5.5 → 2.5.6}/koffi_linux_riscv64hf64/koffi.node +0 -0
  11. package/build/{2.5.5 → 2.5.6}/koffi_linux_x64/koffi.node +0 -0
  12. package/build/{2.5.5 → 2.5.6}/koffi_openbsd_ia32/koffi.node +0 -0
  13. package/build/{2.5.5 → 2.5.6}/koffi_openbsd_x64/koffi.node +0 -0
  14. package/build/2.5.6/koffi_win32_arm64/koffi.node +0 -0
  15. package/build/{2.5.5 → 2.5.6}/koffi_win32_ia32/koffi.node +0 -0
  16. package/build/{2.5.5 → 2.5.6}/koffi_win32_x64/koffi.node +0 -0
  17. package/package.json +2 -2
  18. package/src/core/libcc/libcc.hh +1 -1
  19. package/src/koffi/src/call.hh +3 -3
  20. package/src/koffi/src/ffi.cc +4 -4
  21. package/src/koffi/src/ffi.hh +0 -1
  22. package/src/koffi/src/parser.cc +2 -2
  23. package/build/2.5.5/koffi_darwin_arm64/koffi.node +0 -0
  24. package/build/2.5.5/koffi_win32_arm64/koffi.node +0 -0
  25. /package/build/{2.5.5 → 2.5.6}/koffi_win32_arm64/koffi.exp +0 -0
  26. /package/build/{2.5.5 → 2.5.6}/koffi_win32_arm64/koffi.lib +0 -0
  27. /package/build/{2.5.5 → 2.5.6}/koffi_win32_ia32/koffi.exp +0 -0
  28. /package/build/{2.5.5 → 2.5.6}/koffi_win32_ia32/koffi.lib +0 -0
  29. /package/build/{2.5.5 → 2.5.6}/koffi_win32_x64/koffi.exp +0 -0
  30. /package/build/{2.5.5 → 2.5.6}/koffi_win32_x64/koffi.lib +0 -0
package/CHANGELOG.md CHANGED
@@ -4,27 +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
+
7
13
  #### Koffi 2.5.5
8
14
 
9
15
  **Main changes:**
10
16
 
11
- - Support decoding non-char NUL-terminated arrays
17
+ - Support decoding non-char null-terminated arrays
12
18
 
13
19
  #### Koffi 2.5.4
14
20
 
15
21
  **Main changes:**
16
22
 
17
- - Fix koffi.pointer() not accepting disposable types
23
+ - Fix `koffi.pointer()` not accepting disposable types
18
24
 
19
25
  **Other changes:**
20
26
 
21
- - Fix potential issues when making pointer to anonymous types
27
+ - Fix potential issues when making pointers to anonymous types
22
28
 
23
29
  #### Koffi 2.5.3
24
30
 
25
31
  **Main changes:**
26
32
 
27
33
  - Add missing union exports in TS definition file
34
+
35
+ **Other changes:**
36
+
28
37
  - Fix some parameter names in TS definition file
29
38
 
30
39
  #### Koffi 2.5.2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koffi",
3
- "version": "2.5.5",
4
- "stable": "2.5.5",
3
+ "version": "2.5.6",
4
+ "stable": "2.5.6",
5
5
  "description": "Fast and simple C FFI (foreign function interface) for Node.js",
6
6
  "keywords": [
7
7
  "foreign",
@@ -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
 
@@ -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:
@@ -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 >= MaxOutParameters) {
908
- ThrowError<Napi::TypeError>(env, "Functions cannot have more than %1 output parameters", MaxOutParameters);
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 >= MaxOutParameters) [[unlikely]] {
1321
- ThrowError<Napi::TypeError>(env, "Functions cannot have more than %1 output parameters", MaxOutParameters);
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
 
@@ -37,7 +37,6 @@ static const Size DefaultMaxTypeSize = Mebibytes(64);
37
37
 
38
38
  static const int MaxAsyncCalls = 256;
39
39
  static const Size MaxParameters = 32;
40
- static const Size MaxOutParameters = 16;
41
40
  static const Size MaxTrampolines = 8192;
42
41
 
43
42
  enum class PrimitiveKind {
@@ -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 >= MaxOutParameters) {
86
- MarkError("Functions cannot have more than out %1 parameters", MaxOutParameters);
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