bare-buffer 2.5.10 → 2.6.0

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 (57) hide show
  1. package/CMakeLists.txt +6 -11
  2. package/binding.c +1 -11
  3. package/index.js +71 -136
  4. package/package.json +3 -8
  5. package/prebuilds/android-arm/bare-buffer.bare +0 -0
  6. package/prebuilds/android-arm64/bare-buffer.bare +0 -0
  7. package/prebuilds/android-ia32/bare-buffer.bare +0 -0
  8. package/prebuilds/android-x64/bare-buffer.bare +0 -0
  9. package/prebuilds/darwin-arm64/bare-buffer.bare +0 -0
  10. package/prebuilds/darwin-x64/bare-buffer.bare +0 -0
  11. package/prebuilds/ios-arm64/bare-buffer.bare +0 -0
  12. package/prebuilds/ios-arm64-simulator/bare-buffer.bare +0 -0
  13. package/prebuilds/ios-x64-simulator/bare-buffer.bare +0 -0
  14. package/prebuilds/linux-arm64/bare-buffer.bare +0 -0
  15. package/prebuilds/linux-x64/bare-buffer.bare +0 -0
  16. package/prebuilds/win32-arm64/bare-buffer.bare +0 -0
  17. package/prebuilds/win32-x64/bare-buffer.bare +0 -0
  18. package/vendor/libbase64/CMakeLists.txt +0 -70
  19. package/vendor/libbase64/include/base64.h +0 -128
  20. package/vendor/libbase64/src/base64.c +0 -10
  21. package/vendor/libhex/CMakeLists.txt +0 -71
  22. package/vendor/libhex/include/hex.h +0 -88
  23. package/vendor/libhex/src/hex.c +0 -10
  24. package/vendor/libutf/CMakeLists.txt +0 -93
  25. package/vendor/libutf/include/utf/string.h +0 -786
  26. package/vendor/libutf/include/utf.h +0 -132
  27. package/vendor/libutf/src/ascii/validate.c +0 -47
  28. package/vendor/libutf/src/endianness.c +0 -19
  29. package/vendor/libutf/src/endianness.h +0 -54
  30. package/vendor/libutf/src/latin1/convert-to-utf16.c +0 -37
  31. package/vendor/libutf/src/latin1/convert-to-utf32.c +0 -34
  32. package/vendor/libutf/src/latin1/convert-to-utf8.c +0 -58
  33. package/vendor/libutf/src/latin1/length-from-utf16.c +0 -26
  34. package/vendor/libutf/src/latin1/length-from-utf32.c +0 -26
  35. package/vendor/libutf/src/latin1/length-from-utf8.c +0 -34
  36. package/vendor/libutf/src/utf16/convert-to-latin1.c +0 -41
  37. package/vendor/libutf/src/utf16/convert-to-utf32.c +0 -56
  38. package/vendor/libutf/src/utf16/convert-to-utf8.c +0 -75
  39. package/vendor/libutf/src/utf16/length-from-latin1.c +0 -26
  40. package/vendor/libutf/src/utf16/length-from-utf32.c +0 -33
  41. package/vendor/libutf/src/utf16/length-from-utf8.c +0 -38
  42. package/vendor/libutf/src/utf16/validate.c +0 -53
  43. package/vendor/libutf/src/utf32/convert-to-latin1.c +0 -40
  44. package/vendor/libutf/src/utf32/convert-to-utf16.c +0 -56
  45. package/vendor/libutf/src/utf32/convert-to-utf8.c +0 -71
  46. package/vendor/libutf/src/utf32/length-from-latin1.c +0 -26
  47. package/vendor/libutf/src/utf32/length-from-utf16.c +0 -35
  48. package/vendor/libutf/src/utf32/length-from-utf8.c +0 -35
  49. package/vendor/libutf/src/utf32/validate.c +0 -39
  50. package/vendor/libutf/src/utf8/convert-to-latin1.c +0 -70
  51. package/vendor/libutf/src/utf8/convert-to-utf16.c +0 -95
  52. package/vendor/libutf/src/utf8/convert-to-utf32.c +0 -110
  53. package/vendor/libutf/src/utf8/length-from-latin1.c +0 -32
  54. package/vendor/libutf/src/utf8/length-from-utf16.c +0 -44
  55. package/vendor/libutf/src/utf8/length-from-utf32.c +0 -35
  56. package/vendor/libutf/src/utf8/string.c +0 -149
  57. package/vendor/libutf/src/utf8/validate.c +0 -107
