diff options
-rw-r--r-- | examples/.clang-tidy | 2 | ||||
-rw-r--r-- | examples/pugl_shader_demo.c | 4 | ||||
-rw-r--r-- | examples/pugl_vulkan_demo.c | 8 | ||||
-rw-r--r-- | examples/sybok.hpp | 20 | ||||
-rw-r--r-- | src/.clang-tidy | 2 | ||||
-rw-r--r-- | src/implementation.c | 17 | ||||
-rw-r--r-- | src/x11.c | 8 |
7 files changed, 42 insertions, 19 deletions
diff --git a/examples/.clang-tidy b/examples/.clang-tidy index 3410f19..fdfa4ea 100644 --- a/examples/.clang-tidy +++ b/examples/.clang-tidy @@ -30,12 +30,10 @@ Checks: > -hicpp-no-array-decay, -hicpp-signed-bitwise, -hicpp-vararg, - -llvm-else-after-return, -llvm-header-guard, -llvmlibc-*, -misc-misplaced-const, -modernize-use-trailing-return-type, - -readability-else-after-return, -readability-implicit-bool-conversion, -readability-named-parameter, FormatStyle: file diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c index d038b3f..087afc5 100644 --- a/examples/pugl_shader_demo.c +++ b/examples/pugl_shader_demo.c @@ -249,7 +249,9 @@ parseOptions(PuglTestApp* app, int argc, char** argv) if (endptr != argv[1] + strlen(argv[1])) { logError("Invalid GL major version: %s\n", argv[1]); return 1; - } else if (app->glMajorVersion == 4) { + } + + if (app->glMajorVersion == 4) { app->glMinorVersion = 2; } else if (app->glMajorVersion != 3) { logError("Unsupported GL major version %d\n", app->glMajorVersion); diff --git a/examples/pugl_vulkan_demo.c b/examples/pugl_vulkan_demo.c index 3af6d19..0dfbadd 100644 --- a/examples/pugl_vulkan_demo.c +++ b/examples/pugl_vulkan_demo.c @@ -312,7 +312,9 @@ getGraphicsQueueIndex(VkSurfaceKHR surface, device, q, surface, &supported))) { free(props); return r; - } else if (supported) { + } + + if (supported) { *graphicsIndex = q; free(props); return VK_SUCCESS; @@ -1059,7 +1061,9 @@ main(int argc, char** argv) // Create world and view if (!(app.world = puglNewWorld(PUGL_PROGRAM, PUGL_WORLD_THREADS))) { return logError("Failed to create world\n"); - } else if (!(app.view = puglNewView(app.world))) { + } + + if (!(app.view = puglNewView(app.world))) { puglFreeWorld(app.world); return logError("Failed to create Pugl World and View\n"); } diff --git a/examples/sybok.hpp b/examples/sybok.hpp index ed82afb..7740824 100644 --- a/examples/sybok.hpp +++ b/examples/sybok.hpp @@ -782,7 +782,9 @@ public: VkInstance h = {}; if (const VkResult r = vkCreateInstance(&createInfo, nullptr, &h)) { return r; - } else if (!h) { + } + + if (!h) { // Shouldn't actually happen, but this lets the compiler know that return VK_ERROR_INITIALIZATION_FAILED; } @@ -1392,7 +1394,9 @@ public: VkDeviceMemory h = {}; if (const VkResult r = vkAllocateMemory(device, &info, nullptr, &h)) { return r; - } else if (!h) { + } + + if (!h) { return VK_ERROR_OUT_OF_DEVICE_MEMORY; } @@ -1484,7 +1488,9 @@ public: if (const VkResult r = vkCreateDebugReportCallbackEXT(instance, &createInfo, nullptr, &h)) { return r; - } else if (!h) { + } + + if (!h) { return VK_ERROR_FEATURE_NOT_PRESENT; } @@ -1577,7 +1583,9 @@ public: if (r) { return r; - } else if (!h) { + } + + if (!h) { return VK_ERROR_INCOMPATIBLE_DRIVER; } @@ -1763,7 +1771,9 @@ private: { if (r) { return r; - } else if (!handle) { + } + + if (!handle) { return VK_ERROR_INITIALIZATION_FAILED; } diff --git a/src/.clang-tidy b/src/.clang-tidy index 808cbb1..11b620e 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -11,9 +11,7 @@ Checks: > -clang-diagnostic-unused-macros, -hicpp-multiway-paths-covered, -hicpp-signed-bitwise, - -llvm-else-after-return, -llvm-header-guard, -llvmlibc-*, - -readability-else-after-return, FormatStyle: file HeaderFilterRegex: 'pugl/.*' diff --git a/src/implementation.c b/src/implementation.c index a6d8393..79ac5d6 100644 --- a/src/implementation.c +++ b/src/implementation.c @@ -320,19 +320,27 @@ puglDecodeUTF8(const uint8_t* buf) if (buf[0] < 0x80) { return buf[0]; - } else if (buf[0] < 0xC2) { + } + + if (buf[0] < 0xC2) { return 0xFFFD; - } else if (buf[0] < 0xE0) { + } + + if (buf[0] < 0xE0) { FAIL_IF((buf[1] & 0xC0u) != 0x80); return ((uint32_t)buf[0] << 6u) + buf[1] - 0x3080u; - } else if (buf[0] < 0xF0) { + } + + 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 ((uint32_t)buf[0] << 12u) + // ((uint32_t)buf[1] << 6u) + // ((uint32_t)buf[2] - 0xE2080u); - } else if (buf[0] < 0xF5) { + } + + 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); @@ -343,6 +351,7 @@ puglDecodeUTF8(const uint8_t* buf) ((uint32_t)buf[2] << 6u) + // ((uint32_t)buf[3] - 0x3C82080u)); } + return 0xFFFD; } @@ -278,7 +278,9 @@ puglRealize(PuglView* view) // Ensure that we're unrealized and that a reasonable backend has been set if (impl->win) { return PUGL_FAILURE; - } else if (!view->backend || !view->backend->configure) { + } + + if (!view->backend || !view->backend->configure) { return PUGL_BAD_BACKEND; } @@ -902,9 +904,9 @@ puglSendEvent(PuglView* view, const PuglEvent* event) if (xev.type) { if (XSendEvent(view->impl->display, view->impl->win, False, 0, &xev)) { return PUGL_SUCCESS; - } else { - return PUGL_UNKNOWN_ERROR; } + + return PUGL_UNKNOWN_ERROR; } return PUGL_UNSUPPORTED_TYPE; |