From 0b23de1bec627954b309e948c4791bd2cb72dc3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Sat, 26 Dec 2020 17:51:22 -0300 Subject: [PATCH] __UNCONST: use uintptr_t instead of unsigned long. The width of unsigned long matching the width of a pointer isn't guaranteed by any standard, though it is a requirement of the Linux syscall API. Using uintptr_t directly is always correct. --- include/xbps_api_impl.h | 2 +- lib/fetch/common.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/xbps_api_impl.h b/include/xbps_api_impl.h index 8d3a9aa9..ab5422ab 100644 --- a/include/xbps_api_impl.h +++ b/include/xbps_api_impl.h @@ -53,7 +53,7 @@ #define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | EXTRACT_FLAGS #ifndef __UNCONST -#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) +#define __UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) #endif /* libarchive compat */ diff --git a/lib/fetch/common.h b/lib/fetch/common.h index 3fde522c..647b184b 100644 --- a/lib/fetch/common.h +++ b/lib/fetch/common.h @@ -168,7 +168,7 @@ fetchIO *ftp_request(struct url *, const char *, const char *, #define CHECK_FLAG(x) (flags && strchr(flags, (x))) #ifndef __UNCONST -#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) +#define __UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) #endif #endif