From d3ee655a90c99fda3b5ee386d0ee10b717fe0bc1 Mon Sep 17 00:00:00 2001 From: Evgeny Gorodetskiy Date: Sun, 26 Feb 2023 23:49:52 +0300 Subject: [PATCH] Fix Apple Clang 14 build errors (issue #588) (#589) --- src/ftxui/component/screen_interactive.cpp | 6 +++--- src/ftxui/dom/flexbox_helper.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ftxui/component/screen_interactive.cpp b/src/ftxui/component/screen_interactive.cpp index 46e2b5b..9f4eba7 100644 --- a/src/ftxui/component/screen_interactive.cpp +++ b/src/ftxui/component/screen_interactive.cpp @@ -174,9 +174,9 @@ void EventListener(std::atomic* quit, Sender out) { } const size_t buffer_size = 100; - std::array buffer; // NOLINT; - int l = read(fileno(stdin), buffer.data(), buffer_size); // NOLINT - for (int i = 0; i < l; ++i) { + std::array buffer; // NOLINT; + size_t l = read(fileno(stdin), buffer.data(), buffer_size); // NOLINT + for (size_t i = 0; i < l; ++i) { parser.Add(buffer[i]); // NOLINT } } diff --git a/src/ftxui/dom/flexbox_helper.cpp b/src/ftxui/dom/flexbox_helper.cpp index f404f2c..d3b71fc 100644 --- a/src/ftxui/dom/flexbox_helper.cpp +++ b/src/ftxui/dom/flexbox_helper.cpp @@ -161,7 +161,7 @@ void SetY(Global& g, std::vector lines) { } case FlexboxConfig::AlignContent::Stretch: { - for (int i = ys.size() - 1; i >= 0; --i) { // NOLINT + for (int i = static_cast(ys.size()) - 1; i >= 0; --i) { // NOLINT const int shifted = remaining_space * (i + 0) / (i + 1); ys[i] += shifted; const int consumed = remaining_space - shifted; @@ -172,7 +172,7 @@ void SetY(Global& g, std::vector lines) { } case FlexboxConfig::AlignContent::SpaceBetween: { - for (int i = ys.size() - 1; i >= 1; --i) { // NOLINT + for (int i = static_cast(ys.size()) - 1; i >= 1; --i) { // NOLINT ys[i] += remaining_space; remaining_space = remaining_space * (i - 1) / i; } @@ -180,7 +180,7 @@ void SetY(Global& g, std::vector lines) { } case FlexboxConfig::AlignContent::SpaceAround: { - for (int i = ys.size() - 1; i >= 0; --i) { // NOLINT + for (int i = static_cast(ys.size()) - 1; i >= 0; --i) { // NOLINT ys[i] += remaining_space * (2 * i + 1) / (2 * i + 2); remaining_space = remaining_space * (2 * i) / (2 * i + 2); } @@ -188,7 +188,7 @@ void SetY(Global& g, std::vector lines) { } case FlexboxConfig::AlignContent::SpaceEvenly: { - for (int i = ys.size() - 1; i >= 0; --i) { // NOLINT + for (int i = static_cast(ys.size()) - 1; i >= 0; --i) { // NOLINT ys[i] += remaining_space * (i + 1) / (i + 2); remaining_space = remaining_space * (i + 1) / (i + 2); }