diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index a668d3f5..d2ed986b 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -29,6 +29,8 @@ jobs: - {os: windows-latest, r: '3.6'} # use 4.1 to check with rtools40's older compiler - {os: windows-latest, r: '4.1'} + # keep this until the format specifier dust is truly settled (#524) + - {os: windows-latest, r: 'devel'} - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} diff --git a/NEWS.md b/NEWS.md index 7100deea..b8841309 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # vroom (development version) +* Internal changes requested by CRAN around format specification (#524). + # vroom 1.6.4 * It is now possible (again?) to read from a list of connections (@bairdj, #514). diff --git a/src/r_utils.h b/src/r_utils.h index fc5926fd..c09c0794 100644 --- a/src/r_utils.h +++ b/src/r_utils.h @@ -9,6 +9,14 @@ #include #include +#ifndef R_PRIdXLEN_T +# ifdef LONG_VECTOR_SUPPORT +# define R_PRIdXLEN_T "td" +# else +# define R_PRIdXLEN_T "d" +# endif +#endif + namespace vroom { inline std::string diff --git a/src/unicode_fopen.h b/src/unicode_fopen.h index eac96dc7..7ad47ee3 100644 --- a/src/unicode_fopen.h +++ b/src/unicode_fopen.h @@ -49,7 +49,7 @@ inline FILE* unicode_fopen(const char* path, const char* mode) { } buf = (wchar_t*)R_alloc(len, sizeof(wchar_t)); if (buf == NULL) { - Rf_error("Could not allocate buffer of size: %ll", len); + Rf_error("Could not allocate buffer of size: %zu", len); } MultiByteToWideChar(CP_UTF8, 0, path, -1, buf, len); @@ -75,7 +75,7 @@ make_mmap_source(const char* file, std::error_code& error) { } buf = (wchar_t*)malloc(len * sizeof(wchar_t)); if (buf == NULL) { - Rf_error("Could not allocate buffer of size: %ll", len); + Rf_error("Could not allocate buffer of size: %zu", len); } MultiByteToWideChar(CP_UTF8, 0, file, -1, buf, len); diff --git a/src/utils.h b/src/utils.h index 97c1a95c..62e3f43c 100644 --- a/src/utils.h +++ b/src/utils.h @@ -5,6 +5,7 @@ #include #include #include +#include namespace vroom { diff --git a/src/vroom_big_int.h b/src/vroom_big_int.h index eaa2bba0..ba225d21 100644 --- a/src/vroom_big_int.h +++ b/src/vroom_big_int.h @@ -6,6 +6,7 @@ constexpr long long NA_INTEGER64 = 0x8000000000000000LL; +#include "r_utils.h" #include "vroom.h" namespace cpp11 { @@ -56,7 +57,7 @@ class vroom_big_int : public vroom_vec { static Rboolean Inspect(SEXP x, int, int, int, void (*)(SEXP, int, int, int)) { Rprintf( - "vroom_big_int (len=%d, materialized=%s)\n", + "vroom_big_int (len=%" R_PRIdXLEN_T ", materialized=%s)\n", Length(x), R_altrep_data2(x) != R_NilValue ? "T" : "F"); return TRUE; diff --git a/src/vroom_chr.h b/src/vroom_chr.h index ffc90e4c..f101b3eb 100644 --- a/src/vroom_chr.h +++ b/src/vroom_chr.h @@ -4,6 +4,7 @@ #include "altrep.h" +#include "r_utils.h" #include "vroom_vec.h" cpp11::strings read_chr(vroom_vec_info* info); @@ -38,7 +39,7 @@ struct vroom_chr : vroom_vec { static Rboolean Inspect(SEXP x, int, int, int, void (*)(SEXP, int, int, int)) { Rprintf( - "vroom_chr (len=%d, materialized=%s)\n", + "vroom_chr (len=%" R_PRIdXLEN_T ", materialized=%s)\n", Length(x), R_altrep_data2(x) != R_NilValue ? "T" : "F"); return TRUE; diff --git a/src/vroom_date.h b/src/vroom_date.h index d9fcd098..c0acb807 100644 --- a/src/vroom_date.h +++ b/src/vroom_date.h @@ -2,6 +2,7 @@ #include +#include "r_utils.h" #include "vroom_dttm.h" using namespace vroom; @@ -47,7 +48,7 @@ class vroom_date : public vroom_dttm { static Rboolean Inspect(SEXP x, int, int, int, void (*)(SEXP, int, int, int)) { Rprintf( - "vroom_date (len=%d, materialized=%s)\n", + "vroom_date (len=%" R_PRIdXLEN_T ", materialized=%s)\n", Length(x), R_altrep_data2(x) != R_NilValue ? "T" : "F"); return TRUE; diff --git a/src/vroom_dbl.h b/src/vroom_dbl.h index c9699ef9..38f4954e 100644 --- a/src/vroom_dbl.h +++ b/src/vroom_dbl.h @@ -2,6 +2,7 @@ #include "altrep.h" #include "parallel.h" +#include "r_utils.h" #include "vroom_vec.h" double bsd_strtod(const char* begin, const char* end, const char decimalMark); @@ -37,7 +38,7 @@ class vroom_dbl : public vroom_vec { static Rboolean Inspect(SEXP x, int, int, int, void (*)(SEXP, int, int, int)) { Rprintf( - "vroom_dbl (len=%d, materialized=%s)\n", + "vroom_dbl (len=%" R_PRIdXLEN_T ", materialized=%s)\n", Length(x), R_altrep_data2(x) != R_NilValue ? "T" : "F"); return TRUE; diff --git a/src/vroom_dttm.h b/src/vroom_dttm.h index 9ab90798..6d96ec32 100644 --- a/src/vroom_dttm.h +++ b/src/vroom_dttm.h @@ -3,6 +3,7 @@ #include #include +#include "r_utils.h" #include "vroom.h" #include "vroom_vec.h" @@ -65,7 +66,7 @@ class vroom_dttm : public vroom_vec { static Rboolean Inspect(SEXP x, int, int, int, void (*)(SEXP, int, int, int)) { Rprintf( - "vroom_dttm (len=%d, materialized=%s)\n", + "vroom_dttm (len=%" R_PRIdXLEN_T ", materialized=%s)\n", Length(x), R_altrep_data2(x) != R_NilValue ? "T" : "F"); return TRUE; diff --git a/src/vroom_fct.h b/src/vroom_fct.h index 14083ad6..41434b0b 100644 --- a/src/vroom_fct.h +++ b/src/vroom_fct.h @@ -3,6 +3,7 @@ #include #include "altrep.h" +#include "r_utils.h" #include "vroom.h" #include "vroom_vec.h" @@ -122,7 +123,7 @@ struct vroom_fct : vroom_vec { static Rboolean Inspect(SEXP x, int, int, int, void (*)(SEXP, int, int, int)) { Rprintf( - "vroom_factor (len=%d, materialized=%s)\n", + "vroom_factor (len=%" R_PRIdXLEN_T ", materialized=%s)\n", Length(x), R_altrep_data2(x) != R_NilValue ? "T" : "F"); return TRUE; diff --git a/src/vroom_int.h b/src/vroom_int.h index b61a1acc..0fdb1bda 100644 --- a/src/vroom_int.h +++ b/src/vroom_int.h @@ -2,6 +2,7 @@ #include "altrep.h" +#include "r_utils.h" #include "vroom_vec.h" int strtoi(const char* begin, const char* end); @@ -35,7 +36,7 @@ class vroom_int : public vroom_vec { static Rboolean Inspect(SEXP x, int, int, int, void (*)(SEXP, int, int, int)) { Rprintf( - "vroom_int (len=%d, materialized=%s)\n", + "vroom_int (len=%" R_PRIdXLEN_T ", materialized=%s)\n", Length(x), R_altrep_data2(x) != R_NilValue ? "T" : "F"); return TRUE; diff --git a/src/vroom_num.h b/src/vroom_num.h index b21eacd5..665502fe 100644 --- a/src/vroom_num.h +++ b/src/vroom_num.h @@ -4,6 +4,7 @@ #include "altrep.h" +#include "r_utils.h" #include "vroom_vec.h" #include "parallel.h" @@ -47,7 +48,7 @@ class vroom_num : public vroom_vec { static Rboolean Inspect(SEXP x, int, int, int, void (*)(SEXP, int, int, int)) { Rprintf( - "vroom_num (len=%d, materialized=%s)\n", + "vroom_num (len=%" R_PRIdXLEN_T ", materialized=%s)\n", Length(x), R_altrep_data2(x) != R_NilValue ? "T" : "F"); return TRUE; diff --git a/src/vroom_rle.h b/src/vroom_rle.h index d47373ca..bc05e20b 100644 --- a/src/vroom_rle.h +++ b/src/vroom_rle.h @@ -1,6 +1,7 @@ #pragma once #include "altrep.h" +#include "r_utils.h" #ifdef HAS_ALTREP @@ -40,7 +41,7 @@ class vroom_rle { static Rboolean Inspect(SEXP x, int, int, int, void (*)(SEXP, int, int, int)) { Rprintf( - "vroom_rle (len=%d, materialized=%s)\n", + "vroom_rle (len=%" R_PRIdXLEN_T ", materialized=%s)\n", Length(x), R_altrep_data2(x) != R_NilValue ? "T" : "F"); return TRUE; diff --git a/src/vroom_time.h b/src/vroom_time.h index 1a8d5de5..32d4e01d 100644 --- a/src/vroom_time.h +++ b/src/vroom_time.h @@ -2,6 +2,7 @@ #include +#include "r_utils.h" #include "vroom.h" #include "vroom_dttm.h" @@ -47,7 +48,7 @@ class vroom_time : public vroom_dttm { static Rboolean Inspect(SEXP x, int, int, int, void (*)(SEXP, int, int, int)) { Rprintf( - "vroom_time (len=%d, materialized=%s)\n", + "vroom_time (len=%" R_PRIdXLEN_T ", materialized=%s)\n", Length(x), R_altrep_data2(x) != R_NilValue ? "T" : "F"); return TRUE; diff --git a/src/vroom_write.cc b/src/vroom_write.cc index e399acee..b3624710 100644 --- a/src/vroom_write.cc +++ b/src/vroom_write.cc @@ -270,7 +270,7 @@ void write_buf_con(const std::vector& buf, SEXP con, bool is_stdout) { if (is_stdout) { std::string out; std::copy(buf.begin(), buf.end(), std::back_inserter(out)); - Rprintf("%.*s", buf.size(), out.c_str()); + Rprintf("%.*s", (int) buf.size(), out.c_str()); } else { write_buf(buf, con); }