koffi 2.5.5 → 2.5.7

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 (32) hide show
  1. package/CHANGELOG.md +18 -3
  2. package/build/2.5.7/koffi_darwin_arm64/koffi.node +0 -0
  3. package/build/{2.5.5 → 2.5.7}/koffi_darwin_x64/koffi.node +0 -0
  4. package/build/{2.5.5 → 2.5.7}/koffi_freebsd_arm64/koffi.node +0 -0
  5. package/build/{2.5.5 → 2.5.7}/koffi_freebsd_ia32/koffi.node +0 -0
  6. package/build/{2.5.5 → 2.5.7}/koffi_freebsd_x64/koffi.node +0 -0
  7. package/build/{2.5.5 → 2.5.7}/koffi_linux_arm32hf/koffi.node +0 -0
  8. package/build/{2.5.5 → 2.5.7}/koffi_linux_arm64/koffi.node +0 -0
  9. package/build/{2.5.5 → 2.5.7}/koffi_linux_ia32/koffi.node +0 -0
  10. package/build/{2.5.5 → 2.5.7}/koffi_linux_riscv64hf64/koffi.node +0 -0
  11. package/build/{2.5.5 → 2.5.7}/koffi_linux_x64/koffi.node +0 -0
  12. package/build/{2.5.5 → 2.5.7}/koffi_openbsd_ia32/koffi.node +0 -0
  13. package/build/{2.5.5 → 2.5.7}/koffi_openbsd_x64/koffi.node +0 -0
  14. package/build/2.5.7/koffi_win32_arm64/koffi.node +0 -0
  15. package/build/{2.5.5 → 2.5.7}/koffi_win32_ia32/koffi.node +0 -0
  16. package/build/{2.5.5 → 2.5.7}/koffi_win32_x64/koffi.node +0 -0
  17. package/doc/favicon.png +0 -0
  18. package/doc/templates/badges.html +1 -1
  19. package/package.json +3 -3
  20. package/src/core/libcc/libcc.hh +1 -1
  21. package/src/koffi/src/call.hh +3 -3
  22. package/src/koffi/src/ffi.cc +4 -4
  23. package/src/koffi/src/ffi.hh +0 -1
  24. package/src/koffi/src/parser.cc +2 -2
  25. package/build/2.5.5/koffi_darwin_arm64/koffi.node +0 -0
  26. package/build/2.5.5/koffi_win32_arm64/koffi.node +0 -0
  27. /package/build/{2.5.5 → 2.5.7}/koffi_win32_arm64/koffi.exp +0 -0
  28. /package/build/{2.5.5 → 2.5.7}/koffi_win32_arm64/koffi.lib +0 -0
  29. /package/build/{2.5.5 → 2.5.7}/koffi_win32_ia32/koffi.exp +0 -0
  30. /package/build/{2.5.5 → 2.5.7}/koffi_win32_ia32/koffi.lib +0 -0
  31. /package/build/{2.5.5 → 2.5.7}/koffi_win32_x64/koffi.exp +0 -0
  32. /package/build/{2.5.5 → 2.5.7}/koffi_win32_x64/koffi.lib +0 -0
package/CHANGELOG.md CHANGED
@@ -4,27 +4,42 @@
4
4
 
5
5
  ### Koffi 2.5
6
6
 
7
+ #### Koffi 2.5.7
8
+
9
+ **Main changes:**
10
+
11
+ - Point package to new repository
12
+
13
+ #### Koffi 2.5.6
14
+
15
+ **Main changes:**
16
+
17
+ - Increase limit of output parameters from 16 to 32
18
+
7
19
  #### Koffi 2.5.5
8
20
 
9
21
  **Main changes:**
10
22
 
11
- - Support decoding non-char NUL-terminated arrays
23
+ - Support decoding non-char null-terminated arrays
12
24
 
13
25
  #### Koffi 2.5.4
14
26
 
15
27
  **Main changes:**
16
28
 
17
- - Fix koffi.pointer() not accepting disposable types
29
+ - Fix `koffi.pointer()` not accepting disposable types
18
30
 
19
31
  **Other changes:**
20
32
 
21
- - Fix potential issues when making pointer to anonymous types
33
+ - Fix potential issues when making pointers to anonymous types
22
34
 
23
35
  #### Koffi 2.5.3
24
36
 
25
37
  **Main changes:**
26
38
 
27
39
  - Add missing union exports in TS definition file
40
+
41
+ **Other changes:**
42
+
28
43
  - Fix some parameter names in TS definition file
29
44
 
30
45
  #### Koffi 2.5.2
Binary file
@@ -1,6 +1,6 @@
1
1
  <div style="text-align: center; margin-top: 2em;">
2
2
  <a href="https://www.npmjs.com/package/koffi"><img src="https://img.shields.io/badge/NPM-{{ stable }}-brightgreen" alt="NPM"/></a>
3
- <a href="https://github.com/Koromix/rygel/tree/master/src/koffi"><img src="https://img.shields.io/badge/GitHub-Koffi-ff6600" alt="GitHub"/></a>
3
+ <a href="https://github.com/Koromix/koffi"><img src="https://img.shields.io/badge/GitHub-Koffi-ff6600" alt="GitHub"/></a>
4
4
 
5
5
  <br><br>
6
6
  <iframe src="https://github.com/sponsors/Koromix/button" title="Sponsor Koromix" height="35" width="116" style="border: 0;"></iframe>
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.7",
4
+ "stable": "2.5.7",
5
5
  "description": "Fast and simple C FFI (foreign function interface) for Node.js",
6
6
  "keywords": [
7
7
  "foreign",
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/Koromix/rygel.git"
17
+ "url": "https://github.com/Koromix/koffi"
18
18
  },
19
19
  "homepage": "https://koffi.dev/",
20
20
  "author": "Niels Martignène <niels.martignene@protonmail.com>",
@@ -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