From 84b8b056cfbc91dc6d8d29bb40b04afb3a282cbc Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sun, 27 Feb 2022 14:44:11 -0500 Subject: [PATCH] Work around missing SIZE_MAX. Older library implementations lack this macro. Outside of an #if directive the expression (size_t)-1 is equivalent so we can define a fallback easily enough. --- src/engine/mesh.gob | 6 +++++- src/uobject/uobject.c | 27 +++++++++++++++------------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/engine/mesh.gob b/src/engine/mesh.gob index 74b5b68..8e60828 100644 --- a/src/engine/mesh.gob +++ b/src/engine/mesh.gob @@ -23,10 +23,14 @@ %} %{ -#include +#include #include #include #include "pack.h" + +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t)-1) +#endif %} %h{ diff --git a/src/uobject/uobject.c b/src/uobject/uobject.c index 3bada24..0fbcd8d 100644 --- a/src/uobject/uobject.c +++ b/src/uobject/uobject.c @@ -1,19 +1,19 @@ /* - * upkg: tool for manipulating Unreal Tournament packages. - * Copyright © 2009-2012, 2015, 2020 Nick Bowler + * upkg: tool for manipulating Unreal Tournament packages. + * Copyright © 2009-2012, 2015, 2020, 2022 Nick Bowler * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #include @@ -36,6 +36,9 @@ #define U_OBJECT_GET_PRIV(o) \ G_TYPE_INSTANCE_GET_PRIVATE(o, U_TYPE_OBJECT, struct u_object_priv) +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t)-1) +#endif struct prop_head { const char *prop_name, *struct_name; -- 2.43.2