diff --git a/VERSION b/VERSION index 100435b..ee94dd8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.2 +0.8.3 diff --git a/debian/changelog b/debian/changelog index efafd3f..debe3e2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,11 @@ -hyprutils (0.8.2-1) unstable; urgency=medium +hyprutils (0.8.3-1) unstable; urgency=medium [ Carl Keinath ] - * New upstream version 0.8.2. + * New upstream version 0.8.3. * Breaking ABI changes: updated soversion to 7. * Added autopkgtests to run upstream tests. - * Added upstream signing-key. - - -- Alan M Varghese (NyxTrail) Sun, 03 Aug 2025 09:42:26 +0200 + + -- Alan M Varghese (NyxTrail) Sat, 23 Aug 2025 00:31:10 +0200 hyprutils (0.7.0-1) unstable; urgency=medium diff --git a/debian/upstream/signing-key.asc b/debian/upstream/signing-key.asc deleted file mode 100644 index 92a763f..0000000 --- a/debian/upstream/signing-key.asc +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- - -mDMEaAEKAhYJKwYBBAHaRw8BAQdA0jcIjjszUVXbYrI09s73NVDUJWpyy4FwIKah -lo3R7VC0F1ZheHJ5IDx2YXhyeUB2YXhyeS5uZXQ+iJkEExYKAEEWIQTiakoquWdv -VBSfjqpmWAY4CHHWQAUCaAEKAgIbAwUJAeEzgAULCQgHAgIiAgYVCgkICwIEFgID -AQIeBwIXgAAKCRBmWAY4CHHWQNgzAQD0rfPNY85dp07PDQxA/Et9Tau5YfjUomMr -hKrngxNr0AD/WFZNUQVK6OBfDSG8cXDyompOdu8s82SuwUXHQ6HyNgS4OARoAQoC -EgorBgEEAZdVAQUBAQdA5nZLWUoLdG3Y5TCWxopWbveBREiefaK+co2bLCZUVAYD -AQgHiH4EGBYKACYWIQTiakoquWdvVBSfjqpmWAY4CHHWQAUCaAEKAgIbDAUJAeEz -gAAKCRBmWAY4CHHWQF13AQCddVwYoD7pnqaUUnx7lSck8YpPfJ/TS2DqFp8g1etV -nwEA8CMv+uDMdIk4TaPQY2jAgKBH2kE9x8FYBZcQoqhK6gQ= -=WUHf ------END PGP PUBLIC KEY BLOCK----- diff --git a/include/hyprutils/math/Edges.hpp b/include/hyprutils/math/Edges.hpp index a1eaef9..8161be5 100644 --- a/include/hyprutils/math/Edges.hpp +++ b/include/hyprutils/math/Edges.hpp @@ -1,4 +1,6 @@ #pragma once +#include "hyprutils/memory/Casts.hpp" + #include namespace Hyprutils::Math { @@ -18,7 +20,7 @@ namespace Hyprutils::Math { CEdges() = default; CEdges(eEdges edges) : m_edges(edges) {} - CEdges(uint8_t edges) : m_edges(static_cast(edges)) {} + CEdges(uint8_t edges) : m_edges(Memory::sc(edges)) {} bool operator==(const CEdges& other) { return m_edges == other.m_edges; @@ -80,28 +82,28 @@ namespace Hyprutils::Math { * @param top The state the top edge should be set to. */ void setTop(bool top) { - m_edges = static_cast((m_edges & ~TOP) | (TOP * top)); + m_edges = Memory::sc((m_edges & ~TOP) | (TOP * top)); } /** * @param left The state the left edge should be set to. */ void setLeft(bool left) { - m_edges = static_cast((m_edges & ~LEFT) | (LEFT * left)); + m_edges = Memory::sc((m_edges & ~LEFT) | (LEFT * left)); } /** * @param bottom The state the bottom edge should be set to. */ void setBottom(bool bottom) { - m_edges = static_cast((m_edges & ~BOTTOM) | (BOTTOM * bottom)); + m_edges = Memory::sc((m_edges & ~BOTTOM) | (BOTTOM * bottom)); } /** * @param right The state the right edge should be set to. */ void setRight(bool right) { - m_edges = static_cast((m_edges & ~RIGHT) | (RIGHT * right)); + m_edges = Memory::sc((m_edges & ~RIGHT) | (RIGHT * right)); } eEdges m_edges = NONE; diff --git a/include/hyprutils/memory/Atomic.hpp b/include/hyprutils/memory/Atomic.hpp index 8d6da7d..77505a9 100644 --- a/include/hyprutils/memory/Atomic.hpp +++ b/include/hyprutils/memory/Atomic.hpp @@ -83,9 +83,7 @@ namespace Hyprutils::Memory { std::swap(m_ptr, ref.m_ptr); } - CAtomicSharedPointer() noexcept { - ; // empty - } + CAtomicSharedPointer() noexcept = default; CAtomicSharedPointer(std::nullptr_t) noexcept { ; // empty @@ -143,7 +141,7 @@ namespace Hyprutils::Memory { // -> must unlock BEFORE reset // not last ref? // -> must unlock AFTER reset - auto& mutex = ((Atomic_::impl*)m_ptr.impl_)->getMutex(); + auto& mutex = sc*>(m_ptr.impl_)->getMutex(); mutex.lock(); if (m_ptr.impl_->ref() > 1) { @@ -208,7 +206,7 @@ namespace Hyprutils::Memory { private: std::lock_guard implLockGuard() const { - return ((Atomic_::impl*)m_ptr.impl_)->lockGuard(); + return sc*>(m_ptr.impl_)->lockGuard(); } CSharedPointer m_ptr; @@ -262,9 +260,7 @@ namespace Hyprutils::Memory { m_ptr = ref.m_ptr; } - CAtomicWeakPointer() noexcept { - ; // empty - } + CAtomicWeakPointer() noexcept = default; CAtomicWeakPointer(std::nullptr_t) noexcept { ; // empty @@ -316,7 +312,7 @@ namespace Hyprutils::Memory { // -> must unlock BEFORE reset // not last ref? // -> must unlock AFTER reset - auto& mutex = ((Atomic_::impl*)m_ptr.impl_)->getMutex(); + auto& mutex = sc*>(m_ptr.impl_)->getMutex(); mutex.lock(); if (m_ptr.impl_->ref() == 0 && m_ptr.impl_->wref() == 1) { mutex.unlock(); @@ -379,7 +375,7 @@ namespace Hyprutils::Memory { private: std::lock_guard implLockGuard() const { - return ((Atomic_::impl*)m_ptr.impl_)->lockGuard(); + return sc*>(m_ptr.impl_)->lockGuard(); } CWeakPointer m_ptr; diff --git a/include/hyprutils/memory/Casts.hpp b/include/hyprutils/memory/Casts.hpp new file mode 100644 index 0000000..a40af73 --- /dev/null +++ b/include/hyprutils/memory/Casts.hpp @@ -0,0 +1,31 @@ +#pragma once +#include +#include +namespace Hyprutils::Memory { + template + constexpr To sc(From&& from) noexcept { + return static_cast(std::forward(from)); + } + + template + constexpr To cc(From&& from) noexcept { + return const_cast(std::forward(from)); + } + + template + constexpr To rc(From&& from) noexcept { + return reinterpret_cast(std::forward(from)); + } + + template + constexpr To dc(From&& from) { + return dynamic_cast(std::forward(from)); + } + + template + constexpr To bc(const From& from) noexcept { + return std::bit_cast(from); + } +} + + diff --git a/include/hyprutils/memory/SharedPtr.hpp b/include/hyprutils/memory/SharedPtr.hpp index b86dfb2..3b1b3ca 100644 --- a/include/hyprutils/memory/SharedPtr.hpp +++ b/include/hyprutils/memory/SharedPtr.hpp @@ -2,6 +2,7 @@ #include #include "ImplBase.hpp" +#include "Casts.hpp" /* This is a custom impl of std::shared_ptr. @@ -60,9 +61,7 @@ namespace Hyprutils { } /* creates an empty shared pointer with no implementation */ - CSharedPointer() noexcept { - ; // empty - } + CSharedPointer() noexcept = default; /* creates an empty shared pointer with no implementation */ CSharedPointer(std::nullptr_t) noexcept { @@ -114,11 +113,11 @@ namespace Hyprutils { } bool operator()(const CSharedPointer& lhs, const CSharedPointer& rhs) const { - return reinterpret_cast(lhs.impl_) < reinterpret_cast(rhs.impl_); + return rc(lhs.impl_) < rc(rhs.impl_); } bool operator<(const CSharedPointer& rhs) const { - return reinterpret_cast(impl_) < reinterpret_cast(rhs.impl_); + return rc(impl_) < rc(rhs.impl_); } T* operator->() const { @@ -135,7 +134,7 @@ namespace Hyprutils { } T* get() const { - return impl_ ? static_cast(impl_->getData()) : nullptr; + return impl_ ? sc(impl_->getData()) : nullptr; } unsigned int strongRef() const { @@ -183,7 +182,7 @@ namespace Hyprutils { }; template - static CSharedPointer makeShared(Args&&... args) { + [[nodiscard]] inline CSharedPointer makeShared(Args&&... args) { return CSharedPointer(new U(std::forward(args)...)); } diff --git a/include/hyprutils/memory/UniquePtr.hpp b/include/hyprutils/memory/UniquePtr.hpp index 8588560..4d95934 100644 --- a/include/hyprutils/memory/UniquePtr.hpp +++ b/include/hyprutils/memory/UniquePtr.hpp @@ -1,6 +1,7 @@ #pragma once #include "ImplBase.hpp" +#include "Casts.hpp" /* This is a custom impl of std::unique_ptr. @@ -41,9 +42,7 @@ namespace Hyprutils { } /* creates an empty unique pointer with no implementation */ - CUniquePointer() noexcept { - ; // empty - } + CUniquePointer() noexcept = default; /* creates an empty unique pointer with no implementation */ CUniquePointer(std::nullptr_t) noexcept { @@ -74,7 +73,7 @@ namespace Hyprutils { } bool operator()(const CUniquePointer& lhs, const CUniquePointer& rhs) const { - return reinterpret_cast(lhs.impl_) < reinterpret_cast(rhs.impl_); + return rc(lhs.impl_) < rc(rhs.impl_); } T* operator->() const { @@ -91,7 +90,7 @@ namespace Hyprutils { } T* get() const { - return impl_ ? static_cast(impl_->getData()) : nullptr; + return impl_ ? sc(impl_->getData()) : nullptr; } Impl_::impl_base* impl_ = nullptr; @@ -135,7 +134,7 @@ namespace Hyprutils { }; template - static CUniquePointer makeUnique(Args&&... args) { + [[nodiscard]] inline CUniquePointer makeUnique(Args&&... args) { return CUniquePointer(new U(std::forward(args)...)); } } @@ -146,4 +145,4 @@ struct std::hash> { std::size_t operator()(const Hyprutils::Memory::CUniquePointer& p) const noexcept { return std::hash{}(p.impl_); } -}; \ No newline at end of file +}; diff --git a/include/hyprutils/memory/WeakPtr.hpp b/include/hyprutils/memory/WeakPtr.hpp index 023bf78..35d3ac6 100644 --- a/include/hyprutils/memory/WeakPtr.hpp +++ b/include/hyprutils/memory/WeakPtr.hpp @@ -2,6 +2,7 @@ #include "./SharedPtr.hpp" #include "./UniquePtr.hpp" +#include "./Casts.hpp" /* This is a Hyprland implementation of std::weak_ptr. @@ -91,7 +92,7 @@ namespace Hyprutils { /* create a weak ptr from a shared ptr with assignment */ template validHierarchy&> operator=(const CSharedPointer& rhs) { - if (reinterpret_cast(impl_) == reinterpret_cast(rhs.impl_)) + if (rc(impl_) == rc(rhs.impl_)) return *this; decrementWeak(); @@ -101,9 +102,7 @@ namespace Hyprutils { } /* create an empty weak ptr */ - CWeakPointer() { - ; - } + CWeakPointer() noexcept = default; ~CWeakPointer() { decrementWeak(); @@ -162,15 +161,15 @@ namespace Hyprutils { } bool operator()(const CWeakPointer& lhs, const CWeakPointer& rhs) const { - return reinterpret_cast(lhs.impl_) < reinterpret_cast(rhs.impl_); + return rc(lhs.impl_) < rc(rhs.impl_); } bool operator<(const CWeakPointer& rhs) const { - return reinterpret_cast(impl_) < reinterpret_cast(rhs.impl_); + return rc(impl_) < rc(rhs.impl_); } T* get() const { - return impl_ ? static_cast(impl_->getData()) : nullptr; + return impl_ ? sc(impl_->getData()) : nullptr; } T* operator->() const { diff --git a/include/hyprutils/signal/Signal.hpp b/include/hyprutils/signal/Signal.hpp index 37a12ba..425c36f 100644 --- a/include/hyprutils/signal/Signal.hpp +++ b/include/hyprutils/signal/Signal.hpp @@ -37,7 +37,7 @@ namespace Hyprutils { if constexpr (sizeof...(Args) == 1) // NOLINTNEXTLINE: const is reapplied by handler invocation if required - emitInternal(const_cast(static_cast(&std::get<0>(argsTuple)))); + emitInternal(Memory::cc(Memory::sc(&std::get<0>(argsTuple)))); else emitInternal(&argsTuple); } @@ -94,9 +94,9 @@ namespace Hyprutils { if constexpr (sizeof...(Args) == 0) handler(); else if constexpr (sizeof...(Args) == 1) - handler(*static_cast...>>>*>(args)); + handler(*Memory::sc...>>>*>(args)); else - std::apply(handler, *static_cast...>*>(args)); + std::apply(handler, *Memory::sc...>*>(args)); }; } }; diff --git a/src/animation/BezierCurve.cpp b/src/animation/BezierCurve.cpp index 5b05d2f..005d7a8 100644 --- a/src/animation/BezierCurve.cpp +++ b/src/animation/BezierCurve.cpp @@ -1,10 +1,12 @@ #include +#include #include #include using namespace Hyprutils::Animation; using namespace Hyprutils::Math; +using namespace Hyprutils::Memory; void CBezierCurve::setup(const std::array& pVec) { // Avoid reallocations by reserving enough memory upfront @@ -21,7 +23,7 @@ void CBezierCurve::setup(const std::array& pVec) { // bake BAKEDPOINTS points for faster lookups // T -> X ( / BAKEDPOINTS ) for (int i = 0; i < BAKEDPOINTS; ++i) { - float const t = (i + 1) / (float)BAKEDPOINTS; + float const t = (i + 1) / sc(BAKEDPOINTS); m_aPointsBaked[i] = Vector2D(getXForT(t), getYForT(t)); } diff --git a/src/math/Mat3x3.cpp b/src/math/Mat3x3.cpp index a889f3b..b91cf1e 100644 --- a/src/math/Mat3x3.cpp +++ b/src/math/Mat3x3.cpp @@ -1,11 +1,13 @@ #include #include #include +#include #include #include #include using namespace Hyprutils::Math; +using namespace Hyprutils::Memory; static std::unordered_map transforms = { {HYPRUTILS_TRANSFORM_NORMAL, std::array{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}}, @@ -98,7 +100,7 @@ Mat3x3& Mat3x3::rotate(float rot) { } Mat3x3& Mat3x3::scale(const Vector2D& scale_) { - multiply(std::array{(float)scale_.x, 0.0f, 0.0f, 0.0f, (float)scale_.y, 0.0f, 0.0f, 0.0f, 1.0f}); + multiply(std::array{sc(scale_.x), 0.0f, 0.0f, 0.0f, sc(scale_.y), 0.0f, 0.0f, 0.0f, 1.0f}); return *this; } @@ -107,7 +109,7 @@ Mat3x3& Mat3x3::scale(const float scale_) { } Mat3x3& Mat3x3::translate(const Vector2D& offset) { - multiply(std::array{1.0f, 0.0f, (float)offset.x, 0.0f, 1.0f, (float)offset.y, 0.0f, 0.0f, 1.0f}); + multiply(std::array{1.0f, 0.0f, sc(offset.x), 0.0f, 1.0f, sc(offset.y), 0.0f, 0.0f, 1.0f}); return *this; } diff --git a/src/math/Region.cpp b/src/math/Region.cpp index f05cfb0..5f9d1a6 100644 --- a/src/math/Region.cpp +++ b/src/math/Region.cpp @@ -1,7 +1,9 @@ +#include "hyprutils/memory/Casts.hpp" #include #include using namespace Hyprutils::Math; +using namespace Hyprutils::Memory; constexpr const int64_t MAX_REGION_SIDE = 10000000; @@ -86,7 +88,7 @@ CRegion& Hyprutils::Math::CRegion::invert(pixman_box32_t* box) { } CRegion& Hyprutils::Math::CRegion::invert(const CBox& box) { - pixman_box32 pixmanBox = {.x1 = (int32_t)box.x, .y1 = (int32_t)box.y, .x2 = (int32_t)box.w + (int32_t)box.x, .y2 = (int32_t)box.h + (int32_t)box.y}; + pixman_box32 pixmanBox = {.x1 = sc(box.x), .y1 = sc(box.y), .x2 = sc(box.w) + sc(box.x), .y2 = sc(box.h) + sc(box.y)}; return this->invert(&pixmanBox); } @@ -104,7 +106,7 @@ CRegion& Hyprutils::Math::CRegion::transform(const eTransform t, double w, doubl clear(); for (auto& r : rects) { - CBox xfmd{(double)r.x1, (double)r.y1, (double)r.x2 - r.x1, (double)r.y2 - r.y1}; + CBox xfmd{r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1}; xfmd.transform(t, w, h); add(xfmd); } @@ -118,7 +120,7 @@ CRegion& Hyprutils::Math::CRegion::expand(double units) { clear(); for (auto& r : rects) { - CBox b{(double)r.x1 - units, (double)r.y1 - units, (double)r.x2 - r.x1 + (units * 2), (double)r.y2 - r.y1 + (units * 2)}; + CBox b{sc(r.x1) - units, sc(r.y1) - units, sc(r.x2) - r.x1 + (units * 2), sc(r.y2) - r.y1 + (units * 2)}; add(b); } @@ -171,7 +173,7 @@ std::vector Hyprutils::Math::CRegion::getRects() const { CBox Hyprutils::Math::CRegion::getExtents() { pixman_box32_t* box = pixman_region32_extents(&m_rRegion); - return {(double)box->x1, (double)box->y1, (double)box->x2 - box->x1, (double)box->y2 - box->y1}; + return {sc(box->x1), sc(box->y1), sc(box->x2) - box->x1, sc(box->y2) - box->y1}; } bool Hyprutils::Math::CRegion::containsPoint(const Vector2D& vec) const { diff --git a/src/math/Vector2D.cpp b/src/math/Vector2D.cpp index 6957154..99f93d2 100644 --- a/src/math/Vector2D.cpp +++ b/src/math/Vector2D.cpp @@ -1,15 +1,17 @@ #include +#include #include #include #include using namespace Hyprutils::Math; +using namespace Hyprutils::Memory; Hyprutils::Math::Vector2D::Vector2D(double xx, double yy) : x(xx), y(yy) { ; } -Hyprutils::Math::Vector2D::Vector2D(int xx, int yy) : x((double)xx), y((double)yy) { +Hyprutils::Math::Vector2D::Vector2D(int xx, int yy) : x(sc(xx)), y(sc(yy)) { ; } @@ -59,23 +61,14 @@ Vector2D Hyprutils::Math::Vector2D::getComponentMax(const Vector2D& other) const Vector2D Hyprutils::Math::Vector2D::transform(eTransform transform, const Vector2D& monitorSize) const { switch (transform) { - case HYPRUTILS_TRANSFORM_NORMAL: - return *this; - case HYPRUTILS_TRANSFORM_90: - return Vector2D(y, monitorSize.y - x); - case HYPRUTILS_TRANSFORM_180: - return Vector2D(monitorSize.x - x, monitorSize.y - y); - case HYPRUTILS_TRANSFORM_270: - return Vector2D(monitorSize.x - y, x); - case HYPRUTILS_TRANSFORM_FLIPPED: - return Vector2D(monitorSize.x - x, y); - case HYPRUTILS_TRANSFORM_FLIPPED_90: - return Vector2D(y, x); - case HYPRUTILS_TRANSFORM_FLIPPED_180: - return Vector2D(x, monitorSize.y - y); - case HYPRUTILS_TRANSFORM_FLIPPED_270: - return Vector2D(monitorSize.x - y, monitorSize.y - x); - default: - return *this; + case HYPRUTILS_TRANSFORM_NORMAL: return *this; + case HYPRUTILS_TRANSFORM_90: return Vector2D(y, monitorSize.y - x); + case HYPRUTILS_TRANSFORM_180: return Vector2D(monitorSize.x - x, monitorSize.y - y); + case HYPRUTILS_TRANSFORM_270: return Vector2D(monitorSize.x - y, x); + case HYPRUTILS_TRANSFORM_FLIPPED: return Vector2D(monitorSize.x - x, y); + case HYPRUTILS_TRANSFORM_FLIPPED_90: return Vector2D(y, x); + case HYPRUTILS_TRANSFORM_FLIPPED_180: return Vector2D(x, monitorSize.y - y); + case HYPRUTILS_TRANSFORM_FLIPPED_270: return Vector2D(monitorSize.x - y, monitorSize.y - x); + default: return *this; } } diff --git a/src/os/Process.cpp b/src/os/Process.cpp index cd6a758..3982b62 100644 --- a/src/os/Process.cpp +++ b/src/os/Process.cpp @@ -1,5 +1,7 @@ #include +#include using namespace Hyprutils::OS; +using namespace Hyprutils::Memory; #include #include @@ -61,7 +63,7 @@ bool Hyprutils::OS::CProcess::runSync() { dup2(errPipe[1], 2 /* stderr */); // build argv - std::vector argsC; + std::vector argsC; argsC.emplace_back(strdup(m_impl->binary.c_str())); for (auto& arg : m_impl->args) { // TODO: does this leak? Can we just pipe c_str() as the strings won't be realloc'd? @@ -75,7 +77,7 @@ bool Hyprutils::OS::CProcess::runSync() { setenv(n.c_str(), v.c_str(), 1); } - execvp(m_impl->binary.c_str(), (char* const*)argsC.data()); + execvp(m_impl->binary.c_str(), argsC.data()); exit(1); } else { // parent @@ -129,7 +131,7 @@ bool Hyprutils::OS::CProcess::runSync() { if (pollfds[0].revents & POLLIN) { while ((ret = read(outPipe[0], buf.data(), 1023)) > 0) { - m_impl->out += std::string_view{(char*)buf.data(), (size_t)ret}; + m_impl->out += std::string_view{buf.data(), sc(ret)}; } buf.fill(0); @@ -137,7 +139,7 @@ bool Hyprutils::OS::CProcess::runSync() { if (pollfds[1].revents & POLLIN) { while ((ret = read(errPipe[0], buf.data(), 1023)) > 0) { - m_impl->err += std::string_view{(char*)buf.data(), (size_t)ret}; + m_impl->err += std::string_view{buf.data(), sc(ret)}; } buf.fill(0); @@ -146,13 +148,13 @@ bool Hyprutils::OS::CProcess::runSync() { // Final reads. Nonblock, so its ok. while ((ret = read(outPipe[0], buf.data(), 1023)) > 0) { - m_impl->out += std::string_view{(char*)buf.data(), (size_t)ret}; + m_impl->out += std::string_view{buf.data(), sc(ret)}; } buf.fill(0); while ((ret = read(errPipe[0], buf.data(), 1023)) > 0) { - m_impl->err += std::string_view{(char*)buf.data(), (size_t)ret}; + m_impl->err += std::string_view{buf.data(), sc(ret)}; } buf.fill(0); @@ -198,7 +200,7 @@ bool Hyprutils::OS::CProcess::runAsync() { close(socket[0]); close(socket[1]); // build argv - std::vector argsC; + std::vector argsC; argsC.emplace_back(strdup(m_impl->binary.c_str())); for (auto& arg : m_impl->args) { argsC.emplace_back(strdup(arg.c_str())); @@ -216,7 +218,7 @@ bool Hyprutils::OS::CProcess::runAsync() { if (m_impl->stderrFD != -1) dup2(m_impl->stderrFD, 2); - execvp(m_impl->binary.c_str(), (char* const*)argsC.data()); + execvp(m_impl->binary.c_str(), argsC.data()); _exit(0); } close(socket[0]); diff --git a/src/signal/Listener.cpp b/src/signal/Listener.cpp index da49943..6d1746d 100644 --- a/src/signal/Listener.cpp +++ b/src/signal/Listener.cpp @@ -16,5 +16,5 @@ void Hyprutils::Signal::CSignalListener::emitInternal(void* data) { void Hyprutils::Signal::CSignalListener::emit(std::any data) { auto dataTuple = std::tuple(data); - emitInternal(static_cast(&dataTuple)); + emitInternal(&dataTuple); } diff --git a/tests/animation.cpp b/tests/animation.cpp index 112f379..9dbcf84 100644 --- a/tests/animation.cpp +++ b/tests/animation.cpp @@ -62,7 +62,7 @@ class CMyAnimationManager : public CAnimationManager { switch (PAV->m_Type) { case eAVTypes::INT: { - auto avInt = dynamic_cast*>(PAV.get()); + auto avInt = dc*>(PAV.get()); if (!avInt) std::cout << Colors::RED << "Dynamic cast upcast failed" << Colors::RESET; @@ -70,7 +70,7 @@ class CMyAnimationManager : public CAnimationManager { avInt->value() = avInt->begun() + (DELTA * POINTY); } break; case eAVTypes::TEST: { - auto avCustom = dynamic_cast*>(PAV.get()); + auto avCustom = dc*>(PAV.get()); if (!avCustom) std::cout << Colors::RED << "Dynamic cast upcast failed" << Colors::RESET; @@ -93,7 +93,7 @@ class CMyAnimationManager : public CAnimationManager { constexpr const eAVTypes EAVTYPE = std::is_same_v ? eAVTypes::INT : eAVTypes::TEST; const auto PAV = makeShared>(); - PAV->create(EAVTYPE, static_cast(this), PAV, v); + PAV->create(EAVTYPE, sc(this), PAV, v); PAV->setConfig(animationTree.getConfig(animationConfigName)); av = std::move(PAV); } @@ -348,7 +348,7 @@ int main(int argc, char** argv, char** envp) { *s.m_iA = 5; s.m_iA->setCallbackOnEnd([&endCallbackRan](WP v) { endCallbackRan++; - const auto PAV = dynamic_cast*>(v.lock().get()); + const auto PAV = dc*>(v.lock().get()); *PAV = 10; PAV->setCallbackOnEnd([&endCallbackRan](WP v) { endCallbackRan++; });