diff --git a/ChangeLog.md b/ChangeLog.md index 82529b9..290056d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,7 @@ ### Internal - Add builds with gcc-9 to CI. +- Fix invalid pointer to integer cast that might cause problems on some platforms. ## v0.4.1 diff --git a/lib/fort.c b/lib/fort.c index 47bc0d5..6c5e3d6 100644 --- a/lib/fort.c +++ b/lib/fort.c @@ -6867,7 +6867,7 @@ int buffer_check_align(f_string_buffer_t *buffer) return 1; #ifdef FT_HAVE_WCHAR case W_CHAR_BUF: - return (((unsigned long)buffer->str.data) & (sizeof(wchar_t) - 1)) == 0; + return (((uintptr_t)buffer->str.data) & (sizeof(wchar_t) - 1)) == 0; #endif #ifdef FT_HAVE_UTF8 case UTF8_BUF: diff --git a/src/string_buffer.c b/src/string_buffer.c index dfafbcc..cb2f6f1 100644 --- a/src/string_buffer.c +++ b/src/string_buffer.c @@ -685,7 +685,7 @@ int buffer_check_align(f_string_buffer_t *buffer) return 1; #ifdef FT_HAVE_WCHAR case W_CHAR_BUF: - return (((unsigned long)buffer->str.data) & (sizeof(wchar_t) - 1)) == 0; + return (((uintptr_t)buffer->str.data) & (sizeof(wchar_t) - 1)) == 0; #endif #ifdef FT_HAVE_UTF8 case UTF8_BUF: