diff --git a/src/lib/platform/OSXUchrKeyResource.cpp b/src/lib/platform/OSXUchrKeyResource.cpp index b3f785b8..603ba04a 100644 --- a/src/lib/platform/OSXUchrKeyResource.cpp +++ b/src/lib/platform/OSXUchrKeyResource.cpp @@ -56,19 +56,19 @@ OSXUchrKeyResource::OSXUchrKeyResource(const void* resource, } // get tables for keyboard type - const UInt8* base = static_cast(m_resource); - m_m = static_cast(base + + const UInt8* const base = reinterpret_cast(m_resource); + m_m = reinterpret_cast(base + th->keyModifiersToTableNumOffset); - m_cti = static_cast(base + + m_cti = reinterpret_cast(base + th->keyToCharTableIndexOffset); - m_sdi = static_cast(base + + m_sdi = reinterpret_cast(base + th->keySequenceDataIndexOffset); if (th->keyStateRecordsIndexOffset != 0) { - m_sri = static_cast(base + + m_sri = reinterpret_cast(base + th->keyStateRecordsIndexOffset); } if (th->keyStateTerminatorsOffset != 0) { - m_st = static_cast(base + + m_st = reinterpret_cast(base + th->keyStateTerminatorsOffset); } @@ -81,7 +81,7 @@ OSXUchrKeyResource::OSXUchrKeyResource(const void* resource, KeyID id = getKey(table, button); if (id == 0x20) { UCKeyOutput c = - static_cast(base + + reinterpret_cast(base + m_cti->keyToCharTableOffsets[table])[button]; if ((c & kUCKeyOutputTestForIndexMask) == kUCKeyOutputStateIndexMask) { @@ -134,8 +134,8 @@ OSXUchrKeyResource::getKey(UInt32 table, UInt32 button) const assert(table < getNumTables()); assert(button < getNumButtons()); - const UInt8* base = static_cast(m_resource); - const UCKeyOutput* cPtr = static_cast(base + + const UInt8* const base = reinterpret_cast(m_resource); + const UCKeyOutput* cPtr = reinterpret_cast(base + m_cti->keyToCharTableOffsets[table]); const UCKeyOutput c = cPtr[button]; @@ -211,12 +211,12 @@ bool OSXUchrKeyResource::getKeyRecord( KeySequence& keys, UInt16 index, UInt16& state) const { - const UInt8* base = static_cast(m_resource); + const UInt8* const base = reinterpret_cast(m_resource); const UCKeyStateRecord* sr = - static_cast(base + + reinterpret_cast(base + m_sri->keyStateRecordOffsets[index]); const UCKeyStateEntryTerminal* kset = - static_cast(sr->stateEntryData); + reinterpret_cast(sr->stateEntryData); UInt16 nextState = 0; bool found = false;