aboutsummaryrefslogtreecommitdiffstats
path: root/src/internal.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2025-01-22 18:42:14 -0500
committerDavid Robillard <d@drobilla.net>2025-01-22 18:42:14 -0500
commit77f88bd146b1ce10d405c7812bdd2c4d78857bd4 (patch)
tree985979dd02e043b5bc7f635e406b34bd6b3e46e4 /src/internal.c
parent44e65f78fca1597471d31a96907d5be465ca1ec1 (diff)
downloadpugl-77f88bd146b1ce10d405c7812bdd2c4d78857bd4.tar.gz
pugl-77f88bd146b1ce10d405c7812bdd2c4d78857bd4.tar.bz2
pugl-77f88bd146b1ce10d405c7812bdd2c4d78857bd4.zip
Factor out puglIsValidSize()
Diffstat (limited to 'src/internal.c')
-rw-r--r--src/internal.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/internal.c b/src/internal.c
index 3799e97..31345f3 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -19,6 +19,12 @@ puglIsValidPosition(const int x, const int y)
}
bool
+puglIsValidSize(const unsigned width, const unsigned height)
+{
+ return width && height && width <= INT16_MAX && height <= INT16_MAX;
+}
+
+bool
puglIsValidArea(const PuglArea size)
{
return size.width && size.height;
@@ -80,8 +86,7 @@ puglStoreSizeHint(PuglView* const view,
const unsigned width,
const unsigned height)
{
- if (width > INT16_MAX || height > INT16_MAX ||
- (unsigned)hint >= PUGL_NUM_SIZE_HINTS) {
+ if (!puglIsValidSize(width, height)) {
return PUGL_BAD_PARAMETER;
}