Skip to content

Commit

Permalink
[libheif] Fix compilation errors using gcc8 (microsoft#42869)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimwang118 authored Dec 30, 2024
1 parent 89b92ea commit 8906f18
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
33 changes: 33 additions & 0 deletions ports/libheif/fix-gcc8.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/libheif/bitstream.cc b/libheif/bitstream.cc
index 9063718..f459fcc 100644
--- a/libheif/bitstream.cc
+++ b/libheif/bitstream.cc
@@ -25,6 +25,12 @@
#include <cassert>
#include <bit>

+#if ((defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__PGI)) && __GNUC__ < 9) || (defined(__clang__) && __clang_major__ < 10)
+#include <type_traits>
+#else
+#include <bit>
+#endif
+
#define MAX_UVLC_LEADING_ZEROS 20

#define AVOID_FUZZER_FALSE_POSITIVE 0
diff --git a/libheif/codecs/uncompressed/decoder_abstract.cc b/libheif/codecs/uncompressed/decoder_abstract.cc
index bbe4692..3c9aacd 100644
--- a/libheif/codecs/uncompressed/decoder_abstract.cc
+++ b/libheif/codecs/uncompressed/decoder_abstract.cc
@@ -35,6 +35,11 @@
#include "unc_codec.h"
#include "decoder_abstract.h"

+#if ((defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__PGI)) && __GNUC__ < 9) || (defined(__clang__) && __clang_major__ < 10)
+#include <type_traits>
+#else
+#include <bit>
+#endif

AbstractDecoder::AbstractDecoder(uint32_t width, uint32_t height, const std::shared_ptr<Box_cmpd> cmpd, const std::shared_ptr<Box_uncC> uncC) :
m_width(width),
1 change: 1 addition & 0 deletions ports/libheif/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
gdk-pixbuf.patch
fix-gcc8.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
Expand Down
2 changes: 1 addition & 1 deletion ports/libheif/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "libheif",
"version": "1.19.5",
"port-version": 1,
"port-version": 2,
"description": "libheif is an HEIF and AVIF file format decoder and encoder.",
"homepage": "http://www.libheif.org/",
"license": "LGPL-3.0-only",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4658,7 +4658,7 @@
},
"libheif": {
"baseline": "1.19.5",
"port-version": 1
"port-version": 2
},
"libhsplasma": {
"baseline": "2024-03-07",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libheif.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "ecd6b2d082b2b4c294587aaabb0c53b7e1d87f5c",
"version": "1.19.5",
"port-version": 2
},
{
"git-tree": "b714664a4550bae5edc9fbe655f0ce057ac9e67e",
"version": "1.19.5",
Expand Down

0 comments on commit 8906f18

Please sign in to comment.