From 96092df4fcb30149054a4d257dd41653de60be59 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Fri, 10 Jan 2025 21:13:19 -0500 Subject: [PATCH] refactor: replace UInt32 with uint32_t --- .../MSWindowsClientTaskBarReceiver.cpp | 4 +- .../MSWindowsServerTaskBarReceiver.cpp | 4 +- src/lib/arch/IArchString.cpp | 4 +- src/lib/arch/IArchString.h | 4 +- src/lib/base/Event.h | 4 +- src/lib/base/EventQueue.cpp | 14 +-- src/lib/base/EventQueue.h | 8 +- src/lib/base/IEventQueue.h | 2 +- src/lib/base/IEventQueueBuffer.h | 4 +- src/lib/base/SimpleEventQueueBuffer.cpp | 4 +- src/lib/base/SimpleEventQueueBuffer.h | 6 +- src/lib/base/Unicode.cpp | 102 +++++++++--------- src/lib/base/Unicode.h | 20 ++-- src/lib/base/log_outputters.cpp | 2 +- src/lib/base/log_outputters.h | 4 +- src/lib/client/Client.cpp | 6 +- src/lib/client/Client.h | 6 +- src/lib/client/ServerProxy.cpp | 16 +-- src/lib/client/ServerProxy.h | 4 +- src/lib/common/basic_types.h | 1 - src/lib/deskflow/ClipboardChunk.cpp | 10 +- src/lib/deskflow/ClipboardChunk.h | 8 +- src/lib/deskflow/DragInformation.cpp | 4 +- src/lib/deskflow/DragInformation.h | 2 +- src/lib/deskflow/IClient.h | 2 +- src/lib/deskflow/IClipboard.cpp | 26 ++--- src/lib/deskflow/IClipboard.h | 6 +- src/lib/deskflow/IPlatformScreen.h | 10 +- src/lib/deskflow/IPrimaryScreen.cpp | 2 +- src/lib/deskflow/IPrimaryScreen.h | 12 +-- src/lib/deskflow/IScreen.h | 2 +- src/lib/deskflow/KeyMap.cpp | 8 +- src/lib/deskflow/KeyMap.h | 8 +- src/lib/deskflow/KeyState.cpp | 4 +- src/lib/deskflow/KeyState.h | 4 +- src/lib/deskflow/PacketStreamFilter.cpp | 11 +- src/lib/deskflow/PacketStreamFilter.h | 8 +- src/lib/deskflow/PlatformScreen.h | 10 +- src/lib/deskflow/ProtocolUtil.cpp | 82 +++++++------- src/lib/deskflow/ProtocolUtil.h | 26 ++--- src/lib/deskflow/Screen.cpp | 12 +-- src/lib/deskflow/Screen.h | 8 +- src/lib/deskflow/StreamChunker.cpp | 2 +- src/lib/deskflow/StreamChunker.h | 2 +- src/lib/deskflow/key_types.h | 34 +++--- src/lib/deskflow/option_types.h | 12 +-- src/lib/deskflow/protocol_types.h | 2 +- src/lib/io/IStream.h | 6 +- src/lib/io/StreamBuffer.cpp | 14 +-- src/lib/io/StreamBuffer.h | 14 +-- src/lib/io/StreamFilter.cpp | 6 +- src/lib/io/StreamFilter.h | 6 +- src/lib/ipc/IpcClientProxy.cpp | 2 +- src/lib/ipc/IpcServerProxy.cpp | 2 +- src/lib/net/IDataSocket.h | 6 +- .../InverseSockets/InverseClientSocket.cpp | 14 +-- .../net/InverseSockets/InverseClientSocket.h | 6 +- src/lib/net/SocketMultiplexer.cpp | 2 +- src/lib/net/TCPSocket.cpp | 14 +-- src/lib/net/TCPSocket.h | 6 +- src/lib/platform/IOSXKeyResource.h | 10 +- .../MSWindowsClipboardAnyTextConverter.cpp | 16 +-- .../MSWindowsClipboardBitmapConverter.cpp | 2 +- .../MSWindowsClipboardHTMLConverter.cpp | 6 +- src/lib/platform/MSWindowsDesks.cpp | 2 +- .../platform/MSWindowsEventQueueBuffer.cpp | 6 +- src/lib/platform/MSWindowsEventQueueBuffer.h | 4 +- src/lib/platform/MSWindowsHook.cpp | 4 +- src/lib/platform/MSWindowsHook.h | 2 +- src/lib/platform/MSWindowsKeyState.cpp | 2 +- src/lib/platform/MSWindowsScreen.cpp | 22 ++-- src/lib/platform/MSWindowsScreen.h | 24 ++--- src/lib/platform/OSXClipboardBMPConverter.cpp | 18 ++-- src/lib/platform/OSXEventQueueBuffer.cpp | 6 +- src/lib/platform/OSXEventQueueBuffer.h | 4 +- src/lib/platform/OSXKeyState.cpp | 80 +++++++------- src/lib/platform/OSXKeyState.h | 17 +-- src/lib/platform/OSXScreen.h | 36 +++---- src/lib/platform/OSXScreen.mm | 49 +++++---- src/lib/platform/OSXScreenSaver.cpp | 2 +- src/lib/platform/OSXUchrKeyResource.cpp | 16 +-- src/lib/platform/OSXUchrKeyResource.h | 12 +-- src/lib/platform/XWindowsClipboard.cpp | 17 ++- src/lib/platform/XWindowsClipboard.h | 2 +- .../XWindowsClipboardAnyBitmapConverter.cpp | 34 +++--- .../XWindowsClipboardAnyBitmapConverter.h | 6 +- .../XWindowsClipboardBMPConverter.cpp | 18 ++-- src/lib/platform/XWindowsEventQueueBuffer.cpp | 6 +- src/lib/platform/XWindowsEventQueueBuffer.h | 4 +- src/lib/platform/XWindowsKeyState.cpp | 12 +-- src/lib/platform/XWindowsKeyState.h | 6 +- src/lib/platform/XWindowsScreen.cpp | 22 ++-- src/lib/platform/XWindowsScreen.h | 18 ++-- src/lib/platform/XWindowsUtil.cpp | 22 ++-- src/lib/platform/XWindowsUtil.h | 15 +-- src/lib/server/BaseClientProxy.h | 4 +- src/lib/server/ClientProxy.h | 4 +- src/lib/server/ClientProxy1_0.cpp | 10 +- src/lib/server/ClientProxy1_0.h | 6 +- src/lib/server/ClientProxy1_5.cpp | 4 +- src/lib/server/ClientProxy1_5.h | 2 +- src/lib/server/ClientProxy1_6.cpp | 2 +- src/lib/server/ClientProxyUnknown.cpp | 2 +- src/lib/server/Config.cpp | 2 +- src/lib/server/Config.h | 2 +- src/lib/server/InputFilter.cpp | 20 ++-- src/lib/server/InputFilter.h | 16 +-- src/lib/server/PrimaryClient.cpp | 12 +-- src/lib/server/PrimaryClient.h | 10 +- src/lib/server/Server.cpp | 20 ++-- src/lib/server/Server.h | 14 +-- .../integtests/platform/OSXClipboardTests.cpp | 4 +- src/test/mock/deskflow/MockKeyState.h | 2 +- src/test/mock/io/MockStream.h | 6 +- src/test/mock/server/MockPrimaryClient.h | 6 +- src/test/unittests/client/HelloBackTests.cpp | 4 +- .../deskflow/ClipboardChunkTests.cpp | 12 +-- .../unittests/deskflow/ProtocolUtilTests.cpp | 36 +++---- .../unittests/platform/OSXKeyStateTests.cpp | 12 +-- 119 files changed, 684 insertions(+), 684 deletions(-) diff --git a/src/apps/deskflow-client/MSWindowsClientTaskBarReceiver.cpp b/src/apps/deskflow-client/MSWindowsClientTaskBarReceiver.cpp index b3fbf2ac8..4fd871485 100644 --- a/src/apps/deskflow-client/MSWindowsClientTaskBarReceiver.cpp +++ b/src/apps/deskflow-client/MSWindowsClientTaskBarReceiver.cpp @@ -45,7 +45,7 @@ MSWindowsClientTaskBarReceiver::MSWindowsClientTaskBarReceiver( m_window(NULL), m_logBuffer(logBuffer) { - for (UInt32 i = 0; i < kMaxState; ++i) { + for (uint32_t i = 0; i < kMaxState; ++i) { m_icon[i] = loadIcon(s_stateToIconID[i]); } m_menu = LoadMenu(m_appInstance, MAKEINTRESOURCE(IDR_TASKBAR)); @@ -67,7 +67,7 @@ MSWindowsClientTaskBarReceiver::~MSWindowsClientTaskBarReceiver() void MSWindowsClientTaskBarReceiver::cleanup() { ARCH->removeReceiver(this); - for (UInt32 i = 0; i < kMaxState; ++i) { + for (uint32_t i = 0; i < kMaxState; ++i) { deleteIcon(m_icon[i]); } DestroyMenu(m_menu); diff --git a/src/apps/deskflow-server/MSWindowsServerTaskBarReceiver.cpp b/src/apps/deskflow-server/MSWindowsServerTaskBarReceiver.cpp index b42926683..604562359 100644 --- a/src/apps/deskflow-server/MSWindowsServerTaskBarReceiver.cpp +++ b/src/apps/deskflow-server/MSWindowsServerTaskBarReceiver.cpp @@ -47,7 +47,7 @@ MSWindowsServerTaskBarReceiver::MSWindowsServerTaskBarReceiver( m_window(NULL), m_logBuffer(logBuffer) { - for (UInt32 i = 0; i < kMaxState; ++i) { + for (uint32_t i = 0; i < kMaxState; ++i) { m_icon[i] = loadIcon(s_stateToIconID[i]); } m_menu = LoadMenu(m_appInstance, MAKEINTRESOURCE(IDR_TASKBAR)); @@ -64,7 +64,7 @@ MSWindowsServerTaskBarReceiver::MSWindowsServerTaskBarReceiver( void MSWindowsServerTaskBarReceiver::cleanup() { ARCH->removeReceiver(this); - for (UInt32 i = 0; i < kMaxState; ++i) { + for (uint32_t i = 0; i < kMaxState; ++i) { deleteIcon(m_icon[i]); } DestroyMenu(m_menu); diff --git a/src/lib/arch/IArchString.cpp b/src/lib/arch/IArchString.cpp index 4af3bc05a..0c8f9d5c5 100644 --- a/src/lib/arch/IArchString.cpp +++ b/src/lib/arch/IArchString.cpp @@ -38,7 +38,7 @@ IArchString::~IArchString() } } -int IArchString::convStringWCToMB(char *dst, const wchar_t *src, UInt32 n, bool *errors) +int IArchString::convStringWCToMB(char *dst, const wchar_t *src, uint32_t n, bool *errors) { ptrdiff_t len = 0; @@ -95,7 +95,7 @@ int IArchString::convStringWCToMB(char *dst, const wchar_t *src, UInt32 n, bool return static_cast(len); } -int IArchString::convStringMBToWC(wchar_t *dst, const char *src, UInt32 n, bool *errors) +int IArchString::convStringMBToWC(wchar_t *dst, const char *src, uint32_t n, bool *errors) { ptrdiff_t len = 0; wchar_t dummy; diff --git a/src/lib/arch/IArchString.h b/src/lib/arch/IArchString.h index 2ebf6bcb9..6f7bd74dc 100644 --- a/src/lib/arch/IArchString.h +++ b/src/lib/arch/IArchString.h @@ -65,10 +65,10 @@ public: virtual int vsnprintf(char *str, int size, const char *fmt, va_list ap); //! Convert multibyte string to wide character string - virtual int convStringMBToWC(wchar_t *, const char *, UInt32 n, bool *errors); + virtual int convStringMBToWC(wchar_t *, const char *, uint32_t n, bool *errors); //! Convert wide character string to multibyte string - virtual int convStringWCToMB(char *, const wchar_t *, UInt32 n, bool *errors); + virtual int convStringWCToMB(char *, const wchar_t *, uint32_t n, bool *errors); //! Return the architecture's native wide character encoding virtual EWideCharEncoding getWideCharEncoding() = 0; diff --git a/src/lib/base/Event.h b/src/lib/base/Event.h index 6d76189fa..3907ea38e 100644 --- a/src/lib/base/Event.h +++ b/src/lib/base/Event.h @@ -39,7 +39,7 @@ A \c Event holds an event type and a pointer to event data. class Event { public: - using Type = UInt32; + using Type = uint32_t; enum { kUnknown, //!< The event type is unknown @@ -49,7 +49,7 @@ public: kLast //!< Must be last }; - using Flags = UInt32; + using Flags = uint32_t; enum { kNone = 0x00, //!< No flags diff --git a/src/lib/base/EventQueue.cpp b/src/lib/base/EventQueue.cpp index 3ba9c6bf6..ca69d0751 100644 --- a/src/lib/base/EventQueue.cpp +++ b/src/lib/base/EventQueue.cpp @@ -224,7 +224,7 @@ retry: } // get the event - UInt32 dataID; + uint32_t dataID; IEventQueueBuffer::Type type = m_buffer->getEvent(event, dataID); switch (type) { case IEventQueueBuffer::kNone: @@ -293,7 +293,7 @@ void EventQueue::addEventToBuffer(const Event &event) ArchMutexLock lock(m_mutex); // store the event's data locally - UInt32 eventID = saveEvent(event); + uint32_t eventID = saveEvent(event); // add it if (!m_buffer->addEvent(eventID)) { @@ -420,17 +420,17 @@ IEventJob *EventQueue::getHandler(Event::Type type, void *target) const return NULL; } -UInt32 EventQueue::saveEvent(const Event &event) +uint32_t EventQueue::saveEvent(const Event &event) { // choose id - UInt32 id; + uint32_t id; if (!m_oldEventIDs.empty()) { // reuse an id id = m_oldEventIDs.back(); m_oldEventIDs.pop_back(); } else { // make a new id - id = static_cast(m_events.size()); + id = static_cast(m_events.size()); } // save data @@ -438,7 +438,7 @@ UInt32 EventQueue::saveEvent(const Event &event) return id; } -Event EventQueue::removeEvent(UInt32 eventID) +Event EventQueue::removeEvent(uint32_t eventID) { // look up id EventTable::iterator index = m_events.find(eventID); @@ -592,7 +592,7 @@ void EventQueue::Timer::fillEvent(TimerEvent &event) const event.m_timer = m_timer; event.m_count = 0; if (m_time <= 0.0) { - event.m_count = static_cast((m_timeout - m_time) / m_timeout); + event.m_count = static_cast((m_timeout - m_time) / m_timeout); } } diff --git a/src/lib/base/EventQueue.h b/src/lib/base/EventQueue.h index 84a95923b..bf12a8c66 100644 --- a/src/lib/base/EventQueue.h +++ b/src/lib/base/EventQueue.h @@ -68,8 +68,8 @@ public: virtual void waitForReady() const; private: - UInt32 saveEvent(const Event &event); - Event removeEvent(UInt32 eventID); + uint32_t saveEvent(const Event &event); + Event removeEvent(uint32_t eventID); bool hasTimerExpired(Event &event); double getNextTimerTimeout() const; void addEventToBuffer(const Event &event); @@ -104,8 +104,8 @@ private: using Timers = std::set; using TimerQueue = PriorityQueue; - using EventTable = std::map; - using EventIDList = std::vector; + using EventTable = std::map; + using EventIDList = std::vector; using TypeMap = std::map; using NameMap = std::map; using TypeHandlerTable = std::map; diff --git a/src/lib/base/IEventQueue.h b/src/lib/base/IEventQueue.h index 6c8147c25..e236d15b8 100644 --- a/src/lib/base/IEventQueue.h +++ b/src/lib/base/IEventQueue.h @@ -66,7 +66,7 @@ public: { public: EventQueueTimer *m_timer; //!< The timer - UInt32 m_count; //!< Number of repeats + uint32_t m_count; //!< Number of repeats }; //! @name manipulators diff --git a/src/lib/base/IEventQueueBuffer.h b/src/lib/base/IEventQueueBuffer.h index c34c322c2..d63bda1b4 100644 --- a/src/lib/base/IEventQueueBuffer.h +++ b/src/lib/base/IEventQueueBuffer.h @@ -63,7 +63,7 @@ public: data in a kSystem event). Otherwise, return kUser and fill in \p dataID with the value passed to \c addEvent(). */ - virtual Type getEvent(Event &event, UInt32 &dataID) = 0; + virtual Type getEvent(Event &event, uint32_t &dataID) = 0; //! Post an event /*! @@ -72,7 +72,7 @@ public: return \p dataID. This method must cause \c waitForEvent() to return at some future time if it's blocked waiting on an event. */ - virtual bool addEvent(UInt32 dataID) = 0; + virtual bool addEvent(uint32_t dataID) = 0; //@} //! @name accessors diff --git a/src/lib/base/SimpleEventQueueBuffer.cpp b/src/lib/base/SimpleEventQueueBuffer.cpp index b8130eb8a..260af5099 100644 --- a/src/lib/base/SimpleEventQueueBuffer.cpp +++ b/src/lib/base/SimpleEventQueueBuffer.cpp @@ -57,7 +57,7 @@ void SimpleEventQueueBuffer::waitForEvent(double timeout) } } -IEventQueueBuffer::Type SimpleEventQueueBuffer::getEvent(Event &, UInt32 &dataID) +IEventQueueBuffer::Type SimpleEventQueueBuffer::getEvent(Event &, uint32_t &dataID) { ArchMutexLock lock(m_queueMutex); if (!m_queueReady) { @@ -69,7 +69,7 @@ IEventQueueBuffer::Type SimpleEventQueueBuffer::getEvent(Event &, UInt32 &dataID return kUser; } -bool SimpleEventQueueBuffer::addEvent(UInt32 dataID) +bool SimpleEventQueueBuffer::addEvent(uint32_t dataID) { ArchMutexLock lock(m_queueMutex); m_queue.push_front(dataID); diff --git a/src/lib/base/SimpleEventQueueBuffer.h b/src/lib/base/SimpleEventQueueBuffer.h index ac609276e..2f4be6776 100644 --- a/src/lib/base/SimpleEventQueueBuffer.h +++ b/src/lib/base/SimpleEventQueueBuffer.h @@ -42,14 +42,14 @@ public: { } virtual void waitForEvent(double timeout); - virtual Type getEvent(Event &event, UInt32 &dataID); - virtual bool addEvent(UInt32 dataID); + virtual Type getEvent(Event &event, uint32_t &dataID); + virtual bool addEvent(uint32_t dataID); virtual bool isEmpty() const; virtual EventQueueTimer *newTimer(double duration, bool oneShot) const; virtual void deleteTimer(EventQueueTimer *) const; private: - using EventDeque = std::deque; + using EventDeque = std::deque; ArchMutex m_queueMutex; ArchCond m_queueReadyCond; diff --git a/src/lib/base/Unicode.cpp b/src/lib/base/Unicode.cpp index dbf0a9240..98c476dd7 100644 --- a/src/lib/base/Unicode.cpp +++ b/src/lib/base/Unicode.cpp @@ -42,12 +42,12 @@ inline static uint16_t decode16(const uint8_t *n, bool byteSwapped) return c.n16; } -inline static UInt32 decode32(const uint8_t *n, bool byteSwapped) +inline static uint32_t decode32(const uint8_t *n, bool byteSwapped) { union x32 { uint8_t n8[4]; - UInt32 n32; + uint32_t n32; } c; if (byteSwapped) { c.n8[0] = n[3]; @@ -81,14 +81,14 @@ inline static void setError(bool *errors) // Unicode // -UInt32 Unicode::s_invalid = 0x0000ffff; -UInt32 Unicode::s_replacement = 0x0000fffd; +uint32_t Unicode::s_invalid = 0x0000ffff; +uint32_t Unicode::s_replacement = 0x0000fffd; bool Unicode::isUTF8(const std::string &src) { // convert and test each character const uint8_t *data = reinterpret_cast(src.c_str()); - for (UInt32 n = (UInt32)src.size(); n > 0;) { + for (uint32_t n = (uint32_t)src.size(); n > 0;) { if (fromUTF8(data, n) == s_invalid) { return false; } @@ -102,14 +102,14 @@ std::string Unicode::UTF8ToUCS2(const std::string &src, bool *errors) resetError(errors); // get size of input string and reserve some space in output - UInt32 n = (UInt32)src.size(); + uint32_t n = (uint32_t)src.size(); std::string dst; dst.reserve(2 * n); // convert each character const uint8_t *data = reinterpret_cast(src.c_str()); while (n > 0) { - UInt32 c = fromUTF8(data, n); + uint32_t c = fromUTF8(data, n); if (c == s_invalid) { c = s_replacement; } else if (c >= 0x00010000) { @@ -129,14 +129,14 @@ std::string Unicode::UTF8ToUCS4(const std::string &src, bool *errors) resetError(errors); // get size of input string and reserve some space in output - UInt32 n = (UInt32)src.size(); + uint32_t n = (uint32_t)src.size(); std::string dst; dst.reserve(4 * n); // convert each character const uint8_t *data = reinterpret_cast(src.c_str()); while (n > 0) { - UInt32 c = fromUTF8(data, n); + uint32_t c = fromUTF8(data, n); if (c == s_invalid) { c = s_replacement; } @@ -152,14 +152,14 @@ std::string Unicode::UTF8ToUTF16(const std::string &src, bool *errors) resetError(errors); // get size of input string and reserve some space in output - UInt32 n = (UInt32)src.size(); + uint32_t n = (uint32_t)src.size(); std::string dst; dst.reserve(2 * n); // convert each character const uint8_t *data = reinterpret_cast(src.c_str()); while (n > 0) { - UInt32 c = fromUTF8(data, n); + uint32_t c = fromUTF8(data, n); if (c == s_invalid) { c = s_replacement; } else if (c >= 0x00110000) { @@ -187,14 +187,14 @@ std::string Unicode::UTF8ToUTF32(const std::string &src, bool *errors) resetError(errors); // get size of input string and reserve some space in output - UInt32 n = (UInt32)src.size(); + uint32_t n = (uint32_t)src.size(); std::string dst; dst.reserve(4 * n); // convert each character const uint8_t *data = reinterpret_cast(src.c_str()); while (n > 0) { - UInt32 c = fromUTF8(data, n); + uint32_t c = fromUTF8(data, n); if (c == s_invalid) { c = s_replacement; } else if (c >= 0x00110000) { @@ -213,7 +213,7 @@ std::string Unicode::UTF8ToText(const std::string &src, bool *errors) resetError(errors); // convert to wide char - UInt32 size; + uint32_t size; wchar_t *tmp = UTF8ToWideChar(src, size, errors); // convert string to multibyte @@ -235,7 +235,7 @@ std::string Unicode::UCS2ToUTF8(const std::string &src, bool *errors) resetError(errors); // convert - UInt32 n = (UInt32)src.size() >> 1; + uint32_t n = (uint32_t)src.size() >> 1; return doUCS2ToUTF8(reinterpret_cast(src.data()), n, errors); } @@ -245,7 +245,7 @@ std::string Unicode::UCS4ToUTF8(const std::string &src, bool *errors) resetError(errors); // convert - UInt32 n = (UInt32)src.size() >> 2; + uint32_t n = (uint32_t)src.size() >> 2; return doUCS4ToUTF8(reinterpret_cast(src.data()), n, errors); } @@ -255,7 +255,7 @@ std::string Unicode::UTF16ToUTF8(const std::string &src, bool *errors) resetError(errors); // convert - UInt32 n = (UInt32)src.size() >> 1; + uint32_t n = (uint32_t)src.size() >> 1; return doUTF16ToUTF8(reinterpret_cast(src.data()), n, errors); } @@ -265,7 +265,7 @@ std::string Unicode::UTF32ToUTF8(const std::string &src, bool *errors) resetError(errors); // convert - UInt32 n = (UInt32)src.size() >> 2; + uint32_t n = (uint32_t)src.size() >> 2; return doUTF32ToUTF8(reinterpret_cast(src.data()), n, errors); } @@ -275,7 +275,7 @@ std::string Unicode::textToUTF8(const std::string &src, bool *errors, IArchStrin resetError(errors); // convert string to wide characters - UInt32 n = (UInt32)src.size(); + uint32_t n = (uint32_t)src.size(); int len = ARCH->convStringMBToWC(NULL, src.c_str(), n, errors); wchar_t *wcs = new wchar_t[len + 1]; ARCH->convStringMBToWC(wcs, src.c_str(), n, errors); @@ -289,29 +289,29 @@ std::string Unicode::textToUTF8(const std::string &src, bool *errors, IArchStrin return utf8; } -wchar_t *Unicode::UTF8ToWideChar(const std::string &src, UInt32 &size, bool *errors) +wchar_t *Unicode::UTF8ToWideChar(const std::string &src, uint32_t &size, bool *errors) { // convert to platform's wide character encoding std::string tmp; switch (ARCH->getWideCharEncoding()) { case IArchString::kUCS2: tmp = UTF8ToUCS2(src, errors); - size = (UInt32)tmp.size() >> 1; + size = (uint32_t)tmp.size() >> 1; break; case IArchString::kUCS4: tmp = UTF8ToUCS4(src, errors); - size = (UInt32)tmp.size() >> 2; + size = (uint32_t)tmp.size() >> 2; break; case IArchString::kUTF16: tmp = UTF8ToUTF16(src, errors); - size = (UInt32)tmp.size() >> 1; + size = (uint32_t)tmp.size() >> 1; break; case IArchString::kUTF32: tmp = UTF8ToUTF32(src, errors); - size = (UInt32)tmp.size() >> 2; + size = (uint32_t)tmp.size() >> 2; break; default: @@ -325,7 +325,7 @@ wchar_t *Unicode::UTF8ToWideChar(const std::string &src, UInt32 &size, bool *err } std::string -Unicode::wideCharToUTF8(const wchar_t *src, UInt32 size, bool *errors, IArchString::EWideCharEncoding encoding) +Unicode::wideCharToUTF8(const wchar_t *src, uint32_t size, bool *errors, IArchString::EWideCharEncoding encoding) { if (encoding == IArchString::kPlatformDetermined) { encoding = ARCH->getWideCharEncoding(); @@ -352,7 +352,7 @@ Unicode::wideCharToUTF8(const wchar_t *src, UInt32 size, bool *errors, IArchStri } } -std::string Unicode::doUCS2ToUTF8(const uint8_t *data, UInt32 n, bool *errors) +std::string Unicode::doUCS2ToUTF8(const uint8_t *data, uint32_t n, bool *errors) { // make some space std::string dst; @@ -380,7 +380,7 @@ std::string Unicode::doUCS2ToUTF8(const uint8_t *data, UInt32 n, bool *errors) // convert each character for (; n > 0; --n) { - UInt32 c = decode16(data, byteSwapped); + uint32_t c = decode16(data, byteSwapped); toUTF8(dst, c, errors); data += 2; } @@ -388,7 +388,7 @@ std::string Unicode::doUCS2ToUTF8(const uint8_t *data, UInt32 n, bool *errors) return dst; } -std::string Unicode::doUCS4ToUTF8(const uint8_t *data, UInt32 n, bool *errors) +std::string Unicode::doUCS4ToUTF8(const uint8_t *data, uint32_t n, bool *errors) { // make some space std::string dst; @@ -416,7 +416,7 @@ std::string Unicode::doUCS4ToUTF8(const uint8_t *data, UInt32 n, bool *errors) // convert each character for (; n > 0; --n) { - UInt32 c = decode32(data, byteSwapped); + uint32_t c = decode32(data, byteSwapped); toUTF8(dst, c, errors); data += 4; } @@ -424,7 +424,7 @@ std::string Unicode::doUCS4ToUTF8(const uint8_t *data, UInt32 n, bool *errors) return dst; } -std::string Unicode::doUTF16ToUTF8(const uint8_t *data, UInt32 n, bool *errors) +std::string Unicode::doUTF16ToUTF8(const uint8_t *data, uint32_t n, bool *errors) { // make some space std::string dst; @@ -452,7 +452,7 @@ std::string Unicode::doUTF16ToUTF8(const uint8_t *data, UInt32 n, bool *errors) // convert each character while (n > 0) { - UInt32 c = decode16(data, byteSwapped); + uint32_t c = decode16(data, byteSwapped); if (c < 0x0000d800 || c > 0x0000dfff) { toUTF8(dst, c, errors); } else if (n == 1) { @@ -462,7 +462,7 @@ std::string Unicode::doUTF16ToUTF8(const uint8_t *data, UInt32 n, bool *errors) } else if (c >= 0x0000d800 && c <= 0x0000dbff) { data += 2; --n; - UInt32 c2 = decode16(data, byteSwapped); + uint32_t c2 = decode16(data, byteSwapped); if (c2 < 0x0000dc00 || c2 > 0x0000dfff) { // error -- [d800,dbff] not followed by [dc00,dfff] setError(errors); @@ -483,7 +483,7 @@ std::string Unicode::doUTF16ToUTF8(const uint8_t *data, UInt32 n, bool *errors) return dst; } -std::string Unicode::doUTF32ToUTF8(const uint8_t *data, UInt32 n, bool *errors) +std::string Unicode::doUTF32ToUTF8(const uint8_t *data, uint32_t n, bool *errors) { // make some space std::string dst; @@ -511,7 +511,7 @@ std::string Unicode::doUTF32ToUTF8(const uint8_t *data, UInt32 n, bool *errors) // convert each character for (; n > 0; --n) { - UInt32 c = decode32(data, byteSwapped); + uint32_t c = decode32(data, byteSwapped); if (c >= 0x00110000) { setError(errors); c = s_replacement; @@ -523,7 +523,7 @@ std::string Unicode::doUTF32ToUTF8(const uint8_t *data, UInt32 n, bool *errors) return dst; } -UInt32 Unicode::fromUTF8(const uint8_t *&data, UInt32 &n) +uint32_t Unicode::fromUTF8(const uint8_t *&data, uint32_t &n) { assert(data != NULL); assert(n != 0); @@ -531,7 +531,7 @@ UInt32 Unicode::fromUTF8(const uint8_t *&data, UInt32 &n) // compute character encoding length, checking for overlong // sequences (i.e. characters that don't use the shortest // possible encoding). - UInt32 size; + uint32_t size; if (data[0] < 0x80) { // 0xxxxxxx size = 1; @@ -571,36 +571,36 @@ UInt32 Unicode::fromUTF8(const uint8_t *&data, UInt32 &n) } // extract character - UInt32 c; + uint32_t c; switch (size) { case 1: - c = static_cast(data[0]); + c = static_cast(data[0]); break; case 2: - c = ((static_cast(data[0]) & 0x1f) << 6) | ((static_cast(data[1]) & 0x3f)); + c = ((static_cast(data[0]) & 0x1f) << 6) | ((static_cast(data[1]) & 0x3f)); break; case 3: - c = ((static_cast(data[0]) & 0x0f) << 12) | ((static_cast(data[1]) & 0x3f) << 6) | - ((static_cast(data[2]) & 0x3f)); + c = ((static_cast(data[0]) & 0x0f) << 12) | ((static_cast(data[1]) & 0x3f) << 6) | + ((static_cast(data[2]) & 0x3f)); break; case 4: - c = ((static_cast(data[0]) & 0x07) << 18) | ((static_cast(data[1]) & 0x3f) << 12) | - ((static_cast(data[2]) & 0x3f) << 6) | ((static_cast(data[3]) & 0x3f)); + c = ((static_cast(data[0]) & 0x07) << 18) | ((static_cast(data[1]) & 0x3f) << 12) | + ((static_cast(data[2]) & 0x3f) << 6) | ((static_cast(data[3]) & 0x3f)); break; case 5: - c = ((static_cast(data[0]) & 0x03) << 24) | ((static_cast(data[1]) & 0x3f) << 18) | - ((static_cast(data[2]) & 0x3f) << 12) | ((static_cast(data[3]) & 0x3f) << 6) | - ((static_cast(data[4]) & 0x3f)); + c = ((static_cast(data[0]) & 0x03) << 24) | ((static_cast(data[1]) & 0x3f) << 18) | + ((static_cast(data[2]) & 0x3f) << 12) | ((static_cast(data[3]) & 0x3f) << 6) | + ((static_cast(data[4]) & 0x3f)); break; case 6: - c = ((static_cast(data[0]) & 0x01) << 30) | ((static_cast(data[1]) & 0x3f) << 24) | - ((static_cast(data[2]) & 0x3f) << 18) | ((static_cast(data[3]) & 0x3f) << 12) | - ((static_cast(data[4]) & 0x3f) << 6) | ((static_cast(data[5]) & 0x3f)); + c = ((static_cast(data[0]) & 0x01) << 30) | ((static_cast(data[1]) & 0x3f) << 24) | + ((static_cast(data[2]) & 0x3f) << 18) | ((static_cast(data[3]) & 0x3f) << 12) | + ((static_cast(data[4]) & 0x3f) << 6) | ((static_cast(data[5]) & 0x3f)); break; default: @@ -657,7 +657,7 @@ UInt32 Unicode::fromUTF8(const uint8_t *&data, UInt32 &n) } // check for characters that didn't use the smallest possible encoding - static UInt32 s_minChar[] = {0, 0x00000000, 0x00000080, 0x00000800, 0x00010000, 0x00200000, 0x04000000}; + static uint32_t s_minChar[] = {0, 0x00000000, 0x00000080, 0x00000800, 0x00010000, 0x00200000, 0x04000000}; if (c < s_minChar[size]) { return s_invalid; } @@ -673,7 +673,7 @@ UInt32 Unicode::fromUTF8(const uint8_t *&data, UInt32 &n) return c; } -void Unicode::toUTF8(std::string &dst, UInt32 c, bool *errors) +void Unicode::toUTF8(std::string &dst, uint32_t c, bool *errors) { uint8_t data[6]; diff --git a/src/lib/base/Unicode.h b/src/lib/base/Unicode.h index 84fa10661..27d565b6d 100644 --- a/src/lib/base/Unicode.h +++ b/src/lib/base/Unicode.h @@ -125,26 +125,26 @@ private: // to the platform). caller must delete[] the returned string. the // string is *not* nul terminated; the length (in characters) is // returned in size. - static wchar_t *UTF8ToWideChar(const std::string &, UInt32 &size, bool *errors); + static wchar_t *UTF8ToWideChar(const std::string &, uint32_t &size, bool *errors); // convert nul terminated wchar_t string (in platform's native // encoding) to UTF8. static std::string wideCharToUTF8( - const wchar_t *, UInt32 size, bool *errors, + const wchar_t *, uint32_t size, bool *errors, IArchString::EWideCharEncoding encoding = IArchString::kPlatformDetermined ); // internal conversion to UTF8 - static std::string doUCS2ToUTF8(const uint8_t *src, UInt32 n, bool *errors); - static std::string doUCS4ToUTF8(const uint8_t *src, UInt32 n, bool *errors); - static std::string doUTF16ToUTF8(const uint8_t *src, UInt32 n, bool *errors); - static std::string doUTF32ToUTF8(const uint8_t *src, UInt32 n, bool *errors); + static std::string doUCS2ToUTF8(const uint8_t *src, uint32_t n, bool *errors); + static std::string doUCS4ToUTF8(const uint8_t *src, uint32_t n, bool *errors); + static std::string doUTF16ToUTF8(const uint8_t *src, uint32_t n, bool *errors); + static std::string doUTF32ToUTF8(const uint8_t *src, uint32_t n, bool *errors); // convert characters to/from UTF8 - static UInt32 fromUTF8(const uint8_t *&src, UInt32 &size); - static void toUTF8(std::string &dst, UInt32 c, bool *errors); + static uint32_t fromUTF8(const uint8_t *&src, uint32_t &size); + static void toUTF8(std::string &dst, uint32_t c, bool *errors); private: - static UInt32 s_invalid; - static UInt32 s_replacement; + static uint32_t s_invalid; + static uint32_t s_replacement; }; diff --git a/src/lib/base/log_outputters.cpp b/src/lib/base/log_outputters.cpp index 2cfe0c037..805a4a990 100644 --- a/src/lib/base/log_outputters.cpp +++ b/src/lib/base/log_outputters.cpp @@ -165,7 +165,7 @@ SystemLogger::~SystemLogger() // BufferedLogOutputter // -BufferedLogOutputter::BufferedLogOutputter(UInt32 maxBufferSize) : m_maxBufferSize(maxBufferSize) +BufferedLogOutputter::BufferedLogOutputter(uint32_t maxBufferSize) : m_maxBufferSize(maxBufferSize) { // do nothing } diff --git a/src/lib/base/log_outputters.h b/src/lib/base/log_outputters.h index 8847204b2..d795bae7e 100644 --- a/src/lib/base/log_outputters.h +++ b/src/lib/base/log_outputters.h @@ -142,7 +142,7 @@ private: public: using const_iterator = Buffer::const_iterator; - BufferedLogOutputter(UInt32 maxBufferSize); + BufferedLogOutputter(uint32_t maxBufferSize); virtual ~BufferedLogOutputter(); //! @name accessors @@ -163,6 +163,6 @@ public: virtual bool write(ELevel level, const char *message); private: - UInt32 m_maxBufferSize; + uint32_t m_maxBufferSize; Buffer m_buffer; }; diff --git a/src/lib/client/Client.cpp b/src/lib/client/Client.cpp index d4204cefc..2fb5f88f9 100644 --- a/src/lib/client/Client.cpp +++ b/src/lib/client/Client.cpp @@ -250,7 +250,7 @@ void Client::getCursorPos(int32_t &x, int32_t &y) const m_screen->getCursorPos(x, y); } -void Client::enter(int32_t xAbs, int32_t yAbs, UInt32, KeyModifierMask mask, bool) +void Client::enter(int32_t xAbs, int32_t yAbs, uint32_t, KeyModifierMask mask, bool) { m_active = true; m_screen->mouseMove(xAbs, yAbs); @@ -757,7 +757,7 @@ void Client::writeToDropDirThread(void *) DropHelper::writeToDir(m_screen->getDropTarget(), m_dragFileList, m_receivedFileData); } -void Client::dragInfoReceived(UInt32 fileNum, std::string data) +void Client::dragInfoReceived(uint32_t fileNum, std::string data) { // TODO: fix duplicate function from CServer if (!m_args.m_enableDragDrop) { @@ -798,7 +798,7 @@ void Client::sendFileThread(void *filename) m_sendFileThread.reset(nullptr); } -void Client::sendDragInfo(UInt32 fileCount, std::string &info, size_t size) +void Client::sendDragInfo(uint32_t fileCount, std::string &info, size_t size) { m_server->sendDragInfo(fileCount, info.c_str(), size); } diff --git a/src/lib/client/Client.h b/src/lib/client/Client.h index ec01cc9c3..0cbcd252d 100644 --- a/src/lib/client/Client.h +++ b/src/lib/client/Client.h @@ -109,13 +109,13 @@ public: virtual void handshakeComplete(); //! Received drag information - void dragInfoReceived(UInt32 fileNum, std::string data); + void dragInfoReceived(uint32_t fileNum, std::string data); //! Create a new thread and use it to send file to Server void sendFileToServer(const char *filename); //! Send dragging file information back to server - void sendDragInfo(UInt32 fileCount, std::string &info, size_t size); + void sendDragInfo(uint32_t fileCount, std::string &info, size_t size); //@} //! @name accessors @@ -177,7 +177,7 @@ public: virtual void getCursorPos(int32_t &x, int32_t &y) const; // IClient overrides - virtual void enter(int32_t xAbs, int32_t yAbs, UInt32 seqNum, KeyModifierMask mask, bool forScreensaver); + virtual void enter(int32_t xAbs, int32_t yAbs, uint32_t seqNum, KeyModifierMask mask, bool forScreensaver); virtual bool leave(); virtual void setClipboard(ClipboardID, const IClipboard *); virtual void grabClipboard(ClipboardID); diff --git a/src/lib/client/ServerProxy.cpp b/src/lib/client/ServerProxy.cpp index 8aa98104b..029a3bc87 100644 --- a/src/lib/client/ServerProxy.cpp +++ b/src/lib/client/ServerProxy.cpp @@ -111,7 +111,7 @@ void ServerProxy::handleData(const Event &, void *) { // handle messages until there are no more. first read message code. uint8_t code[4]; - UInt32 n = m_stream->read(code, 4); + uint32_t n = m_stream->read(code, 4); while (n != 0) { // verify we got an entire code if (n != 4) { @@ -416,7 +416,7 @@ KeyID ServerProxy::translateKey(KeyID id) const }; KeyModifierID id2 = kKeyModifierIDNull; - UInt32 side = 0; + uint32_t side = 0; switch (id) { case kKeyShift_L: id2 = kKeyModifierIDShift; @@ -515,7 +515,7 @@ void ServerProxy::enter() // parse int16_t x, y; uint16_t mask; - UInt32 seqNum; + uint32_t seqNum; ProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask); LOG((CLOG_DEBUG1 "recv enter, %d,%d %d %04x", x, y, seqNum, mask)); @@ -549,7 +549,7 @@ void ServerProxy::setClipboard() // parse static std::string dataCached; ClipboardID id; - UInt32 seq; + uint32_t seq; int r = ClipboardChunk::assemble(m_stream, dataCached, id, seq); @@ -572,7 +572,7 @@ void ServerProxy::grabClipboard() { // parse ClipboardID id; - UInt32 seqNum; + uint32_t seqNum; ProtocolUtil::readf(m_stream, kMsgCClipboard + 4, &id, &seqNum); LOG((CLOG_DEBUG "recv grab clipboard %d", id)); @@ -788,7 +788,7 @@ void ServerProxy::setOptions() m_client->setOptions(options); // update modifier table - for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) { + for (uint32_t i = 0, n = (uint32_t)options.size(); i < n; i += 2) { KeyModifierID id = kKeyModifierIDNull; if (options[i] == kOptionModifierMapForShift) { id = kKeyModifierIDShift; @@ -845,7 +845,7 @@ void ServerProxy::fileChunkReceived() void ServerProxy::dragInfoReceived() { // parse - UInt32 fileNum = 0; + uint32_t fileNum = 0; std::string content; ProtocolUtil::readf(m_stream, kMsgDDragInfo + 4, &fileNum, &content); @@ -862,7 +862,7 @@ void ServerProxy::fileChunkSending(uint8_t mark, char *data, size_t dataSize) FileChunk::send(m_stream, mark, data, dataSize); } -void ServerProxy::sendDragInfo(UInt32 fileCount, const char *info, size_t size) +void ServerProxy::sendDragInfo(uint32_t fileCount, const char *info, size_t size) { std::string data(info, size); ProtocolUtil::writef(m_stream, kMsgDDragInfo, fileCount, &data); diff --git a/src/lib/client/ServerProxy.h b/src/lib/client/ServerProxy.h index abbeb6c51..93c1328fe 100644 --- a/src/lib/client/ServerProxy.h +++ b/src/lib/client/ServerProxy.h @@ -66,7 +66,7 @@ public: void fileChunkSending(uint8_t mark, char *data, size_t dataSize); // sending dragging information to server - void sendDragInfo(UInt32 fileCount, const char *info, size_t size); + void sendDragInfo(uint32_t fileCount, const char *info, size_t size); #ifdef TEST_ENV void handleDataForTest() @@ -134,7 +134,7 @@ private: Client *m_client; deskflow::IStream *m_stream; - UInt32 m_seqNum; + uint32_t m_seqNum; bool m_compressMouse; bool m_compressMouseRelative; diff --git a/src/lib/common/basic_types.h b/src/lib/common/basic_types.h index 6d7501647..ab1c85fef 100644 --- a/src/lib/common/basic_types.h +++ b/src/lib/common/basic_types.h @@ -84,7 +84,6 @@ #if defined(__APPLE__) #include #else -using UInt32 = unsigned TYPE_OF_SIZE_4; #endif #endif // diff --git a/src/lib/deskflow/ClipboardChunk.cpp b/src/lib/deskflow/ClipboardChunk.cpp index 919305f18..fef48acd4 100644 --- a/src/lib/deskflow/ClipboardChunk.cpp +++ b/src/lib/deskflow/ClipboardChunk.cpp @@ -31,7 +31,7 @@ ClipboardChunk::ClipboardChunk(size_t size) : Chunk(size) m_dataSize = size - CLIPBOARD_CHUNK_META_SIZE; } -ClipboardChunk *ClipboardChunk::start(ClipboardID id, UInt32 sequence, const std::string &size) +ClipboardChunk *ClipboardChunk::start(ClipboardID id, uint32_t sequence, const std::string &size) { size_t sizeLength = size.size(); ClipboardChunk *start = new ClipboardChunk(sizeLength + CLIPBOARD_CHUNK_META_SIZE); @@ -46,7 +46,7 @@ ClipboardChunk *ClipboardChunk::start(ClipboardID id, UInt32 sequence, const std return start; } -ClipboardChunk *ClipboardChunk::data(ClipboardID id, UInt32 sequence, const std::string &data) +ClipboardChunk *ClipboardChunk::data(ClipboardID id, uint32_t sequence, const std::string &data) { size_t dataSize = data.size(); ClipboardChunk *chunk = new ClipboardChunk(dataSize + CLIPBOARD_CHUNK_META_SIZE); @@ -61,7 +61,7 @@ ClipboardChunk *ClipboardChunk::data(ClipboardID id, UInt32 sequence, const std: return chunk; } -ClipboardChunk *ClipboardChunk::end(ClipboardID id, UInt32 sequence) +ClipboardChunk *ClipboardChunk::end(ClipboardID id, uint32_t sequence) { ClipboardChunk *end = new ClipboardChunk(CLIPBOARD_CHUNK_META_SIZE); char *chunk = end->m_chunk; @@ -74,7 +74,7 @@ ClipboardChunk *ClipboardChunk::end(ClipboardID id, UInt32 sequence) return end; } -int ClipboardChunk::assemble(deskflow::IStream *stream, std::string &dataCached, ClipboardID &id, UInt32 &sequence) +int ClipboardChunk::assemble(deskflow::IStream *stream, std::string &dataCached, ClipboardID &id, uint32_t &sequence) { uint8_t mark; std::string data; @@ -114,7 +114,7 @@ void ClipboardChunk::send(deskflow::IStream *stream, void *data) char *chunk = clipboardData->m_chunk; ClipboardID id = chunk[0]; - UInt32 sequence; + uint32_t sequence; std::memcpy(&sequence, &chunk[1], 4); uint8_t mark = chunk[5]; std::string dataChunk(&chunk[6], clipboardData->m_dataSize); diff --git a/src/lib/deskflow/ClipboardChunk.h b/src/lib/deskflow/ClipboardChunk.h index a55e50f6d..fcaab3c72 100644 --- a/src/lib/deskflow/ClipboardChunk.h +++ b/src/lib/deskflow/ClipboardChunk.h @@ -34,11 +34,11 @@ class ClipboardChunk : public Chunk public: ClipboardChunk(size_t size); - static ClipboardChunk *start(ClipboardID id, UInt32 sequence, const std::string &size); - static ClipboardChunk *data(ClipboardID id, UInt32 sequence, const std::string &data); - static ClipboardChunk *end(ClipboardID id, UInt32 sequence); + static ClipboardChunk *start(ClipboardID id, uint32_t sequence, const std::string &size); + static ClipboardChunk *data(ClipboardID id, uint32_t sequence, const std::string &data); + static ClipboardChunk *end(ClipboardID id, uint32_t sequence); - static int assemble(deskflow::IStream *stream, std::string &dataCached, ClipboardID &id, UInt32 &sequence); + static int assemble(deskflow::IStream *stream, std::string &dataCached, ClipboardID &id, uint32_t &sequence); static void send(deskflow::IStream *stream, void *data); diff --git a/src/lib/deskflow/DragInformation.cpp b/src/lib/deskflow/DragInformation.cpp index 6227d708c..6e3acdca1 100644 --- a/src/lib/deskflow/DragInformation.cpp +++ b/src/lib/deskflow/DragInformation.cpp @@ -28,7 +28,7 @@ DragInformation::DragInformation() : m_filename(), m_filesize(0) { } -void DragInformation::parseDragInfo(DragFileList &dragFileList, UInt32 fileNum, std::string data) +void DragInformation::parseDragInfo(DragFileList &dragFileList, uint32_t fileNum, std::string data) { size_t startPos = 0; size_t findResult1 = 0; @@ -39,7 +39,7 @@ void DragInformation::parseDragInfo(DragFileList &dragFileList, UInt32 fileNum, slash = "/"; } - UInt32 index = 0; + uint32_t index = 0; while (index < fileNum) { findResult1 = data.find(',', startPos); findResult2 = data.find_last_of(slash, findResult1); diff --git a/src/lib/deskflow/DragInformation.h b/src/lib/deskflow/DragInformation.h index da33017d1..6c06165ee 100644 --- a/src/lib/deskflow/DragInformation.h +++ b/src/lib/deskflow/DragInformation.h @@ -50,7 +50,7 @@ public: m_filesize = size; } - static void parseDragInfo(DragFileList &dragFileList, UInt32 fileNum, std::string data); + static void parseDragInfo(DragFileList &dragFileList, uint32_t fileNum, std::string data); static std::string getDragFileExtension(std::string filename); // helper function to setup drag info // example: filename1,filesize1,filename2,filesize2, diff --git a/src/lib/deskflow/IClient.h b/src/lib/deskflow/IClient.h index 9491d6b83..1f1910858 100644 --- a/src/lib/deskflow/IClient.h +++ b/src/lib/deskflow/IClient.h @@ -45,7 +45,7 @@ public: screen is being entered because the screen saver is starting. Subsequent clipboard events should report \p seqNum. */ - virtual void enter(int32_t xAbs, int32_t yAbs, UInt32 seqNum, KeyModifierMask mask, bool forScreensaver) = 0; + virtual void enter(int32_t xAbs, int32_t yAbs, uint32_t seqNum, KeyModifierMask mask, bool forScreensaver) = 0; //! Leave screen /*! diff --git a/src/lib/deskflow/IClipboard.cpp b/src/lib/deskflow/IClipboard.cpp index 5480a9856..813cea288 100644 --- a/src/lib/deskflow/IClipboard.cpp +++ b/src/lib/deskflow/IClipboard.cpp @@ -34,17 +34,17 @@ void IClipboard::unmarshall(IClipboard *clipboard, const std::string &data, Time clipboard->empty(); // read the number of formats - const UInt32 numFormats = readUInt32(index); + const uint32_t numFormats = readUInt32(index); index += 4; // read each format - for (UInt32 i = 0; i < numFormats; ++i) { + for (uint32_t i = 0; i < numFormats; ++i) { // get the format id IClipboard::EFormat format = static_cast(readUInt32(index)); index += 4; // get the size of the format data - UInt32 size = readUInt32(index); + uint32_t size = readUInt32(index); index += 4; // save the data if it's a known format. if either the client @@ -80,13 +80,13 @@ std::string IClipboard::marshall(const IClipboard *clipboard) if (clipboard->open(0)) { // compute size of marshalled data - UInt32 size = 4; - UInt32 numFormats = 0; - for (UInt32 format = 0; format != IClipboard::kNumFormats; ++format) { + uint32_t size = 4; + uint32_t numFormats = 0; + for (uint32_t format = 0; format != IClipboard::kNumFormats; ++format) { if (clipboard->has(static_cast(format))) { ++numFormats; formatData[format] = clipboard->get(static_cast(format)); - size += 4 + 4 + (UInt32)formatData[format].size(); + size += 4 + 4 + (uint32_t)formatData[format].size(); } } @@ -95,10 +95,10 @@ std::string IClipboard::marshall(const IClipboard *clipboard) // marshall the data writeUInt32(&data, numFormats); - for (UInt32 format = 0; format != IClipboard::kNumFormats; ++format) { + for (uint32_t format = 0; format != IClipboard::kNumFormats; ++format) { if (clipboard->has(static_cast(format))) { writeUInt32(&data, format); - writeUInt32(&data, (UInt32)formatData[format].size()); + writeUInt32(&data, (uint32_t)formatData[format].size()); data += formatData[format]; } } @@ -141,14 +141,14 @@ bool IClipboard::copy(IClipboard *dst, const IClipboard *src, Time time) return success; } -UInt32 IClipboard::readUInt32(const char *buf) +uint32_t IClipboard::readUInt32(const char *buf) { const unsigned char *ubuf = reinterpret_cast(buf); - return (static_cast(ubuf[0]) << 24) | (static_cast(ubuf[1]) << 16) | - (static_cast(ubuf[2]) << 8) | static_cast(ubuf[3]); + return (static_cast(ubuf[0]) << 24) | (static_cast(ubuf[1]) << 16) | + (static_cast(ubuf[2]) << 8) | static_cast(ubuf[3]); } -void IClipboard::writeUInt32(std::string *buf, UInt32 v) +void IClipboard::writeUInt32(std::string *buf, uint32_t v) { *buf += static_cast((v >> 24) & 0xff); *buf += static_cast((v >> 16) & 0xff); diff --git a/src/lib/deskflow/IClipboard.h b/src/lib/deskflow/IClipboard.h index cc526c716..07055d10d 100644 --- a/src/lib/deskflow/IClipboard.h +++ b/src/lib/deskflow/IClipboard.h @@ -36,7 +36,7 @@ public: arbitrary starting time. Timestamps will wrap around to 0 after about 49 3/4 days. */ - using Time = UInt32; + using Time = uint32_t; //! Clipboard formats /*! @@ -166,6 +166,6 @@ public: //@} private: - static UInt32 readUInt32(const char *); - static void writeUInt32(std::string *, UInt32); + static uint32_t readUInt32(const char *); + static void writeUInt32(std::string *, uint32_t); }; diff --git a/src/lib/deskflow/IPlatformScreen.h b/src/lib/deskflow/IPlatformScreen.h index fe80a8c32..c53608a7f 100644 --- a/src/lib/deskflow/IPlatformScreen.h +++ b/src/lib/deskflow/IPlatformScreen.h @@ -136,7 +136,7 @@ public: /*! Sets the sequence number to use in subsequent clipboard events. */ - virtual void setSequenceNumber(UInt32) = 0; + virtual void setSequenceNumber(uint32_t) = 0; //! Change dragging status virtual void setDraggingStarted(bool started) = 0; @@ -167,14 +167,14 @@ public: virtual void getCursorPos(int32_t &x, int32_t &y) const = 0; // IPrimaryScreen overrides - virtual void reconfigure(UInt32 activeSides) = 0; + virtual void reconfigure(uint32_t activeSides) = 0; virtual void warpCursor(int32_t x, int32_t y) = 0; - virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask) = 0; - virtual void unregisterHotKey(UInt32 id) = 0; + virtual uint32_t registerHotKey(KeyID key, KeyModifierMask mask) = 0; + virtual void unregisterHotKey(uint32_t id) = 0; virtual void fakeInputBegin() = 0; virtual void fakeInputEnd() = 0; virtual int32_t getJumpZoneSize() const = 0; - virtual bool isAnyMouseButtonDown(UInt32 &buttonID) const = 0; + virtual bool isAnyMouseButtonDown(uint32_t &buttonID) const = 0; virtual void getCursorCenter(int32_t &x, int32_t &y) const = 0; // ISecondaryScreen overrides diff --git a/src/lib/deskflow/IPrimaryScreen.cpp b/src/lib/deskflow/IPrimaryScreen.cpp index 9edb41c59..4a39fa6bf 100644 --- a/src/lib/deskflow/IPrimaryScreen.cpp +++ b/src/lib/deskflow/IPrimaryScreen.cpp @@ -74,7 +74,7 @@ IPrimaryScreen::WheelInfo *IPrimaryScreen::WheelInfo::alloc(int32_t xDelta, int3 // IPrimaryScreen::HotKeyInfo // -IPrimaryScreen::HotKeyInfo *IPrimaryScreen::HotKeyInfo::alloc(UInt32 id) +IPrimaryScreen::HotKeyInfo *IPrimaryScreen::HotKeyInfo::alloc(uint32_t id) { HotKeyInfo *info = (HotKeyInfo *)malloc(sizeof(HotKeyInfo)); info->m_id = id; diff --git a/src/lib/deskflow/IPrimaryScreen.h b/src/lib/deskflow/IPrimaryScreen.h index 58a326c10..0370a788a 100644 --- a/src/lib/deskflow/IPrimaryScreen.h +++ b/src/lib/deskflow/IPrimaryScreen.h @@ -69,10 +69,10 @@ public: class HotKeyInfo { public: - static HotKeyInfo *alloc(UInt32 id); + static HotKeyInfo *alloc(uint32_t id); public: - UInt32 m_id; + uint32_t m_id; }; class EiConnectInfo @@ -94,7 +94,7 @@ public: primary screen are linked to clients. Override to handle the possible change in jump zones. */ - virtual void reconfigure(UInt32 activeSides) = 0; + virtual void reconfigure(uint32_t activeSides) = 0; //! Warp cursor /*! @@ -125,13 +125,13 @@ public: the modifiers in any order or to require the user to press the given key last. */ - virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask) = 0; + virtual uint32_t registerHotKey(KeyID key, KeyModifierMask mask) = 0; //! Unregister a system hotkey /*! Unregisters a previously registered hot key. */ - virtual void unregisterHotKey(UInt32 id) = 0; + virtual void unregisterHotKey(uint32_t id) = 0; //! Prepare to synthesize input on primary screen /*! @@ -165,7 +165,7 @@ public: "current" means up to the last processed event but it can mean the current physical mouse button state. */ - virtual bool isAnyMouseButtonDown(UInt32 &buttonID) const = 0; + virtual bool isAnyMouseButtonDown(uint32_t &buttonID) const = 0; //! Get cursor center position /*! diff --git a/src/lib/deskflow/IScreen.h b/src/lib/deskflow/IScreen.h index ebc1345da..19e53fd6b 100644 --- a/src/lib/deskflow/IScreen.h +++ b/src/lib/deskflow/IScreen.h @@ -36,7 +36,7 @@ public: { public: ClipboardID m_id; - UInt32 m_sequenceNumber; + uint32_t m_sequenceNumber; }; //! @name accessors diff --git a/src/lib/deskflow/KeyMap.cpp b/src/lib/deskflow/KeyMap.cpp index 17cbf77d5..d0cd6580a 100644 --- a/src/lib/deskflow/KeyMap.cpp +++ b/src/lib/deskflow/KeyMap.cpp @@ -133,7 +133,7 @@ void KeyMap::addKeyAliasEntry( } } -bool KeyMap::addKeyCombinationEntry(KeyID id, int32_t group, const KeyID *keys, UInt32 numKeys) +bool KeyMap::addKeyCombinationEntry(KeyID id, int32_t group, const KeyID *keys, uint32_t numKeys) { // disallow kKeyNone if (id == kKeyNone) { @@ -155,7 +155,7 @@ bool KeyMap::addKeyCombinationEntry(KeyID id, int32_t group, const KeyID *keys, // convert to buttons KeyItemList items; - for (UInt32 i = 0; i < numKeys; ++i) { + for (uint32_t i = 0; i < numKeys; ++i) { KeyIDMap::const_iterator gtIndex = m_keyIDMap.find(keys[i]); if (gtIndex == m_keyIDMap.end()) { return false; @@ -926,7 +926,7 @@ void KeyMap::addKeystrokes( ) const { KeyButton button = keyItem.m_button; - UInt32 data = keyItem.m_client; + uint32_t data = keyItem.m_client; switch (type) { case kKeystrokePress: keystrokes.push_back(Keystroke(button, true, false, data)); @@ -1245,7 +1245,7 @@ bool KeyMap::KeyItem::operator==(const KeyItem &x) const // KeyMap::Keystroke // -KeyMap::Keystroke::Keystroke(KeyButton button, bool press, bool repeat, UInt32 data) : m_type(kButton) +KeyMap::Keystroke::Keystroke(KeyButton button, bool press, bool repeat, uint32_t data) : m_type(kButton) { m_data.m_button.m_button = button; m_data.m_button.m_press = press; diff --git a/src/lib/deskflow/KeyMap.h b/src/lib/deskflow/KeyMap.h index 0e068af67..84a0093f5 100644 --- a/src/lib/deskflow/KeyMap.h +++ b/src/lib/deskflow/KeyMap.h @@ -60,7 +60,7 @@ public: KeyModifierMask m_generates{}; //!< Modifiers key is mapped to bool m_dead{}; //!< \c true if this is a dead KeyID bool m_lock{}; //!< \c true if this locks a modifier - UInt32 m_client{}; //!< Client data + uint32_t m_client{}; //!< Client data public: bool operator==(const KeyItem &) const; @@ -88,7 +88,7 @@ public: kGroup //!< Set new group }; - Keystroke(KeyButton, bool press, bool repeat, UInt32 clientData); + Keystroke(KeyButton, bool press, bool repeat, uint32_t clientData); Keystroke(int32_t group, bool absolute, bool restore); public: @@ -98,7 +98,7 @@ public: KeyButton m_button{}; //!< Button to synthesize bool m_press{}; //!< \c true iff press bool m_repeat{}; //!< \c true iff for an autorepeat - UInt32 m_client{}; //!< Client data + uint32_t m_client{}; //!< Client data }; struct Group { @@ -168,7 +168,7 @@ public: least one key in \p keys is not in the map then nothing is added and this returns \c false, otherwise it returns \c true. */ - bool addKeyCombinationEntry(KeyID id, int32_t group, const KeyID *keys, UInt32 numKeys); + bool addKeyCombinationEntry(KeyID id, int32_t group, const KeyID *keys, uint32_t numKeys); //! Enable composition across groups /*! diff --git a/src/lib/deskflow/KeyState.cpp b/src/lib/deskflow/KeyState.cpp index 17c37c58b..6b42da6cd 100644 --- a/src/lib/deskflow/KeyState.cpp +++ b/src/lib/deskflow/KeyState.cpp @@ -1051,7 +1051,7 @@ void KeyState::addCombinationEntries() const KeyID *i = s_decomposeTable; while (*i != 0) { // count the decomposed keys for this key - UInt32 numKeys = 0; + uint32_t numKeys = 0; const KeyID *j = i; while (*++j != 0) { ++numKeys; @@ -1067,7 +1067,7 @@ void KeyState::addCombinationEntries() } } -void KeyState::fakeKeys(const Keystrokes &keys, UInt32 count) +void KeyState::fakeKeys(const Keystrokes &keys, uint32_t count) { // do nothing if no keys or no repeats if (count == 0 || keys.empty()) { diff --git a/src/lib/deskflow/KeyState.h b/src/lib/deskflow/KeyState.h index b28b0c1cb..f637f92b9 100644 --- a/src/lib/deskflow/KeyState.h +++ b/src/lib/deskflow/KeyState.h @@ -191,7 +191,7 @@ private: void addCombinationEntries(); // synthesize key events. synthesize auto-repeat events count times. - void fakeKeys(const Keystrokes &, UInt32 count); + void fakeKeys(const Keystrokes &, uint32_t count); // update key state to match changes to modifiers void updateModifierKeyState(KeyButton button, const ModifierToKeys &oldModifiers, const ModifierToKeys &newModifiers); @@ -224,7 +224,7 @@ private: int32_t m_syntheticKeys[kNumButtons]; // client data for each pressed key - UInt32 m_keyClientData[kNumButtons]; + uint32_t m_keyClientData[kNumButtons]; // server keyboard state. an entry is 0 if not the key isn't pressed // otherwise it's the local KeyButton synthesized for the server key. diff --git a/src/lib/deskflow/PacketStreamFilter.cpp b/src/lib/deskflow/PacketStreamFilter.cpp index 93efc72ae..abf03c1d0 100644 --- a/src/lib/deskflow/PacketStreamFilter.cpp +++ b/src/lib/deskflow/PacketStreamFilter.cpp @@ -51,7 +51,7 @@ void PacketStreamFilter::close() StreamFilter::close(); } -UInt32 PacketStreamFilter::read(void *buffer, UInt32 n) +uint32_t PacketStreamFilter::read(void *buffer, uint32_t n) { if (n == 0) { return 0; @@ -87,7 +87,7 @@ UInt32 PacketStreamFilter::read(void *buffer, UInt32 n) return n; } -void PacketStreamFilter::write(const void *buffer, UInt32 count) +void PacketStreamFilter::write(const void *buffer, uint32_t count) { // write the length of the payload uint8_t length[4]; @@ -115,7 +115,7 @@ bool PacketStreamFilter::isReady() const return isReadyNoLock(); } -UInt32 PacketStreamFilter::getSize() const +uint32_t PacketStreamFilter::getSize() const { Lock lock(&m_mutex); return isReadyNoLock() ? m_size : 0; @@ -134,7 +134,8 @@ bool PacketStreamFilter::readPacketSize() uint8_t buffer[4]; memcpy(buffer, m_buffer.peek(sizeof(buffer)), sizeof(buffer)); m_buffer.pop(sizeof(buffer)); - m_size = ((UInt32)buffer[0] << 24) | ((UInt32)buffer[1] << 16) | ((UInt32)buffer[2] << 8) | (UInt32)buffer[3]; + m_size = + ((uint32_t)buffer[0] << 24) | ((uint32_t)buffer[1] << 16) | ((uint32_t)buffer[2] << 8) | (uint32_t)buffer[3]; if (m_size > PROTOCOL_MAX_MESSAGE_LENGTH) { m_events->addEvent(Event(m_events->forIStream().inputFormatError(), getEventTarget())); return false; @@ -150,7 +151,7 @@ bool PacketStreamFilter::readMore() // read more data char buffer[4096]; - UInt32 n = getStream()->read(buffer, sizeof(buffer)); + uint32_t n = getStream()->read(buffer, sizeof(buffer)); while (n > 0) { m_buffer.write(buffer, n); diff --git a/src/lib/deskflow/PacketStreamFilter.h b/src/lib/deskflow/PacketStreamFilter.h index 5ea66e28c..d786bb325 100644 --- a/src/lib/deskflow/PacketStreamFilter.h +++ b/src/lib/deskflow/PacketStreamFilter.h @@ -36,11 +36,11 @@ public: // IStream overrides virtual void close(); - virtual UInt32 read(void *buffer, UInt32 n); - virtual void write(const void *buffer, UInt32 n); + virtual uint32_t read(void *buffer, uint32_t n); + virtual void write(const void *buffer, uint32_t n); virtual void shutdownInput(); virtual bool isReady() const; - virtual UInt32 getSize() const; + virtual uint32_t getSize() const; protected: // StreamFilter overrides @@ -53,7 +53,7 @@ private: private: Mutex m_mutex; - UInt32 m_size; + uint32_t m_size; StreamBuffer m_buffer; bool m_inputShutdown; IEventQueue *m_events; diff --git a/src/lib/deskflow/PlatformScreen.h b/src/lib/deskflow/PlatformScreen.h index e56ae98a8..00c79f4b8 100644 --- a/src/lib/deskflow/PlatformScreen.h +++ b/src/lib/deskflow/PlatformScreen.h @@ -44,14 +44,14 @@ public: virtual void getCursorPos(int32_t &x, int32_t &y) const = 0; // IPrimaryScreen overrides - virtual void reconfigure(UInt32 activeSides) = 0; + virtual void reconfigure(uint32_t activeSides) = 0; virtual void warpCursor(int32_t x, int32_t y) = 0; - virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask) = 0; - virtual void unregisterHotKey(UInt32 id) = 0; + virtual uint32_t registerHotKey(KeyID key, KeyModifierMask mask) = 0; + virtual void unregisterHotKey(uint32_t id) = 0; virtual void fakeInputBegin() = 0; virtual void fakeInputEnd() = 0; virtual int32_t getJumpZoneSize() const = 0; - virtual bool isAnyMouseButtonDown(UInt32 &buttonID) const = 0; + virtual bool isAnyMouseButtonDown(uint32_t &buttonID) const = 0; virtual void getCursorCenter(int32_t &x, int32_t &y) const = 0; // ISecondaryScreen overrides @@ -105,7 +105,7 @@ public: virtual void screensaver(bool activate) = 0; virtual void resetOptions() = 0; virtual void setOptions(const OptionsList &options) = 0; - virtual void setSequenceNumber(UInt32) = 0; + virtual void setSequenceNumber(uint32_t) = 0; virtual bool isPrimary() const = 0; virtual void fakeDraggingFiles(DragFileList fileList) diff --git a/src/lib/deskflow/ProtocolUtil.cpp b/src/lib/deskflow/ProtocolUtil.cpp index f479bcf66..9312e2ae9 100644 --- a/src/lib/deskflow/ProtocolUtil.cpp +++ b/src/lib/deskflow/ProtocolUtil.cpp @@ -34,7 +34,7 @@ namespace { -void writeInt(UInt32 Value, UInt32 Length, std::vector &Buffer) +void writeInt(uint32_t Value, uint32_t Length, std::vector &Buffer) { switch (Length) { case 1: @@ -60,7 +60,7 @@ template void writeVectorInt(const std::vector *VectorData, std: { if (VectorData) { const std::vector &Vector = *VectorData; - writeInt((UInt32)Vector.size(), sizeof(UInt32), Buffer); + writeInt((uint32_t)Vector.size(), sizeof(uint32_t), Buffer); for (size_t i = 0; i < Vector.size(); ++i) { writeInt(Vector[i], sizeof(T), Buffer); } @@ -69,7 +69,7 @@ template void writeVectorInt(const std::vector *VectorData, std: void writeString(const std::string *StringData, std::vector &Buffer) { - const UInt32 len = (StringData != NULL) ? (UInt32)StringData->size() : 0; + const uint32_t len = (StringData != NULL) ? (uint32_t)StringData->size() : 0; writeInt(len, sizeof(len), Buffer); if (len != 0) { std::copy(StringData->begin(), StringData->end(), std::back_inserter(Buffer)); @@ -86,7 +86,7 @@ void ProtocolUtil::writef(deskflow::IStream *stream, const char *fmt, ...) va_list args; va_start(args, fmt); - UInt32 size = getLength(fmt, args); + uint32_t size = getLength(fmt, args); va_end(args); va_start(args, fmt); vwritef(stream, fmt, size, args); @@ -115,7 +115,7 @@ bool ProtocolUtil::readf(deskflow::IStream *stream, const char *fmt, ...) return result; } -void ProtocolUtil::vwritef(deskflow::IStream *stream, const char *fmt, UInt32 size, va_list args) +void ProtocolUtil::vwritef(deskflow::IStream *stream, const char *fmt, uint32_t size, va_list args) { assert(stream != NULL); assert(fmt != NULL); @@ -149,7 +149,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar if (*fmt == '%') { // format specifier. determine argument size. ++fmt; - UInt32 len = eatLength(&fmt); + uint32_t len = eatLength(&fmt); switch (*fmt) { case 'i': { void *destination = va_arg(args, void *); @@ -164,7 +164,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar break; case 4: // 4 byte integer - *static_cast(destination) = read4BytesInt(stream); + *static_cast(destination) = read4BytesInt(stream); break; default: // the length is wrong @@ -188,7 +188,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar break; case 4: // 4 byte integer - readVector4BytesInt(stream, *static_cast *>(destination)); + readVector4BytesInt(stream, *static_cast *>(destination)); break; default: // the length is wrong @@ -238,45 +238,45 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar } } -UInt32 ProtocolUtil::getLength(const char *fmt, va_list args) +uint32_t ProtocolUtil::getLength(const char *fmt, va_list args) { - UInt32 n = 0; + uint32_t n = 0; while (*fmt) { if (*fmt == '%') { // format specifier. determine argument size. ++fmt; - UInt32 len = eatLength(&fmt); + uint32_t len = eatLength(&fmt); switch (*fmt) { case 'i': assert(len == 1 || len == 2 || len == 4); - (void)va_arg(args, UInt32); + (void)va_arg(args, uint32_t); break; case 'I': assert(len == 1 || len == 2 || len == 4); switch (len) { case 1: - len = (UInt32)(va_arg(args, std::vector *))->size() + 4; + len = (uint32_t)(va_arg(args, std::vector *))->size() + 4; break; case 2: - len = 2 * (UInt32)(va_arg(args, std::vector *))->size() + 4; + len = 2 * (uint32_t)(va_arg(args, std::vector *))->size() + 4; break; case 4: - len = 4 * (UInt32)(va_arg(args, std::vector *))->size() + 4; + len = 4 * (uint32_t)(va_arg(args, std::vector *))->size() + 4; break; } break; case 's': assert(len == 0); - len = (UInt32)(va_arg(args, std::string *))->size() + 4; + len = (uint32_t)(va_arg(args, std::string *))->size() + 4; break; case 'S': assert(len == 0); - len = va_arg(args, UInt32) + 4; + len = va_arg(args, uint32_t) + 4; break; case '%': @@ -306,10 +306,10 @@ void ProtocolUtil::writef(std::vector &buffer, const char *fmt, va_list if (*fmt == '%') { // format specifier. determine argument size. ++fmt; - UInt32 len = eatLength(&fmt); + uint32_t len = eatLength(&fmt); switch (*fmt) { case 'i': { - const UInt32 v = va_arg(args, UInt32); + const uint32_t v = va_arg(args, uint32_t); writeInt(v, len, buffer); break; } @@ -332,7 +332,7 @@ void ProtocolUtil::writef(std::vector &buffer, const char *fmt, va_list case 4: { // 4 byte integers - const std::vector *list = va_arg(args, const std::vector *); + const std::vector *list = va_arg(args, const std::vector *); writeVectorInt(list, buffer); break; } @@ -353,7 +353,7 @@ void ProtocolUtil::writef(std::vector &buffer, const char *fmt, va_list case 'S': { assert(len == 0); - const UInt32 len = va_arg(args, UInt32); + const uint32_t len = va_arg(args, uint32_t); const uint8_t *src = va_arg(args, uint8_t *); writeInt(len, sizeof(len), buffer); std::copy(src, src + len, std::back_inserter(buffer)); @@ -378,12 +378,12 @@ void ProtocolUtil::writef(std::vector &buffer, const char *fmt, va_list } } -UInt32 ProtocolUtil::eatLength(const char **pfmt) +uint32_t ProtocolUtil::eatLength(const char **pfmt) { const char *fmt = *pfmt; - UInt32 n = 0; + uint32_t n = 0; for (;;) { - UInt32 d; + uint32_t d; switch (*fmt) { case '0': d = 0; @@ -424,7 +424,7 @@ UInt32 ProtocolUtil::eatLength(const char **pfmt) } } -void ProtocolUtil::read(deskflow::IStream *stream, void *vbuffer, UInt32 count) +void ProtocolUtil::read(deskflow::IStream *stream, void *vbuffer, uint32_t count) { assert(stream != NULL); assert(vbuffer != NULL); @@ -432,7 +432,7 @@ void ProtocolUtil::read(deskflow::IStream *stream, void *vbuffer, UInt32 count) uint8_t *buffer = static_cast(vbuffer); while (count > 0) { // read more - UInt32 n = stream->read(buffer, count); + uint32_t n = stream->read(buffer, count); // bail if stream has hungup if (n == 0) { @@ -448,7 +448,7 @@ void ProtocolUtil::read(deskflow::IStream *stream, void *vbuffer, UInt32 count) uint8_t ProtocolUtil::read1ByteInt(deskflow::IStream *stream) { - const UInt32 BufferSize = 1; + const uint32_t BufferSize = 1; std::array buffer = {}; read(stream, buffer.data(), BufferSize); @@ -460,7 +460,7 @@ uint8_t ProtocolUtil::read1ByteInt(deskflow::IStream *stream) uint16_t ProtocolUtil::read2BytesInt(deskflow::IStream *stream) { - const UInt32 BufferSize = 2; + const uint32_t BufferSize = 2; std::array buffer = {}; read(stream, buffer.data(), BufferSize); @@ -470,14 +470,14 @@ uint16_t ProtocolUtil::read2BytesInt(deskflow::IStream *stream) return Result; } -UInt32 ProtocolUtil::read4BytesInt(deskflow::IStream *stream) +uint32_t ProtocolUtil::read4BytesInt(deskflow::IStream *stream) { const int BufferSize = 4; std::array buffer = {}; read(stream, buffer.data(), BufferSize); - UInt32 Result = (static_cast(buffer[0]) << 24) | (static_cast(buffer[1]) << 16) | - (static_cast(buffer[2]) << 8) | (static_cast(buffer[3])); + uint32_t Result = (static_cast(buffer[0]) << 24) | (static_cast(buffer[1]) << 16) | + (static_cast(buffer[2]) << 8) | (static_cast(buffer[3])); LOG((CLOG_DEBUG2 "readf: read 4 byte integer: %d (0x%x)", Result, Result)); @@ -486,31 +486,31 @@ UInt32 ProtocolUtil::read4BytesInt(deskflow::IStream *stream) void ProtocolUtil::readVector1ByteInt(deskflow::IStream *stream, std::vector &destination) { - UInt32 size = readVectorSize(stream); - for (UInt32 i = 0; i < size; ++i) { + uint32_t size = readVectorSize(stream); + for (uint32_t i = 0; i < size; ++i) { destination.push_back(read1ByteInt(stream)); } } void ProtocolUtil::readVector2BytesInt(deskflow::IStream *stream, std::vector &destination) { - UInt32 size = readVectorSize(stream); - for (UInt32 i = 0; i < size; ++i) { + uint32_t size = readVectorSize(stream); + for (uint32_t i = 0; i < size; ++i) { destination.push_back(read2BytesInt(stream)); } } -void ProtocolUtil::readVector4BytesInt(deskflow::IStream *stream, std::vector &destination) +void ProtocolUtil::readVector4BytesInt(deskflow::IStream *stream, std::vector &destination) { - UInt32 size = readVectorSize(stream); - for (UInt32 i = 0; i < size; ++i) { + uint32_t size = readVectorSize(stream); + for (uint32_t i = 0; i < size; ++i) { destination.push_back(read4BytesInt(stream)); } } -UInt32 ProtocolUtil::readVectorSize(deskflow::IStream *stream) +uint32_t ProtocolUtil::readVectorSize(deskflow::IStream *stream) { - UInt32 size = read4BytesInt(stream); + uint32_t size = read4BytesInt(stream); if (size > PROTOCOL_MAX_LIST_LENGTH) { LOG((CLOG_ERR "readVectorSize: vector length exceeds maximum allowed size: %u", size)); @@ -520,7 +520,7 @@ UInt32 ProtocolUtil::readVectorSize(deskflow::IStream *stream) return size; } -void ProtocolUtil::readBytes(deskflow::IStream *stream, UInt32 len, std::string *destination) +void ProtocolUtil::readBytes(deskflow::IStream *stream, uint32_t len, std::string *destination) { // read the string length uint8_t buffer[128]; diff --git a/src/lib/deskflow/ProtocolUtil.h b/src/lib/deskflow/ProtocolUtil.h index 6a94edace..5e3136f5e 100644 --- a/src/lib/deskflow/ProtocolUtil.h +++ b/src/lib/deskflow/ProtocolUtil.h @@ -50,7 +50,7 @@ public: - \%4i -- converts integer argument to 4 byte integer in NBO - \%1I -- converts std::vector* to 1 byte integers - \%2I -- converts std::vector* to 2 byte integers in NBO - - \%4I -- converts std::vector* to 4 byte integers in NBO + - \%4I -- converts std::vector* to 4 byte integers in NBO - \%s -- converts std::string* to stream of bytes - \%S -- converts integer N and const uint8_t* to stream of N bytes */ @@ -64,44 +64,44 @@ public: Format specifiers are: - \%\% -- read (and discard) a literal `\%' - - \%1i -- reads a 1 byte integer; argument is a int32_t* or UInt32* - - \%2i -- reads an NBO 2 byte integer; arg is int32_t* or UInt32* - - \%4i -- reads an NBO 4 byte integer; arg is int32_t* or UInt32* + - \%1i -- reads a 1 byte integer; argument is a int32_t* or uint32_t* + - \%2i -- reads an NBO 2 byte integer; arg is int32_t* or uint32_t* + - \%4i -- reads an NBO 4 byte integer; arg is int32_t* or uint32_t* - \%1I -- reads 1 byte integers; arg is std::vector* - \%2I -- reads NBO 2 byte integers; arg is std::vector* - - \%4I -- reads NBO 4 byte integers; arg is std::vector* + - \%4I -- reads NBO 4 byte integers; arg is std::vector* - \%s -- reads bytes; argument must be a std::string*, \b not a char* */ static bool readf(deskflow::IStream *, const char *fmt, ...); private: - static void vwritef(deskflow::IStream *, const char *fmt, UInt32 size, va_list); + static void vwritef(deskflow::IStream *, const char *fmt, uint32_t size, va_list); static void vreadf(deskflow::IStream *, const char *fmt, va_list); - static UInt32 getLength(const char *fmt, va_list); + static uint32_t getLength(const char *fmt, va_list); static void writef(std::vector &, const char *fmt, va_list); - static UInt32 eatLength(const char **fmt); - static void read(deskflow::IStream *, void *, UInt32); + static uint32_t eatLength(const char **fmt); + static void read(deskflow::IStream *, void *, uint32_t); /** * @brief Handles 1,2, or 4 byte Integers */ static uint8_t read1ByteInt(deskflow::IStream *stream); static uint16_t read2BytesInt(deskflow::IStream *stream); - static UInt32 read4BytesInt(deskflow::IStream *stream); + static uint32_t read4BytesInt(deskflow::IStream *stream); /** * @brief Handles a Vector of integers */ static void readVector1ByteInt(deskflow::IStream *, std::vector &); static void readVector2BytesInt(deskflow::IStream *, std::vector &); - static void readVector4BytesInt(deskflow::IStream *, std::vector &); - static UInt32 readVectorSize(deskflow::IStream *stream); + static void readVector4BytesInt(deskflow::IStream *, std::vector &); + static uint32_t readVectorSize(deskflow::IStream *stream); /** * @brief Handles an array of bytes */ - static void readBytes(deskflow::IStream *, UInt32, std::string *); + static void readBytes(deskflow::IStream *, uint32_t, std::string *); }; //! Mismatched read exception diff --git a/src/lib/deskflow/Screen.cpp b/src/lib/deskflow/Screen.cpp index ff6caddbc..c47736a74 100644 --- a/src/lib/deskflow/Screen.cpp +++ b/src/lib/deskflow/Screen.cpp @@ -171,7 +171,7 @@ bool Screen::leave() return true; } -void Screen::reconfigure(UInt32 activeSides) +void Screen::reconfigure(uint32_t activeSides) { assert(m_isPrimary); m_screen->reconfigure(activeSides); @@ -261,7 +261,7 @@ void Screen::resetOptions() void Screen::setOptions(const OptionsList &options) { // update options - for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) { + for (uint32_t i = 0, n = (uint32_t)options.size(); i < n; i += 2) { if (options[i] == kOptionHalfDuplexCapsLock) { if (options[i + 1] != 0) { m_halfDuplex |= KeyModifierCapsLock; @@ -293,17 +293,17 @@ void Screen::setOptions(const OptionsList &options) m_screen->setOptions(options); } -void Screen::setSequenceNumber(UInt32 seqNum) +void Screen::setSequenceNumber(uint32_t seqNum) { m_screen->setSequenceNumber(seqNum); } -UInt32 Screen::registerHotKey(KeyID key, KeyModifierMask mask) +uint32_t Screen::registerHotKey(KeyID key, KeyModifierMask mask) { return m_screen->registerHotKey(key, mask); } -void Screen::unregisterHotKey(UInt32 id) +void Screen::unregisterHotKey(uint32_t id) { m_screen->unregisterHotKey(id); } @@ -333,7 +333,7 @@ bool Screen::isLockedToScreen() const { // check for pressed mouse buttons // HACK: commented out as it breaks new drag drop feature - UInt32 buttonID = 0; + uint32_t buttonID = 0; if (m_screen->isAnyMouseButtonDown(buttonID)) { if (buttonID != kButtonLeft) { diff --git a/src/lib/deskflow/Screen.h b/src/lib/deskflow/Screen.h index 122e65861..a5104cb53 100644 --- a/src/lib/deskflow/Screen.h +++ b/src/lib/deskflow/Screen.h @@ -90,7 +90,7 @@ public: is a bitmask of EDirectionMask indicating which sides of the primary screen are linked to clients. */ - void reconfigure(UInt32 activeSides); + void reconfigure(uint32_t activeSides); //! Warp cursor /*! @@ -197,20 +197,20 @@ public: /*! Sets the sequence number to use in subsequent clipboard events. */ - void setSequenceNumber(UInt32); + void setSequenceNumber(uint32_t); //! Register a system hotkey /*! Registers a system-wide hotkey for key \p key with modifiers \p mask. Returns an id used to unregister the hotkey. */ - UInt32 registerHotKey(KeyID key, KeyModifierMask mask); + uint32_t registerHotKey(KeyID key, KeyModifierMask mask); //! Unregister a system hotkey /*! Unregisters a previously registered hot key. */ - void unregisterHotKey(UInt32 id); + void unregisterHotKey(uint32_t id); //! Prepare to synthesize input on primary screen /*! diff --git a/src/lib/deskflow/StreamChunker.cpp b/src/lib/deskflow/StreamChunker.cpp index a9c818302..524c36724 100644 --- a/src/lib/deskflow/StreamChunker.cpp +++ b/src/lib/deskflow/StreamChunker.cpp @@ -106,7 +106,7 @@ void StreamChunker::sendFile(char *filename, IEventQueue *events, void *eventTar } void StreamChunker::sendClipboard( - std::string &data, size_t size, ClipboardID id, UInt32 sequence, IEventQueue *events, void *eventTarget + std::string &data, size_t size, ClipboardID id, uint32_t sequence, IEventQueue *events, void *eventTarget ) { // send first message (data size) diff --git a/src/lib/deskflow/StreamChunker.h b/src/lib/deskflow/StreamChunker.h index 07980279a..1fda15ca3 100644 --- a/src/lib/deskflow/StreamChunker.h +++ b/src/lib/deskflow/StreamChunker.h @@ -29,7 +29,7 @@ class StreamChunker public: static void sendFile(char *filename, IEventQueue *events, void *eventTarget); static void sendClipboard( - std::string &data, size_t size, ClipboardID id, UInt32 sequence, IEventQueue *events, void *eventTarget + std::string &data, size_t size, ClipboardID id, uint32_t sequence, IEventQueue *events, void *eventTarget ); static void interruptFile(); diff --git a/src/lib/deskflow/key_types.h b/src/lib/deskflow/key_types.h index 4302653c8..4cba6d62e 100644 --- a/src/lib/deskflow/key_types.h +++ b/src/lib/deskflow/key_types.h @@ -28,9 +28,9 @@ keys, function keys, modifier keys, etc). */ // Typedef has to be used on mac os as this is used in objective-C #if __APPLE__ -typedef UInt32 KeyID; +typedef uint32_t KeyID; #else -using KeyID = UInt32; +using KeyID = uint32_t; #endif //! Key Code @@ -51,9 +51,9 @@ using KeyButton = uint16_t; Type to hold a bitmask of key modifiers (e.g. shift keys). */ #if __APPLE__ -typedef UInt32 KeyModifierMask; +typedef uint32_t KeyModifierMask; #else -using KeyModifierMask = UInt32; +using KeyModifierMask = uint32_t; #endif //! Modifier key ID @@ -61,9 +61,9 @@ using KeyModifierMask = UInt32; Type to hold the id of a key modifier (e.g. a shift key). */ #if __APPLE__ -typedef UInt32 KeyModifierID; +typedef uint32_t KeyModifierID; #else -using KeyModifierID = UInt32; +using KeyModifierID = uint32_t; #endif //! @name Modifier key masks @@ -82,17 +82,17 @@ static const KeyModifierMask KeyModifierScrollLock = 0x4000; //! @name Modifier key bits //@{ -static const UInt32 kKeyModifierBitNone = 16; -static const UInt32 kKeyModifierBitShift = 0; -static const UInt32 kKeyModifierBitControl = 1; -static const UInt32 kKeyModifierBitAlt = 2; -static const UInt32 kKeyModifierBitMeta = 3; -static const UInt32 kKeyModifierBitSuper = 4; -static const UInt32 kKeyModifierBitAltGr = 5; -static const UInt32 kKeyModifierBitLevel5Lock = 6; -static const UInt32 kKeyModifierBitCapsLock = 12; -static const UInt32 kKeyModifierBitNumLock = 13; -static const UInt32 kKeyModifierBitScrollLock = 14; +static const uint32_t kKeyModifierBitNone = 16; +static const uint32_t kKeyModifierBitShift = 0; +static const uint32_t kKeyModifierBitControl = 1; +static const uint32_t kKeyModifierBitAlt = 2; +static const uint32_t kKeyModifierBitMeta = 3; +static const uint32_t kKeyModifierBitSuper = 4; +static const uint32_t kKeyModifierBitAltGr = 5; +static const uint32_t kKeyModifierBitLevel5Lock = 6; +static const uint32_t kKeyModifierBitCapsLock = 12; +static const uint32_t kKeyModifierBitNumLock = 13; +static const uint32_t kKeyModifierBitScrollLock = 14; static const int32_t kKeyModifierNumBits = 16; //@} diff --git a/src/lib/deskflow/option_types.h b/src/lib/deskflow/option_types.h index 4b73d2e58..4b0e29b51 100644 --- a/src/lib/deskflow/option_types.h +++ b/src/lib/deskflow/option_types.h @@ -25,7 +25,7 @@ /*! Type to hold an option identifier. */ -using OptionID = UInt32; +using OptionID = uint32_t; //! Option Value /*! @@ -34,14 +34,14 @@ Type to hold an option value. using OptionValue = int32_t; // for now, options are just pairs of integers -using OptionsList = std::vector; +using OptionsList = std::vector; // macro for packing 4 character strings into 4 byte integers #define OPTION_CODE(_s) \ - (static_cast(static_cast(_s[0]) << 24) | \ - static_cast(static_cast(_s[1]) << 16) | \ - static_cast(static_cast(_s[2]) << 8) | \ - static_cast(static_cast(_s[3]))) + (static_cast(static_cast(_s[0]) << 24) | \ + static_cast(static_cast(_s[1]) << 16) | \ + static_cast(static_cast(_s[2]) << 8) | \ + static_cast(static_cast(_s[3]))) //! @name Option identifiers //@{ diff --git a/src/lib/deskflow/protocol_types.h b/src/lib/deskflow/protocol_types.h index 5d7c6e0f0..8930a2d51 100644 --- a/src/lib/deskflow/protocol_types.h +++ b/src/lib/deskflow/protocol_types.h @@ -41,7 +41,7 @@ static const int16_t kProtocolMinorVersion = 8; static const uint16_t kDefaultPort = 24800; // maximum total length for greeting returned by client -static const UInt32 kMaxHelloLength = 1024; +static const uint32_t kMaxHelloLength = 1024; // time between kMsgCKeepAlive (in seconds). a non-positive value disables // keep alives. this is the default rate that can be overridden using an diff --git a/src/lib/io/IStream.h b/src/lib/io/IStream.h index 8e9d78619..9a1ac0485 100644 --- a/src/lib/io/IStream.h +++ b/src/lib/io/IStream.h @@ -57,7 +57,7 @@ public: (zero if no data is available or input is shutdown). \p buffer may be NULL in which case the data is discarded. */ - virtual UInt32 read(void *buffer, UInt32 n) = 0; + virtual uint32_t read(void *buffer, uint32_t n) = 0; //! Write to stream /*! @@ -66,7 +66,7 @@ public: order to return more quickly. A output error event is generated when writing fails. */ - virtual void write(const void *buffer, UInt32 n) = 0; + virtual void write(const void *buffer, uint32_t n) = 0; //! Flush the stream /*! @@ -115,7 +115,7 @@ public: Some streams may not be able to determine this and will always return zero. */ - virtual UInt32 getSize() const = 0; + virtual uint32_t getSize() const = 0; //@} }; diff --git a/src/lib/io/StreamBuffer.cpp b/src/lib/io/StreamBuffer.cpp index ae2c5c61e..0a33f641c 100644 --- a/src/lib/io/StreamBuffer.cpp +++ b/src/lib/io/StreamBuffer.cpp @@ -23,7 +23,7 @@ // StreamBuffer // -const UInt32 StreamBuffer::kChunkSize = 4096; +const uint32_t StreamBuffer::kChunkSize = 4096; StreamBuffer::StreamBuffer() : m_size(0), m_headUsed(0) { @@ -35,7 +35,7 @@ StreamBuffer::~StreamBuffer() // do nothing } -const void *StreamBuffer::peek(UInt32 n) +const void *StreamBuffer::peek(uint32_t n) { assert(n <= m_size); @@ -60,7 +60,7 @@ const void *StreamBuffer::peek(UInt32 n) return static_cast(&(head->begin()[m_headUsed])); } -void StreamBuffer::pop(UInt32 n) +void StreamBuffer::pop(uint32_t n) { // discard all chunks if n is greater than or equal to m_size if (n >= m_size) { @@ -77,7 +77,7 @@ void StreamBuffer::pop(UInt32 n) ChunkList::iterator scan = m_chunks.begin(); assert(scan != m_chunks.end()); while (scan->size() - m_headUsed <= n) { - n -= (UInt32)scan->size() - m_headUsed; + n -= (uint32_t)scan->size() - m_headUsed; m_headUsed = 0; scan = m_chunks.erase(scan); assert(scan != m_chunks.end()); @@ -89,7 +89,7 @@ void StreamBuffer::pop(UInt32 n) } } -void StreamBuffer::write(const void *vdata, UInt32 n) +void StreamBuffer::write(const void *vdata, uint32_t n) { assert(vdata != NULL); @@ -118,7 +118,7 @@ void StreamBuffer::write(const void *vdata, UInt32 n) while (n > 0) { // choose number of bytes for next chunk assert(scan->size() <= kChunkSize); - UInt32 count = kChunkSize - (UInt32)scan->size(); + uint32_t count = kChunkSize - (uint32_t)scan->size(); if (count > n) count = n; @@ -135,7 +135,7 @@ void StreamBuffer::write(const void *vdata, UInt32 n) } } -UInt32 StreamBuffer::getSize() const +uint32_t StreamBuffer::getSize() const { return m_size; } diff --git a/src/lib/io/StreamBuffer.h b/src/lib/io/StreamBuffer.h index d62ccff81..c5fa9a003 100644 --- a/src/lib/io/StreamBuffer.h +++ b/src/lib/io/StreamBuffer.h @@ -41,20 +41,20 @@ public: (which must be <= getSize()). The caller must not modify the returned memory nor delete it. */ - const void *peek(UInt32 n); + const void *peek(uint32_t n); //! Discard data /*! Discards the next \c n bytes. If \c n >= getSize() then the buffer is cleared. */ - void pop(UInt32 n); + void pop(uint32_t n); //! Write data to buffer /*! Appends \c n bytes from \c data to the buffer. */ - void write(const void *data, UInt32 n); + void write(const void *data, uint32_t n); //@} //! @name accessors @@ -64,17 +64,17 @@ public: /*! Returns the number of bytes in the buffer. */ - UInt32 getSize() const; + uint32_t getSize() const; //@} private: - static const UInt32 kChunkSize; + static const uint32_t kChunkSize; using Chunk = std::vector; using ChunkList = std::list; ChunkList m_chunks; - UInt32 m_size; - UInt32 m_headUsed; + uint32_t m_size; + uint32_t m_headUsed; }; diff --git a/src/lib/io/StreamFilter.cpp b/src/lib/io/StreamFilter.cpp index 6fa902cdd..088c3812f 100644 --- a/src/lib/io/StreamFilter.cpp +++ b/src/lib/io/StreamFilter.cpp @@ -50,12 +50,12 @@ void StreamFilter::close() getStream()->close(); } -UInt32 StreamFilter::read(void *buffer, UInt32 n) +uint32_t StreamFilter::read(void *buffer, uint32_t n) { return getStream()->read(buffer, n); } -void StreamFilter::write(const void *buffer, UInt32 n) +void StreamFilter::write(const void *buffer, uint32_t n) { getStream()->write(buffer, n); } @@ -85,7 +85,7 @@ bool StreamFilter::isReady() const return getStream()->isReady(); } -UInt32 StreamFilter::getSize() const +uint32_t StreamFilter::getSize() const { return getStream()->getSize(); } diff --git a/src/lib/io/StreamFilter.h b/src/lib/io/StreamFilter.h index adfebbc0b..771046240 100644 --- a/src/lib/io/StreamFilter.h +++ b/src/lib/io/StreamFilter.h @@ -46,14 +46,14 @@ public: // These all just forward to the underlying stream except getEventTarget. // Override as necessary. getEventTarget returns a pointer to this. virtual void close(); - virtual UInt32 read(void *buffer, UInt32 n); - virtual void write(const void *buffer, UInt32 n); + virtual uint32_t read(void *buffer, uint32_t n); + virtual void write(const void *buffer, uint32_t n); virtual void flush(); virtual void shutdownInput(); virtual void shutdownOutput(); virtual void *getEventTarget() const; virtual bool isReady() const; - virtual UInt32 getSize() const; + virtual uint32_t getSize() const; //! Get the stream /*! diff --git a/src/lib/ipc/IpcClientProxy.cpp b/src/lib/ipc/IpcClientProxy.cpp index 1b00f903e..998a9b4fb 100644 --- a/src/lib/ipc/IpcClientProxy.cpp +++ b/src/lib/ipc/IpcClientProxy.cpp @@ -90,7 +90,7 @@ void IpcClientProxy::handleData(const Event &, void *) LOG((CLOG_DEBUG "start ipc handle data")); uint8_t code[4]; - UInt32 n = m_stream.read(code, 4); + uint32_t n = m_stream.read(code, 4); while (n != 0) { LOG((CLOG_DEBUG "ipc read: %c%c%c%c", code[0], code[1], code[2], code[3])); diff --git a/src/lib/ipc/IpcServerProxy.cpp b/src/lib/ipc/IpcServerProxy.cpp index bddb7d466..65e644541 100644 --- a/src/lib/ipc/IpcServerProxy.cpp +++ b/src/lib/ipc/IpcServerProxy.cpp @@ -47,7 +47,7 @@ void IpcServerProxy::handleData(const Event &, void *) LOG((CLOG_DEBUG "start ipc handle data")); uint8_t code[4]; - UInt32 n = m_stream.read(code, 4); + uint32_t n = m_stream.read(code, 4); while (n != 0) { LOG((CLOG_DEBUG "ipc read: %c%c%c%c", code[0], code[1], code[2], code[3])); diff --git a/src/lib/net/IDataSocket.h b/src/lib/net/IDataSocket.h index ce8ded330..7dda0a1d9 100644 --- a/src/lib/net/IDataSocket.h +++ b/src/lib/net/IDataSocket.h @@ -67,12 +67,12 @@ public: virtual void *getEventTarget() const; // IStream overrides - virtual UInt32 read(void *buffer, UInt32 n) = 0; - virtual void write(const void *buffer, UInt32 n) = 0; + virtual uint32_t read(void *buffer, uint32_t n) = 0; + virtual void write(const void *buffer, uint32_t n) = 0; virtual void flush() = 0; virtual void shutdownInput() = 0; virtual void shutdownOutput() = 0; virtual bool isReady() const = 0; virtual bool isFatal() const = 0; - virtual UInt32 getSize() const = 0; + virtual uint32_t getSize() const = 0; }; diff --git a/src/lib/net/InverseSockets/InverseClientSocket.cpp b/src/lib/net/InverseSockets/InverseClientSocket.cpp index 2bb7f3c97..3eed2bf32 100644 --- a/src/lib/net/InverseSockets/InverseClientSocket.cpp +++ b/src/lib/net/InverseSockets/InverseClientSocket.cpp @@ -77,11 +77,11 @@ void *InverseClientSocket::getEventTarget() const return const_cast(static_cast(this)); } -UInt32 InverseClientSocket::read(void *buffer, UInt32 n) +uint32_t InverseClientSocket::read(void *buffer, uint32_t n) { // copy data directly from our input buffer Lock lock(&m_mutex); - UInt32 size = m_inputBuffer.getSize(); + uint32_t size = m_inputBuffer.getSize(); if (n > size) { n = size; } @@ -99,7 +99,7 @@ UInt32 InverseClientSocket::read(void *buffer, UInt32 n) return n; } -void InverseClientSocket::write(const void *buffer, UInt32 n) +void InverseClientSocket::write(const void *buffer, uint32_t n) { bool wasEmpty; { @@ -193,7 +193,7 @@ bool InverseClientSocket::isFatal() const return false; } -UInt32 InverseClientSocket::getSize() const +uint32_t InverseClientSocket::getSize() const { Lock lock(&m_mutex); return m_inputBuffer.getSize(); @@ -220,7 +220,7 @@ InverseClientSocket::EJobResult InverseClientSocket::doRead() // slurp up as much as possible do { - m_inputBuffer.write(buffer, static_cast(bytesRead)); + m_inputBuffer.write(buffer, static_cast(bytesRead)); bytesRead = m_socket.readSocket(buffer, sizeof(buffer)); } while (bytesRead > 0); @@ -247,9 +247,9 @@ InverseClientSocket::EJobResult InverseClientSocket::doRead() InverseClientSocket::EJobResult InverseClientSocket::doWrite() { - UInt32 bufferSize = m_outputBuffer.getSize(); + uint32_t bufferSize = m_outputBuffer.getSize(); auto buffer = static_cast(m_outputBuffer.peek(bufferSize)); - const auto bytesWrote = static_cast(m_socket.writeSocket(buffer, bufferSize)); + const auto bytesWrote = static_cast(m_socket.writeSocket(buffer, bufferSize)); if (bytesWrote > 0) { discardWrittenData(bytesWrote); diff --git a/src/lib/net/InverseSockets/InverseClientSocket.h b/src/lib/net/InverseSockets/InverseClientSocket.h index 59de91a77..660b29121 100644 --- a/src/lib/net/InverseSockets/InverseClientSocket.h +++ b/src/lib/net/InverseSockets/InverseClientSocket.h @@ -49,14 +49,14 @@ public: void *getEventTarget() const override; // IStream overrides - UInt32 read(void *buffer, UInt32 n) override; - void write(const void *buffer, UInt32 n) override; + uint32_t read(void *buffer, uint32_t n) override; + void write(const void *buffer, uint32_t n) override; void flush() override; void shutdownInput() override; void shutdownOutput() override; bool isReady() const override; bool isFatal() const override; - UInt32 getSize() const override; + uint32_t getSize() const override; // IDataSocket overrides void connect(const NetworkAddress &) override; diff --git a/src/lib/net/SocketMultiplexer.cpp b/src/lib/net/SocketMultiplexer.cpp index 7d077e267..e48275ca3 100644 --- a/src/lib/net/SocketMultiplexer.cpp +++ b/src/lib/net/SocketMultiplexer.cpp @@ -200,7 +200,7 @@ void SocketMultiplexer::serviceThread(void *) if (status != 0) { // iterate over socket jobs, invoking each and saving the // new job. - UInt32 i = 0; + uint32_t i = 0; JobCursor cursor = newCursor(); JobCursor jobCursor = nextCursor(cursor); while (i < pfds.size() && jobCursor != m_socketJobs.end()) { diff --git a/src/lib/net/TCPSocket.cpp b/src/lib/net/TCPSocket.cpp index 70382a3d8..5ee14aa4f 100644 --- a/src/lib/net/TCPSocket.cpp +++ b/src/lib/net/TCPSocket.cpp @@ -129,11 +129,11 @@ void *TCPSocket::getEventTarget() const return const_cast(static_cast(this)); } -UInt32 TCPSocket::read(void *buffer, UInt32 n) +uint32_t TCPSocket::read(void *buffer, uint32_t n) { // copy data directly from our input buffer Lock lock(&m_mutex); - UInt32 size = m_inputBuffer.getSize(); + uint32_t size = m_inputBuffer.getSize(); if (n > size) { n = size; } @@ -151,7 +151,7 @@ UInt32 TCPSocket::read(void *buffer, UInt32 n) return n; } -void TCPSocket::write(const void *buffer, UInt32 n) +void TCPSocket::write(const void *buffer, uint32_t n) { bool wasEmpty; { @@ -255,7 +255,7 @@ bool TCPSocket::isFatal() const return false; } -UInt32 TCPSocket::getSize() const +uint32_t TCPSocket::getSize() const { Lock lock(&m_mutex); return m_inputBuffer.getSize(); @@ -324,7 +324,7 @@ TCPSocket::EJobResult TCPSocket::doRead() // slurp up as much as possible do { - m_inputBuffer.write(buffer, static_cast(bytesRead)); + m_inputBuffer.write(buffer, static_cast(bytesRead)); if (m_inputBuffer.getSize() > MAX_INPUT_BUFFER_SIZE) { break; @@ -356,12 +356,12 @@ TCPSocket::EJobResult TCPSocket::doRead() TCPSocket::EJobResult TCPSocket::doWrite() { // write data - UInt32 bufferSize = 0; + uint32_t bufferSize = 0; int bytesWrote = 0; bufferSize = m_outputBuffer.getSize(); const void *buffer = m_outputBuffer.peek(bufferSize); - bytesWrote = (UInt32)ARCH->writeSocket(m_socket, buffer, bufferSize); + bytesWrote = (uint32_t)ARCH->writeSocket(m_socket, buffer, bufferSize); if (bytesWrote > 0) { discardWrittenData(bytesWrote); diff --git a/src/lib/net/TCPSocket.h b/src/lib/net/TCPSocket.h index 8dd783bc8..be399b073 100644 --- a/src/lib/net/TCPSocket.h +++ b/src/lib/net/TCPSocket.h @@ -55,14 +55,14 @@ public: virtual void *getEventTarget() const; // IStream overrides - virtual UInt32 read(void *buffer, UInt32 n); - virtual void write(const void *buffer, UInt32 n); + virtual uint32_t read(void *buffer, uint32_t n); + virtual void write(const void *buffer, uint32_t n); virtual void flush(); virtual void shutdownInput(); virtual void shutdownOutput(); virtual bool isReady() const; virtual bool isFatal() const; - virtual UInt32 getSize() const; + virtual uint32_t getSize() const; // IDataSocket overrides virtual void connect(const NetworkAddress &); diff --git a/src/lib/platform/IOSXKeyResource.h b/src/lib/platform/IOSXKeyResource.h index c8bdb3315..41a67224a 100644 --- a/src/lib/platform/IOSXKeyResource.h +++ b/src/lib/platform/IOSXKeyResource.h @@ -23,11 +23,11 @@ class IOSXKeyResource : public IInterface { public: virtual bool isValid() const = 0; - virtual UInt32 getNumModifierCombinations() const = 0; - virtual UInt32 getNumTables() const = 0; - virtual UInt32 getNumButtons() const = 0; - virtual UInt32 getTableForModifier(UInt32 mask) const = 0; - virtual KeyID getKey(UInt32 table, UInt32 button) const = 0; + virtual uint32_t getNumModifierCombinations() const = 0; + virtual uint32_t getNumTables() const = 0; + virtual uint32_t getNumButtons() const = 0; + virtual uint32_t getTableForModifier(uint32_t mask) const = 0; + virtual KeyID getKey(uint32_t table, uint32_t button) const = 0; // Convert a character in the current script to the equivalent KeyID static KeyID getKeyID(uint8_t); diff --git a/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp b/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp index cf300b441..86165bc35 100644 --- a/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp +++ b/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp @@ -42,7 +42,7 @@ MSWindowsClipboardAnyTextConverter::fromIClipboard(const std::string &data) cons { // convert linefeeds and then convert to desired encoding std::string text = doFromIClipboard(convertLinefeedToWin32(data)); - UInt32 size = (UInt32)text.size(); + uint32_t size = (uint32_t)text.size(); // copy to memory handle HGLOBAL gData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, size); @@ -65,7 +65,7 @@ std::string MSWindowsClipboardAnyTextConverter::toIClipboard(HANDLE data) const { // get datator const char *src = (const char *)GlobalLock(data); - UInt32 srcSize = (UInt32)GlobalSize(data); + uint32_t srcSize = (uint32_t)GlobalSize(data); if (src == NULL || srcSize <= 1) { return std::string(); } @@ -85,8 +85,8 @@ std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(const std // note -- we assume src is a valid UTF-8 string // count newlines in string - UInt32 numNewlines = 0; - UInt32 n = (UInt32)src.size(); + uint32_t numNewlines = 0; + uint32_t n = (uint32_t)src.size(); for (const char *scan = src.c_str(); n > 0; ++scan, --n) { if (*scan == '\n') { ++numNewlines; @@ -101,7 +101,7 @@ std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(const std dst.reserve(src.size() + numNewlines); // copy string, converting newlines - n = (UInt32)src.size(); + n = (uint32_t)src.size(); for (const char *scan = src.c_str(); n > 0; ++scan, --n) { if (scan[0] == '\n') { dst += '\r'; @@ -115,8 +115,8 @@ std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(const std std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToUnix(const std::string &src) const { // count newlines in string - UInt32 numNewlines = 0; - UInt32 n = (UInt32)src.size(); + uint32_t numNewlines = 0; + uint32_t n = (uint32_t)src.size(); for (const char *scan = src.c_str(); n > 0; ++scan, --n) { if (scan[0] == '\r' && scan[1] == '\n') { ++numNewlines; @@ -131,7 +131,7 @@ std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToUnix(const std: dst.reserve(src.size()); // copy string, converting newlines - n = (UInt32)src.size(); + n = (uint32_t)src.size(); for (const char *scan = src.c_str(); n > 0; ++scan, --n) { if (scan[0] != '\r' || scan[1] != '\n') { dst += scan[0]; diff --git a/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp b/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp index 331517472..b6e9b611a 100644 --- a/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp +++ b/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp @@ -71,7 +71,7 @@ std::string MSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const if (src == NULL) { return std::string(); } - UInt32 srcSize = (UInt32)GlobalSize(data); + uint32_t srcSize = (uint32_t)GlobalSize(data); // check image type const BITMAPINFO *bitmap = static_cast(src); diff --git a/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp b/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp index c16d74298..5ed07faff 100644 --- a/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp +++ b/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp @@ -54,10 +54,10 @@ std::string MSWindowsClipboardHTMLConverter::doFromIClipboard(const std::string std::string suffix("\r\n"); // Get byte offsets for header - UInt32 StartFragment = (UInt32)prefix.size(); - UInt32 EndFragment = StartFragment + (UInt32)data.size(); + uint32_t StartFragment = (uint32_t)prefix.size(); + uint32_t EndFragment = StartFragment + (uint32_t)data.size(); // StartHTML is constant by the design of the prefix - UInt32 EndHTML = EndFragment + (UInt32)suffix.size(); + uint32_t EndHTML = EndFragment + (uint32_t)suffix.size(); prefix.replace(prefix.find("XXXXXXXXXX"), 10, deskflow::string::sprintf("%010u", StartFragment)); prefix.replace(prefix.find("YYYYYYYYYY"), 10, deskflow::string::sprintf("%010u", EndFragment)); diff --git a/src/lib/platform/MSWindowsDesks.cpp b/src/lib/platform/MSWindowsDesks.cpp index ce37844e1..286d7ccdd 100644 --- a/src/lib/platform/MSWindowsDesks.cpp +++ b/src/lib/platform/MSWindowsDesks.cpp @@ -208,7 +208,7 @@ void MSWindowsDesks::resetOptions() void MSWindowsDesks::setOptions(const OptionsList &options) { - for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) { + for (uint32_t i = 0, n = (uint32_t)options.size(); i < n; i += 2) { if (options[i] == kOptionWin32KeepForeground) { m_leaveForegroundOption = (options[i + 1] != 0); LOG((CLOG_DEBUG1 "%s the foreground window", m_leaveForegroundOption ? "don\'t grab" : "grab")); diff --git a/src/lib/platform/MSWindowsEventQueueBuffer.cpp b/src/lib/platform/MSWindowsEventQueueBuffer.cpp index d02ad2a98..b0ba7075b 100644 --- a/src/lib/platform/MSWindowsEventQueueBuffer.cpp +++ b/src/lib/platform/MSWindowsEventQueueBuffer.cpp @@ -80,7 +80,7 @@ void MSWindowsEventQueueBuffer::waitForEvent(double timeout) MsgWaitForMultipleObjects(0, dummy, FALSE, t, QS_ALLPOSTMESSAGE); } -IEventQueueBuffer::Type MSWindowsEventQueueBuffer::getEvent(Event &event, UInt32 &dataID) +IEventQueueBuffer::Type MSWindowsEventQueueBuffer::getEvent(Event &event, uint32_t &dataID) { // NOTE: QS_ALLINPUT was replaced with QS_ALLPOSTMESSAGE. // @@ -103,7 +103,7 @@ IEventQueueBuffer::Type MSWindowsEventQueueBuffer::getEvent(Event &event, UInt32 event = Event(Event::kQuit); return kSystem; } else if (m_event.message == m_userEvent) { - dataID = static_cast(m_event.wParam); + dataID = static_cast(m_event.wParam); return kUser; } else { event = Event(Event::kSystem, m_events->getSystemTarget(), &m_event); @@ -111,7 +111,7 @@ IEventQueueBuffer::Type MSWindowsEventQueueBuffer::getEvent(Event &event, UInt32 } } -bool MSWindowsEventQueueBuffer::addEvent(UInt32 dataID) +bool MSWindowsEventQueueBuffer::addEvent(uint32_t dataID) { return (PostThreadMessage(m_thread, m_userEvent, static_cast(dataID), 0) != 0); } diff --git a/src/lib/platform/MSWindowsEventQueueBuffer.h b/src/lib/platform/MSWindowsEventQueueBuffer.h index e4b03c6d5..772c8a928 100644 --- a/src/lib/platform/MSWindowsEventQueueBuffer.h +++ b/src/lib/platform/MSWindowsEventQueueBuffer.h @@ -37,8 +37,8 @@ public: { } virtual void waitForEvent(double timeout); - virtual Type getEvent(Event &event, UInt32 &dataID); - virtual bool addEvent(UInt32 dataID); + virtual Type getEvent(Event &event, uint32_t &dataID); + virtual bool addEvent(uint32_t dataID); virtual bool isEmpty() const; virtual EventQueueTimer *newTimer(double duration, bool oneShot) const; virtual void deleteTimer(EventQueueTimer *) const; diff --git a/src/lib/platform/MSWindowsHook.cpp b/src/lib/platform/MSWindowsHook.cpp index af6d1914f..03a8879e7 100644 --- a/src/lib/platform/MSWindowsHook.cpp +++ b/src/lib/platform/MSWindowsHook.cpp @@ -30,7 +30,7 @@ static HHOOK g_keyboardLL = NULL; static HHOOK g_mouseLL = NULL; static bool g_screenSaver = false; static EHookMode g_mode = kHOOK_DISABLE; -static UInt32 g_zoneSides = 0; +static uint32_t g_zoneSides = 0; static int32_t g_zoneSize = 0; static int32_t g_xScreen = 0; static int32_t g_yScreen = 0; @@ -125,7 +125,7 @@ int MSWindowsHook::cleanup() return 1; } -void MSWindowsHook::setSides(UInt32 sides) +void MSWindowsHook::setSides(uint32_t sides) { g_zoneSides = sides; } diff --git a/src/lib/platform/MSWindowsHook.h b/src/lib/platform/MSWindowsHook.h index c1dc26035..14fbc4996 100644 --- a/src/lib/platform/MSWindowsHook.h +++ b/src/lib/platform/MSWindowsHook.h @@ -36,7 +36,7 @@ public: int cleanup(); - void setSides(UInt32 sides); + void setSides(uint32_t sides); void setZone(int32_t x, int32_t y, int32_t w, int32_t h, int32_t jumpZoneSize); diff --git a/src/lib/platform/MSWindowsKeyState.cpp b/src/lib/platform/MSWindowsKeyState.cpp index 05ee992e7..a83d1b8ea 100644 --- a/src/lib/platform/MSWindowsKeyState.cpp +++ b/src/lib/platform/MSWindowsKeyState.cpp @@ -1240,7 +1240,7 @@ KeyModifierMask &MSWindowsKeyState::getActiveModifiersRValue() bool MSWindowsKeyState::getGroups(GroupList &groups) const { // get keyboard layouts - UInt32 newNumLayouts = GetKeyboardLayoutList(0, NULL); + uint32_t newNumLayouts = GetKeyboardLayoutList(0, NULL); if (newNumLayouts == 0) { LOG((CLOG_DEBUG1 "can't get keyboard layouts")); return false; diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp index a5bc34706..7c4a1446a 100644 --- a/src/lib/platform/MSWindowsScreen.cpp +++ b/src/lib/platform/MSWindowsScreen.cpp @@ -384,7 +384,7 @@ void MSWindowsScreen::sendDragThread(void *) if (draggingFilename.empty() == false) { ClientApp &app = ClientApp::instance(); Client *client = app.getClientPtr(); - UInt32 fileCount = 1; + uint32_t fileCount = 1; LOG((CLOG_DEBUG "send dragging info to server: %s", draggingFilename.c_str())); client->sendDragInfo(fileCount, draggingFilename, size); LOG((CLOG_DEBUG "send dragging file to server")); @@ -479,7 +479,7 @@ void MSWindowsScreen::setOptions(const OptionsList &options) m_desks->setOptions(options); } -void MSWindowsScreen::setSequenceNumber(UInt32 seqNum) +void MSWindowsScreen::setSequenceNumber(uint32_t seqNum) { m_sequenceNumber = seqNum; } @@ -567,7 +567,7 @@ void MSWindowsScreen::updateDesktopThread() CloseDesktop(cur_hdesk); } -void MSWindowsScreen::reconfigure(UInt32 activeSides) +void MSWindowsScreen::reconfigure(uint32_t activeSides) { assert(m_isPrimary); @@ -598,7 +598,7 @@ void MSWindowsScreen::saveMousePosition(int32_t x, int32_t y) LOG((CLOG_DEBUG5 "saved mouse position for next delta: %+d,%+d", x, y)); } -UInt32 MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) +uint32_t MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) { // only allow certain modifiers if ((mask & ~(KeyModifierShift | KeyModifierControl | KeyModifierAlt | KeyModifierSuper)) != 0) { @@ -637,13 +637,13 @@ UInt32 MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) } // choose hotkey id - UInt32 id; + uint32_t id; if (!m_oldHotKeyIDs.empty()) { id = m_oldHotKeyIDs.back(); m_oldHotKeyIDs.pop_back(); } else { // id = m_hotKeys.size() + 1; - id = (UInt32)m_hotKeys.size() + 1; + id = (uint32_t)m_hotKeys.size() + 1; } // if this hot key has modifiers only then we'll handle it specially @@ -676,7 +676,7 @@ UInt32 MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) return id; } -void MSWindowsScreen::unregisterHotKey(UInt32 id) +void MSWindowsScreen::unregisterHotKey(uint32_t id) { // look up hotkey HotKeyMap::iterator i = m_hotKeys.find(id); @@ -728,12 +728,12 @@ int32_t MSWindowsScreen::getJumpZoneSize() const return 1; } -bool MSWindowsScreen::isAnyMouseButtonDown(UInt32 &buttonID) const +bool MSWindowsScreen::isAnyMouseButtonDown(uint32_t &buttonID) const { static const char *buttonToName[] = {"", "Left Button", "Middle Button", "Right Button", "X Button 1", "X Button 2"}; - for (UInt32 i = 1; i < sizeof(m_buttons) / sizeof(m_buttons[0]); ++i) { + for (uint32_t i = 1; i < sizeof(m_buttons) / sizeof(m_buttons[0]); ++i) { if (m_buttons[i]) { buttonID = i; LOG((CLOG_DEBUG "locked by \"%s\"", buttonToName[i])); @@ -976,7 +976,7 @@ bool MSWindowsScreen::onPreDispatchPrimary(HWND, UINT message, WPARAM wParam, LP // handle event switch (message) { case DESKFLOW_MSG_MARK: - return onMark(static_cast(wParam)); + return onMark(static_cast(wParam)); case DESKFLOW_MSG_KEY: return onKey(wParam, lParam); @@ -1078,7 +1078,7 @@ bool MSWindowsScreen::onEvent(HWND, UINT msg, WPARAM wParam, LPARAM lParam, LRES return false; } -bool MSWindowsScreen::onMark(UInt32 mark) +bool MSWindowsScreen::onMark(uint32_t mark) { m_markReceived = mark; return true; diff --git a/src/lib/platform/MSWindowsScreen.h b/src/lib/platform/MSWindowsScreen.h index cfe05251a..6bb0a65c3 100644 --- a/src/lib/platform/MSWindowsScreen.h +++ b/src/lib/platform/MSWindowsScreen.h @@ -98,14 +98,14 @@ public: virtual void updateDesktopThread(); // IPrimaryScreen overrides - virtual void reconfigure(UInt32 activeSides); + virtual void reconfigure(uint32_t activeSides); virtual void warpCursor(int32_t x, int32_t y); - virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask); - virtual void unregisterHotKey(UInt32 id); + virtual uint32_t registerHotKey(KeyID key, KeyModifierMask mask); + virtual void unregisterHotKey(uint32_t id); virtual void fakeInputBegin(); virtual void fakeInputEnd(); virtual int32_t getJumpZoneSize() const; - virtual bool isAnyMouseButtonDown(UInt32 &buttonID) const; + virtual bool isAnyMouseButtonDown(uint32_t &buttonID) const; virtual void getCursorCenter(int32_t &x, int32_t &y) const; // ISecondaryScreen overrides @@ -134,7 +134,7 @@ public: virtual void screensaver(bool activate); virtual void resetOptions(); virtual void setOptions(const OptionsList &options); - virtual void setSequenceNumber(UInt32); + virtual void setSequenceNumber(uint32_t); virtual bool isPrimary() const; virtual void fakeDraggingFiles(DragFileList fileList); virtual std::string &getDraggingFilename(); @@ -185,7 +185,7 @@ private: // HACK bool onEvent(HWND, UINT, WPARAM, LPARAM, LRESULT *result); // message handlers - bool onMark(UInt32 mark); + bool onMark(uint32_t mark); bool onKey(WPARAM, LPARAM); bool onHotKey(WPARAM, LPARAM); bool onMouseButton(WPARAM, LPARAM); @@ -261,9 +261,9 @@ private: UINT m_keycode; UINT m_mask; }; - using HotKeyMap = std::map; - using HotKeyIDList = std::vector; - using HotKeyToIDMap = std::map; + using HotKeyMap = std::map; + using HotKeyIDList = std::vector; + using HotKeyToIDMap = std::map; using PrimaryKeyDownList = std::vector; static HINSTANCE s_windowInstance; @@ -292,11 +292,11 @@ private: int32_t m_xCursor, m_yCursor; // last clipboard - UInt32 m_sequenceNumber; + uint32_t m_sequenceNumber; // used to discard queued messages that are no longer needed - UInt32 m_mark; - UInt32 m_markReceived; + uint32_t m_mark; + uint32_t m_markReceived; // the main loop's thread id DWORD m_threadID; diff --git a/src/lib/platform/OSXClipboardBMPConverter.cpp b/src/lib/platform/OSXClipboardBMPConverter.cpp index 018fb74c9..096886505 100644 --- a/src/lib/platform/OSXClipboardBMPConverter.cpp +++ b/src/lib/platform/OSXClipboardBMPConverter.cpp @@ -24,17 +24,17 @@ struct CBMPHeader { public: uint16_t type; - UInt32 size; + uint32_t size; uint16_t reserved1; uint16_t reserved2; - UInt32 offset; + uint32_t offset; }; // BMP is little-endian -static inline UInt32 fromLEU32(const uint8_t *data) +static inline uint32_t fromLEU32(const uint8_t *data) { - return static_cast(data[0]) | (static_cast(data[1]) << 8) | (static_cast(data[2]) << 16) | - (static_cast(data[3]) << 24); + return static_cast(data[0]) | (static_cast(data[1]) << 8) | + (static_cast(data[2]) << 16) | (static_cast(data[3]) << 24); } static void toLE(uint8_t *&dst, char src) @@ -50,7 +50,7 @@ static void toLE(uint8_t *&dst, uint16_t src) dst += 2; } -static void toLE(uint8_t *&dst, UInt32 src) +static void toLE(uint8_t *&dst, uint32_t src) { dst[0] = static_cast(src & 0xffu); dst[1] = static_cast((src >> 8) & 0xffu); @@ -88,10 +88,10 @@ std::string OSXClipboardBMPConverter::fromIClipboard(const std::string &bmp) con uint8_t *dst = header; toLE(dst, 'B'); toLE(dst, 'M'); - toLE(dst, static_cast(14 + bmp.size())); + toLE(dst, static_cast(14 + bmp.size())); toLE(dst, static_cast(0)); toLE(dst, static_cast(0)); - toLE(dst, static_cast(14 + 40)); + toLE(dst, static_cast(14 + 40)); return std::string(reinterpret_cast(header), 14) + bmp; } @@ -109,7 +109,7 @@ std::string OSXClipboardBMPConverter::toIClipboard(const std::string &bmp) const } // get offset to image data - UInt32 offset = fromLEU32(rawBMPHeader + 10); + uint32_t offset = fromLEU32(rawBMPHeader + 10); // construct BMP if (offset == 14 + 40) { diff --git a/src/lib/platform/OSXEventQueueBuffer.cpp b/src/lib/platform/OSXEventQueueBuffer.cpp index 5b2aeb2d3..bce7d1636 100644 --- a/src/lib/platform/OSXEventQueueBuffer.cpp +++ b/src/lib/platform/OSXEventQueueBuffer.cpp @@ -60,7 +60,7 @@ void OSXEventQueueBuffer::waitForEvent(double timeout) ReceiveNextEvent(0, NULL, timeout, false, &event); } -IEventQueueBuffer::Type OSXEventQueueBuffer::getEvent(Event &event, UInt32 &dataID) +IEventQueueBuffer::Type OSXEventQueueBuffer::getEvent(Event &event, uint32_t &dataID) { // release the previous event if (m_event != NULL) { @@ -78,7 +78,7 @@ IEventQueueBuffer::Type OSXEventQueueBuffer::getEvent(Event &event, UInt32 &data } else if (error != noErr) { return kNone; } else { - UInt32 eventClass = GetEventClass(m_event); + uint32_t eventClass = GetEventClass(m_event); switch (eventClass) { case 'Syne': dataID = GetEventKind(m_event); @@ -91,7 +91,7 @@ IEventQueueBuffer::Type OSXEventQueueBuffer::getEvent(Event &event, UInt32 &data } } -bool OSXEventQueueBuffer::addEvent(UInt32 dataID) +bool OSXEventQueueBuffer::addEvent(uint32_t dataID) { EventRef event; OSStatus error = CreateEvent(kCFAllocatorDefault, 'Syne', dataID, 0, kEventAttributeNone, &event); diff --git a/src/lib/platform/OSXEventQueueBuffer.h b/src/lib/platform/OSXEventQueueBuffer.h index 749f52eca..5ae4ce567 100644 --- a/src/lib/platform/OSXEventQueueBuffer.h +++ b/src/lib/platform/OSXEventQueueBuffer.h @@ -34,8 +34,8 @@ public: // IEventQueueBuffer overrides virtual void init(); virtual void waitForEvent(double timeout); - virtual Type getEvent(Event &event, UInt32 &dataID); - virtual bool addEvent(UInt32 dataID); + virtual Type getEvent(Event &event, uint32_t &dataID); + virtual bool addEvent(uint32_t dataID); virtual bool isEmpty() const; virtual EventQueueTimer *newTimer(double duration, bool oneShot) const; virtual void deleteTimer(EventQueueTimer *) const; diff --git a/src/lib/platform/OSXKeyState.cpp b/src/lib/platform/OSXKeyState.cpp index 3ff3966b5..7c2123ced 100644 --- a/src/lib/platform/OSXKeyState.cpp +++ b/src/lib/platform/OSXKeyState.cpp @@ -32,25 +32,25 @@ // first instance of a virtual key code maps to the KeyID that we // want to generate for that code. The others are for mapping // different KeyIDs to a single key code. -static const UInt32 s_shiftVK = kVK_Shift; -static const UInt32 s_controlVK = kVK_Control; -static const UInt32 s_altVK = kVK_Option; -static const UInt32 s_superVK = kVK_Command; -static const UInt32 s_capsLockVK = kVK_CapsLock; -static const UInt32 s_numLockVK = kVK_ANSI_KeypadClear; // 71 +static const uint32_t s_shiftVK = kVK_Shift; +static const uint32_t s_controlVK = kVK_Control; +static const uint32_t s_altVK = kVK_Option; +static const uint32_t s_superVK = kVK_Command; +static const uint32_t s_capsLockVK = kVK_CapsLock; +static const uint32_t s_numLockVK = kVK_ANSI_KeypadClear; // 71 -static const UInt32 s_brightnessUp = 144; -static const UInt32 s_brightnessDown = 145; -static const UInt32 s_missionControlVK = 160; -static const UInt32 s_launchpadVK = 131; +static const uint32_t s_brightnessUp = 144; +static const uint32_t s_brightnessDown = 145; +static const uint32_t s_missionControlVK = 160; +static const uint32_t s_launchpadVK = 131; -static const UInt32 s_osxNumLock = 1 << 16; +static const uint32_t s_osxNumLock = 1 << 16; struct KeyEntry { public: KeyID m_keyID; - UInt32 m_virtualKey; + uint32_t m_virtualKey; }; static const KeyEntry s_controlKeys[] = { // cursor keys. if we don't do this we'll may still get these from @@ -224,7 +224,7 @@ void OSXKeyState::init() } } -KeyModifierMask OSXKeyState::mapModifiersFromOSX(UInt32 mask) const +KeyModifierMask OSXKeyState::mapModifiersFromOSX(uint32_t mask) const { KeyModifierMask outMask = 0; if ((mask & kCGEventFlagMaskShift) != 0) { @@ -250,7 +250,7 @@ KeyModifierMask OSXKeyState::mapModifiersFromOSX(UInt32 mask) const return outMask; } -KeyModifierMask OSXKeyState::mapModifiersToCarbon(UInt32 mask) const +KeyModifierMask OSXKeyState::mapModifiersToCarbon(uint32_t mask) const { KeyModifierMask outMask = 0; if ((mask & kCGEventFlagMaskShift) != 0) { @@ -287,10 +287,10 @@ KeyButton OSXKeyState::mapKeyFromEvent(KeyIDs &ids, KeyModifierMask *maskOut, CG } // get virtual key - UInt32 vkCode = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode); + uint32_t vkCode = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode); // handle up events - UInt32 eventKind = CGEventGetType(event); + uint32_t eventKind = CGEventGetType(event); if (eventKind == kCGEventKeyUp) { // the id isn't used. we just need the same button we used on // the key press. note that we don't use or reset the dead key @@ -317,9 +317,9 @@ KeyButton OSXKeyState::mapKeyFromEvent(KeyIDs &ids, KeyModifierMask *maskOut, CG // get the event modifiers and remove the command and control // keys. note if we used them though. // UCKeyTranslate expects old-style Carbon modifiers, so convert. - UInt32 modifiers; + uint32_t modifiers; modifiers = mapModifiersToCarbon(CGEventGetFlags(event)); - static const UInt32 s_commandModifiers = cmdKey | controlKey | rightControlKey; + static const uint32_t s_commandModifiers = cmdKey | controlKey | rightControlKey; bool isCommand = ((modifiers & s_commandModifiers) != 0); modifiers &= ~s_commandModifiers; @@ -414,7 +414,7 @@ KeyModifierMask OSXKeyState::pollActiveModifiers() const // falsely assumed that the mask returned by GetCurrentKeyModifiers() // was the same as a CGEventFlags (which is what mapModifiersFromOSX // expects). patch by Marc - UInt32 mask = GetCurrentKeyModifiers(); + uint32_t mask = GetCurrentKeyModifiers(); KeyModifierMask outMask = 0; if ((mask & shiftKey) != 0) { @@ -460,8 +460,8 @@ void OSXKeyState::pollPressedKeys(KeyButtonSet &pressedKeys) const ::KeyMap km; GetKeys(km); const uint8_t *m = reinterpret_cast(km); - for (UInt32 i = 0; i < 16; ++i) { - for (UInt32 j = 0; j < 8; ++j) { + for (uint32_t i = 0; i < 16; ++i) { + for (uint32_t j = 0; j < 8; ++j) { if ((m[i] & (1u << j)) != 0) { pressedKeys.insert(mapVirtualKeyToKeyButton(8 * i + j)); } @@ -483,7 +483,7 @@ void OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap) } } - UInt32 keyboardType = LMGetKbdType(); + uint32_t keyboardType = LMGetKbdType(); for (int32_t g = 0; g < numGroups; ++g) { // add special keys getKeyMapForSpecialKeys(keyMap, g); @@ -611,7 +611,7 @@ void OSXKeyState::fakeKey(const Keystroke &keystroke) switch (keystroke.m_type) { case Keystroke::kButton: { bool keyDown = keystroke.m_data.m_button.m_press; - UInt32 client = keystroke.m_data.m_button.m_client; + uint32_t client = keystroke.m_data.m_button.m_client; KeyButton button = keystroke.m_data.m_button.m_button; CGKeyCode virtualKey = mapKeyButtonToVirtualKey(button); @@ -692,20 +692,20 @@ bool OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap, int32_t group, const IOSXK // iterate over each button deskflow::KeyMap::KeyItem item; - for (UInt32 i = 0; i < r.getNumButtons(); ++i) { + for (uint32_t i = 0; i < r.getNumButtons(); ++i) { item.m_button = mapVirtualKeyToKeyButton(i); // the KeyIDs we've already handled std::set keys; // convert the entry in each table for this button to a KeyID - for (UInt32 j = 0; j < r.getNumTables(); ++j) { + for (uint32_t j = 0; j < r.getNumTables(); ++j) { buttonKeys[j].first = r.getKey(j, i); buttonKeys[j].second = deskflow::KeyMap::isDeadKey(buttonKeys[j].first); } // iterate over each character table - for (UInt32 j = 0; j < r.getNumTables(); ++j) { + for (uint32_t j = 0; j < r.getNumTables(); ++j) { // get the KeyID for the button/table KeyID id = buttonKeys[j].first; if (id == kKeyNone) { @@ -734,7 +734,7 @@ bool OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap, int32_t group, const IOSXK // can't be any earlier tables because of the check above. std::set tables; tables.insert(static_cast(j)); - for (UInt32 k = j + 1; k < r.getNumTables(); ++k) { + for (uint32_t k = j + 1; k < r.getNumTables(); ++k) { if (buttonKeys[k].first == id) { tables.insert(static_cast(k)); } @@ -742,7 +742,7 @@ bool OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap, int32_t group, const IOSXK // collect the modifier combinations that map to any of the // tables we just collected - for (UInt32 k = 0; k < r.getNumModifierCombinations(); ++k) { + for (uint32_t k = 0; k < r.getNumModifierCombinations(); ++k) { modifiers[k] = (tables.count(r.getTableForModifier(k)) > 0); } @@ -755,13 +755,13 @@ bool OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap, int32_t group, const IOSXK // for generating characters. in fact, we want to ignore any // characters generated by the control key. we don't map // those and instead expect the control modifier plus a key. - UInt32 sensitive = 0; - for (UInt32 k = 0; (1u << k) < r.getNumModifierCombinations(); ++k) { - UInt32 bit = (1u << k); + uint32_t sensitive = 0; + for (uint32_t k = 0; (1u << k) < r.getNumModifierCombinations(); ++k) { + uint32_t bit = (1u << k); if ((bit << 8) == cmdKey || (bit << 8) == controlKey || (bit << 8) == rightControlKey) { continue; } - for (UInt32 m = 0; m < r.getNumModifierCombinations(); ++m) { + for (uint32_t m = 0; m < r.getNumModifierCombinations(); ++m) { if (modifiers[m] != modifiers[m ^ bit]) { sensitive |= bit; break; @@ -771,8 +771,8 @@ bool OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap, int32_t group, const IOSXK // find each required modifier mask. the key can be synthesized // using any of the masks. - std::set required; - for (UInt32 k = 0; k < r.getNumModifierCombinations(); ++k) { + std::set required; + for (uint32_t k = 0; k < r.getNumModifierCombinations(); ++k) { if ((k & sensitive) == k && modifiers[k & sensitive]) { required.insert(k); } @@ -780,7 +780,7 @@ bool OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap, int32_t group, const IOSXK // now add a key entry for each key/required modifier pair. item.m_sensitive = mapModifiersFromOSX(sensitive << 16); - for (std::set::iterator k = required.begin(); k != required.end(); ++k) { + for (std::set::iterator k = required.begin(); k != required.end(); ++k) { item.m_required = mapModifiersFromOSX(*k << 16); keyMap.addKeyEntry(item); } @@ -791,7 +791,7 @@ bool OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap, int32_t group, const IOSXK } bool OSXKeyState::mapDeskflowHotKeyToMac( - KeyID key, KeyModifierMask mask, UInt32 &macVirtualKey, UInt32 &macModifierMask + KeyID key, KeyModifierMask mask, uint32_t &macVirtualKey, uint32_t &macModifierMask ) const { // look up button for key @@ -851,7 +851,7 @@ void OSXKeyState::handleModifierKeys(void *target, KeyModifierMask oldMask, KeyM } } -void OSXKeyState::handleModifierKey(void *target, UInt32 virtualKey, KeyID id, bool down, KeyModifierMask newMask) +void OSXKeyState::handleModifierKey(void *target, uint32_t virtualKey, KeyID id, bool down, KeyModifierMask newMask) { KeyButton button = mapVirtualKeyToKeyButton(virtualKey); onKey(button, down, newMask); @@ -918,13 +918,13 @@ void OSXKeyState::adjustAltGrModifier(const KeyIDs &ids, KeyModifierMask *mask, } } -KeyButton OSXKeyState::mapVirtualKeyToKeyButton(UInt32 keyCode) +KeyButton OSXKeyState::mapVirtualKeyToKeyButton(uint32_t keyCode) { // 'A' maps to 0 so shift every id return static_cast(keyCode + KeyButtonOffset); } -UInt32 OSXKeyState::mapKeyButtonToVirtualKey(KeyButton keyButton) +uint32_t OSXKeyState::mapKeyButtonToVirtualKey(KeyButton keyButton) { - return static_cast(keyButton - KeyButtonOffset); + return static_cast(keyButton - KeyButtonOffset); } diff --git a/src/lib/platform/OSXKeyState.h b/src/lib/platform/OSXKeyState.h index 71c17e948..d2183e9df 100644 --- a/src/lib/platform/OSXKeyState.h +++ b/src/lib/platform/OSXKeyState.h @@ -60,13 +60,13 @@ public: Returns the deskflow modifier mask corresponding to the OS X modifier mask in \p mask. */ - KeyModifierMask mapModifiersFromOSX(UInt32 mask) const; + KeyModifierMask mapModifiersFromOSX(uint32_t mask) const; //! Convert CG flags-style modifier mask to old-style Carbon /*! Still required in a few places for translation calls. */ - KeyModifierMask mapModifiersToCarbon(UInt32 mask) const; + KeyModifierMask mapModifiersToCarbon(uint32_t mask) const; //! Map key event to keys /*! @@ -83,7 +83,8 @@ public: Calculates mac virtual key and mask for a key \p key and modifiers \p mask. Returns \c true if the key can be mapped, \c false otherwise. */ - bool mapDeskflowHotKeyToMac(KeyID key, KeyModifierMask mask, UInt32 &macVirtualKey, UInt32 &macModifierMask) const; + bool + mapDeskflowHotKeyToMac(KeyID key, KeyModifierMask mask, uint32_t &macVirtualKey, uint32_t &macModifierMask) const; //@} @@ -117,7 +118,7 @@ private: void setGroup(int32_t group); // Send an event for the given modifier key - void handleModifierKey(void *target, UInt32 virtualKey, KeyID id, bool down, KeyModifierMask newMask); + void handleModifierKey(void *target, uint32_t virtualKey, KeyID id, bool down, KeyModifierMask newMask); // Checks if any in \p ids is a glyph key and if \p isCommand is false. // If so it adds the AltGr modifier to \p mask. This allows OS X @@ -129,11 +130,11 @@ private: // Maps an OS X virtual key id to a KeyButton. This simply remaps // the ids so we don't use KeyButton 0. - static KeyButton mapVirtualKeyToKeyButton(UInt32 keyCode); + static KeyButton mapVirtualKeyToKeyButton(uint32_t keyCode); // Maps a KeyButton to an OS X key code. This is the inverse of // mapVirtualKeyToKeyButton. - static UInt32 mapKeyButtonToVirtualKey(KeyButton keyButton); + static uint32_t mapKeyButtonToVirtualKey(KeyButton keyButton); void init(); @@ -161,10 +162,10 @@ private: }; using GroupMap = std::map; - using VirtualKeyMap = std::map; + using VirtualKeyMap = std::map; VirtualKeyMap m_virtualKeyMap; - mutable UInt32 m_deadKeyState; + mutable uint32_t m_deadKeyState; AutoCFArray m_groups{nullptr, CFRelease}; GroupMap m_groupMap; bool m_shiftPressed; diff --git a/src/lib/platform/OSXScreen.h b/src/lib/platform/OSXScreen.h index 1174718ff..90a7f104c 100644 --- a/src/lib/platform/OSXScreen.h +++ b/src/lib/platform/OSXScreen.h @@ -73,14 +73,14 @@ public: void getCursorPos(int32_t &x, int32_t &y) const override; // IPrimaryScreen overrides - void reconfigure(UInt32 activeSides) override; + void reconfigure(uint32_t activeSides) override; void warpCursor(int32_t x, int32_t y) override; - UInt32 registerHotKey(KeyID key, KeyModifierMask mask) override; - void unregisterHotKey(UInt32 id) override; + uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override; + void unregisterHotKey(uint32_t id) override; void fakeInputBegin() override; void fakeInputEnd() override; int32_t getJumpZoneSize() const override; - bool isAnyMouseButtonDown(UInt32 &buttonID) const override; + bool isAnyMouseButtonDown(uint32_t &buttonID) const override; void getCursorCenter(int32_t &x, int32_t &y) const override; // ISecondaryScreen overrides @@ -102,7 +102,7 @@ public: void screensaver(bool activate) override; void resetOptions() override; void setOptions(const OptionsList &options) override; - void setSequenceNumber(UInt32) override; + void setSequenceNumber(uint32_t) override; bool isPrimary() const override; void fakeDraggingFiles(DragFileList fileList) override; std::string &getDraggingFilename() override; @@ -206,8 +206,8 @@ private: struct HotKeyItem { public: - HotKeyItem(UInt32, UInt32); - HotKeyItem(EventHotKeyRef, UInt32, UInt32); + HotKeyItem(uint32_t, uint32_t); + HotKeyItem(EventHotKeyRef, uint32_t, uint32_t); EventHotKeyRef getRef() const; @@ -215,8 +215,8 @@ private: private: EventHotKeyRef m_ref; - UInt32 m_keycode; - UInt32 m_mask; + uint32_t m_keycode; + uint32_t m_mask; }; enum EMouseButtonState @@ -230,22 +230,22 @@ private: class MouseButtonState { public: - void set(UInt32 button, EMouseButtonState state); + void set(uint32_t button, EMouseButtonState state); bool any(); void reset(); - void overwrite(UInt32 buttons); + void overwrite(uint32_t buttons); - bool test(UInt32 button) const; + bool test(uint32_t button) const; int8_t getFirstButtonDown() const; private: std::bitset m_buttons; }; - using HotKeyMap = std::map; - using HotKeyIDList = std::vector; - using ModifierHotKeyMap = std::map; - using HotKeyToIDMap = std::map; + using HotKeyMap = std::map; + using HotKeyIDList = std::vector; + using ModifierHotKeyMap = std::map; + using HotKeyToIDMap = std::map; // true if screen is being used as a primary screen, false otherwise bool m_isPrimary; @@ -285,7 +285,7 @@ private: // clipboards OSXClipboard m_pasteboard; - UInt32 m_sequenceNumber; + uint32_t m_sequenceNumber; // screen saver stuff OSXScreenSaver *m_screensaver; @@ -316,7 +316,7 @@ private: HotKeyMap m_hotKeys; HotKeyIDList m_oldHotKeyIDs; ModifierHotKeyMap m_modifierHotKeys; - UInt32 m_activeModifierHotKey; + uint32_t m_activeModifierHotKey; KeyModifierMask m_activeModifierHotKeyMask; HotKeyToIDMap m_hotKeyToIDMap; diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm index 5904adb2c..37c939692 100644 --- a/src/lib/platform/OSXScreen.mm +++ b/src/lib/platform/OSXScreen.mm @@ -275,7 +275,7 @@ void OSXScreen::getCursorPos(int32_t &x, int32_t &y) const CFRelease(event); } -void OSXScreen::reconfigure(UInt32) +void OSXScreen::reconfigure(uint32_t) { // do nothing } @@ -309,7 +309,7 @@ int32_t OSXScreen::getJumpZoneSize() const return 1; } -bool OSXScreen::isAnyMouseButtonDown(UInt32 &buttonID) const +bool OSXScreen::isAnyMouseButtonDown(uint32_t &buttonID) const { if (m_buttonState.test(0)) { buttonID = kButtonLeft; @@ -325,17 +325,17 @@ void OSXScreen::getCursorCenter(int32_t &x, int32_t &y) const y = m_yCenter; } -UInt32 OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask) +uint32_t OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask) { // get mac virtual key and modifier mask matching deskflow key and mask - UInt32 macKey, macMask; + uint32_t macKey, macMask; if (!m_keyState->mapDeskflowHotKeyToMac(key, mask, macKey, macMask)) { LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask)); return 0; } // choose hotkey id - UInt32 id; + uint32_t id; if (!m_oldHotKeyIDs.empty()) { id = m_oldHotKeyIDs.back(); m_oldHotKeyIDs.pop_back(); @@ -355,7 +355,7 @@ UInt32 OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask) okay = true; } } else { - EventHotKeyID hkid = {'SNRG', (UInt32)id}; + EventHotKeyID hkid = {'SNRG', (uint32_t)id}; OSStatus status = RegisterEventHotKey(macKey, macMask, hkid, GetApplicationEventTarget(), 0, &ref); okay = (status == noErr); m_hotKeyToIDMap[HotKeyItem(macKey, macMask)] = id; @@ -380,7 +380,7 @@ UInt32 OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask) return id; } -void OSXScreen::unregisterHotKey(UInt32 id) +void OSXScreen::unregisterHotKey(uint32_t id) { // look up hotkey HotKeyMap::iterator i = m_hotKeys.find(id); @@ -431,7 +431,7 @@ void OSXScreen::constructMouseButtonEventMap() for (uint16_t button = 0; button < NumButtonIDs; button++) { MouseButtonEventMapType new_map; - for (uint16_t state = (UInt32)kMouseButtonUp; state < kMouseButtonStateMax; state++) { + for (uint16_t state = (uint32_t)kMouseButtonUp; state < kMouseButtonStateMax; state++) { CGEventType curEvent = source[button][state]; new_map[state] = curEvent; } @@ -507,7 +507,7 @@ void OSXScreen::postMouseEvent(CGPoint &pos) const void OSXScreen::fakeMouseButton(ButtonID id, bool press) { // Buttons are indexed from one, but the button down array is indexed from zero - UInt32 index = mapDeskflowButtonToMac(id) - kButtonLeft; + uint32_t index = mapDeskflowButtonToMac(id) - kButtonLeft; if (index >= NumButtonIDs) { return; } @@ -585,7 +585,7 @@ void OSXScreen::getDropTargetThread(void *) { #if defined(MAC_OS_X_VERSION_10_7) // wait for 5 secs for the drop destinaiton string to be filled. - UInt32 timeout = ARCH->time() + 5; + uint32_t timeout = ARCH->time() + 5; m_dropTarget.clear(); while (ARCH->time() < timeout) { @@ -847,7 +847,7 @@ void OSXScreen::leave() DragFileList dragFileList; dragFileList.push_back(di); std::string info; - UInt32 fileCount = DragInformation::setupDragInfo(dragFileList, info); + uint32_t fileCount = DragInformation::setupDragInfo(dragFileList, info); client->sendDragInfo(fileCount, info, info.size()); LOG((CLOG_DEBUG "send dragging file to server")); @@ -920,7 +920,7 @@ void OSXScreen::setOptions(const OptionsList &) // no options } -void OSXScreen::setSequenceNumber(UInt32 seqNum) +void OSXScreen::setSequenceNumber(uint32_t seqNum) { m_sequenceNumber = seqNum; } @@ -948,7 +948,7 @@ void OSXScreen::handleSystemEvent(const Event &event, void *) EventRef *carbonEvent = static_cast(event.getData()); assert(carbonEvent != NULL); - UInt32 eventClass = GetEventClass(*carbonEvent); + uint32_t eventClass = GetEventClass(*carbonEvent); switch (eventClass) { case kEventClassMouse: @@ -1166,7 +1166,7 @@ bool OSXScreen::onKey(CGEventRef event) CGEventType eventKind = CGEventGetType(event); // get the key and active modifiers - UInt32 virtualKey = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode); + uint32_t virtualKey = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode); CGEventFlags macMask = CGEventGetFlags(event); LOG((CLOG_DEBUG1 "event: Key event kind: %d, keycode=%d", eventKind, virtualKey)); @@ -1209,11 +1209,10 @@ bool OSXScreen::onKey(CGEventRef event) HotKeyToIDMap::const_iterator i = m_hotKeyToIDMap.find(HotKeyItem(virtualKey, m_keyState->mapModifiersToCarbon(macMask) & 0xff00u)); if (i != m_hotKeyToIDMap.end()) { - UInt32 id = i->second; + uint32_t id = i->second; // determine event type Event::Type type; - // UInt32 eventKind = GetEventKind(event); if (eventKind == kCGEventKeyDown) { type = m_events->forIPrimaryScreen().hotKeyDown(); } else if (eventKind == kCGEventKeyUp) { @@ -1294,11 +1293,11 @@ bool OSXScreen::onHotKey(EventRef event) const // get the hotkey id EventHotKeyID hkid; GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(EventHotKeyID), NULL, &hkid); - UInt32 id = hkid.id; + uint32_t id = hkid.id; // determine event type Event::Type type; - UInt32 eventKind = GetEventKind(event); + uint32_t eventKind = GetEventKind(event); if (eventKind == kEventHotKeyPressed) { type = m_events->forIPrimaryScreen().hotKeyDown(); } else if (eventKind == kEventHotKeyReleased) { @@ -1413,7 +1412,7 @@ void OSXScreen::handleDrag(const Event &, void *) void OSXScreen::updateButtons() { - UInt32 buttons = GetCurrentButtonState(); + uint32_t buttons = GetCurrentButtonState(); m_buttonState.overwrite(buttons); } @@ -1495,7 +1494,7 @@ bool OSXScreen::updateScreenShape() pascal OSStatus OSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler, EventRef theEvent, void *inUserData) { OSXScreen *screen = (OSXScreen *)inUserData; - UInt32 kind = GetEventKind(theEvent); + uint32_t kind = GetEventKind(theEvent); IEventQueue *events = screen->getEvents(); if (kind == kEventSystemUserSessionDeactivated) { @@ -1738,12 +1737,12 @@ OSXScreen::getGlobalHotKeysEnabled() // OSXScreen::HotKeyItem // -OSXScreen::HotKeyItem::HotKeyItem(UInt32 keycode, UInt32 mask) : m_ref(NULL), m_keycode(keycode), m_mask(mask) +OSXScreen::HotKeyItem::HotKeyItem(uint32_t keycode, uint32_t mask) : m_ref(NULL), m_keycode(keycode), m_mask(mask) { // do nothing } -OSXScreen::HotKeyItem::HotKeyItem(EventHotKeyRef ref, UInt32 keycode, UInt32 mask) +OSXScreen::HotKeyItem::HotKeyItem(EventHotKeyRef ref, uint32_t keycode, uint32_t mask) : m_ref(ref), m_keycode(keycode), m_mask(mask) @@ -1857,7 +1856,7 @@ CGEventRef OSXScreen::handleCGInputEvent(CGEventTapProxy proxy, CGEventType type } } -void OSXScreen::MouseButtonState::set(UInt32 button, EMouseButtonState state) +void OSXScreen::MouseButtonState::set(uint32_t button, EMouseButtonState state) { bool newState = (state == kMouseButtonDown); m_buttons.set(button, newState); @@ -1873,12 +1872,12 @@ void OSXScreen::MouseButtonState::reset() m_buttons.reset(); } -void OSXScreen::MouseButtonState::overwrite(UInt32 buttons) +void OSXScreen::MouseButtonState::overwrite(uint32_t buttons) { m_buttons = std::bitset(buttons); } -bool OSXScreen::MouseButtonState::test(UInt32 button) const +bool OSXScreen::MouseButtonState::test(uint32_t button) const { return m_buttons.test(button); } diff --git a/src/lib/platform/OSXScreenSaver.cpp b/src/lib/platform/OSXScreenSaver.cpp index 22dac106e..dd262019a 100644 --- a/src/lib/platform/OSXScreenSaver.cpp +++ b/src/lib/platform/OSXScreenSaver.cpp @@ -135,7 +135,7 @@ OSXScreenSaver::launchTerminationCallback(EventHandlerCallRef nextHandler, Event if ((result == noErr) && (actualSize > 0) && (actualType == typeProcessSerialNumber)) { OSXScreenSaver *screenSaver = (OSXScreenSaver *)userData; - UInt32 eventKind = GetEventKind(theEvent); + uint32_t eventKind = GetEventKind(theEvent); if (eventKind == kEventAppLaunched) { screenSaver->processLaunched(psn); } else if (eventKind == kEventAppTerminated) { diff --git a/src/lib/platform/OSXUchrKeyResource.cpp b/src/lib/platform/OSXUchrKeyResource.cpp index 22ef38e5e..339f51f14 100644 --- a/src/lib/platform/OSXUchrKeyResource.cpp +++ b/src/lib/platform/OSXUchrKeyResource.cpp @@ -23,7 +23,7 @@ // OSXUchrKeyResource // -OSXUchrKeyResource::OSXUchrKeyResource(const void *resource, UInt32 keyboardType) +OSXUchrKeyResource::OSXUchrKeyResource(const void *resource, uint32_t keyboardType) : m_m(NULL), m_cti(NULL), m_sdi(NULL), @@ -70,8 +70,8 @@ OSXUchrKeyResource::OSXUchrKeyResource(const void *resource, UInt32 keyboardType // a dead key followed by a space yields the non-dead version of // the dead key. m_spaceOutput = 0xffffu; - UInt32 table = getTableForModifier(0); - for (UInt32 button = 0, n = getNumButtons(); button < n; ++button) { + uint32_t table = getTableForModifier(0); + for (uint32_t button = 0, n = getNumButtons(); button < n; ++button) { KeyID id = getKey(table, button); if (id == 0x20) { UCKeyOutput c = reinterpret_cast(base + m_cti->keyToCharTableOffsets[table])[button]; @@ -88,23 +88,23 @@ bool OSXUchrKeyResource::isValid() const return (m_m != NULL); } -UInt32 OSXUchrKeyResource::getNumModifierCombinations() const +uint32_t OSXUchrKeyResource::getNumModifierCombinations() const { // only 32 (not 256) because the righthanded modifier bits are ignored return 32; } -UInt32 OSXUchrKeyResource::getNumTables() const +uint32_t OSXUchrKeyResource::getNumTables() const { return m_cti->keyToCharTableCount; } -UInt32 OSXUchrKeyResource::getNumButtons() const +uint32_t OSXUchrKeyResource::getNumButtons() const { return m_cti->keyToCharTableSize; } -UInt32 OSXUchrKeyResource::getTableForModifier(UInt32 mask) const +uint32_t OSXUchrKeyResource::getTableForModifier(uint32_t mask) const { if (mask >= m_m->modifiersCount) { return m_m->defaultTableNum; @@ -113,7 +113,7 @@ UInt32 OSXUchrKeyResource::getTableForModifier(UInt32 mask) const } } -KeyID OSXUchrKeyResource::getKey(UInt32 table, UInt32 button) const +KeyID OSXUchrKeyResource::getKey(uint32_t table, uint32_t button) const { assert(table < getNumTables()); assert(button < getNumButtons()); diff --git a/src/lib/platform/OSXUchrKeyResource.h b/src/lib/platform/OSXUchrKeyResource.h index c5888a3df..aa91b1df7 100644 --- a/src/lib/platform/OSXUchrKeyResource.h +++ b/src/lib/platform/OSXUchrKeyResource.h @@ -27,15 +27,15 @@ using KeyLayout = TISInputSourceRef; class OSXUchrKeyResource : public IOSXKeyResource { public: - OSXUchrKeyResource(const void *, UInt32 keyboardType); + OSXUchrKeyResource(const void *, uint32_t keyboardType); // KeyResource overrides virtual bool isValid() const; - virtual UInt32 getNumModifierCombinations() const; - virtual UInt32 getNumTables() const; - virtual UInt32 getNumButtons() const; - virtual UInt32 getTableForModifier(UInt32 mask) const; - virtual KeyID getKey(UInt32 table, UInt32 button) const; + virtual uint32_t getNumModifierCombinations() const; + virtual uint32_t getNumTables() const; + virtual uint32_t getNumButtons() const; + virtual uint32_t getTableForModifier(uint32_t mask) const; + virtual KeyID getKey(uint32_t table, uint32_t button) const; private: using KeySequence = std::vector; diff --git a/src/lib/platform/XWindowsClipboard.cpp b/src/lib/platform/XWindowsClipboard.cpp index 5092c493d..07da9003e 100644 --- a/src/lib/platform/XWindowsClipboard.cpp +++ b/src/lib/platform/XWindowsClipboard.cpp @@ -477,7 +477,7 @@ void XWindowsClipboard::icccmFillCache() XWindowsUtil::convertAtomProperty(data); auto targets = static_cast(static_cast(data.data())); - const UInt32 numTargets = data.size() / sizeof(Atom); + const uint32_t numTargets = data.size() / sizeof(Atom); LOG((CLOG_DEBUG " available targets: %s", XWindowsUtil::atomsToString(m_display, targets, numTargets).c_str())); // try each converter in order (because they're in order of @@ -497,7 +497,7 @@ void XWindowsClipboard::icccmFillCache() // owners that don't report all the targets they support. target = converter->getAtom(); /* - for (UInt32 i = 0; i < numTargets; ++i) { + for (uint32_t i = 0; i < numTargets; ++i) { if (converter->getAtom() == targets[i]) { target = targets[i]; break; @@ -705,7 +705,6 @@ void XWindowsClipboard::motifFillCache() // save it motifFormats.insert(std::make_pair(motifFormat.m_type, data)); } - // const UInt32 numMotifFormats = motifFormats.size(); // try each converter in order (because they're in order of // preference). @@ -790,11 +789,11 @@ bool XWindowsClipboard::insertMultipleReply(Window requestor, ::Time time, Atom // data is a list of atom pairs: target, property XWindowsUtil::convertAtomProperty(data); auto targets = static_cast(static_cast(data.data())); - const UInt32 numTargets = data.size() / sizeof(Atom); + const uint32_t numTargets = data.size() / sizeof(Atom); // add replies for each target bool changed = false; - for (UInt32 i = 0; i < numTargets; i += 2) { + for (uint32_t i = 0; i < numTargets; i += 2) { const Atom target = targets[i + 0]; const Atom property = targets[i + 1]; if (!addSimpleRequest(requestor, target, time, property)) { @@ -930,12 +929,12 @@ bool XWindowsClipboard::sendReply(Reply *reply) // send using INCR if already sending incrementally or if reply // is too large, otherwise just send it. - const UInt32 maxRequestSize = 3 * XMaxRequestSize(m_display); + const uint32_t maxRequestSize = 3 * XMaxRequestSize(m_display); const bool useINCR = (reply->m_data.size() > maxRequestSize); // send INCR reply if incremental and we haven't replied yet if (useINCR && !reply->m_replied) { - UInt32 size = reply->m_data.size(); + uint32_t size = reply->m_data.size(); if (!XWindowsUtil::setWindowProperty( m_display, reply->m_requestor, reply->m_property, &size, 4, m_atomINCR, 32 )) { @@ -946,7 +945,7 @@ bool XWindowsClipboard::sendReply(Reply *reply) // send more INCR reply or entire non-incremental reply else { // how much more data should we send? - UInt32 size = reply->m_data.size() - reply->m_ptr; + uint32_t size = reply->m_data.size() - reply->m_ptr; if (size > maxRequestSize) size = maxRequestSize; @@ -1255,7 +1254,7 @@ bool XWindowsClipboard::CICCCMGetClipboard::readClipboard( } // put unprocessed events back - for (UInt32 i = events.size(); i > 0; --i) { + for (uint32_t i = events.size(); i > 0; --i) { XPutBackEvent(display, &events[i - 1]); } diff --git a/src/lib/platform/XWindowsClipboard.h b/src/lib/platform/XWindowsClipboard.h index b5c278465..894052524 100644 --- a/src/lib/platform/XWindowsClipboard.h +++ b/src/lib/platform/XWindowsClipboard.h @@ -256,7 +256,7 @@ protected: int m_format; // index of next byte in m_data to send - UInt32 m_ptr; + uint32_t m_ptr; }; using ReplyList = std::list; using ReplyMap = std::map; diff --git a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp index 48c80336f..980ee7939 100644 --- a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp +++ b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp @@ -22,17 +22,17 @@ struct CBMPInfoHeader { public: - UInt32 biSize; + uint32_t biSize; int32_t biWidth; int32_t biHeight; uint16_t biPlanes; uint16_t biBitCount; - UInt32 biCompression; - UInt32 biSizeImage; + uint32_t biCompression; + uint32_t biSizeImage; int32_t biXPelsPerMeter; int32_t biYPelsPerMeter; - UInt32 biClrUsed; - UInt32 biClrImportant; + uint32_t biClrUsed; + uint32_t biClrImportant; }; // BMP is little-endian @@ -53,7 +53,7 @@ static void toLE(uint8_t *&dst, int32_t src) dst += 4; } -static void toLE(uint8_t *&dst, UInt32 src) +static void toLE(uint8_t *&dst, uint32_t src) { dst[0] = static_cast(src & 0xffu); dst[1] = static_cast((src >> 8) & 0xffu); @@ -70,15 +70,15 @@ static inline uint16_t fromLEU16(const uint8_t *data) static inline int32_t fromLES32(const uint8_t *data) { return static_cast( - static_cast(data[0]) | (static_cast(data[1]) << 8) | (static_cast(data[2]) << 16) | - (static_cast(data[3]) << 24) + static_cast(data[0]) | (static_cast(data[1]) << 8) | (static_cast(data[2]) << 16) | + (static_cast(data[3]) << 24) ); } -static inline UInt32 fromLEU32(const uint8_t *data) +static inline uint32_t fromLEU32(const uint8_t *data) { - return static_cast(data[0]) | (static_cast(data[1]) << 8) | (static_cast(data[2]) << 16) | - (static_cast(data[3]) << 24); + return static_cast(data[0]) | (static_cast(data[1]) << 8) | + (static_cast(data[2]) << 16) | (static_cast(data[3]) << 24); } // @@ -140,7 +140,7 @@ std::string XWindowsClipboardAnyBitmapConverter::fromIClipboard(const std::strin std::string XWindowsClipboardAnyBitmapConverter::toIClipboard(const std::string &image) const { // convert to raw BMP data - UInt32 w, h, depth; + uint32_t w, h, depth; std::string rawBMP = doToIClipboard(image, w, h, depth); if (rawBMP.empty() || w == 0 || h == 0 || (depth != 24 && depth != 32)) { return std::string(); @@ -149,17 +149,17 @@ std::string XWindowsClipboardAnyBitmapConverter::toIClipboard(const std::string // fill BMP info header with little-endian data uint8_t infoHeader[40]; uint8_t *dst = infoHeader; - toLE(dst, static_cast(40)); + toLE(dst, static_cast(40)); toLE(dst, static_cast(w)); toLE(dst, static_cast(h)); toLE(dst, static_cast(1)); toLE(dst, static_cast(depth)); - toLE(dst, static_cast(0)); // BI_RGB - toLE(dst, static_cast(image.size())); + toLE(dst, static_cast(0)); // BI_RGB + toLE(dst, static_cast(image.size())); toLE(dst, static_cast(2834)); // 72 dpi toLE(dst, static_cast(2834)); // 72 dpi - toLE(dst, static_cast(0)); - toLE(dst, static_cast(0)); + toLE(dst, static_cast(0)); + toLE(dst, static_cast(0)); // construct image return std::string(reinterpret_cast(infoHeader), sizeof(infoHeader)) + rawBMP; diff --git a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h index 79320e18a..0d87fa649 100644 --- a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h +++ b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h @@ -39,18 +39,18 @@ protected: /*! Convert raw BGR pixel data to another image format. */ - virtual std::string doBGRFromIClipboard(const uint8_t *bgrData, UInt32 w, UInt32 h) const = 0; + virtual std::string doBGRFromIClipboard(const uint8_t *bgrData, uint32_t w, uint32_t h) const = 0; //! Convert from IClipboard format /*! Convert raw BGRA pixel data to another image format. */ - virtual std::string doBGRAFromIClipboard(const uint8_t *bgrData, UInt32 w, UInt32 h) const = 0; + virtual std::string doBGRAFromIClipboard(const uint8_t *bgrData, uint32_t w, uint32_t h) const = 0; //! Convert to IClipboard format /*! Convert an image into raw BGR or BGRA image data and store the width, height, and image depth (24 or 32). */ - virtual std::string doToIClipboard(const std::string &, UInt32 &w, UInt32 &h, UInt32 &depth) const = 0; + virtual std::string doToIClipboard(const std::string &, uint32_t &w, uint32_t &h, uint32_t &depth) const = 0; }; diff --git a/src/lib/platform/XWindowsClipboardBMPConverter.cpp b/src/lib/platform/XWindowsClipboardBMPConverter.cpp index 5bf8e99bf..3f1be2229 100644 --- a/src/lib/platform/XWindowsClipboardBMPConverter.cpp +++ b/src/lib/platform/XWindowsClipboardBMPConverter.cpp @@ -23,17 +23,17 @@ struct CBMPHeader { public: uint16_t type; - UInt32 size; + uint32_t size; uint16_t reserved1; uint16_t reserved2; - UInt32 offset; + uint32_t offset; }; // BMP is little-endian -static inline UInt32 fromLEU32(const uint8_t *data) +static inline uint32_t fromLEU32(const uint8_t *data) { - return static_cast(data[0]) | (static_cast(data[1]) << 8) | (static_cast(data[2]) << 16) | - (static_cast(data[3]) << 24); + return static_cast(data[0]) | (static_cast(data[1]) << 8) | + (static_cast(data[2]) << 16) | (static_cast(data[3]) << 24); } static void toLE(uint8_t *&dst, char src) @@ -49,7 +49,7 @@ static void toLE(uint8_t *&dst, uint16_t src) dst += 2; } -static void toLE(uint8_t *&dst, UInt32 src) +static void toLE(uint8_t *&dst, uint32_t src) { dst[0] = static_cast(src & 0xffu); dst[1] = static_cast((src >> 8) & 0xffu); @@ -95,10 +95,10 @@ std::string XWindowsClipboardBMPConverter::fromIClipboard(const std::string &bmp uint8_t *dst = header; toLE(dst, 'B'); toLE(dst, 'M'); - toLE(dst, static_cast(14 + bmp.size())); + toLE(dst, static_cast(14 + bmp.size())); toLE(dst, static_cast(0)); toLE(dst, static_cast(0)); - toLE(dst, static_cast(14 + 40)); + toLE(dst, static_cast(14 + 40)); return std::string(reinterpret_cast(header), 14) + bmp; } @@ -116,7 +116,7 @@ std::string XWindowsClipboardBMPConverter::toIClipboard(const std::string &bmp) } // get offset to image data - UInt32 offset = fromLEU32(rawBMPHeader + 10); + uint32_t offset = fromLEU32(rawBMPHeader + 10); // construct BMP if (offset == 14 + 40) { diff --git a/src/lib/platform/XWindowsEventQueueBuffer.cpp b/src/lib/platform/XWindowsEventQueueBuffer.cpp index 6d5820148..47e07c1de 100644 --- a/src/lib/platform/XWindowsEventQueueBuffer.cpp +++ b/src/lib/platform/XWindowsEventQueueBuffer.cpp @@ -146,7 +146,7 @@ void XWindowsEventQueueBuffer::waitForEvent(double dtimeout) Thread::testCancel(); } -IEventQueueBuffer::Type XWindowsEventQueueBuffer::getEvent(Event &event, UInt32 &dataID) +IEventQueueBuffer::Type XWindowsEventQueueBuffer::getEvent(Event &event, uint32_t &dataID) { Lock lock(&m_mutex); @@ -158,7 +158,7 @@ IEventQueueBuffer::Type XWindowsEventQueueBuffer::getEvent(Event &event, UInt32 // process event if (m_event.xany.type == ClientMessage && m_event.xclient.message_type == m_userEvent) { - dataID = static_cast(m_event.xclient.data.l[0]); + dataID = static_cast(m_event.xclient.data.l[0]); return kUser; } else { event = Event(Event::kSystem, m_events->getSystemTarget(), &m_event); @@ -166,7 +166,7 @@ IEventQueueBuffer::Type XWindowsEventQueueBuffer::getEvent(Event &event, UInt32 } } -bool XWindowsEventQueueBuffer::addEvent(UInt32 dataID) +bool XWindowsEventQueueBuffer::addEvent(uint32_t dataID) { // prepare a message XEvent xevent; diff --git a/src/lib/platform/XWindowsEventQueueBuffer.h b/src/lib/platform/XWindowsEventQueueBuffer.h index 066b02f63..04330076f 100644 --- a/src/lib/platform/XWindowsEventQueueBuffer.h +++ b/src/lib/platform/XWindowsEventQueueBuffer.h @@ -47,8 +47,8 @@ public: { } virtual void waitForEvent(double timeout); - virtual Type getEvent(Event &event, UInt32 &dataID); - virtual bool addEvent(UInt32 dataID); + virtual Type getEvent(Event &event, uint32_t &dataID); + virtual bool addEvent(uint32_t dataID); virtual bool isEmpty() const; virtual EventQueueTimer *newTimer(double duration, bool oneShot) const; virtual void deleteTimer(EventQueueTimer *) const; diff --git a/src/lib/platform/XWindowsKeyState.cpp b/src/lib/platform/XWindowsKeyState.cpp index b6e55831c..97a85549b 100644 --- a/src/lib/platform/XWindowsKeyState.cpp +++ b/src/lib/platform/XWindowsKeyState.cpp @@ -112,7 +112,7 @@ void XWindowsKeyState::setAutoRepeat(const XKeyboardState &state) KeyModifierMask XWindowsKeyState::mapModifiersFromX(unsigned int state) const { LOG((CLOG_DEBUG2 "mapping state: %i", state)); - UInt32 offset = 8 * getGroupFromState(state); + uint32_t offset = 8 * getGroupFromState(state); KeyModifierMask mask = 0; for (int i = 0; i < 8; ++i) { if ((state & (1u << i)) != 0) { @@ -201,8 +201,8 @@ void XWindowsKeyState::pollPressedKeys(KeyButtonSet &pressedKeys) const { char keys[32]; XQueryKeymap(m_display, keys); - for (UInt32 i = 0; i < 32; ++i) { - for (UInt32 j = 0; j < 8; ++j) { + for (uint32_t i = 0; i < 32; ++i) { + for (uint32_t j = 0; j < 8; ++j) { if ((keys[i] & (1u << j)) != 0) { pressedKeys.insert(8 * i + j); } @@ -666,7 +666,7 @@ void XWindowsKeyState::updateKeysymMapXKB(deskflow::KeyMap &keyMap) // modifier masks. item.m_lock = false; bool isModifier = false; - UInt32 modifierMask = m_xkb->map->modmap[keycode]; + uint32_t modifierMask = m_xkb->map->modmap[keycode]; if (XkbKeyHasActions(m_xkb, keycode) == True) { XkbAction *action = XkbKeyActionEntry(m_xkb, keycode, level, eGroup); if (action->type == XkbSA_SetMods || action->type == XkbSA_LockMods) { @@ -708,7 +708,7 @@ void XWindowsKeyState::updateKeysymMapXKB(deskflow::KeyMap &keyMap) // record the modifier mask for this key. don't bother // for keys that change the group. item.m_generates = 0; - UInt32 modifierBit = XWindowsUtil::getModifierBitForKeySym(keysym); + uint32_t modifierBit = XWindowsUtil::getModifierBitForKeySym(keysym); if (isModifier && modifierBit != kKeyModifierBitNone) { item.m_generates = (1u << modifierBit); for (int32_t j = 0; j < 8; ++j) { @@ -855,7 +855,7 @@ int XWindowsKeyState::getEffectiveGroup(KeyCode keycode, int group) const return group; } -UInt32 XWindowsKeyState::getGroupFromState(unsigned int state) const +uint32_t XWindowsKeyState::getGroupFromState(unsigned int state) const { #if HAVE_XKB_EXTENSION if (m_xkb != NULL) { diff --git a/src/lib/platform/XWindowsKeyState.h b/src/lib/platform/XWindowsKeyState.h index f06d9b875..98300f1f1 100644 --- a/src/lib/platform/XWindowsKeyState.h +++ b/src/lib/platform/XWindowsKeyState.h @@ -120,7 +120,7 @@ private: void updateKeysymMapXKB(deskflow::KeyMap &); bool hasModifiersXKB() const; int getEffectiveGroup(KeyCode, int group) const; - UInt32 getGroupFromState(unsigned int state) const; + uint32_t getGroupFromState(unsigned int state) const; //! Create and send language change request to \p group by DBus interface /*! @@ -135,7 +135,7 @@ private: { public: unsigned char m_level; - UInt32 m_mask; + uint32_t m_mask; bool m_lock; }; @@ -148,7 +148,7 @@ private: using KeyModifierToXMask = std::map; using KeyToKeyCodeMap = std::multimap; using NonXKBModifierMap = std::map; - using XKBModifierMap = std::map; + using XKBModifierMap = std::map; Display *m_display; #if HAVE_XKB_EXTENSION diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index f844e9d22..fa197ba02 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -450,7 +450,7 @@ void XWindowsScreen::resetOptions() void XWindowsScreen::setOptions(const OptionsList &options) { - for (UInt32 i = 0, n = options.size(); i < n; i += 2) { + for (uint32_t i = 0, n = options.size(); i < n; i += 2) { if (options[i] == kOptionXTestXineramaUnaware) { m_xtestIsXineramaUnaware = (options[i + 1] != 0); LOG((CLOG_DEBUG1 "library, XTest is Xinerama unaware %s", m_xtestIsXineramaUnaware ? "true" : "false")); @@ -461,7 +461,7 @@ void XWindowsScreen::setOptions(const OptionsList &options) } } -void XWindowsScreen::setSequenceNumber(UInt32 seqNum) +void XWindowsScreen::setSequenceNumber(uint32_t seqNum) { m_sequenceNumber = seqNum; } @@ -520,7 +520,7 @@ void XWindowsScreen::getCursorPos(int32_t &x, int32_t &y) const } } -void XWindowsScreen::reconfigure(UInt32) +void XWindowsScreen::reconfigure(uint32_t) { // do nothing } @@ -544,7 +544,7 @@ void XWindowsScreen::warpCursor(int32_t x, int32_t y) m_yCursor = y; } -UInt32 XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) +uint32_t XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) { // only allow certain modifiers if ((mask & ~(KeyModifierShift | KeyModifierControl | KeyModifierAlt | KeyModifierSuper)) != 0) { @@ -573,7 +573,7 @@ UInt32 XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) } // choose hotkey id - UInt32 id; + uint32_t id; if (!m_oldHotKeyIDs.empty()) { id = m_oldHotKeyIDs.back(); m_oldHotKeyIDs.pop_back(); @@ -731,7 +731,7 @@ UInt32 XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) return id; } -void XWindowsScreen::unregisterHotKey(UInt32 id) +void XWindowsScreen::unregisterHotKey(uint32_t id) { // look up hotkey HotKeyMap::iterator i = m_hotKeys.find(id); @@ -775,7 +775,7 @@ int32_t XWindowsScreen::getJumpZoneSize() const return 1; } -bool XWindowsScreen::isAnyMouseButtonDown(UInt32 &buttonID) const +bool XWindowsScreen::isAnyMouseButtonDown(uint32_t &buttonID) const { // query the pointer to get the button state Window root, window; @@ -1878,13 +1878,13 @@ void XWindowsScreen::warpCursorNoFlush(int32_t x, int32_t y) void XWindowsScreen::updateButtons() { // query the button mapping - UInt32 numButtons = XGetPointerMapping(m_display, NULL, 0); + uint32_t numButtons = XGetPointerMapping(m_display, NULL, 0); unsigned char *tmpButtons = new unsigned char[numButtons]; XGetPointerMapping(m_display, tmpButtons, numButtons); // find the largest logical button id unsigned char maxButton = 0; - for (UInt32 i = 0; i < numButtons; ++i) { + for (uint32_t i = 0; i < numButtons; ++i) { if (tmpButtons[i] > maxButton) { maxButton = tmpButtons[i]; } @@ -1895,10 +1895,10 @@ void XWindowsScreen::updateButtons() // fill in button array values. m_buttons[i] is the physical // button number for logical button i+1. - for (UInt32 i = 0; i < numButtons; ++i) { + for (uint32_t i = 0; i < numButtons; ++i) { m_buttons[i] = 0; } - for (UInt32 i = 0; i < numButtons; ++i) { + for (uint32_t i = 0; i < numButtons; ++i) { m_buttons[tmpButtons[i] - 1] = i + 1; } diff --git a/src/lib/platform/XWindowsScreen.h b/src/lib/platform/XWindowsScreen.h index bebe8fffa..b520ba907 100644 --- a/src/lib/platform/XWindowsScreen.h +++ b/src/lib/platform/XWindowsScreen.h @@ -58,14 +58,14 @@ public: void getCursorPos(int32_t &x, int32_t &y) const override; // IPrimaryScreen overrides - void reconfigure(UInt32 activeSides) override; + void reconfigure(uint32_t activeSides) override; void warpCursor(int32_t x, int32_t y) override; - UInt32 registerHotKey(KeyID key, KeyModifierMask mask) override; - void unregisterHotKey(UInt32 id) override; + uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override; + void unregisterHotKey(uint32_t id) override; void fakeInputBegin() override; void fakeInputEnd() override; int32_t getJumpZoneSize() const override; - bool isAnyMouseButtonDown(UInt32 &buttonID) const override; + bool isAnyMouseButtonDown(uint32_t &buttonID) const override; void getCursorCenter(int32_t &x, int32_t &y) const override; // ISecondaryScreen overrides @@ -87,7 +87,7 @@ public: void screensaver(bool activate) override; void resetOptions() override; void setOptions(const OptionsList &options) override; - void setSequenceNumber(UInt32) override; + void setSequenceNumber(uint32_t) override; bool isPrimary() const override; std::string getSecureInputApp() const override; @@ -174,9 +174,9 @@ private: }; using FilteredKeycodes = std::set; using HotKeyList = std::vector>; - using HotKeyMap = std::map; - using HotKeyIDList = std::vector; - using HotKeyToIDMap = std::map; + using HotKeyMap = std::map; + using HotKeyIDList = std::vector; + using HotKeyToIDMap = std::map; // true if screen is being used as a primary screen, false otherwise bool m_isPrimary; @@ -217,7 +217,7 @@ private: // clipboards XWindowsClipboard *m_clipboard[kClipboardEnd]; - UInt32 m_sequenceNumber; + uint32_t m_sequenceNumber; // screen saver stuff XWindowsScreenSaver *m_screensaver; diff --git a/src/lib/platform/XWindowsUtil.cpp b/src/lib/platform/XWindowsUtil.cpp index aa343b029..762034b1b 100644 --- a/src/lib/platform/XWindowsUtil.cpp +++ b/src/lib/platform/XWindowsUtil.cpp @@ -79,7 +79,7 @@ struct codepair { KeySym keysym; - UInt32 ucs4; + uint32_t ucs4; } s_keymap[] = { {XK_Aogonek, 0x0104}, /* LATIN CAPITAL LETTER A WITH OGONEK */ {XK_breve, 0x02d8}, /* BREVE */ @@ -1601,12 +1601,12 @@ bool XWindowsUtil::getWindowProperty( } bool XWindowsUtil::setWindowProperty( - Display *display, Window window, Atom property, const void *vdata, UInt32 size, Atom type, int32_t format + Display *display, Window window, Atom property, const void *vdata, uint32_t size, Atom type, int32_t format ) { - const UInt32 length = 4 * XMaxRequestSize(display); + const uint32_t length = 4 * XMaxRequestSize(display); const unsigned char *data = static_cast(vdata); - UInt32 datumSize = static_cast(format / 8); + uint32_t datumSize = static_cast(format / 8); // format 32 on 64bit systems is 8 bytes not 4. if (format == 32) { datumSize = sizeof(Atom); @@ -1617,7 +1617,7 @@ bool XWindowsUtil::setWindowProperty( XWindowsUtil::ErrorLock lock(display, &error); // how much data to send in first chunk? - UInt32 chunkSize = size; + uint32_t chunkSize = size; if (chunkSize > length) { chunkSize = length; } @@ -1768,7 +1768,7 @@ KeyID XWindowsUtil::mapKeySymToKeyID(KeySym k) } } -UInt32 XWindowsUtil::getModifierBitForKeySym(KeySym keysym) +uint32_t XWindowsUtil::getModifierBitForKeySym(KeySym keysym) { switch (keysym) { case XK_Shift_L: @@ -1834,7 +1834,7 @@ std::string XWindowsUtil::atomToString(Display *display, Atom atom) } } -std::string XWindowsUtil::atomsToString(Display *display, const Atom *atom, UInt32 num) +std::string XWindowsUtil::atomsToString(Display *display, const Atom *atom, uint32_t num) { char **names = new char *[num]; bool error = false; @@ -1842,11 +1842,11 @@ std::string XWindowsUtil::atomsToString(Display *display, const Atom *atom, UInt XGetAtomNames(display, const_cast(atom), (int)num, names); std::string msg; if (error) { - for (UInt32 i = 0; i < num; ++i) { + for (uint32_t i = 0; i < num; ++i) { msg += deskflow::string::sprintf(" (%d), ", (int)atom[i]); } } else { - for (UInt32 i = 0; i < num; ++i) { + for (uint32_t i = 0; i < num; ++i) { msg += deskflow::string::sprintf("%s (%d), ", names[i], (int)atom[i]); XFree(names[i]); } @@ -1867,7 +1867,7 @@ void XWindowsUtil::convertAtomProperty(std::string &data) // should all be 0. since we're going to reference the Atoms as // 64-bit numbers we have to ensure the last number is a full 64 bits. if (sizeof(Atom) != 4 && ((data.size() / 4) & 1) != 0) { - UInt32 zero = 0; + uint32_t zero = 0; data.append(reinterpret_cast(&zero), sizeof(zero)); } } @@ -1877,7 +1877,7 @@ void XWindowsUtil::appendAtomData(std::string &data, Atom atom) data.append(reinterpret_cast(&atom), sizeof(Atom)); } -void XWindowsUtil::replaceAtomData(std::string &data, UInt32 index, Atom atom) +void XWindowsUtil::replaceAtomData(std::string &data, uint32_t index, Atom atom) { data.replace(index * sizeof(Atom), sizeof(Atom), reinterpret_cast(&atom), sizeof(Atom)); } diff --git a/src/lib/platform/XWindowsUtil.h b/src/lib/platform/XWindowsUtil.h index 04d7a3bc3..937c8aabc 100644 --- a/src/lib/platform/XWindowsUtil.h +++ b/src/lib/platform/XWindowsUtil.h @@ -53,8 +53,9 @@ public: Sets property \c property on \c window to \c size bytes of data from \c data. */ - static bool - setWindowProperty(Display *, Window window, Atom property, const void *data, UInt32 size, Atom type, int32_t format); + static bool setWindowProperty( + Display *, Window window, Atom property, const void *data, uint32_t size, Atom type, int32_t format + ); //! Get X server time /*! @@ -67,14 +68,14 @@ public: Converts a KeySym to the equivalent KeyID. Returns kKeyNone if the KeySym cannot be mapped. */ - static UInt32 mapKeySymToKeyID(KeySym); + static uint32_t mapKeySymToKeyID(KeySym); //! Convert KeySym to corresponding KeyModifierMask /*! Converts a KeySym to the corresponding KeyModifierMask, or 0 if the KeySym is not a modifier. */ - static UInt32 getModifierBitForKeySym(KeySym keysym); + static uint32_t getModifierBitForKeySym(KeySym keysym); //! Convert Atom to its string /*! @@ -87,7 +88,7 @@ public: Converts each atom in \p atoms to its string representation and concatenates the results. */ - static std::string atomsToString(Display *display, const Atom *atom, UInt32 num); + static std::string atomsToString(Display *display, const Atom *atom, uint32_t num); //! Prepare a property of atoms for use /*! @@ -108,7 +109,7 @@ public: Converts \p atom to a 32-bit on-the-wire format and replaces the atom at index \p index in \p data. */ - static void replaceAtomData(std::string &data, UInt32 index, Atom atom); + static void replaceAtomData(std::string &data, uint32_t index, Atom atom); //! Append an Time to property data /*! @@ -184,7 +185,7 @@ private: static void initKeyMaps(); private: - typedef std::map KeySymMap; + typedef std::map KeySymMap; static KeySymMap s_keySymToUCS4; }; diff --git a/src/lib/server/BaseClientProxy.h b/src/lib/server/BaseClientProxy.h index 5fdd890e3..55f02ec8c 100644 --- a/src/lib/server/BaseClientProxy.h +++ b/src/lib/server/BaseClientProxy.h @@ -71,7 +71,7 @@ public: virtual void getCursorPos(int32_t &x, int32_t &y) const = 0; // IClient overrides - virtual void enter(int32_t xAbs, int32_t yAbs, UInt32 seqNum, KeyModifierMask mask, bool forScreensaver) = 0; + virtual void enter(int32_t xAbs, int32_t yAbs, uint32_t seqNum, KeyModifierMask mask, bool forScreensaver) = 0; virtual bool leave() = 0; virtual void setClipboard(ClipboardID, const IClipboard *) = 0; virtual void grabClipboard(ClipboardID) = 0; @@ -87,7 +87,7 @@ public: virtual void screensaver(bool activate) = 0; virtual void resetOptions() = 0; virtual void setOptions(const OptionsList &options) = 0; - virtual void sendDragInfo(UInt32 fileCount, const char *info, size_t size) = 0; + virtual void sendDragInfo(uint32_t fileCount, const char *info, size_t size) = 0; virtual void fileChunkSending(uint8_t mark, char *data, size_t dataSize) = 0; virtual std::string getSecureInputApp() const = 0; virtual void secureInputNotification(const std::string &app) const = 0; diff --git a/src/lib/server/ClientProxy.h b/src/lib/server/ClientProxy.h index 4595e0030..fda4f6142 100644 --- a/src/lib/server/ClientProxy.h +++ b/src/lib/server/ClientProxy.h @@ -69,7 +69,7 @@ public: void getCursorPos(int32_t &x, int32_t &y) const override = 0; // IClient overrides - void enter(int32_t xAbs, int32_t yAbs, UInt32 seqNum, KeyModifierMask mask, bool forScreensaver) override = 0; + void enter(int32_t xAbs, int32_t yAbs, uint32_t seqNum, KeyModifierMask mask, bool forScreensaver) override = 0; bool leave() override = 0; void setClipboard(ClipboardID, const IClipboard *) override = 0; void grabClipboard(ClipboardID) override = 0; @@ -85,7 +85,7 @@ public: void screensaver(bool activate) override = 0; void resetOptions() override = 0; void setOptions(const OptionsList &options) override = 0; - void sendDragInfo(UInt32 fileCount, const char *info, size_t size) override = 0; + void sendDragInfo(uint32_t fileCount, const char *info, size_t size) override = 0; void fileChunkSending(uint8_t mark, char *data, size_t dataSize) override = 0; void secureInputNotification(const std::string &app) const override = 0; diff --git a/src/lib/server/ClientProxy1_0.cpp b/src/lib/server/ClientProxy1_0.cpp index 7f844a21c..8b1856d6c 100644 --- a/src/lib/server/ClientProxy1_0.cpp +++ b/src/lib/server/ClientProxy1_0.cpp @@ -130,7 +130,7 @@ void ClientProxy1_0::handleData(const Event &, void *) { // handle messages until there are no more. first read message code. uint8_t code[4]; - UInt32 n = getStream()->read(code, 4); + uint32_t n = getStream()->read(code, 4); while (n != 0) { // verify we got an entire code if (n != 4) { @@ -244,7 +244,7 @@ void ClientProxy1_0::getCursorPos(int32_t &x, int32_t &y) const y = m_info.m_my; } -void ClientProxy1_0::enter(int32_t xAbs, int32_t yAbs, UInt32 seqNum, KeyModifierMask mask, bool) +void ClientProxy1_0::enter(int32_t xAbs, int32_t yAbs, uint32_t seqNum, KeyModifierMask mask, bool) { LOG((CLOG_DEBUG1 "send enter to \"%s\", %d,%d %d %04x", getName().c_str(), xAbs, yAbs, seqNum, mask)); ProtocolUtil::writef(getStream(), kMsgCEnter, xAbs, yAbs, seqNum, mask); @@ -326,7 +326,7 @@ void ClientProxy1_0::mouseWheel(int32_t, int32_t yDelta) ProtocolUtil::writef(getStream(), kMsgDMouseWheel1_0, yDelta); } -void ClientProxy1_0::sendDragInfo(UInt32 fileCount, const char *info, size_t size) +void ClientProxy1_0::sendDragInfo(uint32_t fileCount, const char *info, size_t size) { // ignore -- not supported in protocol 1.0 LOG((CLOG_DEBUG "draggingInfoSending not supported")); @@ -374,7 +374,7 @@ void ClientProxy1_0::setOptions(const OptionsList &options) ProtocolUtil::writef(getStream(), kMsgDSetOptions, &options); // check options - for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) { + for (uint32_t i = 0, n = (uint32_t)options.size(); i < n; i += 2) { if (options[i] == kOptionHeartbeat) { double rate = 1.0e-3 * static_cast(options[i + 1]); if (rate <= 0.0) { @@ -429,7 +429,7 @@ bool ClientProxy1_0::recvGrabClipboard() { // parse message ClipboardID id; - UInt32 seqNum; + uint32_t seqNum; if (!ProtocolUtil::readf(getStream(), kMsgCClipboard + 4, &id, &seqNum)) { return false; } diff --git a/src/lib/server/ClientProxy1_0.h b/src/lib/server/ClientProxy1_0.h index 6fa09e67f..edc5e197b 100644 --- a/src/lib/server/ClientProxy1_0.h +++ b/src/lib/server/ClientProxy1_0.h @@ -44,7 +44,7 @@ public: void getCursorPos(int32_t &x, int32_t &y) const override; // IClient overrides - void enter(int32_t xAbs, int32_t yAbs, UInt32 seqNum, KeyModifierMask mask, bool forScreensaver) override; + void enter(int32_t xAbs, int32_t yAbs, uint32_t seqNum, KeyModifierMask mask, bool forScreensaver) override; bool leave() override; void setClipboard(ClipboardID, const IClipboard *) override; void grabClipboard(ClipboardID) override; @@ -60,7 +60,7 @@ public: void screensaver(bool activate) override; void resetOptions() override; void setOptions(const OptionsList &options) override; - void sendDragInfo(UInt32 fileCount, const char *info, size_t size) override; + void sendDragInfo(uint32_t fileCount, const char *info, size_t size) override; void fileChunkSending(uint8_t mark, char *data, size_t dataSize) override; std::string getSecureInputApp() const override; void secureInputNotification(const std::string &app) const override; @@ -96,7 +96,7 @@ protected: public: Clipboard m_clipboard; - UInt32 m_sequenceNumber; + uint32_t m_sequenceNumber; bool m_dirty; }; diff --git a/src/lib/server/ClientProxy1_5.cpp b/src/lib/server/ClientProxy1_5.cpp index a7634678b..c0f4e87a8 100644 --- a/src/lib/server/ClientProxy1_5.cpp +++ b/src/lib/server/ClientProxy1_5.cpp @@ -47,7 +47,7 @@ ClientProxy1_5::~ClientProxy1_5() m_events->removeHandler(m_events->forFile().keepAlive(), this); } -void ClientProxy1_5::sendDragInfo(UInt32 fileCount, const char *info, size_t size) +void ClientProxy1_5::sendDragInfo(uint32_t fileCount, const char *info, size_t size) { std::string data(info, size); @@ -90,7 +90,7 @@ void ClientProxy1_5::fileChunkReceived() void ClientProxy1_5::dragInfoReceived() { // parse - UInt32 fileNum = 0; + uint32_t fileNum = 0; std::string content; ProtocolUtil::readf(getStream(), kMsgDDragInfo + 4, &fileNum, &content); diff --git a/src/lib/server/ClientProxy1_5.h b/src/lib/server/ClientProxy1_5.h index 569c7b8d3..94c97eb15 100644 --- a/src/lib/server/ClientProxy1_5.h +++ b/src/lib/server/ClientProxy1_5.h @@ -36,7 +36,7 @@ public: ClientProxy1_5 &operator=(ClientProxy1_5 const &) = delete; ClientProxy1_5 &operator=(ClientProxy1_5 &&) = delete; - virtual void sendDragInfo(UInt32 fileCount, const char *info, size_t size); + virtual void sendDragInfo(uint32_t fileCount, const char *info, size_t size); virtual void fileChunkSending(uint8_t mark, char *data, size_t dataSize); virtual bool parseMessage(const uint8_t *code); void fileChunkReceived(); diff --git a/src/lib/server/ClientProxy1_6.cpp b/src/lib/server/ClientProxy1_6.cpp index 3031b613e..65e0636c7 100644 --- a/src/lib/server/ClientProxy1_6.cpp +++ b/src/lib/server/ClientProxy1_6.cpp @@ -70,7 +70,7 @@ bool ClientProxy1_6::recvClipboard() // parse message static std::string dataCached; ClipboardID id; - UInt32 seq; + uint32_t seq; int r = ClipboardChunk::assemble(getStream(), dataCached, id, seq); diff --git a/src/lib/server/ClientProxyUnknown.cpp b/src/lib/server/ClientProxyUnknown.cpp index 237ef997f..cee2d3737 100644 --- a/src/lib/server/ClientProxyUnknown.cpp +++ b/src/lib/server/ClientProxyUnknown.cpp @@ -224,7 +224,7 @@ void ClientProxyUnknown::handleData(const Event &, void *) try { // limit the maximum length of the hello - UInt32 n = m_stream->getSize(); + uint32_t n = m_stream->getSize(); if (n > kMaxHelloLength) { LOG((CLOG_DEBUG1 "hello reply too long")); throw XBadClient(); diff --git a/src/lib/server/Config.cpp b/src/lib/server/Config.cpp index e89aea2da..3ecce5d47 100644 --- a/src/lib/server/Config.cpp +++ b/src/lib/server/Config.cpp @@ -1752,7 +1752,7 @@ bool ConfigReadContext::readLine(std::string &line) return false; } -UInt32 ConfigReadContext::getLineNumber() const +uint32_t ConfigReadContext::getLineNumber() const { return m_line; } diff --git a/src/lib/server/Config.h b/src/lib/server/Config.h index dd511dba1..b6a672179 100644 --- a/src/lib/server/Config.h +++ b/src/lib/server/Config.h @@ -530,7 +530,7 @@ public: ~ConfigReadContext(); bool readLine(std::string &); - UInt32 getLineNumber() const; + uint32_t getLineNumber() const; bool operator!() const; diff --git a/src/lib/server/InputFilter.cpp b/src/lib/server/InputFilter.cpp index 56ad542a8..ebba7de86 100644 --- a/src/lib/server/InputFilter.cpp +++ b/src/lib/server/InputFilter.cpp @@ -654,7 +654,7 @@ void InputFilter::Rule::adoptAction(Action *action, bool onActivation) } } -void InputFilter::Rule::removeAction(bool onActivation, UInt32 index) +void InputFilter::Rule::removeAction(bool onActivation, uint32_t index) { if (onActivation) { delete m_activateActions[index]; @@ -665,7 +665,7 @@ void InputFilter::Rule::removeAction(bool onActivation, UInt32 index) } } -void InputFilter::Rule::replaceAction(Action *adopted, bool onActivation, UInt32 index) +void InputFilter::Rule::replaceAction(Action *adopted, bool onActivation, uint32_t index) { if (adopted == NULL) { removeAction(onActivation, index); @@ -765,16 +765,16 @@ const InputFilter::Condition *InputFilter::Rule::getCondition() const return m_condition; } -UInt32 InputFilter::Rule::getNumActions(bool onActivation) const +uint32_t InputFilter::Rule::getNumActions(bool onActivation) const { if (onActivation) { - return static_cast(m_activateActions.size()); + return static_cast(m_activateActions.size()); } else { - return static_cast(m_deactivateActions.size()); + return static_cast(m_deactivateActions.size()); } } -const InputFilter::Action &InputFilter::Rule::getAction(bool onActivation, UInt32 index) const +const InputFilter::Action &InputFilter::Rule::getAction(bool onActivation, uint32_t index) const { if (onActivation) { return *m_activateActions[index]; @@ -822,7 +822,7 @@ void InputFilter::addFilterRule(const Rule &rule) } } -void InputFilter::removeFilterRule(UInt32 index) +void InputFilter::removeFilterRule(uint32_t index) { if (m_primaryClient != NULL) { m_ruleList[index].disable(m_primaryClient); @@ -830,7 +830,7 @@ void InputFilter::removeFilterRule(UInt32 index) m_ruleList.erase(m_ruleList.begin() + index); } -InputFilter::Rule &InputFilter::getRule(UInt32 index) +InputFilter::Rule &InputFilter::getRule(uint32_t index) { return m_ruleList[index]; } @@ -909,9 +909,9 @@ std::string InputFilter::format(const std::string &linePrefix) const return s; } -UInt32 InputFilter::getNumRules() const +uint32_t InputFilter::getNumRules() const { - return static_cast(m_ruleList.size()); + return static_cast(m_ruleList.size()); } bool InputFilter::operator==(const InputFilter &x) const diff --git a/src/lib/server/InputFilter.h b/src/lib/server/InputFilter.h index 513896298..e63dbc8f6 100644 --- a/src/lib/server/InputFilter.h +++ b/src/lib/server/InputFilter.h @@ -76,7 +76,7 @@ public: virtual void disablePrimary(PrimaryClient *); private: - UInt32 m_id; + uint32_t m_id; KeyID m_key; KeyModifierMask m_mask; IEventQueue *m_events; @@ -324,10 +324,10 @@ public: void adoptAction(Action *, bool onActivation); // remove an action from the rule - void removeAction(bool onActivation, UInt32 index); + void removeAction(bool onActivation, uint32_t index); // replace an action in the rule - void replaceAction(Action *adopted, bool onActivation, UInt32 index); + void replaceAction(Action *adopted, bool onActivation, uint32_t index); // enable/disable void enable(PrimaryClient *); @@ -343,10 +343,10 @@ public: const Condition *getCondition() const; // get number of actions - UInt32 getNumActions(bool onActivation) const; + uint32_t getNumActions(bool onActivation) const; // get action by index - const Action &getAction(bool onActivation, UInt32 index) const; + const Action &getAction(bool onActivation, uint32_t index) const; private: void clear(); @@ -381,10 +381,10 @@ public: void addFilterRule(const Rule &rule); // remove a rule - void removeFilterRule(UInt32 index); + void removeFilterRule(uint32_t index); // get rule by index - Rule &getRule(UInt32 index); + Rule &getRule(uint32_t index); // enable event filtering using the given primary client. disable // if client is NULL. @@ -394,7 +394,7 @@ public: std::string format(const std::string &linePrefix) const; // get number of rules - UInt32 getNumRules() const; + uint32_t getNumRules() const; //! Compare filters bool operator==(const InputFilter &) const; diff --git a/src/lib/server/PrimaryClient.cpp b/src/lib/server/PrimaryClient.cpp index 9f1791f57..72ac6faad 100644 --- a/src/lib/server/PrimaryClient.cpp +++ b/src/lib/server/PrimaryClient.cpp @@ -32,7 +32,7 @@ PrimaryClient::PrimaryClient(const std::string &name, deskflow::Screen *screen) m_fakeInputCount(0) { // all clipboards are clean - for (UInt32 i = 0; i < kClipboardEnd; ++i) { + for (uint32_t i = 0; i < kClipboardEnd; ++i) { m_clipboardDirty[i] = false; } } @@ -42,17 +42,17 @@ PrimaryClient::~PrimaryClient() // do nothing } -void PrimaryClient::reconfigure(UInt32 activeSides) +void PrimaryClient::reconfigure(uint32_t activeSides) { m_screen->reconfigure(activeSides); } -UInt32 PrimaryClient::registerHotKey(KeyID key, KeyModifierMask mask) +uint32_t PrimaryClient::registerHotKey(KeyID key, KeyModifierMask mask) { return m_screen->registerHotKey(key, mask); } -void PrimaryClient::unregisterHotKey(UInt32 id) +void PrimaryClient::unregisterHotKey(uint32_t id) { m_screen->unregisterHotKey(id); } @@ -121,7 +121,7 @@ void PrimaryClient::disable() m_screen->disable(); } -void PrimaryClient::enter(int32_t xAbs, int32_t yAbs, UInt32 seqNum, KeyModifierMask mask, bool screensaver) +void PrimaryClient::enter(int32_t xAbs, int32_t yAbs, uint32_t seqNum, KeyModifierMask mask, bool screensaver) { m_screen->setSequenceNumber(seqNum); if (!screensaver) { @@ -218,7 +218,7 @@ void PrimaryClient::screensaver(bool) // ignore } -void PrimaryClient::sendDragInfo(UInt32 fileCount, const char *info, size_t size) +void PrimaryClient::sendDragInfo(uint32_t fileCount, const char *info, size_t size) { // ignore } diff --git a/src/lib/server/PrimaryClient.h b/src/lib/server/PrimaryClient.h index 65a31ea41..e1125106a 100644 --- a/src/lib/server/PrimaryClient.h +++ b/src/lib/server/PrimaryClient.h @@ -53,20 +53,20 @@ public: /*! Handles reconfiguration of jump zones. */ - virtual void reconfigure(UInt32 activeSides); + virtual void reconfigure(uint32_t activeSides); //! Register a system hotkey /*! Registers a system-wide hotkey for key \p key with modifiers \p mask. Returns an id used to unregister the hotkey. */ - virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask); + virtual uint32_t registerHotKey(KeyID key, KeyModifierMask mask); //! Unregister a system hotkey /*! Unregisters a previously registered hot key. */ - virtual void unregisterHotKey(UInt32 id); + virtual void unregisterHotKey(uint32_t id); //! Prepare to synthesize input on primary screen /*! @@ -127,7 +127,7 @@ public: void getCursorPos(int32_t &x, int32_t &y) const override; // IClient overrides - void enter(int32_t xAbs, int32_t yAbs, UInt32 seqNum, KeyModifierMask mask, bool forScreensaver) override; + void enter(int32_t xAbs, int32_t yAbs, uint32_t seqNum, KeyModifierMask mask, bool forScreensaver) override; bool leave() override; void setClipboard(ClipboardID, const IClipboard *) override; void grabClipboard(ClipboardID) override; @@ -143,7 +143,7 @@ public: void screensaver(bool activate) override; void resetOptions() override; void setOptions(const OptionsList &options) override; - void sendDragInfo(UInt32 fileCount, const char *info, size_t size) override; + void sendDragInfo(uint32_t fileCount, const char *info, size_t size) override; void fileChunkSending(uint8_t mark, char *data, size_t dataSize) override; std::string getSecureInputApp() const override; void secureInputNotification(const std::string &app) const override; diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index 20fe27601..dc32c3e32 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -353,7 +353,7 @@ std::string Server::protocolString() const throw XInvalidProtocol(); } -UInt32 Server::getNumClients() const +uint32_t Server::getNumClients() const { return (int32_t)m_clients.size(); } @@ -375,9 +375,9 @@ std::string Server::getName(const BaseClientProxy *client) const return name; } -UInt32 Server::getActivePrimarySides() const +uint32_t Server::getActivePrimarySides() const { - UInt32 sides = 0; + uint32_t sides = 0; if (!isLockedToScreenServer()) { if (hasAnyNeighbor(m_primaryClient, kLeft)) { sides |= kLeftMask; @@ -855,7 +855,7 @@ bool Server::isSwitchOkay( if (options != NULL && options->count(kOptionScreenSwitchCorners) > 0) { // get corner mask and size Config::ScreenOptions::const_iterator i = options->find(kOptionScreenSwitchCorners); - UInt32 corners = static_cast(i->second); + uint32_t corners = static_cast(i->second); i = options->find(kOptionScreenSwitchCornerSize); int32_t size = 0; if (i != options->end()) { @@ -1000,7 +1000,7 @@ bool Server::isSwitchWaitStarted() const return (m_switchWaitTimer != NULL); } -UInt32 Server::getCorner(BaseClientProxy *client, int32_t x, int32_t y, int32_t size) const +uint32_t Server::getCorner(BaseClientProxy *client, int32_t x, int32_t y, int32_t size) const { assert(client != NULL); @@ -1077,7 +1077,7 @@ void Server::sendOptions(BaseClientProxy *client) const optionsList.reserve(2 * options->size()); for (Config::ScreenOptions::const_iterator index = options->begin(); index != options->end(); ++index) { optionsList.push_back(index->first); - optionsList.push_back(static_cast(index->second)); + optionsList.push_back(static_cast(index->second)); } } @@ -1088,7 +1088,7 @@ void Server::sendOptions(BaseClientProxy *client) const optionsList.reserve(optionsList.size() + 2 * options->size()); for (Config::ScreenOptions::const_iterator index = options->begin(); index != options->end(); ++index) { optionsList.push_back(index->first); - optionsList.push_back(static_cast(index->second)); + optionsList.push_back(static_cast(index->second)); } } @@ -1469,7 +1469,7 @@ void Server::handleFileRecieveCompletedEvent(const Event &event, void *) onFileRecieveCompleted(); } -void Server::onClipboardChanged(BaseClientProxy *sender, ClipboardID id, UInt32 seqNum) +void Server::onClipboardChanged(BaseClientProxy *sender, ClipboardID id, uint32_t seqNum) { ClipboardInfo &clipboard = m_clipboards[id]; @@ -1792,7 +1792,7 @@ void Server::sendDragInfoThread(void *arg) void Server::sendDragInfo(BaseClientProxy *newScreen) { std::string infoString; - UInt32 fileCount = DragInformation::setupDragInfo(m_dragFileList, infoString); + uint32_t fileCount = DragInformation::setupDragInfo(m_dragFileList, infoString); if (fileCount > 0) { LOG((CLOG_DEBUG2 "sending drag information to client")); @@ -2291,7 +2291,7 @@ void Server::sendFileThread(void *data) m_sendFileThread.reset(nullptr); } -void Server::dragInfoReceived(UInt32 fileNum, std::string content) +void Server::dragInfoReceived(uint32_t fileNum, std::string content) { if (!m_args.m_enableDragDrop) { LOG((CLOG_DEBUG "drag drop not enabled, ignoring drag info.")); diff --git a/src/lib/server/Server.h b/src/lib/server/Server.h index a044b061b..1a658b74b 100644 --- a/src/lib/server/Server.h +++ b/src/lib/server/Server.h @@ -181,7 +181,7 @@ public: void sendFileToClient(const char *filename); //! Received dragging information from client - void dragInfoReceived(UInt32 fileNum, std::string content); + void dragInfoReceived(uint32_t fileNum, std::string content); //! Store ClientListener pointer void setListener(ClientListener *p) @@ -203,7 +203,7 @@ public: /*! Returns the number of connected clients, including the server itself. */ - UInt32 getNumClients() const; + uint32_t getNumClients() const; //! Get the list of connected clients /*! @@ -242,7 +242,7 @@ private: std::string getName(const BaseClientProxy *) const; // get the sides of the primary screen that have neighbors - UInt32 getActivePrimarySides() const; + uint32_t getActivePrimarySides() const; // returns true iff mouse should be locked to the current screen // according to this object only, ignoring what the primary client @@ -327,7 +327,7 @@ private: // returns the corner (EScreenSwitchCornerMasks) where x,y is on the // given client. corners have the given size. - UInt32 getCorner(BaseClientProxy *, int32_t x, int32_t y, int32_t size) const; + uint32_t getCorner(BaseClientProxy *, int32_t x, int32_t y, int32_t size) const; // stop relative mouse moves void stopRelativeMoves(); @@ -365,7 +365,7 @@ private: void handleFileRecieveCompletedEvent(const Event &, void *); // event processing - void onClipboardChanged(BaseClientProxy *sender, ClipboardID id, UInt32 seqNum); + void onClipboardChanged(BaseClientProxy *sender, ClipboardID id, uint32_t seqNum); void onScreensaver(bool activated); void onKeyDown(KeyID, KeyModifierMask, KeyButton, const std::string &, const char *screens); void onKeyUp(KeyID, KeyModifierMask, KeyButton, const char *screens); @@ -426,7 +426,7 @@ private: Clipboard m_clipboard; std::string m_clipboardData; std::string m_clipboardOwner; - UInt32 m_clipboardSeqNum; + uint32_t m_clipboardSeqNum; }; // used in hello message sent to the client @@ -449,7 +449,7 @@ private: BaseClientProxy *m_active; // the sequence number of enter messages - UInt32 m_seqNum; + uint32_t m_seqNum; // current mouse position (in absolute screen coordinates) on // whichever screen is active diff --git a/src/test/integtests/platform/OSXClipboardTests.cpp b/src/test/integtests/platform/OSXClipboardTests.cpp index 34f82953e..d7fc3a1af 100644 --- a/src/test/integtests/platform/OSXClipboardTests.cpp +++ b/src/test/integtests/platform/OSXClipboardTests.cpp @@ -97,7 +97,7 @@ TEST(OSXClipboardTests, getTime_openWithNoEmpty_returnsOne) { // this behavior is different to that of Clipboard which only // returns the value passed into open(t) after empty() is called. - EXPECT_EQ((UInt32)1, actual); + EXPECT_EQ((uint32_t)1, actual); } TEST(OSXClipboardTests, getTime_openAndEmpty_returnsOne) { @@ -107,7 +107,7 @@ TEST(OSXClipboardTests, getTime_openAndEmpty_returnsOne) { OSXClipboard::Time actual = clipboard.getTime(); - EXPECT_EQ((UInt32)1, actual); + EXPECT_EQ((uint32_t)1, actual); } TEST(OSXClipboardTests, has_withFormatAdded_returnsTrue) { diff --git a/src/test/mock/deskflow/MockKeyState.h b/src/test/mock/deskflow/MockKeyState.h index bcdc00b2a..3a4e66189 100644 --- a/src/test/mock/deskflow/MockKeyState.h +++ b/src/test/mock/deskflow/MockKeyState.h @@ -50,6 +50,6 @@ public: typedef ::testing::NiceMock KeyStateImpl; -using KeyID = UInt32; +using KeyID = uint32_t; typedef void (*ForeachKeyCallback)(KeyID, int32_t group, deskflow::KeyMap::KeyItem &, void *userData); diff --git a/src/test/mock/io/MockStream.h b/src/test/mock/io/MockStream.h index add4f7ac8..e9b06e298 100644 --- a/src/test/mock/io/MockStream.h +++ b/src/test/mock/io/MockStream.h @@ -33,8 +33,8 @@ public: { } MOCK_METHOD(void, close, (), (override)); - MOCK_METHOD(UInt32, read, (void *, UInt32), (override)); - MOCK_METHOD(void, write, (const void *, UInt32), (override)); + MOCK_METHOD(uint32_t, read, (void *, uint32_t), (override)); + MOCK_METHOD(void, write, (const void *, uint32_t), (override)); MOCK_METHOD(void, flush, (), (override)); MOCK_METHOD(void, shutdownInput, (), (override)); MOCK_METHOD(void, shutdownOutput, (), (override)); @@ -44,7 +44,7 @@ public: MOCK_METHOD(Event::Type, getOutputShutdownEvent, ()); MOCK_METHOD(void *, getEventTarget, (), (const, override)); MOCK_METHOD(bool, isReady, (), (const, override)); - MOCK_METHOD(UInt32, getSize, (), (const, override)); + MOCK_METHOD(uint32_t, getSize, (), (const, override)); }; } // namespace diff --git a/src/test/mock/server/MockPrimaryClient.h b/src/test/mock/server/MockPrimaryClient.h index 3d2cf1bfe..cd04a07a4 100644 --- a/src/test/mock/server/MockPrimaryClient.h +++ b/src/test/mock/server/MockPrimaryClient.h @@ -29,12 +29,12 @@ public: MOCK_METHOD(void *, getEventTarget, (), (const, override)); MOCK_METHOD(void, getCursorPos, (int32_t &, int32_t &), (const, override)); MOCK_METHOD(void, setJumpCursorPos, (int32_t, int32_t), (const)); - MOCK_METHOD(void, reconfigure, (UInt32), (override)); + MOCK_METHOD(void, reconfigure, (uint32_t), (override)); MOCK_METHOD(void, resetOptions, (), (override)); MOCK_METHOD(void, setOptions, (const OptionsList &), (override)); MOCK_METHOD(void, enable, (), (override)); MOCK_METHOD(void, disable, (), (override)); - MOCK_METHOD(UInt32, registerHotKey, (KeyID, KeyModifierMask), (override)); + MOCK_METHOD(uint32_t, registerHotKey, (KeyID, KeyModifierMask), (override)); MOCK_METHOD(KeyModifierMask, getToggleMask, (), (const, override)); - MOCK_METHOD(void, unregisterHotKey, (UInt32), (override)); + MOCK_METHOD(void, unregisterHotKey, (uint32_t), (override)); }; diff --git a/src/test/unittests/client/HelloBackTests.cpp b/src/test/unittests/client/HelloBackTests.cpp index d1b9fb99b..99bfe9832 100644 --- a/src/test/unittests/client/HelloBackTests.cpp +++ b/src/test/unittests/client/HelloBackTests.cpp @@ -103,8 +103,8 @@ void setupMockHelloBackWrite( const auto versionIntSize = 4; const auto clientNameIntSize = 4; - const UInt32 helloBackSize = - static_cast(protocolName.size() + versionIntSize + clientNameIntSize + name.size()); + const uint32_t helloBackSize = + static_cast(protocolName.size() + versionIntSize + clientNameIntSize + name.size()); std::vector expect; expect.reserve(helloBackSize); diff --git a/src/test/unittests/deskflow/ClipboardChunkTests.cpp b/src/test/unittests/deskflow/ClipboardChunkTests.cpp index f83617dfe..ec4c1f5d3 100644 --- a/src/test/unittests/deskflow/ClipboardChunkTests.cpp +++ b/src/test/unittests/deskflow/ClipboardChunkTests.cpp @@ -23,10 +23,10 @@ TEST(ClipboardChunkTests, start_formatStartChunk) { ClipboardID id = 0; - UInt32 sequence = 0; + uint32_t sequence = 0; std::string mockDataSize("10"); ClipboardChunk *chunk = ClipboardChunk::start(id, sequence, mockDataSize); - UInt32 temp_m_chunk; + uint32_t temp_m_chunk; memcpy(&temp_m_chunk, &(chunk->m_chunk[1]), 4); EXPECT_EQ(id, chunk->m_chunk[0]); @@ -42,12 +42,12 @@ TEST(ClipboardChunkTests, start_formatStartChunk) TEST(ClipboardChunkTests, data_formatDataChunk) { ClipboardID id = 0; - UInt32 sequence = 1; + uint32_t sequence = 1; std::string mockData("mock data"); ClipboardChunk *chunk = ClipboardChunk::data(id, sequence, mockData); EXPECT_EQ(id, chunk->m_chunk[0]); - EXPECT_EQ(sequence, (UInt32)chunk->m_chunk[1]); + EXPECT_EQ(sequence, (uint32_t)chunk->m_chunk[1]); EXPECT_EQ(kDataChunk, chunk->m_chunk[5]); EXPECT_EQ('m', chunk->m_chunk[6]); EXPECT_EQ('o', chunk->m_chunk[7]); @@ -66,11 +66,11 @@ TEST(ClipboardChunkTests, data_formatDataChunk) TEST(ClipboardChunkTests, end_formatDataChunk) { ClipboardID id = 1; - UInt32 sequence = 1; + uint32_t sequence = 1; ClipboardChunk *chunk = ClipboardChunk::end(id, sequence); EXPECT_EQ(id, chunk->m_chunk[0]); - EXPECT_EQ(sequence, (UInt32)chunk->m_chunk[1]); + EXPECT_EQ(sequence, (uint32_t)chunk->m_chunk[1]); EXPECT_EQ(kDataEnd, chunk->m_chunk[5]); EXPECT_EQ('\0', chunk->m_chunk[6]); diff --git a/src/test/unittests/deskflow/ProtocolUtilTests.cpp b/src/test/unittests/deskflow/ProtocolUtilTests.cpp index 60a7cf62a..2508f9e4e 100644 --- a/src/test/unittests/deskflow/ProtocolUtilTests.cpp +++ b/src/test/unittests/deskflow/ProtocolUtilTests.cpp @@ -50,7 +50,7 @@ MATCHER_P(EqVoidPointeeInt16, expected, "") MATCHER_P(EqVoidPointeeInt32, expected, "") { - const UInt32 Actual32 = (*static_cast(arg)); + const uint32_t Actual32 = (*static_cast(arg)); return (expected == (Actual32 >> 24)); } @@ -97,7 +97,7 @@ MATCHER_P(EqVoidVectorInt2bytes, expected, "") MATCHER_P(EqVoidVectorInt4bytes, expected, "") { bool Result = true; - const UInt32 *Actual = (static_cast(arg)) + 1; + const uint32_t *Actual = (static_cast(arg)) + 1; const size_t Size = *(Actual - 1) >> 24; if (Size == expected.size()) { @@ -140,7 +140,7 @@ public: MockStream stream; uint8_t ActualInt8 = 0; uint16_t ActualInt16 = 0; - UInt32 ActualInt32 = 0; + uint32_t ActualInt32 = 0; std::string ActualString; }; @@ -254,11 +254,11 @@ class ReadfIntVectorTestFixture : public ReadfIntTestFixture {}; TEST_P(ReadfIntVectorTestFixture, readf_int_vector) { std::vector Actual1Byte = {}; std::vector Actual2Bytes = {}; - std::vector Actual4Bytes = {}; + std::vector Actual4Bytes = {}; const std::vector Expected1Byte = {10, 10}; const std::vector Expected2Bytes = {10, 10}; - const std::vector Expected4Bytes = {10, 10}; + const std::vector Expected4Bytes = {10, 10}; std::array StreamVectorSize{{0, 0, 0, 2}}; const char *Format = std::get<0>(GetParam()); @@ -299,7 +299,7 @@ class ReadfIntAndStringTest : public ReadfIntTestFixture { public: uint8_t ActualInt8 = 0; uint16_t ActualInt16 = 0; - UInt32 ActualInt32 = 32; + uint32_t ActualInt32 = 32; std::string ActualString; }; @@ -372,8 +372,8 @@ TEST_F(ProtocolUtilTests, readf_string_and_int4bytes) { } TEST_F(ProtocolUtilTests, readf_string_and_vector_int4bytes) { - std::vector Actual = {}; - const std::vector Expected4Bytes = {10, 10}; + std::vector Actual = {}; + const std::vector Expected4Bytes = {10, 10}; std::array StreamVectorSize{{0, 0, 0, 2}}; std::array StreamData4Bytes{{0, 0, 0, 10}}; @@ -400,8 +400,8 @@ TEST_F(ProtocolUtilTests, readf_string_and_vector_int4bytes) { } TEST_F(ProtocolUtilTests, readf_vector_int4bytes_and_string) { - std::vector Actual4Bytes = {}; - const std::vector Expected4Bytes = {10, 10}; + std::vector Actual4Bytes = {}; + const std::vector Expected4Bytes = {10, 10}; std::array StreamVectorSize{{0, 0, 0, 2}}; std::array StreamData4Bytes{{0, 0, 0, 10}}; @@ -437,7 +437,7 @@ public: MockStream stream; uint8_t Expected1Byte = 5; uint16_t Expected2Bytes = 10; - UInt32 Expected4Bytes = 15; + uint32_t Expected4Bytes = 15; }; TEST_P(WriteIntTest, write_int) { @@ -472,7 +472,7 @@ public: MockStream stream; const std::vector Expected1Byte = {10, 20, 30}; const std::vector Expected2Byte = {40, 50, 60}; - const std::vector Expected4Byte = {70, 80, 90}; + const std::vector Expected4Byte = {70, 80, 90}; }; TEST_P(WriteIntVectorTest, write_vector_int) { @@ -483,18 +483,18 @@ TEST_P(WriteIntVectorTest, write_vector_int) { case 2: EXPECT_CALL(stream, write(EqVoidVectorInt2bytes(Expected2Byte), - Eq(Type * Expected2Byte.size() + sizeof(UInt32)))); + Eq(Type * Expected2Byte.size() + sizeof(uint32_t)))); ProtocolUtil::writef(&stream, Format, &Expected2Byte); break; case 4: EXPECT_CALL(stream, write(EqVoidVectorInt4bytes(Expected4Byte), - Eq(Type * Expected4Byte.size() + sizeof(UInt32)))); + Eq(Type * Expected4Byte.size() + sizeof(uint32_t)))); ProtocolUtil::writef(&stream, Format, &Expected4Byte); break; default: EXPECT_CALL(stream, write(EqVoidVectorInt1byte(Expected1Byte), - Eq(Expected1Byte.size() + sizeof(UInt32)))); + Eq(Expected1Byte.size() + sizeof(uint32_t)))); ProtocolUtil::writef(&stream, Format, &Expected1Byte); break; } @@ -510,15 +510,15 @@ TEST_F(ProtocolUtilTests, write_string_test) { const std::vector ExpectedVector = {'E', 'x', 'p', 'e', 'c', 't', 'e', 'd'}; EXPECT_CALL(stream, write(EqVoidVectorInt1byte(ExpectedVector), - Expected.size() + sizeof(UInt32))); + Expected.size() + sizeof(uint32_t))); ProtocolUtil::writef(&stream, "%s", &Expected); } TEST_F(ProtocolUtilTests, write_raw_bytes_test) { - const UInt32 Size = 5; + const uint32_t Size = 5; const std::array Expected{{10, 20, 30, 40, 50}}; EXPECT_CALL(stream, write(EqVoidVectorInt1byte(Expected), - Expected.size() + sizeof(UInt32))); + Expected.size() + sizeof(uint32_t))); ProtocolUtil::writef(&stream, "%S", Size, &Expected); } diff --git a/src/test/unittests/platform/OSXKeyStateTests.cpp b/src/test/unittests/platform/OSXKeyStateTests.cpp index 4610c9b4b..2dffb18e6 100644 --- a/src/test/unittests/platform/OSXKeyStateTests.cpp +++ b/src/test/unittests/platform/OSXKeyStateTests.cpp @@ -31,27 +31,27 @@ TEST(OSXKeyStateTests, mapModifiersFromOSX_OSXMask_returnDeskflowMask) KeyModifierMask outMask = 0; - UInt32 shiftMask = 0 | kCGEventFlagMaskShift; + uint32_t shiftMask = 0 | kCGEventFlagMaskShift; outMask = keyState.mapModifiersFromOSX(shiftMask); EXPECT_EQ(KeyModifierShift, outMask); - UInt32 ctrlMask = 0 | kCGEventFlagMaskControl; + uint32_t ctrlMask = 0 | kCGEventFlagMaskControl; outMask = keyState.mapModifiersFromOSX(ctrlMask); EXPECT_EQ(KeyModifierControl, outMask); - UInt32 altMask = 0 | kCGEventFlagMaskAlternate; + uint32_t altMask = 0 | kCGEventFlagMaskAlternate; outMask = keyState.mapModifiersFromOSX(altMask); EXPECT_EQ(KeyModifierAlt, outMask); - UInt32 cmdMask = 0 | kCGEventFlagMaskCommand; + uint32_t cmdMask = 0 | kCGEventFlagMaskCommand; outMask = keyState.mapModifiersFromOSX(cmdMask); EXPECT_EQ(KeyModifierSuper, outMask); - UInt32 capsMask = 0 | kCGEventFlagMaskAlphaShift; + uint32_t capsMask = 0 | kCGEventFlagMaskAlphaShift; outMask = keyState.mapModifiersFromOSX(capsMask); EXPECT_EQ(KeyModifierCapsLock, outMask); - UInt32 numMask = 0 | kCGEventFlagMaskNumericPad; + uint32_t numMask = 0 | kCGEventFlagMaskNumericPad; outMask = keyState.mapModifiersFromOSX(numMask); EXPECT_EQ(KeyModifierNumLock, outMask); }