1
1
// The constructor created by cbindgen's `derive_constructor` causes this warning.
2
2
// Gecko's various uses of cbindgen silence it, so we do, too.
3
3
#ifdef __clang__
4
- #pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
4
+ # pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
5
5
#endif
6
6
7
+
7
8
#ifndef rust_encoding_bindings_h
8
9
#define rust_encoding_bindings_h
9
10
15
16
#include < cstddef>
16
17
#include < cstdint>
17
18
#include < cstdlib>
18
- #include < new>
19
19
#include < ostream>
20
+ #include < new>
21
+
20
22
21
23
namespace jsencoding {
22
24
@@ -313,6 +315,7 @@ struct Encoder;
313
315
// / C/C++).
314
316
struct Encoding ;
315
317
318
+
316
319
extern " C" {
317
320
318
321
extern const ConstEncoding BIG5_ENCODING;
@@ -766,8 +769,13 @@ size_t decoder_max_utf8_buffer_length_without_replacement(const Decoder *decoder
766
769
// / designate a valid block of memory.
767
770
// /
768
771
// / [1]: https://docs.rs/encoding_rs/0.6.10/encoding_rs/struct.Decoder.html
769
- uint32_t decoder_decode_to_utf8 (Decoder *decoder, const uint8_t *src, size_t *src_len, uint8_t *dst,
770
- size_t *dst_len, bool last, bool *had_replacements);
772
+ uint32_t decoder_decode_to_utf8 (Decoder *decoder,
773
+ const uint8_t *src,
774
+ size_t *src_len,
775
+ uint8_t *dst,
776
+ size_t *dst_len,
777
+ bool last,
778
+ bool *had_replacements);
771
779
772
780
// / Incrementally decode a byte stream into UTF-8 _without replacement_.
773
781
// /
@@ -787,8 +795,11 @@ uint32_t decoder_decode_to_utf8(Decoder *decoder, const uint8_t *src, size_t *sr
787
795
// / designate a valid block of memory.
788
796
// /
789
797
// / [1]: https://docs.rs/encoding_rs/0.6.10/encoding_rs/struct.Decoder.html
790
- uint32_t decoder_decode_to_utf8_without_replacement (Decoder *decoder, const uint8_t *src,
791
- size_t *src_len, uint8_t *dst, size_t *dst_len,
798
+ uint32_t decoder_decode_to_utf8_without_replacement (Decoder *decoder,
799
+ const uint8_t *src,
800
+ size_t *src_len,
801
+ uint8_t *dst,
802
+ size_t *dst_len,
792
803
bool last);
793
804
794
805
// / Query the worst-case UTF-16 output size (with or without replacement).
@@ -826,8 +837,13 @@ size_t decoder_max_utf16_buffer_length(const Decoder *decoder, size_t u16_length
826
837
// / designate a valid block of memory.
827
838
// /
828
839
// / [1]: https://docs.rs/encoding_rs/0.6.10/encoding_rs/struct.Decoder.html
829
- uint32_t decoder_decode_to_utf16 (Decoder *decoder, const uint8_t *src, size_t *src_len,
830
- uint16_t *dst, size_t *dst_len, bool last, bool *had_replacements);
840
+ uint32_t decoder_decode_to_utf16 (Decoder *decoder,
841
+ const uint8_t *src,
842
+ size_t *src_len,
843
+ uint16_t *dst,
844
+ size_t *dst_len,
845
+ bool last,
846
+ bool *had_replacements);
831
847
832
848
// / Incrementally decode a byte stream into UTF-16 _without replacement_.
833
849
// /
@@ -847,9 +863,12 @@ uint32_t decoder_decode_to_utf16(Decoder *decoder, const uint8_t *src, size_t *s
847
863
// / designate a valid block of memory.
848
864
// /
849
865
// / [1]: https://docs.rs/encoding_rs/0.6.10/encoding_rs/struct.Decoder.html
850
- uint32_t decoder_decode_to_utf16_without_replacement (Decoder *decoder, const uint8_t *src,
851
- size_t *src_len, uint16_t *dst,
852
- size_t *dst_len, bool last);
866
+ uint32_t decoder_decode_to_utf16_without_replacement (Decoder *decoder,
867
+ const uint8_t *src,
868
+ size_t *src_len,
869
+ uint16_t *dst,
870
+ size_t *dst_len,
871
+ bool last);
853
872
854
873
// / Checks for compatibility with storing Unicode scalar values as unsigned
855
874
// / bytes taking into account the state of the decoder.
@@ -871,7 +890,8 @@ uint32_t decoder_decode_to_utf16_without_replacement(Decoder *decoder, const uin
871
890
// /
872
891
// / UB ensues if `buffer` and `*buffer_len` don't designate a valid memory
873
892
// / block of if `buffer` is `NULL`.
874
- size_t decoder_latin1_byte_compatible_up_to (const Decoder *decoder, const uint8_t *buffer,
893
+ size_t decoder_latin1_byte_compatible_up_to (const Decoder *decoder,
894
+ const uint8_t *buffer,
875
895
size_t buffer_len);
876
896
877
897
// / Deallocates an `Encoder` previously allocated by `encoding_new_encoder()`.
@@ -937,8 +957,13 @@ size_t encoder_max_buffer_length_from_utf8_without_replacement(const Encoder *en
937
957
// / designate a valid block of memory.
938
958
// /
939
959
// / [1]: https://docs.rs/encoding_rs/0.6.10/encoding_rs/struct.Encoder.html
940
- uint32_t encoder_encode_from_utf8 (Encoder *encoder, const uint8_t *src, size_t *src_len,
941
- uint8_t *dst, size_t *dst_len, bool last, bool *had_replacements);
960
+ uint32_t encoder_encode_from_utf8 (Encoder *encoder,
961
+ const uint8_t *src,
962
+ size_t *src_len,
963
+ uint8_t *dst,
964
+ size_t *dst_len,
965
+ bool last,
966
+ bool *had_replacements);
942
967
943
968
// / Incrementally encode into byte stream from UTF-8 _without replacement_.
944
969
// /
@@ -961,9 +986,12 @@ uint32_t encoder_encode_from_utf8(Encoder *encoder, const uint8_t *src, size_t *
961
986
// / designate a valid block of memory.
962
987
// /
963
988
// / [1]: https://docs.rs/encoding_rs/0.6.10/encoding_rs/struct.Encoder.html
964
- uint32_t encoder_encode_from_utf8_without_replacement (Encoder *encoder, const uint8_t *src,
965
- size_t *src_len, uint8_t *dst,
966
- size_t *dst_len, bool last);
989
+ uint32_t encoder_encode_from_utf8_without_replacement (Encoder *encoder,
990
+ const uint8_t *src,
991
+ size_t *src_len,
992
+ uint8_t *dst,
993
+ size_t *dst_len,
994
+ bool last);
967
995
968
996
// / Query the worst-case output size when encoding from UTF-16 with
969
997
// / replacement.
@@ -1003,8 +1031,12 @@ size_t encoder_max_buffer_length_from_utf16_without_replacement(const Encoder *e
1003
1031
// / designate a valid block of memory.
1004
1032
// /
1005
1033
// / [1]: https://docs.rs/encoding_rs/0.6.10/encoding_rs/struct.Encoder.html
1006
- uint32_t encoder_encode_from_utf16 (Encoder *encoder, const uint16_t *src, size_t *src_len,
1007
- uint8_t *dst, size_t *dst_len, bool last,
1034
+ uint32_t encoder_encode_from_utf16 (Encoder *encoder,
1035
+ const uint16_t *src,
1036
+ size_t *src_len,
1037
+ uint8_t *dst,
1038
+ size_t *dst_len,
1039
+ bool last,
1008
1040
bool *had_replacements);
1009
1041
1010
1042
// / Incrementally encode into byte stream from UTF-16 _without replacement_.
@@ -1025,9 +1057,12 @@ uint32_t encoder_encode_from_utf16(Encoder *encoder, const uint16_t *src, size_t
1025
1057
// / designate a valid block of memory.
1026
1058
// /
1027
1059
// / [1]: https://docs.rs/encoding_rs/0.6.10/encoding_rs/struct.Encoder.html
1028
- uint32_t encoder_encode_from_utf16_without_replacement (Encoder *encoder, const uint16_t *src,
1029
- size_t *src_len, uint8_t *dst,
1030
- size_t *dst_len, bool last);
1060
+ uint32_t encoder_encode_from_utf16_without_replacement (Encoder *encoder,
1061
+ const uint16_t *src,
1062
+ size_t *src_len,
1063
+ uint8_t *dst,
1064
+ size_t *dst_len,
1065
+ bool last);
1031
1066
1032
1067
} // extern "C"
1033
1068
0 commit comments