Minor improvement (#7766)

This commit is contained in:
Saman
2023-01-08 11:40:03 +08:00
committed by GitHub
parent c2668fc0e2
commit 5638a6a900
4 changed files with 7 additions and 7 deletions

View File

@@ -45,7 +45,7 @@ class DetachedBuffer {
cur_(cur),
size_(sz) {}
DetachedBuffer(DetachedBuffer &&other)
DetachedBuffer(DetachedBuffer &&other) noexcept
: allocator_(other.allocator_),
own_allocator_(other.own_allocator_),
buf_(other.buf_),
@@ -55,7 +55,7 @@ class DetachedBuffer {
other.reset();
}
DetachedBuffer &operator=(DetachedBuffer &&other) {
DetachedBuffer &operator=(DetachedBuffer &&other) noexcept {
if (this == &other) return *this;
destroy();

View File

@@ -98,7 +98,7 @@ class FlatBufferBuilder {
}
/// @brief Move constructor for FlatBufferBuilder.
FlatBufferBuilder(FlatBufferBuilder &&other)
FlatBufferBuilder(FlatBufferBuilder &&other) noexcept
: buf_(1024, nullptr, false, AlignOf<largest_scalar_t>()),
num_field_loc(0),
max_voffset_(0),
@@ -116,7 +116,7 @@ class FlatBufferBuilder {
}
/// @brief Move assignment operator for FlatBufferBuilder.
FlatBufferBuilder &operator=(FlatBufferBuilder &&other) {
FlatBufferBuilder &operator=(FlatBufferBuilder &&other) noexcept {
// Move construct a temporary and swap idiom
FlatBufferBuilder temp(std::move(other));
Swap(temp);

View File

@@ -1845,7 +1845,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
uint8_t len = 0;
auto vtype = ToFixedTypedVectorElementType(r.type_, &len);
if (!VerifyType(vtype)) return false;
return VerifyFromPointer(p, r.byte_width_ * len);
return VerifyFromPointer(p, static_cast<size_t>(r.byte_width_) * len);
}
default: return false;
}

View File

@@ -45,7 +45,7 @@ class vector_downward {
cur_(nullptr),
scratch_(nullptr) {}
vector_downward(vector_downward &&other)
vector_downward(vector_downward &&other) noexcept
// clang-format on
: allocator_(other.allocator_),
own_allocator_(other.own_allocator_),
@@ -66,7 +66,7 @@ class vector_downward {
other.scratch_ = nullptr;
}
vector_downward &operator=(vector_downward &&other) {
vector_downward &operator=(vector_downward &&other) noexcept {
// Move construct a temporary and swap idiom
vector_downward temp(std::move(other));
swap(temp);