Skip to content

Commit

Permalink
apacheGH-38090: [C++][Emscripten] c: Suppress shorten-64-to-32 warnings
Browse files Browse the repository at this point in the history
We need explicit cast to use `int64_t` for `size_t` on Emscripten.

Explicit casts.
  • Loading branch information
kou committed Oct 6, 2023
1 parent 3697bcd commit d0f9636
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cpp/src/arrow/c/bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -986,8 +986,8 @@ struct SchemaImporter {

Status DoImport() {
// First import children (required for reconstituting parent type)
child_importers_.resize(c_struct_->n_children);
for (int64_t i = 0; i < c_struct_->n_children; ++i) {
child_importers_.resize(static_cast<size_t>(c_struct_->n_children));
for (size_t i = 0; i < static_cast<size_t>(c_struct_->n_children); ++i) {
DCHECK_NE(c_struct_->children[i], nullptr);
RETURN_NOT_OK(child_importers_[i].ImportChild(this, c_struct_->children[i]));
}
Expand Down Expand Up @@ -1301,7 +1301,7 @@ struct SchemaImporter {
}

Result<std::shared_ptr<Field>> MakeChildField(int64_t child_id) {
const auto& child = child_importers_[child_id];
const auto& child = child_importers_[static_cast<size_t>(child_id)];
if (child.c_struct_->name == nullptr) {
return Status::Invalid("Expected non-null name in imported array child");
}
Expand All @@ -1310,7 +1310,7 @@ struct SchemaImporter {

Result<std::vector<std::shared_ptr<Field>>> MakeChildFields() {
std::vector<std::shared_ptr<Field>> fields(child_importers_.size());
for (int64_t i = 0; i < static_cast<int64_t>(child_importers_.size()); ++i) {
for (size_t i = 0; i < child_importers_.size(); ++i) {
ARROW_ASSIGN_OR_RAISE(fields[i], MakeChildField(i));
}
return fields;
Expand Down Expand Up @@ -1511,7 +1511,7 @@ struct ArrayImporter {
type_->ToString());
}
child_importers_.reserve(fields.size());
for (int64_t i = 0; i < c_struct_->n_children; ++i) {
for (size_t i = 0; i < static_cast<size_t>(c_struct_->n_children); ++i) {
DCHECK_NE(c_struct_->children[i], nullptr);
child_importers_.emplace_back(fields[i]->type());
RETURN_NOT_OK(child_importers_.back().ImportChild(this, c_struct_->children[i]));
Expand Down

0 comments on commit d0f9636

Please sign in to comment.