]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
src/include/uuid.h: fix for boost 1.86.0
authorLuc Ritchie <luc.ritchie@gmail.com>
Fri, 6 Sep 2024 23:17:53 +0000 (19:17 -0400)
committerLuc Ritchie <luc.ritchie@gmail.com>
Fri, 6 Sep 2024 23:30:32 +0000 (19:30 -0400)
Boost 1.86.0 includes a significant rewrite of the UUID library. The
Changelog[^1] notes that:

> u.data(), where u is of type uuid, now returns a pointer to the first
> uint8_t of the representation (same as u.begin().) For backward
> compatibility, data is a function object with operator(), rather than
> a member function, which allows most existing uses of data as a
> public member to remain valid, if no longer encouraged.

I don't know enough about C++ to judge how that should have worked, but
it leads to a compile error here. This patch uses BOOST_VERSION to
decide whether to access .data as a member or .data() as a function.

[^1]: https://www.boost.org/doc/libs/1_86_0/libs/uuid/doc/html/uuid.html#changes

Signed-off-by: Luc Ritchie <luc.ritchie@gmail.com>
src/include/uuid.h

index f6ef9878daee729220409c9f3ed24261adaf9b4f..a5d63c372977aed556f5babb70068e3e3689891c 100644 (file)
@@ -60,7 +60,11 @@ struct uuid_d {
   }
 
   const char *bytes() const {
+#if BOOST_VERSION >= 108600
+    return (const char*)uuid.data();
+#else
     return (const char*)uuid.data;
+#endif
   }
 
   void encode(::ceph::buffer::list::contiguous_appender& p) const {