diff options
author | David Robillard <d@drobilla.net> | 2020-03-13 13:05:47 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-03-13 13:05:47 +0100 |
commit | e09f204aca2393ba0f78867eb2e284ab00091205 (patch) | |
tree | f7227b5541eaaa735835e749e2a4c51d2054e70c /pugl | |
parent | 5c02f37c8d1dd74f3b72f1fb0b2a77f4d1dc2da9 (diff) | |
download | pugl-e09f204aca2393ba0f78867eb2e284ab00091205.tar.gz pugl-e09f204aca2393ba0f78867eb2e284ab00091205.tar.bz2 pugl-e09f204aca2393ba0f78867eb2e284ab00091205.zip |
Strengthen warnings
Diffstat (limited to 'pugl')
-rw-r--r-- | pugl/detail/implementation.c | 14 | ||||
-rw-r--r-- | pugl/detail/x11.c | 8 |
2 files changed, 12 insertions, 10 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index 6433faa..7764bbd 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -290,22 +290,24 @@ puglDecodeUTF8(const uint8_t* buf) return 0xFFFD; } else if (buf[0] < 0xE0) { FAIL_IF((buf[1] & 0xC0u) != 0x80); - return (buf[0] << 6u) + buf[1] - 0x3080u; + return ((uint32_t)buf[0] << 6u) + buf[1] - 0x3080u; } else if (buf[0] < 0xF0) { FAIL_IF((buf[1] & 0xC0u) != 0x80); FAIL_IF(buf[0] == 0xE0 && buf[1] < 0xA0); FAIL_IF((buf[2] & 0xC0u) != 0x80); - return (buf[0] << 12u) + (buf[1] << 6u) + buf[2] - 0xE2080u; + return ((uint32_t)buf[0] << 12u) + // + ((uint32_t)buf[1] << 6u) + // + ((uint32_t)buf[2] - 0xE2080u); } else if (buf[0] < 0xF5) { FAIL_IF((buf[1] & 0xC0u) != 0x80); FAIL_IF(buf[0] == 0xF0 && buf[1] < 0x90); FAIL_IF(buf[0] == 0xF4 && buf[1] >= 0x90); FAIL_IF((buf[2] & 0xC0u) != 0x80u); FAIL_IF((buf[3] & 0xC0u) != 0x80u); - return ((buf[0] << 18u) + // - (buf[1] << 12u) + // - (buf[2] << 6u) + // - (buf[3] - 0x3C82080u)); + return (((uint32_t)buf[0] << 18u) + // + ((uint32_t)buf[1] << 12u) + // + ((uint32_t)buf[2] << 6u) + // + ((uint32_t)buf[3] - 0x3C82080u)); } return 0xFFFD; } diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index ae00f73..25693a2 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -432,8 +432,8 @@ translateEvent(PuglView* view, XEvent xevent) } } else if (xevent.xclient.message_type == atoms->PUGL_CLIENT_MSG) { event.type = PUGL_CLIENT; - event.client.data1 = xevent.xclient.data.l[0]; - event.client.data2 = xevent.xclient.data.l[1]; + event.client.data1 = (uintptr_t)xevent.xclient.data.l[0]; + event.client.data2 = (uintptr_t)xevent.xclient.data.l[1]; } break; case VisibilityNotify: @@ -626,8 +626,8 @@ puglEventToX(PuglView* view, const PuglEvent* event) xev.xclient.window = view->impl->win; xev.xclient.message_type = view->world->impl->atoms.PUGL_CLIENT_MSG; xev.xclient.format = 32; - xev.xclient.data.l[0] = event->client.data1; - xev.xclient.data.l[1] = event->client.data2; + xev.xclient.data.l[0] = (long)event->client.data1; + xev.xclient.data.l[1] = (long)event->client.data2; break; default: |