|
20 | 20 | #ifndef FLB_SIMDUTF_CONNECTOR_H
|
21 | 21 | #define FLB_SIMDUTF_CONNECTOR_H
|
22 | 22 |
|
23 |
| -#include <uchar.h> |
24 |
| - |
25 | 23 | #ifdef __cplusplus
|
26 | 24 | extern "C" {
|
27 | 25 | #endif /* __cplusplus */
|
28 | 26 |
|
| 27 | +#ifdef __APPLE__ |
| 28 | +#include <stdint.h> |
| 29 | +#include <stddef.h> |
| 30 | +typedef int_least16_t CHAR16_T; |
| 31 | +#else |
| 32 | +#include <uchar.h> |
| 33 | +typedef char16_t CHAR16_T; |
| 34 | +#endif |
| 35 | + |
29 | 36 | #define FLB_SIMDUTF_CONNECTOR_CONVERT_OK 0
|
30 | 37 | #define FLB_SIMDUTF_CONNECTOR_CONVERT_NOP -1
|
31 | 38 | #define FLB_SIMDUTF_CONNECTOR_CONVERT_UNSUPPORTED -2
|
@@ -58,20 +65,20 @@ enum flb_simdutf_error_code {
|
58 | 65 | FLB_SIMDUTF_ERROR_CODE_OTHER,
|
59 | 66 | };
|
60 | 67 |
|
61 |
| -int flb_simdutf_connector_utf8_length_from_utf16le(const char16_t *buf, size_t len); |
62 |
| -int flb_simdutf_connector_utf8_length_from_utf16be(const char16_t *buf, size_t len); |
63 |
| -int flb_simdutf_connector_utf8_length_from_utf16(const char16_t *buf, size_t len); |
| 68 | +int flb_simdutf_connector_utf8_length_from_utf16le(const CHAR16_T *buf, size_t len); |
| 69 | +int flb_simdutf_connector_utf8_length_from_utf16be(const CHAR16_T *buf, size_t len); |
| 70 | +int flb_simdutf_connector_utf8_length_from_utf16(const CHAR16_T *buf, size_t len); |
64 | 71 | int flb_simdutf_connector_validate_utf8(const char *buf, size_t len);
|
65 |
| -int flb_simdutf_connector_validate_utf16le(const char16_t *buf, size_t len); |
66 |
| -int flb_simdutf_connector_validate_utf16be(const char16_t *buf, size_t len); |
67 |
| -int flb_simdutf_connector_validate_utf16(const char16_t *buf, size_t len); |
68 |
| -int flb_simdutf_connector_convert_utf16le_to_utf8(const char16_t *buf, size_t len, |
| 72 | +int flb_simdutf_connector_validate_utf16le(const CHAR16_T *buf, size_t len); |
| 73 | +int flb_simdutf_connector_validate_utf16be(const CHAR16_T *buf, size_t len); |
| 74 | +int flb_simdutf_connector_validate_utf16(const CHAR16_T *buf, size_t len); |
| 75 | +int flb_simdutf_connector_convert_utf16le_to_utf8(const CHAR16_T *buf, size_t len, |
69 | 76 | char **utf8_output, size_t *out_size);
|
70 |
| -int flb_simdutf_connector_convert_utf16be_to_utf8(const char16_t *buf, size_t len, |
| 77 | +int flb_simdutf_connector_convert_utf16be_to_utf8(const CHAR16_T *buf, size_t len, |
71 | 78 | char **utf8_output, size_t *out_size);
|
72 |
| -int flb_simdutf_connector_convert_utf16_to_utf8(const char16_t *buf, size_t len, |
| 79 | +int flb_simdutf_connector_convert_utf16_to_utf8(const CHAR16_T *buf, size_t len, |
73 | 80 | char **utf8_output, size_t *out_size);
|
74 |
| -void flb_simdutf_connector_change_endianness_utf16(const char16_t *input, size_t length, char16_t *output); |
| 81 | +void flb_simdutf_connector_change_endianness_utf16(const CHAR16_T *input, size_t length, CHAR16_T *output); |
75 | 82 | int flb_simdutf_connector_detect_encodings(const char *input, size_t length);
|
76 | 83 | int flb_simdutf_connector_convert_from_unicode(int preferred_encoding,
|
77 | 84 | const char *input, size_t length,
|
|
0 commit comments