From b86387442e90ec75e4b84f5e06e2a4556b15d9b8 Mon Sep 17 00:00:00 2001 From: Derek Bailey Date: Fri, 26 Aug 2022 14:35:21 -0700 Subject: [PATCH] Fix typos (#7483) --- dart/lib/src/builder.dart | 2 +- dart/lib/src/reference.dart | 2 +- include/flatbuffers/base.h | 18 +++++++++--------- include/flatbuffers/buffer.h | 2 +- include/flatbuffers/flatbuffer_builder.h | 6 +++--- include/flatbuffers/flexbuffers.h | 2 +- include/flatbuffers/stl_emulation.h | 12 ++++++------ include/flatbuffers/util.h | 2 +- include/flatbuffers/vector_downward.h | 2 +- include/flatbuffers/verifier.h | 2 +- .../google/flatbuffers/FlexBuffersBuilder.java | 4 ++-- tests/test.cpp | 18 +++++++++--------- ts/builder.ts | 12 ++++++------ 13 files changed, 42 insertions(+), 42 deletions(-) diff --git a/dart/lib/src/builder.dart b/dart/lib/src/builder.dart index a0d47ed1f..82681e7ec 100644 --- a/dart/lib/src/builder.dart +++ b/dart/lib/src/builder.dart @@ -17,7 +17,7 @@ class Builder { final Map _indirectDoubleCache = {}; /// Instantiate the builder if you intent to gradually build up the buffer by calling - /// add... methods and calling [finish] to receive the the resulting byte array. + /// add... methods and calling [finish] to receive the resulting byte array. /// /// The default size of internal buffer is set to 2048. Provide a different value in order to avoid buffer copies. Builder({int size = 2048}) : _buffer = ByteData(size); diff --git a/dart/lib/src/reference.dart b/dart/lib/src/reference.dart index e52d0b709..66195c1bd 100644 --- a/dart/lib/src/reference.dart +++ b/dart/lib/src/reference.dart @@ -199,7 +199,7 @@ class Reference { return _MapValueIterator(this); } - /// Returns the length of the the underlying FlexBuffer value. + /// Returns the length of the underlying FlexBuffer value. /// If the underlying value is [null] the length is 0. /// If the underlying value is a number, or a bool, the length is 1. /// If the underlying value is a vector, or map, the length reflects number of elements / element pairs. diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h index beeb35d60..edff523f5 100644 --- a/include/flatbuffers/base.h +++ b/include/flatbuffers/base.h @@ -273,14 +273,14 @@ namespace flatbuffers { #endif // !FLATBUFFERS_LOCALE_INDEPENDENT // Suppress Undefined Behavior Sanitizer (recoverable only). Usage: -// - __supress_ubsan__("undefined") -// - __supress_ubsan__("signed-integer-overflow") +// - __suppress_ubsan__("undefined") +// - __suppress_ubsan__("signed-integer-overflow") #if defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7)) - #define __supress_ubsan__(type) __attribute__((no_sanitize(type))) + #define __suppress_ubsan__(type) __attribute__((no_sanitize(type))) #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409) - #define __supress_ubsan__(type) __attribute__((no_sanitize_undefined)) + #define __suppress_ubsan__(type) __attribute__((no_sanitize_undefined)) #else - #define __supress_ubsan__(type) + #define __suppress_ubsan__(type) #endif // This is constexpr function used for checking compile-time constants. @@ -413,7 +413,7 @@ template T EndianScalar(T t) { template // UBSAN: C++ aliasing type rules, see std::bit_cast<> for details. -__supress_ubsan__("alignment") +__suppress_ubsan__("alignment") T ReadScalar(const void *p) { return EndianScalar(*reinterpret_cast(p)); } @@ -427,13 +427,13 @@ T ReadScalar(const void *p) { template // UBSAN: C++ aliasing type rules, see std::bit_cast<> for details. -__supress_ubsan__("alignment") +__suppress_ubsan__("alignment") void WriteScalar(void *p, T t) { *reinterpret_cast(p) = EndianScalar(t); } template struct Offset; -template __supress_ubsan__("alignment") void WriteScalar(void *p, Offset t) { +template __suppress_ubsan__("alignment") void WriteScalar(void *p, Offset t) { *reinterpret_cast(p) = EndianScalar(t.o); } @@ -444,7 +444,7 @@ template __supress_ubsan__("alignment") void WriteScalar(void *p, Of // Computes how many bytes you'd have to pad to be able to write an // "scalar_size" scalar if the buffer had grown to "buf_size" (downwards in // memory). -__supress_ubsan__("unsigned-integer-overflow") +__suppress_ubsan__("unsigned-integer-overflow") inline size_t PaddingBytes(size_t buf_size, size_t scalar_size) { return ((~buf_size) + 1) & (scalar_size - 1); } diff --git a/include/flatbuffers/buffer.h b/include/flatbuffers/buffer.h index e8d2ce9c7..ca005f715 100644 --- a/include/flatbuffers/buffer.h +++ b/include/flatbuffers/buffer.h @@ -95,7 +95,7 @@ template struct IndirectHelper { } }; -/// @brief Get a pointer to the the file_identifier section of the buffer. +/// @brief Get a pointer to the file_identifier section of the buffer. /// @return Returns a const char pointer to the start of the file_identifier /// characters in the buffer. The returned char * has length /// 'flatbuffers::FlatBufferBuilder::kFileIdentifierLength'. diff --git a/include/flatbuffers/flatbuffer_builder.h b/include/flatbuffers/flatbuffer_builder.h index 9f413971e..f9432338f 100644 --- a/include/flatbuffers/flatbuffer_builder.h +++ b/include/flatbuffers/flatbuffer_builder.h @@ -358,7 +358,7 @@ class FlatBufferBuilder { // If you get this assert, a corresponding StartTable wasn't called. FLATBUFFERS_ASSERT(nested); // Write the vtable offset, which is the start of any Table. - // We fill it's value later. + // We fill its value later. auto vtableoffsetloc = PushElement(0); // Write a vtable, which consists entirely of voffset_t elements. // It starts with the number of offsets, followed by a type id, followed @@ -747,7 +747,7 @@ class FlatBufferBuilder { /// @brief Serialize a collection of Strings into a FlatBuffer `vector`. /// This is a convenience function for a common case. - /// @param begin The begining iterator of the collection + /// @param begin The beginning iterator of the collection /// @param end The ending iterator of the collection /// @return Returns a typed `Offset` into the serialized data indicating /// where the vector is stored. @@ -757,7 +757,7 @@ class FlatBufferBuilder { auto scratch_buffer_usage = size * sizeof(Offset); // If there is not enough space to store the offsets, there definitely won't // be enough space to store all the strings. So ensuring space for the - // scratch region is OK, for it it fails, it would have failed later. + // scratch region is OK, for if it fails, it would have failed later. buf_.ensure_space(scratch_buffer_usage); for (auto it = begin; it != end; ++it) { buf_.scratch_push_small(CreateString(*it)); diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h index 025d6625d..7bf84302e 100644 --- a/include/flatbuffers/flexbuffers.h +++ b/include/flatbuffers/flexbuffers.h @@ -1871,7 +1871,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS { std::vector *reuse_tracker_; }; -// Utility function that contructs the Verifier for you, see above for +// Utility function that constructs the Verifier for you, see above for // parameters. inline bool VerifyBuffer(const uint8_t *buf, size_t buf_len, std::vector *reuse_tracker = nullptr) { diff --git a/include/flatbuffers/stl_emulation.h b/include/flatbuffers/stl_emulation.h index c930b67dc..452ddb832 100644 --- a/include/flatbuffers/stl_emulation.h +++ b/include/flatbuffers/stl_emulation.h @@ -293,7 +293,7 @@ namespace internal { // > to a pointer to an array of To. // This helper is used for checking of 'From -> const From'. template - struct is_span_convertable { + struct is_span_convertible { using type = typename std::conditional::value && (Extent == dynamic_extent || N == Extent), @@ -415,7 +415,7 @@ class span FLATBUFFERS_FINAL_CLASS { // extent == 0 || extent == flatbuffers::dynamic_extent. // A dummy template argument N is need dependency for SFINAE. template::type = 0> + typename internal::is_span_convertible::type = 0> FLATBUFFERS_CONSTEXPR_CPP11 span() FLATBUFFERS_NOEXCEPT : data_(nullptr), count_(0) { static_assert(extent == 0 || extent == dynamic_extent, "invalid span"); @@ -428,12 +428,12 @@ class span FLATBUFFERS_FINAL_CLASS { // std::remove_pointer_t(*)[] // is convertible to element_type (*)[]. template::type = 0> + typename internal::is_span_convertible::type = 0> FLATBUFFERS_CONSTEXPR_CPP11 span(element_type (&arr)[N]) FLATBUFFERS_NOEXCEPT : data_(arr), count_(N) {} template::type = 0> + typename internal::is_span_convertible::type = 0> FLATBUFFERS_CONSTEXPR_CPP11 span(std::array &arr) FLATBUFFERS_NOEXCEPT : data_(arr.data()), count_(N) {} @@ -443,7 +443,7 @@ class span FLATBUFFERS_FINAL_CLASS { // : data_(arr.data()), count_(N) {} template::type = 0> + typename internal::is_span_convertible::type = 0> FLATBUFFERS_CONSTEXPR_CPP11 span(const std::array &arr) FLATBUFFERS_NOEXCEPT : data_(arr.data()), count_(N) {} @@ -453,7 +453,7 @@ class span FLATBUFFERS_FINAL_CLASS { // if extent == std::dynamic_extent || N == extent is true and U (*)[] // is convertible to element_type (*)[]. template::type = 0> + typename internal::is_span_convertible::type = 0> FLATBUFFERS_CONSTEXPR_CPP11 span(const flatbuffers::span &s) FLATBUFFERS_NOEXCEPT : span(s.data(), s.size()) { } diff --git a/include/flatbuffers/util.h b/include/flatbuffers/util.h index 091af53e3..dcc5065f9 100644 --- a/include/flatbuffers/util.h +++ b/include/flatbuffers/util.h @@ -255,7 +255,7 @@ inline void strtoval_impl(double *val, const char *str, char **endptr) { } // UBSAN: double to float is safe if numeric_limits::is_iec559 is true. -__supress_ubsan__("float-cast-overflow") +__suppress_ubsan__("float-cast-overflow") inline void strtoval_impl(float *val, const char *str, char **endptr) { *val = __strtof_impl(str, endptr); } diff --git a/include/flatbuffers/vector_downward.h b/include/flatbuffers/vector_downward.h index 339139185..d25e54497 100644 --- a/include/flatbuffers/vector_downward.h +++ b/include/flatbuffers/vector_downward.h @@ -24,7 +24,7 @@ namespace flatbuffers { // This is a minimal replication of std::vector functionality, -// except growing from higher to lower addresses. i.e push_back() inserts data +// except growing from higher to lower addresses. i.e. push_back() inserts data // in the lowest address in the vector. // Since this vector leaves the lower part unused, we support a "scratch-pad" // that can be stored there for temporary data, to share the allocated space. diff --git a/include/flatbuffers/verifier.h b/include/flatbuffers/verifier.h index 0241223e4..1369e57d8 100644 --- a/include/flatbuffers/verifier.h +++ b/include/flatbuffers/verifier.h @@ -158,7 +158,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS { return true; } - __supress_ubsan__("unsigned-integer-overflow") bool VerifyTableStart( + __suppress_ubsan__("unsigned-integer-overflow") bool VerifyTableStart( const uint8_t *const table) { // Check the vtable offset. const auto tableo = static_cast(table - buf_); diff --git a/java/com/google/flatbuffers/FlexBuffersBuilder.java b/java/com/google/flatbuffers/FlexBuffersBuilder.java index 7f41bb6f3..08ed72f42 100644 --- a/java/com/google/flatbuffers/FlexBuffersBuilder.java +++ b/java/com/google/flatbuffers/FlexBuffersBuilder.java @@ -451,7 +451,7 @@ public class FlexBuffersBuilder { /** * Finishes a vector, but writing the information in the buffer * @param key key used to store element in map - * @param start reference for begining of the vector. Returned by {@link startVector()} + * @param start reference for beginning of the vector. Returned by {@link startVector()} * @param typed boolean indicating whether vector is typed * @param fixed boolean indicating whether vector is fixed * @return Reference to the vector @@ -602,7 +602,7 @@ public class FlexBuffersBuilder { /** * Finishes a map, but writing the information in the buffer * @param key key used to store element in map - * @param start reference for begining of the map. Returned by {@link startMap()} + * @param start reference for beginning of the map. Returned by {@link startMap()} * @return Reference to the map */ public int endMap(String key, int start) { diff --git a/tests/test.cpp b/tests/test.cpp index 711eaf4d8..1202cefa1 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -1815,7 +1815,7 @@ void FuzzTest2() { break; } } - TEST_NOTNULL(nullptr); //-V501 (this comment supresses CWE-570 warning) + TEST_NOTNULL(nullptr); //-V501 (this comment suppresses CWE-570 warning) } // clang-format off @@ -3663,14 +3663,14 @@ void CreateSharedStringTest() { #if !defined(FLATBUFFERS_USE_STD_SPAN) && !defined(FLATBUFFERS_SPAN_MINIMAL) void FlatbuffersSpanTest() { // Compile-time checking of non-const [] to const [] conversions. - using flatbuffers::internal::is_span_convertable; - (void)is_span_convertable::type(123); - (void)is_span_convertable::type(123); - (void)is_span_convertable::type(123); - (void)is_span_convertable::type(123); - (void)is_span_convertable::type(123); - (void)is_span_convertable::type(123); - (void)is_span_convertable::type(123); + using flatbuffers::internal::is_span_convertible; + (void)is_span_convertible::type(123); + (void)is_span_convertible::type(123); + (void)is_span_convertible::type(123); + (void)is_span_convertible::type(123); + (void)is_span_convertible::type(123); + (void)is_span_convertible::type(123); + (void)is_span_convertible::type(123); using flatbuffers::span; span c1; diff --git a/ts/builder.ts b/ts/builder.ts index 2178434ca..85f572627 100644 --- a/ts/builder.ts +++ b/ts/builder.ts @@ -150,7 +150,7 @@ export class Builder { /** * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary). - * @param value The `int8` to add the the buffer. + * @param value The `int8` to add the buffer. */ addInt8(value: number): void { this.prep(1, 0); @@ -159,7 +159,7 @@ export class Builder { /** * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary). - * @param value The `int16` to add the the buffer. + * @param value The `int16` to add the buffer. */ addInt16(value: number): void { this.prep(2, 0); @@ -168,7 +168,7 @@ export class Builder { /** * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary). - * @param value The `int32` to add the the buffer. + * @param value The `int32` to add the buffer. */ addInt32(value: number): void { this.prep(4, 0); @@ -177,7 +177,7 @@ export class Builder { /** * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary). - * @param value The `int64` to add the the buffer. + * @param value The `int64` to add the buffer. */ addInt64(value: bigint): void { this.prep(8, 0); @@ -186,7 +186,7 @@ export class Builder { /** * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary). - * @param value The `float32` to add the the buffer. + * @param value The `float32` to add the buffer. */ addFloat32(value: number): void { this.prep(4, 0); @@ -195,7 +195,7 @@ export class Builder { /** * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary). - * @param value The `float64` to add the the buffer. + * @param value The `float64` to add the buffer. */ addFloat64(value: number): void { this.prep(8, 0);