You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by as...@apache.org on 2023/11/27 21:22:07 UTC

(arrow) branch main updated: GH-38893: [R] Fix printf syntax in altrep.cpp (#38894)

This is an automated email from the ASF dual-hosted git repository.

assignuser pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 9cece9dc3e GH-38893: [R] Fix printf syntax in altrep.cpp (#38894)
9cece9dc3e is described below

commit 9cece9dc3e63956a8cbfc125026a17eb3a7ae3dc
Author: Dewey Dunnington <de...@voltrondata.com>
AuthorDate: Mon Nov 27 17:21:59 2023 -0400

    GH-38893: [R] Fix printf syntax in altrep.cpp (#38894)
    
    ### 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: #38893
    
    Authored-by: Dewey Dunnington <de...@voltrondata.com>
    Signed-off-by: Jacob Wujciak-Jens <ja...@wujciak.de>
---
 r/src/altrep.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/r/src/altrep.cpp b/r/src/altrep.cpp
index ae435d54d6..9bacf07d18 100644
--- a/r/src/altrep.cpp
+++ b/r/src/altrep.cpp
@@ -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;
@@ -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) {