diff --git a/src/lib/gui/CMakeLists.txt b/src/lib/gui/CMakeLists.txt index ec36456e3..1cded67a1 100644 --- a/src/lib/gui/CMakeLists.txt +++ b/src/lib/gui/CMakeLists.txt @@ -15,7 +15,6 @@ endif() add_library(${target} STATIC ${platform_sources} - byte_utils.h constants.h diagnostic.cpp diagnostic.h diff --git a/src/lib/gui/byte_utils.h b/src/lib/gui/byte_utils.h deleted file mode 100644 index c2ce2ad33..000000000 --- a/src/lib/gui/byte_utils.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2024 Symless Ltd. - * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception - */ - -#pragma once - -#include -#include -#include -#include - -namespace deskflow::gui { - -inline int bytesToInt(const char *buffer, size_t size) -{ - QByteArray byteArray(buffer, static_cast(size)); - QDataStream stream(byteArray); - int result; - stream >> result; - return result; -} - -inline QByteArray intToBytes(int value) -{ - QByteArray bytes; - QDataStream stream(&bytes, QIODevice::WriteOnly); - stream << value; - return bytes; -} - -} // namespace deskflow::gui diff --git a/src/test/unittests/gui/byte_utils_tests.cpp b/src/test/unittests/gui/byte_utils_tests.cpp deleted file mode 100644 index 4b9851e87..000000000 --- a/src/test/unittests/gui/byte_utils_tests.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2024 Symless Ltd. - * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception - */ - -#include "gui/byte_utils.h" - -#include - -using namespace deskflow::gui; - -TEST(byte_utils_tests, bytesToInt_size4) -{ - char buffer[4] = {0x01, 0x02, 0x03, 0x04}; - - const auto i = bytesToInt(buffer, 4); - - EXPECT_EQ(i, 0x01020304); -} - -TEST(byte_utils_tests, intToBytes_size4) -{ - QByteArray bytes = intToBytes(0x01020304); - - EXPECT_EQ(bytes.size(), 4); - EXPECT_EQ(bytes[0], 0x01); - EXPECT_EQ(bytes[1], 0x02); - EXPECT_EQ(bytes[2], 0x03); - EXPECT_EQ(bytes[3], 0x04); -}