chore: remove unused lib/gui/byte_utils
This commit is contained in:
parent
2ef23b8206
commit
1c4ec6ec41
3 changed files with 0 additions and 65 deletions
|
|
@ -15,7 +15,6 @@ endif()
|
||||||
|
|
||||||
add_library(${target} STATIC
|
add_library(${target} STATIC
|
||||||
${platform_sources}
|
${platform_sources}
|
||||||
byte_utils.h
|
|
||||||
constants.h
|
constants.h
|
||||||
diagnostic.cpp
|
diagnostic.cpp
|
||||||
diagnostic.h
|
diagnostic.h
|
||||||
|
|
|
||||||
|
|
@ -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 <QByteArray>
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QIODevice>
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
namespace deskflow::gui {
|
|
||||||
|
|
||||||
inline int bytesToInt(const char *buffer, size_t size)
|
|
||||||
{
|
|
||||||
QByteArray byteArray(buffer, static_cast<int>(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
|
|
||||||
|
|
@ -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 <gtest/gtest.h>
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue