kicad/fix_bad_cast_boost_1_86.patch

48 lines
1.4 KiB
Diff
Raw Normal View History

From 9fdd825681fb5c639470f8a68f1bf4cf73cc5cd1 Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@gmail.com>
Date: Sat, 7 Sep 2024 16:13:42 +0100
Subject: [PATCH] KIID: Use Boost uuids own hash function (fix Boost 1.86)
Not only is this simpler, but it should be compatible
with all Boost versions (the cast is a problem in 1.86)
and it was also 'improved' in 1.86 for better mixing.
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18651
(cherry picked from commit 9a3ebfba404e43d82b5c194e01f6afb67909bf88)
---
common/kiid.cpp | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/common/kiid.cpp b/common/kiid.cpp
index 80aea3e55da..81266cbd226 100644
--- a/common/kiid.cpp
+++ b/common/kiid.cpp
@@ -28,7 +28,6 @@
#include <boost/random/mersenne_twister.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
-#include <boost/functional/hash.hpp>
#if BOOST_VERSION >= 106700
#include <boost/uuid/entropy_error.hpp>
@@ -236,15 +235,7 @@ timestamp_t KIID::AsLegacyTimestamp() const
size_t KIID::Hash() const
{
- size_t hash = 0;
-
- // Note: this is NOT little-endian/big-endian safe, but as long as it's just used
- // at runtime it won't matter.
-
- for( int i = 0; i < 4; ++i )
- boost::hash_combine( hash, reinterpret_cast<const uint32_t*>( m_uuid.data )[i] );
-
- return hash;
+ return boost::uuids::hash_value( m_uuid );
}
--
GitLab