@@ -1,88 +0,0 @@
1
- #ifndef HEX_H
2
- #define HEX_H
3
-
4
- #include <stdbool.h>
5
- #include <stddef.h>
6
- #include <stdint.h>
7
- #include <utf.h>
8
-
9
- #ifdef __cplusplus
10
- extern "C" {
11
- #endif
12
-
13
- static const char hex__alphabet[16] = "0123456789abcdef";
14
-
15
- static const char hex__inverse_alphabet[256] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
16
-
17
- static inline int
18
- hex__encode (const uint8_t *buffer, size_t buffer_len, utf8_t *string, size_t *string_len) {
19
- size_t len = buffer_len * 2;
20
-
21
- if (string == NULL) {
22
- *string_len = len;
23
- return 0;
24
- }
25
-
26
- if (*string_len < len) return -1;
27
-
28
- bool terminate = *string_len > len;
29
-
30
- *string_len = len;
31
-
32
- size_t k = 0;
33
-
34
- for (size_t i = 0, n = buffer_len; i < n; i++) {
35
- string[k++] = hex__alphabet[buffer[i] >> 4];
36
- string[k++] = hex__alphabet[buffer[i] & 0x0f];
37
- }
38
-
39
- if (terminate) string[k] = '\0';
40
-
41
- return 0;
42
- }
43
-
44
- static inline int
45
- hex__decode (const utf8_t *string, size_t string_len, uint8_t *buffer, size_t *buffer_len) {
46
- size_t len = string_len >> 1;
47
-
48
- if (buffer == NULL) {
49
- *buffer_len = len;
50
- return 0;
51
- }
52
-
53
- if (*buffer_len < len) return -1;
54
-
55
- *buffer_len = len;
56
-
57
- size_t k = 0;
58
-
59
- for (size_t i = 0, n = string_len; i < n; i += 2) {
60
- char chunk[2];
61
-
62
- for (size_t j = 0; j < 2; j++) {
63
- chunk[j] = i + j < n ? hex__inverse_alphabet[string[i + j]] : 0;
64
-
65
- if (chunk[j] == (char) -1) return -1;
66
- }
67
-
68
- buffer[k++] = (chunk[0] << 4) | chunk[1];
69
- }
70
-
71
- return 0;
72
- }
73
-
74
- inline int
75
- hex_encode (const uint8_t *buffer, size_t buffer_len, utf8_t *string, size_t *string_len) {
76
- return hex__encode(buffer, buffer_len, string, string_len);
77
- }
78
-
79
- inline int
80
- hex_decode (const utf8_t *string, size_t string_len, uint8_t *buffer, size_t *buffer_len) {
81
- return hex__decode(string, string_len, buffer, buffer_len);
82
- }
83
-
84
- #ifdef __cplusplus
85
- }
86
- #endif
87
-
88
- #endif // HEX_H
@@ -1,10 +0,0 @@
1
- #include <stdint.h>
2
- #include <utf.h>
3
-
4
- #include "../include/hex.h"
5
-
6
- extern int
7
- hex_encode (const uint8_t *buffer, size_t buffer_len, utf8_t *string, size_t *string_len);
8
-
9
- extern int
10
- hex_decode (const utf8_t *string, size_t string_len, uint8_t *buffer, size_t *buffer_len);
@@ -1,93 +0,0 @@
1
- cmake_minimum_required(VERSION 3.25)
2
-
3
- project(utf C)
4
-
5
- add_library(utf OBJECT)
6
-
7
- set_target_properties(
8
- utf
9
- PROPERTIES
10
- C_STANDARD 99
11
- POSITION_INDEPENDENT_CODE ON
12
- )
13
-
14
- target_sources(
15
- utf
16
- INTERFACE
17
- include/utf.h
18
- include/utf/string.h
19
- PRIVATE
20
- src/endianness.c
21
- src/endianness.h
22
- src/ascii/validate.c
23
- src/utf8/convert-to-latin1.c
24
- src/utf8/convert-to-utf16.c
25
- src/utf8/convert-to-utf32.c
26
- src/utf8/length-from-latin1.c
27
- src/utf8/length-from-utf16.c
28
- src/utf8/length-from-utf32.c
29
- src/utf8/string.c
30
- src/utf8/validate.c
31
- src/utf16/convert-to-latin1.c
32
- src/utf16/convert-to-utf8.c
33
- src/utf16/convert-to-utf32.c
34
- src/utf16/length-from-latin1.c
35
- src/utf16/length-from-utf8.c
36
- src/utf16/length-from-utf32.c
37
- src/utf16/validate.c
38
- src/utf32/convert-to-latin1.c
39
- src/utf32/convert-to-utf8.c
40
- src/utf32/convert-to-utf16.c
41
- src/utf32/length-from-latin1.c
42
- src/utf32/length-from-utf8.c
43
- src/utf32/length-from-utf16.c
44
- src/utf32/validate.c
45
- )
46
-
47
- target_include_directories(
48
- utf
49
- PUBLIC
50
- include
51
- )
52
-
53
- add_library(utf_shared SHARED)
54
-
55
- set_target_properties(
56
- utf_shared
57
- PROPERTIES
58
- OUTPUT_NAME utf
59
- WINDOWS_EXPORT_ALL_SYMBOLS ON
60
- )
61
-
62
- target_link_libraries(
63
- utf_shared
64
- PUBLIC
65
- utf
66
- )
67
-
68
- add_library(utf_static STATIC)
69
-
70
- set_target_properties(
71
- utf_static
72
- PROPERTIES
73
- OUTPUT_NAME utf
74
- PREFIX lib
75
- )
76
-
77
- target_link_libraries(
78
- utf_static
79
- PUBLIC
80
- utf
81
- )
82
-
83
- install(TARGETS utf_shared utf_static)
84
-
85
- install(FILES include/utf.h DESTINATION include)
86
-
87
- install(DIRECTORY include/utf DESTINATION include)
88
-
89
- if(PROJECT_IS_TOP_LEVEL)
90
- enable_testing()
91
-
92
- add_subdirectory(test)
93
- endif()