git: 054bf3111cfe - main - x11/hypridle: avoid casting integer to string
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 29 Mar 2025 00:21:41 UTC
The branch main has been updated by jbeich:
URL: https://cgit.FreeBSD.org/ports/commit/?id=054bf3111cfe945baee5bd84f37023b1e9afb607
commit 054bf3111cfe945baee5bd84f37023b1e9afb607
Author: Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2025-03-28 21:25:49 +0000
Commit: Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2025-03-29 00:18:57 +0000
x11/hypridle: avoid casting integer to string
src/core/Hypridle.cpp:508:131: error: non-constant-expression cannot be narrowed from type 'pid_t' (aka 'int') to 'uint32_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
508 | proxy->callMethod("GetSessionByPID").onInterface("org.freedesktop.ConsoleKit.Manager").withArguments(std::string{uint32_t{getpid()}}).storeResultsTo(path);
| ^~~~~~~~
src/core/Hypridle.cpp:508:131: note: insert an explicit cast to silence this issue
508 | proxy->callMethod("GetSessionByPID").onInterface("org.freedesktop.ConsoleKit.Manager").withArguments(std::string{uint32_t{getpid()}}).storeResultsTo(path);
| ^~~~~~~~
| static_cast<uint32_t>( )
src/core/Hypridle.cpp:508:122: error: non-constant-expression cannot be narrowed from type 'uint32_t' (aka 'unsigned int') to 'char' in initializer list [-Wc++11-narrowing]
508 | proxy->callMethod("GetSessionByPID").onInterface("org.freedesktop.ConsoleKit.Manager").withArguments(std::string{uint32_t{getpid()}}).storeResultsTo(path);
| ^~~~~~~~~~~~~~~~~~
src/core/Hypridle.cpp:508:122: note: insert an explicit cast to silence this issue
508 | proxy->callMethod("GetSessionByPID").onInterface("org.freedesktop.ConsoleKit.Manager").withArguments(std::string{uint32_t{getpid()}}).storeResultsTo(path);
| ^~~~~~~~~~~~~~~~~~
| static_cast<char>()
Exposed by -Wno-narrowing removal in v0.1.6.
---
x11/hypridle/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/x11/hypridle/Makefile b/x11/hypridle/Makefile
index f57788955fd0..39b92b10eb29 100644
--- a/x11/hypridle/Makefile
+++ b/x11/hypridle/Makefile
@@ -1,7 +1,7 @@
PORTNAME= hypridle
DISTVERSIONPREFIX= v
DISTVERSION= 0.1.5
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= x11 wayland
MAINTAINER= jbeich@FreeBSD.org
@@ -32,7 +32,7 @@ post-patch:
-e 's,login1,ConsoleKit,' \
-e 's,logind,consolekit2,' \
-e 's,GetSession,&ByPID,' \
- -e 's,"auto",uint32_t{getpid()},' \
+ -e 's,string{"auto"},to_string(getpid()),' \
${WRKSRC}/src/core/Hypridle.cpp
.include <bsd.port.mk>