refactor: replace UInt32 with uint32_t

This commit is contained in:
sithlord48 2025-01-10 21:13:19 -05:00 committed by Nick Bolton
parent 27eb83c981
commit 96092df4fc
119 changed files with 684 additions and 684 deletions

View file

@ -45,7 +45,7 @@ MSWindowsClientTaskBarReceiver::MSWindowsClientTaskBarReceiver(
m_window(NULL), m_window(NULL),
m_logBuffer(logBuffer) 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_icon[i] = loadIcon(s_stateToIconID[i]);
} }
m_menu = LoadMenu(m_appInstance, MAKEINTRESOURCE(IDR_TASKBAR)); m_menu = LoadMenu(m_appInstance, MAKEINTRESOURCE(IDR_TASKBAR));
@ -67,7 +67,7 @@ MSWindowsClientTaskBarReceiver::~MSWindowsClientTaskBarReceiver()
void MSWindowsClientTaskBarReceiver::cleanup() void MSWindowsClientTaskBarReceiver::cleanup()
{ {
ARCH->removeReceiver(this); ARCH->removeReceiver(this);
for (UInt32 i = 0; i < kMaxState; ++i) { for (uint32_t i = 0; i < kMaxState; ++i) {
deleteIcon(m_icon[i]); deleteIcon(m_icon[i]);
} }
DestroyMenu(m_menu); DestroyMenu(m_menu);

View file

@ -47,7 +47,7 @@ MSWindowsServerTaskBarReceiver::MSWindowsServerTaskBarReceiver(
m_window(NULL), m_window(NULL),
m_logBuffer(logBuffer) 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_icon[i] = loadIcon(s_stateToIconID[i]);
} }
m_menu = LoadMenu(m_appInstance, MAKEINTRESOURCE(IDR_TASKBAR)); m_menu = LoadMenu(m_appInstance, MAKEINTRESOURCE(IDR_TASKBAR));
@ -64,7 +64,7 @@ MSWindowsServerTaskBarReceiver::MSWindowsServerTaskBarReceiver(
void MSWindowsServerTaskBarReceiver::cleanup() void MSWindowsServerTaskBarReceiver::cleanup()
{ {
ARCH->removeReceiver(this); ARCH->removeReceiver(this);
for (UInt32 i = 0; i < kMaxState; ++i) { for (uint32_t i = 0; i < kMaxState; ++i) {
deleteIcon(m_icon[i]); deleteIcon(m_icon[i]);
} }
DestroyMenu(m_menu); DestroyMenu(m_menu);

View file

@ -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; ptrdiff_t len = 0;
@ -95,7 +95,7 @@ int IArchString::convStringWCToMB(char *dst, const wchar_t *src, UInt32 n, bool
return static_cast<int>(len); return static_cast<int>(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; ptrdiff_t len = 0;
wchar_t dummy; wchar_t dummy;

View file

@ -65,10 +65,10 @@ public:
virtual int vsnprintf(char *str, int size, const char *fmt, va_list ap); virtual int vsnprintf(char *str, int size, const char *fmt, va_list ap);
//! Convert multibyte string to wide character string //! 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 //! 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 //! Return the architecture's native wide character encoding
virtual EWideCharEncoding getWideCharEncoding() = 0; virtual EWideCharEncoding getWideCharEncoding() = 0;

View file

@ -39,7 +39,7 @@ A \c Event holds an event type and a pointer to event data.
class Event class Event
{ {
public: public:
using Type = UInt32; using Type = uint32_t;
enum enum
{ {
kUnknown, //!< The event type is unknown kUnknown, //!< The event type is unknown
@ -49,7 +49,7 @@ public:
kLast //!< Must be last kLast //!< Must be last
}; };
using Flags = UInt32; using Flags = uint32_t;
enum enum
{ {
kNone = 0x00, //!< No flags kNone = 0x00, //!< No flags

View file

@ -224,7 +224,7 @@ retry:
} }
// get the event // get the event
UInt32 dataID; uint32_t dataID;
IEventQueueBuffer::Type type = m_buffer->getEvent(event, dataID); IEventQueueBuffer::Type type = m_buffer->getEvent(event, dataID);
switch (type) { switch (type) {
case IEventQueueBuffer::kNone: case IEventQueueBuffer::kNone:
@ -293,7 +293,7 @@ void EventQueue::addEventToBuffer(const Event &event)
ArchMutexLock lock(m_mutex); ArchMutexLock lock(m_mutex);
// store the event's data locally // store the event's data locally
UInt32 eventID = saveEvent(event); uint32_t eventID = saveEvent(event);
// add it // add it
if (!m_buffer->addEvent(eventID)) { if (!m_buffer->addEvent(eventID)) {
@ -420,17 +420,17 @@ IEventJob *EventQueue::getHandler(Event::Type type, void *target) const
return NULL; return NULL;
} }
UInt32 EventQueue::saveEvent(const Event &event) uint32_t EventQueue::saveEvent(const Event &event)
{ {
// choose id // choose id
UInt32 id; uint32_t id;
if (!m_oldEventIDs.empty()) { if (!m_oldEventIDs.empty()) {
// reuse an id // reuse an id
id = m_oldEventIDs.back(); id = m_oldEventIDs.back();
m_oldEventIDs.pop_back(); m_oldEventIDs.pop_back();
} else { } else {
// make a new id // make a new id
id = static_cast<UInt32>(m_events.size()); id = static_cast<uint32_t>(m_events.size());
} }
// save data // save data
@ -438,7 +438,7 @@ UInt32 EventQueue::saveEvent(const Event &event)
return id; return id;
} }
Event EventQueue::removeEvent(UInt32 eventID) Event EventQueue::removeEvent(uint32_t eventID)
{ {
// look up id // look up id
EventTable::iterator index = m_events.find(eventID); 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_timer = m_timer;
event.m_count = 0; event.m_count = 0;
if (m_time <= 0.0) { if (m_time <= 0.0) {
event.m_count = static_cast<UInt32>((m_timeout - m_time) / m_timeout); event.m_count = static_cast<uint32_t>((m_timeout - m_time) / m_timeout);
} }
} }

View file

@ -68,8 +68,8 @@ public:
virtual void waitForReady() const; virtual void waitForReady() const;
private: private:
UInt32 saveEvent(const Event &event); uint32_t saveEvent(const Event &event);
Event removeEvent(UInt32 eventID); Event removeEvent(uint32_t eventID);
bool hasTimerExpired(Event &event); bool hasTimerExpired(Event &event);
double getNextTimerTimeout() const; double getNextTimerTimeout() const;
void addEventToBuffer(const Event &event); void addEventToBuffer(const Event &event);
@ -104,8 +104,8 @@ private:
using Timers = std::set<EventQueueTimer *>; using Timers = std::set<EventQueueTimer *>;
using TimerQueue = PriorityQueue<Timer>; using TimerQueue = PriorityQueue<Timer>;
using EventTable = std::map<UInt32, Event>; using EventTable = std::map<uint32_t, Event>;
using EventIDList = std::vector<UInt32>; using EventIDList = std::vector<uint32_t>;
using TypeMap = std::map<Event::Type, const char *>; using TypeMap = std::map<Event::Type, const char *>;
using NameMap = std::map<std::string, Event::Type>; using NameMap = std::map<std::string, Event::Type>;
using TypeHandlerTable = std::map<Event::Type, IEventJob *>; using TypeHandlerTable = std::map<Event::Type, IEventJob *>;

View file

@ -66,7 +66,7 @@ public:
{ {
public: public:
EventQueueTimer *m_timer; //!< The timer EventQueueTimer *m_timer; //!< The timer
UInt32 m_count; //!< Number of repeats uint32_t m_count; //!< Number of repeats
}; };
//! @name manipulators //! @name manipulators

View file

@ -63,7 +63,7 @@ public:
data in a kSystem event). Otherwise, return kUser and fill in data in a kSystem event). Otherwise, return kUser and fill in
\p dataID with the value passed to \c addEvent(). \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 //! Post an event
/*! /*!
@ -72,7 +72,7 @@ public:
return \p dataID. This method must cause \c waitForEvent() to return \p dataID. This method must cause \c waitForEvent() to
return at some future time if it's blocked waiting on an event. 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 //! @name accessors

View file

@ -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); ArchMutexLock lock(m_queueMutex);
if (!m_queueReady) { if (!m_queueReady) {
@ -69,7 +69,7 @@ IEventQueueBuffer::Type SimpleEventQueueBuffer::getEvent(Event &, UInt32 &dataID
return kUser; return kUser;
} }
bool SimpleEventQueueBuffer::addEvent(UInt32 dataID) bool SimpleEventQueueBuffer::addEvent(uint32_t dataID)
{ {
ArchMutexLock lock(m_queueMutex); ArchMutexLock lock(m_queueMutex);
m_queue.push_front(dataID); m_queue.push_front(dataID);

View file

@ -42,14 +42,14 @@ public:
{ {
} }
virtual void waitForEvent(double timeout); virtual void waitForEvent(double timeout);
virtual Type getEvent(Event &event, UInt32 &dataID); virtual Type getEvent(Event &event, uint32_t &dataID);
virtual bool addEvent(UInt32 dataID); virtual bool addEvent(uint32_t dataID);
virtual bool isEmpty() const; virtual bool isEmpty() const;
virtual EventQueueTimer *newTimer(double duration, bool oneShot) const; virtual EventQueueTimer *newTimer(double duration, bool oneShot) const;
virtual void deleteTimer(EventQueueTimer *) const; virtual void deleteTimer(EventQueueTimer *) const;
private: private:
using EventDeque = std::deque<UInt32>; using EventDeque = std::deque<uint32_t>;
ArchMutex m_queueMutex; ArchMutex m_queueMutex;
ArchCond m_queueReadyCond; ArchCond m_queueReadyCond;

View file

@ -42,12 +42,12 @@ inline static uint16_t decode16(const uint8_t *n, bool byteSwapped)
return c.n16; 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 union x32
{ {
uint8_t n8[4]; uint8_t n8[4];
UInt32 n32; uint32_t n32;
} c; } c;
if (byteSwapped) { if (byteSwapped) {
c.n8[0] = n[3]; c.n8[0] = n[3];
@ -81,14 +81,14 @@ inline static void setError(bool *errors)
// Unicode // Unicode
// //
UInt32 Unicode::s_invalid = 0x0000ffff; uint32_t Unicode::s_invalid = 0x0000ffff;
UInt32 Unicode::s_replacement = 0x0000fffd; uint32_t Unicode::s_replacement = 0x0000fffd;
bool Unicode::isUTF8(const std::string &src) bool Unicode::isUTF8(const std::string &src)
{ {
// convert and test each character // convert and test each character
const uint8_t *data = reinterpret_cast<const uint8_t *>(src.c_str()); const uint8_t *data = reinterpret_cast<const uint8_t *>(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) { if (fromUTF8(data, n) == s_invalid) {
return false; return false;
} }
@ -102,14 +102,14 @@ std::string Unicode::UTF8ToUCS2(const std::string &src, bool *errors)
resetError(errors); resetError(errors);
// get size of input string and reserve some space in output // 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; std::string dst;
dst.reserve(2 * n); dst.reserve(2 * n);
// convert each character // convert each character
const uint8_t *data = reinterpret_cast<const uint8_t *>(src.c_str()); const uint8_t *data = reinterpret_cast<const uint8_t *>(src.c_str());
while (n > 0) { while (n > 0) {
UInt32 c = fromUTF8(data, n); uint32_t c = fromUTF8(data, n);
if (c == s_invalid) { if (c == s_invalid) {
c = s_replacement; c = s_replacement;
} else if (c >= 0x00010000) { } else if (c >= 0x00010000) {
@ -129,14 +129,14 @@ std::string Unicode::UTF8ToUCS4(const std::string &src, bool *errors)
resetError(errors); resetError(errors);
// get size of input string and reserve some space in output // 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; std::string dst;
dst.reserve(4 * n); dst.reserve(4 * n);
// convert each character // convert each character
const uint8_t *data = reinterpret_cast<const uint8_t *>(src.c_str()); const uint8_t *data = reinterpret_cast<const uint8_t *>(src.c_str());
while (n > 0) { while (n > 0) {
UInt32 c = fromUTF8(data, n); uint32_t c = fromUTF8(data, n);
if (c == s_invalid) { if (c == s_invalid) {
c = s_replacement; c = s_replacement;
} }
@ -152,14 +152,14 @@ std::string Unicode::UTF8ToUTF16(const std::string &src, bool *errors)
resetError(errors); resetError(errors);
// get size of input string and reserve some space in output // 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; std::string dst;
dst.reserve(2 * n); dst.reserve(2 * n);
// convert each character // convert each character
const uint8_t *data = reinterpret_cast<const uint8_t *>(src.c_str()); const uint8_t *data = reinterpret_cast<const uint8_t *>(src.c_str());
while (n > 0) { while (n > 0) {
UInt32 c = fromUTF8(data, n); uint32_t c = fromUTF8(data, n);
if (c == s_invalid) { if (c == s_invalid) {
c = s_replacement; c = s_replacement;
} else if (c >= 0x00110000) { } else if (c >= 0x00110000) {
@ -187,14 +187,14 @@ std::string Unicode::UTF8ToUTF32(const std::string &src, bool *errors)
resetError(errors); resetError(errors);
// get size of input string and reserve some space in output // 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; std::string dst;
dst.reserve(4 * n); dst.reserve(4 * n);
// convert each character // convert each character
const uint8_t *data = reinterpret_cast<const uint8_t *>(src.c_str()); const uint8_t *data = reinterpret_cast<const uint8_t *>(src.c_str());
while (n > 0) { while (n > 0) {
UInt32 c = fromUTF8(data, n); uint32_t c = fromUTF8(data, n);
if (c == s_invalid) { if (c == s_invalid) {
c = s_replacement; c = s_replacement;
} else if (c >= 0x00110000) { } else if (c >= 0x00110000) {
@ -213,7 +213,7 @@ std::string Unicode::UTF8ToText(const std::string &src, bool *errors)
resetError(errors); resetError(errors);
// convert to wide char // convert to wide char
UInt32 size; uint32_t size;
wchar_t *tmp = UTF8ToWideChar(src, size, errors); wchar_t *tmp = UTF8ToWideChar(src, size, errors);
// convert string to multibyte // convert string to multibyte
@ -235,7 +235,7 @@ std::string Unicode::UCS2ToUTF8(const std::string &src, bool *errors)
resetError(errors); resetError(errors);
// convert // convert
UInt32 n = (UInt32)src.size() >> 1; uint32_t n = (uint32_t)src.size() >> 1;
return doUCS2ToUTF8(reinterpret_cast<const uint8_t *>(src.data()), n, errors); return doUCS2ToUTF8(reinterpret_cast<const uint8_t *>(src.data()), n, errors);
} }
@ -245,7 +245,7 @@ std::string Unicode::UCS4ToUTF8(const std::string &src, bool *errors)
resetError(errors); resetError(errors);
// convert // convert
UInt32 n = (UInt32)src.size() >> 2; uint32_t n = (uint32_t)src.size() >> 2;
return doUCS4ToUTF8(reinterpret_cast<const uint8_t *>(src.data()), n, errors); return doUCS4ToUTF8(reinterpret_cast<const uint8_t *>(src.data()), n, errors);
} }
@ -255,7 +255,7 @@ std::string Unicode::UTF16ToUTF8(const std::string &src, bool *errors)
resetError(errors); resetError(errors);
// convert // convert
UInt32 n = (UInt32)src.size() >> 1; uint32_t n = (uint32_t)src.size() >> 1;
return doUTF16ToUTF8(reinterpret_cast<const uint8_t *>(src.data()), n, errors); return doUTF16ToUTF8(reinterpret_cast<const uint8_t *>(src.data()), n, errors);
} }
@ -265,7 +265,7 @@ std::string Unicode::UTF32ToUTF8(const std::string &src, bool *errors)
resetError(errors); resetError(errors);
// convert // convert
UInt32 n = (UInt32)src.size() >> 2; uint32_t n = (uint32_t)src.size() >> 2;
return doUTF32ToUTF8(reinterpret_cast<const uint8_t *>(src.data()), n, errors); return doUTF32ToUTF8(reinterpret_cast<const uint8_t *>(src.data()), n, errors);
} }
@ -275,7 +275,7 @@ std::string Unicode::textToUTF8(const std::string &src, bool *errors, IArchStrin
resetError(errors); resetError(errors);
// convert string to wide characters // 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); int len = ARCH->convStringMBToWC(NULL, src.c_str(), n, errors);
wchar_t *wcs = new wchar_t[len + 1]; wchar_t *wcs = new wchar_t[len + 1];
ARCH->convStringMBToWC(wcs, src.c_str(), n, errors); 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; 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 // convert to platform's wide character encoding
std::string tmp; std::string tmp;
switch (ARCH->getWideCharEncoding()) { switch (ARCH->getWideCharEncoding()) {
case IArchString::kUCS2: case IArchString::kUCS2:
tmp = UTF8ToUCS2(src, errors); tmp = UTF8ToUCS2(src, errors);
size = (UInt32)tmp.size() >> 1; size = (uint32_t)tmp.size() >> 1;
break; break;
case IArchString::kUCS4: case IArchString::kUCS4:
tmp = UTF8ToUCS4(src, errors); tmp = UTF8ToUCS4(src, errors);
size = (UInt32)tmp.size() >> 2; size = (uint32_t)tmp.size() >> 2;
break; break;
case IArchString::kUTF16: case IArchString::kUTF16:
tmp = UTF8ToUTF16(src, errors); tmp = UTF8ToUTF16(src, errors);
size = (UInt32)tmp.size() >> 1; size = (uint32_t)tmp.size() >> 1;
break; break;
case IArchString::kUTF32: case IArchString::kUTF32:
tmp = UTF8ToUTF32(src, errors); tmp = UTF8ToUTF32(src, errors);
size = (UInt32)tmp.size() >> 2; size = (uint32_t)tmp.size() >> 2;
break; break;
default: default:
@ -325,7 +325,7 @@ wchar_t *Unicode::UTF8ToWideChar(const std::string &src, UInt32 &size, bool *err
} }
std::string 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) { if (encoding == IArchString::kPlatformDetermined) {
encoding = ARCH->getWideCharEncoding(); 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 // make some space
std::string dst; std::string dst;
@ -380,7 +380,7 @@ std::string Unicode::doUCS2ToUTF8(const uint8_t *data, UInt32 n, bool *errors)
// convert each character // convert each character
for (; n > 0; --n) { for (; n > 0; --n) {
UInt32 c = decode16(data, byteSwapped); uint32_t c = decode16(data, byteSwapped);
toUTF8(dst, c, errors); toUTF8(dst, c, errors);
data += 2; data += 2;
} }
@ -388,7 +388,7 @@ std::string Unicode::doUCS2ToUTF8(const uint8_t *data, UInt32 n, bool *errors)
return dst; 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 // make some space
std::string dst; std::string dst;
@ -416,7 +416,7 @@ std::string Unicode::doUCS4ToUTF8(const uint8_t *data, UInt32 n, bool *errors)
// convert each character // convert each character
for (; n > 0; --n) { for (; n > 0; --n) {
UInt32 c = decode32(data, byteSwapped); uint32_t c = decode32(data, byteSwapped);
toUTF8(dst, c, errors); toUTF8(dst, c, errors);
data += 4; data += 4;
} }
@ -424,7 +424,7 @@ std::string Unicode::doUCS4ToUTF8(const uint8_t *data, UInt32 n, bool *errors)
return dst; 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 // make some space
std::string dst; std::string dst;
@ -452,7 +452,7 @@ std::string Unicode::doUTF16ToUTF8(const uint8_t *data, UInt32 n, bool *errors)
// convert each character // convert each character
while (n > 0) { while (n > 0) {
UInt32 c = decode16(data, byteSwapped); uint32_t c = decode16(data, byteSwapped);
if (c < 0x0000d800 || c > 0x0000dfff) { if (c < 0x0000d800 || c > 0x0000dfff) {
toUTF8(dst, c, errors); toUTF8(dst, c, errors);
} else if (n == 1) { } 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) { } else if (c >= 0x0000d800 && c <= 0x0000dbff) {
data += 2; data += 2;
--n; --n;
UInt32 c2 = decode16(data, byteSwapped); uint32_t c2 = decode16(data, byteSwapped);
if (c2 < 0x0000dc00 || c2 > 0x0000dfff) { if (c2 < 0x0000dc00 || c2 > 0x0000dfff) {
// error -- [d800,dbff] not followed by [dc00,dfff] // error -- [d800,dbff] not followed by [dc00,dfff]
setError(errors); setError(errors);
@ -483,7 +483,7 @@ std::string Unicode::doUTF16ToUTF8(const uint8_t *data, UInt32 n, bool *errors)
return dst; 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 // make some space
std::string dst; std::string dst;
@ -511,7 +511,7 @@ std::string Unicode::doUTF32ToUTF8(const uint8_t *data, UInt32 n, bool *errors)
// convert each character // convert each character
for (; n > 0; --n) { for (; n > 0; --n) {
UInt32 c = decode32(data, byteSwapped); uint32_t c = decode32(data, byteSwapped);
if (c >= 0x00110000) { if (c >= 0x00110000) {
setError(errors); setError(errors);
c = s_replacement; c = s_replacement;
@ -523,7 +523,7 @@ std::string Unicode::doUTF32ToUTF8(const uint8_t *data, UInt32 n, bool *errors)
return dst; 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(data != NULL);
assert(n != 0); assert(n != 0);
@ -531,7 +531,7 @@ UInt32 Unicode::fromUTF8(const uint8_t *&data, UInt32 &n)
// compute character encoding length, checking for overlong // compute character encoding length, checking for overlong
// sequences (i.e. characters that don't use the shortest // sequences (i.e. characters that don't use the shortest
// possible encoding). // possible encoding).
UInt32 size; uint32_t size;
if (data[0] < 0x80) { if (data[0] < 0x80) {
// 0xxxxxxx // 0xxxxxxx
size = 1; size = 1;
@ -571,36 +571,36 @@ UInt32 Unicode::fromUTF8(const uint8_t *&data, UInt32 &n)
} }
// extract character // extract character
UInt32 c; uint32_t c;
switch (size) { switch (size) {
case 1: case 1:
c = static_cast<UInt32>(data[0]); c = static_cast<uint32_t>(data[0]);
break; break;
case 2: case 2:
c = ((static_cast<UInt32>(data[0]) & 0x1f) << 6) | ((static_cast<UInt32>(data[1]) & 0x3f)); c = ((static_cast<uint32_t>(data[0]) & 0x1f) << 6) | ((static_cast<uint32_t>(data[1]) & 0x3f));
break; break;
case 3: case 3:
c = ((static_cast<UInt32>(data[0]) & 0x0f) << 12) | ((static_cast<UInt32>(data[1]) & 0x3f) << 6) | c = ((static_cast<uint32_t>(data[0]) & 0x0f) << 12) | ((static_cast<uint32_t>(data[1]) & 0x3f) << 6) |
((static_cast<UInt32>(data[2]) & 0x3f)); ((static_cast<uint32_t>(data[2]) & 0x3f));
break; break;
case 4: case 4:
c = ((static_cast<UInt32>(data[0]) & 0x07) << 18) | ((static_cast<UInt32>(data[1]) & 0x3f) << 12) | c = ((static_cast<uint32_t>(data[0]) & 0x07) << 18) | ((static_cast<uint32_t>(data[1]) & 0x3f) << 12) |
((static_cast<UInt32>(data[2]) & 0x3f) << 6) | ((static_cast<UInt32>(data[3]) & 0x3f)); ((static_cast<uint32_t>(data[2]) & 0x3f) << 6) | ((static_cast<uint32_t>(data[3]) & 0x3f));
break; break;
case 5: case 5:
c = ((static_cast<UInt32>(data[0]) & 0x03) << 24) | ((static_cast<UInt32>(data[1]) & 0x3f) << 18) | c = ((static_cast<uint32_t>(data[0]) & 0x03) << 24) | ((static_cast<uint32_t>(data[1]) & 0x3f) << 18) |
((static_cast<UInt32>(data[2]) & 0x3f) << 12) | ((static_cast<UInt32>(data[3]) & 0x3f) << 6) | ((static_cast<uint32_t>(data[2]) & 0x3f) << 12) | ((static_cast<uint32_t>(data[3]) & 0x3f) << 6) |
((static_cast<UInt32>(data[4]) & 0x3f)); ((static_cast<uint32_t>(data[4]) & 0x3f));
break; break;
case 6: case 6:
c = ((static_cast<UInt32>(data[0]) & 0x01) << 30) | ((static_cast<UInt32>(data[1]) & 0x3f) << 24) | c = ((static_cast<uint32_t>(data[0]) & 0x01) << 30) | ((static_cast<uint32_t>(data[1]) & 0x3f) << 24) |
((static_cast<UInt32>(data[2]) & 0x3f) << 18) | ((static_cast<UInt32>(data[3]) & 0x3f) << 12) | ((static_cast<uint32_t>(data[2]) & 0x3f) << 18) | ((static_cast<uint32_t>(data[3]) & 0x3f) << 12) |
((static_cast<UInt32>(data[4]) & 0x3f) << 6) | ((static_cast<UInt32>(data[5]) & 0x3f)); ((static_cast<uint32_t>(data[4]) & 0x3f) << 6) | ((static_cast<uint32_t>(data[5]) & 0x3f));
break; break;
default: 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 // 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]) { if (c < s_minChar[size]) {
return s_invalid; return s_invalid;
} }
@ -673,7 +673,7 @@ UInt32 Unicode::fromUTF8(const uint8_t *&data, UInt32 &n)
return c; 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]; uint8_t data[6];

View file

@ -125,26 +125,26 @@ private:
// to the platform). caller must delete[] the returned string. the // to the platform). caller must delete[] the returned string. the
// string is *not* nul terminated; the length (in characters) is // string is *not* nul terminated; the length (in characters) is
// returned in size. // 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 // convert nul terminated wchar_t string (in platform's native
// encoding) to UTF8. // encoding) to UTF8.
static std::string wideCharToUTF8( static std::string wideCharToUTF8(
const wchar_t *, UInt32 size, bool *errors, const wchar_t *, uint32_t size, bool *errors,
IArchString::EWideCharEncoding encoding = IArchString::kPlatformDetermined IArchString::EWideCharEncoding encoding = IArchString::kPlatformDetermined
); );
// internal conversion to UTF8 // internal conversion to UTF8
static std::string doUCS2ToUTF8(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 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 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 n, bool *errors); static std::string doUTF32ToUTF8(const uint8_t *src, uint32_t n, bool *errors);
// convert characters to/from UTF8 // convert characters to/from UTF8
static UInt32 fromUTF8(const uint8_t *&src, UInt32 &size); static uint32_t fromUTF8(const uint8_t *&src, uint32_t &size);
static void toUTF8(std::string &dst, UInt32 c, bool *errors); static void toUTF8(std::string &dst, uint32_t c, bool *errors);
private: private:
static UInt32 s_invalid; static uint32_t s_invalid;
static UInt32 s_replacement; static uint32_t s_replacement;
}; };

View file

@ -165,7 +165,7 @@ SystemLogger::~SystemLogger()
// BufferedLogOutputter // BufferedLogOutputter
// //
BufferedLogOutputter::BufferedLogOutputter(UInt32 maxBufferSize) : m_maxBufferSize(maxBufferSize) BufferedLogOutputter::BufferedLogOutputter(uint32_t maxBufferSize) : m_maxBufferSize(maxBufferSize)
{ {
// do nothing // do nothing
} }

View file

@ -142,7 +142,7 @@ private:
public: public:
using const_iterator = Buffer::const_iterator; using const_iterator = Buffer::const_iterator;
BufferedLogOutputter(UInt32 maxBufferSize); BufferedLogOutputter(uint32_t maxBufferSize);
virtual ~BufferedLogOutputter(); virtual ~BufferedLogOutputter();
//! @name accessors //! @name accessors
@ -163,6 +163,6 @@ public:
virtual bool write(ELevel level, const char *message); virtual bool write(ELevel level, const char *message);
private: private:
UInt32 m_maxBufferSize; uint32_t m_maxBufferSize;
Buffer m_buffer; Buffer m_buffer;
}; };

View file

@ -250,7 +250,7 @@ void Client::getCursorPos(int32_t &x, int32_t &y) const
m_screen->getCursorPos(x, y); 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_active = true;
m_screen->mouseMove(xAbs, yAbs); m_screen->mouseMove(xAbs, yAbs);
@ -757,7 +757,7 @@ void Client::writeToDropDirThread(void *)
DropHelper::writeToDir(m_screen->getDropTarget(), m_dragFileList, m_receivedFileData); 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 // TODO: fix duplicate function from CServer
if (!m_args.m_enableDragDrop) { if (!m_args.m_enableDragDrop) {
@ -798,7 +798,7 @@ void Client::sendFileThread(void *filename)
m_sendFileThread.reset(nullptr); 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); m_server->sendDragInfo(fileCount, info.c_str(), size);
} }

View file

@ -109,13 +109,13 @@ public:
virtual void handshakeComplete(); virtual void handshakeComplete();
//! Received drag information //! 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 //! Create a new thread and use it to send file to Server
void sendFileToServer(const char *filename); void sendFileToServer(const char *filename);
//! Send dragging file information back to server //! 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 //! @name accessors
@ -177,7 +177,7 @@ public:
virtual void getCursorPos(int32_t &x, int32_t &y) const; virtual void getCursorPos(int32_t &x, int32_t &y) const;
// IClient overrides // 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 bool leave();
virtual void setClipboard(ClipboardID, const IClipboard *); virtual void setClipboard(ClipboardID, const IClipboard *);
virtual void grabClipboard(ClipboardID); virtual void grabClipboard(ClipboardID);

View file

@ -111,7 +111,7 @@ void ServerProxy::handleData(const Event &, void *)
{ {
// handle messages until there are no more. first read message code. // handle messages until there are no more. first read message code.
uint8_t code[4]; uint8_t code[4];
UInt32 n = m_stream->read(code, 4); uint32_t n = m_stream->read(code, 4);
while (n != 0) { while (n != 0) {
// verify we got an entire code // verify we got an entire code
if (n != 4) { if (n != 4) {
@ -416,7 +416,7 @@ KeyID ServerProxy::translateKey(KeyID id) const
}; };
KeyModifierID id2 = kKeyModifierIDNull; KeyModifierID id2 = kKeyModifierIDNull;
UInt32 side = 0; uint32_t side = 0;
switch (id) { switch (id) {
case kKeyShift_L: case kKeyShift_L:
id2 = kKeyModifierIDShift; id2 = kKeyModifierIDShift;
@ -515,7 +515,7 @@ void ServerProxy::enter()
// parse // parse
int16_t x, y; int16_t x, y;
uint16_t mask; uint16_t mask;
UInt32 seqNum; uint32_t seqNum;
ProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask); ProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask);
LOG((CLOG_DEBUG1 "recv enter, %d,%d %d %04x", 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 // parse
static std::string dataCached; static std::string dataCached;
ClipboardID id; ClipboardID id;
UInt32 seq; uint32_t seq;
int r = ClipboardChunk::assemble(m_stream, dataCached, id, seq); int r = ClipboardChunk::assemble(m_stream, dataCached, id, seq);
@ -572,7 +572,7 @@ void ServerProxy::grabClipboard()
{ {
// parse // parse
ClipboardID id; ClipboardID id;
UInt32 seqNum; uint32_t seqNum;
ProtocolUtil::readf(m_stream, kMsgCClipboard + 4, &id, &seqNum); ProtocolUtil::readf(m_stream, kMsgCClipboard + 4, &id, &seqNum);
LOG((CLOG_DEBUG "recv grab clipboard %d", id)); LOG((CLOG_DEBUG "recv grab clipboard %d", id));
@ -788,7 +788,7 @@ void ServerProxy::setOptions()
m_client->setOptions(options); m_client->setOptions(options);
// update modifier table // 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; KeyModifierID id = kKeyModifierIDNull;
if (options[i] == kOptionModifierMapForShift) { if (options[i] == kOptionModifierMapForShift) {
id = kKeyModifierIDShift; id = kKeyModifierIDShift;
@ -845,7 +845,7 @@ void ServerProxy::fileChunkReceived()
void ServerProxy::dragInfoReceived() void ServerProxy::dragInfoReceived()
{ {
// parse // parse
UInt32 fileNum = 0; uint32_t fileNum = 0;
std::string content; std::string content;
ProtocolUtil::readf(m_stream, kMsgDDragInfo + 4, &fileNum, &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); 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); std::string data(info, size);
ProtocolUtil::writef(m_stream, kMsgDDragInfo, fileCount, &data); ProtocolUtil::writef(m_stream, kMsgDDragInfo, fileCount, &data);

View file

@ -66,7 +66,7 @@ public:
void fileChunkSending(uint8_t mark, char *data, size_t dataSize); void fileChunkSending(uint8_t mark, char *data, size_t dataSize);
// sending dragging information to server // 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 #ifdef TEST_ENV
void handleDataForTest() void handleDataForTest()
@ -134,7 +134,7 @@ private:
Client *m_client; Client *m_client;
deskflow::IStream *m_stream; deskflow::IStream *m_stream;
UInt32 m_seqNum; uint32_t m_seqNum;
bool m_compressMouse; bool m_compressMouse;
bool m_compressMouseRelative; bool m_compressMouseRelative;

View file

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

View file

@ -31,7 +31,7 @@ ClipboardChunk::ClipboardChunk(size_t size) : Chunk(size)
m_dataSize = size - CLIPBOARD_CHUNK_META_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(); size_t sizeLength = size.size();
ClipboardChunk *start = new ClipboardChunk(sizeLength + CLIPBOARD_CHUNK_META_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; 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(); size_t dataSize = data.size();
ClipboardChunk *chunk = new ClipboardChunk(dataSize + CLIPBOARD_CHUNK_META_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; 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); ClipboardChunk *end = new ClipboardChunk(CLIPBOARD_CHUNK_META_SIZE);
char *chunk = end->m_chunk; char *chunk = end->m_chunk;
@ -74,7 +74,7 @@ ClipboardChunk *ClipboardChunk::end(ClipboardID id, UInt32 sequence)
return end; 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; uint8_t mark;
std::string data; std::string data;
@ -114,7 +114,7 @@ void ClipboardChunk::send(deskflow::IStream *stream, void *data)
char *chunk = clipboardData->m_chunk; char *chunk = clipboardData->m_chunk;
ClipboardID id = chunk[0]; ClipboardID id = chunk[0];
UInt32 sequence; uint32_t sequence;
std::memcpy(&sequence, &chunk[1], 4); std::memcpy(&sequence, &chunk[1], 4);
uint8_t mark = chunk[5]; uint8_t mark = chunk[5];
std::string dataChunk(&chunk[6], clipboardData->m_dataSize); std::string dataChunk(&chunk[6], clipboardData->m_dataSize);

View file

@ -34,11 +34,11 @@ class ClipboardChunk : public Chunk
public: public:
ClipboardChunk(size_t size); ClipboardChunk(size_t size);
static ClipboardChunk *start(ClipboardID id, UInt32 sequence, const std::string &size); static ClipboardChunk *start(ClipboardID id, uint32_t sequence, const std::string &size);
static ClipboardChunk *data(ClipboardID id, UInt32 sequence, const std::string &data); static ClipboardChunk *data(ClipboardID id, uint32_t sequence, const std::string &data);
static ClipboardChunk *end(ClipboardID id, UInt32 sequence); 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); static void send(deskflow::IStream *stream, void *data);

View file

@ -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 startPos = 0;
size_t findResult1 = 0; size_t findResult1 = 0;
@ -39,7 +39,7 @@ void DragInformation::parseDragInfo(DragFileList &dragFileList, UInt32 fileNum,
slash = "/"; slash = "/";
} }
UInt32 index = 0; uint32_t index = 0;
while (index < fileNum) { while (index < fileNum) {
findResult1 = data.find(',', startPos); findResult1 = data.find(',', startPos);
findResult2 = data.find_last_of(slash, findResult1); findResult2 = data.find_last_of(slash, findResult1);

View file

@ -50,7 +50,7 @@ public:
m_filesize = size; 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); static std::string getDragFileExtension(std::string filename);
// helper function to setup drag info // helper function to setup drag info
// example: filename1,filesize1,filename2,filesize2, // example: filename1,filesize1,filename2,filesize2,

View file

@ -45,7 +45,7 @@ public:
screen is being entered because the screen saver is starting. screen is being entered because the screen saver is starting.
Subsequent clipboard events should report \p seqNum. 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 //! Leave screen
/*! /*!

View file

@ -34,17 +34,17 @@ void IClipboard::unmarshall(IClipboard *clipboard, const std::string &data, Time
clipboard->empty(); clipboard->empty();
// read the number of formats // read the number of formats
const UInt32 numFormats = readUInt32(index); const uint32_t numFormats = readUInt32(index);
index += 4; index += 4;
// read each format // read each format
for (UInt32 i = 0; i < numFormats; ++i) { for (uint32_t i = 0; i < numFormats; ++i) {
// get the format id // get the format id
IClipboard::EFormat format = static_cast<IClipboard::EFormat>(readUInt32(index)); IClipboard::EFormat format = static_cast<IClipboard::EFormat>(readUInt32(index));
index += 4; index += 4;
// get the size of the format data // get the size of the format data
UInt32 size = readUInt32(index); uint32_t size = readUInt32(index);
index += 4; index += 4;
// save the data if it's a known format. if either the client // 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)) { if (clipboard->open(0)) {
// compute size of marshalled data // compute size of marshalled data
UInt32 size = 4; uint32_t size = 4;
UInt32 numFormats = 0; uint32_t numFormats = 0;
for (UInt32 format = 0; format != IClipboard::kNumFormats; ++format) { for (uint32_t format = 0; format != IClipboard::kNumFormats; ++format) {
if (clipboard->has(static_cast<IClipboard::EFormat>(format))) { if (clipboard->has(static_cast<IClipboard::EFormat>(format))) {
++numFormats; ++numFormats;
formatData[format] = clipboard->get(static_cast<IClipboard::EFormat>(format)); formatData[format] = clipboard->get(static_cast<IClipboard::EFormat>(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 // marshall the data
writeUInt32(&data, numFormats); 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<IClipboard::EFormat>(format))) { if (clipboard->has(static_cast<IClipboard::EFormat>(format))) {
writeUInt32(&data, format); writeUInt32(&data, format);
writeUInt32(&data, (UInt32)formatData[format].size()); writeUInt32(&data, (uint32_t)formatData[format].size());
data += formatData[format]; data += formatData[format];
} }
} }
@ -141,14 +141,14 @@ bool IClipboard::copy(IClipboard *dst, const IClipboard *src, Time time)
return success; return success;
} }
UInt32 IClipboard::readUInt32(const char *buf) uint32_t IClipboard::readUInt32(const char *buf)
{ {
const unsigned char *ubuf = reinterpret_cast<const unsigned char *>(buf); const unsigned char *ubuf = reinterpret_cast<const unsigned char *>(buf);
return (static_cast<UInt32>(ubuf[0]) << 24) | (static_cast<UInt32>(ubuf[1]) << 16) | return (static_cast<uint32_t>(ubuf[0]) << 24) | (static_cast<uint32_t>(ubuf[1]) << 16) |
(static_cast<UInt32>(ubuf[2]) << 8) | static_cast<UInt32>(ubuf[3]); (static_cast<uint32_t>(ubuf[2]) << 8) | static_cast<uint32_t>(ubuf[3]);
} }
void IClipboard::writeUInt32(std::string *buf, UInt32 v) void IClipboard::writeUInt32(std::string *buf, uint32_t v)
{ {
*buf += static_cast<uint8_t>((v >> 24) & 0xff); *buf += static_cast<uint8_t>((v >> 24) & 0xff);
*buf += static_cast<uint8_t>((v >> 16) & 0xff); *buf += static_cast<uint8_t>((v >> 16) & 0xff);

View file

@ -36,7 +36,7 @@ public:
arbitrary starting time. Timestamps will wrap around to 0 arbitrary starting time. Timestamps will wrap around to 0
after about 49 3/4 days. after about 49 3/4 days.
*/ */
using Time = UInt32; using Time = uint32_t;
//! Clipboard formats //! Clipboard formats
/*! /*!
@ -166,6 +166,6 @@ public:
//@} //@}
private: private:
static UInt32 readUInt32(const char *); static uint32_t readUInt32(const char *);
static void writeUInt32(std::string *, UInt32); static void writeUInt32(std::string *, uint32_t);
}; };

View file

@ -136,7 +136,7 @@ public:
/*! /*!
Sets the sequence number to use in subsequent clipboard events. Sets the sequence number to use in subsequent clipboard events.
*/ */
virtual void setSequenceNumber(UInt32) = 0; virtual void setSequenceNumber(uint32_t) = 0;
//! Change dragging status //! Change dragging status
virtual void setDraggingStarted(bool started) = 0; virtual void setDraggingStarted(bool started) = 0;
@ -167,14 +167,14 @@ public:
virtual void getCursorPos(int32_t &x, int32_t &y) const = 0; virtual void getCursorPos(int32_t &x, int32_t &y) const = 0;
// IPrimaryScreen overrides // 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 void warpCursor(int32_t x, int32_t y) = 0;
virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask) = 0; virtual uint32_t registerHotKey(KeyID key, KeyModifierMask mask) = 0;
virtual void unregisterHotKey(UInt32 id) = 0; virtual void unregisterHotKey(uint32_t id) = 0;
virtual void fakeInputBegin() = 0; virtual void fakeInputBegin() = 0;
virtual void fakeInputEnd() = 0; virtual void fakeInputEnd() = 0;
virtual int32_t getJumpZoneSize() const = 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; virtual void getCursorCenter(int32_t &x, int32_t &y) const = 0;
// ISecondaryScreen overrides // ISecondaryScreen overrides

View file

@ -74,7 +74,7 @@ IPrimaryScreen::WheelInfo *IPrimaryScreen::WheelInfo::alloc(int32_t xDelta, int3
// IPrimaryScreen::HotKeyInfo // IPrimaryScreen::HotKeyInfo
// //
IPrimaryScreen::HotKeyInfo *IPrimaryScreen::HotKeyInfo::alloc(UInt32 id) IPrimaryScreen::HotKeyInfo *IPrimaryScreen::HotKeyInfo::alloc(uint32_t id)
{ {
HotKeyInfo *info = (HotKeyInfo *)malloc(sizeof(HotKeyInfo)); HotKeyInfo *info = (HotKeyInfo *)malloc(sizeof(HotKeyInfo));
info->m_id = id; info->m_id = id;

View file

@ -69,10 +69,10 @@ public:
class HotKeyInfo class HotKeyInfo
{ {
public: public:
static HotKeyInfo *alloc(UInt32 id); static HotKeyInfo *alloc(uint32_t id);
public: public:
UInt32 m_id; uint32_t m_id;
}; };
class EiConnectInfo class EiConnectInfo
@ -94,7 +94,7 @@ public:
primary screen are linked to clients. Override to handle the primary screen are linked to clients. Override to handle the
possible change in jump zones. possible change in jump zones.
*/ */
virtual void reconfigure(UInt32 activeSides) = 0; virtual void reconfigure(uint32_t activeSides) = 0;
//! Warp cursor //! Warp cursor
/*! /*!
@ -125,13 +125,13 @@ public:
the modifiers in any order or to require the user to press the given key the modifiers in any order or to require the user to press the given key
last. last.
*/ */
virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask) = 0; virtual uint32_t registerHotKey(KeyID key, KeyModifierMask mask) = 0;
//! Unregister a system hotkey //! Unregister a system hotkey
/*! /*!
Unregisters a previously registered hot key. 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 //! Prepare to synthesize input on primary screen
/*! /*!
@ -165,7 +165,7 @@ public:
"current" means up to the last processed event but it can mean "current" means up to the last processed event but it can mean
the current physical mouse button state. 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 //! Get cursor center position
/*! /*!

View file

@ -36,7 +36,7 @@ public:
{ {
public: public:
ClipboardID m_id; ClipboardID m_id;
UInt32 m_sequenceNumber; uint32_t m_sequenceNumber;
}; };
//! @name accessors //! @name accessors

View file

@ -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 // disallow kKeyNone
if (id == kKeyNone) { if (id == kKeyNone) {
@ -155,7 +155,7 @@ bool KeyMap::addKeyCombinationEntry(KeyID id, int32_t group, const KeyID *keys,
// convert to buttons // convert to buttons
KeyItemList items; 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]); KeyIDMap::const_iterator gtIndex = m_keyIDMap.find(keys[i]);
if (gtIndex == m_keyIDMap.end()) { if (gtIndex == m_keyIDMap.end()) {
return false; return false;
@ -926,7 +926,7 @@ void KeyMap::addKeystrokes(
) const ) const
{ {
KeyButton button = keyItem.m_button; KeyButton button = keyItem.m_button;
UInt32 data = keyItem.m_client; uint32_t data = keyItem.m_client;
switch (type) { switch (type) {
case kKeystrokePress: case kKeystrokePress:
keystrokes.push_back(Keystroke(button, true, false, data)); keystrokes.push_back(Keystroke(button, true, false, data));
@ -1245,7 +1245,7 @@ bool KeyMap::KeyItem::operator==(const KeyItem &x) const
// KeyMap::Keystroke // 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_button = button;
m_data.m_button.m_press = press; m_data.m_button.m_press = press;

View file

@ -60,7 +60,7 @@ public:
KeyModifierMask m_generates{}; //!< Modifiers key is mapped to KeyModifierMask m_generates{}; //!< Modifiers key is mapped to
bool m_dead{}; //!< \c true if this is a dead KeyID bool m_dead{}; //!< \c true if this is a dead KeyID
bool m_lock{}; //!< \c true if this locks a modifier bool m_lock{}; //!< \c true if this locks a modifier
UInt32 m_client{}; //!< Client data uint32_t m_client{}; //!< Client data
public: public:
bool operator==(const KeyItem &) const; bool operator==(const KeyItem &) const;
@ -88,7 +88,7 @@ public:
kGroup //!< Set new group 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); Keystroke(int32_t group, bool absolute, bool restore);
public: public:
@ -98,7 +98,7 @@ public:
KeyButton m_button{}; //!< Button to synthesize KeyButton m_button{}; //!< Button to synthesize
bool m_press{}; //!< \c true iff press bool m_press{}; //!< \c true iff press
bool m_repeat{}; //!< \c true iff for an autorepeat bool m_repeat{}; //!< \c true iff for an autorepeat
UInt32 m_client{}; //!< Client data uint32_t m_client{}; //!< Client data
}; };
struct Group struct Group
{ {
@ -168,7 +168,7 @@ public:
least one key in \p keys is not in the map then nothing is added 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. 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 //! Enable composition across groups
/*! /*!

View file

@ -1051,7 +1051,7 @@ void KeyState::addCombinationEntries()
const KeyID *i = s_decomposeTable; const KeyID *i = s_decomposeTable;
while (*i != 0) { while (*i != 0) {
// count the decomposed keys for this key // count the decomposed keys for this key
UInt32 numKeys = 0; uint32_t numKeys = 0;
const KeyID *j = i; const KeyID *j = i;
while (*++j != 0) { while (*++j != 0) {
++numKeys; ++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 // do nothing if no keys or no repeats
if (count == 0 || keys.empty()) { if (count == 0 || keys.empty()) {

View file

@ -191,7 +191,7 @@ private:
void addCombinationEntries(); void addCombinationEntries();
// synthesize key events. synthesize auto-repeat events count times. // 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 // update key state to match changes to modifiers
void updateModifierKeyState(KeyButton button, const ModifierToKeys &oldModifiers, const ModifierToKeys &newModifiers); void updateModifierKeyState(KeyButton button, const ModifierToKeys &oldModifiers, const ModifierToKeys &newModifiers);
@ -224,7 +224,7 @@ private:
int32_t m_syntheticKeys[kNumButtons]; int32_t m_syntheticKeys[kNumButtons];
// client data for each pressed key // 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 // 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. // otherwise it's the local KeyButton synthesized for the server key.

View file

@ -51,7 +51,7 @@ void PacketStreamFilter::close()
StreamFilter::close(); StreamFilter::close();
} }
UInt32 PacketStreamFilter::read(void *buffer, UInt32 n) uint32_t PacketStreamFilter::read(void *buffer, uint32_t n)
{ {
if (n == 0) { if (n == 0) {
return 0; return 0;
@ -87,7 +87,7 @@ UInt32 PacketStreamFilter::read(void *buffer, UInt32 n)
return 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 // write the length of the payload
uint8_t length[4]; uint8_t length[4];
@ -115,7 +115,7 @@ bool PacketStreamFilter::isReady() const
return isReadyNoLock(); return isReadyNoLock();
} }
UInt32 PacketStreamFilter::getSize() const uint32_t PacketStreamFilter::getSize() const
{ {
Lock lock(&m_mutex); Lock lock(&m_mutex);
return isReadyNoLock() ? m_size : 0; return isReadyNoLock() ? m_size : 0;
@ -134,7 +134,8 @@ bool PacketStreamFilter::readPacketSize()
uint8_t buffer[4]; uint8_t buffer[4];
memcpy(buffer, m_buffer.peek(sizeof(buffer)), sizeof(buffer)); memcpy(buffer, m_buffer.peek(sizeof(buffer)), sizeof(buffer));
m_buffer.pop(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) { if (m_size > PROTOCOL_MAX_MESSAGE_LENGTH) {
m_events->addEvent(Event(m_events->forIStream().inputFormatError(), getEventTarget())); m_events->addEvent(Event(m_events->forIStream().inputFormatError(), getEventTarget()));
return false; return false;
@ -150,7 +151,7 @@ bool PacketStreamFilter::readMore()
// read more data // read more data
char buffer[4096]; char buffer[4096];
UInt32 n = getStream()->read(buffer, sizeof(buffer)); uint32_t n = getStream()->read(buffer, sizeof(buffer));
while (n > 0) { while (n > 0) {
m_buffer.write(buffer, n); m_buffer.write(buffer, n);

View file

@ -36,11 +36,11 @@ public:
// IStream overrides // IStream overrides
virtual void close(); virtual void close();
virtual UInt32 read(void *buffer, UInt32 n); virtual uint32_t read(void *buffer, uint32_t n);
virtual void write(const void *buffer, UInt32 n); virtual void write(const void *buffer, uint32_t n);
virtual void shutdownInput(); virtual void shutdownInput();
virtual bool isReady() const; virtual bool isReady() const;
virtual UInt32 getSize() const; virtual uint32_t getSize() const;
protected: protected:
// StreamFilter overrides // StreamFilter overrides
@ -53,7 +53,7 @@ private:
private: private:
Mutex m_mutex; Mutex m_mutex;
UInt32 m_size; uint32_t m_size;
StreamBuffer m_buffer; StreamBuffer m_buffer;
bool m_inputShutdown; bool m_inputShutdown;
IEventQueue *m_events; IEventQueue *m_events;

View file

@ -44,14 +44,14 @@ public:
virtual void getCursorPos(int32_t &x, int32_t &y) const = 0; virtual void getCursorPos(int32_t &x, int32_t &y) const = 0;
// IPrimaryScreen overrides // 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 void warpCursor(int32_t x, int32_t y) = 0;
virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask) = 0; virtual uint32_t registerHotKey(KeyID key, KeyModifierMask mask) = 0;
virtual void unregisterHotKey(UInt32 id) = 0; virtual void unregisterHotKey(uint32_t id) = 0;
virtual void fakeInputBegin() = 0; virtual void fakeInputBegin() = 0;
virtual void fakeInputEnd() = 0; virtual void fakeInputEnd() = 0;
virtual int32_t getJumpZoneSize() const = 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; virtual void getCursorCenter(int32_t &x, int32_t &y) const = 0;
// ISecondaryScreen overrides // ISecondaryScreen overrides
@ -105,7 +105,7 @@ public:
virtual void screensaver(bool activate) = 0; virtual void screensaver(bool activate) = 0;
virtual void resetOptions() = 0; virtual void resetOptions() = 0;
virtual void setOptions(const OptionsList &options) = 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 bool isPrimary() const = 0;
virtual void fakeDraggingFiles(DragFileList fileList) virtual void fakeDraggingFiles(DragFileList fileList)

View file

@ -34,7 +34,7 @@
namespace { namespace {
void writeInt(UInt32 Value, UInt32 Length, std::vector<uint8_t> &Buffer) void writeInt(uint32_t Value, uint32_t Length, std::vector<uint8_t> &Buffer)
{ {
switch (Length) { switch (Length) {
case 1: case 1:
@ -60,7 +60,7 @@ template <typename T> void writeVectorInt(const std::vector<T> *VectorData, std:
{ {
if (VectorData) { if (VectorData) {
const std::vector<T> &Vector = *VectorData; const std::vector<T> &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) { for (size_t i = 0; i < Vector.size(); ++i) {
writeInt(Vector[i], sizeof(T), Buffer); writeInt(Vector[i], sizeof(T), Buffer);
} }
@ -69,7 +69,7 @@ template <typename T> void writeVectorInt(const std::vector<T> *VectorData, std:
void writeString(const std::string *StringData, std::vector<uint8_t> &Buffer) void writeString(const std::string *StringData, std::vector<uint8_t> &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); writeInt(len, sizeof(len), Buffer);
if (len != 0) { if (len != 0) {
std::copy(StringData->begin(), StringData->end(), std::back_inserter(Buffer)); 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_list args;
va_start(args, fmt); va_start(args, fmt);
UInt32 size = getLength(fmt, args); uint32_t size = getLength(fmt, args);
va_end(args); va_end(args);
va_start(args, fmt); va_start(args, fmt);
vwritef(stream, fmt, size, args); vwritef(stream, fmt, size, args);
@ -115,7 +115,7 @@ bool ProtocolUtil::readf(deskflow::IStream *stream, const char *fmt, ...)
return result; 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(stream != NULL);
assert(fmt != NULL); assert(fmt != NULL);
@ -149,7 +149,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar
if (*fmt == '%') { if (*fmt == '%') {
// format specifier. determine argument size. // format specifier. determine argument size.
++fmt; ++fmt;
UInt32 len = eatLength(&fmt); uint32_t len = eatLength(&fmt);
switch (*fmt) { switch (*fmt) {
case 'i': { case 'i': {
void *destination = va_arg(args, void *); void *destination = va_arg(args, void *);
@ -164,7 +164,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar
break; break;
case 4: case 4:
// 4 byte integer // 4 byte integer
*static_cast<UInt32 *>(destination) = read4BytesInt(stream); *static_cast<uint32_t *>(destination) = read4BytesInt(stream);
break; break;
default: default:
// the length is wrong // the length is wrong
@ -188,7 +188,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar
break; break;
case 4: case 4:
// 4 byte integer // 4 byte integer
readVector4BytesInt(stream, *static_cast<std::vector<UInt32> *>(destination)); readVector4BytesInt(stream, *static_cast<std::vector<uint32_t> *>(destination));
break; break;
default: default:
// the length is wrong // 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) { while (*fmt) {
if (*fmt == '%') { if (*fmt == '%') {
// format specifier. determine argument size. // format specifier. determine argument size.
++fmt; ++fmt;
UInt32 len = eatLength(&fmt); uint32_t len = eatLength(&fmt);
switch (*fmt) { switch (*fmt) {
case 'i': case 'i':
assert(len == 1 || len == 2 || len == 4); assert(len == 1 || len == 2 || len == 4);
(void)va_arg(args, UInt32); (void)va_arg(args, uint32_t);
break; break;
case 'I': case 'I':
assert(len == 1 || len == 2 || len == 4); assert(len == 1 || len == 2 || len == 4);
switch (len) { switch (len) {
case 1: case 1:
len = (UInt32)(va_arg(args, std::vector<uint8_t> *))->size() + 4; len = (uint32_t)(va_arg(args, std::vector<uint8_t> *))->size() + 4;
break; break;
case 2: case 2:
len = 2 * (UInt32)(va_arg(args, std::vector<uint16_t> *))->size() + 4; len = 2 * (uint32_t)(va_arg(args, std::vector<uint16_t> *))->size() + 4;
break; break;
case 4: case 4:
len = 4 * (UInt32)(va_arg(args, std::vector<UInt32> *))->size() + 4; len = 4 * (uint32_t)(va_arg(args, std::vector<uint32_t> *))->size() + 4;
break; break;
} }
break; break;
case 's': case 's':
assert(len == 0); assert(len == 0);
len = (UInt32)(va_arg(args, std::string *))->size() + 4; len = (uint32_t)(va_arg(args, std::string *))->size() + 4;
break; break;
case 'S': case 'S':
assert(len == 0); assert(len == 0);
len = va_arg(args, UInt32) + 4; len = va_arg(args, uint32_t) + 4;
break; break;
case '%': case '%':
@ -306,10 +306,10 @@ void ProtocolUtil::writef(std::vector<uint8_t> &buffer, const char *fmt, va_list
if (*fmt == '%') { if (*fmt == '%') {
// format specifier. determine argument size. // format specifier. determine argument size.
++fmt; ++fmt;
UInt32 len = eatLength(&fmt); uint32_t len = eatLength(&fmt);
switch (*fmt) { switch (*fmt) {
case 'i': { case 'i': {
const UInt32 v = va_arg(args, UInt32); const uint32_t v = va_arg(args, uint32_t);
writeInt(v, len, buffer); writeInt(v, len, buffer);
break; break;
} }
@ -332,7 +332,7 @@ void ProtocolUtil::writef(std::vector<uint8_t> &buffer, const char *fmt, va_list
case 4: { case 4: {
// 4 byte integers // 4 byte integers
const std::vector<UInt32> *list = va_arg(args, const std::vector<UInt32> *); const std::vector<uint32_t> *list = va_arg(args, const std::vector<uint32_t> *);
writeVectorInt(list, buffer); writeVectorInt(list, buffer);
break; break;
} }
@ -353,7 +353,7 @@ void ProtocolUtil::writef(std::vector<uint8_t> &buffer, const char *fmt, va_list
case 'S': { case 'S': {
assert(len == 0); 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 *); const uint8_t *src = va_arg(args, uint8_t *);
writeInt(len, sizeof(len), buffer); writeInt(len, sizeof(len), buffer);
std::copy(src, src + len, std::back_inserter(buffer)); std::copy(src, src + len, std::back_inserter(buffer));
@ -378,12 +378,12 @@ void ProtocolUtil::writef(std::vector<uint8_t> &buffer, const char *fmt, va_list
} }
} }
UInt32 ProtocolUtil::eatLength(const char **pfmt) uint32_t ProtocolUtil::eatLength(const char **pfmt)
{ {
const char *fmt = *pfmt; const char *fmt = *pfmt;
UInt32 n = 0; uint32_t n = 0;
for (;;) { for (;;) {
UInt32 d; uint32_t d;
switch (*fmt) { switch (*fmt) {
case '0': case '0':
d = 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(stream != NULL);
assert(vbuffer != NULL); assert(vbuffer != NULL);
@ -432,7 +432,7 @@ void ProtocolUtil::read(deskflow::IStream *stream, void *vbuffer, UInt32 count)
uint8_t *buffer = static_cast<uint8_t *>(vbuffer); uint8_t *buffer = static_cast<uint8_t *>(vbuffer);
while (count > 0) { while (count > 0) {
// read more // read more
UInt32 n = stream->read(buffer, count); uint32_t n = stream->read(buffer, count);
// bail if stream has hungup // bail if stream has hungup
if (n == 0) { if (n == 0) {
@ -448,7 +448,7 @@ void ProtocolUtil::read(deskflow::IStream *stream, void *vbuffer, UInt32 count)
uint8_t ProtocolUtil::read1ByteInt(deskflow::IStream *stream) uint8_t ProtocolUtil::read1ByteInt(deskflow::IStream *stream)
{ {
const UInt32 BufferSize = 1; const uint32_t BufferSize = 1;
std::array<uint8_t, 1> buffer = {}; std::array<uint8_t, 1> buffer = {};
read(stream, buffer.data(), BufferSize); read(stream, buffer.data(), BufferSize);
@ -460,7 +460,7 @@ uint8_t ProtocolUtil::read1ByteInt(deskflow::IStream *stream)
uint16_t ProtocolUtil::read2BytesInt(deskflow::IStream *stream) uint16_t ProtocolUtil::read2BytesInt(deskflow::IStream *stream)
{ {
const UInt32 BufferSize = 2; const uint32_t BufferSize = 2;
std::array<uint8_t, BufferSize> buffer = {}; std::array<uint8_t, BufferSize> buffer = {};
read(stream, buffer.data(), BufferSize); read(stream, buffer.data(), BufferSize);
@ -470,14 +470,14 @@ uint16_t ProtocolUtil::read2BytesInt(deskflow::IStream *stream)
return Result; return Result;
} }
UInt32 ProtocolUtil::read4BytesInt(deskflow::IStream *stream) uint32_t ProtocolUtil::read4BytesInt(deskflow::IStream *stream)
{ {
const int BufferSize = 4; const int BufferSize = 4;
std::array<uint8_t, BufferSize> buffer = {}; std::array<uint8_t, BufferSize> buffer = {};
read(stream, buffer.data(), BufferSize); read(stream, buffer.data(), BufferSize);
UInt32 Result = (static_cast<UInt32>(buffer[0]) << 24) | (static_cast<UInt32>(buffer[1]) << 16) | uint32_t Result = (static_cast<uint32_t>(buffer[0]) << 24) | (static_cast<uint32_t>(buffer[1]) << 16) |
(static_cast<UInt32>(buffer[2]) << 8) | (static_cast<UInt32>(buffer[3])); (static_cast<uint32_t>(buffer[2]) << 8) | (static_cast<uint32_t>(buffer[3]));
LOG((CLOG_DEBUG2 "readf: read 4 byte integer: %d (0x%x)", Result, Result)); 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<uint8_t> &destination) void ProtocolUtil::readVector1ByteInt(deskflow::IStream *stream, std::vector<uint8_t> &destination)
{ {
UInt32 size = readVectorSize(stream); uint32_t size = readVectorSize(stream);
for (UInt32 i = 0; i < size; ++i) { for (uint32_t i = 0; i < size; ++i) {
destination.push_back(read1ByteInt(stream)); destination.push_back(read1ByteInt(stream));
} }
} }
void ProtocolUtil::readVector2BytesInt(deskflow::IStream *stream, std::vector<uint16_t> &destination) void ProtocolUtil::readVector2BytesInt(deskflow::IStream *stream, std::vector<uint16_t> &destination)
{ {
UInt32 size = readVectorSize(stream); uint32_t size = readVectorSize(stream);
for (UInt32 i = 0; i < size; ++i) { for (uint32_t i = 0; i < size; ++i) {
destination.push_back(read2BytesInt(stream)); destination.push_back(read2BytesInt(stream));
} }
} }
void ProtocolUtil::readVector4BytesInt(deskflow::IStream *stream, std::vector<UInt32> &destination) void ProtocolUtil::readVector4BytesInt(deskflow::IStream *stream, std::vector<uint32_t> &destination)
{ {
UInt32 size = readVectorSize(stream); uint32_t size = readVectorSize(stream);
for (UInt32 i = 0; i < size; ++i) { for (uint32_t i = 0; i < size; ++i) {
destination.push_back(read4BytesInt(stream)); 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) { if (size > PROTOCOL_MAX_LIST_LENGTH) {
LOG((CLOG_ERR "readVectorSize: vector length exceeds maximum allowed size: %u", size)); LOG((CLOG_ERR "readVectorSize: vector length exceeds maximum allowed size: %u", size));
@ -520,7 +520,7 @@ UInt32 ProtocolUtil::readVectorSize(deskflow::IStream *stream)
return size; 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 // read the string length
uint8_t buffer[128]; uint8_t buffer[128];

View file

@ -50,7 +50,7 @@ public:
- \%4i -- converts integer argument to 4 byte integer in NBO - \%4i -- converts integer argument to 4 byte integer in NBO
- \%1I -- converts std::vector<uint8_t>* to 1 byte integers - \%1I -- converts std::vector<uint8_t>* to 1 byte integers
- \%2I -- converts std::vector<uint16_t>* to 2 byte integers in NBO - \%2I -- converts std::vector<uint16_t>* to 2 byte integers in NBO
- \%4I -- converts std::vector<UInt32>* to 4 byte integers in NBO - \%4I -- converts std::vector<uint32_t>* to 4 byte integers in NBO
- \%s -- converts std::string* to stream of bytes - \%s -- converts std::string* to stream of bytes
- \%S -- converts integer N and const uint8_t* to stream of N bytes - \%S -- converts integer N and const uint8_t* to stream of N bytes
*/ */
@ -64,44 +64,44 @@ public:
Format specifiers are: Format specifiers are:
- \%\% -- read (and discard) a literal `\%' - \%\% -- read (and discard) a literal `\%'
- \%1i -- reads a 1 byte integer; argument is a 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* - \%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* - \%4i -- reads an NBO 4 byte integer; arg is int32_t* or uint32_t*
- \%1I -- reads 1 byte integers; arg is std::vector<uint8_t>* - \%1I -- reads 1 byte integers; arg is std::vector<uint8_t>*
- \%2I -- reads NBO 2 byte integers; arg is std::vector<uint16_t>* - \%2I -- reads NBO 2 byte integers; arg is std::vector<uint16_t>*
- \%4I -- reads NBO 4 byte integers; arg is std::vector<UInt32>* - \%4I -- reads NBO 4 byte integers; arg is std::vector<uint32_t>*
- \%s -- reads bytes; argument must be a std::string*, \b not a char* - \%s -- reads bytes; argument must be a std::string*, \b not a char*
*/ */
static bool readf(deskflow::IStream *, const char *fmt, ...); static bool readf(deskflow::IStream *, const char *fmt, ...);
private: 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 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<uint8_t> &, const char *fmt, va_list); static void writef(std::vector<uint8_t> &, const char *fmt, va_list);
static UInt32 eatLength(const char **fmt); static uint32_t eatLength(const char **fmt);
static void read(deskflow::IStream *, void *, UInt32); static void read(deskflow::IStream *, void *, uint32_t);
/** /**
* @brief Handles 1,2, or 4 byte Integers * @brief Handles 1,2, or 4 byte Integers
*/ */
static uint8_t read1ByteInt(deskflow::IStream *stream); static uint8_t read1ByteInt(deskflow::IStream *stream);
static uint16_t read2BytesInt(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 * @brief Handles a Vector of integers
*/ */
static void readVector1ByteInt(deskflow::IStream *, std::vector<uint8_t> &); static void readVector1ByteInt(deskflow::IStream *, std::vector<uint8_t> &);
static void readVector2BytesInt(deskflow::IStream *, std::vector<uint16_t> &); static void readVector2BytesInt(deskflow::IStream *, std::vector<uint16_t> &);
static void readVector4BytesInt(deskflow::IStream *, std::vector<UInt32> &); static void readVector4BytesInt(deskflow::IStream *, std::vector<uint32_t> &);
static UInt32 readVectorSize(deskflow::IStream *stream); static uint32_t readVectorSize(deskflow::IStream *stream);
/** /**
* @brief Handles an array of bytes * @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 //! Mismatched read exception

View file

@ -171,7 +171,7 @@ bool Screen::leave()
return true; return true;
} }
void Screen::reconfigure(UInt32 activeSides) void Screen::reconfigure(uint32_t activeSides)
{ {
assert(m_isPrimary); assert(m_isPrimary);
m_screen->reconfigure(activeSides); m_screen->reconfigure(activeSides);
@ -261,7 +261,7 @@ void Screen::resetOptions()
void Screen::setOptions(const OptionsList &options) void Screen::setOptions(const OptionsList &options)
{ {
// update 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] == kOptionHalfDuplexCapsLock) {
if (options[i + 1] != 0) { if (options[i + 1] != 0) {
m_halfDuplex |= KeyModifierCapsLock; m_halfDuplex |= KeyModifierCapsLock;
@ -293,17 +293,17 @@ void Screen::setOptions(const OptionsList &options)
m_screen->setOptions(options); m_screen->setOptions(options);
} }
void Screen::setSequenceNumber(UInt32 seqNum) void Screen::setSequenceNumber(uint32_t seqNum)
{ {
m_screen->setSequenceNumber(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); return m_screen->registerHotKey(key, mask);
} }
void Screen::unregisterHotKey(UInt32 id) void Screen::unregisterHotKey(uint32_t id)
{ {
m_screen->unregisterHotKey(id); m_screen->unregisterHotKey(id);
} }
@ -333,7 +333,7 @@ bool Screen::isLockedToScreen() const
{ {
// check for pressed mouse buttons // check for pressed mouse buttons
// HACK: commented out as it breaks new drag drop feature // HACK: commented out as it breaks new drag drop feature
UInt32 buttonID = 0; uint32_t buttonID = 0;
if (m_screen->isAnyMouseButtonDown(buttonID)) { if (m_screen->isAnyMouseButtonDown(buttonID)) {
if (buttonID != kButtonLeft) { if (buttonID != kButtonLeft) {

View file

@ -90,7 +90,7 @@ public:
is a bitmask of EDirectionMask indicating which sides of the is a bitmask of EDirectionMask indicating which sides of the
primary screen are linked to clients. primary screen are linked to clients.
*/ */
void reconfigure(UInt32 activeSides); void reconfigure(uint32_t activeSides);
//! Warp cursor //! Warp cursor
/*! /*!
@ -197,20 +197,20 @@ public:
/*! /*!
Sets the sequence number to use in subsequent clipboard events. Sets the sequence number to use in subsequent clipboard events.
*/ */
void setSequenceNumber(UInt32); void setSequenceNumber(uint32_t);
//! Register a system hotkey //! Register a system hotkey
/*! /*!
Registers a system-wide hotkey for key \p key with modifiers \p mask. Registers a system-wide hotkey for key \p key with modifiers \p mask.
Returns an id used to unregister the hotkey. 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 //! Unregister a system hotkey
/*! /*!
Unregisters a previously registered hot key. Unregisters a previously registered hot key.
*/ */
void unregisterHotKey(UInt32 id); void unregisterHotKey(uint32_t id);
//! Prepare to synthesize input on primary screen //! Prepare to synthesize input on primary screen
/*! /*!

View file

@ -106,7 +106,7 @@ void StreamChunker::sendFile(char *filename, IEventQueue *events, void *eventTar
} }
void StreamChunker::sendClipboard( 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) // send first message (data size)

View file

@ -29,7 +29,7 @@ class StreamChunker
public: public:
static void sendFile(char *filename, IEventQueue *events, void *eventTarget); static void sendFile(char *filename, IEventQueue *events, void *eventTarget);
static void sendClipboard( 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(); static void interruptFile();

View file

@ -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 // Typedef has to be used on mac os as this is used in objective-C
#if __APPLE__ #if __APPLE__
typedef UInt32 KeyID; typedef uint32_t KeyID;
#else #else
using KeyID = UInt32; using KeyID = uint32_t;
#endif #endif
//! Key Code //! Key Code
@ -51,9 +51,9 @@ using KeyButton = uint16_t;
Type to hold a bitmask of key modifiers (e.g. shift keys). Type to hold a bitmask of key modifiers (e.g. shift keys).
*/ */
#if __APPLE__ #if __APPLE__
typedef UInt32 KeyModifierMask; typedef uint32_t KeyModifierMask;
#else #else
using KeyModifierMask = UInt32; using KeyModifierMask = uint32_t;
#endif #endif
//! Modifier key ID //! Modifier key ID
@ -61,9 +61,9 @@ using KeyModifierMask = UInt32;
Type to hold the id of a key modifier (e.g. a shift key). Type to hold the id of a key modifier (e.g. a shift key).
*/ */
#if __APPLE__ #if __APPLE__
typedef UInt32 KeyModifierID; typedef uint32_t KeyModifierID;
#else #else
using KeyModifierID = UInt32; using KeyModifierID = uint32_t;
#endif #endif
//! @name Modifier key masks //! @name Modifier key masks
@ -82,17 +82,17 @@ static const KeyModifierMask KeyModifierScrollLock = 0x4000;
//! @name Modifier key bits //! @name Modifier key bits
//@{ //@{
static const UInt32 kKeyModifierBitNone = 16; static const uint32_t kKeyModifierBitNone = 16;
static const UInt32 kKeyModifierBitShift = 0; static const uint32_t kKeyModifierBitShift = 0;
static const UInt32 kKeyModifierBitControl = 1; static const uint32_t kKeyModifierBitControl = 1;
static const UInt32 kKeyModifierBitAlt = 2; static const uint32_t kKeyModifierBitAlt = 2;
static const UInt32 kKeyModifierBitMeta = 3; static const uint32_t kKeyModifierBitMeta = 3;
static const UInt32 kKeyModifierBitSuper = 4; static const uint32_t kKeyModifierBitSuper = 4;
static const UInt32 kKeyModifierBitAltGr = 5; static const uint32_t kKeyModifierBitAltGr = 5;
static const UInt32 kKeyModifierBitLevel5Lock = 6; static const uint32_t kKeyModifierBitLevel5Lock = 6;
static const UInt32 kKeyModifierBitCapsLock = 12; static const uint32_t kKeyModifierBitCapsLock = 12;
static const UInt32 kKeyModifierBitNumLock = 13; static const uint32_t kKeyModifierBitNumLock = 13;
static const UInt32 kKeyModifierBitScrollLock = 14; static const uint32_t kKeyModifierBitScrollLock = 14;
static const int32_t kKeyModifierNumBits = 16; static const int32_t kKeyModifierNumBits = 16;
//@} //@}

View file

@ -25,7 +25,7 @@
/*! /*!
Type to hold an option identifier. Type to hold an option identifier.
*/ */
using OptionID = UInt32; using OptionID = uint32_t;
//! Option Value //! Option Value
/*! /*!
@ -34,14 +34,14 @@ Type to hold an option value.
using OptionValue = int32_t; using OptionValue = int32_t;
// for now, options are just pairs of integers // for now, options are just pairs of integers
using OptionsList = std::vector<UInt32>; using OptionsList = std::vector<uint32_t>;
// macro for packing 4 character strings into 4 byte integers // macro for packing 4 character strings into 4 byte integers
#define OPTION_CODE(_s) \ #define OPTION_CODE(_s) \
(static_cast<UInt32>(static_cast<unsigned char>(_s[0]) << 24) | \ (static_cast<uint32_t>(static_cast<unsigned char>(_s[0]) << 24) | \
static_cast<UInt32>(static_cast<unsigned char>(_s[1]) << 16) | \ static_cast<uint32_t>(static_cast<unsigned char>(_s[1]) << 16) | \
static_cast<UInt32>(static_cast<unsigned char>(_s[2]) << 8) | \ static_cast<uint32_t>(static_cast<unsigned char>(_s[2]) << 8) | \
static_cast<UInt32>(static_cast<unsigned char>(_s[3]))) static_cast<uint32_t>(static_cast<unsigned char>(_s[3])))
//! @name Option identifiers //! @name Option identifiers
//@{ //@{

View file

@ -41,7 +41,7 @@ static const int16_t kProtocolMinorVersion = 8;
static const uint16_t kDefaultPort = 24800; static const uint16_t kDefaultPort = 24800;
// maximum total length for greeting returned by client // 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 // time between kMsgCKeepAlive (in seconds). a non-positive value disables
// keep alives. this is the default rate that can be overridden using an // keep alives. this is the default rate that can be overridden using an

View file

@ -57,7 +57,7 @@ public:
(zero if no data is available or input is shutdown). \p buffer (zero if no data is available or input is shutdown). \p buffer
may be NULL in which case the data is discarded. 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 //! Write to stream
/*! /*!
@ -66,7 +66,7 @@ public:
order to return more quickly. A output error event is generated order to return more quickly. A output error event is generated
when writing fails. 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 //! Flush the stream
/*! /*!
@ -115,7 +115,7 @@ public:
Some streams may not be able to determine this and will always Some streams may not be able to determine this and will always
return zero. return zero.
*/ */
virtual UInt32 getSize() const = 0; virtual uint32_t getSize() const = 0;
//@} //@}
}; };

View file

@ -23,7 +23,7 @@
// StreamBuffer // StreamBuffer
// //
const UInt32 StreamBuffer::kChunkSize = 4096; const uint32_t StreamBuffer::kChunkSize = 4096;
StreamBuffer::StreamBuffer() : m_size(0), m_headUsed(0) StreamBuffer::StreamBuffer() : m_size(0), m_headUsed(0)
{ {
@ -35,7 +35,7 @@ StreamBuffer::~StreamBuffer()
// do nothing // do nothing
} }
const void *StreamBuffer::peek(UInt32 n) const void *StreamBuffer::peek(uint32_t n)
{ {
assert(n <= m_size); assert(n <= m_size);
@ -60,7 +60,7 @@ const void *StreamBuffer::peek(UInt32 n)
return static_cast<const void *>(&(head->begin()[m_headUsed])); return static_cast<const void *>(&(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 // discard all chunks if n is greater than or equal to m_size
if (n >= m_size) { if (n >= m_size) {
@ -77,7 +77,7 @@ void StreamBuffer::pop(UInt32 n)
ChunkList::iterator scan = m_chunks.begin(); ChunkList::iterator scan = m_chunks.begin();
assert(scan != m_chunks.end()); assert(scan != m_chunks.end());
while (scan->size() - m_headUsed <= n) { while (scan->size() - m_headUsed <= n) {
n -= (UInt32)scan->size() - m_headUsed; n -= (uint32_t)scan->size() - m_headUsed;
m_headUsed = 0; m_headUsed = 0;
scan = m_chunks.erase(scan); scan = m_chunks.erase(scan);
assert(scan != m_chunks.end()); 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); assert(vdata != NULL);
@ -118,7 +118,7 @@ void StreamBuffer::write(const void *vdata, UInt32 n)
while (n > 0) { while (n > 0) {
// choose number of bytes for next chunk // choose number of bytes for next chunk
assert(scan->size() <= kChunkSize); assert(scan->size() <= kChunkSize);
UInt32 count = kChunkSize - (UInt32)scan->size(); uint32_t count = kChunkSize - (uint32_t)scan->size();
if (count > n) if (count > n)
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; return m_size;
} }

View file

@ -41,20 +41,20 @@ public:
(which must be <= getSize()). The caller must not modify the returned (which must be <= getSize()). The caller must not modify the returned
memory nor delete it. memory nor delete it.
*/ */
const void *peek(UInt32 n); const void *peek(uint32_t n);
//! Discard data //! Discard data
/*! /*!
Discards the next \c n bytes. If \c n >= getSize() then the buffer Discards the next \c n bytes. If \c n >= getSize() then the buffer
is cleared. is cleared.
*/ */
void pop(UInt32 n); void pop(uint32_t n);
//! Write data to buffer //! Write data to buffer
/*! /*!
Appends \c n bytes from \c data to the 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 //! @name accessors
@ -64,17 +64,17 @@ public:
/*! /*!
Returns the number of bytes in the buffer. Returns the number of bytes in the buffer.
*/ */
UInt32 getSize() const; uint32_t getSize() const;
//@} //@}
private: private:
static const UInt32 kChunkSize; static const uint32_t kChunkSize;
using Chunk = std::vector<uint8_t>; using Chunk = std::vector<uint8_t>;
using ChunkList = std::list<Chunk>; using ChunkList = std::list<Chunk>;
ChunkList m_chunks; ChunkList m_chunks;
UInt32 m_size; uint32_t m_size;
UInt32 m_headUsed; uint32_t m_headUsed;
}; };

View file

@ -50,12 +50,12 @@ void StreamFilter::close()
getStream()->close(); getStream()->close();
} }
UInt32 StreamFilter::read(void *buffer, UInt32 n) uint32_t StreamFilter::read(void *buffer, uint32_t n)
{ {
return getStream()->read(buffer, 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); getStream()->write(buffer, n);
} }
@ -85,7 +85,7 @@ bool StreamFilter::isReady() const
return getStream()->isReady(); return getStream()->isReady();
} }
UInt32 StreamFilter::getSize() const uint32_t StreamFilter::getSize() const
{ {
return getStream()->getSize(); return getStream()->getSize();
} }

View file

@ -46,14 +46,14 @@ public:
// These all just forward to the underlying stream except getEventTarget. // These all just forward to the underlying stream except getEventTarget.
// Override as necessary. getEventTarget returns a pointer to this. // Override as necessary. getEventTarget returns a pointer to this.
virtual void close(); virtual void close();
virtual UInt32 read(void *buffer, UInt32 n); virtual uint32_t read(void *buffer, uint32_t n);
virtual void write(const void *buffer, UInt32 n); virtual void write(const void *buffer, uint32_t n);
virtual void flush(); virtual void flush();
virtual void shutdownInput(); virtual void shutdownInput();
virtual void shutdownOutput(); virtual void shutdownOutput();
virtual void *getEventTarget() const; virtual void *getEventTarget() const;
virtual bool isReady() const; virtual bool isReady() const;
virtual UInt32 getSize() const; virtual uint32_t getSize() const;
//! Get the stream //! Get the stream
/*! /*!

View file

@ -90,7 +90,7 @@ void IpcClientProxy::handleData(const Event &, void *)
LOG((CLOG_DEBUG "start ipc handle data")); LOG((CLOG_DEBUG "start ipc handle data"));
uint8_t code[4]; uint8_t code[4];
UInt32 n = m_stream.read(code, 4); uint32_t n = m_stream.read(code, 4);
while (n != 0) { while (n != 0) {
LOG((CLOG_DEBUG "ipc read: %c%c%c%c", code[0], code[1], code[2], code[3])); LOG((CLOG_DEBUG "ipc read: %c%c%c%c", code[0], code[1], code[2], code[3]));

View file

@ -47,7 +47,7 @@ void IpcServerProxy::handleData(const Event &, void *)
LOG((CLOG_DEBUG "start ipc handle data")); LOG((CLOG_DEBUG "start ipc handle data"));
uint8_t code[4]; uint8_t code[4];
UInt32 n = m_stream.read(code, 4); uint32_t n = m_stream.read(code, 4);
while (n != 0) { while (n != 0) {
LOG((CLOG_DEBUG "ipc read: %c%c%c%c", code[0], code[1], code[2], code[3])); LOG((CLOG_DEBUG "ipc read: %c%c%c%c", code[0], code[1], code[2], code[3]));

View file

@ -67,12 +67,12 @@ public:
virtual void *getEventTarget() const; virtual void *getEventTarget() const;
// IStream overrides // IStream overrides
virtual UInt32 read(void *buffer, UInt32 n) = 0; virtual uint32_t read(void *buffer, uint32_t n) = 0;
virtual void write(const void *buffer, UInt32 n) = 0; virtual void write(const void *buffer, uint32_t n) = 0;
virtual void flush() = 0; virtual void flush() = 0;
virtual void shutdownInput() = 0; virtual void shutdownInput() = 0;
virtual void shutdownOutput() = 0; virtual void shutdownOutput() = 0;
virtual bool isReady() const = 0; virtual bool isReady() const = 0;
virtual bool isFatal() const = 0; virtual bool isFatal() const = 0;
virtual UInt32 getSize() const = 0; virtual uint32_t getSize() const = 0;
}; };

View file

@ -77,11 +77,11 @@ void *InverseClientSocket::getEventTarget() const
return const_cast<void *>(static_cast<const void *>(this)); return const_cast<void *>(static_cast<const void *>(this));
} }
UInt32 InverseClientSocket::read(void *buffer, UInt32 n) uint32_t InverseClientSocket::read(void *buffer, uint32_t n)
{ {
// copy data directly from our input buffer // copy data directly from our input buffer
Lock lock(&m_mutex); Lock lock(&m_mutex);
UInt32 size = m_inputBuffer.getSize(); uint32_t size = m_inputBuffer.getSize();
if (n > size) { if (n > size) {
n = size; n = size;
} }
@ -99,7 +99,7 @@ UInt32 InverseClientSocket::read(void *buffer, UInt32 n)
return n; return n;
} }
void InverseClientSocket::write(const void *buffer, UInt32 n) void InverseClientSocket::write(const void *buffer, uint32_t n)
{ {
bool wasEmpty; bool wasEmpty;
{ {
@ -193,7 +193,7 @@ bool InverseClientSocket::isFatal() const
return false; return false;
} }
UInt32 InverseClientSocket::getSize() const uint32_t InverseClientSocket::getSize() const
{ {
Lock lock(&m_mutex); Lock lock(&m_mutex);
return m_inputBuffer.getSize(); return m_inputBuffer.getSize();
@ -220,7 +220,7 @@ InverseClientSocket::EJobResult InverseClientSocket::doRead()
// slurp up as much as possible // slurp up as much as possible
do { do {
m_inputBuffer.write(buffer, static_cast<UInt32>(bytesRead)); m_inputBuffer.write(buffer, static_cast<uint32_t>(bytesRead));
bytesRead = m_socket.readSocket(buffer, sizeof(buffer)); bytesRead = m_socket.readSocket(buffer, sizeof(buffer));
} while (bytesRead > 0); } while (bytesRead > 0);
@ -247,9 +247,9 @@ InverseClientSocket::EJobResult InverseClientSocket::doRead()
InverseClientSocket::EJobResult InverseClientSocket::doWrite() InverseClientSocket::EJobResult InverseClientSocket::doWrite()
{ {
UInt32 bufferSize = m_outputBuffer.getSize(); uint32_t bufferSize = m_outputBuffer.getSize();
auto buffer = static_cast<const uint8_t *>(m_outputBuffer.peek(bufferSize)); auto buffer = static_cast<const uint8_t *>(m_outputBuffer.peek(bufferSize));
const auto bytesWrote = static_cast<UInt32>(m_socket.writeSocket(buffer, bufferSize)); const auto bytesWrote = static_cast<uint32_t>(m_socket.writeSocket(buffer, bufferSize));
if (bytesWrote > 0) { if (bytesWrote > 0) {
discardWrittenData(bytesWrote); discardWrittenData(bytesWrote);

View file

@ -49,14 +49,14 @@ public:
void *getEventTarget() const override; void *getEventTarget() const override;
// IStream overrides // IStream overrides
UInt32 read(void *buffer, UInt32 n) override; uint32_t read(void *buffer, uint32_t n) override;
void write(const void *buffer, UInt32 n) override; void write(const void *buffer, uint32_t n) override;
void flush() override; void flush() override;
void shutdownInput() override; void shutdownInput() override;
void shutdownOutput() override; void shutdownOutput() override;
bool isReady() const override; bool isReady() const override;
bool isFatal() const override; bool isFatal() const override;
UInt32 getSize() const override; uint32_t getSize() const override;
// IDataSocket overrides // IDataSocket overrides
void connect(const NetworkAddress &) override; void connect(const NetworkAddress &) override;

View file

@ -200,7 +200,7 @@ void SocketMultiplexer::serviceThread(void *)
if (status != 0) { if (status != 0) {
// iterate over socket jobs, invoking each and saving the // iterate over socket jobs, invoking each and saving the
// new job. // new job.
UInt32 i = 0; uint32_t i = 0;
JobCursor cursor = newCursor(); JobCursor cursor = newCursor();
JobCursor jobCursor = nextCursor(cursor); JobCursor jobCursor = nextCursor(cursor);
while (i < pfds.size() && jobCursor != m_socketJobs.end()) { while (i < pfds.size() && jobCursor != m_socketJobs.end()) {

View file

@ -129,11 +129,11 @@ void *TCPSocket::getEventTarget() const
return const_cast<void *>(static_cast<const void *>(this)); return const_cast<void *>(static_cast<const void *>(this));
} }
UInt32 TCPSocket::read(void *buffer, UInt32 n) uint32_t TCPSocket::read(void *buffer, uint32_t n)
{ {
// copy data directly from our input buffer // copy data directly from our input buffer
Lock lock(&m_mutex); Lock lock(&m_mutex);
UInt32 size = m_inputBuffer.getSize(); uint32_t size = m_inputBuffer.getSize();
if (n > size) { if (n > size) {
n = size; n = size;
} }
@ -151,7 +151,7 @@ UInt32 TCPSocket::read(void *buffer, UInt32 n)
return n; return n;
} }
void TCPSocket::write(const void *buffer, UInt32 n) void TCPSocket::write(const void *buffer, uint32_t n)
{ {
bool wasEmpty; bool wasEmpty;
{ {
@ -255,7 +255,7 @@ bool TCPSocket::isFatal() const
return false; return false;
} }
UInt32 TCPSocket::getSize() const uint32_t TCPSocket::getSize() const
{ {
Lock lock(&m_mutex); Lock lock(&m_mutex);
return m_inputBuffer.getSize(); return m_inputBuffer.getSize();
@ -324,7 +324,7 @@ TCPSocket::EJobResult TCPSocket::doRead()
// slurp up as much as possible // slurp up as much as possible
do { do {
m_inputBuffer.write(buffer, static_cast<UInt32>(bytesRead)); m_inputBuffer.write(buffer, static_cast<uint32_t>(bytesRead));
if (m_inputBuffer.getSize() > MAX_INPUT_BUFFER_SIZE) { if (m_inputBuffer.getSize() > MAX_INPUT_BUFFER_SIZE) {
break; break;
@ -356,12 +356,12 @@ TCPSocket::EJobResult TCPSocket::doRead()
TCPSocket::EJobResult TCPSocket::doWrite() TCPSocket::EJobResult TCPSocket::doWrite()
{ {
// write data // write data
UInt32 bufferSize = 0; uint32_t bufferSize = 0;
int bytesWrote = 0; int bytesWrote = 0;
bufferSize = m_outputBuffer.getSize(); bufferSize = m_outputBuffer.getSize();
const void *buffer = m_outputBuffer.peek(bufferSize); 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) { if (bytesWrote > 0) {
discardWrittenData(bytesWrote); discardWrittenData(bytesWrote);

View file

@ -55,14 +55,14 @@ public:
virtual void *getEventTarget() const; virtual void *getEventTarget() const;
// IStream overrides // IStream overrides
virtual UInt32 read(void *buffer, UInt32 n); virtual uint32_t read(void *buffer, uint32_t n);
virtual void write(const void *buffer, UInt32 n); virtual void write(const void *buffer, uint32_t n);
virtual void flush(); virtual void flush();
virtual void shutdownInput(); virtual void shutdownInput();
virtual void shutdownOutput(); virtual void shutdownOutput();
virtual bool isReady() const; virtual bool isReady() const;
virtual bool isFatal() const; virtual bool isFatal() const;
virtual UInt32 getSize() const; virtual uint32_t getSize() const;
// IDataSocket overrides // IDataSocket overrides
virtual void connect(const NetworkAddress &); virtual void connect(const NetworkAddress &);

View file

@ -23,11 +23,11 @@ class IOSXKeyResource : public IInterface
{ {
public: public:
virtual bool isValid() const = 0; virtual bool isValid() const = 0;
virtual UInt32 getNumModifierCombinations() const = 0; virtual uint32_t getNumModifierCombinations() const = 0;
virtual UInt32 getNumTables() const = 0; virtual uint32_t getNumTables() const = 0;
virtual UInt32 getNumButtons() const = 0; virtual uint32_t getNumButtons() const = 0;
virtual UInt32 getTableForModifier(UInt32 mask) const = 0; virtual uint32_t getTableForModifier(uint32_t mask) const = 0;
virtual KeyID getKey(UInt32 table, UInt32 button) const = 0; virtual KeyID getKey(uint32_t table, uint32_t button) const = 0;
// Convert a character in the current script to the equivalent KeyID // Convert a character in the current script to the equivalent KeyID
static KeyID getKeyID(uint8_t); static KeyID getKeyID(uint8_t);

View file

@ -42,7 +42,7 @@ MSWindowsClipboardAnyTextConverter::fromIClipboard(const std::string &data) cons
{ {
// convert linefeeds and then convert to desired encoding // convert linefeeds and then convert to desired encoding
std::string text = doFromIClipboard(convertLinefeedToWin32(data)); std::string text = doFromIClipboard(convertLinefeedToWin32(data));
UInt32 size = (UInt32)text.size(); uint32_t size = (uint32_t)text.size();
// copy to memory handle // copy to memory handle
HGLOBAL gData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, size); HGLOBAL gData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, size);
@ -65,7 +65,7 @@ std::string MSWindowsClipboardAnyTextConverter::toIClipboard(HANDLE data) const
{ {
// get datator // get datator
const char *src = (const char *)GlobalLock(data); const char *src = (const char *)GlobalLock(data);
UInt32 srcSize = (UInt32)GlobalSize(data); uint32_t srcSize = (uint32_t)GlobalSize(data);
if (src == NULL || srcSize <= 1) { if (src == NULL || srcSize <= 1) {
return std::string(); return std::string();
} }
@ -85,8 +85,8 @@ std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(const std
// note -- we assume src is a valid UTF-8 string // note -- we assume src is a valid UTF-8 string
// count newlines in string // count newlines in string
UInt32 numNewlines = 0; uint32_t numNewlines = 0;
UInt32 n = (UInt32)src.size(); uint32_t n = (uint32_t)src.size();
for (const char *scan = src.c_str(); n > 0; ++scan, --n) { for (const char *scan = src.c_str(); n > 0; ++scan, --n) {
if (*scan == '\n') { if (*scan == '\n') {
++numNewlines; ++numNewlines;
@ -101,7 +101,7 @@ std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(const std
dst.reserve(src.size() + numNewlines); dst.reserve(src.size() + numNewlines);
// copy string, converting newlines // copy string, converting newlines
n = (UInt32)src.size(); n = (uint32_t)src.size();
for (const char *scan = src.c_str(); n > 0; ++scan, --n) { for (const char *scan = src.c_str(); n > 0; ++scan, --n) {
if (scan[0] == '\n') { if (scan[0] == '\n') {
dst += '\r'; dst += '\r';
@ -115,8 +115,8 @@ std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(const std
std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToUnix(const std::string &src) const std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToUnix(const std::string &src) const
{ {
// count newlines in string // count newlines in string
UInt32 numNewlines = 0; uint32_t numNewlines = 0;
UInt32 n = (UInt32)src.size(); uint32_t n = (uint32_t)src.size();
for (const char *scan = src.c_str(); n > 0; ++scan, --n) { for (const char *scan = src.c_str(); n > 0; ++scan, --n) {
if (scan[0] == '\r' && scan[1] == '\n') { if (scan[0] == '\r' && scan[1] == '\n') {
++numNewlines; ++numNewlines;
@ -131,7 +131,7 @@ std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToUnix(const std:
dst.reserve(src.size()); dst.reserve(src.size());
// copy string, converting newlines // copy string, converting newlines
n = (UInt32)src.size(); n = (uint32_t)src.size();
for (const char *scan = src.c_str(); n > 0; ++scan, --n) { for (const char *scan = src.c_str(); n > 0; ++scan, --n) {
if (scan[0] != '\r' || scan[1] != '\n') { if (scan[0] != '\r' || scan[1] != '\n') {
dst += scan[0]; dst += scan[0];

View file

@ -71,7 +71,7 @@ std::string MSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const
if (src == NULL) { if (src == NULL) {
return std::string(); return std::string();
} }
UInt32 srcSize = (UInt32)GlobalSize(data); uint32_t srcSize = (uint32_t)GlobalSize(data);
// check image type // check image type
const BITMAPINFO *bitmap = static_cast<const BITMAPINFO *>(src); const BITMAPINFO *bitmap = static_cast<const BITMAPINFO *>(src);

View file

@ -54,10 +54,10 @@ std::string MSWindowsClipboardHTMLConverter::doFromIClipboard(const std::string
std::string suffix("<!--EndFragment--></BODY></HTML>\r\n"); std::string suffix("<!--EndFragment--></BODY></HTML>\r\n");
// Get byte offsets for header // Get byte offsets for header
UInt32 StartFragment = (UInt32)prefix.size(); uint32_t StartFragment = (uint32_t)prefix.size();
UInt32 EndFragment = StartFragment + (UInt32)data.size(); uint32_t EndFragment = StartFragment + (uint32_t)data.size();
// StartHTML is constant by the design of the prefix // 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("XXXXXXXXXX"), 10, deskflow::string::sprintf("%010u", StartFragment));
prefix.replace(prefix.find("YYYYYYYYYY"), 10, deskflow::string::sprintf("%010u", EndFragment)); prefix.replace(prefix.find("YYYYYYYYYY"), 10, deskflow::string::sprintf("%010u", EndFragment));

View file

@ -208,7 +208,7 @@ void MSWindowsDesks::resetOptions()
void MSWindowsDesks::setOptions(const OptionsList &options) 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) { if (options[i] == kOptionWin32KeepForeground) {
m_leaveForegroundOption = (options[i + 1] != 0); m_leaveForegroundOption = (options[i + 1] != 0);
LOG((CLOG_DEBUG1 "%s the foreground window", m_leaveForegroundOption ? "don\'t grab" : "grab")); LOG((CLOG_DEBUG1 "%s the foreground window", m_leaveForegroundOption ? "don\'t grab" : "grab"));

View file

@ -80,7 +80,7 @@ void MSWindowsEventQueueBuffer::waitForEvent(double timeout)
MsgWaitForMultipleObjects(0, dummy, FALSE, t, QS_ALLPOSTMESSAGE); 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. // NOTE: QS_ALLINPUT was replaced with QS_ALLPOSTMESSAGE.
// //
@ -103,7 +103,7 @@ IEventQueueBuffer::Type MSWindowsEventQueueBuffer::getEvent(Event &event, UInt32
event = Event(Event::kQuit); event = Event(Event::kQuit);
return kSystem; return kSystem;
} else if (m_event.message == m_userEvent) { } else if (m_event.message == m_userEvent) {
dataID = static_cast<UInt32>(m_event.wParam); dataID = static_cast<uint32_t>(m_event.wParam);
return kUser; return kUser;
} else { } else {
event = Event(Event::kSystem, m_events->getSystemTarget(), &m_event); 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<WPARAM>(dataID), 0) != 0); return (PostThreadMessage(m_thread, m_userEvent, static_cast<WPARAM>(dataID), 0) != 0);
} }

View file

@ -37,8 +37,8 @@ public:
{ {
} }
virtual void waitForEvent(double timeout); virtual void waitForEvent(double timeout);
virtual Type getEvent(Event &event, UInt32 &dataID); virtual Type getEvent(Event &event, uint32_t &dataID);
virtual bool addEvent(UInt32 dataID); virtual bool addEvent(uint32_t dataID);
virtual bool isEmpty() const; virtual bool isEmpty() const;
virtual EventQueueTimer *newTimer(double duration, bool oneShot) const; virtual EventQueueTimer *newTimer(double duration, bool oneShot) const;
virtual void deleteTimer(EventQueueTimer *) const; virtual void deleteTimer(EventQueueTimer *) const;

View file

@ -30,7 +30,7 @@ static HHOOK g_keyboardLL = NULL;
static HHOOK g_mouseLL = NULL; static HHOOK g_mouseLL = NULL;
static bool g_screenSaver = false; static bool g_screenSaver = false;
static EHookMode g_mode = kHOOK_DISABLE; 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_zoneSize = 0;
static int32_t g_xScreen = 0; static int32_t g_xScreen = 0;
static int32_t g_yScreen = 0; static int32_t g_yScreen = 0;
@ -125,7 +125,7 @@ int MSWindowsHook::cleanup()
return 1; return 1;
} }
void MSWindowsHook::setSides(UInt32 sides) void MSWindowsHook::setSides(uint32_t sides)
{ {
g_zoneSides = sides; g_zoneSides = sides;
} }

View file

@ -36,7 +36,7 @@ public:
int cleanup(); 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); void setZone(int32_t x, int32_t y, int32_t w, int32_t h, int32_t jumpZoneSize);

View file

@ -1240,7 +1240,7 @@ KeyModifierMask &MSWindowsKeyState::getActiveModifiersRValue()
bool MSWindowsKeyState::getGroups(GroupList &groups) const bool MSWindowsKeyState::getGroups(GroupList &groups) const
{ {
// get keyboard layouts // get keyboard layouts
UInt32 newNumLayouts = GetKeyboardLayoutList(0, NULL); uint32_t newNumLayouts = GetKeyboardLayoutList(0, NULL);
if (newNumLayouts == 0) { if (newNumLayouts == 0) {
LOG((CLOG_DEBUG1 "can't get keyboard layouts")); LOG((CLOG_DEBUG1 "can't get keyboard layouts"));
return false; return false;

View file

@ -384,7 +384,7 @@ void MSWindowsScreen::sendDragThread(void *)
if (draggingFilename.empty() == false) { if (draggingFilename.empty() == false) {
ClientApp &app = ClientApp::instance(); ClientApp &app = ClientApp::instance();
Client *client = app.getClientPtr(); Client *client = app.getClientPtr();
UInt32 fileCount = 1; uint32_t fileCount = 1;
LOG((CLOG_DEBUG "send dragging info to server: %s", draggingFilename.c_str())); LOG((CLOG_DEBUG "send dragging info to server: %s", draggingFilename.c_str()));
client->sendDragInfo(fileCount, draggingFilename, size); client->sendDragInfo(fileCount, draggingFilename, size);
LOG((CLOG_DEBUG "send dragging file to server")); LOG((CLOG_DEBUG "send dragging file to server"));
@ -479,7 +479,7 @@ void MSWindowsScreen::setOptions(const OptionsList &options)
m_desks->setOptions(options); m_desks->setOptions(options);
} }
void MSWindowsScreen::setSequenceNumber(UInt32 seqNum) void MSWindowsScreen::setSequenceNumber(uint32_t seqNum)
{ {
m_sequenceNumber = seqNum; m_sequenceNumber = seqNum;
} }
@ -567,7 +567,7 @@ void MSWindowsScreen::updateDesktopThread()
CloseDesktop(cur_hdesk); CloseDesktop(cur_hdesk);
} }
void MSWindowsScreen::reconfigure(UInt32 activeSides) void MSWindowsScreen::reconfigure(uint32_t activeSides)
{ {
assert(m_isPrimary); 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)); 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 // only allow certain modifiers
if ((mask & ~(KeyModifierShift | KeyModifierControl | KeyModifierAlt | KeyModifierSuper)) != 0) { if ((mask & ~(KeyModifierShift | KeyModifierControl | KeyModifierAlt | KeyModifierSuper)) != 0) {
@ -637,13 +637,13 @@ UInt32 MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
} }
// choose hotkey id // choose hotkey id
UInt32 id; uint32_t id;
if (!m_oldHotKeyIDs.empty()) { if (!m_oldHotKeyIDs.empty()) {
id = m_oldHotKeyIDs.back(); id = m_oldHotKeyIDs.back();
m_oldHotKeyIDs.pop_back(); m_oldHotKeyIDs.pop_back();
} else { } else {
// id = m_hotKeys.size() + 1; // 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 // 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; return id;
} }
void MSWindowsScreen::unregisterHotKey(UInt32 id) void MSWindowsScreen::unregisterHotKey(uint32_t id)
{ {
// look up hotkey // look up hotkey
HotKeyMap::iterator i = m_hotKeys.find(id); HotKeyMap::iterator i = m_hotKeys.find(id);
@ -728,12 +728,12 @@ int32_t MSWindowsScreen::getJumpZoneSize() const
return 1; return 1;
} }
bool MSWindowsScreen::isAnyMouseButtonDown(UInt32 &buttonID) const bool MSWindowsScreen::isAnyMouseButtonDown(uint32_t &buttonID) const
{ {
static const char *buttonToName[] = {"<invalid>", "Left Button", "Middle Button", static const char *buttonToName[] = {"<invalid>", "Left Button", "Middle Button",
"Right Button", "X Button 1", "X Button 2"}; "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]) { if (m_buttons[i]) {
buttonID = i; buttonID = i;
LOG((CLOG_DEBUG "locked by \"%s\"", buttonToName[i])); LOG((CLOG_DEBUG "locked by \"%s\"", buttonToName[i]));
@ -976,7 +976,7 @@ bool MSWindowsScreen::onPreDispatchPrimary(HWND, UINT message, WPARAM wParam, LP
// handle event // handle event
switch (message) { switch (message) {
case DESKFLOW_MSG_MARK: case DESKFLOW_MSG_MARK:
return onMark(static_cast<UInt32>(wParam)); return onMark(static_cast<uint32_t>(wParam));
case DESKFLOW_MSG_KEY: case DESKFLOW_MSG_KEY:
return onKey(wParam, lParam); return onKey(wParam, lParam);
@ -1078,7 +1078,7 @@ bool MSWindowsScreen::onEvent(HWND, UINT msg, WPARAM wParam, LPARAM lParam, LRES
return false; return false;
} }
bool MSWindowsScreen::onMark(UInt32 mark) bool MSWindowsScreen::onMark(uint32_t mark)
{ {
m_markReceived = mark; m_markReceived = mark;
return true; return true;

View file

@ -98,14 +98,14 @@ public:
virtual void updateDesktopThread(); virtual void updateDesktopThread();
// IPrimaryScreen overrides // IPrimaryScreen overrides
virtual void reconfigure(UInt32 activeSides); virtual void reconfigure(uint32_t activeSides);
virtual void warpCursor(int32_t x, int32_t y); virtual void warpCursor(int32_t x, int32_t y);
virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask); virtual uint32_t registerHotKey(KeyID key, KeyModifierMask mask);
virtual void unregisterHotKey(UInt32 id); virtual void unregisterHotKey(uint32_t id);
virtual void fakeInputBegin(); virtual void fakeInputBegin();
virtual void fakeInputEnd(); virtual void fakeInputEnd();
virtual int32_t getJumpZoneSize() const; 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; virtual void getCursorCenter(int32_t &x, int32_t &y) const;
// ISecondaryScreen overrides // ISecondaryScreen overrides
@ -134,7 +134,7 @@ public:
virtual void screensaver(bool activate); virtual void screensaver(bool activate);
virtual void resetOptions(); virtual void resetOptions();
virtual void setOptions(const OptionsList &options); virtual void setOptions(const OptionsList &options);
virtual void setSequenceNumber(UInt32); virtual void setSequenceNumber(uint32_t);
virtual bool isPrimary() const; virtual bool isPrimary() const;
virtual void fakeDraggingFiles(DragFileList fileList); virtual void fakeDraggingFiles(DragFileList fileList);
virtual std::string &getDraggingFilename(); virtual std::string &getDraggingFilename();
@ -185,7 +185,7 @@ private: // HACK
bool onEvent(HWND, UINT, WPARAM, LPARAM, LRESULT *result); bool onEvent(HWND, UINT, WPARAM, LPARAM, LRESULT *result);
// message handlers // message handlers
bool onMark(UInt32 mark); bool onMark(uint32_t mark);
bool onKey(WPARAM, LPARAM); bool onKey(WPARAM, LPARAM);
bool onHotKey(WPARAM, LPARAM); bool onHotKey(WPARAM, LPARAM);
bool onMouseButton(WPARAM, LPARAM); bool onMouseButton(WPARAM, LPARAM);
@ -261,9 +261,9 @@ private:
UINT m_keycode; UINT m_keycode;
UINT m_mask; UINT m_mask;
}; };
using HotKeyMap = std::map<UInt32, HotKeyItem>; using HotKeyMap = std::map<uint32_t, HotKeyItem>;
using HotKeyIDList = std::vector<UInt32>; using HotKeyIDList = std::vector<uint32_t>;
using HotKeyToIDMap = std::map<HotKeyItem, UInt32>; using HotKeyToIDMap = std::map<HotKeyItem, uint32_t>;
using PrimaryKeyDownList = std::vector<KeyButton>; using PrimaryKeyDownList = std::vector<KeyButton>;
static HINSTANCE s_windowInstance; static HINSTANCE s_windowInstance;
@ -292,11 +292,11 @@ private:
int32_t m_xCursor, m_yCursor; int32_t m_xCursor, m_yCursor;
// last clipboard // last clipboard
UInt32 m_sequenceNumber; uint32_t m_sequenceNumber;
// used to discard queued messages that are no longer needed // used to discard queued messages that are no longer needed
UInt32 m_mark; uint32_t m_mark;
UInt32 m_markReceived; uint32_t m_markReceived;
// the main loop's thread id // the main loop's thread id
DWORD m_threadID; DWORD m_threadID;

View file

@ -24,17 +24,17 @@ struct CBMPHeader
{ {
public: public:
uint16_t type; uint16_t type;
UInt32 size; uint32_t size;
uint16_t reserved1; uint16_t reserved1;
uint16_t reserved2; uint16_t reserved2;
UInt32 offset; uint32_t offset;
}; };
// BMP is little-endian // BMP is little-endian
static inline UInt32 fromLEU32(const uint8_t *data) static inline uint32_t fromLEU32(const uint8_t *data)
{ {
return static_cast<UInt32>(data[0]) | (static_cast<UInt32>(data[1]) << 8) | (static_cast<UInt32>(data[2]) << 16) | return static_cast<uint32_t>(data[0]) | (static_cast<uint32_t>(data[1]) << 8) |
(static_cast<UInt32>(data[3]) << 24); (static_cast<uint32_t>(data[2]) << 16) | (static_cast<uint32_t>(data[3]) << 24);
} }
static void toLE(uint8_t *&dst, char src) static void toLE(uint8_t *&dst, char src)
@ -50,7 +50,7 @@ static void toLE(uint8_t *&dst, uint16_t src)
dst += 2; dst += 2;
} }
static void toLE(uint8_t *&dst, UInt32 src) static void toLE(uint8_t *&dst, uint32_t src)
{ {
dst[0] = static_cast<uint8_t>(src & 0xffu); dst[0] = static_cast<uint8_t>(src & 0xffu);
dst[1] = static_cast<uint8_t>((src >> 8) & 0xffu); dst[1] = static_cast<uint8_t>((src >> 8) & 0xffu);
@ -88,10 +88,10 @@ std::string OSXClipboardBMPConverter::fromIClipboard(const std::string &bmp) con
uint8_t *dst = header; uint8_t *dst = header;
toLE(dst, 'B'); toLE(dst, 'B');
toLE(dst, 'M'); toLE(dst, 'M');
toLE(dst, static_cast<UInt32>(14 + bmp.size())); toLE(dst, static_cast<uint32_t>(14 + bmp.size()));
toLE(dst, static_cast<uint16_t>(0)); toLE(dst, static_cast<uint16_t>(0));
toLE(dst, static_cast<uint16_t>(0)); toLE(dst, static_cast<uint16_t>(0));
toLE(dst, static_cast<UInt32>(14 + 40)); toLE(dst, static_cast<uint32_t>(14 + 40));
return std::string(reinterpret_cast<const char *>(header), 14) + bmp; return std::string(reinterpret_cast<const char *>(header), 14) + bmp;
} }
@ -109,7 +109,7 @@ std::string OSXClipboardBMPConverter::toIClipboard(const std::string &bmp) const
} }
// get offset to image data // get offset to image data
UInt32 offset = fromLEU32(rawBMPHeader + 10); uint32_t offset = fromLEU32(rawBMPHeader + 10);
// construct BMP // construct BMP
if (offset == 14 + 40) { if (offset == 14 + 40) {

View file

@ -60,7 +60,7 @@ void OSXEventQueueBuffer::waitForEvent(double timeout)
ReceiveNextEvent(0, NULL, timeout, false, &event); 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 // release the previous event
if (m_event != NULL) { if (m_event != NULL) {
@ -78,7 +78,7 @@ IEventQueueBuffer::Type OSXEventQueueBuffer::getEvent(Event &event, UInt32 &data
} else if (error != noErr) { } else if (error != noErr) {
return kNone; return kNone;
} else { } else {
UInt32 eventClass = GetEventClass(m_event); uint32_t eventClass = GetEventClass(m_event);
switch (eventClass) { switch (eventClass) {
case 'Syne': case 'Syne':
dataID = GetEventKind(m_event); 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; EventRef event;
OSStatus error = CreateEvent(kCFAllocatorDefault, 'Syne', dataID, 0, kEventAttributeNone, &event); OSStatus error = CreateEvent(kCFAllocatorDefault, 'Syne', dataID, 0, kEventAttributeNone, &event);

View file

@ -34,8 +34,8 @@ public:
// IEventQueueBuffer overrides // IEventQueueBuffer overrides
virtual void init(); virtual void init();
virtual void waitForEvent(double timeout); virtual void waitForEvent(double timeout);
virtual Type getEvent(Event &event, UInt32 &dataID); virtual Type getEvent(Event &event, uint32_t &dataID);
virtual bool addEvent(UInt32 dataID); virtual bool addEvent(uint32_t dataID);
virtual bool isEmpty() const; virtual bool isEmpty() const;
virtual EventQueueTimer *newTimer(double duration, bool oneShot) const; virtual EventQueueTimer *newTimer(double duration, bool oneShot) const;
virtual void deleteTimer(EventQueueTimer *) const; virtual void deleteTimer(EventQueueTimer *) const;

View file

@ -32,25 +32,25 @@
// first instance of a virtual key code maps to the KeyID that we // first instance of a virtual key code maps to the KeyID that we
// want to generate for that code. The others are for mapping // want to generate for that code. The others are for mapping
// different KeyIDs to a single key code. // different KeyIDs to a single key code.
static const UInt32 s_shiftVK = kVK_Shift; static const uint32_t s_shiftVK = kVK_Shift;
static const UInt32 s_controlVK = kVK_Control; static const uint32_t s_controlVK = kVK_Control;
static const UInt32 s_altVK = kVK_Option; static const uint32_t s_altVK = kVK_Option;
static const UInt32 s_superVK = kVK_Command; static const uint32_t s_superVK = kVK_Command;
static const UInt32 s_capsLockVK = kVK_CapsLock; static const uint32_t s_capsLockVK = kVK_CapsLock;
static const UInt32 s_numLockVK = kVK_ANSI_KeypadClear; // 71 static const uint32_t s_numLockVK = kVK_ANSI_KeypadClear; // 71
static const UInt32 s_brightnessUp = 144; static const uint32_t s_brightnessUp = 144;
static const UInt32 s_brightnessDown = 145; static const uint32_t s_brightnessDown = 145;
static const UInt32 s_missionControlVK = 160; static const uint32_t s_missionControlVK = 160;
static const UInt32 s_launchpadVK = 131; static const uint32_t s_launchpadVK = 131;
static const UInt32 s_osxNumLock = 1 << 16; static const uint32_t s_osxNumLock = 1 << 16;
struct KeyEntry struct KeyEntry
{ {
public: public:
KeyID m_keyID; KeyID m_keyID;
UInt32 m_virtualKey; uint32_t m_virtualKey;
}; };
static const KeyEntry s_controlKeys[] = { static const KeyEntry s_controlKeys[] = {
// cursor keys. if we don't do this we'll may still get these from // 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; KeyModifierMask outMask = 0;
if ((mask & kCGEventFlagMaskShift) != 0) { if ((mask & kCGEventFlagMaskShift) != 0) {
@ -250,7 +250,7 @@ KeyModifierMask OSXKeyState::mapModifiersFromOSX(UInt32 mask) const
return outMask; return outMask;
} }
KeyModifierMask OSXKeyState::mapModifiersToCarbon(UInt32 mask) const KeyModifierMask OSXKeyState::mapModifiersToCarbon(uint32_t mask) const
{ {
KeyModifierMask outMask = 0; KeyModifierMask outMask = 0;
if ((mask & kCGEventFlagMaskShift) != 0) { if ((mask & kCGEventFlagMaskShift) != 0) {
@ -287,10 +287,10 @@ KeyButton OSXKeyState::mapKeyFromEvent(KeyIDs &ids, KeyModifierMask *maskOut, CG
} }
// get virtual key // get virtual key
UInt32 vkCode = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode); uint32_t vkCode = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode);
// handle up events // handle up events
UInt32 eventKind = CGEventGetType(event); uint32_t eventKind = CGEventGetType(event);
if (eventKind == kCGEventKeyUp) { if (eventKind == kCGEventKeyUp) {
// the id isn't used. we just need the same button we used on // 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 // 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 // get the event modifiers and remove the command and control
// keys. note if we used them though. // keys. note if we used them though.
// UCKeyTranslate expects old-style Carbon modifiers, so convert. // UCKeyTranslate expects old-style Carbon modifiers, so convert.
UInt32 modifiers; uint32_t modifiers;
modifiers = mapModifiersToCarbon(CGEventGetFlags(event)); 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); bool isCommand = ((modifiers & s_commandModifiers) != 0);
modifiers &= ~s_commandModifiers; modifiers &= ~s_commandModifiers;
@ -414,7 +414,7 @@ KeyModifierMask OSXKeyState::pollActiveModifiers() const
// falsely assumed that the mask returned by GetCurrentKeyModifiers() // falsely assumed that the mask returned by GetCurrentKeyModifiers()
// was the same as a CGEventFlags (which is what mapModifiersFromOSX // was the same as a CGEventFlags (which is what mapModifiersFromOSX
// expects). patch by Marc // expects). patch by Marc
UInt32 mask = GetCurrentKeyModifiers(); uint32_t mask = GetCurrentKeyModifiers();
KeyModifierMask outMask = 0; KeyModifierMask outMask = 0;
if ((mask & shiftKey) != 0) { if ((mask & shiftKey) != 0) {
@ -460,8 +460,8 @@ void OSXKeyState::pollPressedKeys(KeyButtonSet &pressedKeys) const
::KeyMap km; ::KeyMap km;
GetKeys(km); GetKeys(km);
const uint8_t *m = reinterpret_cast<const uint8_t *>(km); const uint8_t *m = reinterpret_cast<const uint8_t *>(km);
for (UInt32 i = 0; i < 16; ++i) { for (uint32_t i = 0; i < 16; ++i) {
for (UInt32 j = 0; j < 8; ++j) { for (uint32_t j = 0; j < 8; ++j) {
if ((m[i] & (1u << j)) != 0) { if ((m[i] & (1u << j)) != 0) {
pressedKeys.insert(mapVirtualKeyToKeyButton(8 * i + j)); 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) { for (int32_t g = 0; g < numGroups; ++g) {
// add special keys // add special keys
getKeyMapForSpecialKeys(keyMap, g); getKeyMapForSpecialKeys(keyMap, g);
@ -611,7 +611,7 @@ void OSXKeyState::fakeKey(const Keystroke &keystroke)
switch (keystroke.m_type) { switch (keystroke.m_type) {
case Keystroke::kButton: { case Keystroke::kButton: {
bool keyDown = keystroke.m_data.m_button.m_press; 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; KeyButton button = keystroke.m_data.m_button.m_button;
CGKeyCode virtualKey = mapKeyButtonToVirtualKey(button); CGKeyCode virtualKey = mapKeyButtonToVirtualKey(button);
@ -692,20 +692,20 @@ bool OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap, int32_t group, const IOSXK
// iterate over each button // iterate over each button
deskflow::KeyMap::KeyItem item; 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); item.m_button = mapVirtualKeyToKeyButton(i);
// the KeyIDs we've already handled // the KeyIDs we've already handled
std::set<KeyID> keys; std::set<KeyID> keys;
// convert the entry in each table for this button to a KeyID // 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].first = r.getKey(j, i);
buttonKeys[j].second = deskflow::KeyMap::isDeadKey(buttonKeys[j].first); buttonKeys[j].second = deskflow::KeyMap::isDeadKey(buttonKeys[j].first);
} }
// iterate over each character table // 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 // get the KeyID for the button/table
KeyID id = buttonKeys[j].first; KeyID id = buttonKeys[j].first;
if (id == kKeyNone) { 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. // can't be any earlier tables because of the check above.
std::set<uint8_t> tables; std::set<uint8_t> tables;
tables.insert(static_cast<uint8_t>(j)); tables.insert(static_cast<uint8_t>(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) { if (buttonKeys[k].first == id) {
tables.insert(static_cast<uint8_t>(k)); tables.insert(static_cast<uint8_t>(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 // collect the modifier combinations that map to any of the
// tables we just collected // 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); 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 // for generating characters. in fact, we want to ignore any
// characters generated by the control key. we don't map // characters generated by the control key. we don't map
// those and instead expect the control modifier plus a key. // those and instead expect the control modifier plus a key.
UInt32 sensitive = 0; uint32_t sensitive = 0;
for (UInt32 k = 0; (1u << k) < r.getNumModifierCombinations(); ++k) { for (uint32_t k = 0; (1u << k) < r.getNumModifierCombinations(); ++k) {
UInt32 bit = (1u << k); uint32_t bit = (1u << k);
if ((bit << 8) == cmdKey || (bit << 8) == controlKey || (bit << 8) == rightControlKey) { if ((bit << 8) == cmdKey || (bit << 8) == controlKey || (bit << 8) == rightControlKey) {
continue; continue;
} }
for (UInt32 m = 0; m < r.getNumModifierCombinations(); ++m) { for (uint32_t m = 0; m < r.getNumModifierCombinations(); ++m) {
if (modifiers[m] != modifiers[m ^ bit]) { if (modifiers[m] != modifiers[m ^ bit]) {
sensitive |= bit; sensitive |= bit;
break; 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 // find each required modifier mask. the key can be synthesized
// using any of the masks. // using any of the masks.
std::set<UInt32> required; std::set<uint32_t> required;
for (UInt32 k = 0; k < r.getNumModifierCombinations(); ++k) { for (uint32_t k = 0; k < r.getNumModifierCombinations(); ++k) {
if ((k & sensitive) == k && modifiers[k & sensitive]) { if ((k & sensitive) == k && modifiers[k & sensitive]) {
required.insert(k); 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. // now add a key entry for each key/required modifier pair.
item.m_sensitive = mapModifiersFromOSX(sensitive << 16); item.m_sensitive = mapModifiersFromOSX(sensitive << 16);
for (std::set<UInt32>::iterator k = required.begin(); k != required.end(); ++k) { for (std::set<uint32_t>::iterator k = required.begin(); k != required.end(); ++k) {
item.m_required = mapModifiersFromOSX(*k << 16); item.m_required = mapModifiersFromOSX(*k << 16);
keyMap.addKeyEntry(item); keyMap.addKeyEntry(item);
} }
@ -791,7 +791,7 @@ bool OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap, int32_t group, const IOSXK
} }
bool OSXKeyState::mapDeskflowHotKeyToMac( bool OSXKeyState::mapDeskflowHotKeyToMac(
KeyID key, KeyModifierMask mask, UInt32 &macVirtualKey, UInt32 &macModifierMask KeyID key, KeyModifierMask mask, uint32_t &macVirtualKey, uint32_t &macModifierMask
) const ) const
{ {
// look up button for key // 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); KeyButton button = mapVirtualKeyToKeyButton(virtualKey);
onKey(button, down, newMask); 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 // 'A' maps to 0 so shift every id
return static_cast<KeyButton>(keyCode + KeyButtonOffset); return static_cast<KeyButton>(keyCode + KeyButtonOffset);
} }
UInt32 OSXKeyState::mapKeyButtonToVirtualKey(KeyButton keyButton) uint32_t OSXKeyState::mapKeyButtonToVirtualKey(KeyButton keyButton)
{ {
return static_cast<UInt32>(keyButton - KeyButtonOffset); return static_cast<uint32_t>(keyButton - KeyButtonOffset);
} }

View file

@ -60,13 +60,13 @@ public:
Returns the deskflow modifier mask corresponding to the OS X modifier Returns the deskflow modifier mask corresponding to the OS X modifier
mask in \p mask. 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 //! Convert CG flags-style modifier mask to old-style Carbon
/*! /*!
Still required in a few places for translation calls. 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 //! Map key event to keys
/*! /*!
@ -83,7 +83,8 @@ public:
Calculates mac virtual key and mask for a key \p key and modifiers 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. \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); void setGroup(int32_t group);
// Send an event for the given modifier key // 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. // 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 // 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 // Maps an OS X virtual key id to a KeyButton. This simply remaps
// the ids so we don't use KeyButton 0. // 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 // Maps a KeyButton to an OS X key code. This is the inverse of
// mapVirtualKeyToKeyButton. // mapVirtualKeyToKeyButton.
static UInt32 mapKeyButtonToVirtualKey(KeyButton keyButton); static uint32_t mapKeyButtonToVirtualKey(KeyButton keyButton);
void init(); void init();
@ -161,10 +162,10 @@ private:
}; };
using GroupMap = std::map<CFDataRef, int32_t>; using GroupMap = std::map<CFDataRef, int32_t>;
using VirtualKeyMap = std::map<UInt32, KeyID>; using VirtualKeyMap = std::map<uint32_t, KeyID>;
VirtualKeyMap m_virtualKeyMap; VirtualKeyMap m_virtualKeyMap;
mutable UInt32 m_deadKeyState; mutable uint32_t m_deadKeyState;
AutoCFArray m_groups{nullptr, CFRelease}; AutoCFArray m_groups{nullptr, CFRelease};
GroupMap m_groupMap; GroupMap m_groupMap;
bool m_shiftPressed; bool m_shiftPressed;

View file

@ -73,14 +73,14 @@ public:
void getCursorPos(int32_t &x, int32_t &y) const override; void getCursorPos(int32_t &x, int32_t &y) const override;
// IPrimaryScreen overrides // IPrimaryScreen overrides
void reconfigure(UInt32 activeSides) override; void reconfigure(uint32_t activeSides) override;
void warpCursor(int32_t x, int32_t y) override; void warpCursor(int32_t x, int32_t y) override;
UInt32 registerHotKey(KeyID key, KeyModifierMask mask) override; uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override;
void unregisterHotKey(UInt32 id) override; void unregisterHotKey(uint32_t id) override;
void fakeInputBegin() override; void fakeInputBegin() override;
void fakeInputEnd() override; void fakeInputEnd() override;
int32_t getJumpZoneSize() const 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; void getCursorCenter(int32_t &x, int32_t &y) const override;
// ISecondaryScreen overrides // ISecondaryScreen overrides
@ -102,7 +102,7 @@ public:
void screensaver(bool activate) override; void screensaver(bool activate) override;
void resetOptions() override; void resetOptions() override;
void setOptions(const OptionsList &options) override; void setOptions(const OptionsList &options) override;
void setSequenceNumber(UInt32) override; void setSequenceNumber(uint32_t) override;
bool isPrimary() const override; bool isPrimary() const override;
void fakeDraggingFiles(DragFileList fileList) override; void fakeDraggingFiles(DragFileList fileList) override;
std::string &getDraggingFilename() override; std::string &getDraggingFilename() override;
@ -206,8 +206,8 @@ private:
struct HotKeyItem struct HotKeyItem
{ {
public: public:
HotKeyItem(UInt32, UInt32); HotKeyItem(uint32_t, uint32_t);
HotKeyItem(EventHotKeyRef, UInt32, UInt32); HotKeyItem(EventHotKeyRef, uint32_t, uint32_t);
EventHotKeyRef getRef() const; EventHotKeyRef getRef() const;
@ -215,8 +215,8 @@ private:
private: private:
EventHotKeyRef m_ref; EventHotKeyRef m_ref;
UInt32 m_keycode; uint32_t m_keycode;
UInt32 m_mask; uint32_t m_mask;
}; };
enum EMouseButtonState enum EMouseButtonState
@ -230,22 +230,22 @@ private:
class MouseButtonState class MouseButtonState
{ {
public: public:
void set(UInt32 button, EMouseButtonState state); void set(uint32_t button, EMouseButtonState state);
bool any(); bool any();
void reset(); 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; int8_t getFirstButtonDown() const;
private: private:
std::bitset<NumButtonIDs> m_buttons; std::bitset<NumButtonIDs> m_buttons;
}; };
using HotKeyMap = std::map<UInt32, HotKeyItem>; using HotKeyMap = std::map<uint32_t, HotKeyItem>;
using HotKeyIDList = std::vector<UInt32>; using HotKeyIDList = std::vector<uint32_t>;
using ModifierHotKeyMap = std::map<KeyModifierMask, UInt32>; using ModifierHotKeyMap = std::map<KeyModifierMask, uint32_t>;
using HotKeyToIDMap = std::map<HotKeyItem, UInt32>; using HotKeyToIDMap = std::map<HotKeyItem, uint32_t>;
// true if screen is being used as a primary screen, false otherwise // true if screen is being used as a primary screen, false otherwise
bool m_isPrimary; bool m_isPrimary;
@ -285,7 +285,7 @@ private:
// clipboards // clipboards
OSXClipboard m_pasteboard; OSXClipboard m_pasteboard;
UInt32 m_sequenceNumber; uint32_t m_sequenceNumber;
// screen saver stuff // screen saver stuff
OSXScreenSaver *m_screensaver; OSXScreenSaver *m_screensaver;
@ -316,7 +316,7 @@ private:
HotKeyMap m_hotKeys; HotKeyMap m_hotKeys;
HotKeyIDList m_oldHotKeyIDs; HotKeyIDList m_oldHotKeyIDs;
ModifierHotKeyMap m_modifierHotKeys; ModifierHotKeyMap m_modifierHotKeys;
UInt32 m_activeModifierHotKey; uint32_t m_activeModifierHotKey;
KeyModifierMask m_activeModifierHotKeyMask; KeyModifierMask m_activeModifierHotKeyMask;
HotKeyToIDMap m_hotKeyToIDMap; HotKeyToIDMap m_hotKeyToIDMap;

View file

@ -275,7 +275,7 @@ void OSXScreen::getCursorPos(int32_t &x, int32_t &y) const
CFRelease(event); CFRelease(event);
} }
void OSXScreen::reconfigure(UInt32) void OSXScreen::reconfigure(uint32_t)
{ {
// do nothing // do nothing
} }
@ -309,7 +309,7 @@ int32_t OSXScreen::getJumpZoneSize() const
return 1; return 1;
} }
bool OSXScreen::isAnyMouseButtonDown(UInt32 &buttonID) const bool OSXScreen::isAnyMouseButtonDown(uint32_t &buttonID) const
{ {
if (m_buttonState.test(0)) { if (m_buttonState.test(0)) {
buttonID = kButtonLeft; buttonID = kButtonLeft;
@ -325,17 +325,17 @@ void OSXScreen::getCursorCenter(int32_t &x, int32_t &y) const
y = m_yCenter; 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 // 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)) { if (!m_keyState->mapDeskflowHotKeyToMac(key, mask, macKey, macMask)) {
LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask)); LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask));
return 0; return 0;
} }
// choose hotkey id // choose hotkey id
UInt32 id; uint32_t id;
if (!m_oldHotKeyIDs.empty()) { if (!m_oldHotKeyIDs.empty()) {
id = m_oldHotKeyIDs.back(); id = m_oldHotKeyIDs.back();
m_oldHotKeyIDs.pop_back(); m_oldHotKeyIDs.pop_back();
@ -355,7 +355,7 @@ UInt32 OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask)
okay = true; okay = true;
} }
} else { } else {
EventHotKeyID hkid = {'SNRG', (UInt32)id}; EventHotKeyID hkid = {'SNRG', (uint32_t)id};
OSStatus status = RegisterEventHotKey(macKey, macMask, hkid, GetApplicationEventTarget(), 0, &ref); OSStatus status = RegisterEventHotKey(macKey, macMask, hkid, GetApplicationEventTarget(), 0, &ref);
okay = (status == noErr); okay = (status == noErr);
m_hotKeyToIDMap[HotKeyItem(macKey, macMask)] = id; m_hotKeyToIDMap[HotKeyItem(macKey, macMask)] = id;
@ -380,7 +380,7 @@ UInt32 OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask)
return id; return id;
} }
void OSXScreen::unregisterHotKey(UInt32 id) void OSXScreen::unregisterHotKey(uint32_t id)
{ {
// look up hotkey // look up hotkey
HotKeyMap::iterator i = m_hotKeys.find(id); HotKeyMap::iterator i = m_hotKeys.find(id);
@ -431,7 +431,7 @@ void OSXScreen::constructMouseButtonEventMap()
for (uint16_t button = 0; button < NumButtonIDs; button++) { for (uint16_t button = 0; button < NumButtonIDs; button++) {
MouseButtonEventMapType new_map; 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]; CGEventType curEvent = source[button][state];
new_map[state] = curEvent; new_map[state] = curEvent;
} }
@ -507,7 +507,7 @@ void OSXScreen::postMouseEvent(CGPoint &pos) const
void OSXScreen::fakeMouseButton(ButtonID id, bool press) void OSXScreen::fakeMouseButton(ButtonID id, bool press)
{ {
// Buttons are indexed from one, but the button down array is indexed from zero // 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) { if (index >= NumButtonIDs) {
return; return;
} }
@ -585,7 +585,7 @@ void OSXScreen::getDropTargetThread(void *)
{ {
#if defined(MAC_OS_X_VERSION_10_7) #if defined(MAC_OS_X_VERSION_10_7)
// wait for 5 secs for the drop destinaiton string to be filled. // 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(); m_dropTarget.clear();
while (ARCH->time() < timeout) { while (ARCH->time() < timeout) {
@ -847,7 +847,7 @@ void OSXScreen::leave()
DragFileList dragFileList; DragFileList dragFileList;
dragFileList.push_back(di); dragFileList.push_back(di);
std::string info; std::string info;
UInt32 fileCount = DragInformation::setupDragInfo(dragFileList, info); uint32_t fileCount = DragInformation::setupDragInfo(dragFileList, info);
client->sendDragInfo(fileCount, info, info.size()); client->sendDragInfo(fileCount, info, info.size());
LOG((CLOG_DEBUG "send dragging file to server")); LOG((CLOG_DEBUG "send dragging file to server"));
@ -920,7 +920,7 @@ void OSXScreen::setOptions(const OptionsList &)
// no options // no options
} }
void OSXScreen::setSequenceNumber(UInt32 seqNum) void OSXScreen::setSequenceNumber(uint32_t seqNum)
{ {
m_sequenceNumber = seqNum; m_sequenceNumber = seqNum;
} }
@ -948,7 +948,7 @@ void OSXScreen::handleSystemEvent(const Event &event, void *)
EventRef *carbonEvent = static_cast<EventRef *>(event.getData()); EventRef *carbonEvent = static_cast<EventRef *>(event.getData());
assert(carbonEvent != NULL); assert(carbonEvent != NULL);
UInt32 eventClass = GetEventClass(*carbonEvent); uint32_t eventClass = GetEventClass(*carbonEvent);
switch (eventClass) { switch (eventClass) {
case kEventClassMouse: case kEventClassMouse:
@ -1166,7 +1166,7 @@ bool OSXScreen::onKey(CGEventRef event)
CGEventType eventKind = CGEventGetType(event); CGEventType eventKind = CGEventGetType(event);
// get the key and active modifiers // get the key and active modifiers
UInt32 virtualKey = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode); uint32_t virtualKey = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode);
CGEventFlags macMask = CGEventGetFlags(event); CGEventFlags macMask = CGEventGetFlags(event);
LOG((CLOG_DEBUG1 "event: Key event kind: %d, keycode=%d", eventKind, virtualKey)); 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 = HotKeyToIDMap::const_iterator i =
m_hotKeyToIDMap.find(HotKeyItem(virtualKey, m_keyState->mapModifiersToCarbon(macMask) & 0xff00u)); m_hotKeyToIDMap.find(HotKeyItem(virtualKey, m_keyState->mapModifiersToCarbon(macMask) & 0xff00u));
if (i != m_hotKeyToIDMap.end()) { if (i != m_hotKeyToIDMap.end()) {
UInt32 id = i->second; uint32_t id = i->second;
// determine event type // determine event type
Event::Type type; Event::Type type;
// UInt32 eventKind = GetEventKind(event);
if (eventKind == kCGEventKeyDown) { if (eventKind == kCGEventKeyDown) {
type = m_events->forIPrimaryScreen().hotKeyDown(); type = m_events->forIPrimaryScreen().hotKeyDown();
} else if (eventKind == kCGEventKeyUp) { } else if (eventKind == kCGEventKeyUp) {
@ -1294,11 +1293,11 @@ bool OSXScreen::onHotKey(EventRef event) const
// get the hotkey id // get the hotkey id
EventHotKeyID hkid; EventHotKeyID hkid;
GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(EventHotKeyID), NULL, &hkid); GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(EventHotKeyID), NULL, &hkid);
UInt32 id = hkid.id; uint32_t id = hkid.id;
// determine event type // determine event type
Event::Type type; Event::Type type;
UInt32 eventKind = GetEventKind(event); uint32_t eventKind = GetEventKind(event);
if (eventKind == kEventHotKeyPressed) { if (eventKind == kEventHotKeyPressed) {
type = m_events->forIPrimaryScreen().hotKeyDown(); type = m_events->forIPrimaryScreen().hotKeyDown();
} else if (eventKind == kEventHotKeyReleased) { } else if (eventKind == kEventHotKeyReleased) {
@ -1413,7 +1412,7 @@ void OSXScreen::handleDrag(const Event &, void *)
void OSXScreen::updateButtons() void OSXScreen::updateButtons()
{ {
UInt32 buttons = GetCurrentButtonState(); uint32_t buttons = GetCurrentButtonState();
m_buttonState.overwrite(buttons); m_buttonState.overwrite(buttons);
} }
@ -1495,7 +1494,7 @@ bool OSXScreen::updateScreenShape()
pascal OSStatus OSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler, EventRef theEvent, void *inUserData) pascal OSStatus OSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler, EventRef theEvent, void *inUserData)
{ {
OSXScreen *screen = (OSXScreen *)inUserData; OSXScreen *screen = (OSXScreen *)inUserData;
UInt32 kind = GetEventKind(theEvent); uint32_t kind = GetEventKind(theEvent);
IEventQueue *events = screen->getEvents(); IEventQueue *events = screen->getEvents();
if (kind == kEventSystemUserSessionDeactivated) { if (kind == kEventSystemUserSessionDeactivated) {
@ -1738,12 +1737,12 @@ OSXScreen::getGlobalHotKeysEnabled()
// OSXScreen::HotKeyItem // 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 // 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_ref(ref),
m_keycode(keycode), m_keycode(keycode),
m_mask(mask) 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); bool newState = (state == kMouseButtonDown);
m_buttons.set(button, newState); m_buttons.set(button, newState);
@ -1873,12 +1872,12 @@ void OSXScreen::MouseButtonState::reset()
m_buttons.reset(); m_buttons.reset();
} }
void OSXScreen::MouseButtonState::overwrite(UInt32 buttons) void OSXScreen::MouseButtonState::overwrite(uint32_t buttons)
{ {
m_buttons = std::bitset<NumButtonIDs>(buttons); m_buttons = std::bitset<NumButtonIDs>(buttons);
} }
bool OSXScreen::MouseButtonState::test(UInt32 button) const bool OSXScreen::MouseButtonState::test(uint32_t button) const
{ {
return m_buttons.test(button); return m_buttons.test(button);
} }

View file

@ -135,7 +135,7 @@ OSXScreenSaver::launchTerminationCallback(EventHandlerCallRef nextHandler, Event
if ((result == noErr) && (actualSize > 0) && (actualType == typeProcessSerialNumber)) { if ((result == noErr) && (actualSize > 0) && (actualType == typeProcessSerialNumber)) {
OSXScreenSaver *screenSaver = (OSXScreenSaver *)userData; OSXScreenSaver *screenSaver = (OSXScreenSaver *)userData;
UInt32 eventKind = GetEventKind(theEvent); uint32_t eventKind = GetEventKind(theEvent);
if (eventKind == kEventAppLaunched) { if (eventKind == kEventAppLaunched) {
screenSaver->processLaunched(psn); screenSaver->processLaunched(psn);
} else if (eventKind == kEventAppTerminated) { } else if (eventKind == kEventAppTerminated) {

View file

@ -23,7 +23,7 @@
// OSXUchrKeyResource // OSXUchrKeyResource
// //
OSXUchrKeyResource::OSXUchrKeyResource(const void *resource, UInt32 keyboardType) OSXUchrKeyResource::OSXUchrKeyResource(const void *resource, uint32_t keyboardType)
: m_m(NULL), : m_m(NULL),
m_cti(NULL), m_cti(NULL),
m_sdi(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 // a dead key followed by a space yields the non-dead version of
// the dead key. // the dead key.
m_spaceOutput = 0xffffu; m_spaceOutput = 0xffffu;
UInt32 table = getTableForModifier(0); uint32_t table = getTableForModifier(0);
for (UInt32 button = 0, n = getNumButtons(); button < n; ++button) { for (uint32_t button = 0, n = getNumButtons(); button < n; ++button) {
KeyID id = getKey(table, button); KeyID id = getKey(table, button);
if (id == 0x20) { if (id == 0x20) {
UCKeyOutput c = reinterpret_cast<const UCKeyOutput *>(base + m_cti->keyToCharTableOffsets[table])[button]; UCKeyOutput c = reinterpret_cast<const UCKeyOutput *>(base + m_cti->keyToCharTableOffsets[table])[button];
@ -88,23 +88,23 @@ bool OSXUchrKeyResource::isValid() const
return (m_m != NULL); return (m_m != NULL);
} }
UInt32 OSXUchrKeyResource::getNumModifierCombinations() const uint32_t OSXUchrKeyResource::getNumModifierCombinations() const
{ {
// only 32 (not 256) because the righthanded modifier bits are ignored // only 32 (not 256) because the righthanded modifier bits are ignored
return 32; return 32;
} }
UInt32 OSXUchrKeyResource::getNumTables() const uint32_t OSXUchrKeyResource::getNumTables() const
{ {
return m_cti->keyToCharTableCount; return m_cti->keyToCharTableCount;
} }
UInt32 OSXUchrKeyResource::getNumButtons() const uint32_t OSXUchrKeyResource::getNumButtons() const
{ {
return m_cti->keyToCharTableSize; return m_cti->keyToCharTableSize;
} }
UInt32 OSXUchrKeyResource::getTableForModifier(UInt32 mask) const uint32_t OSXUchrKeyResource::getTableForModifier(uint32_t mask) const
{ {
if (mask >= m_m->modifiersCount) { if (mask >= m_m->modifiersCount) {
return m_m->defaultTableNum; 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(table < getNumTables());
assert(button < getNumButtons()); assert(button < getNumButtons());

View file

@ -27,15 +27,15 @@ using KeyLayout = TISInputSourceRef;
class OSXUchrKeyResource : public IOSXKeyResource class OSXUchrKeyResource : public IOSXKeyResource
{ {
public: public:
OSXUchrKeyResource(const void *, UInt32 keyboardType); OSXUchrKeyResource(const void *, uint32_t keyboardType);
// KeyResource overrides // KeyResource overrides
virtual bool isValid() const; virtual bool isValid() const;
virtual UInt32 getNumModifierCombinations() const; virtual uint32_t getNumModifierCombinations() const;
virtual UInt32 getNumTables() const; virtual uint32_t getNumTables() const;
virtual UInt32 getNumButtons() const; virtual uint32_t getNumButtons() const;
virtual UInt32 getTableForModifier(UInt32 mask) const; virtual uint32_t getTableForModifier(uint32_t mask) const;
virtual KeyID getKey(UInt32 table, UInt32 button) const; virtual KeyID getKey(uint32_t table, uint32_t button) const;
private: private:
using KeySequence = std::vector<KeyID>; using KeySequence = std::vector<KeyID>;

View file

@ -477,7 +477,7 @@ void XWindowsClipboard::icccmFillCache()
XWindowsUtil::convertAtomProperty(data); XWindowsUtil::convertAtomProperty(data);
auto targets = static_cast<const Atom *>(static_cast<const void *>(data.data())); auto targets = static_cast<const Atom *>(static_cast<const void *>(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())); 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 // 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. // owners that don't report all the targets they support.
target = converter->getAtom(); target = converter->getAtom();
/* /*
for (UInt32 i = 0; i < numTargets; ++i) { for (uint32_t i = 0; i < numTargets; ++i) {
if (converter->getAtom() == targets[i]) { if (converter->getAtom() == targets[i]) {
target = targets[i]; target = targets[i];
break; break;
@ -705,7 +705,6 @@ void XWindowsClipboard::motifFillCache()
// save it // save it
motifFormats.insert(std::make_pair(motifFormat.m_type, data)); 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 // try each converter in order (because they're in order of
// preference). // preference).
@ -790,11 +789,11 @@ bool XWindowsClipboard::insertMultipleReply(Window requestor, ::Time time, Atom
// data is a list of atom pairs: target, property // data is a list of atom pairs: target, property
XWindowsUtil::convertAtomProperty(data); XWindowsUtil::convertAtomProperty(data);
auto targets = static_cast<const Atom *>(static_cast<const void *>(data.data())); auto targets = static_cast<const Atom *>(static_cast<const void *>(data.data()));
const UInt32 numTargets = data.size() / sizeof(Atom); const uint32_t numTargets = data.size() / sizeof(Atom);
// add replies for each target // add replies for each target
bool changed = false; 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 target = targets[i + 0];
const Atom property = targets[i + 1]; const Atom property = targets[i + 1];
if (!addSimpleRequest(requestor, target, time, property)) { 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 // send using INCR if already sending incrementally or if reply
// is too large, otherwise just send it. // 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); const bool useINCR = (reply->m_data.size() > maxRequestSize);
// send INCR reply if incremental and we haven't replied yet // send INCR reply if incremental and we haven't replied yet
if (useINCR && !reply->m_replied) { if (useINCR && !reply->m_replied) {
UInt32 size = reply->m_data.size(); uint32_t size = reply->m_data.size();
if (!XWindowsUtil::setWindowProperty( if (!XWindowsUtil::setWindowProperty(
m_display, reply->m_requestor, reply->m_property, &size, 4, m_atomINCR, 32 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 // send more INCR reply or entire non-incremental reply
else { else {
// how much more data should we send? // 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) if (size > maxRequestSize)
size = maxRequestSize; size = maxRequestSize;
@ -1255,7 +1254,7 @@ bool XWindowsClipboard::CICCCMGetClipboard::readClipboard(
} }
// put unprocessed events back // 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]); XPutBackEvent(display, &events[i - 1]);
} }

View file

@ -256,7 +256,7 @@ protected:
int m_format; int m_format;
// index of next byte in m_data to send // index of next byte in m_data to send
UInt32 m_ptr; uint32_t m_ptr;
}; };
using ReplyList = std::list<Reply *>; using ReplyList = std::list<Reply *>;
using ReplyMap = std::map<Window, ReplyList>; using ReplyMap = std::map<Window, ReplyList>;

View file

@ -22,17 +22,17 @@
struct CBMPInfoHeader struct CBMPInfoHeader
{ {
public: public:
UInt32 biSize; uint32_t biSize;
int32_t biWidth; int32_t biWidth;
int32_t biHeight; int32_t biHeight;
uint16_t biPlanes; uint16_t biPlanes;
uint16_t biBitCount; uint16_t biBitCount;
UInt32 biCompression; uint32_t biCompression;
UInt32 biSizeImage; uint32_t biSizeImage;
int32_t biXPelsPerMeter; int32_t biXPelsPerMeter;
int32_t biYPelsPerMeter; int32_t biYPelsPerMeter;
UInt32 biClrUsed; uint32_t biClrUsed;
UInt32 biClrImportant; uint32_t biClrImportant;
}; };
// BMP is little-endian // BMP is little-endian
@ -53,7 +53,7 @@ static void toLE(uint8_t *&dst, int32_t src)
dst += 4; dst += 4;
} }
static void toLE(uint8_t *&dst, UInt32 src) static void toLE(uint8_t *&dst, uint32_t src)
{ {
dst[0] = static_cast<uint8_t>(src & 0xffu); dst[0] = static_cast<uint8_t>(src & 0xffu);
dst[1] = static_cast<uint8_t>((src >> 8) & 0xffu); dst[1] = static_cast<uint8_t>((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) static inline int32_t fromLES32(const uint8_t *data)
{ {
return static_cast<int32_t>( return static_cast<int32_t>(
static_cast<UInt32>(data[0]) | (static_cast<UInt32>(data[1]) << 8) | (static_cast<UInt32>(data[2]) << 16) | static_cast<uint32_t>(data[0]) | (static_cast<uint32_t>(data[1]) << 8) | (static_cast<uint32_t>(data[2]) << 16) |
(static_cast<UInt32>(data[3]) << 24) (static_cast<uint32_t>(data[3]) << 24)
); );
} }
static inline UInt32 fromLEU32(const uint8_t *data) static inline uint32_t fromLEU32(const uint8_t *data)
{ {
return static_cast<UInt32>(data[0]) | (static_cast<UInt32>(data[1]) << 8) | (static_cast<UInt32>(data[2]) << 16) | return static_cast<uint32_t>(data[0]) | (static_cast<uint32_t>(data[1]) << 8) |
(static_cast<UInt32>(data[3]) << 24); (static_cast<uint32_t>(data[2]) << 16) | (static_cast<uint32_t>(data[3]) << 24);
} }
// //
@ -140,7 +140,7 @@ std::string XWindowsClipboardAnyBitmapConverter::fromIClipboard(const std::strin
std::string XWindowsClipboardAnyBitmapConverter::toIClipboard(const std::string &image) const std::string XWindowsClipboardAnyBitmapConverter::toIClipboard(const std::string &image) const
{ {
// convert to raw BMP data // convert to raw BMP data
UInt32 w, h, depth; uint32_t w, h, depth;
std::string rawBMP = doToIClipboard(image, w, h, depth); std::string rawBMP = doToIClipboard(image, w, h, depth);
if (rawBMP.empty() || w == 0 || h == 0 || (depth != 24 && depth != 32)) { if (rawBMP.empty() || w == 0 || h == 0 || (depth != 24 && depth != 32)) {
return std::string(); return std::string();
@ -149,17 +149,17 @@ std::string XWindowsClipboardAnyBitmapConverter::toIClipboard(const std::string
// fill BMP info header with little-endian data // fill BMP info header with little-endian data
uint8_t infoHeader[40]; uint8_t infoHeader[40];
uint8_t *dst = infoHeader; uint8_t *dst = infoHeader;
toLE(dst, static_cast<UInt32>(40)); toLE(dst, static_cast<uint32_t>(40));
toLE(dst, static_cast<int32_t>(w)); toLE(dst, static_cast<int32_t>(w));
toLE(dst, static_cast<int32_t>(h)); toLE(dst, static_cast<int32_t>(h));
toLE(dst, static_cast<uint16_t>(1)); toLE(dst, static_cast<uint16_t>(1));
toLE(dst, static_cast<uint16_t>(depth)); toLE(dst, static_cast<uint16_t>(depth));
toLE(dst, static_cast<UInt32>(0)); // BI_RGB toLE(dst, static_cast<uint32_t>(0)); // BI_RGB
toLE(dst, static_cast<UInt32>(image.size())); toLE(dst, static_cast<uint32_t>(image.size()));
toLE(dst, static_cast<int32_t>(2834)); // 72 dpi toLE(dst, static_cast<int32_t>(2834)); // 72 dpi
toLE(dst, static_cast<int32_t>(2834)); // 72 dpi toLE(dst, static_cast<int32_t>(2834)); // 72 dpi
toLE(dst, static_cast<UInt32>(0)); toLE(dst, static_cast<uint32_t>(0));
toLE(dst, static_cast<UInt32>(0)); toLE(dst, static_cast<uint32_t>(0));
// construct image // construct image
return std::string(reinterpret_cast<const char *>(infoHeader), sizeof(infoHeader)) + rawBMP; return std::string(reinterpret_cast<const char *>(infoHeader), sizeof(infoHeader)) + rawBMP;

View file

@ -39,18 +39,18 @@ protected:
/*! /*!
Convert raw BGR pixel data to another image format. 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 from IClipboard format
/*! /*!
Convert raw BGRA pixel data to another image 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 to IClipboard format
/*! /*!
Convert an image into raw BGR or BGRA image data and store the Convert an image into raw BGR or BGRA image data and store the
width, height, and image depth (24 or 32). 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;
}; };

View file

@ -23,17 +23,17 @@ struct CBMPHeader
{ {
public: public:
uint16_t type; uint16_t type;
UInt32 size; uint32_t size;
uint16_t reserved1; uint16_t reserved1;
uint16_t reserved2; uint16_t reserved2;
UInt32 offset; uint32_t offset;
}; };
// BMP is little-endian // BMP is little-endian
static inline UInt32 fromLEU32(const uint8_t *data) static inline uint32_t fromLEU32(const uint8_t *data)
{ {
return static_cast<UInt32>(data[0]) | (static_cast<UInt32>(data[1]) << 8) | (static_cast<UInt32>(data[2]) << 16) | return static_cast<uint32_t>(data[0]) | (static_cast<uint32_t>(data[1]) << 8) |
(static_cast<UInt32>(data[3]) << 24); (static_cast<uint32_t>(data[2]) << 16) | (static_cast<uint32_t>(data[3]) << 24);
} }
static void toLE(uint8_t *&dst, char src) static void toLE(uint8_t *&dst, char src)
@ -49,7 +49,7 @@ static void toLE(uint8_t *&dst, uint16_t src)
dst += 2; dst += 2;
} }
static void toLE(uint8_t *&dst, UInt32 src) static void toLE(uint8_t *&dst, uint32_t src)
{ {
dst[0] = static_cast<uint8_t>(src & 0xffu); dst[0] = static_cast<uint8_t>(src & 0xffu);
dst[1] = static_cast<uint8_t>((src >> 8) & 0xffu); dst[1] = static_cast<uint8_t>((src >> 8) & 0xffu);
@ -95,10 +95,10 @@ std::string XWindowsClipboardBMPConverter::fromIClipboard(const std::string &bmp
uint8_t *dst = header; uint8_t *dst = header;
toLE(dst, 'B'); toLE(dst, 'B');
toLE(dst, 'M'); toLE(dst, 'M');
toLE(dst, static_cast<UInt32>(14 + bmp.size())); toLE(dst, static_cast<uint32_t>(14 + bmp.size()));
toLE(dst, static_cast<uint16_t>(0)); toLE(dst, static_cast<uint16_t>(0));
toLE(dst, static_cast<uint16_t>(0)); toLE(dst, static_cast<uint16_t>(0));
toLE(dst, static_cast<UInt32>(14 + 40)); toLE(dst, static_cast<uint32_t>(14 + 40));
return std::string(reinterpret_cast<const char *>(header), 14) + bmp; return std::string(reinterpret_cast<const char *>(header), 14) + bmp;
} }
@ -116,7 +116,7 @@ std::string XWindowsClipboardBMPConverter::toIClipboard(const std::string &bmp)
} }
// get offset to image data // get offset to image data
UInt32 offset = fromLEU32(rawBMPHeader + 10); uint32_t offset = fromLEU32(rawBMPHeader + 10);
// construct BMP // construct BMP
if (offset == 14 + 40) { if (offset == 14 + 40) {

View file

@ -146,7 +146,7 @@ void XWindowsEventQueueBuffer::waitForEvent(double dtimeout)
Thread::testCancel(); Thread::testCancel();
} }
IEventQueueBuffer::Type XWindowsEventQueueBuffer::getEvent(Event &event, UInt32 &dataID) IEventQueueBuffer::Type XWindowsEventQueueBuffer::getEvent(Event &event, uint32_t &dataID)
{ {
Lock lock(&m_mutex); Lock lock(&m_mutex);
@ -158,7 +158,7 @@ IEventQueueBuffer::Type XWindowsEventQueueBuffer::getEvent(Event &event, UInt32
// process event // process event
if (m_event.xany.type == ClientMessage && m_event.xclient.message_type == m_userEvent) { if (m_event.xany.type == ClientMessage && m_event.xclient.message_type == m_userEvent) {
dataID = static_cast<UInt32>(m_event.xclient.data.l[0]); dataID = static_cast<uint32_t>(m_event.xclient.data.l[0]);
return kUser; return kUser;
} else { } else {
event = Event(Event::kSystem, m_events->getSystemTarget(), &m_event); 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 // prepare a message
XEvent xevent; XEvent xevent;

View file

@ -47,8 +47,8 @@ public:
{ {
} }
virtual void waitForEvent(double timeout); virtual void waitForEvent(double timeout);
virtual Type getEvent(Event &event, UInt32 &dataID); virtual Type getEvent(Event &event, uint32_t &dataID);
virtual bool addEvent(UInt32 dataID); virtual bool addEvent(uint32_t dataID);
virtual bool isEmpty() const; virtual bool isEmpty() const;
virtual EventQueueTimer *newTimer(double duration, bool oneShot) const; virtual EventQueueTimer *newTimer(double duration, bool oneShot) const;
virtual void deleteTimer(EventQueueTimer *) const; virtual void deleteTimer(EventQueueTimer *) const;

View file

@ -112,7 +112,7 @@ void XWindowsKeyState::setAutoRepeat(const XKeyboardState &state)
KeyModifierMask XWindowsKeyState::mapModifiersFromX(unsigned int state) const KeyModifierMask XWindowsKeyState::mapModifiersFromX(unsigned int state) const
{ {
LOG((CLOG_DEBUG2 "mapping state: %i", state)); LOG((CLOG_DEBUG2 "mapping state: %i", state));
UInt32 offset = 8 * getGroupFromState(state); uint32_t offset = 8 * getGroupFromState(state);
KeyModifierMask mask = 0; KeyModifierMask mask = 0;
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i) {
if ((state & (1u << i)) != 0) { if ((state & (1u << i)) != 0) {
@ -201,8 +201,8 @@ void XWindowsKeyState::pollPressedKeys(KeyButtonSet &pressedKeys) const
{ {
char keys[32]; char keys[32];
XQueryKeymap(m_display, keys); XQueryKeymap(m_display, keys);
for (UInt32 i = 0; i < 32; ++i) { for (uint32_t i = 0; i < 32; ++i) {
for (UInt32 j = 0; j < 8; ++j) { for (uint32_t j = 0; j < 8; ++j) {
if ((keys[i] & (1u << j)) != 0) { if ((keys[i] & (1u << j)) != 0) {
pressedKeys.insert(8 * i + j); pressedKeys.insert(8 * i + j);
} }
@ -666,7 +666,7 @@ void XWindowsKeyState::updateKeysymMapXKB(deskflow::KeyMap &keyMap)
// modifier masks. // modifier masks.
item.m_lock = false; item.m_lock = false;
bool isModifier = 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) { if (XkbKeyHasActions(m_xkb, keycode) == True) {
XkbAction *action = XkbKeyActionEntry(m_xkb, keycode, level, eGroup); XkbAction *action = XkbKeyActionEntry(m_xkb, keycode, level, eGroup);
if (action->type == XkbSA_SetMods || action->type == XkbSA_LockMods) { 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 // record the modifier mask for this key. don't bother
// for keys that change the group. // for keys that change the group.
item.m_generates = 0; item.m_generates = 0;
UInt32 modifierBit = XWindowsUtil::getModifierBitForKeySym(keysym); uint32_t modifierBit = XWindowsUtil::getModifierBitForKeySym(keysym);
if (isModifier && modifierBit != kKeyModifierBitNone) { if (isModifier && modifierBit != kKeyModifierBitNone) {
item.m_generates = (1u << modifierBit); item.m_generates = (1u << modifierBit);
for (int32_t j = 0; j < 8; ++j) { for (int32_t j = 0; j < 8; ++j) {
@ -855,7 +855,7 @@ int XWindowsKeyState::getEffectiveGroup(KeyCode keycode, int group) const
return group; return group;
} }
UInt32 XWindowsKeyState::getGroupFromState(unsigned int state) const uint32_t XWindowsKeyState::getGroupFromState(unsigned int state) const
{ {
#if HAVE_XKB_EXTENSION #if HAVE_XKB_EXTENSION
if (m_xkb != NULL) { if (m_xkb != NULL) {

View file

@ -120,7 +120,7 @@ private:
void updateKeysymMapXKB(deskflow::KeyMap &); void updateKeysymMapXKB(deskflow::KeyMap &);
bool hasModifiersXKB() const; bool hasModifiersXKB() const;
int getEffectiveGroup(KeyCode, int group) 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 //! Create and send language change request to \p group by DBus interface
/*! /*!
@ -135,7 +135,7 @@ private:
{ {
public: public:
unsigned char m_level; unsigned char m_level;
UInt32 m_mask; uint32_t m_mask;
bool m_lock; bool m_lock;
}; };
@ -148,7 +148,7 @@ private:
using KeyModifierToXMask = std::map<KeyModifierMask, unsigned int>; using KeyModifierToXMask = std::map<KeyModifierMask, unsigned int>;
using KeyToKeyCodeMap = std::multimap<KeyID, KeyCode>; using KeyToKeyCodeMap = std::multimap<KeyID, KeyCode>;
using NonXKBModifierMap = std::map<KeyCode, unsigned int>; using NonXKBModifierMap = std::map<KeyCode, unsigned int>;
using XKBModifierMap = std::map<UInt32, XKBModifierInfo>; using XKBModifierMap = std::map<uint32_t, XKBModifierInfo>;
Display *m_display; Display *m_display;
#if HAVE_XKB_EXTENSION #if HAVE_XKB_EXTENSION

View file

@ -450,7 +450,7 @@ void XWindowsScreen::resetOptions()
void XWindowsScreen::setOptions(const OptionsList &options) 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) { if (options[i] == kOptionXTestXineramaUnaware) {
m_xtestIsXineramaUnaware = (options[i + 1] != 0); m_xtestIsXineramaUnaware = (options[i + 1] != 0);
LOG((CLOG_DEBUG1 "library, XTest is Xinerama unaware %s", m_xtestIsXineramaUnaware ? "true" : "false")); 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; 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 // do nothing
} }
@ -544,7 +544,7 @@ void XWindowsScreen::warpCursor(int32_t x, int32_t y)
m_yCursor = y; m_yCursor = y;
} }
UInt32 XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) uint32_t XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
{ {
// only allow certain modifiers // only allow certain modifiers
if ((mask & ~(KeyModifierShift | KeyModifierControl | KeyModifierAlt | KeyModifierSuper)) != 0) { if ((mask & ~(KeyModifierShift | KeyModifierControl | KeyModifierAlt | KeyModifierSuper)) != 0) {
@ -573,7 +573,7 @@ UInt32 XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
} }
// choose hotkey id // choose hotkey id
UInt32 id; uint32_t id;
if (!m_oldHotKeyIDs.empty()) { if (!m_oldHotKeyIDs.empty()) {
id = m_oldHotKeyIDs.back(); id = m_oldHotKeyIDs.back();
m_oldHotKeyIDs.pop_back(); m_oldHotKeyIDs.pop_back();
@ -731,7 +731,7 @@ UInt32 XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
return id; return id;
} }
void XWindowsScreen::unregisterHotKey(UInt32 id) void XWindowsScreen::unregisterHotKey(uint32_t id)
{ {
// look up hotkey // look up hotkey
HotKeyMap::iterator i = m_hotKeys.find(id); HotKeyMap::iterator i = m_hotKeys.find(id);
@ -775,7 +775,7 @@ int32_t XWindowsScreen::getJumpZoneSize() const
return 1; return 1;
} }
bool XWindowsScreen::isAnyMouseButtonDown(UInt32 &buttonID) const bool XWindowsScreen::isAnyMouseButtonDown(uint32_t &buttonID) const
{ {
// query the pointer to get the button state // query the pointer to get the button state
Window root, window; Window root, window;
@ -1878,13 +1878,13 @@ void XWindowsScreen::warpCursorNoFlush(int32_t x, int32_t y)
void XWindowsScreen::updateButtons() void XWindowsScreen::updateButtons()
{ {
// query the button mapping // 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]; unsigned char *tmpButtons = new unsigned char[numButtons];
XGetPointerMapping(m_display, tmpButtons, numButtons); XGetPointerMapping(m_display, tmpButtons, numButtons);
// find the largest logical button id // find the largest logical button id
unsigned char maxButton = 0; unsigned char maxButton = 0;
for (UInt32 i = 0; i < numButtons; ++i) { for (uint32_t i = 0; i < numButtons; ++i) {
if (tmpButtons[i] > maxButton) { if (tmpButtons[i] > maxButton) {
maxButton = tmpButtons[i]; maxButton = tmpButtons[i];
} }
@ -1895,10 +1895,10 @@ void XWindowsScreen::updateButtons()
// fill in button array values. m_buttons[i] is the physical // fill in button array values. m_buttons[i] is the physical
// button number for logical button i+1. // 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; 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; m_buttons[tmpButtons[i] - 1] = i + 1;
} }

View file

@ -58,14 +58,14 @@ public:
void getCursorPos(int32_t &x, int32_t &y) const override; void getCursorPos(int32_t &x, int32_t &y) const override;
// IPrimaryScreen overrides // IPrimaryScreen overrides
void reconfigure(UInt32 activeSides) override; void reconfigure(uint32_t activeSides) override;
void warpCursor(int32_t x, int32_t y) override; void warpCursor(int32_t x, int32_t y) override;
UInt32 registerHotKey(KeyID key, KeyModifierMask mask) override; uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override;
void unregisterHotKey(UInt32 id) override; void unregisterHotKey(uint32_t id) override;
void fakeInputBegin() override; void fakeInputBegin() override;
void fakeInputEnd() override; void fakeInputEnd() override;
int32_t getJumpZoneSize() const 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; void getCursorCenter(int32_t &x, int32_t &y) const override;
// ISecondaryScreen overrides // ISecondaryScreen overrides
@ -87,7 +87,7 @@ public:
void screensaver(bool activate) override; void screensaver(bool activate) override;
void resetOptions() override; void resetOptions() override;
void setOptions(const OptionsList &options) override; void setOptions(const OptionsList &options) override;
void setSequenceNumber(UInt32) override; void setSequenceNumber(uint32_t) override;
bool isPrimary() const override; bool isPrimary() const override;
std::string getSecureInputApp() const override; std::string getSecureInputApp() const override;
@ -174,9 +174,9 @@ private:
}; };
using FilteredKeycodes = std::set<bool>; using FilteredKeycodes = std::set<bool>;
using HotKeyList = std::vector<std::pair<int, unsigned int>>; using HotKeyList = std::vector<std::pair<int, unsigned int>>;
using HotKeyMap = std::map<UInt32, HotKeyList>; using HotKeyMap = std::map<uint32_t, HotKeyList>;
using HotKeyIDList = std::vector<UInt32>; using HotKeyIDList = std::vector<uint32_t>;
using HotKeyToIDMap = std::map<HotKeyItem, UInt32>; using HotKeyToIDMap = std::map<HotKeyItem, uint32_t>;
// true if screen is being used as a primary screen, false otherwise // true if screen is being used as a primary screen, false otherwise
bool m_isPrimary; bool m_isPrimary;
@ -217,7 +217,7 @@ private:
// clipboards // clipboards
XWindowsClipboard *m_clipboard[kClipboardEnd]; XWindowsClipboard *m_clipboard[kClipboardEnd];
UInt32 m_sequenceNumber; uint32_t m_sequenceNumber;
// screen saver stuff // screen saver stuff
XWindowsScreenSaver *m_screensaver; XWindowsScreenSaver *m_screensaver;

View file

@ -79,7 +79,7 @@
struct codepair struct codepair
{ {
KeySym keysym; KeySym keysym;
UInt32 ucs4; uint32_t ucs4;
} s_keymap[] = { } s_keymap[] = {
{XK_Aogonek, 0x0104}, /* LATIN CAPITAL LETTER A WITH OGONEK */ {XK_Aogonek, 0x0104}, /* LATIN CAPITAL LETTER A WITH OGONEK */
{XK_breve, 0x02d8}, /* BREVE */ {XK_breve, 0x02d8}, /* BREVE */
@ -1601,12 +1601,12 @@ bool XWindowsUtil::getWindowProperty(
} }
bool XWindowsUtil::setWindowProperty( 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<const unsigned char *>(vdata); const unsigned char *data = static_cast<const unsigned char *>(vdata);
UInt32 datumSize = static_cast<UInt32>(format / 8); uint32_t datumSize = static_cast<uint32_t>(format / 8);
// format 32 on 64bit systems is 8 bytes not 4. // format 32 on 64bit systems is 8 bytes not 4.
if (format == 32) { if (format == 32) {
datumSize = sizeof(Atom); datumSize = sizeof(Atom);
@ -1617,7 +1617,7 @@ bool XWindowsUtil::setWindowProperty(
XWindowsUtil::ErrorLock lock(display, &error); XWindowsUtil::ErrorLock lock(display, &error);
// how much data to send in first chunk? // how much data to send in first chunk?
UInt32 chunkSize = size; uint32_t chunkSize = size;
if (chunkSize > length) { if (chunkSize > length) {
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) { switch (keysym) {
case XK_Shift_L: 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]; char **names = new char *[num];
bool error = false; bool error = false;
@ -1842,11 +1842,11 @@ std::string XWindowsUtil::atomsToString(Display *display, const Atom *atom, UInt
XGetAtomNames(display, const_cast<Atom *>(atom), (int)num, names); XGetAtomNames(display, const_cast<Atom *>(atom), (int)num, names);
std::string msg; std::string msg;
if (error) { if (error) {
for (UInt32 i = 0; i < num; ++i) { for (uint32_t i = 0; i < num; ++i) {
msg += deskflow::string::sprintf("<UNKNOWN> (%d), ", (int)atom[i]); msg += deskflow::string::sprintf("<UNKNOWN> (%d), ", (int)atom[i]);
} }
} else { } 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]); msg += deskflow::string::sprintf("%s (%d), ", names[i], (int)atom[i]);
XFree(names[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 // 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. // 64-bit numbers we have to ensure the last number is a full 64 bits.
if (sizeof(Atom) != 4 && ((data.size() / 4) & 1) != 0) { if (sizeof(Atom) != 4 && ((data.size() / 4) & 1) != 0) {
UInt32 zero = 0; uint32_t zero = 0;
data.append(reinterpret_cast<char *>(&zero), sizeof(zero)); data.append(reinterpret_cast<char *>(&zero), sizeof(zero));
} }
} }
@ -1877,7 +1877,7 @@ void XWindowsUtil::appendAtomData(std::string &data, Atom atom)
data.append(reinterpret_cast<char *>(&atom), sizeof(Atom)); data.append(reinterpret_cast<char *>(&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<const char *>(&atom), sizeof(Atom)); data.replace(index * sizeof(Atom), sizeof(Atom), reinterpret_cast<const char *>(&atom), sizeof(Atom));
} }

View file

@ -53,8 +53,9 @@ public:
Sets property \c property on \c window to \c size bytes of data from Sets property \c property on \c window to \c size bytes of data from
\c data. \c data.
*/ */
static bool static bool setWindowProperty(
setWindowProperty(Display *, Window window, Atom property, const void *data, UInt32 size, Atom type, int32_t format); Display *, Window window, Atom property, const void *data, uint32_t size, Atom type, int32_t format
);
//! Get X server time //! Get X server time
/*! /*!
@ -67,14 +68,14 @@ public:
Converts a KeySym to the equivalent KeyID. Returns kKeyNone if the Converts a KeySym to the equivalent KeyID. Returns kKeyNone if the
KeySym cannot be mapped. KeySym cannot be mapped.
*/ */
static UInt32 mapKeySymToKeyID(KeySym); static uint32_t mapKeySymToKeyID(KeySym);
//! Convert KeySym to corresponding KeyModifierMask //! Convert KeySym to corresponding KeyModifierMask
/*! /*!
Converts a KeySym to the corresponding KeyModifierMask, or 0 if the Converts a KeySym to the corresponding KeyModifierMask, or 0 if the
KeySym is not a modifier. KeySym is not a modifier.
*/ */
static UInt32 getModifierBitForKeySym(KeySym keysym); static uint32_t getModifierBitForKeySym(KeySym keysym);
//! Convert Atom to its string //! Convert Atom to its string
/*! /*!
@ -87,7 +88,7 @@ public:
Converts each atom in \p atoms to its string representation and Converts each atom in \p atoms to its string representation and
concatenates the results. 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 //! 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 Converts \p atom to a 32-bit on-the-wire format and replaces the atom
at index \p index in \p data. 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 //! Append an Time to property data
/*! /*!
@ -184,7 +185,7 @@ private:
static void initKeyMaps(); static void initKeyMaps();
private: private:
typedef std::map<KeySym, UInt32> KeySymMap; typedef std::map<KeySym, uint32_t> KeySymMap;
static KeySymMap s_keySymToUCS4; static KeySymMap s_keySymToUCS4;
}; };

View file

@ -71,7 +71,7 @@ public:
virtual void getCursorPos(int32_t &x, int32_t &y) const = 0; virtual void getCursorPos(int32_t &x, int32_t &y) const = 0;
// IClient overrides // 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 bool leave() = 0;
virtual void setClipboard(ClipboardID, const IClipboard *) = 0; virtual void setClipboard(ClipboardID, const IClipboard *) = 0;
virtual void grabClipboard(ClipboardID) = 0; virtual void grabClipboard(ClipboardID) = 0;
@ -87,7 +87,7 @@ public:
virtual void screensaver(bool activate) = 0; virtual void screensaver(bool activate) = 0;
virtual void resetOptions() = 0; virtual void resetOptions() = 0;
virtual void setOptions(const OptionsList &options) = 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 void fileChunkSending(uint8_t mark, char *data, size_t dataSize) = 0;
virtual std::string getSecureInputApp() const = 0; virtual std::string getSecureInputApp() const = 0;
virtual void secureInputNotification(const std::string &app) const = 0; virtual void secureInputNotification(const std::string &app) const = 0;

View file

@ -69,7 +69,7 @@ public:
void getCursorPos(int32_t &x, int32_t &y) const override = 0; void getCursorPos(int32_t &x, int32_t &y) const override = 0;
// IClient overrides // 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; bool leave() override = 0;
void setClipboard(ClipboardID, const IClipboard *) override = 0; void setClipboard(ClipboardID, const IClipboard *) override = 0;
void grabClipboard(ClipboardID) override = 0; void grabClipboard(ClipboardID) override = 0;
@ -85,7 +85,7 @@ public:
void screensaver(bool activate) override = 0; void screensaver(bool activate) override = 0;
void resetOptions() override = 0; void resetOptions() override = 0;
void setOptions(const OptionsList &options) 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 fileChunkSending(uint8_t mark, char *data, size_t dataSize) override = 0;
void secureInputNotification(const std::string &app) const override = 0; void secureInputNotification(const std::string &app) const override = 0;

View file

@ -130,7 +130,7 @@ void ClientProxy1_0::handleData(const Event &, void *)
{ {
// handle messages until there are no more. first read message code. // handle messages until there are no more. first read message code.
uint8_t code[4]; uint8_t code[4];
UInt32 n = getStream()->read(code, 4); uint32_t n = getStream()->read(code, 4);
while (n != 0) { while (n != 0) {
// verify we got an entire code // verify we got an entire code
if (n != 4) { if (n != 4) {
@ -244,7 +244,7 @@ void ClientProxy1_0::getCursorPos(int32_t &x, int32_t &y) const
y = m_info.m_my; 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)); 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); 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); 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 // ignore -- not supported in protocol 1.0
LOG((CLOG_DEBUG "draggingInfoSending not supported")); LOG((CLOG_DEBUG "draggingInfoSending not supported"));
@ -374,7 +374,7 @@ void ClientProxy1_0::setOptions(const OptionsList &options)
ProtocolUtil::writef(getStream(), kMsgDSetOptions, &options); ProtocolUtil::writef(getStream(), kMsgDSetOptions, &options);
// check 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) { if (options[i] == kOptionHeartbeat) {
double rate = 1.0e-3 * static_cast<double>(options[i + 1]); double rate = 1.0e-3 * static_cast<double>(options[i + 1]);
if (rate <= 0.0) { if (rate <= 0.0) {
@ -429,7 +429,7 @@ bool ClientProxy1_0::recvGrabClipboard()
{ {
// parse message // parse message
ClipboardID id; ClipboardID id;
UInt32 seqNum; uint32_t seqNum;
if (!ProtocolUtil::readf(getStream(), kMsgCClipboard + 4, &id, &seqNum)) { if (!ProtocolUtil::readf(getStream(), kMsgCClipboard + 4, &id, &seqNum)) {
return false; return false;
} }

View file

@ -44,7 +44,7 @@ public:
void getCursorPos(int32_t &x, int32_t &y) const override; void getCursorPos(int32_t &x, int32_t &y) const override;
// IClient overrides // 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; bool leave() override;
void setClipboard(ClipboardID, const IClipboard *) override; void setClipboard(ClipboardID, const IClipboard *) override;
void grabClipboard(ClipboardID) override; void grabClipboard(ClipboardID) override;
@ -60,7 +60,7 @@ public:
void screensaver(bool activate) override; void screensaver(bool activate) override;
void resetOptions() override; void resetOptions() override;
void setOptions(const OptionsList &options) 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; void fileChunkSending(uint8_t mark, char *data, size_t dataSize) override;
std::string getSecureInputApp() const override; std::string getSecureInputApp() const override;
void secureInputNotification(const std::string &app) const override; void secureInputNotification(const std::string &app) const override;
@ -96,7 +96,7 @@ protected:
public: public:
Clipboard m_clipboard; Clipboard m_clipboard;
UInt32 m_sequenceNumber; uint32_t m_sequenceNumber;
bool m_dirty; bool m_dirty;
}; };

View file

@ -47,7 +47,7 @@ ClientProxy1_5::~ClientProxy1_5()
m_events->removeHandler(m_events->forFile().keepAlive(), this); 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); std::string data(info, size);
@ -90,7 +90,7 @@ void ClientProxy1_5::fileChunkReceived()
void ClientProxy1_5::dragInfoReceived() void ClientProxy1_5::dragInfoReceived()
{ {
// parse // parse
UInt32 fileNum = 0; uint32_t fileNum = 0;
std::string content; std::string content;
ProtocolUtil::readf(getStream(), kMsgDDragInfo + 4, &fileNum, &content); ProtocolUtil::readf(getStream(), kMsgDDragInfo + 4, &fileNum, &content);

Some files were not shown because too many files have changed in this diff Show more