From: <sv...@op...> - 2024-05-08 06:12:52
|
Author: manx Date: Wed May 8 08:12:38 2024 New Revision: 20727 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20727 Log: [Fix] Static (internal linkage) functions in namespace scope in headers can cause ODR-violations when used by external linkage inline functions. Modified: trunk/OpenMPT/soundlib/MODTools.h Modified: trunk/OpenMPT/soundlib/MODTools.h ============================================================================== --- trunk/OpenMPT/soundlib/MODTools.h Wed May 8 08:11:05 2024 (r20726) +++ trunk/OpenMPT/soundlib/MODTools.h Wed May 8 08:12:38 2024 (r20727) @@ -79,7 +79,7 @@ using MODPatternData = std::array<std::array<std::array<uint8, 4>, 4>, 64>; // Check if header magic equals a given string. -static inline bool IsMagic(const char *magic1, const char (&magic2)[5]) noexcept +inline bool IsMagic(const char *magic1, const char (&magic2)[5]) noexcept { return std::memcmp(magic1, magic2, 4) == 0; } @@ -87,7 +87,7 @@ // For .DTM files from Apocalypse Abyss, where the first 2108 bytes are swapped template<typename T, typename TFileReader> -static T ReadAndSwap(TFileReader &file, const bool swapBytes) +inline T ReadAndSwap(TFileReader &file, const bool swapBytes) { T value; if(file.Read(value) && swapBytes) @@ -117,7 +117,7 @@ // Check if number of malformed bytes in MOD pattern data exceeds some threshold template <typename TFileReader> -static bool ValidateMODPatternData(TFileReader &file, const uint32 threshold, const bool extendedFormat) +inline bool ValidateMODPatternData(TFileReader &file, const uint32 threshold, const bool extendedFormat) { MODPatternData patternData; if(!file.Read(patternData)) |