From 8d56fcd22d088214ff2847ef0a468096ad7c4fb4 Mon Sep 17 00:00:00 2001 From: Toddr Bot Date: Thu, 23 Apr 2026 11:55:36 +0000 Subject: [PATCH] Fix macOS compile warnings (-Wexpansion-to-defined, -Wpointer-sign) The OLD_CRUFTY_SSL_VERSION macro used defined() inside a #define, which produces undefined behavior when expanded in #if directives. Split into #ifdef/#else branches to evaluate the LibreSSL check at preprocessing time instead. Also cast SvPV_nolen() result to UNSIGNED_CHAR* to fix pointer sign mismatch warning in _load_rsa_key(). Co-Authored-By: Claude Opus 4.6 --- RSA.xs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/RSA.xs b/RSA.xs index cc19cd2..fd80267 100644 --- a/RSA.xs +++ b/RSA.xs @@ -91,7 +91,11 @@ typedef struct #define PACKAGE_NAME "Crypt::OpenSSL::RSA" -#define OLD_CRUFTY_SSL_VERSION (OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x03050000fL)) +#ifdef LIBRESSL_VERSION_NUMBER +#define OLD_CRUFTY_SSL_VERSION (OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x03050000fL) +#else +#define OLD_CRUFTY_SSL_VERSION (OPENSSL_VERSION_NUMBER < 0x10100000L) +#endif void croakSsl(char* p_file, int p_line) { @@ -376,7 +380,7 @@ EVP_PKEY* _load_rsa_key(SV* p_keyStringSv, keyString = SvPV(p_keyStringSv, keyStringLength); if (SvPOK(p_passphaseSv)) { - passphase = SvPV_nolen(p_passphaseSv); + passphase = (UNSIGNED_CHAR *)SvPV_nolen(p_passphaseSv); } CHECK_OPEN_SSL(stringBIO = BIO_new_mem_buf(keyString, keyStringLength));