You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/media-gfx/openvdb/files/openvdb-4.0.2-fix-const-cor...

36 lines
1.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Blosc changed the signature of blosc_compcode_to_compname in 1.15 so
that the second parameter is now const char** not char **. This causes
compile failures when using openvdb with earlier versions of blosc.
The fix, which is backported from openvdb-7, is to check the blosc
version and cast the char** to const char** for modern versions of
blosc.
The bug can be produced by emerging blosc 1.15+, and then openvdb.
Without this patch, the compiler will fail with
error: invalid conversion from char** to const char**
To test that the patch has been properly implemented, emerge modern
blosc and then openvdb with this patch, and the compile will succeed.
Fixes bug https://bugs.gentoo.org/734102
Upstream commit https://github.com/AcademySoftwareFoundation/openvdb/commit/d2e8bd87a63d1e9f66a558ecbb6e6cbd54f7de13
diff -Naur a/openvdb/unittest/TestFile.cc b/openvdb/unittest/TestFile.cc
--- a/openvdb/unittest/TestFile.cc 2020-08-19 02:11:48.945711312 +1000
+++ b/openvdb/unittest/TestFile.cc 2020-08-19 02:13:31.106074899 +1000
@@ -2666,7 +2666,12 @@
for (int compcode = 0; compcode <= BLOSC_ZLIB; ++compcode) {
char* compname = nullptr;
- if (0 > blosc_compcode_to_compname(compcode, &compname)) continue;
+#if BLOSC_VERSION_MAJOR > 1 || (BLOSC_VERSION_MAJOR == 1 && BLOSC_VERSION_MINOR >= 15)
+ if (0 > blosc_compcode_to_compname(compcode, const_cast<const char**>(&compname)))
+#else
+ if (0 > blosc_compcode_to_compname(compcode, &compname))
+#endif
+ continue;
/// @todo This changes the compressor setting globally.
if (blosc_set_compressor(compname) < 0) continue;