Skip to content

Commit 933eb06

Browse files
author
Jake Champion
committed
chore: format rust-encoding.h
1 parent 807cf82 commit 933eb06

File tree

1 file changed

+57
-22
lines changed

1 file changed

+57
-22
lines changed

runtime/js-compute-runtime/rust-encoding/rust-encoding.h

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// The constructor created by cbindgen's `derive_constructor` causes this warning.
22
// Gecko's various uses of cbindgen silence it, so we do, too.
33
#ifdef __clang__
4-
#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
4+
# pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
55
#endif
66

7+
78
#ifndef rust_encoding_bindings_h
89
#define rust_encoding_bindings_h
910

@@ -15,8 +16,9 @@
1516
#include <cstddef>
1617
#include <cstdint>
1718
#include <cstdlib>
18-
#include <new>
1919
#include <ostream>
20+
#include <new>
21+
2022

2123
namespace jsencoding {
2224

@@ -313,6 +315,7 @@ struct Encoder;
313315
/// C/C++).
314316
struct Encoding;
315317

318+
316319
extern "C" {
317320

318321
extern const ConstEncoding BIG5_ENCODING;
@@ -766,8 +769,13 @@ size_t decoder_max_utf8_buffer_length_without_replacement(const Decoder *decoder
766769
/// designate a valid block of memory.
767770
///
768771
/// [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);
771779

772780
/// Incrementally decode a byte stream into UTF-8 _without replacement_.
773781
///
@@ -787,8 +795,11 @@ uint32_t decoder_decode_to_utf8(Decoder *decoder, const uint8_t *src, size_t *sr
787795
/// designate a valid block of memory.
788796
///
789797
/// [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,
792803
bool last);
793804

794805
/// 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
826837
/// designate a valid block of memory.
827838
///
828839
/// [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);
831847

832848
/// Incrementally decode a byte stream into UTF-16 _without replacement_.
833849
///
@@ -847,9 +863,12 @@ uint32_t decoder_decode_to_utf16(Decoder *decoder, const uint8_t *src, size_t *s
847863
/// designate a valid block of memory.
848864
///
849865
/// [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);
853872

854873
/// Checks for compatibility with storing Unicode scalar values as unsigned
855874
/// 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
871890
///
872891
/// UB ensues if `buffer` and `*buffer_len` don't designate a valid memory
873892
/// 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,
875895
size_t buffer_len);
876896

877897
/// 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
937957
/// designate a valid block of memory.
938958
///
939959
/// [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);
942967

943968
/// Incrementally encode into byte stream from UTF-8 _without replacement_.
944969
///
@@ -961,9 +986,12 @@ uint32_t encoder_encode_from_utf8(Encoder *encoder, const uint8_t *src, size_t *
961986
/// designate a valid block of memory.
962987
///
963988
/// [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);
967995

968996
/// Query the worst-case output size when encoding from UTF-16 with
969997
/// replacement.
@@ -1003,8 +1031,12 @@ size_t encoder_max_buffer_length_from_utf16_without_replacement(const Encoder *e
10031031
/// designate a valid block of memory.
10041032
///
10051033
/// [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,
10081040
bool *had_replacements);
10091041

10101042
/// 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
10251057
/// designate a valid block of memory.
10261058
///
10271059
/// [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);
10311066

10321067
} // extern "C"
10331068

0 commit comments

Comments
 (0)