Skip to content

Commit

Permalink
apacheGH-38893: [R] Fix printf syntax in altrep.cpp (apache#38894)
Browse files Browse the repository at this point in the history
### Rationale for this change

We have CI errors and CRAN check errors on R-devel, where the appropriate attribute for printf format checking was just added.

### What changes are included in this PR?

The appopriate types are now used for printf parameters.

### Are these changes tested?

Covered by existing tests

### Are there any user-facing changes?

No
* Closes: apache#38893

Authored-by: Dewey Dunnington <dewey@voltrondata.com>
Signed-off-by: Jacob Wujciak-Jens <jacob@wujciak.de>
  • Loading branch information
paleolimbot authored and assignUser committed Dec 1, 2023
1 parent 04b2a68 commit 8a6c06e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions r/src/altrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,15 @@ struct AltrepVectorBase {
const char* class_name = CHAR(PRINTNAME(data_class_sym));

if (IsMaterialized(alt)) {
Rprintf("materialized %s len=%d\n", class_name, Rf_xlength(Representation(alt)));
Rprintf("materialized %s len=%ld\n", class_name,
static_cast<long>(Rf_xlength(Representation(alt)))); // NOLINT: runtime/int
} else {
const auto& chunked_array = GetChunkedArray(alt);
Rprintf("%s<%p, %s, %d chunks, %d nulls> len=%d\n", class_name, chunked_array.get(),
Rprintf("%s<%p, %s, %d chunks, %ld nulls> len=%ld\n", class_name,
reinterpret_cast<void*>(chunked_array.get()),
chunked_array->type()->ToString().c_str(), chunked_array->num_chunks(),
chunked_array->null_count(), chunked_array->length());
static_cast<long>(chunked_array->null_count()), // NOLINT: runtime/int
static_cast<long>(chunked_array->length())); // NOLINT: runtime/int
}

return TRUE;
Expand Down Expand Up @@ -819,7 +822,7 @@ struct AltrepVectorString : public AltrepVectorBase<AltrepVectorString<Type>> {
"'; to strip nuls when converting from Arrow to R, set options(arrow.skip_nul "
"= TRUE)";

Rf_error(stripped_string_.c_str());
Rf_error("%s", stripped_string_.c_str());
}

void SetArray(const std::shared_ptr<Array>& array) {
Expand Down

0 comments on commit 8a6c06e

Please sign in to comment.