summaryrefslogtreecommitdiff
path: root/gui-wm/hyprland/files/hyprland-9999-gcc15-compile-fix.patch
blob: 62a688f1e9eae67a1e8829f41b1590d616d1050a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
commit 5fdbbae4a6d51860b0b4766769132c7f0f50461a
Author: Anthony Ruhier <aruhier@mailbox.org>
Date:   Thu Sep 17 12:38:29 2026 +0200

    Fixes compatibility with GCC < 16
---
 src/helpers/MiscFunctions.cpp | 11 ++++++++++-
 src/ipc/s1/S1.cpp             |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index 299d2199..a81e78f1 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -474,7 +474,16 @@ bool truthy(const std::string& str) {
     });
 
     return [&](auto&&... prefixes) -> bool {
-        return (... || std::ranges::starts_with(str_view, prefixes));
+        auto starts_with = [](auto&& range, std::string_view prefix) {
+            auto it = std::ranges::begin(range);
+            auto end = std::ranges::end(range);
+            for (char c : prefix) {
+                if (it == end || *it != c) return false;
+                ++it;
+            }
+            return true;
+        };
+        return (... || starts_with(str_view, prefixes));
     }("true"sv, "yes"sv, "on"sv);
     // clang-format on
 }
diff --git a/src/ipc/s1/S1.cpp b/src/ipc/s1/S1.cpp
index 76f2e9b5..6c0bed5d 100644
--- a/src/ipc/s1/S1.cpp
+++ b/src/ipc/s1/S1.cpp
@@ -145,7 +145,7 @@ SResponse CSocket1::dispatchBatch(std::string request, pid_t pid) {
             if (i < request.size() && (request[i + 1] == '\\' || request[i + 1] == ';'))
                 ++i;
             else
-                LOG(Log::ERR, "Malformed socket1 request: invalid escape sequence {} at position {}, using it verbatim", request.subview(i, 2), i);
+                LOG(Log::ERR, "Malformed socket1 request: invalid escape sequence {} at position {}, using it verbatim", request.substr(i, 2), i);
         }
         parsedCommand << request[i];
     }