refactor: replace SInt16 with int16_t

This commit is contained in:
sithlord48
2025-01-10 19:55:14 -05:00
committed by Nick Bolton
parent ba11eba91e
commit 1ed49e7487
9 changed files with 18 additions and 19 deletions

View File

@ -36,8 +36,8 @@ void HelloBack::Deps::incompatible(int major, int minor)
void HelloBack::handleHello(deskflow::IStream *stream, const std::string &clientName) const
{
SInt16 serverMajor;
SInt16 serverMinor;
int16_t serverMajor;
int16_t serverMinor;
// as luck would have it, both "Synergy" and "Barrier" are 7 chars,
// so we eat 7 chars and then test for either protocol name.

View File

@ -45,8 +45,8 @@ public:
};
explicit HelloBack(
std::shared_ptr<Deps> deps, const SInt16 majorVersion = kProtocolMajorVersion,
const SInt16 minorVersion = kProtocolMinorVersion
std::shared_ptr<Deps> deps, const int16_t majorVersion = kProtocolMajorVersion,
const int16_t minorVersion = kProtocolMinorVersion
)
: m_deps(deps),
m_majorVersion(majorVersion),
@ -63,8 +63,8 @@ private:
bool shouldDowngrade(int major, int minor) const;
std::shared_ptr<Deps> m_deps;
SInt16 m_majorVersion;
SInt16 m_minorVersion;
int16_t m_majorVersion;
int16_t m_minorVersion;
};
} // namespace deskflow::client

View File

@ -513,7 +513,7 @@ KeyModifierMask ServerProxy::translateModifierMask(KeyModifierMask mask) const
void ServerProxy::enter()
{
// parse
SInt16 x, y;
int16_t x, y;
UInt16 mask;
UInt32 seqNum;
ProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask);
@ -678,7 +678,7 @@ void ServerProxy::mouseMove()
{
// parse
bool ignore;
SInt16 x, y;
int16_t x, y;
ProtocolUtil::readf(m_stream, kMsgDMouseMove + 4, &x, &y);
// note if we should ignore the move
@ -710,7 +710,7 @@ void ServerProxy::mouseRelativeMove()
{
// parse
bool ignore;
SInt16 dx, dy;
int16_t dx, dy;
ProtocolUtil::readf(m_stream, kMsgDMouseRelMove + 4, &dx, &dy);
// note if we should ignore the move
@ -741,7 +741,7 @@ void ServerProxy::mouseWheel()
flushCompressedMouse();
// parse
SInt16 xDelta, yDelta;
int16_t xDelta, yDelta;
ProtocolUtil::readf(m_stream, kMsgDMouseWheel + 4, &xDelta, &yDelta);
LOG((CLOG_DEBUG2 "recv mouse wheel %+d,%+d", xDelta, yDelta));

View File

@ -84,7 +84,6 @@
#if defined(__APPLE__)
#include <CoreServices/CoreServices.h>
#else
using SInt16 = signed TYPE_OF_SIZE_2;
using SInt32 = signed TYPE_OF_SIZE_4;
using UInt16 = unsigned TYPE_OF_SIZE_2;
using UInt32 = unsigned TYPE_OF_SIZE_4;

View File

@ -34,8 +34,8 @@
// 1.7 adds security input notifications
// 1.8 adds language synchronization functionality
// NOTE: with new version, deskflow minor version should increment
static const SInt16 kProtocolMajorVersion = 1;
static const SInt16 kProtocolMinorVersion = 8;
static const int16_t kProtocolMajorVersion = 1;
static const int16_t kProtocolMinorVersion = 8;
// default contact port number
static const UInt16 kDefaultPort = 24800;

View File

@ -587,7 +587,7 @@ static LRESULT CALLBACK mouseLLHook(int code, WPARAM wParam, LPARAM lParam)
SInt32 x = static_cast<SInt32>(info->pt.x);
SInt32 y = static_cast<SInt32>(info->pt.y);
SInt32 w = static_cast<SInt16>(HIWORD(info->mouseData));
SInt32 w = static_cast<int16_t>(HIWORD(info->mouseData));
// handle the message
if (mouseHookHandler(wParam, x, y, w)) {

View File

@ -390,7 +390,7 @@ void ClientProxy1_0::setOptions(const OptionsList &options)
bool ClientProxy1_0::recvInfo()
{
// parse the message
SInt16 x, y, w, h, dummy1, mx, my;
int16_t x, y, w, h, dummy1, mx, my;
if (!ProtocolUtil::readf(getStream(), kMsgDInfo + 4, &x, &y, &w, &h, &dummy1, &mx, &my)) {
return false;
}

View File

@ -231,7 +231,7 @@ void ClientProxyUnknown::handleData(const Event &, void *)
}
// parse the reply to hello
SInt16 major, minor;
int16_t major, minor;
std::string protocolName;
if (!ProtocolUtil::readf(m_stream, kMsgHelloBack, &protocolName, &major, &minor, &name)) {
throw XBadClient();

View File

@ -30,7 +30,7 @@ public:
MOCK_METHOD(void, incompatible, (int major, int minor), (override));
};
void intTo2ByteBuf(SInt16 value, std::array<char, 2> &buf)
void intTo2ByteBuf(int16_t value, std::array<char, 2> &buf)
{
buf[0] = static_cast<char>((value >> 8) & 0xFF); // MSB
buf[1] = static_cast<char>(value & 0xFF); // LSB
@ -55,7 +55,7 @@ std::string printAsHex(const char *buffer, size_t size)
}
void setupMockHelloRead(
MockStream &stream, const std::string &protocolName, const SInt16 majorVersion, const SInt16 minorVersion
MockStream &stream, const std::string &protocolName, const int16_t majorVersion, const int16_t minorVersion
)
{
@ -89,7 +89,7 @@ void setupMockHelloRead(
}
void setupMockHelloBackWrite(
MockStream &stream, const std::string &protocolName, const SInt16 majorVersion, const SInt16 minorVersion,
MockStream &stream, const std::string &protocolName, const int16_t majorVersion, const int16_t minorVersion,
const std::string &name
)
{