diff --git a/cpp/src/arrow/scalar.cc b/cpp/src/arrow/scalar.cc index b2ad1ad519bb2..68a0eb08ba4d3 100644 --- a/cpp/src/arrow/scalar.cc +++ b/cpp/src/arrow/scalar.cc @@ -169,8 +169,9 @@ struct ScalarHashImpl { // We can't visit values without unboxing the whole array, so only hash // the null bitmap for now. Only hash the null bitmap if the null count // is not 0 to ensure hash consistency. - hash_ = internal::ComputeBitmapHash(validity, /*seed=*/hash_, - /*bits_offset=*/offset, /*num_bits=*/length); + hash_ = static_cast(internal::ComputeBitmapHash(validity, /*seed=*/hash_, + /*bits_offset=*/offset, + /*num_bits=*/length)); } // Hash the relevant child arrays for each type taking offset and length @@ -791,7 +792,7 @@ struct MakeNullImpl { ARROW_ASSIGN_OR_RAISE(std::shared_ptr value, AllocateBuffer(type.byte_width())); // Avoid exposing past memory contents - memset(value->mutable_data(), 0, value->size()); + memset(value->mutable_data(), 0, static_cast(value->size())); out_ = std::make_shared(std::move(value), type_, /*is_valid=*/false); return Status::OK(); diff --git a/cpp/src/arrow/type.cc b/cpp/src/arrow/type.cc index 47bf52660ffe9..90bc0d1940bd4 100644 --- a/cpp/src/arrow/type.cc +++ b/cpp/src/arrow/type.cc @@ -1057,7 +1057,8 @@ std::string NullType::ToString() const { return name(); } // FieldPath size_t FieldPath::hash() const { - return internal::ComputeStringHash<0>(indices().data(), indices().size() * sizeof(int)); + return static_cast( + internal::ComputeStringHash<0>(indices().data(), indices().size() * sizeof(int))); } std::string FieldPath::ToString() const { @@ -1423,7 +1424,7 @@ void FieldRef::Flatten(std::vector children) { if (n_indices == 0) { return; } else if (n_indices > 0) { - std::vector indices(n_indices); + std::vector indices(static_cast(n_indices)); auto out_indices = indices.begin(); for (const auto& child : flattened_children) { for (int index : *child.field_path()) { diff --git a/cpp/src/arrow/visit_data_inline.h b/cpp/src/arrow/visit_data_inline.h index 6a9b32d73a635..158a123d82107 100644 --- a/cpp/src/arrow/visit_data_inline.h +++ b/cpp/src/arrow/visit_data_inline.h @@ -104,7 +104,8 @@ struct ArraySpanInlineVisitor> { arr.buffers[0].data, arr.offset, arr.length, [&](int64_t i) { ARROW_UNUSED(i); - auto value = std::string_view(data + cur_offset, *offsets - cur_offset); + auto value = std::string_view(data + cur_offset, + static_cast(*offsets - cur_offset)); cur_offset = *offsets++; return valid_func(value); }, @@ -137,7 +138,7 @@ struct ArraySpanInlineVisitor> { arr.buffers[0].data, arr.offset, arr.length, [&](int64_t i) { auto value = std::string_view(reinterpret_cast(data + offsets[i]), - offsets[i + 1] - offsets[i]); + static_cast(offsets[i + 1] - offsets[i])); valid_func(value); }, std::forward(null_func));