Skip to content

Commit

Permalink
using uintptr_t
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonov548 committed Jan 15, 2024
1 parent 0da758d commit 9e8249a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/rinterface_extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <R_ext/Altrep.h>

#include <stdio.h>
#include <inttypes.h>

#if defined(__SANITIZE_ADDRESS__)
# define IGRAPH_SANITIZER_AVAILABLE 1
Expand Down Expand Up @@ -73,8 +74,8 @@ enum igraph_versions {
void R_check_int_scalar(SEXP value)
{
if (Rf_xlength(value) != 1) {
igraph_errorf("Expecting a scalar integer but received a vector of length %lu.",
__FILE__, __LINE__, IGRAPH_EINVAL, (unsigned long) Rf_xlength(value));
igraph_errorf("Expecting a scalar integer but received a vector of length %" PRIuPTR ".",
__FILE__, __LINE__, IGRAPH_EINVAL, (uintptr_t) Rf_xlength(value));
}
if (((igraph_integer_t) REAL(value)[0]) != REAL(value)[0]) {
igraph_errorf("The value %.17g is not representable as an integer.",
Expand All @@ -85,16 +86,16 @@ void R_check_int_scalar(SEXP value)
void R_check_real_scalar(SEXP value)
{
if (Rf_xlength(value) != 1) {
igraph_errorf("Expecting a scalar real but received a vector of length %lu.",
__FILE__, __LINE__, IGRAPH_EINVAL, (unsigned long) Rf_xlength(value));
igraph_errorf("Expecting a scalar real but received a vector of length %" PRIuPTR ".",
__FILE__, __LINE__, IGRAPH_EINVAL, (uintptr_t) Rf_xlength(value));
}
}

void R_check_bool_scalar(SEXP value)
{
if (Rf_xlength(value) != 1) {
igraph_errorf("Expecting a scalar logical but received a vector of length %lu.",
__FILE__, __LINE__, IGRAPH_EINVAL, (unsigned long) Rf_xlength(value));
igraph_errorf("Expecting a scalar logical but received a vector of length %" PRIuPTR ".",
__FILE__, __LINE__, IGRAPH_EINVAL, (uintptr_t) Rf_xlength(value));
}
}

Expand Down

0 comments on commit 9e8249a

Please sign in to comment.