diff --git a/CMakeLists.txt b/CMakeLists.txt index bff03eb27..e07625816 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.16) cmake_policy(SET CMP0074 NEW) # find_package() uses _ROOT implicit hints -project(jana2 VERSION 2.4.0) +project(jana2 VERSION 2.4.0 LANGUAGES CXX) set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Enable -fPIC for all targets diff --git a/src/external/md5/CMakeLists.txt b/src/external/md5/CMakeLists.txt index ed5f3c194..59487078d 100644 --- a/src/external/md5/CMakeLists.txt +++ b/src/external/md5/CMakeLists.txt @@ -1,5 +1,5 @@ -add_library(VendoredMD5 OBJECT md5.c) +add_library(VendoredMD5 OBJECT md5.cc) target_include_directories(VendoredMD5 PUBLIC $) diff --git a/src/external/md5/md5.c b/src/external/md5/md5.cc similarity index 97% rename from src/external/md5/md5.c rename to src/external/md5/md5.cc index c35d96c5e..6c595af67 100644 --- a/src/external/md5/md5.c +++ b/src/external/md5/md5.cc @@ -52,6 +52,7 @@ */ #include "md5.h" +#include #include #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ @@ -161,14 +162,13 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) * On little-endian machines, we can process properly aligned * data without copying it. */ - if (!((data - (const md5_byte_t *)0) & 3)) { - /* data are properly aligned */ - X = (const md5_word_t *)data; - } else { - /* not aligned */ - memcpy(xbuf, data, 64); - X = xbuf; - } + if (reinterpret_cast(data) % alignof(md5_word_t) == 0) { + // data is aligned + X = reinterpret_cast(data); + } else { + memcpy(xbuf, data, 64); + X = xbuf; + } } #endif #if BYTE_ORDER == 0