From 35f7a12d7c5bd5d316167f43a5f2a4f622113ab2 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Sun, 26 Jul 2026 23:04:25 +0200 Subject: [PATCH] fix(linux): keep the mpv node builder clear of X11's Bool macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Linux native reliability job stopped compiling mpv_player.cc: the node-conversion builder exposed a leaf named `Bool`, and X11's Xlib.h — reached through epoxy/egl.h -> EGL/eglplatform.h — defines `Bool` as a macro for `int`, so the declaration was rewritten into nonsense. Renames that leaf to `Boolean` across the shared walk and all three builders. The name is the only thing that changes; no conversion behaviour differs. --- linux/runner/mpv/mpv_player.cc | 2 +- shared/mpv/mpv_player_common.h | 10 ++++++---- shared/mpv/mpv_player_common_test.cpp | 2 +- windows/runner/mpv/mpv_player.cpp | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/linux/runner/mpv/mpv_player.cc b/linux/runner/mpv/mpv_player.cc index f857e689..cc7ab232 100644 --- a/linux/runner/mpv/mpv_player.cc +++ b/linux/runner/mpv/mpv_player.cc @@ -969,7 +969,7 @@ struct FlValueNodeBuilder { using MapBuilder = FlValue*; static Value Null() { return fl_value_new_null(); } - static Value Bool(bool value) { return fl_value_new_bool(value); } + static Value Boolean(bool value) { return fl_value_new_bool(value); } static Value Int(int64_t value) { return fl_value_new_int(value); } static Value Double(double value) { return fl_value_new_float(value); } static Value String(const char* value, size_t length) { diff --git a/shared/mpv/mpv_player_common.h b/shared/mpv/mpv_player_common.h index 665e6d65..d1500eba 100644 --- a/shared/mpv/mpv_player_common.h +++ b/shared/mpv/mpv_player_common.h @@ -252,11 +252,13 @@ inline bool ClaimNodeString(const char* input, NodeConversionBudget* budget, siz // `Builder` adapts the walk to a platform value type and keeps that platform's // UTF-8 sanitizer out of this header. It supplies the types `Value`, -// `ListBuilder` and `MapBuilder`, the leaves `Null`, `Bool`, `Int`, `Double` -// and `String(data, length)`, and the containers `NewList`/`Append`/ +// `ListBuilder` and `MapBuilder`, the leaves `Null`, `Boolean`, `Int`, +// `Double` and `String(data, length)`, and the containers `NewList`/`Append`/ // `FinishList` plus `NewMap`/`Insert`/`FinishMap`. A value passed to // `Append`/`Insert` belongs to the builder from then on, and `AbandonMap` -// releases a partially built map whose key was rejected. +// releases a partially built map whose key was rejected. The boolean leaf is +// deliberately not named `Bool`: X11's `Xlib.h`, reached through `epoxy/egl.h` +// on Linux, defines `Bool` as a macro and would rewrite the declaration. template typename Builder::Value ConvertNode(const mpv_node* node, size_t depth, NodeConversionBudget* budget) { if (!node || !budget || depth >= kMaxNodeDepth || budget->remaining_entries == 0) { @@ -271,7 +273,7 @@ typename Builder::Value ConvertNode(const mpv_node* node, size_t depth, NodeConv return Builder::String(node->u.string, length); } case MPV_FORMAT_FLAG: - return Builder::Bool(node->u.flag != 0); + return Builder::Boolean(node->u.flag != 0); case MPV_FORMAT_INT64: return Builder::Int(node->u.int64); case MPV_FORMAT_DOUBLE: diff --git a/shared/mpv/mpv_player_common_test.cpp b/shared/mpv/mpv_player_common_test.cpp index 648d3e44..189b7cba 100644 --- a/shared/mpv/mpv_player_common_test.cpp +++ b/shared/mpv/mpv_player_common_test.cpp @@ -353,7 +353,7 @@ struct TextNodeBuilder { using MapBuilder = std::string; static Value Null() { return "null"; } - static Value Bool(bool value) { return value ? "true" : "false"; } + static Value Boolean(bool value) { return value ? "true" : "false"; } static Value Int(int64_t value) { return std::to_string(value); } static Value Double(double value) { return std::to_string(value); } static Value String(const char* value, size_t length) { return "'" + std::string(value, length) + "'"; } diff --git a/windows/runner/mpv/mpv_player.cpp b/windows/runner/mpv/mpv_player.cpp index bbcb464b..591999d7 100644 --- a/windows/runner/mpv/mpv_player.cpp +++ b/windows/runner/mpv/mpv_player.cpp @@ -33,7 +33,7 @@ struct EncodableNodeBuilder { using MapBuilder = flutter::EncodableMap; static Value Null() { return flutter::EncodableValue(); } - static Value Bool(bool value) { return flutter::EncodableValue(value); } + static Value Boolean(bool value) { return flutter::EncodableValue(value); } static Value Int(int64_t value) { return flutter::EncodableValue(value); } static Value Double(double value) { return flutter::EncodableValue(value); } static Value String(const char* value, size_t length) { return flutter::EncodableValue(SanitizeUtf8(value, length)); }