diff --git a/src/lib/base/Unicode.cpp b/src/lib/base/Unicode.cpp index 7b88f7840..dbf0a9240 100644 --- a/src/lib/base/Unicode.cpp +++ b/src/lib/base/Unicode.cpp @@ -25,12 +25,12 @@ // local utility functions // -inline static UInt16 decode16(const uint8_t *n, bool byteSwapped) +inline static uint16_t decode16(const uint8_t *n, bool byteSwapped) { union x16 { uint8_t n8[2]; - UInt16 n16; + uint16_t n16; } c; if (byteSwapped) { c.n8[0] = n[1]; @@ -116,7 +116,7 @@ std::string Unicode::UTF8ToUCS2(const std::string &src, bool *errors) setError(errors); c = s_replacement; } - UInt16 ucs2 = static_cast(c); + uint16_t ucs2 = static_cast(c); dst.append(reinterpret_cast(&ucs2), 2); } @@ -167,12 +167,12 @@ std::string Unicode::UTF8ToUTF16(const std::string &src, bool *errors) c = s_replacement; } if (c < 0x00010000) { - UInt16 ucs2 = static_cast(c); + uint16_t ucs2 = static_cast(c); dst.append(reinterpret_cast(&ucs2), 2); } else { c -= 0x00010000; - UInt16 utf16h = static_cast((c >> 10) + 0xd800); - UInt16 utf16l = static_cast((c & 0x03ff) + 0xdc00); + uint16_t utf16h = static_cast((c >> 10) + 0xd800); + uint16_t utf16l = static_cast((c & 0x03ff) + 0xdc00); dst.append(reinterpret_cast(&utf16h), 2); dst.append(reinterpret_cast(&utf16l), 2); } diff --git a/src/lib/client/ServerProxy.cpp b/src/lib/client/ServerProxy.cpp index bda736b60..7889f5964 100644 --- a/src/lib/client/ServerProxy.cpp +++ b/src/lib/client/ServerProxy.cpp @@ -240,9 +240,9 @@ ServerProxy::EResult ServerProxy::parseMessage(const uint8_t *code) } else if (memcmp(code, kMsgDKeyDown, 4) == 0) { - UInt16 id = 0; - UInt16 mask = 0; - UInt16 button = 0; + uint16_t id = 0; + uint16_t mask = 0; + uint16_t button = 0; ProtocolUtil::readf(m_stream, kMsgDKeyDown + 4, &id, &mask, &button); LOG((CLOG_DEBUG1 "recv key down id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button)); @@ -251,9 +251,9 @@ ServerProxy::EResult ServerProxy::parseMessage(const uint8_t *code) else if (memcmp(code, kMsgDKeyDownLang, 4) == 0) { std::string lang; - UInt16 id = 0; - UInt16 mask = 0; - UInt16 button = 0; + uint16_t id = 0; + uint16_t mask = 0; + uint16_t button = 0; ProtocolUtil::readf(m_stream, kMsgDKeyDownLang + 4, &id, &mask, &button, &lang); LOG((CLOG_DEBUG1 "recv key down id=0x%08x, mask=0x%04x, button=0x%04x, lang=\"%s\"", id, mask, button, lang.c_str()) @@ -514,7 +514,7 @@ void ServerProxy::enter() { // parse int16_t x, y; - UInt16 mask; + uint16_t mask; UInt32 seqNum; ProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask); LOG((CLOG_DEBUG1 "recv enter, %d,%d %d %04x", x, y, seqNum, mask)); @@ -585,7 +585,7 @@ void ServerProxy::grabClipboard() m_client->grabClipboard(id); } -void ServerProxy::keyDown(UInt16 id, UInt16 mask, UInt16 button, const std::string &lang) +void ServerProxy::keyDown(uint16_t id, uint16_t mask, uint16_t button, const std::string &lang) { // get mouse up to date flushCompressedMouse(); @@ -607,7 +607,7 @@ void ServerProxy::keyRepeat() flushCompressedMouse(); // parse - UInt16 id, mask, count, button; + uint16_t id, mask, count, button; std::string lang; ProtocolUtil::readf(m_stream, kMsgDKeyRepeat + 4, &id, &mask, &count, &button, &lang); LOG( @@ -632,7 +632,7 @@ void ServerProxy::keyUp() flushCompressedMouse(); // parse - UInt16 id, mask, button; + uint16_t id, mask, button; ProtocolUtil::readf(m_stream, kMsgDKeyUp + 4, &id, &mask, &button); LOG((CLOG_DEBUG1 "recv key up id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button)); diff --git a/src/lib/client/ServerProxy.h b/src/lib/client/ServerProxy.h index c69be0c06..bc9fb62d9 100644 --- a/src/lib/client/ServerProxy.h +++ b/src/lib/client/ServerProxy.h @@ -107,7 +107,7 @@ private: void leave(); void setClipboard(); void grabClipboard(); - void keyDown(UInt16 id, UInt16 mask, UInt16 button, const std::string &lang); + void keyDown(uint16_t id, uint16_t mask, uint16_t button, const std::string &lang); void keyRepeat(); void keyUp(); void mouseDown(); diff --git a/src/lib/common/basic_types.h b/src/lib/common/basic_types.h index e69055034..43c8ebf13 100644 --- a/src/lib/common/basic_types.h +++ b/src/lib/common/basic_types.h @@ -85,7 +85,6 @@ #include #else using SInt32 = signed TYPE_OF_SIZE_4; -using UInt16 = unsigned TYPE_OF_SIZE_2; using UInt32 = unsigned TYPE_OF_SIZE_4; #endif #endif diff --git a/src/lib/deskflow/FileChunk.cpp b/src/lib/deskflow/FileChunk.cpp index 72c03ff6f..ff34f5c71 100644 --- a/src/lib/deskflow/FileChunk.cpp +++ b/src/lib/deskflow/FileChunk.cpp @@ -24,7 +24,7 @@ #include "deskflow/protocol_types.h" #include "io/IStream.h" -static const UInt16 kIntervalThreshold = 1; +static const uint16_t kIntervalThreshold = 1; FileChunk::FileChunk(size_t size) : Chunk(size) { diff --git a/src/lib/deskflow/ProtocolUtil.cpp b/src/lib/deskflow/ProtocolUtil.cpp index 54da4f194..f479bcf66 100644 --- a/src/lib/deskflow/ProtocolUtil.cpp +++ b/src/lib/deskflow/ProtocolUtil.cpp @@ -160,7 +160,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar break; case 2: // 2 byte integer - *static_cast(destination) = read2BytesInt(stream); + *static_cast(destination) = read2BytesInt(stream); break; case 4: // 4 byte integer @@ -184,7 +184,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar break; case 2: // 2 byte integer - readVector2BytesInt(stream, *static_cast *>(destination)); + readVector2BytesInt(stream, *static_cast *>(destination)); break; case 4: // 4 byte integer @@ -260,7 +260,7 @@ UInt32 ProtocolUtil::getLength(const char *fmt, va_list args) break; case 2: - len = 2 * (UInt32)(va_arg(args, std::vector *))->size() + 4; + len = 2 * (UInt32)(va_arg(args, std::vector *))->size() + 4; break; case 4: @@ -325,7 +325,7 @@ void ProtocolUtil::writef(std::vector &buffer, const char *fmt, va_list case 2: { // 2 byte integers - const std::vector *list = va_arg(args, const std::vector *); + const std::vector *list = va_arg(args, const std::vector *); writeVectorInt(list, buffer); break; } @@ -458,13 +458,13 @@ uint8_t ProtocolUtil::read1ByteInt(deskflow::IStream *stream) return Result; } -UInt16 ProtocolUtil::read2BytesInt(deskflow::IStream *stream) +uint16_t ProtocolUtil::read2BytesInt(deskflow::IStream *stream) { const UInt32 BufferSize = 2; std::array buffer = {}; read(stream, buffer.data(), BufferSize); - UInt16 Result = static_cast((static_cast(buffer[0]) << 8) | static_cast(buffer[1])); + uint16_t Result = static_cast((static_cast(buffer[0]) << 8) | static_cast(buffer[1])); LOG((CLOG_DEBUG2 "readf: read 2 byte integer: %d (0x%x)", Result, Result)); return Result; @@ -492,7 +492,7 @@ void ProtocolUtil::readVector1ByteInt(deskflow::IStream *stream, std::vector &destination) +void ProtocolUtil::readVector2BytesInt(deskflow::IStream *stream, std::vector &destination) { UInt32 size = readVectorSize(stream); for (UInt32 i = 0; i < size; ++i) { diff --git a/src/lib/deskflow/ProtocolUtil.h b/src/lib/deskflow/ProtocolUtil.h index 22197ce94..ba24a515a 100644 --- a/src/lib/deskflow/ProtocolUtil.h +++ b/src/lib/deskflow/ProtocolUtil.h @@ -49,7 +49,7 @@ public: - \%2i -- converts integer argument to 2 byte integer in NBO - \%4i -- converts integer argument to 4 byte integer in NBO - \%1I -- converts std::vector* to 1 byte integers - - \%2I -- converts std::vector* to 2 byte integers in NBO + - \%2I -- converts std::vector* to 2 byte integers in NBO - \%4I -- converts std::vector* to 4 byte integers in NBO - \%s -- converts std::string* to stream of bytes - \%S -- converts integer N and const uint8_t* to stream of N bytes @@ -68,7 +68,7 @@ public: - \%2i -- reads an NBO 2 byte integer; arg is SInt32* or UInt32* - \%4i -- reads an NBO 4 byte integer; arg is SInt32* or UInt32* - \%1I -- reads 1 byte integers; arg is std::vector* - - \%2I -- reads NBO 2 byte integers; arg is std::vector* + - \%2I -- reads NBO 2 byte integers; arg is std::vector* - \%4I -- reads NBO 4 byte integers; arg is std::vector* - \%s -- reads bytes; argument must be a std::string*, \b not a char* */ @@ -87,14 +87,14 @@ private: * @brief Handles 1,2, or 4 byte Integers */ static uint8_t read1ByteInt(deskflow::IStream *stream); - static UInt16 read2BytesInt(deskflow::IStream *stream); + static uint16_t read2BytesInt(deskflow::IStream *stream); static UInt32 read4BytesInt(deskflow::IStream *stream); /** * @brief Handles a Vector of integers */ static void readVector1ByteInt(deskflow::IStream *, std::vector &); - static void readVector2BytesInt(deskflow::IStream *, std::vector &); + static void readVector2BytesInt(deskflow::IStream *, std::vector &); static void readVector4BytesInt(deskflow::IStream *, std::vector &); static UInt32 readVectorSize(deskflow::IStream *stream); diff --git a/src/lib/deskflow/key_types.h b/src/lib/deskflow/key_types.h index 958fd7066..1d3657dca 100644 --- a/src/lib/deskflow/key_types.h +++ b/src/lib/deskflow/key_types.h @@ -41,9 +41,9 @@ invalid key; platforms that use 0 as a physical key identifier will have to remap that value to some arbitrary unused id. */ #if __APPLE__ -typedef UInt16 KeyButton; +typedef uint16_t KeyButton; #else -using KeyButton = UInt16; +using KeyButton = uint16_t; #endif //! Modifier key mask diff --git a/src/lib/deskflow/protocol_types.h b/src/lib/deskflow/protocol_types.h index c4b464c18..48887ff28 100644 --- a/src/lib/deskflow/protocol_types.h +++ b/src/lib/deskflow/protocol_types.h @@ -38,7 +38,7 @@ static const int16_t kProtocolMajorVersion = 1; static const int16_t kProtocolMinorVersion = 8; // default contact port number -static const UInt16 kDefaultPort = 24800; +static const uint16_t kDefaultPort = 24800; // maximum total length for greeting returned by client static const UInt32 kMaxHelloLength = 1024; diff --git a/src/lib/ipc/IpcLogOutputter.cpp b/src/lib/ipc/IpcLogOutputter.cpp index 30be28327..29f2ab2c9 100644 --- a/src/lib/ipc/IpcLogOutputter.cpp +++ b/src/lib/ipc/IpcLogOutputter.cpp @@ -195,17 +195,17 @@ void IpcLogOutputter::sendBuffer() m_sending = false; } -void IpcLogOutputter::bufferMaxSize(UInt16 bufferMaxSize) +void IpcLogOutputter::bufferMaxSize(uint16_t bufferMaxSize) { m_bufferMaxSize = bufferMaxSize; } -UInt16 IpcLogOutputter::bufferMaxSize() const +uint16_t IpcLogOutputter::bufferMaxSize() const { return m_bufferMaxSize; } -void IpcLogOutputter::bufferRateLimit(UInt16 writeLimit, double timeLimit) +void IpcLogOutputter::bufferRateLimit(uint16_t writeLimit, double timeLimit) { m_bufferRateWriteLimit = writeLimit; m_bufferRateTimeLimit = timeLimit; diff --git a/src/lib/ipc/IpcLogOutputter.h b/src/lib/ipc/IpcLogOutputter.h index fac8db285..541c6b63e 100644 --- a/src/lib/ipc/IpcLogOutputter.h +++ b/src/lib/ipc/IpcLogOutputter.h @@ -62,13 +62,13 @@ public: Set the maximum size of the buffer to protect memory from runaway logging. */ - void bufferMaxSize(UInt16 bufferMaxSize); + void bufferMaxSize(uint16_t bufferMaxSize); //! Set the rate limit /*! Set the maximum number of \p writeRate for every \p timeRate in seconds. */ - void bufferRateLimit(UInt16 writeLimit, double timeLimit); + void bufferRateLimit(uint16_t writeLimit, double timeLimit); //! Send the buffer /*! @@ -86,7 +86,7 @@ public: /*! Returns the maximum size of the buffer. */ - UInt16 bufferMaxSize() const; + uint16_t bufferMaxSize() const; //@} @@ -110,10 +110,10 @@ private: ArchMutex m_notifyMutex; bool m_bufferWaiting; IArchMultithread::ThreadID m_bufferThreadId; - UInt16 m_bufferMaxSize; - UInt16 m_bufferRateWriteLimit; + uint16_t m_bufferMaxSize; + uint16_t m_bufferRateWriteLimit; double m_bufferRateTimeLimit; - UInt16 m_bufferWriteCount; + uint16_t m_bufferWriteCount; double m_bufferRateStart; IpcClientType m_clientType; ArchMutex m_runningMutex; diff --git a/src/lib/platform/OSXClipboardBMPConverter.cpp b/src/lib/platform/OSXClipboardBMPConverter.cpp index 4c8d55730..018fb74c9 100644 --- a/src/lib/platform/OSXClipboardBMPConverter.cpp +++ b/src/lib/platform/OSXClipboardBMPConverter.cpp @@ -23,10 +23,10 @@ struct CBMPHeader { public: - UInt16 type; + uint16_t type; UInt32 size; - UInt16 reserved1; - UInt16 reserved2; + uint16_t reserved1; + uint16_t reserved2; UInt32 offset; }; @@ -43,7 +43,7 @@ static void toLE(uint8_t *&dst, char src) dst += 1; } -static void toLE(uint8_t *&dst, UInt16 src) +static void toLE(uint8_t *&dst, uint16_t src) { dst[0] = static_cast(src & 0xffu); dst[1] = static_cast((src >> 8) & 0xffu); @@ -89,8 +89,8 @@ std::string OSXClipboardBMPConverter::fromIClipboard(const std::string &bmp) con toLE(dst, 'B'); toLE(dst, 'M'); toLE(dst, static_cast(14 + bmp.size())); - toLE(dst, static_cast(0)); - toLE(dst, static_cast(0)); + toLE(dst, static_cast(0)); + toLE(dst, static_cast(0)); toLE(dst, static_cast(14 + 40)); return std::string(reinterpret_cast(header), 14) + bmp; } diff --git a/src/lib/platform/OSXKeyState.cpp b/src/lib/platform/OSXKeyState.cpp index 3f814ca0a..59f9b1f1e 100644 --- a/src/lib/platform/OSXKeyState.cpp +++ b/src/lib/platform/OSXKeyState.cpp @@ -330,7 +330,7 @@ KeyButton OSXKeyState::mapKeyFromEvent(KeyIDs &ids, KeyModifierMask *maskOut, CG //} // choose action - UInt16 action; + uint16_t action; if (eventKind == kCGEventKeyDown) { action = kUCKeyActionDown; } else if (CGEventGetIntegerValueField(event, kCGKeyboardEventAutorepeat) == 1) { diff --git a/src/lib/platform/OSXScreen.h b/src/lib/platform/OSXScreen.h index 32d112d67..2d8dde03e 100644 --- a/src/lib/platform/OSXScreen.h +++ b/src/lib/platform/OSXScreen.h @@ -134,7 +134,7 @@ private: // mouse button handler. pressed is true if this is a mousedown // event, false if it is a mouseup event. macButton is the index // of the button pressed using the mac button mapping. - bool onMouseButton(bool pressed, UInt16 macButton); + bool onMouseButton(bool pressed, uint16_t macButton); bool onMouseWheel(SInt32 xDelta, SInt32 yDelta) const; void constructMouseButtonEventMap(); @@ -150,10 +150,10 @@ private: void hideCursor(); // map deskflow mouse button to mac buttons - ButtonID mapDeskflowButtonToMac(UInt16) const; + ButtonID mapDeskflowButtonToMac(uint16_t) const; // map mac mouse button to deskflow buttons - ButtonID mapMacButtonToDeskflow(UInt16) const; + ButtonID mapMacButtonToDeskflow(uint16_t) const; // map mac scroll wheel value to a deskflow scroll wheel value SInt32 mapScrollWheelToDeskflow(SInt32) const; @@ -272,7 +272,7 @@ private: Evil, and this should be moved to a place where it need not be mutable as soon as possible. */ mutable MouseButtonState m_buttonState; - using MouseButtonEventMapType = std::map; + using MouseButtonEventMapType = std::map; std::vector MouseButtonEventMap; bool m_cursorHidden; diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm index c9d86a5ef..b9431ee7a 100644 --- a/src/lib/platform/OSXScreen.mm +++ b/src/lib/platform/OSXScreen.mm @@ -429,9 +429,9 @@ void OSXScreen::constructMouseButtonEventMap() {kCGEventOtherMouseUp, kCGEventOtherMouseDragged, kCGEventOtherMouseDown} }; - for (UInt16 button = 0; button < NumButtonIDs; button++) { + for (uint16_t button = 0; button < NumButtonIDs; button++) { MouseButtonEventMapType new_map; - for (UInt16 state = (UInt32)kMouseButtonUp; state < kMouseButtonStateMax; state++) { + for (uint16_t state = (UInt32)kMouseButtonUp; state < kMouseButtonStateMax; state++) { CGEventType curEvent = source[button][state]; new_map[state] = curEvent; } @@ -1073,7 +1073,7 @@ bool OSXScreen::onMouseMove(CGFloat mx, CGFloat my) return true; } -bool OSXScreen::onMouseButton(bool pressed, UInt16 macButton) +bool OSXScreen::onMouseButton(bool pressed, uint16_t macButton) { // Buttons 2 and 3 are inverted on the mac ButtonID button = mapMacButtonToDeskflow(macButton); @@ -1312,7 +1312,7 @@ bool OSXScreen::onHotKey(EventRef event) const return true; } -ButtonID OSXScreen::mapDeskflowButtonToMac(UInt16 button) const +ButtonID OSXScreen::mapDeskflowButtonToMac(uint16_t button) const { switch (button) { case 1: @@ -1326,7 +1326,7 @@ ButtonID OSXScreen::mapDeskflowButtonToMac(UInt16 button) const return static_cast(button); } -ButtonID OSXScreen::mapMacButtonToDeskflow(UInt16 macButton) const +ButtonID OSXScreen::mapMacButtonToDeskflow(uint16_t macButton) const { switch (macButton) { case 1: diff --git a/src/lib/platform/OSXUchrKeyResource.cpp b/src/lib/platform/OSXUchrKeyResource.cpp index 56680ae19..22ef38e5e 100644 --- a/src/lib/platform/OSXUchrKeyResource.cpp +++ b/src/lib/platform/OSXUchrKeyResource.cpp @@ -147,14 +147,14 @@ KeyID OSXUchrKeyResource::getKey(UInt32 table, UInt32 button) const return keys.front(); } -bool OSXUchrKeyResource::getDeadKey(KeySequence &keys, UInt16 index) const +bool OSXUchrKeyResource::getDeadKey(KeySequence &keys, uint16_t index) const { if (m_sri == NULL || index >= m_sri->keyStateRecordCount) { // XXX -- should we be using some other fallback? return false; } - UInt16 state = 0; + uint16_t state = 0; if (!getKeyRecord(keys, index, state)) { return false; } @@ -188,13 +188,13 @@ bool OSXUchrKeyResource::getDeadKey(KeySequence &keys, UInt16 index) const return true; } -bool OSXUchrKeyResource::getKeyRecord(KeySequence &keys, UInt16 index, UInt16 &state) const +bool OSXUchrKeyResource::getKeyRecord(KeySequence &keys, uint16_t index, uint16_t &state) const { const uint8_t *const base = reinterpret_cast(m_resource); const UCKeyStateRecord *sr = reinterpret_cast(base + m_sri->keyStateRecordOffsets[index]); const UCKeyStateEntryTerminal *kset = reinterpret_cast(sr->stateEntryData); - UInt16 nextState = 0; + uint16_t nextState = 0; bool found = false; if (state == 0) { found = true; @@ -206,7 +206,7 @@ bool OSXUchrKeyResource::getKeyRecord(KeySequence &keys, UInt16 index, UInt16 &s // we have a next entry switch (sr->stateEntryFormat) { case kUCKeyStateEntryTerminalFormat: - for (UInt16 j = 0; j < sr->stateEntryCount; ++j) { + for (uint16_t j = 0; j < sr->stateEntryCount; ++j) { if (kset[j].curState == state) { if (!addSequence(keys, kset[j].charData)) { return false; @@ -249,7 +249,7 @@ bool OSXUchrKeyResource::getKeyRecord(KeySequence &keys, UInt16 index, UInt16 &s bool OSXUchrKeyResource::addSequence(KeySequence &keys, UCKeyCharSeq c) const { if ((c & kUCKeyOutputTestForIndexMask) == kUCKeyOutputSequenceIndexMask) { - UInt16 index = (c & kUCKeyOutputGetIndexMask); + uint16_t index = (c & kUCKeyOutputGetIndexMask); if (index < m_sdi->charSequenceCount && m_sdi->charSequenceOffsets[index] != m_sdi->charSequenceOffsets[index + 1]) { // XXX -- sequences not supported yet diff --git a/src/lib/platform/OSXUchrKeyResource.h b/src/lib/platform/OSXUchrKeyResource.h index 45bff2cb4..c5888a3df 100644 --- a/src/lib/platform/OSXUchrKeyResource.h +++ b/src/lib/platform/OSXUchrKeyResource.h @@ -40,8 +40,8 @@ public: private: using KeySequence = std::vector; - bool getDeadKey(KeySequence &keys, UInt16 index) const; - bool getKeyRecord(KeySequence &keys, UInt16 index, UInt16 &state) const; + bool getDeadKey(KeySequence &keys, uint16_t index) const; + bool getKeyRecord(KeySequence &keys, uint16_t index, uint16_t &state) const; bool addSequence(KeySequence &keys, UCKeyCharSeq c) const; private: @@ -51,5 +51,5 @@ private: const UCKeySequenceDataIndex *m_sdi; const UCKeyStateRecordsIndex *m_sri; const UCKeyStateTerminators *m_st; - UInt16 m_spaceOutput; + uint16_t m_spaceOutput; }; diff --git a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp index 181f9d66b..ac9c3d77e 100644 --- a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp +++ b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp @@ -25,8 +25,8 @@ public: UInt32 biSize; SInt32 biWidth; SInt32 biHeight; - UInt16 biPlanes; - UInt16 biBitCount; + uint16_t biPlanes; + uint16_t biBitCount; UInt32 biCompression; UInt32 biSizeImage; SInt32 biXPelsPerMeter; @@ -37,7 +37,7 @@ public: // BMP is little-endian -static void toLE(uint8_t *&dst, UInt16 src) +static void toLE(uint8_t *&dst, uint16_t src) { dst[0] = static_cast(src & 0xffu); dst[1] = static_cast((src >> 8) & 0xffu); @@ -62,9 +62,9 @@ static void toLE(uint8_t *&dst, UInt32 src) dst += 4; } -static inline UInt16 fromLEU16(const uint8_t *data) +static inline uint16_t fromLEU16(const uint8_t *data) { - return static_cast(data[0]) | (static_cast(data[1]) << 8); + return static_cast(data[0]) | (static_cast(data[1]) << 8); } static inline SInt32 fromLES32(const uint8_t *data) @@ -152,8 +152,8 @@ std::string XWindowsClipboardAnyBitmapConverter::toIClipboard(const std::string toLE(dst, static_cast(40)); toLE(dst, static_cast(w)); toLE(dst, static_cast(h)); - toLE(dst, static_cast(1)); - toLE(dst, static_cast(depth)); + toLE(dst, static_cast(1)); + toLE(dst, static_cast(depth)); toLE(dst, static_cast(0)); // BI_RGB toLE(dst, static_cast(image.size())); toLE(dst, static_cast(2834)); // 72 dpi diff --git a/src/lib/platform/XWindowsClipboardBMPConverter.cpp b/src/lib/platform/XWindowsClipboardBMPConverter.cpp index 278bfd927..5bf8e99bf 100644 --- a/src/lib/platform/XWindowsClipboardBMPConverter.cpp +++ b/src/lib/platform/XWindowsClipboardBMPConverter.cpp @@ -22,10 +22,10 @@ struct CBMPHeader { public: - UInt16 type; + uint16_t type; UInt32 size; - UInt16 reserved1; - UInt16 reserved2; + uint16_t reserved1; + uint16_t reserved2; UInt32 offset; }; @@ -42,7 +42,7 @@ static void toLE(uint8_t *&dst, char src) dst += 1; } -static void toLE(uint8_t *&dst, UInt16 src) +static void toLE(uint8_t *&dst, uint16_t src) { dst[0] = static_cast(src & 0xffu); dst[1] = static_cast((src >> 8) & 0xffu); @@ -96,8 +96,8 @@ std::string XWindowsClipboardBMPConverter::fromIClipboard(const std::string &bmp toLE(dst, 'B'); toLE(dst, 'M'); toLE(dst, static_cast(14 + bmp.size())); - toLE(dst, static_cast(0)); - toLE(dst, static_cast(0)); + toLE(dst, static_cast(0)); + toLE(dst, static_cast(0)); toLE(dst, static_cast(14 + 40)); return std::string(reinterpret_cast(header), 14) + bmp; } diff --git a/src/test/integtests/net/NetworkTests.cpp b/src/test/integtests/net/NetworkTests.cpp index 00d0a2e38..6ffd89ff4 100644 --- a/src/test/integtests/net/NetworkTests.cpp +++ b/src/test/integtests/net/NetworkTests.cpp @@ -55,7 +55,7 @@ using ::testing::Return; #define TEST_HOST "localhost" const size_t kMockDataSize = 1024 * 1024 * 10; // 10MB -const UInt16 kMockDataChunkIncrement = 1024; // 1KB +const uint16_t kMockDataChunkIncrement = 1024; // 1KB const char *kMockFilename = "tmp/test/NetworkTests.mock"; const size_t kMockFileSize = 1024 * 1024 * 10; // 10MB diff --git a/src/test/unittests/deskflow/ProtocolUtilTests.cpp b/src/test/unittests/deskflow/ProtocolUtilTests.cpp index e826f527a..60a7cf62a 100644 --- a/src/test/unittests/deskflow/ProtocolUtilTests.cpp +++ b/src/test/unittests/deskflow/ProtocolUtilTests.cpp @@ -44,7 +44,7 @@ MATCHER_P(EqVoidPointeeInt8, expected, "") MATCHER_P(EqVoidPointeeInt16, expected, "") { - const UInt16 Actual16 = (*static_cast(arg)); + const uint16_t Actual16 = (*static_cast(arg)); return (expected == (Actual16 >> 8)); } @@ -77,7 +77,7 @@ MATCHER_P(EqVoidVectorInt1byte, expected, "") MATCHER_P(EqVoidVectorInt2bytes, expected, "") { bool Result = true; - const UInt16 *Actual = (static_cast(arg)) + 2; + const uint16_t *Actual = (static_cast(arg)) + 2; const size_t Size = *(Actual - 1) >> 8; if (Size == expected.size()) { @@ -139,7 +139,7 @@ class ProtocolUtilTests : public ::testing::Test public: MockStream stream; uint8_t ActualInt8 = 0; - UInt16 ActualInt16 = 0; + uint16_t ActualInt16 = 0; UInt32 ActualInt32 = 0; std::string ActualString; }; @@ -253,11 +253,11 @@ class ReadfIntVectorTestFixture : public ReadfIntTestFixture {}; TEST_P(ReadfIntVectorTestFixture, readf_int_vector) { std::vector Actual1Byte = {}; - std::vector Actual2Bytes = {}; + std::vector Actual2Bytes = {}; std::vector Actual4Bytes = {}; const std::vector Expected1Byte = {10, 10}; - const std::vector Expected2Bytes = {10, 10}; + const std::vector Expected2Bytes = {10, 10}; const std::vector Expected4Bytes = {10, 10}; std::array StreamVectorSize{{0, 0, 0, 2}}; @@ -298,7 +298,7 @@ INSTANTIATE_TEST_SUITE_P(ReadfIntVectorTests, ReadfIntVectorTestFixture, class ReadfIntAndStringTest : public ReadfIntTestFixture { public: uint8_t ActualInt8 = 0; - UInt16 ActualInt16 = 0; + uint16_t ActualInt16 = 0; UInt32 ActualInt32 = 32; std::string ActualString; }; @@ -436,7 +436,7 @@ class WriteIntTest public: MockStream stream; uint8_t Expected1Byte = 5; - UInt16 Expected2Bytes = 10; + uint16_t Expected2Bytes = 10; UInt32 Expected4Bytes = 15; }; @@ -471,7 +471,7 @@ class WriteIntVectorTest public: MockStream stream; const std::vector Expected1Byte = {10, 20, 30}; - const std::vector Expected2Byte = {40, 50, 60}; + const std::vector Expected2Byte = {40, 50, 60}; const std::vector Expected4Byte = {70, 80, 90}; };