From 505b3fc6cfbed95a4101c9a9c75a76645eb6fb6b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 17 Feb 2021 11:34:47 -0700 Subject: [PATCH] [harfbuzz.cc] Fix OffsetTable name clash with Mac headers There's no easy way to undo a "using namespace" in our sources, so by the time we get to include hb-coretext.cc from harfbuzz.cc, we already have "using namespace OT" active, which clashes with Mac headers. Error was: $ gcc -O3 -Wall -arch i386 -DHAVE_CORETEXT=1 -c harfbuzz.cc -o harfbuzz.o -std=c++11 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/TextUtils.h:288:3: error: reference to 'OffsetTable' is ambiguous OffsetTable offsets, ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/IntlResources.h:115:41: note: candidate found by name lookup is 'OffsetTable' typedef OffPair OffsetTable[3]; ^ ./hb-open-file.hh:81:16: note: candidate found by name lookup is 'OT::OffsetTable' typedef struct OffsetTable ^ 1 error generated. --- src/hb-open-file.hh | 6 +++--- src/hb-ot-head-table.hh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh index ac13dd23c..54c07ff13 100644 --- a/src/hb-open-file.hh +++ b/src/hb-open-file.hh @@ -48,7 +48,7 @@ namespace OT { */ struct OpenTypeFontFile; -struct OffsetTable; +struct OpenTypeOffsetTable; struct TTCHeader; @@ -78,7 +78,7 @@ typedef struct TableRecord DEFINE_SIZE_STATIC (16); } OpenTypeTable; -typedef struct OffsetTable +typedef struct OpenTypeOffsetTable { friend struct OpenTypeFontFile; @@ -218,7 +218,7 @@ struct TTCHeaderVersion1 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ FixedVersion<>version; /* Version of the TTC Header (1.0), * 0x00010000u */ - LArrayOf> + LArrayOf> table; /* Array of offsets to the OffsetTable for each font * from the beginning of the file */ public: diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh index 5613a96db..ac588e3af 100644 --- a/src/hb-ot-head-table.hh +++ b/src/hb-ot-head-table.hh @@ -43,7 +43,7 @@ namespace OT { struct head { - friend struct OffsetTable; + friend struct OpenTypeOffsetTable; static constexpr hb_tag_t tableTag = HB_OT_TAG_head;