aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy6
-rw-r--r--.gitlab-ci.yml9
-rw-r--r--bindings/cpp/include/.clang-tidy1
-rw-r--r--examples/pugl_cpp_demo.cpp2
-rw-r--r--examples/pugl_embed_demo.c12
-rw-r--r--examples/pugl_shader_demo.c4
-rw-r--r--examples/pugl_vulkan_cpp_demo.cpp58
-rw-r--r--examples/pugl_window_demo.c14
-rw-r--r--examples/sybok.hpp14
-rw-r--r--include/pugl/pugl.h16
-rw-r--r--src/internal.c28
-rw-r--r--src/mac.m4
-rw-r--r--src/mac_gl.m4
-rw-r--r--src/win.c34
-rw-r--r--src/win_gl.c2
-rw-r--r--src/x11.c20
-rw-r--r--test/test_clipboard.c2
-rw-r--r--test/test_local_copy_paste.c2
-rw-r--r--test/test_remote_copy_paste.c4
-rw-r--r--test/test_show_hide.c2
-rw-r--r--test/test_size.c2
-rw-r--r--test/test_timer.c2
22 files changed, 127 insertions, 115 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 0a4ae44..dacb9df 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,11 +1,15 @@
Checks: >
*,
-*-magic-numbers,
- -*-uppercase-literal-suffix,
-altera*,
-clang-diagnostic-unused-function,
-clang-diagnostic-unused-macros,
-llvmlibc-*,
-readability-identifier-length,
+CheckOptions:
+ - key: hicpp-uppercase-literal-suffix.NewSuffixes
+ value: L;U;f
+ - key: readability-uppercase-literal-suffix.NewSuffixes
+ value: L;U;f
FormatStyle: file
HeaderFilterRegex: 'pugl/.*'
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6e92e98..b2310dc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -75,6 +75,15 @@ x64_sanitize:
LDFLAGS: "-fno-sanitize-recover=all -fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=unsigned-integer-overflow -fsanitize=implicit-conversion -fsanitize=local-bounds -fsanitize=nullability"
+fedora:
+ image: lv2plugin/fedora-big
+ script:
+ - meson setup build -Dbuildtype=plain -Dstrict=true -Dwerror=true
+ - ninja -C build
+ variables:
+ CFLAGS: -O2 -D_FORTIFY_SOURCE=2
+
+
mingw32_dbg:
<<: *build_definition
image: lv2plugin/debian-mingw32
diff --git a/bindings/cpp/include/.clang-tidy b/bindings/cpp/include/.clang-tidy
index 4da9021..53e1b08 100644
--- a/bindings/cpp/include/.clang-tidy
+++ b/bindings/cpp/include/.clang-tidy
@@ -1,6 +1,5 @@
Checks: >
*,
- -*-uppercase-literal-suffix,
-altera*,
-clang-diagnostic-unused-macros,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
diff --git a/examples/pugl_cpp_demo.cpp b/examples/pugl_cpp_demo.cpp
index 19b8065..6abe45b 100644
--- a/examples/pugl_cpp_demo.cpp
+++ b/examples/pugl_cpp_demo.cpp
@@ -58,7 +58,7 @@ CubeView::onEvent(const pugl::UpdateEvent&) noexcept
// But for testing, use sendEvent() instead:
return sendEvent(pugl::ExposeEvent{
- 0u, PuglCoord{0}, PuglCoord{0}, frame().width, frame().height});
+ 0U, PuglCoord{0}, PuglCoord{0}, frame().width, frame().height});
}
pugl::Status
diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c
index 9f93287..94310a5 100644
--- a/examples/pugl_embed_demo.c
+++ b/examples/pugl_embed_demo.c
@@ -12,8 +12,8 @@
#include <stdbool.h>
#include <stdint.h>
-static const uint8_t borderWidth = 64u;
-static const uintptr_t reverseTimerId = 1u;
+static const uint8_t borderWidth = 64U;
+static const uintptr_t reverseTimerId = 1U;
typedef struct {
PuglWorld* world;
@@ -109,13 +109,13 @@ onKeyPress(PuglView* view, const PuglKeyEvent* event)
app->quit = 1;
} else if (event->state & PUGL_MOD_SHIFT) {
if (event->key == PUGL_KEY_UP) {
- puglSetSize(view, frame.width, frame.height - 10u);
+ puglSetSize(view, frame.width, frame.height - 10U);
} else if (event->key == PUGL_KEY_DOWN) {
- puglSetSize(view, frame.width, frame.height + 10u);
+ puglSetSize(view, frame.width, frame.height + 10U);
} else if (event->key == PUGL_KEY_LEFT) {
- puglSetSize(view, frame.width - 10u, frame.height);
+ puglSetSize(view, frame.width - 10U, frame.height);
} else if (event->key == PUGL_KEY_RIGHT) {
- puglSetSize(view, frame.width + 10u, frame.height);
+ puglSetSize(view, frame.width + 10U, frame.height);
}
} else {
if (event->key == PUGL_KEY_UP) {
diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c
index d018db3..e3a1900 100644
--- a/examples/pugl_shader_demo.c
+++ b/examples/pugl_shader_demo.c
@@ -46,7 +46,7 @@
#endif
static const PuglSpan defaultSpan = 512;
-static const uintptr_t resizeTimerId = 1u;
+static const uintptr_t resizeTimerId = 1U;
typedef struct {
const char* programPath;
@@ -202,7 +202,7 @@ loadShader(const char* const programPath, const char* const name)
const size_t fileSize = (size_t)ftell(file);
fseek(file, 0, SEEK_SET);
- char* source = (char*)calloc(1, fileSize + 1u);
+ char* source = (char*)calloc(1, fileSize + 1U);
if (fread(source, 1, fileSize, file) != fileSize) {
free(source);
diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp
index 7e0bd38..f148743 100644
--- a/examples/pugl_vulkan_cpp_demo.cpp
+++ b/examples/pugl_vulkan_cpp_demo.cpp
@@ -50,7 +50,7 @@
namespace {
-constexpr uintptr_t resizeTimerId = 1u;
+constexpr uintptr_t resizeTimerId = 1U;
struct PhysicalDeviceSelection {
sk::PhysicalDevice physicalDevice;
@@ -295,17 +295,17 @@ openDevice(const sk::VulkanApi& vk,
const VkDeviceQueueCreateInfo queueCreateInfo{
VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
nullptr,
- 0u,
+ 0U,
graphicsFamilyIndex,
- SK_COUNTED(1u, &graphicsQueuePriority),
+ SK_COUNTED(1U, &graphicsQueuePriority),
};
const VkDeviceCreateInfo createInfo{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
nullptr,
- 0u,
- SK_COUNTED(1u, &queueCreateInfo),
- SK_COUNTED(0u, nullptr), // Deprecated
- SK_COUNTED(1u, &swapchainName),
+ 0U,
+ SK_COUNTED(1U, &queueCreateInfo),
+ SK_COUNTED(0U, nullptr), // Deprecated
+ SK_COUNTED(1U, &swapchainName),
nullptr};
return vk.createDevice(physicalDevice, createInfo, device);
@@ -346,7 +346,7 @@ findGraphicsQueue(const sk::VulkanApi& vk,
return r;
}
- for (uint32_t q = 0u; q < queueProps.size(); ++q) {
+ for (uint32_t q = 0U; q < queueProps.size(); ++q) {
if (queueProps[q].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
bool supported = false;
if ((r = vk.getPhysicalDeviceSurfaceSupportKHR(
@@ -385,7 +385,7 @@ selectPhysicalDevice(const sk::VulkanApi& vk,
}
if (supported) {
- auto queueIndex = 0u;
+ auto queueIndex = 0U;
if ((r = findGraphicsQueue(vk, surface, device, queueIndex))) {
return r;
}
@@ -529,8 +529,8 @@ Swapchain::init(const sk::VulkanApi& vk,
extent = surfaceExtent;
const auto minNumImages =
- (!capabilities.maxImageCount || capabilities.maxImageCount >= 3u)
- ? 3u
+ (!capabilities.maxImageCount || capabilities.maxImageCount >= 3U)
+ ? 3U
: capabilities.maxImageCount;
const VkSwapchainCreateInfoKHR swapchainCreateInfo{
@@ -611,7 +611,7 @@ RenderPass::init(const sk::VulkanApi& vk,
VK_PIPELINE_BIND_POINT_GRAPHICS,
SK_COUNTED(0, nullptr),
SK_COUNTED(1, &colorAttachmentRef, nullptr, nullptr),
- SK_COUNTED(0u, nullptr)};
+ SK_COUNTED(0U, nullptr)};
static constexpr VkSubpassDependency dependency{
VK_SUBPASS_EXTERNAL,
@@ -767,7 +767,7 @@ RectPipeline::init(const sk::VulkanApi& vk,
nullptr,
VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
numImages,
- 1u,
+ 1U,
&poolSize};
if ((r = vk.createDescriptorPool(
gpu.device, descriptorPoolCreateInfo, descriptorPool))) {
@@ -811,19 +811,19 @@ RectPipeline::init(const sk::VulkanApi& vk,
static constexpr std::array<VkVertexInputAttributeDescription, 4>
vertexAttributeDescriptions{
{// Model
- {0u, 0u, VK_FORMAT_R32G32_SFLOAT, 0},
+ {0U, 0U, VK_FORMAT_R32G32_SFLOAT, 0},
// Rect instance attributes
- {1u, 1u, VK_FORMAT_R32G32_SFLOAT, offsetof(Rect, pos)},
- {2u, 1u, VK_FORMAT_R32G32_SFLOAT, offsetof(Rect, size)},
- {3u, 1u, VK_FORMAT_R32G32B32A32_SFLOAT, offsetof(Rect, fillColor)}}};
+ {1U, 1U, VK_FORMAT_R32G32_SFLOAT, offsetof(Rect, pos)},
+ {2U, 1U, VK_FORMAT_R32G32_SFLOAT, offsetof(Rect, size)},
+ {3U, 1U, VK_FORMAT_R32G32B32A32_SFLOAT, offsetof(Rect, fillColor)}}};
static constexpr std::array<VkVertexInputBindingDescription, 2>
vertexBindingDescriptions{
VkVertexInputBindingDescription{
0, sizeof(vec2), VK_VERTEX_INPUT_RATE_VERTEX},
VkVertexInputBindingDescription{
- 1u, sizeof(Rect), VK_VERTEX_INPUT_RATE_INSTANCE}};
+ 1U, sizeof(Rect), VK_VERTEX_INPUT_RATE_INSTANCE}};
static constexpr VkPipelineInputAssemblyStateCreateInfo inputAssembly{
VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
@@ -946,7 +946,7 @@ RectPipeline::init(const sk::VulkanApi& vk,
nullptr,
pipelineLayout,
renderPass.renderPass,
- 0u,
+ 0U,
{},
0}}};
@@ -1049,7 +1049,7 @@ RenderSync::init(const sk::VulkanApi& vk,
const sk::Device& device,
const uint32_t numImages)
{
- const auto maxInFlight = std::max(1u, numImages - 1u);
+ const auto maxInFlight = std::max(1U, numImages - 1U);
VkResult r = VK_SUCCESS;
imageAvailable = std::vector<sk::Semaphore>(numImages);
@@ -1301,19 +1301,19 @@ recordCommandBuffer(sk::CommandScope& cmd,
const std::array<VkDeviceSize, 1> offsets{0};
pass.bindVertexBuffers(
- 0u, SK_COUNTED(1u, &rectData.modelBuffer.buffer.get(), offsets.data()));
+ 0U, SK_COUNTED(1U, &rectData.modelBuffer.buffer.get(), offsets.data()));
pass.bindVertexBuffers(
- 1u, SK_COUNTED(1u, &rectData.instanceBuffer.buffer.get(), offsets.data()));
+ 1U, SK_COUNTED(1U, &rectData.instanceBuffer.buffer.get(), offsets.data()));
pass.bindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS,
rectPipeline.pipelineLayout,
- 0u,
- SK_COUNTED(1u, rectPipeline.descriptorSets.get()),
- 0u,
+ 0U,
+ SK_COUNTED(1U, rectPipeline.descriptorSets.get()),
+ 0U,
nullptr);
- pass.draw(4u, static_cast<uint32_t>(rectData.numRects), 0u, 0u);
+ pass.draw(4U, static_cast<uint32_t>(rectData.numRects), 0U, 0U);
}
VkResult
@@ -1397,7 +1397,7 @@ public:
RectData rectData;
RectShaders rectShaders;
uint32_t framesDrawn{0};
- VkExtent2D extent{512u, 512u};
+ VkExtent2D extent{512U, 512U};
std::vector<Rect> rects;
bool resizing{false};
bool quit{false};
@@ -1621,7 +1621,7 @@ View::onEvent(const pugl::ExposeEvent&)
const auto& gpu = _app.gpu;
// Acquire the next image, waiting and/or rebuilding if necessary
- auto nextImageIndex = 0u;
+ auto nextImageIndex = 0U;
if (beginFrame(_app, gpu.device, nextImageIndex)) {
return pugl::Status::unknownError;
}
@@ -1719,7 +1719,7 @@ run(const char* const programPath,
app.world.setClassName("PuglVulkanCppDemo");
app.view.setWindowTitle("Pugl Vulkan C++ Demo");
app.view.setSizeHint(pugl::SizeHint::defaultSize, width, height);
- app.view.setSizeHint(pugl::SizeHint::minSize, width / 4u, height / 4u);
+ app.view.setSizeHint(pugl::SizeHint::minSize, width / 4U, height / 4U);
app.view.setBackend(pugl::vulkanBackend());
app.view.setHint(pugl::ViewHint::resizable, opts.resizable);
const pugl::Status st = app.view.realize();
diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c
index b3deb0d..1827991 100644
--- a/examples/pugl_window_demo.c
+++ b/examples/pugl_window_demo.c
@@ -36,7 +36,7 @@ typedef struct {
bool verbose;
} PuglTestApp;
-static const uint8_t pad = 64u;
+static const uint8_t pad = 64U;
static void
onDisplay(PuglView* view)
@@ -70,13 +70,13 @@ onKeyPress(PuglView* view, const PuglKeyEvent* event)
app->quit = 1;
} else if (event->state & PUGL_MOD_SHIFT) {
if (event->key == PUGL_KEY_UP) {
- puglSetSize(view, frame.width, frame.height - 10u);
+ puglSetSize(view, frame.width, frame.height - 10U);
} else if (event->key == PUGL_KEY_DOWN) {
- puglSetSize(view, frame.width, frame.height + 10u);
+ puglSetSize(view, frame.width, frame.height + 10U);
} else if (event->key == PUGL_KEY_LEFT) {
- puglSetSize(view, frame.width - 10u, frame.height);
+ puglSetSize(view, frame.width - 10U, frame.height);
} else if (event->key == PUGL_KEY_RIGHT) {
- puglSetSize(view, frame.width + 10u, frame.height);
+ puglSetSize(view, frame.width + 10U, frame.height);
}
} else {
if (event->key == PUGL_KEY_UP) {
@@ -187,8 +187,8 @@ main(int argc, char** argv)
puglSetWindowTitle(view, "Pugl Window Demo");
puglSetPosition(view,
- (PuglCoord)(pad + (128u + pad) * i),
- (PuglCoord)(pad + (128u + pad) * i));
+ (PuglCoord)(pad + (128U + pad) * i),
+ (PuglCoord)(pad + (128U + pad) * i));
puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 512, 512);
puglSetSizeHint(view, PUGL_MIN_SIZE, 128, 128);
diff --git a/examples/sybok.hpp b/examples/sybok.hpp
index aad1b41..4fe4886 100644
--- a/examples/sybok.hpp
+++ b/examples/sybok.hpp
@@ -655,7 +655,7 @@ template<class Value, class Vector, class Func, class... Args>
inline VkResult
wrapVectorAccessor(Vector& vector, Func func, Args... args) noexcept
{
- uint32_t count = 0u;
+ uint32_t count = 0U;
VkResult r = func(args..., &count, nullptr);
if (r > VK_INCOMPLETE) {
vector.clear();
@@ -1310,7 +1310,7 @@ public:
VkResult enumeratePhysicalDevices(const Instance& instance,
Vector& physicalDevices) const noexcept
{
- uint32_t count = 0u;
+ uint32_t count = 0U;
VkResult r = vkEnumeratePhysicalDevices(instance, &count, nullptr);
if (r > VK_INCOMPLETE) {
return r;
@@ -1355,7 +1355,7 @@ public:
const PhysicalDevice& physicalDevice,
Vector& queueFamilyProperties) const noexcept
{
- uint32_t count = 0u;
+ uint32_t count = 0U;
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, nullptr);
queueFamilyProperties = Vector(count);
@@ -1420,7 +1420,7 @@ public:
const VkSubmitInfo& submit,
const Fence& fence) const noexcept
{
- return vkQueueSubmit(queue, 1u, &submit, fence);
+ return vkQueueSubmit(queue, 1U, &submit, fence);
}
template<size_t descriptorWriteCount, size_t descriptorCopyCount>
@@ -1440,7 +1440,7 @@ public:
VkResult resetFence(const Device& device, const Fence& fence) const noexcept
{
VkFence h = fence;
- return vkResetFences(device, 1u, &h);
+ return vkResetFences(device, 1U, &h);
}
VkResult waitForFence(const Device& device,
@@ -1448,13 +1448,13 @@ public:
uint64_t timeout) const noexcept
{
VkFence h = fence;
- return vkWaitForFences(device, 1u, &h, VK_TRUE, timeout);
+ return vkWaitForFences(device, 1U, &h, VK_TRUE, timeout);
}
VkResult waitForFence(const Device& device, const Fence& fence) const noexcept
{
VkFence h = fence;
- return vkWaitForFences(device, 1u, &h, VK_TRUE, UINT64_MAX);
+ return vkWaitForFences(device, 1U, &h, VK_TRUE, UINT64_MAX);
}
// Scoped command buffer interface
diff --git a/include/pugl/pugl.h b/include/pugl/pugl.h
index 397d25e..431efab 100644
--- a/include/pugl/pugl.h
+++ b/include/pugl/pugl.h
@@ -109,10 +109,10 @@ typedef struct {
/// Keyboard modifier flags
typedef enum {
- PUGL_MOD_SHIFT = 1u << 0u, ///< Shift key
- PUGL_MOD_CTRL = 1u << 1u, ///< Control key
- PUGL_MOD_ALT = 1u << 2u, ///< Alt/Option key
- PUGL_MOD_SUPER = 1u << 3u ///< Mod4/Command/Windows key
+ PUGL_MOD_SHIFT = 1U << 0U, ///< Shift key
+ PUGL_MOD_CTRL = 1U << 1U, ///< Control key
+ PUGL_MOD_ALT = 1U << 2U, ///< Alt/Option key
+ PUGL_MOD_SUPER = 1U << 3U ///< Mod4/Command/Windows key
} PuglMod;
/// Bitwise OR of #PuglMod values
@@ -690,7 +690,7 @@ typedef enum {
X11: Calls XInitThreads() which is required for some drivers.
*/
- PUGL_WORLD_THREADS = 1u << 0u
+ PUGL_WORLD_THREADS = 1U << 0U
} PuglWorldFlag;
/// Bitwise OR of #PuglWorldFlag values
@@ -862,7 +862,7 @@ typedef enum {
} PuglViewHint;
/// The number of #PuglViewHint values
-#define PUGL_NUM_VIEW_HINTS ((unsigned)PUGL_REFRESH_RATE + 1u)
+#define PUGL_NUM_VIEW_HINTS ((unsigned)PUGL_REFRESH_RATE + 1U)
/// A special view hint value
typedef enum {
@@ -909,7 +909,7 @@ typedef enum {
} PuglSizeHint;
/// The number of #PuglSizeHint values
-#define PUGL_NUM_SIZE_HINTS ((unsigned)PUGL_MAX_ASPECT + 1u)
+#define PUGL_NUM_SIZE_HINTS ((unsigned)PUGL_MAX_ASPECT + 1U)
/// A function called when an event occurs
typedef PuglStatus (*PuglEventFunc)(PuglView* view, const PuglEvent* event);
@@ -1265,7 +1265,7 @@ typedef enum {
} PuglCursor;
/// The number of #PuglCursor values
-#define PUGL_NUM_CURSORS ((unsigned)PUGL_CURSOR_UP_DOWN + 1u)
+#define PUGL_NUM_CURSORS ((unsigned)PUGL_CURSOR_UP_DOWN + 1U)
/**
Grab the keyboard input focus.
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;
diff --git a/src/mac.m b/src/mac.m
index fafade3..f93f80c 100644
--- a/src/mac.m
+++ b/src/mac.m
@@ -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
diff --git a/src/win.c b/src/win.c
index 0150d67..8c95386 100644
--- a/src/win.c
+++ b/src/win.c
@@ -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);
}
diff --git a/src/x11.c b/src/x11.c
index 4e68674..b6b6695 100644
--- a/src/x11.c
+++ b/src/x11.c
@@ -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;
}
diff --git a/test/test_clipboard.c b/test/test_clipboard.c
index 3cbb8d1..a99d150 100644
--- a/test/test_clipboard.c
+++ b/test/test_clipboard.c
@@ -51,7 +51,7 @@ main(int argc, char** argv)
puglSetClassName(test.world, "PuglTest");
// Set up views
- for (unsigned i = 0u; i < 2; ++i) {
+ for (unsigned i = 0U; i < 2; ++i) {
test.views[i] = puglNewView(test.world);
puglSetWindowTitle(test.world, "Pugl Clipboard Test");
puglSetBackend(test.views[i], puglStubBackend());
diff --git a/test/test_local_copy_paste.c b/test/test_local_copy_paste.c
index 4a2f4d9..9f99a09 100644
--- a/test/test_local_copy_paste.c
+++ b/test/test_local_copy_paste.c
@@ -16,7 +16,7 @@
#include <stdint.h>
#include <string.h>
-static const uintptr_t timerId = 1u;
+static const uintptr_t timerId = 1U;
typedef enum {
START,
diff --git a/test/test_remote_copy_paste.c b/test/test_remote_copy_paste.c
index 07e75d9..9d385ad 100644
--- a/test/test_remote_copy_paste.c
+++ b/test/test_remote_copy_paste.c
@@ -16,8 +16,8 @@
#include <stdint.h>
#include <string.h>
-static const uintptr_t copierTimerId = 1u;
-static const uintptr_t pasterTimerId = 2u;
+static const uintptr_t copierTimerId = 1U;
+static const uintptr_t pasterTimerId = 2U;
typedef enum {
START,
diff --git a/test/test_show_hide.c b/test/test_show_hide.c
index bfcb035..61f2bc6 100644
--- a/test/test_show_hide.c
+++ b/test/test_show_hide.c
@@ -113,7 +113,7 @@ main(int argc, char** argv)
}
// Show and hide window a couple of times
- for (unsigned i = 0u; i < 2u; ++i) {
+ for (unsigned i = 0U; i < 2U; ++i) {
assert(!puglShow(test.view));
while (test.state != EXPOSED) {
tick(test.world);
diff --git a/test/test_size.c b/test/test_size.c
index 9597a08..1c2f0c6 100644
--- a/test/test_size.c
+++ b/test/test_size.c
@@ -77,7 +77,7 @@ main(int argc, char** argv)
NULL,
puglParseTestOptions(&argc, &argv),
START,
- {0, 0, 0u, 0u}};
+ {0, 0, 0U, 0U}};
// Set up view with size bounds and an aspect ratio
test.view = puglNewView(test.world);
diff --git a/test/test_timer.c b/test/test_timer.c
index 401e4d5..34223c9 100644
--- a/test/test_timer.c
+++ b/test/test_timer.c
@@ -29,7 +29,7 @@ static const double timeout = -1.0;
// Windows SetTimer has a maximum resolution of 10ms
static const double tolerance = 0.012;
-static const uintptr_t timerId = 1u;
+static const uintptr_t timerId = 1U;
static const double timerPeriod = 1 / 60.0;
typedef enum {