Go to file
Tom Englund 7e1b6610a2
memory: avoid undefined behaviour from downcasting ptr implentation (#5)
* sharedptr: dont downcast ptr implentation

avoid runtime errors of wrong downcasts by adding a underlaying ptr data
getter and only cast the data, downcasting the implentation type isnt
inherited from eachother, while the intention was do upcast/downcast
a derived class to a base class. found with UBSAN "runtime error:
downcast of address which does not point to an object of type
"CSharedPointer_::impl<IKeyboard>" note: object is of type
"Hyprutils::Memory::CSharedPointer_::impl<CKeyboard>"

also make dataNonNull check against != nullptr.

* sharedptr: use reinterpret_cast instead of c style

make it more type safe, C style casts tries every single one until one
works, or not. compilers also produces better warnings/errors when using
c++ casts in favour of C style ones.
2024-06-28 18:49:58 +02:00
.github/workflows ci: add pixman to dependencies 2024-06-18 23:36:10 +02:00
include/hyprutils memory: avoid undefined behaviour from downcasting ptr implentation (#5) 2024-06-28 18:49:58 +02:00
nix Nix: add pixman dep 2024-06-19 09:12:49 +03:00
src Math: Some more box improvements and test cases (#3) 2024-06-25 01:17:44 +02:00
tests Math: Some more box improvements and test cases (#3) 2024-06-25 01:17:44 +02:00
.clang-format utils: Initial Commit 2024-06-08 19:37:15 +02:00
.gitignore utils: Initial Commit 2024-06-08 19:37:15 +02:00
CMakeLists.txt cmake: bump ver to 0.1.5 2024-06-25 13:48:22 +02:00
LICENSE Initial commit 2024-06-08 18:51:36 +02:00
README.md README: Update build instructions (#4) 2024-06-25 01:18:45 +02:00
flake.lock Nix: init 2024-06-09 00:13:58 +03:00
flake.nix Nix: init 2024-06-09 00:13:58 +03:00
hyprutils.pc.in utils: Initial Commit 2024-06-08 19:37:15 +02:00

README.md

hyprutils

Hyprutils is a small C++ library for utilities used across the Hypr* ecosystem.

Stability

Hyprutils depends on the ABI stability of the stdlib implementation of your compiler. Sover bumps will be done only for hyprutils ABI breaks, not stdlib.

Building

git clone https://github.com/hyprwm/hyprutils.git
cd hyprutils/
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
sudo cmake --install build