diff options
author | David Robillard <d@drobilla.net> | 2022-10-07 15:19:39 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-10-07 15:22:43 -0400 |
commit | 17d90bda87dd445a974de7e644629593ade617d8 (patch) | |
tree | 319a23c713a4d089863d9c169d63a1d2d413521c /src | |
parent | ed4c8a50505ab02a8f3a01e41f5f86acca04b81d (diff) | |
download | pugl-17d90bda87dd445a974de7e644629593ade617d8.tar.gz pugl-17d90bda87dd445a974de7e644629593ade617d8.tar.bz2 pugl-17d90bda87dd445a974de7e644629593ade617d8.zip |
Use uppercase integer literal suffixes
Diffstat (limited to 'src')
-rw-r--r-- | src/internal.c | 28 | ||||
-rw-r--r-- | src/mac.m | 4 | ||||
-rw-r--r-- | src/mac_gl.m | 4 | ||||
-rw-r--r-- | src/win.c | 34 | ||||
-rw-r--r-- | src/win_gl.c | 2 | ||||
-rw-r--r-- | src/x11.c | 20 |
6 files changed, 46 insertions, 46 deletions
diff --git a/src/internal.c b/src/internal.c index 69f220e..dd1b7f1 100644 --- a/src/internal.c +++ b/src/internal.c @@ -67,29 +67,29 @@ puglDecodeUTF8(const uint8_t* buf) } if (buf[0] < 0xE0) { - FAIL_IF((buf[1] & 0xC0u) != 0x80); - return ((uint32_t)buf[0] << 6u) + buf[1] - 0x3080u; + FAIL_IF((buf[1] & 0xC0U) != 0x80); + return ((uint32_t)buf[0] << 6U) + buf[1] - 0x3080U; } if (buf[0] < 0xF0) { - FAIL_IF((buf[1] & 0xC0u) != 0x80); + FAIL_IF((buf[1] & 0xC0U) != 0x80); FAIL_IF(buf[0] == 0xE0 && buf[1] < 0xA0); - FAIL_IF((buf[2] & 0xC0u) != 0x80); - return ((uint32_t)buf[0] << 12u) + // - ((uint32_t)buf[1] << 6u) + // - ((uint32_t)buf[2] - 0xE2080u); + FAIL_IF((buf[2] & 0xC0U) != 0x80); + return ((uint32_t)buf[0] << 12U) + // + ((uint32_t)buf[1] << 6U) + // + ((uint32_t)buf[2] - 0xE2080U); } if (buf[0] < 0xF5) { - FAIL_IF((buf[1] & 0xC0u) != 0x80); + 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 (((uint32_t)buf[0] << 18u) + // - ((uint32_t)buf[1] << 12u) + // - ((uint32_t)buf[2] << 6u) + // - ((uint32_t)buf[3] - 0x3C82080u)); + FAIL_IF((buf[2] & 0xC0U) != 0x80U); + FAIL_IF((buf[3] & 0xC0U) != 0x80U); + return (((uint32_t)buf[0] << 18U) + // + ((uint32_t)buf[1] << 12U) + // + ((uint32_t)buf[2] << 6U) + // + ((uint32_t)buf[3] - 0x3C82080U)); } return 0xFFFD; @@ -999,7 +999,7 @@ updateSizeHint(PuglView* const view, const PuglSizeHint hint) static void updateSizeHints(PuglView* const view) { - for (unsigned i = 0u; i < PUGL_NUM_SIZE_HINTS; ++i) { + for (unsigned i = 0U; i < PUGL_NUM_SIZE_HINTS; ++i) { updateSizeHint(view, (PuglSizeHint)i); } } @@ -1633,7 +1633,7 @@ puglAcceptOffer(PuglView* const view, wrapper->dragTypeIndex = typeIndex; const PuglDataEvent data = { - PUGL_DATA, 0u, mach_absolute_time() / 1e9, (uint32_t)typeIndex}; + PUGL_DATA, 0U, mach_absolute_time() / 1e9, (uint32_t)typeIndex}; PuglEvent dataEvent; dataEvent.data = data; diff --git a/src/mac_gl.m b/src/mac_gl.m index ddd9fde..53daf97 100644 --- a/src/mac_gl.m +++ b/src/mac_gl.m @@ -60,8 +60,8 @@ NSOpenGLPFAColorSize, colorSize, NSOpenGLPFADepthSize, (unsigned)puglview->hints[PUGL_DEPTH_BITS], NSOpenGLPFAStencilSize, (unsigned)puglview->hints[PUGL_STENCIL_BITS], - NSOpenGLPFAMultisample, samples ? 1u : 0u, - NSOpenGLPFASampleBuffers, samples ? 1u : 0u, + NSOpenGLPFAMultisample, samples ? 1U : 0U, + NSOpenGLPFASampleBuffers, samples ? 1U : 0U, NSOpenGLPFASamples, samples, 0}; // clang-format on @@ -101,7 +101,7 @@ static unsigned puglWinGetWindowFlags(const PuglView* const view) { const bool resizable = !!view->hints[PUGL_RESIZABLE]; - const unsigned sizeFlags = resizable ? (WS_SIZEBOX | WS_MAXIMIZEBOX) : 0u; + const unsigned sizeFlags = resizable ? (WS_SIZEBOX | WS_MAXIMIZEBOX) : 0U; return (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | (view->parent @@ -112,7 +112,7 @@ puglWinGetWindowFlags(const PuglView* const view) static unsigned puglWinGetWindowExFlags(const PuglView* const view) { - return WS_EX_NOINHERITLAYOUT | (view->parent ? 0u : WS_EX_APPWINDOW); + return WS_EX_NOINHERITLAYOUT | (view->parent ? 0U : WS_EX_APPWINDOW); } static double @@ -358,11 +358,11 @@ static uint32_t getModifiers(void) { // clang-format off - return (((GetKeyState(VK_SHIFT) < 0) ? PUGL_MOD_SHIFT : 0u) | - ((GetKeyState(VK_CONTROL) < 0) ? PUGL_MOD_CTRL : 0u) | - ((GetKeyState(VK_MENU) < 0) ? PUGL_MOD_ALT : 0u) | - ((GetKeyState(VK_LWIN) < 0) ? PUGL_MOD_SUPER : 0u) | - ((GetKeyState(VK_RWIN) < 0) ? PUGL_MOD_SUPER : 0u)); + return (((GetKeyState(VK_SHIFT) < 0) ? PUGL_MOD_SHIFT : 0U) | + ((GetKeyState(VK_CONTROL) < 0) ? PUGL_MOD_CTRL : 0U) | + ((GetKeyState(VK_MENU) < 0) ? PUGL_MOD_ALT : 0U) | + ((GetKeyState(VK_LWIN) < 0) ? PUGL_MOD_SUPER : 0U) | + ((GetKeyState(VK_RWIN) < 0) ? PUGL_MOD_SUPER : 0U)); // clang-format on } @@ -415,13 +415,13 @@ puglDecodeUTF16(const wchar_t* buf, const int len) { const uint32_t c0 = buf[0]; const uint32_t c1 = buf[0]; - if (c0 >= 0xD800u && c0 < 0xDC00u) { + if (c0 >= 0xD800U && c0 < 0xDC00U) { if (len < 2) { return 0xFFFD; // Surrogate, but length is only 1 } - if (c1 >= 0xDC00u && c1 <= 0xDFFFu) { - return ((c0 & 0x03FFu) << 10u) + (c1 & 0x03FFu) + 0x10000u; + if (c1 >= 0xDC00U && c1 <= 0xDFFFU) { + return ((c0 & 0x03FFU) << 10U) + (c1 & 0x03FFU) + 0x10000U; } return 0xFFFD; // Unpaired surrogates @@ -450,7 +450,7 @@ initKeyEvent(PuglKeyEvent* event, const unsigned vcode = MapVirtualKey(vkey, MAPVK_VK_TO_VSC); const unsigned kchar = MapVirtualKey(vkey, MAPVK_VK_TO_CHAR); - const bool dead = kchar >> (sizeof(UINT) * 8u - 1u) & 1u; + const bool dead = kchar >> (sizeof(UINT) * 8U - 1U) & 1U; const bool ext = lParam & 0x01000000; event->type = press ? PUGL_KEY_PRESS : PUGL_KEY_RELEASE; @@ -466,7 +466,7 @@ initKeyEvent(PuglKeyEvent* event, const PuglKey special = keySymToSpecial(vkey); if (special) { if (ext && (special == PUGL_KEY_CTRL || special == PUGL_KEY_ALT)) { - event->key = (uint32_t)special + 1u; // Right hand key + event->key = (uint32_t)special + 1U; // Right hand key } else { event->key = (uint32_t)special; } @@ -483,8 +483,8 @@ initKeyEvent(PuglKeyEvent* event, static void initCharEvent(PuglEvent* event, PuglView* view, WPARAM wParam, LPARAM lParam) { - const wchar_t utf16[2] = {(wchar_t)(wParam & 0xFFFFu), - (wchar_t)((wParam >> 16u) & 0xFFFFu)}; + const wchar_t utf16[2] = {(wchar_t)(wParam & 0xFFFFU), + (wchar_t)((wParam >> 16U) & 0xFFFFU)}; initKeyEvent(&event->key, view, true, wParam, lParam); event->type = PUGL_TEXT; @@ -1157,7 +1157,7 @@ puglSetTransientParent(PuglView* view, PuglNativeView parent) uint32_t puglGetNumClipboardTypes(const PuglView* const PUGL_UNUSED(view)) { - return IsClipboardFormatAvailable(CF_UNICODETEXT) ? 1u : 0u; + return IsClipboardFormatAvailable(CF_UNICODETEXT) ? 1U : 0U; } const char* @@ -1198,7 +1198,7 @@ puglGetClipboard(PuglView* const view, { PuglInternals* const impl = view->impl; - if (typeIndex > 0u || !IsClipboardFormatAvailable(CF_UNICODETEXT) || + if (typeIndex > 0U || !IsClipboardFormatAvailable(CF_UNICODETEXT) || !OpenClipboard(impl->hwnd)) { return NULL; } @@ -1327,7 +1327,7 @@ puglWinGetPixelFormatDescriptor(const PuglHints hints) hints[PUGL_GREEN_BITS] + // hints[PUGL_BLUE_BITS]); - const DWORD dwFlags = hints[PUGL_DOUBLE_BUFFER] ? PFD_DOUBLEBUFFER : 0u; + const DWORD dwFlags = hints[PUGL_DOUBLE_BUFFER] ? PFD_DOUBLEBUFFER : 0U; PuglWinPFD pfd; ZeroMemory(&pfd, sizeof(pfd)); diff --git a/src/win_gl.c b/src/win_gl.c index a755020..44795f5 100644 --- a/src/win_gl.c +++ b/src/win_gl.c @@ -164,7 +164,7 @@ puglWinGlConfigure(PuglView* view) // Choose pixel format based on attributes UINT numFormats = 0; if (!surface->procs.wglChoosePixelFormat( - fakeWin.hdc, pixelAttrs, NULL, 1u, &impl->pfId, &numFormats)) { + fakeWin.hdc, pixelAttrs, NULL, 1U, &impl->pfId, &numFormats)) { return puglWinError(&fakeWin, PUGL_SET_FORMAT_FAILED); } @@ -66,7 +66,7 @@ enum WmClientStateMessageAction { WM_STATE_TOGGLE }; -#define NUM_CURSORS ((unsigned)PUGL_CURSOR_UP_DOWN + 1u) +#define NUM_CURSORS ((unsigned)PUGL_CURSOR_UP_DOWN + 1U) #ifdef HAVE_XCURSOR static const char* const cursor_names[NUM_CURSORS] = { @@ -118,7 +118,7 @@ puglX11GetDisplayScaleFactor(Display* const display) if (rms) { XrmDatabase db = XrmGetStringDatabase(rms); if (db) { - XrmValue value = {0u, NULL}; + XrmValue value = {0U, NULL}; char* type = NULL; if (XrmGetResource(db, "Xft.dpi", "Xft.Dpi", &type, &value)) { if (!type || !strcmp(type, "String")) { @@ -652,10 +652,10 @@ translateKey(PuglView* const view, XEvent* const xevent, PuglEvent* const event) static uint32_t translateModifiers(const unsigned xstate) { - return (((xstate & ShiftMask) ? PUGL_MOD_SHIFT : 0u) | - ((xstate & ControlMask) ? PUGL_MOD_CTRL : 0u) | - ((xstate & Mod1Mask) ? PUGL_MOD_ALT : 0u) | - ((xstate & Mod4Mask) ? PUGL_MOD_SUPER : 0u)); + return (((xstate & ShiftMask) ? PUGL_MOD_SHIFT : 0U) | + ((xstate & ControlMask) ? PUGL_MOD_CTRL : 0U) | + ((xstate & Mod1Mask) ? PUGL_MOD_ALT : 0U) | + ((xstate & Mod4Mask) ? PUGL_MOD_SUPER : 0U)); } static PuglStatus @@ -1172,10 +1172,10 @@ retrieveSelection(const PuglWorld* const world, PuglBlob* const result) { uint8_t* value = NULL; - Atom actualType = 0u; + Atom actualType = 0U; int actualFormat = 0; - unsigned long actualNumItems = 0u; - unsigned long bytesAfter = 0u; + unsigned long actualNumItems = 0U; + unsigned long bytesAfter = 0U; if (XGetWindowProperty(world->impl->display, view->impl->win, @@ -1239,7 +1239,7 @@ handleSelectionNotify(const PuglWorld* const world, board->source = XGetSelectionOwner(display, board->selection); const PuglDataEvent data = { - PUGL_DATA, 0u, (double)event->time / 1e3, board->acceptedFormatIndex}; + PUGL_DATA, 0U, (double)event->time / 1e3, board->acceptedFormatIndex}; puglEvent.data = data; } |