blob: 79e1475c6c52f43a3b83fc824732e50c9a00954c [file] [log] [blame]
Andrew Geissler6ce62a22020-11-30 19:58:47 -06001Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4From 52d603212173d4502800bf746436a93f806a8898 Mon Sep 17 00:00:00 2001
5From: Allen Winter <allen.winter@kdab.com>
6Date: Sat, 31 Oct 2020 17:38:01 -0400
7Subject: [PATCH] Fix build with icu-68.1
8
9Use stdbool.h to define true and false when possible
10
11Issue#448
12---
13 ConfigureChecks.cmake | 1 +
14 config.h.cmake | 3 +++
15 src/libical/icalrecur.c | 10 ++++++++--
16 3 files changed, 12 insertions(+), 2 deletions(-)
17
18diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
19index e4d0e2ec..bba33fa9 100644
20--- a/ConfigureChecks.cmake
21+++ b/ConfigureChecks.cmake
22@@ -10,6 +10,7 @@ check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
23 check_include_files(fcntl.h HAVE_FCNTL_H)
24 check_include_files(unistd.h HAVE_UNISTD_H)
25 check_include_files(wctype.h HAVE_WCTYPE_H)
26+check_include_files(stdbool.h HAVE_STDBOOL_H)
27
28 include(CheckFunctionExists)
29 if(WIN32 AND MSVC)
30diff --git a/config.h.cmake b/config.h.cmake
31index 8fd3421b..c8008692 100644
32--- a/config.h.cmake
33+++ b/config.h.cmake
34@@ -39,6 +39,9 @@
35 /* Define to 1 if you have the <dirent.h> header file. */
36 #cmakedefine HAVE_DIRENT_H 1
37
38+/* Define to 1 if you have the <stdbool.h> header file. */
39+#cmakedefine HAVE_STDBOOL_H 1
40+
41 /* Define if we have pthread. */
42 #cmakedefine HAVE_PTHREAD_ATTR_GET_NP 1
43 #cmakedefine HAVE_PTHREAD_GETATTR_NP 1
44diff --git a/src/libical/icalrecur.c b/src/libical/icalrecur.c
45index 73178450..b3f054b8 100644
46--- a/src/libical/icalrecur.c
47+++ b/src/libical/icalrecur.c
48@@ -145,6 +145,12 @@
49 #if defined(HAVE_LIBICU)
50 #include <unicode/ucal.h>
51 #include <unicode/ustring.h>
52+#if defined(HAVE_STDBOOL_H)
53+#include <stdbool.h>
54+#else
55+#define false 0
56+#define true 1
57+#endif
58 #define RSCALE_IS_SUPPORTED 1
59 #else
60 #define RSCALE_IS_SUPPORTED 0
61@@ -1018,7 +1024,7 @@ icalarray *icalrecurrencetype_rscale_supported_calendars(void)
62
63 calendars = icalarray_new(sizeof(const char **), 20);
64
65- en = ucal_getKeywordValuesForLocale("calendar", NULL, FALSE, &status);
66+ en = ucal_getKeywordValuesForLocale("calendar", NULL, false, &status);
67 while ((cal = uenum_next(en, NULL, &status))) {
68 cal = icalmemory_tmp_copy(cal);
69 icalarray_append(calendars, &cal);
70@@ -1411,7 +1417,7 @@ static int initialize_rscale(icalrecur_iterator *impl)
71 }
72
73 /* Check if specified calendar is supported */
74- en = ucal_getKeywordValuesForLocale("calendar", NULL, FALSE, &status);
75+ en = ucal_getKeywordValuesForLocale("calendar", NULL, false, &status);
76 while ((cal = uenum_next(en, NULL, &status))) {
77 if (!strcmp(cal, rule.rscale)) {
78 is_hebrew = !strcmp(rule.rscale, "hebrew");
79--
802.25.1
81