summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/Net-ICal-Libical/Makefile.PL4
-rw-r--r--src/Net-ICal-Libical/README.txt (renamed from src/Net-ICal-Libical/README)0
-rw-r--r--src/Net-ICal-Libical/lib/Net/ICal/Libical.pm10
-rw-r--r--src/Net-ICal-Libical/lib/Net/ICal/Libical/Component.pm10
-rw-r--r--src/Net-ICal-Libical/lib/Net/ICal/Libical/Duration.pm10
-rw-r--r--src/Net-ICal-Libical/lib/Net/ICal/Libical/Period.pm20
-rw-r--r--src/Net-ICal-Libical/lib/Net/ICal/Libical/Property.pm10
-rw-r--r--src/Net-ICal-Libical/lib/Net/ICal/Libical/Time.pm12
-rw-r--r--src/Net-ICal-Libical/netical.i19
-rw-r--r--src/Net-ICal-Libical/netical_wrap.c299
-rw-r--r--src/Net-ICal-Libical/netical_wrap.doc21
-rw-r--r--src/Net-ICal-Libical/test-data/2446.mime46
-rw-r--r--src/Net-ICal-Libical/test-data/mail-examples6
-rw-r--r--src/Net-ICal-Libical/test-data/no-error2
-rw-r--r--src/Net-ICal-Libical/test-data/rfc2446.ics2
-rw-r--r--src/Net-ICal-Libical/test-data/single-with-error3
-rw-r--r--src/Net-ICal-Libical/test/component.pl10
-rw-r--r--[-rwxr-xr-x]src/Net-ICal-Libical/test/libical.pl12
-rw-r--r--[-rwxr-xr-x]src/Net-ICal-Libical/test/swig.pl10
-rw-r--r--src/java/CMakeLists.txt2
-rw-r--r--src/java/ICalDurationType.java3
-rw-r--r--src/java/ICalParameter.java3
-rw-r--r--src/java/ICalPeriodType.java3
-rw-r--r--src/java/ICalProperty.java3
-rw-r--r--src/java/ICalRecurrenceType.java3
-rw-r--r--src/java/ICalTimeType.java4
-rw-r--r--src/java/ICalTriggerType.java4
-rw-r--r--src/java/ICalValue.java3
-rw-r--r--src/java/VAgenda.java5
-rw-r--r--src/java/VAlarm.java5
-rw-r--r--src/java/VCalendar.java5
-rw-r--r--src/java/VComponent.java3
-rw-r--r--src/java/VEvent.java5
-rw-r--r--src/java/VFreeBusy.java9
-rw-r--r--src/java/VQuery.java5
-rw-r--r--src/java/VToDo.java5
-rw-r--r--src/java/jlibical_consts_cxx.h12
-rw-r--r--src/java/jlibical_utils_cxx.cpp13
-rw-r--r--src/java/jlibical_utils_cxx.h13
-rw-r--r--src/java/jniICalDurationType_cxx.cpp13
-rw-r--r--src/java/jniICalDurationType_cxx.h14
-rw-r--r--src/java/jniICalPeriodType_cxx.cpp15
-rw-r--r--src/java/jniICalPeriodType_cxx.h14
-rw-r--r--src/java/jniICalRecurrenceType_cxx.cpp15
-rw-r--r--src/java/jniICalRecurrenceType_cxx.h13
-rw-r--r--src/java/jniICalTimeType_cxx.cpp13
-rw-r--r--src/java/jniICalTimeType_cxx.h13
-rw-r--r--src/java/jniICalTriggerType_cxx.cpp13
-rw-r--r--src/java/jniICalTriggerType_cxx.h14
-rw-r--r--src/java/net_cp_jlibical_ICalParameter_cxx.cpp12
-rw-r--r--src/java/net_cp_jlibical_ICalParameter_cxx.h12
-rw-r--r--src/java/net_cp_jlibical_ICalProperty_cxx.cpp13
-rw-r--r--src/java/net_cp_jlibical_ICalProperty_cxx.h12
-rw-r--r--src/java/net_cp_jlibical_ICalValue_cxx.cpp12
-rw-r--r--src/java/net_cp_jlibical_ICalValue_cxx.h12
-rw-r--r--src/java/net_cp_jlibical_VComponent_cxx.cpp13
-rw-r--r--src/java/net_cp_jlibical_VComponent_cxx.h12
-rw-r--r--src/java/testjni.java7
-rw-r--r--src/libical-glib/CMakeLists.txt36
-rw-r--r--src/libical-glib/api/i-cal-array.xml12
-rw-r--r--src/libical-glib/api/i-cal-attach.xml12
-rw-r--r--src/libical-glib/api/i-cal-comp-iter.xml12
-rw-r--r--src/libical-glib/api/i-cal-component.xml16
-rw-r--r--src/libical-glib/api/i-cal-datetimeperiod.xml12
-rw-r--r--src/libical-glib/api/i-cal-derived-parameter.xml12
-rw-r--r--src/libical-glib/api/i-cal-derived-property.xml12
-rw-r--r--src/libical-glib/api/i-cal-derived-value.xml12
-rw-r--r--src/libical-glib/api/i-cal-duration.xml16
-rw-r--r--src/libical-glib/api/i-cal-enums.xml12
-rw-r--r--src/libical-glib/api/i-cal-error.xml12
-rw-r--r--src/libical-glib/api/i-cal-geo.xml47
-rw-r--r--src/libical-glib/api/i-cal-memory.xml12
-rw-r--r--src/libical-glib/api/i-cal-mime.xml12
-rw-r--r--src/libical-glib/api/i-cal-parameter.xml16
-rw-r--r--src/libical-glib/api/i-cal-parser.xml12
-rw-r--r--src/libical-glib/api/i-cal-period.xml12
-rw-r--r--src/libical-glib/api/i-cal-property.xml16
-rw-r--r--src/libical-glib/api/i-cal-recur-iterator.xml18
-rw-r--r--src/libical-glib/api/i-cal-recur.xml12
-rw-r--r--src/libical-glib/api/i-cal-recurrence.xml124
-rw-r--r--src/libical-glib/api/i-cal-reqstat.xml16
-rw-r--r--src/libical-glib/api/i-cal-restriction.xml12
-rw-r--r--src/libical-glib/api/i-cal-time-span.xml14
-rw-r--r--src/libical-glib/api/i-cal-time.xml16
-rw-r--r--src/libical-glib/api/i-cal-timezone.xml12
-rw-r--r--src/libical-glib/api/i-cal-trigger.xml12
-rw-r--r--src/libical-glib/api/i-cal-unknowntokenhandling.xml12
-rw-r--r--src/libical-glib/api/i-cal-value.xml17
-rw-r--r--src/libical-glib/i-cal-object.c.in190
-rw-r--r--src/libical-glib/i-cal-object.h.in48
-rw-r--r--src/libical-glib/libical-glib.pc.in3
-rw-r--r--src/libical-glib/tools/generator.c41
-rw-r--r--src/libical-glib/tools/generator.h13
-rw-r--r--src/libical-glib/tools/header-forward-declarations-template14
-rw-r--r--src/libical-glib/tools/header-header-template18
-rw-r--r--src/libical-glib/tools/header-structure-boilerplate-template26
-rw-r--r--src/libical-glib/tools/header-template14
-rw-r--r--src/libical-glib/tools/source-template14
-rw-r--r--src/libical-glib/tools/xml-parser.c13
-rw-r--r--src/libical-glib/tools/xml-parser.h12
-rw-r--r--src/libical/CMakeLists.txt42
-rw-r--r--src/libical/astime.h78
-rw-r--r--src/libical/caldate.c110
-rw-r--r--src/libical/ical_file.cmake5
-rw-r--r--src/libical/icalarray.c101
-rw-r--r--src/libical/icalarray.h14
-rw-r--r--src/libical/icalattach.c31
-rw-r--r--src/libical/icalattach.h12
-rw-r--r--src/libical/icalattachimpl.h12
-rw-r--r--src/libical/icalcomponent.c194
-rw-r--r--src/libical/icalcomponent.h52
-rw-r--r--src/libical/icalderivedparameter.c.in13
-rw-r--r--src/libical/icalderivedparameter.h.in13
-rw-r--r--src/libical/icalderivedproperty.c.in12
-rw-r--r--src/libical/icalderivedproperty.h.in13
-rw-r--r--src/libical/icalderivedvalue.c.in26
-rw-r--r--src/libical/icalderivedvalue.h.in12
-rw-r--r--src/libical/icalduration.c25
-rw-r--r--src/libical/icalduration.h17
-rw-r--r--src/libical/icalenums.c12
-rw-r--r--src/libical/icalenums.h19
-rw-r--r--src/libical/icalerror.c32
-rw-r--r--src/libical/icalerror.h25
-rw-r--r--src/libical/icallangbind.c26
-rw-r--r--src/libical/icallangbind.h12
-rw-r--r--src/libical/icalmemory.c155
-rw-r--r--src/libical/icalmemory.h81
-rw-r--r--src/libical/icalmime.c38
-rw-r--r--src/libical/icalmime.h12
-rw-r--r--src/libical/icalparameter.c42
-rw-r--r--src/libical/icalparameter.h39
-rw-r--r--src/libical/icalparameter_cxx.cpp16
-rw-r--r--src/libical/icalparameter_cxx.h12
-rw-r--r--src/libical/icalparameterimpl.h13
-rw-r--r--src/libical/icalparser.c100
-rw-r--r--src/libical/icalparser.h13
-rw-r--r--src/libical/icalperiod.c13
-rw-r--r--src/libical/icalperiod.h13
-rw-r--r--src/libical/icalproperty.c52
-rw-r--r--src/libical/icalproperty.h26
-rw-r--r--src/libical/icalproperty_cxx.cpp16
-rw-r--r--src/libical/icalproperty_cxx.h12
-rw-r--r--src/libical/icalproperty_p.h12
-rw-r--r--src/libical/icalrecur.c903
-rw-r--r--src/libical/icalrecur.h95
-rw-r--r--src/libical/icalrestriction.c.in676
-rw-r--r--src/libical/icalrestriction.h13
-rw-r--r--src/libical/icaltime.c94
-rw-r--r--src/libical/icaltime.h.cmake (renamed from src/libical/icaltime.h)28
-rw-r--r--src/libical/icaltimezone.c98
-rw-r--r--src/libical/icaltimezone.h12
-rw-r--r--src/libical/icaltimezoneimpl.h12
-rw-r--r--src/libical/icaltypes.c12
-rw-r--r--src/libical/icaltypes.h39
-rw-r--r--src/libical/icaltz-util.c119
-rw-r--r--src/libical/icaltz-util.h41
-rw-r--r--src/libical/icalvalue.c101
-rw-r--r--src/libical/icalvalue.h26
-rw-r--r--src/libical/icalvalue_cxx.cpp16
-rw-r--r--src/libical/icalvalue_cxx.h12
-rw-r--r--src/libical/icalvalueimpl.h13
-rw-r--r--src/libical/icalversion.h.cmake12
-rw-r--r--src/libical/icptrholder_cxx.h16
-rw-r--r--src/libical/libical_deprecated.h24
-rw-r--r--src/libical/libical_ical_export.h5
-rw-r--r--src/libical/pvl.c24
-rw-r--r--src/libical/pvl.h12
-rw-r--r--src/libical/qsort_gen.c135
-rw-r--r--src/libical/qsort_gen.h45
-rw-r--r--src/libical/sspm.c115
-rw-r--r--src/libical/sspm.h26
-rw-r--r--src/libical/vcomponent_cxx.cpp16
-rw-r--r--src/libical/vcomponent_cxx.h12
-rw-r--r--src/libicalss/CMakeLists.txt10
-rw-r--r--src/libicalss/icalbdbset.c12
-rw-r--r--src/libicalss/icalbdbset.h12
-rw-r--r--src/libicalss/icalbdbset_cxx.h13
-rw-r--r--src/libicalss/icalbdbsetimpl.h12
-rw-r--r--src/libicalss/icalcalendar.c12
-rw-r--r--src/libicalss/icalcalendar.h13
-rw-r--r--src/libicalss/icalclassify.c20
-rw-r--r--src/libicalss/icalclassify.h12
-rw-r--r--src/libicalss/icalcluster.c29
-rw-r--r--src/libicalss/icalcluster.h32
-rw-r--r--src/libicalss/icalclusterimpl.h12
-rw-r--r--src/libicalss/icaldirset.c13
-rw-r--r--src/libicalss/icaldirset.h13
-rw-r--r--src/libicalss/icaldirsetimpl.h13
-rw-r--r--src/libicalss/icalfileset.c20
-rw-r--r--src/libicalss/icalfileset.h13
-rw-r--r--src/libicalss/icalfilesetimpl.h13
-rw-r--r--src/libicalss/icalgauge.c13
-rw-r--r--src/libicalss/icalgauge.h13
-rw-r--r--src/libicalss/icalgaugeimpl.h12
-rw-r--r--src/libicalss/icalmessage.c21
-rw-r--r--src/libicalss/icalmessage.h12
-rw-r--r--src/libicalss/icalset.c13
-rw-r--r--src/libicalss/icalset.h13
-rw-r--r--src/libicalss/icalspanlist.c34
-rw-r--r--src/libicalss/icalspanlist.h12
-rw-r--r--src/libicalss/icalspanlist_cxx.cpp12
-rw-r--r--src/libicalss/icalspanlist_cxx.h13
-rw-r--r--src/libicalss/icalss_file.cmake3
-rw-r--r--src/libicalss/icalsslexer.c17
-rw-r--r--src/libicalss/icalsslexer.l15
-rw-r--r--src/libicalss/icalssyacc.c12
-rw-r--r--src/libicalss/icalssyacc.h5
-rw-r--r--src/libicalss/icalssyacc.y13
-rw-r--r--src/libicalss/libical_icalss_export.h5
-rw-r--r--src/libicalvcal/CMakeLists.txt3
-rw-r--r--src/libicalvcal/README.txt (renamed from src/libicalvcal/README.TXT)16
-rw-r--r--src/libicalvcal/icalvcal.c25
-rw-r--r--src/libicalvcal/icalvcal.h12
-rw-r--r--src/libicalvcal/libical_vcal_export.h5
-rw-r--r--src/libicalvcal/vcaltmp.c38
-rw-r--r--src/libicalvcal/vcaltmp.h30
-rw-r--r--src/libicalvcal/vcc.c582
-rw-r--r--src/libicalvcal/vcc.h32
-rw-r--r--src/libicalvcal/vcc.y113
-rw-r--r--src/libicalvcal/vobject.c45
-rw-r--r--src/libicalvcal/vobject.h30
-rw-r--r--src/php/Makefile7
-rw-r--r--src/php/README.txt (renamed from src/php/README)0
-rw-r--r--src/php/test.php3
-rw-r--r--src/python/Attendee.py119
-rw-r--r--src/python/CMakeLists.txt24
-rw-r--r--src/python/ChangeLog129
-rw-r--r--src/python/Collection.py121
-rw-r--r--src/python/Component.py816
-rw-r--r--src/python/DerivedProperties.py151
-rw-r--r--src/python/Duration.py85
-rw-r--r--src/python/Error.py39
-rw-r--r--src/python/Gauge.py63
-rw-r--r--src/python/Libical.py32
-rw-r--r--src/python/LibicalWrap.i101
-rw-r--r--src/python/LibicalWrap_icaltime.i196
-rw-r--r--src/python/LibicalWrap_icaltimezone.i215
-rw-r--r--src/python/Period.py201
-rw-r--r--src/python/Property.py256
-rw-r--r--src/python/Store.py173
-rw-r--r--src/python/Time.py219
-rw-r--r--src/python/__init__.py21
-rw-r--r--src/python/littlefile.txt3
-rw-r--r--src/python/python-binding.txt434
-rw-r--r--src/python/test.py598
-rw-r--r--src/test/CMakeLists.txt56
-rw-r--r--src/test/builtin_timezones.c12
-rw-r--r--src/test/copycluster.c15
-rw-r--r--src/test/icalattach-leak.c15
-rw-r--r--src/test/icalrecur_test.c34
-rw-r--r--src/test/icalrecur_test.out70
-rw-r--r--src/test/icalrecur_withicu_dangi_test.out33
-rw-r--r--src/test/icalrecur_withicu_test.out32
-rw-r--r--src/test/icalrecur_withouticu_test.out13
-rw-r--r--src/test/icaltestparser.c13
-rw-r--r--src/test/icaltm_test.c13
-rw-r--r--src/test/libical-glib/CMakeLists.txt20
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/array.py105
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/attach.py41
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/component.py380
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/comprehensive.py137
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/duration.py48
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/error.py49
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/misc.py31
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/parameter.py103
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/period.py111
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/property.py169
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/recurrence.py158
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/timezone.py155
-rw-r--r--[-rwxr-xr-x]src/test/libical-glib/value.py113
-rw-r--r--src/test/outgoing.ics16
-rw-r--r--src/test/process.c16
-rw-r--r--src/test/recur.c22
-rw-r--r--src/test/regression-classify.c12
-rw-r--r--src/test/regression-component.c19
-rw-r--r--src/test/regression-cxx.cpp12
-rw-r--r--src/test/regression-recur.c22
-rw-r--r--src/test/regression-storage.c21
-rw-r--r--src/test/regression-utils.c71
-rw-r--r--src/test/regression.c434
-rw-r--r--src/test/regression.h14
-rw-r--r--src/test/stow.c21
-rw-r--r--src/test/test-malloc.c178
-rw-r--r--src/test/test-malloc.h59
-rw-r--r--src/test/testmime.c13
-rw-r--r--src/test/testvcal.c13
-rw-r--r--src/test/timezones.c27
288 files changed, 5569 insertions, 8934 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9337d091..4959b3ea 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
add_subdirectory(libical)
add_subdirectory(libicalss)
add_subdirectory(libicalvcal)
diff --git a/src/Net-ICal-Libical/Makefile.PL b/src/Net-ICal-Libical/Makefile.PL
index 59d8d53d..60f3bc70 100644
--- a/src/Net-ICal-Libical/Makefile.PL
+++ b/src/Net-ICal-Libical/Makefile.PL
@@ -1,4 +1,8 @@
#!/usr/bin/perl
+#
+# SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+#
use ExtUtils::MakeMaker;
WriteMakefile(
diff --git a/src/Net-ICal-Libical/README b/src/Net-ICal-Libical/README.txt
index f6be345e..f6be345e 100644
--- a/src/Net-ICal-Libical/README
+++ b/src/Net-ICal-Libical/README.txt
diff --git a/src/Net-ICal-Libical/lib/Net/ICal/Libical.pm b/src/Net-ICal-Libical/lib/Net/ICal/Libical.pm
index 070d58be..f4779ca4 100644
--- a/src/Net-ICal-Libical/lib/Net/ICal/Libical.pm
+++ b/src/Net-ICal-Libical/lib/Net/ICal/Libical.pm
@@ -3,18 +3,12 @@
# FILE: Libical.pm
# CREATOR: eric
#
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
#======================================================================
# This part of this file was automatically generated by SWIG
diff --git a/src/Net-ICal-Libical/lib/Net/ICal/Libical/Component.pm b/src/Net-ICal-Libical/lib/Net/ICal/Libical/Component.pm
index 54d9e0ba..46838f02 100644
--- a/src/Net-ICal-Libical/lib/Net/ICal/Libical/Component.pm
+++ b/src/Net-ICal-Libical/lib/Net/ICal/Libical/Component.pm
@@ -3,18 +3,12 @@
# FILE: Component.pm
# CREATOR: eric 1 Mar 01
#
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
#======================================================================
package Net::ICal::Libical::Component;
diff --git a/src/Net-ICal-Libical/lib/Net/ICal/Libical/Duration.pm b/src/Net-ICal-Libical/lib/Net/ICal/Libical/Duration.pm
index 93b1852c..6c3903fe 100644
--- a/src/Net-ICal-Libical/lib/Net/ICal/Libical/Duration.pm
+++ b/src/Net-ICal-Libical/lib/Net/ICal/Libical/Duration.pm
@@ -2,18 +2,12 @@
# FILE: Duration.pm
# CREATOR: eric
#
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
#=============================================================================
=head1 NAME
diff --git a/src/Net-ICal-Libical/lib/Net/ICal/Libical/Period.pm b/src/Net-ICal-Libical/lib/Net/ICal/Libical/Period.pm
index 11ec0325..696d577e 100644
--- a/src/Net-ICal-Libical/lib/Net/ICal/Libical/Period.pm
+++ b/src/Net-ICal-Libical/lib/Net/ICal/Libical/Period.pm
@@ -3,18 +3,12 @@
# FILE: Component.pm
# CREATOR: eric
#
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
#======================================================================
=pod
@@ -330,25 +324,25 @@ sub test {
$p->duration("PT5H30M10S");
print $p->as_ical()."\n";
- die if $p->as_ical() ne "19970101T180000Z/PT5H30M10S" ;
+ die if $p->as_ical() ne "19970101T180000Z/PT5H30M10S";
$p->duration(new Net::ICal::Duration("P10DT30M5S"));
print $p->as_ical()."\n";
- die if $p->as_ical() ne "19970101T180000Z/P10DT30M5S" ;
+ die if $p->as_ical() ne "19970101T180000Z/P10DT30M5S";
$p->end("19970101T183000Z");
print $p->as_ical()."\n";
- die if $p->as_ical() ne "19970101T180000Z/PT30M" ;
+ die if $p->as_ical() ne "19970101T180000Z/PT30M";
$p = new Net::ICal::Period("19970101T180000Z/19970102T070000Z");
$p->end("19970101T183000Z");
print $p->as_ical()."\n";
- die if $p->as_ical() ne "19970101T180000Z/19970101T183000Z" ;
+ die if $p->as_ical() ne "19970101T180000Z/19970101T183000Z";
$p->duration("P1DT1H10M");
print $p->as_ical()."\n";
- die if $p->as_ical() ne "19970101T180000Z/19970102T191000Z" ;
+ die if $p->as_ical() ne "19970101T180000Z/19970102T191000Z";
diff --git a/src/Net-ICal-Libical/lib/Net/ICal/Libical/Property.pm b/src/Net-ICal-Libical/lib/Net/ICal/Libical/Property.pm
index 16c987a6..c2cab511 100644
--- a/src/Net-ICal-Libical/lib/Net/ICal/Libical/Property.pm
+++ b/src/Net-ICal-Libical/lib/Net/ICal/Libical/Property.pm
@@ -3,18 +3,12 @@
# FILE: Property.pm
# CREATOR: eric 1 Mar 01
#
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
#======================================================================
use Net::ICal::Libical::Property;
diff --git a/src/Net-ICal-Libical/lib/Net/ICal/Libical/Time.pm b/src/Net-ICal-Libical/lib/Net/ICal/Libical/Time.pm
index 7302764d..5e744b2c 100644
--- a/src/Net-ICal-Libical/lib/Net/ICal/Libical/Time.pm
+++ b/src/Net-ICal-Libical/lib/Net/ICal/Libical/Time.pm
@@ -3,18 +3,12 @@
# FILE: Time.pm
# CREATOR: eric
#
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
#======================================================================
=pod
@@ -143,7 +137,7 @@ sub clone {
bless( {%$self},ref($self));
- $self->{'ref'} = Net::ICal::Libical::icalproperty_new_clone($self->{'ref'});
+ $self->{'ref'} = Net::ICal::Libical::icalproperty_clone($self->{'ref'});
}
diff --git a/src/Net-ICal-Libical/netical.i b/src/Net-ICal-Libical/netical.i
index e211ee88..7c469b8f 100644
--- a/src/Net-ICal-Libical/netical.i
+++ b/src/Net-ICal-Libical/netical.i
@@ -1,18 +1,9 @@
/*======================================================================
FILE: ical.i
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original author is Eric Busboom
@@ -39,7 +30,7 @@ icalcomponent* icalparser_parse_string(char* str);
icalcomponent* icalcomponent_new(icalcomponent_kind kind);
-icalcomponent* icalcomponent_new_clone(icalcomponent* component);
+icalcomponent* icalcomponent_clone(icalcomponent* component);
icalcomponent* icalcomponent_new_from_string(char* str);
char* icalcomponent_as_ical_string(icalcomponent* component);
@@ -119,7 +110,7 @@ typedef enum icalererorstate {
ICAL_ERROR_NONFATAL, /* Fatal */
ICAL_ERROR_DEFAULT, /* Use the value of icalerror_errors_are_fatal*/
ICAL_ERROR_UNKNOWN /* Asked state for an unknown error type */
-} icalerrorstate ;
+} icalerrorstate;
void icalerror_set_error_state( icalerrorenum error, icalerrorstate);
icalerrorstate icalerror_get_error_state( icalerrorenum error);
@@ -162,7 +153,7 @@ icalcomponent* icallangbind_get_next_component(icalcomponent *c,
/* Returns a string that can be evaluated in perl or python to
- generated a hash that holds the property's name, value and
+ generate a hash that holds the property's name, value and
parameters. Sep is the hash separation string, "=>" for perl and
":" for python */
const char* icallangbind_property_eval_string(icalproperty* prop, const char* sep);
diff --git a/src/Net-ICal-Libical/netical_wrap.c b/src/Net-ICal-Libical/netical_wrap.c
index a4baea5c..0f8c59c0 100644
--- a/src/Net-ICal-Libical/netical_wrap.c
+++ b/src/Net-ICal-Libical/netical_wrap.c
@@ -1,15 +1,15 @@
/*
* FILE : netical_wrap.c
- *
+ *
* This file was automatically generated by :
* Simplified Wrapper and Interface Generator (SWIG)
* Version 1.1 (Patch 5)
- *
+ *
* Portions Copyright (c) 1995-1998
* The University of Utah and The Regents of the University of California.
* Permission is granted to distribute this file in any manner provided
* this notice remains intact.
- *
+ *
* Do not make changes to this file--changes will be lost!
*
*/
@@ -53,7 +53,7 @@ extern "C" {
#ifdef PERL_OBJECT
#define MAGIC_PPERL CPerl *pPerl = (CPerl *) this;
#define MAGIC_CAST (int (CPerl::*)(SV *, MAGIC *))
-#define SWIGCLASS_STATIC
+#define SWIGCLASS_STATIC
#else
#define MAGIC_PPERL
#define MAGIC_CAST
@@ -75,16 +75,16 @@ extern "C" {
* original datatype and newtype is an equivalent type. cast is optional
* pointer to a function to cast pointer values between types (this
* is only used to cast pointers from derived classes to base classes in C++)
- *
+ *
* SWIG_MakePtr(char *buffer, void *ptr, char *typestring);
- *
+ *
* Makes a pointer string from a pointer and typestring. The result is returned
* in buffer.
*
* char * SWIG_GetPtr(SV *obj, void **ptr, char *type)
*
- * Gets a pointer value from a Perl5 scalar value. If there is a
- * type-mismatch, returns a character string to the received type.
+ * Gets a pointer value from a Perl5 scalar value. If there is a
+ * type-mismatch, returns a character string to the received type.
* On success, returns NULL.
*
*
@@ -143,7 +143,7 @@ static int SwigStart[256]; /* Table containing starting positions
#define SWIG_CACHESIZE 8
#define SWIG_CACHEMASK 0x7
-static SwigCacheType SwigCache[SWIG_CACHESIZE];
+static SwigCacheType SwigCache[SWIG_CACHESIZE];
static int SwigCacheIndex = 0;
static int SwigLastCache = 0;
@@ -164,7 +164,7 @@ static int swigcmp(const void *key, const void *data) {
/* Register a new datatype with the type-checker */
#ifndef PERL_OBJECT
-SWIGSTATIC
+SWIGSTATIC
void SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) {
#else
SWIGSTATIC
@@ -175,7 +175,7 @@ void _SWIG_RegisterMapping(CPerl *pPerl, char *origtype, char *newtype, void *(*
int i;
SwigPtrType *t = 0, *t1;
- if (!SwigPtrTable) {
+ if (!SwigPtrTable) {
SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
SwigPtrN = 0;
}
@@ -214,7 +214,7 @@ void _SWIG_RegisterMapping(CPerl *pPerl, char *origtype, char *newtype, void *(*
/* Make a pointer value string */
-SWIGSTATIC
+SWIGSTATIC
void SWIG_MakePtr(char *_c, const void *_ptr, char *type) {
static char _hex[16] =
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
@@ -241,12 +241,12 @@ void SWIG_MakePtr(char *_c, const void *_ptr, char *type) {
/* Define for backwards compatibility */
-#define _swig_make_hex SWIG_MakePtr
+#define _swig_make_hex SWIG_MakePtr
/* Function for getting a pointer value */
#ifndef PERL_OBJECT
-SWIGSTATIC
+SWIGSTATIC
char *SWIG_GetPtr(SV *sv, void **ptr, char *_t)
#else
SWIGSTATIC
@@ -294,7 +294,7 @@ char *_SWIG_GetPtr(CPerl *pPerl, SV *sv, void **ptr, char *_t)
return (char *) 0;
} else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
*(ptr) = (void *) 0;
- if (!SvROK(sv))
+ if (!SvROK(sv))
return (char *) 0;
else
return "Not a valid pointer value";
@@ -303,12 +303,12 @@ char *_SWIG_GetPtr(CPerl *pPerl, SV *sv, void **ptr, char *_t)
return "Not a valid pointer value";
}
if (_t) {
- /* Now see if the types match */
+ /* Now see if the types match */
if (!sv_isa(sv,_t)) {
_c = HvNAME(SvSTASH(SvRV(sv)));
if (!SwigPtrSort) {
- qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort);
+ qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort);
for (i = 0; i < 256; i++) {
SwigStart[i] = SwigPtrN;
}
@@ -320,7 +320,7 @@ char *_SWIG_GetPtr(CPerl *pPerl, SV *sv, void **ptr, char *_t)
SwigStart[i-1] = SwigStart[i];
}
SwigPtrSort = 1;
- for (i = 0; i < SWIG_CACHESIZE; i++)
+ for (i = 0; i < SWIG_CACHESIZE; i++)
SwigCache[i].stat = 0;
}
/* First check cache for matches. Uses last cache value as starting point */
@@ -374,12 +374,12 @@ char *_SWIG_GetPtr(CPerl *pPerl, SV *sv, void **ptr, char *_t)
return (char *) 0;
}
tp = tp->next;
- }
+ }
/* Hmmm. Didn't find it this time */
sp++;
}
}
- /* Didn't find any sort of match for this data.
+ /* Didn't find any sort of match for this data.
Get the pointer value and return the received type */
*ptr = (void *) tmp;
return _c;
@@ -388,7 +388,7 @@ char *_SWIG_GetPtr(CPerl *pPerl, SV *sv, void **ptr, char *_t)
*ptr = (void *) tmp;
return (char *) 0;
}
- }
+ }
*ptr = (void *) tmp;
return (char *) 0;
}
@@ -435,12 +435,12 @@ SWIGEXPORT(void,boot_Net__ICal__Libical)(CPerl *, CV *cv);
#ifndef PERL_OBJECT
#define swig_setiv(a,b) _swig_setiv(a,b)
-static void _swig_setiv(char *name, long value) {
+static void _swig_setiv(char *name, long value) {
#else
#define swig_setiv(a,b) _swig_setiv(pPerl,a,b)
-static void _swig_setiv(CPerl *pPerl, char *name, long value) {
+static void _swig_setiv(CPerl *pPerl, char *name, long value) {
#endif
- SV *sv;
+ SV *sv;
sv = perl_get_sv(name,TRUE | 0x2);
sv_setiv(sv, (IV) value);
SvREADONLY_on(sv);
@@ -448,12 +448,12 @@ static void _swig_setiv(CPerl *pPerl, char *name, long value) {
#ifndef PERL_OBJECT
#define swig_setpv(a,b) _swig_setpv(a,b)
-static void _swig_setpv(char *name, char *value) {
+static void _swig_setpv(char *name, char *value) {
#else
#define swig_setpv(a,b) _swig_setpv(pPerl,a,b)
-static void _swig_setpv(CPerl *pPerl, char *name, char *value) {
+static void _swig_setpv(CPerl *pPerl, char *name, char *value) {
#endif
- SV *sv;
+ SV *sv;
sv = perl_get_sv(name,TRUE | 0x2);
sv_setpv(sv, value);
SvREADONLY_on(sv);
@@ -483,10 +483,10 @@ XS(_wrap_icalparser_parse_string) {
icalcomponent * _result;
char * _arg0;
int argvi = 0;
- dXSARGS ;
+ dXSARGS;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalparser_parse_string(str);");
_arg0 = (char *) SvPV(ST(0),na);
_result = (icalcomponent *)icalparser_parse_string(_arg0);
@@ -503,7 +503,7 @@ XS(_wrap_icalcomponent_new) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalcomponent_new(kind);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"icalcomponent_kindPtr")) {
croak("Type error in argument 1 of icalcomponent_new. Expected icalcomponent_kindPtr.");
@@ -515,7 +515,7 @@ XS(_wrap_icalcomponent_new) {
XSRETURN(argvi);
}
-XS(_wrap_icalcomponent_new_clone) {
+XS(_wrap_icalcomponent_clone) {
icalcomponent * _result;
icalcomponent * _arg0;
@@ -523,13 +523,13 @@ XS(_wrap_icalcomponent_new_clone) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
- croak("Usage: icalcomponent_new_clone(component);");
+ if ((items < 1) || (items > 1))
+ croak("Usage: icalcomponent_clone(component);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
- croak("Type error in argument 1 of icalcomponent_new_clone. Expected icalcomponentPtr.");
+ croak("Type error in argument 1 of icalcomponent_clone. Expected icalcomponentPtr.");
XSRETURN(1);
}
- _result = (icalcomponent *)icalcomponent_new_clone(_arg0);
+ _result = (icalcomponent *)icalcomponent_clone(_arg0);
ST(argvi) = sv_newmortal();
sv_setref_pv(ST(argvi++),"icalcomponentPtr", (void *) _result);
XSRETURN(argvi);
@@ -543,7 +543,7 @@ XS(_wrap_icalcomponent_new_from_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalcomponent_new_from_string(str);");
_arg0 = (char *) SvPV(ST(0),na);
_result = (icalcomponent *)icalcomponent_new_from_string(_arg0);
@@ -560,7 +560,7 @@ XS(_wrap_icalcomponent_as_ical_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalcomponent_as_ical_string(component);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_as_ical_string. Expected icalcomponentPtr.");
@@ -579,7 +579,7 @@ XS(_wrap_icalcomponent_free) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalcomponent_free(component);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_free. Expected icalcomponentPtr.");
@@ -597,7 +597,7 @@ XS(_wrap_icalcomponent_count_errors) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalcomponent_count_errors(component);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_count_errors. Expected icalcomponentPtr.");
@@ -616,7 +616,7 @@ XS(_wrap_icalcomponent_strip_errors) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalcomponent_strip_errors(component);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_strip_errors. Expected icalcomponentPtr.");
@@ -633,7 +633,7 @@ XS(_wrap_icalcomponent_convert_errors) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalcomponent_convert_errors(component);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_convert_errors. Expected icalcomponentPtr.");
@@ -651,7 +651,7 @@ XS(_wrap_icalcomponent_get_current_property) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalcomponent_get_current_property(component);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_get_current_property. Expected icalcomponentPtr.");
@@ -672,7 +672,7 @@ XS(_wrap_icalcomponent_get_first_property) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icalcomponent_get_first_property(component,kind);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_get_first_property. Expected icalcomponentPtr.");
@@ -697,7 +697,7 @@ XS(_wrap_icalcomponent_get_next_property) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icalcomponent_get_next_property(component,kind);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_get_next_property. Expected icalcomponentPtr.");
@@ -721,7 +721,7 @@ XS(_wrap_icalcomponent_get_current_component) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalcomponent_get_current_component(component);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_get_current_component. Expected icalcomponentPtr.");
@@ -742,7 +742,7 @@ XS(_wrap_icalcomponent_get_first_component) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icalcomponent_get_first_component(component,kind);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_get_first_component. Expected icalcomponentPtr.");
@@ -767,7 +767,7 @@ XS(_wrap_icalcomponent_get_next_component) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icalcomponent_get_next_component(component,kind);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_get_next_component. Expected icalcomponentPtr.");
@@ -791,7 +791,7 @@ XS(_wrap_icalcomponent_add_property) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icalcomponent_add_property(component,property);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_add_property. Expected icalcomponentPtr.");
@@ -813,7 +813,7 @@ XS(_wrap_icalcomponent_remove_property) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icalcomponent_remove_property(component,property);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_remove_property. Expected icalcomponentPtr.");
@@ -835,7 +835,7 @@ XS(_wrap_icalcomponent_get_parent) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalcomponent_get_parent(component);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_get_parent. Expected icalcomponentPtr.");
@@ -855,7 +855,7 @@ XS(_wrap_icalcomponent_isa) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalcomponent_isa(component);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalcomponent_isa. Expected icalcomponentPtr.");
@@ -876,7 +876,7 @@ XS(_wrap_icalrestriction_check) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalrestriction_check(comp);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalrestriction_check. Expected icalcomponentPtr.");
@@ -896,7 +896,7 @@ XS(_wrap_icalproperty_string_to_kind) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalproperty_string_to_kind(string);");
_arg0 = (char *) SvPV(ST(0),na);
_result = (int )icalproperty_string_to_kind(_arg0);
@@ -913,7 +913,7 @@ XS(_wrap_icalproperty_new) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalproperty_new(kind);");
_arg0 = (int )SvIV(ST(0));
_result = (icalproperty *)icalproperty_new(_arg0);
@@ -930,7 +930,7 @@ XS(_wrap_icalproperty_new_from_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalproperty_new_from_string(str);");
_arg0 = (char *) SvPV(ST(0),na);
_result = (icalproperty *)icalproperty_new_from_string(_arg0);
@@ -947,7 +947,7 @@ XS(_wrap_icalproperty_as_ical_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalproperty_as_ical_string(prop);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalproperty_as_ical_string. Expected icalpropertyPtr.");
@@ -968,7 +968,7 @@ XS(_wrap_icalproperty_set_parameter_from_string) {
dXSARGS ;
cv = cv;
- if ((items < 3) || (items > 3))
+ if ((items < 3) || (items > 3))
croak("Usage: icalproperty_set_parameter_from_string(prop,name,value);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalproperty_set_parameter_from_string. Expected icalpropertyPtr.");
@@ -989,7 +989,7 @@ XS(_wrap_icalproperty_set_value_from_string) {
dXSARGS ;
cv = cv;
- if ((items < 3) || (items > 3))
+ if ((items < 3) || (items > 3))
croak("Usage: icalproperty_set_value_from_string(prop,value,kind);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalproperty_set_value_from_string. Expected icalpropertyPtr.");
@@ -1009,7 +1009,7 @@ XS(_wrap_icalproperty_get_value_as_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalproperty_get_value_as_string(prop);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalproperty_get_value_as_string. Expected icalpropertyPtr.");
@@ -1030,7 +1030,7 @@ XS(_wrap_icalproperty_get_parameter_as_string) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icalproperty_get_parameter_as_string(prop,name);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalproperty_get_parameter_as_string. Expected icalpropertyPtr.");
@@ -1051,7 +1051,7 @@ XS(_wrap_icalproperty_get_parent) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalproperty_get_parent(property);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icalproperty_get_parent. Expected icalpropertyPtr.");
@@ -1071,7 +1071,7 @@ XS(_wrap_icalerror_set_error_state) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icalerror_set_error_state(error,icalerrorstate );");
_arg0 = (icalerrorenum )SvIV(ST(0));
_arg1 = (icalerrorstate )SvIV(ST(1));
@@ -1087,7 +1087,7 @@ XS(_wrap_icalerror_get_error_state) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalerror_get_error_state(error);");
_arg0 = (icalerrorenum )SvIV(ST(0));
_result = (icalerrorstate )icalerror_get_error_state(_arg0);
@@ -1104,7 +1104,7 @@ XS(_wrap_icalenum_property_kind_to_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalenum_property_kind_to_string(kind);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"icalproperty_kindPtr")) {
croak("Type error in argument 1 of icalenum_property_kind_to_string. Expected icalproperty_kindPtr.");
@@ -1124,7 +1124,7 @@ XS(_wrap_icalenum_string_to_property_kind) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalenum_string_to_property_kind(string);");
_arg0 = (char *) SvPV(ST(0),na);
_result = (icalproperty_kind *) malloc(sizeof(icalproperty_kind ));
@@ -1142,7 +1142,7 @@ XS(_wrap_icalenum_value_kind_to_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalenum_value_kind_to_string(kind);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"icalvalue_kindPtr")) {
croak("Type error in argument 1 of icalenum_value_kind_to_string. Expected icalvalue_kindPtr.");
@@ -1162,7 +1162,7 @@ XS(_wrap_icalenum_parameter_kind_to_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalenum_parameter_kind_to_string(kind);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"icalparameter_kindPtr")) {
croak("Type error in argument 1 of icalenum_parameter_kind_to_string. Expected icalparameter_kindPtr.");
@@ -1182,7 +1182,7 @@ XS(_wrap_icalenum_string_to_parameter_kind) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalenum_string_to_parameter_kind(string);");
_arg0 = (char *) SvPV(ST(0),na);
_result = (icalparameter_kind *) malloc(sizeof(icalparameter_kind ));
@@ -1200,7 +1200,7 @@ XS(_wrap_icalenum_component_kind_to_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalenum_component_kind_to_string(kind);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"icalcomponent_kindPtr")) {
croak("Type error in argument 1 of icalenum_component_kind_to_string. Expected icalcomponent_kindPtr.");
@@ -1220,7 +1220,7 @@ XS(_wrap_icalenum_string_to_component_kind) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalenum_string_to_component_kind(string);");
_arg0 = (char *) SvPV(ST(0),na);
_result = (icalcomponent_kind *) malloc(sizeof(icalcomponent_kind ));
@@ -1238,7 +1238,7 @@ XS(_wrap_icalenum_property_kind_to_value_kind) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalenum_property_kind_to_value_kind(kind);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"icalproperty_kindPtr")) {
croak("Type error in argument 1 of icalenum_property_kind_to_value_kind. Expected icalproperty_kindPtr.");
@@ -1259,7 +1259,7 @@ XS(_wrap_icallangbind_new_array) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icallangbind_new_array(size);");
_arg0 = (int )SvIV(ST(0));
_result = (int *)icallangbind_new_array(_arg0);
@@ -1275,7 +1275,7 @@ XS(_wrap_icallangbind_free_array) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icallangbind_free_array(array);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"intPtr")) {
croak("Type error in argument 1 of icallangbind_free_array. Expected intPtr.");
@@ -1294,7 +1294,7 @@ XS(_wrap_icallangbind_access_array) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icallangbind_access_array(array,index);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"intPtr")) {
croak("Type error in argument 1 of icallangbind_access_array. Expected intPtr.");
@@ -1318,7 +1318,7 @@ XS(_wrap_icalrecur_expand_recurrence) {
dXSARGS ;
cv = cv;
- if ((items < 4) || (items > 4))
+ if ((items < 4) || (items > 4))
croak("Usage: icalrecur_expand_recurrence(rule,start,count,array);");
_arg0 = (char *) SvPV(ST(0),na);
_arg1 = (int )SvIV(ST(1));
@@ -1342,7 +1342,7 @@ XS(_wrap_icallangbind_get_first_property) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icallangbind_get_first_property(c,prop);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icallangbind_get_first_property. Expected icalcomponentPtr.");
@@ -1364,7 +1364,7 @@ XS(_wrap_icallangbind_get_next_property) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icallangbind_get_next_property(c,prop);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icallangbind_get_next_property. Expected icalcomponentPtr.");
@@ -1386,7 +1386,7 @@ XS(_wrap_icallangbind_get_first_component) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icallangbind_get_first_component(c,comp);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icallangbind_get_first_component. Expected icalcomponentPtr.");
@@ -1408,7 +1408,7 @@ XS(_wrap_icallangbind_get_next_component) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icallangbind_get_next_component(c,comp);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icallangbind_get_next_component. Expected icalcomponentPtr.");
@@ -1430,7 +1430,7 @@ XS(_wrap_icallangbind_property_eval_string) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icallangbind_property_eval_string(prop,sep);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,(char *) 0 )) {
croak("Type error in argument 1 of icallangbind_property_eval_string. Expected icalpropertyPtr.");
@@ -1452,7 +1452,7 @@ XS(_wrap_icaltime_from_timet) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltime_from_timet(v,is_date);");
_arg0 = (int )SvIV(ST(0));
_arg1 = (int )SvIV(ST(1));
@@ -1471,7 +1471,7 @@ XS(_wrap_icaltime_as_timet) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltime_as_timet(struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_as_timet. Expected struct icaltimetypePtr.");
@@ -1491,7 +1491,7 @@ XS(_wrap_icaltime_as_ical_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltime_as_ical_string(tt);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_as_ical_string. Expected struct icaltimetypePtr.");
@@ -1511,7 +1511,7 @@ XS(_wrap_icaltime_from_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltime_from_string(str);");
_arg0 = (char *) SvPV(ST(0),na);
_result = (struct icaltimetype *) malloc(sizeof(struct icaltimetype ));
@@ -1530,7 +1530,7 @@ XS(_wrap_icaltime_utc_offset) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltime_utc_offset(tt,tzid);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_utc_offset. Expected struct icaltimetypePtr.");
@@ -1552,7 +1552,7 @@ XS(_wrap_icaltime_as_utc) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltime_as_utc(tt,tzid);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_as_utc. Expected struct icaltimetypePtr.");
@@ -1575,7 +1575,7 @@ XS(_wrap_icaltime_as_zone) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltime_as_zone(tt,tzid);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_as_zone. Expected struct icaltimetypePtr.");
@@ -1596,7 +1596,7 @@ XS(_wrap_icaltime_null_time) {
dXSARGS ;
cv = cv;
- if ((items < 0) || (items > 0))
+ if ((items < 0) || (items > 0))
croak("Usage: icaltime_null_time();");
_result = (struct icaltimetype *) malloc(sizeof(struct icaltimetype ));
*(_result) = icaltime_null_time();
@@ -1613,7 +1613,7 @@ XS(_wrap_icaltime_is_null_time) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltime_is_null_time(t);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_is_null_time. Expected struct icaltimetypePtr.");
@@ -1633,7 +1633,7 @@ XS(_wrap_icaltime_is_valid_time) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltime_is_valid_time(t);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_is_valid_time. Expected struct icaltimetypePtr.");
@@ -1653,7 +1653,7 @@ XS(_wrap_icaltime_normalize) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltime_normalize(t);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_normalize. Expected struct icaltimetypePtr.");
@@ -1674,7 +1674,7 @@ XS(_wrap_icaltime_day_of_year) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltime_day_of_year(t);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_day_of_year. Expected struct icaltimetypePtr.");
@@ -1695,7 +1695,7 @@ XS(_wrap_icaltime_from_day_of_year) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltime_from_day_of_year(doy,year);");
_arg0 = (short )SvIV(ST(0));
_arg1 = (short )SvIV(ST(1));
@@ -1714,7 +1714,7 @@ XS(_wrap_icaltime_day_of_week) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltime_day_of_week(t);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_day_of_week. Expected struct icaltimetypePtr.");
@@ -1734,7 +1734,7 @@ XS(_wrap_icaltime_start_doy_of_week) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltime_start_doy_of_week(t);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_start_doy_of_week. Expected struct icaltimetypePtr.");
@@ -1754,7 +1754,7 @@ XS(_wrap_icaltime_as_ctime) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltime_as_ctime(struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_as_ctime. Expected struct icaltimetypePtr.");
@@ -1774,7 +1774,7 @@ XS(_wrap_icaltime_week_number) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltime_week_number(t);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_week_number. Expected struct icaltimetypePtr.");
@@ -1795,7 +1795,7 @@ XS(_wrap_icaltime_compare) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltime_compare(a,b);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_compare. Expected struct icaltimetypePtr.");
@@ -1820,7 +1820,7 @@ XS(_wrap_icaltime_compare_date_only) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltime_compare_date_only(a,b);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_compare_date_only. Expected struct icaltimetypePtr.");
@@ -1845,7 +1845,7 @@ XS(_wrap_icaltime_days_in_month) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltime_days_in_month(month,year);");
_arg0 = (short )SvIV(ST(0));
_arg1 = (short )SvIV(ST(1));
@@ -1863,7 +1863,7 @@ XS(_wrap_icaldurationtype_from_int) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaldurationtype_from_int(t);");
_arg0 = (int )SvIV(ST(0));
_result = (struct icaldurationtype *) malloc(sizeof(struct icaldurationtype ));
@@ -1881,7 +1881,7 @@ XS(_wrap_icaldurationtype_from_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaldurationtype_from_string(char *);");
_arg0 = (char *) SvPV(ST(0),na);
_result = (struct icaldurationtype *) malloc(sizeof(struct icaldurationtype ));
@@ -1899,7 +1899,7 @@ XS(_wrap_icaldurationtype_as_int) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaldurationtype_as_int(duration);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_as_int. Expected struct icaldurationtypePtr.");
@@ -1919,7 +1919,7 @@ XS(_wrap_icaldurationtype_as_ical_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaldurationtype_as_ical_string(d);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_as_ical_string. Expected struct icaldurationtypePtr.");
@@ -1938,7 +1938,7 @@ XS(_wrap_icaldurationtype_null_duration) {
dXSARGS ;
cv = cv;
- if ((items < 0) || (items > 0))
+ if ((items < 0) || (items > 0))
croak("Usage: icaldurationtype_null_duration();");
_result = (struct icaldurationtype *) malloc(sizeof(struct icaldurationtype ));
*(_result) = icaldurationtype_null_duration();
@@ -1955,7 +1955,7 @@ XS(_wrap_icaldurationtype_is_null_duration) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaldurationtype_is_null_duration(d);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_is_null_duration. Expected struct icaldurationtypePtr.");
@@ -1976,7 +1976,7 @@ XS(_wrap_icaltime_add) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltime_add(t,d);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_add. Expected struct icaltimetypePtr.");
@@ -2002,7 +2002,7 @@ XS(_wrap_icaltime_subtract) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltime_subtract(t1,t2);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltime_subtract. Expected struct icaltimetypePtr.");
@@ -2027,7 +2027,7 @@ XS(_wrap_icalperiodtype_from_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalperiodtype_from_string(str);");
_arg0 = (char *) SvPV(ST(0),na);
_result = (struct icalperiodtype *) malloc(sizeof(struct icalperiodtype ));
@@ -2045,7 +2045,7 @@ XS(_wrap_icalperiodtype_as_ical_string) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalperiodtype_as_ical_string(p);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icalperiodtypePtr")) {
croak("Type error in argument 1 of icalperiodtype_as_ical_string. Expected struct icalperiodtypePtr.");
@@ -2064,7 +2064,7 @@ XS(_wrap_icalperiodtype_null_period) {
dXSARGS ;
cv = cv;
- if ((items < 0) || (items > 0))
+ if ((items < 0) || (items > 0))
croak("Usage: icalperiodtype_null_period();");
_result = (struct icalperiodtype *) malloc(sizeof(struct icalperiodtype ));
*(_result) = icalperiodtype_null_period();
@@ -2081,7 +2081,7 @@ XS(_wrap_icalperiodtype_is_null_period) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalperiodtype_is_null_period(p);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icalperiodtypePtr")) {
croak("Type error in argument 1 of icalperiodtype_is_null_period. Expected struct icalperiodtypePtr.");
@@ -2101,7 +2101,7 @@ XS(_wrap_icalperiodtype_is_valid_period) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalperiodtype_is_valid_period(p);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icalperiodtypePtr")) {
croak("Type error in argument 1 of icalperiodtype_is_valid_period. Expected struct icalperiodtypePtr.");
@@ -2123,7 +2123,7 @@ XS(_wrap_icaltimetype_year_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltimetype_year_set(struct icaltimetype *,int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_year_set. Expected struct icaltimetypePtr.");
@@ -2145,7 +2145,7 @@ XS(_wrap_icaltimetype_year_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltimetype_year_get(struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_year_get. Expected struct icaltimetypePtr.");
@@ -2167,7 +2167,7 @@ XS(_wrap_icaltimetype_month_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltimetype_month_set(struct icaltimetype *,int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_month_set. Expected struct icaltimetypePtr.");
@@ -2189,7 +2189,7 @@ XS(_wrap_icaltimetype_month_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltimetype_month_get(struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_month_get. Expected struct icaltimetypePtr.");
@@ -2211,7 +2211,7 @@ XS(_wrap_icaltimetype_day_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltimetype_day_set(struct icaltimetype *,int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_day_set. Expected struct icaltimetypePtr.");
@@ -2233,7 +2233,7 @@ XS(_wrap_icaltimetype_day_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltimetype_day_get(struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_day_get. Expected struct icaltimetypePtr.");
@@ -2255,7 +2255,7 @@ XS(_wrap_icaltimetype_hour_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltimetype_hour_set(struct icaltimetype *,int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_hour_set. Expected struct icaltimetypePtr.");
@@ -2277,7 +2277,7 @@ XS(_wrap_icaltimetype_hour_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltimetype_hour_get(struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_hour_get. Expected struct icaltimetypePtr.");
@@ -2299,7 +2299,7 @@ XS(_wrap_icaltimetype_minute_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltimetype_minute_set(struct icaltimetype *,int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_minute_set. Expected struct icaltimetypePtr.");
@@ -2321,7 +2321,7 @@ XS(_wrap_icaltimetype_minute_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltimetype_minute_get(struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_minute_get. Expected struct icaltimetypePtr.");
@@ -2343,7 +2343,7 @@ XS(_wrap_icaltimetype_second_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltimetype_second_set(struct icaltimetype *,int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_second_set. Expected struct icaltimetypePtr.");
@@ -2365,7 +2365,7 @@ XS(_wrap_icaltimetype_second_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltimetype_second_get(struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_second_get. Expected struct icaltimetypePtr.");
@@ -2387,7 +2387,7 @@ XS(_wrap_icaltimetype_is_utc_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltimetype_is_utc_set(struct icaltimetype *,int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_is_utc_set. Expected struct icaltimetypePtr.");
@@ -2409,7 +2409,7 @@ XS(_wrap_icaltimetype_is_utc_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltimetype_is_utc_get(struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_is_utc_get. Expected struct icaltimetypePtr.");
@@ -2431,7 +2431,7 @@ XS(_wrap_icaltimetype_is_date_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaltimetype_is_date_set(struct icaltimetype *,int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_is_date_set. Expected struct icaltimetypePtr.");
@@ -2453,7 +2453,7 @@ XS(_wrap_icaltimetype_is_date_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaltimetype_is_date_get(struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaltimetypePtr")) {
croak("Type error in argument 1 of icaltimetype_is_date_get. Expected struct icaltimetypePtr.");
@@ -2475,7 +2475,7 @@ XS(_wrap_icaldurationtype_is_neg_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaldurationtype_is_neg_set(struct icaldurationtype *,int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_is_neg_set. Expected struct icaldurationtypePtr.");
@@ -2497,7 +2497,7 @@ XS(_wrap_icaldurationtype_is_neg_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaldurationtype_is_neg_get(struct icaldurationtype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_is_neg_get. Expected struct icaldurationtypePtr.");
@@ -2519,7 +2519,7 @@ XS(_wrap_icaldurationtype_days_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaldurationtype_days_set(struct icaldurationtype *,unsigned int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_days_set. Expected struct icaldurationtypePtr.");
@@ -2541,7 +2541,7 @@ XS(_wrap_icaldurationtype_days_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaldurationtype_days_get(struct icaldurationtype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_days_get. Expected struct icaldurationtypePtr.");
@@ -2563,7 +2563,7 @@ XS(_wrap_icaldurationtype_weeks_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaldurationtype_weeks_set(struct icaldurationtype *,unsigned int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_weeks_set. Expected struct icaldurationtypePtr.");
@@ -2585,7 +2585,7 @@ XS(_wrap_icaldurationtype_weeks_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaldurationtype_weeks_get(struct icaldurationtype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_weeks_get. Expected struct icaldurationtypePtr.");
@@ -2607,7 +2607,7 @@ XS(_wrap_icaldurationtype_hours_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaldurationtype_hours_set(struct icaldurationtype *,unsigned int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_hours_set. Expected struct icaldurationtypePtr.");
@@ -2629,7 +2629,7 @@ XS(_wrap_icaldurationtype_hours_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaldurationtype_hours_get(struct icaldurationtype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_hours_get. Expected struct icaldurationtypePtr.");
@@ -2651,7 +2651,7 @@ XS(_wrap_icaldurationtype_minutes_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaldurationtype_minutes_set(struct icaldurationtype *,unsigned int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_minutes_set. Expected struct icaldurationtypePtr.");
@@ -2673,7 +2673,7 @@ XS(_wrap_icaldurationtype_minutes_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaldurationtype_minutes_get(struct icaldurationtype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_minutes_get. Expected struct icaldurationtypePtr.");
@@ -2695,7 +2695,7 @@ XS(_wrap_icaldurationtype_seconds_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icaldurationtype_seconds_set(struct icaldurationtype *,unsigned int );");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_seconds_set. Expected struct icaldurationtypePtr.");
@@ -2717,7 +2717,7 @@ XS(_wrap_icaldurationtype_seconds_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icaldurationtype_seconds_get(struct icaldurationtype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icaldurationtypePtr")) {
croak("Type error in argument 1 of icaldurationtype_seconds_get. Expected struct icaldurationtypePtr.");
@@ -2739,7 +2739,7 @@ XS(_wrap_icalperiodtype_start_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icalperiodtype_start_set(struct icalperiodtype *,struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icalperiodtypePtr")) {
croak("Type error in argument 1 of icalperiodtype_start_set. Expected struct icalperiodtypePtr.");
@@ -2764,7 +2764,7 @@ XS(_wrap_icalperiodtype_start_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalperiodtype_start_get(struct icalperiodtype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icalperiodtypePtr")) {
croak("Type error in argument 1 of icalperiodtype_start_get. Expected struct icalperiodtypePtr.");
@@ -2786,7 +2786,7 @@ XS(_wrap_icalperiodtype_end_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icalperiodtype_end_set(struct icalperiodtype *,struct icaltimetype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icalperiodtypePtr")) {
croak("Type error in argument 1 of icalperiodtype_end_set. Expected struct icalperiodtypePtr.");
@@ -2811,7 +2811,7 @@ XS(_wrap_icalperiodtype_end_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalperiodtype_end_get(struct icalperiodtype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icalperiodtypePtr")) {
croak("Type error in argument 1 of icalperiodtype_end_get. Expected struct icalperiodtypePtr.");
@@ -2833,7 +2833,7 @@ XS(_wrap_icalperiodtype_duration_set) {
dXSARGS ;
cv = cv;
- if ((items < 2) || (items > 2))
+ if ((items < 2) || (items > 2))
croak("Usage: icalperiodtype_duration_set(struct icalperiodtype *,struct icaldurationtype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icalperiodtypePtr")) {
croak("Type error in argument 1 of icalperiodtype_duration_set. Expected struct icalperiodtypePtr.");
@@ -2858,7 +2858,7 @@ XS(_wrap_icalperiodtype_duration_get) {
dXSARGS ;
cv = cv;
- if ((items < 1) || (items > 1))
+ if ((items < 1) || (items > 1))
croak("Usage: icalperiodtype_duration_get(struct icalperiodtype *);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"struct icalperiodtypePtr")) {
croak("Type error in argument 1 of icalperiodtype_duration_get. Expected struct icalperiodtypePtr.");
@@ -2901,7 +2901,8 @@ XS(boot_Net__ICal__Libical) {
newXS("Net::ICal::Libical::var_Net__ICal__Libical_init", _wrap_perl5_Net__ICal__Libical_var_init, file);
newXS("Net::ICal::Libical::icalparser_parse_string", _wrap_icalparser_parse_string, file);
newXS("Net::ICal::Libical::icalcomponent_new", _wrap_icalcomponent_new, file);
- newXS("Net::ICal::Libical::icalcomponent_new_clone", _wrap_icalcomponent_new_clone, file);
+ newXS("Net::ICal::Libical::icalcomponent_new_clone", _wrap_icalcomponent_clone, file);
+ newXS("Net::ICal::Libical::icalcomponent_clone", _wrap_icalcomponent_clone, file);
newXS("Net::ICal::Libical::icalcomponent_new_from_string", _wrap_icalcomponent_new_from_string, file);
newXS("Net::ICal::Libical::icalcomponent_as_ical_string", _wrap_icalcomponent_as_ical_string, file);
newXS("Net::ICal::Libical::icalcomponent_free", _wrap_icalcomponent_free, file);
@@ -3015,7 +3016,7 @@ XS(boot_Net__ICal__Libical) {
newXS("Net::ICal::Libical::icalperiodtype_duration_set", _wrap_icalperiodtype_duration_set, file);
newXS("Net::ICal::Libical::icalperiodtype_duration_get", _wrap_icalperiodtype_duration_get, file);
/*
- * These are the pointer type-equivalency mappings.
+ * These are the pointer type-equivalency mappings.
* (Used by the SWIG pointer type-checker).
*/
SWIG_RegisterMapping("unsigned short","short",0);
diff --git a/src/Net-ICal-Libical/netical_wrap.doc b/src/Net-ICal-Libical/netical_wrap.doc
index 41616c00..9d2b7218 100644
--- a/src/Net-ICal-Libical/netical_wrap.doc
+++ b/src/Net-ICal-Libical/netical_wrap.doc
@@ -9,7 +9,7 @@ icalparser_parse_string(str);
icalcomponent_new(kind);
[ returns icalcomponent * ]
-icalcomponent_new_clone(component);
+icalcomponent_clone(component);
[ returns icalcomponent * ]
icalcomponent_new_from_string(str);
@@ -104,7 +104,7 @@ $ICAL_PARSE_ERROR = ICAL_PARSE_ERROR
$ICAL_INTERNAL_ERROR = ICAL_INTERNAL_ERROR
[ Constant: int ]
- Like assert --internal consist. prob
+ Like assert --internal consist. prob
$ICAL_FILE_ERROR = ICAL_FILE_ERROR
[ Constant: int ]
@@ -117,23 +117,23 @@ $ICAL_USAGE_ERROR = ICAL_USAGE_ERROR
$ICAL_NO_ERROR = ICAL_NO_ERROR
[ Constant: int ]
- Used for problems in input to icalerror_strerror()
+ Used for problems in input to icalerror_strerror()
$ICAL_UNKNOWN_ERROR = ICAL_UNKNOWN_ERROR
[ Constant: int ]
$ICAL_ERROR_FATAL = ICAL_ERROR_FATAL
[ Constant: int ]
- Not fata
+ Not fata
$ICAL_ERROR_NONFATAL = ICAL_ERROR_NONFATAL
[ Constant: int ]
- Fatal
+ Fatal
$ICAL_ERROR_DEFAULT = ICAL_ERROR_DEFAULT
[ Constant: int ]
Use the value of icalerror_errors_are_fatal Asked state for an unknown
- error type
+ error type
$ICAL_ERROR_UNKNOWN = ICAL_ERROR_UNKNOWN
[ Constant: int ]
@@ -153,7 +153,7 @@ icalenum_string_to_property_kind(string);
icalenum_value_kind_to_string(kind);
[ returns char * ]
icalvalue_kind icalenum_value_kind_by_prop(icalproperty_kind kind);
-
+
icalenum_parameter_kind_to_string(kind);
[ returns char * ]
@@ -229,16 +229,16 @@ icaltimetype_second_get(struct icaltimetype *);
icaltimetype_is_utc_set(struct icaltimetype *,int );
icaltimetype_is_utc_get(struct icaltimetype *);
[ Member data: returns int ]
- 1-> time is in UTC timezone
+ 1-> time is in UTC timezone
icaltimetype_is_date_set(struct icaltimetype *,int );
icaltimetype_is_date_get(struct icaltimetype *);
[ Member data: returns int ]
- 1 -> interpret this as date.
+ 1 -> interpret this as date.
$icaltimetype_zone = icaltimetype::zone
[ Constant: char * ]
- Ptr to Olsen placename. Libical does not own mem
+ Ptr to Olsen placename. Libical does not own mem
----------
@@ -390,4 +390,3 @@ icalperiodtype_is_null_period(p);
icalperiodtype_is_valid_period(p);
[ returns int ]
-
diff --git a/src/Net-ICal-Libical/test-data/2446.mime b/src/Net-ICal-Libical/test-data/2446.mime
index 2e74cfe5..3afb13aa 100644
--- a/src/Net-ICal-Libical/test-data/2446.mime
+++ b/src/Net-ICal-Libical/test-data/2446.mime
@@ -182,7 +182,7 @@ DTSTART
:19671029T020000
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'FREQ=YEARLY\;BYDAY=-1SU\;BYMONTH=10'
TZOFFSETFROM
:-050000
@@ -196,7 +196,7 @@ DTSTART
:19870405T020000
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'FREQ=YEARLY\;BYDAY=1SU\;BYMONTH=4'
TZOFFSETFROM
:-060000
@@ -305,7 +305,7 @@ DTSTART
:19970714
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'FREQ=YEARLY\;INTERVAL=1'
SUMMARY
: Bastille Day
@@ -665,7 +665,7 @@ SUMMARY
LOCATION
:Green Conference Room
COMMENT
- :This time works much better and I think the big conference room is
+ :This time works much better and I think the big conference room is
too big
UID
:calsrv.example.com-873970198738777a@example.com
@@ -1140,7 +1140,7 @@ X-LIC-ERROR
;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR
:Can't parse parameter name: 'TYPE=INDIVIDUAL'
COMMENT
- :Mr. B cannot attend. It's raining. Let's cancel.
+ :Mr. B cannot attend. It's raining. Lets cancel.
UID
:calsrv.example.com-873970198738777@example.com
SEQUENCE
@@ -1334,7 +1334,7 @@ DTEND
:19970701T203000Z
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'FREQ=WEEKLY'
SUMMARY
:Phone Conference
@@ -1503,7 +1503,7 @@ UID
:calsrv.example.com-873970198738777@example.com
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as PERIOD value in FREEBUSY property. Removing entire
+ :Can't parse as PERIOD value in FREEBUSY property. Removing entire
property: '19970701T090000Z/PT1H'
DTSTAMP
:19970613T190030Z
@@ -1552,7 +1552,7 @@ DTSTART
:19671029T020000
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'FREQ=YEARLY\;BYDAY=-1SU\;BYMONTH=10'
TZOFFSETFROM
:-070000
@@ -1566,7 +1566,7 @@ DTSTART
:19870405T020000
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'FREQ=YEARLY\;BYDAY=1SU\;BYMONTH=4'
TZOFFSETFROM
:-080000
@@ -1608,7 +1608,7 @@ DTEND
:19970701T150000
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'FREQ=WEEKLY\;INTERVAL=20\;WKST=SU\;BYDAY=TU'
RDATE
;TZID=America-SanJose
@@ -1669,7 +1669,7 @@ SEQUENCE
:0
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'FREQ=MONTHLY\;BYMONTHDAY=1\;UNTIL=19980901T210000Z'
ORGANIZER
:Mailto:A@example.com
@@ -2078,7 +2078,7 @@ SEQUENCE
:0
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'WKST=SU\;BYDAY=TU\;FREQ=WEEKLY'
ORGANIZER
:Mailto:A@example.com
@@ -2143,7 +2143,7 @@ SEQUENCE
:7
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'WKST=SU\;BYDAY=TH\;FREQ=WEEKLY'
ORGANIZER
:Mailto:A@example.com
@@ -2208,7 +2208,7 @@ SEQUENCE
:7
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'WKST=SU\;BYDAY=TU'
ORGANIZER
:Mailto:A@example.com
@@ -2470,7 +2470,7 @@ RDATE
:19980315T180000Z
X-LIC-ERROR
;X-LIC-ERRORTYPE=COMPONENT_PARSE_ERROR
- :Got a data line\, but could not find a property name or component
+ :Got a data line\, but could not find a property name or component
begin tag: 'Error! Bookmark not defined.'
ORGANIZER
:Mailto:A@example.com
@@ -2497,7 +2497,7 @@ END:VEVENT
BEGIN:VEVENT
X-LIC-ERROR
;X-LIC-ERRORTYPE=COMPONENT_PARSE_ERROR
- :Got a data line\, but could not find a property name or component
+ :Got a data line\, but could not find a property name or component
begin tag: 'Error! Bookmark not defined.'
SEQUENCE
:2
@@ -2505,7 +2505,7 @@ RECURRENCE-ID
:19980311T160000Z
X-LIC-ERROR
;X-LIC-ERRORTYPE=COMPONENT_PARSE_ERROR
- :Got a data line\, but could not find a property name or component
+ :Got a data line\, but could not find a property name or component
begin tag: 'Error! Bookmark not defined.'
ATTENDEE
:ROLE=CHAIR;Error! Bookmark not defined.
@@ -2638,7 +2638,7 @@ SEQUENCE
:0
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'FREQ=MONTHLY\;BYMONTHDAY=1'
ORGANIZER
:Mailto:A@example.com
@@ -3130,15 +3130,15 @@ X-LIC-ERROR
:Can't parse parameter name: 'TYPE=INDIVIDUAL'
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'FREQ=MONTHLY\;COUNT=10\;BYDAY=1FR'
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as DATE-TIME value in DTSTART property. Removing entire
+ :Can't parse as DATE-TIME value in DTSTART property. Removing entire
property: '19980101T100000-0700'
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as DATE-TIME value in DUE property. Removing entire property:
+ :Can't parse as DATE-TIME value in DUE property. Removing entire property:
'19980103T100000-0700'
SUMMARY
:Send Status Reports to Area Managers
@@ -3347,7 +3347,7 @@ SEQUENCE
:3
X-LIC-ERROR
;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR
- :Can't parse as RECUR value in RRULE property. Removing entire property:
+ :Can't parse as RECUR value in RRULE property. Removing entire property:
'FREQ=WEEKLY'
RDATE
;VALUE=PERIOD
@@ -3422,5 +3422,3 @@ END:VEVENT
END:VCALENDAR
------------=_948951966-26278-52--
-
-
diff --git a/src/Net-ICal-Libical/test-data/mail-examples b/src/Net-ICal-Libical/test-data/mail-examples
index 5fb7c55c..c2d0d816 100644
--- a/src/Net-ICal-Libical/test-data/mail-examples
+++ b/src/Net-ICal-Libical/test-data/mail-examples
@@ -23,7 +23,7 @@ UID:calsvr.example.com-873970198738777
ATTACH:ftp://ftp.bar.com/pub/docs/foo.doc
STATUS:CONFIRMED
END:VEVENT
-END:VCALENDAR
+END:VCALENDAR
From foo2@example.com Sun Jan 16 17:34:23 2000
From: foo2@example.com
@@ -33,7 +33,7 @@ Mime-Version: 1.0
Content-Type: multipart/alternative;boundary="01BD3665.3AF0D360"
--01BD3665.3AF0D360
-Content-Type: text/plain;charset=us-ascii
+Content-Type: text/plain;charset=us-ascii
Content-Transfer-Encoding: 7bit
This is an alternative representation of a TEXT/CALENDAR MIME Object
@@ -259,4 +259,4 @@ R0lGODdhTAQZAJEAAFVVVd3d3e4AAP///ywAAAAATAQZAAAC/5yPOSLhD6OctNqLs94XqAG
4kiW5omm6sq27gvH8kzX9o1y+s73/g8MCofEovGITCoxKMbyCR16cNSq9YrNarfcrvdriIH
5LL5jE6rxc3G+v2cguf0uv2Oz+v38L7/DxgoOKjURnjIIbe3yNjo+AgZWYVIWWl5iZnJY6J.
-----FEE3790DC7E35189CA67CE2C-- \ No newline at end of file
+----FEE3790DC7E35189CA67CE2C--
diff --git a/src/Net-ICal-Libical/test-data/no-error b/src/Net-ICal-Libical/test-data/no-error
index f5b5ce99..6effc988 100644
--- a/src/Net-ICal-Libical/test-data/no-error
+++ b/src/Net-ICal-Libical/test-data/no-error
@@ -23,4 +23,4 @@ UID:calsvr.example.com-873970198738777
ATTACH:ftp://ftp.bar.com/pub/docs/foo.doc
STATUS:CONFIRMED
END:VEVENT
-END:VCALENDAR
+END:VCALENDAR
diff --git a/src/Net-ICal-Libical/test-data/rfc2446.ics b/src/Net-ICal-Libical/test-data/rfc2446.ics
index bd3f8ef2..8bf5c7e8 100644
--- a/src/Net-ICal-Libical/test-data/rfc2446.ics
+++ b/src/Net-ICal-Libical/test-data/rfc2446.ics
@@ -327,7 +327,7 @@ ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:A@example.com
ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:B@example.com
ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:C@example.com
ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:D@example.com
-COMMENT:Mr. B cannot attend. It's raining. Let's cancel.
+COMMENT:Mr. B cannot attend. It's raining. Lets cancel.
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:1
STATUS:CANCELLED
diff --git a/src/Net-ICal-Libical/test-data/single-with-error b/src/Net-ICal-Libical/test-data/single-with-error
index 6a368d99..f9ffddd6 100644
--- a/src/Net-ICal-Libical/test-data/single-with-error
+++ b/src/Net-ICal-Libical/test-data/single-with-error
@@ -32,8 +32,7 @@ CREATED:19980309T130000Z
SUMMARY:XYZ Project Review
DTSTAR;TZID=US-Eastern:19980312T083000
DTEND;TZID=US-Eastern:19980312T093000
-LOCATION:1CP Conference
+LOCATION:1CP Conference
Room 4350
END:VEVENT
END:VCALENDAR
-
diff --git a/src/Net-ICal-Libical/test/component.pl b/src/Net-ICal-Libical/test/component.pl
index f3e9c915..a55a4a73 100644
--- a/src/Net-ICal-Libical/test/component.pl
+++ b/src/Net-ICal-Libical/test/component.pl
@@ -1,17 +1,11 @@
#!/usr/bin/perl
#======================================================================
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
#======================================================================
use lib "../blib/lib";
diff --git a/src/Net-ICal-Libical/test/libical.pl b/src/Net-ICal-Libical/test/libical.pl
index 7c1e48dd..4624943e 100755..100644
--- a/src/Net-ICal-Libical/test/libical.pl
+++ b/src/Net-ICal-Libical/test/libical.pl
@@ -1,17 +1,11 @@
#!/usr/bin/perl
#======================================================================
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
#======================================================================
use lib "../blib/lib";
@@ -80,7 +74,7 @@ foreach $i (@occur){
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($i);
printf("%s %s %2d %02d:%02d:%02d %d\n",
- (Sun,Mon,Tue,Wed,Thur,Fri,Sat)[$wday],
+ (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday],
(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon],
$mday,
$hour,$min,$sec,
diff --git a/src/Net-ICal-Libical/test/swig.pl b/src/Net-ICal-Libical/test/swig.pl
index de6c1792..df3dc316 100755..100644
--- a/src/Net-ICal-Libical/test/swig.pl
+++ b/src/Net-ICal-Libical/test/swig.pl
@@ -1,17 +1,11 @@
#!/usr/bin/perl
#======================================================================
-# (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+# SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
#
-# Or:
#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
#======================================================================
use lib "../blib/lib";
diff --git a/src/java/CMakeLists.txt b/src/java/CMakeLists.txt
index 0b9c08a4..d1dd43d9 100644
--- a/src/java/CMakeLists.txt
+++ b/src/java/CMakeLists.txt
@@ -1,3 +1,5 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
########### next target ###############
diff --git a/src/java/ICalDurationType.java b/src/java/ICalDurationType.java
index 2dcc2344..045589d9 100644
--- a/src/java/ICalDurationType.java
+++ b/src/java/ICalDurationType.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: ICalDurationType.java
CREATOR: structConverter 01/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
diff --git a/src/java/ICalParameter.java b/src/java/ICalParameter.java
index af764e27..078c05f8 100644
--- a/src/java/ICalParameter.java
+++ b/src/java/ICalParameter.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: ICalParameter.java
CREATOR: gnorman 01/09/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
diff --git a/src/java/ICalPeriodType.java b/src/java/ICalPeriodType.java
index 204ff2a1..765ca0c1 100644
--- a/src/java/ICalPeriodType.java
+++ b/src/java/ICalPeriodType.java
@@ -1,6 +1,8 @@
/*======================================================================
FILE: ICalPeriodType.java
CREATOR: structConverter 01/11/02
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
@@ -68,4 +70,3 @@ public class ICalPeriodType
private ICalTimeType end = new ICalTimeType();
private ICalDurationType duration = new ICalDurationType();
}
-
diff --git a/src/java/ICalProperty.java b/src/java/ICalProperty.java
index 87e99f6e..a93b4e0a 100644
--- a/src/java/ICalProperty.java
+++ b/src/java/ICalProperty.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: ICalProperty.java
CREATOR: gnorman 01/09/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
diff --git a/src/java/ICalRecurrenceType.java b/src/java/ICalRecurrenceType.java
index cfe27911..e53bf93d 100644
--- a/src/java/ICalRecurrenceType.java
+++ b/src/java/ICalRecurrenceType.java
@@ -1,6 +1,8 @@
/*======================================================================
FILE: ICalRecurrenceType.java
CREATOR: structConverter 01/11/02
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
@@ -281,4 +283,3 @@ public class ICalRecurrenceType
public static final int ICAL_BY_MONTH_SIZE = 13;
public static final int ICAL_BY_SETPOS_SIZE = 367;
}
-
diff --git a/src/java/ICalTimeType.java b/src/java/ICalTimeType.java
index 15cf8715..ad0946c9 100644
--- a/src/java/ICalTimeType.java
+++ b/src/java/ICalTimeType.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: ICalTimeType.java
CREATOR: structConverter 01/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
@@ -132,4 +133,3 @@ public class ICalTimeType
private int is_date;
private String zone = new String(); // Converted from char*
}
-
diff --git a/src/java/ICalTriggerType.java b/src/java/ICalTriggerType.java
index e2ef7a72..d23f3ba4 100644
--- a/src/java/ICalTriggerType.java
+++ b/src/java/ICalTriggerType.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: ICalTriggerType.java
CREATOR: structConverter 01/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
@@ -90,4 +91,3 @@ public class ICalTriggerType
private ICalTimeType time = new ICalTimeType();
private ICalDurationType duration = new ICalDurationType();
}
-
diff --git a/src/java/ICalValue.java b/src/java/ICalValue.java
index f7160ff6..94c7de99 100644
--- a/src/java/ICalValue.java
+++ b/src/java/ICalValue.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: ICalValue.java
CREATOR: gnorman 01/10/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
diff --git a/src/java/VAgenda.java b/src/java/VAgenda.java
index 8b85fe11..d487c0eb 100644
--- a/src/java/VAgenda.java
+++ b/src/java/VAgenda.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: VAgenda.java
CREATOR: fnguyen 01/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
@@ -10,7 +11,7 @@ public class VAgenda extends VComponent {
public VAgenda()
{
super(ICalComponentKind.ICAL_VAGENDA_COMPONENT);
- }
+ }
public VAgenda(long obj)
{
diff --git a/src/java/VAlarm.java b/src/java/VAlarm.java
index d7693f76..2de52e89 100644
--- a/src/java/VAlarm.java
+++ b/src/java/VAlarm.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: VAlarm.java
CREATOR: fnguyen 01/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
@@ -11,7 +12,7 @@ public class VAlarm extends VComponent {
{
super(ICalComponentKind.ICAL_VALARM_COMPONENT);
}
-
+
public VAlarm(long obj)
{
super(obj);
diff --git a/src/java/VCalendar.java b/src/java/VCalendar.java
index 4cfcad27..a3f0958f 100644
--- a/src/java/VCalendar.java
+++ b/src/java/VCalendar.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: VCalendar.java
CREATOR: echoi 01/28/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
@@ -10,7 +11,7 @@ public class VCalendar extends VComponent {
public VCalendar()
{
super(ICalComponentKind.ICAL_VCALENDAR_COMPONENT);
- }
+ }
public VCalendar(long obj)
{
diff --git a/src/java/VComponent.java b/src/java/VComponent.java
index d77c5bb9..b828b32c 100644
--- a/src/java/VComponent.java
+++ b/src/java/VComponent.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: VComponent.java
CREATOR: gnorman 01/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
diff --git a/src/java/VEvent.java b/src/java/VEvent.java
index 2017aa58..33019b81 100644
--- a/src/java/VEvent.java
+++ b/src/java/VEvent.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: VEvent.java
CREATOR: fnguyen 01/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
@@ -10,7 +11,7 @@ public class VEvent extends VComponent {
public VEvent()
{
super(ICalComponentKind.ICAL_VEVENT_COMPONENT);
- }
+ }
public VEvent(long obj)
{
diff --git a/src/java/VFreeBusy.java b/src/java/VFreeBusy.java
index a781edc5..c8dbf144 100644
--- a/src/java/VFreeBusy.java
+++ b/src/java/VFreeBusy.java
@@ -1,10 +1,17 @@
+/*======================================================================
+ FILE: VFreeBusy.java
+ CREATOR:
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+======================================================================*/
+
package net.cp.jlibical;
public class VFreeBusy extends VComponent {
public VFreeBusy()
{
super(ICalComponentKind.ICAL_VFREEBUSY_COMPONENT);
- }
+ }
public VFreeBusy(long obj)
{
diff --git a/src/java/VQuery.java b/src/java/VQuery.java
index e94a0732..d827534a 100644
--- a/src/java/VQuery.java
+++ b/src/java/VQuery.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: VQuery.java
CREATOR: fnguyen 01/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
@@ -10,7 +11,7 @@ public class VQuery extends VComponent {
public VQuery()
{
super(ICalComponentKind.ICAL_VQUERY_COMPONENT);
- }
+ }
public VQuery(long obj)
{
diff --git a/src/java/VToDo.java b/src/java/VToDo.java
index 9e4a06e1..af1e2bcf 100644
--- a/src/java/VToDo.java
+++ b/src/java/VToDo.java
@@ -1,7 +1,8 @@
/*======================================================================
FILE: VToDo.java
CREATOR: fnguyen 01/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
package net.cp.jlibical;
@@ -10,7 +11,7 @@ public class VToDo extends VComponent {
public VToDo()
{
super(ICalComponentKind.ICAL_VTODO_COMPONENT);
- }
+ }
public VToDo(long obj)
{
diff --git a/src/java/jlibical_consts_cxx.h b/src/java/jlibical_consts_cxx.h
index b4c72da4..d970b660 100644
--- a/src/java/jlibical_consts_cxx.h
+++ b/src/java/jlibical_consts_cxx.h
@@ -2,18 +2,10 @@
FILE: jlibical_consts_cxx/h
CREATOR: Srinivasa Boppana/George Norman
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef JLIBICAL_CONSTS_CXX_H
#define JLIBICAL_CONSTS_CXX_H
diff --git a/src/java/jlibical_utils_cxx.cpp b/src/java/jlibical_utils_cxx.cpp
index d89ee862..e52e33f4 100644
--- a/src/java/jlibical_utils_cxx.cpp
+++ b/src/java/jlibical_utils_cxx.cpp
@@ -2,18 +2,10 @@
FILE: jlibical_utils_cxx.cpp
CREATOR: Srinivasa Boppana/George Norman
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef JLIBICAL_UTILS_CXX_H
@@ -415,7 +407,6 @@ jobject doCreateNewSurrogate(JNIEnv *env, jclass surrogateClass, jlong subject)
return(result);
}
-
//-------------------------------------------------------
// For the given cpErr, create a new Exception and send it to env.
// Note: Throw does not throw anything. It only sets the state.
diff --git a/src/java/jlibical_utils_cxx.h b/src/java/jlibical_utils_cxx.h
index d812202c..2a61b54e 100644
--- a/src/java/jlibical_utils_cxx.h
+++ b/src/java/jlibical_utils_cxx.h
@@ -2,18 +2,10 @@
FILE: jlibical_utils_cxx.h
CREATOR: Srinivasa Boppana/George Norman
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef TEST_CXX_H
@@ -66,5 +58,4 @@ jobject createNewICalPeriodType(JNIEnv *env, icalperiodtype* source);
jobject doCreateNewSurrogate(JNIEnv *env, jclass surrogateClass, jlong subject);
-
#endif /*TEST_CXX_H*/
diff --git a/src/java/jniICalDurationType_cxx.cpp b/src/java/jniICalDurationType_cxx.cpp
index d7bb9d97..de77ce94 100644
--- a/src/java/jniICalDurationType_cxx.cpp
+++ b/src/java/jniICalDurationType_cxx.cpp
@@ -1,18 +1,10 @@
/*======================================================================
FILE: jniICalDurationType_cxx.cpp
CREATOR: structConverter
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#include <jni.h>
@@ -26,7 +18,6 @@ static jfieldID ICalDurationType_Hours_FID;
static jfieldID ICalDurationType_Minutes_FID;
static jfieldID ICalDurationType_Seconds_FID;
-
void initICalDurationTypeFieldIDs(JNIEnv* env, jclass clazz)
{
ICalDurationType_Is_neg_FID = env->GetFieldID(clazz, "is_neg", "I");
diff --git a/src/java/jniICalDurationType_cxx.h b/src/java/jniICalDurationType_cxx.h
index a7408e3c..44b28db7 100644
--- a/src/java/jniICalDurationType_cxx.h
+++ b/src/java/jniICalDurationType_cxx.h
@@ -2,18 +2,10 @@
FILE: jniICalDurationType_cxx.h
CREATOR: structConverter
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef _jni_ICalDurationType_H
#define _jni_ICalDurationType_H
@@ -22,7 +14,6 @@
// I forgot how to do this using a typedef in c++!!!!
#define ICalDurationType icaldurationtype
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -49,7 +40,6 @@ void jni_GetAll_from_ICalDurationType(struct ICalDurationType* __ICalDurationTyp
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalDurationType_initFIDs(JNIEnv *env, jclass clazz);
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalDurationType_init__J(JNIEnv *env, jobject thisICalDurationType, jlong data);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/java/jniICalPeriodType_cxx.cpp b/src/java/jniICalPeriodType_cxx.cpp
index 84d3ed61..d1df8cdb 100644
--- a/src/java/jniICalPeriodType_cxx.cpp
+++ b/src/java/jniICalPeriodType_cxx.cpp
@@ -2,19 +2,11 @@
FILE: jniICalPeriodType_cxx.cpp
CREATOR: structConverter
- (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
- (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
+ SPDX-FileCopyrightText: 2001, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2001, Patrick Lewis <plewis@inetarena.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#include <jni.h>
@@ -26,7 +18,6 @@ static jfieldID ICalPeriodType_Start_FID;
static jfieldID ICalPeriodType_End_FID;
static jfieldID ICalPeriodType_Duration_FID;
-
void initICalPeriodTypeFieldIDs(JNIEnv* env, jclass clazz)
{
ICalPeriodType_Start_FID = env->GetFieldID(clazz, "start", "Lnet/cp/jlibical/ICalTimeType;");
diff --git a/src/java/jniICalPeriodType_cxx.h b/src/java/jniICalPeriodType_cxx.h
index 5928219c..62d8a2e9 100644
--- a/src/java/jniICalPeriodType_cxx.h
+++ b/src/java/jniICalPeriodType_cxx.h
@@ -2,18 +2,10 @@
FILE: jniICalPeriodType_cxx.h
CREATOR: structConverter
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef _jni_ICalPeriodType_H
#define _jni_ICalPeriodType_H
@@ -22,7 +14,6 @@
// I forgot how to do this using a typedef in c++!!!!
#define ICalPeriodType icalperiodtype
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -44,7 +35,6 @@ void jni_GetAll_from_ICalPeriodType(struct ICalPeriodType* __ICalPeriodType_, JN
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalPeriodType_init__J(JNIEnv* env, jobject thisICalPeriodType, jlong data);
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalPeriodType_initFIDs(JNIEnv *env, jclass clazz);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/java/jniICalRecurrenceType_cxx.cpp b/src/java/jniICalRecurrenceType_cxx.cpp
index 34048eaa..83325894 100644
--- a/src/java/jniICalRecurrenceType_cxx.cpp
+++ b/src/java/jniICalRecurrenceType_cxx.cpp
@@ -1,17 +1,8 @@
/*======================================================================
FILE: jniICalRecurrenceType_cxx.cpp
CREATOR: structConverter
-
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
#include <jni.h>
@@ -35,7 +26,6 @@ static jfieldID ICalRecurrenceType_By_week_no_FID;
static jfieldID ICalRecurrenceType_By_month_FID;
static jfieldID ICalRecurrenceType_By_set_pos_FID;
-
void initICalRecurrenceTypeFieldIDs(JNIEnv* env, jclass clazz)
{
ICalRecurrenceType_Until_FID = env->GetFieldID(clazz, "until", "Lnet/cp/jlibical/ICalTimeType;");
@@ -343,7 +333,6 @@ void jni_GetAll_from_ICalRecurrenceType(struct ICalRecurrenceType* __ICalRecurre
jni_GetBy_week_no_from_ICalRecurrenceType(__ICalRecurrenceType_, env, thisICalRecurrenceType);
jni_GetBy_month_from_ICalRecurrenceType(__ICalRecurrenceType_, env, thisICalRecurrenceType);
jni_GetBy_set_pos_from_ICalRecurrenceType(__ICalRecurrenceType_, env, thisICalRecurrenceType);
-
}
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalRecurrenceType_init__J(JNIEnv* env, jobject thisICalRecurrenceType, jlong data) {
diff --git a/src/java/jniICalRecurrenceType_cxx.h b/src/java/jniICalRecurrenceType_cxx.h
index 683cc017..47d90d1b 100644
--- a/src/java/jniICalRecurrenceType_cxx.h
+++ b/src/java/jniICalRecurrenceType_cxx.h
@@ -2,18 +2,10 @@
FILE: jniICalRecurrenceType_cxx.h
CREATOR: structConverter
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef _jni_ICalRecurrenceType_H_
#define _jni_ICalRecurrenceType_H_
@@ -63,7 +55,6 @@ void jni_GetAll_from_ICalRecurrenceType(struct ICalRecurrenceType* __ICalRecurre
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalRecurrenceType_init__J(JNIEnv* env, jobject thisICalRecurrenceType, jlong data);
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalRecurrenceType_initFIDs(JNIEnv *env, jclass clazz);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/java/jniICalTimeType_cxx.cpp b/src/java/jniICalTimeType_cxx.cpp
index 9609b3b8..f956a7f3 100644
--- a/src/java/jniICalTimeType_cxx.cpp
+++ b/src/java/jniICalTimeType_cxx.cpp
@@ -1,18 +1,10 @@
/*======================================================================
FILE: jniICalTimeType_cxx.cpp
CREATOR: structConverter
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#include <jni.h>
@@ -30,7 +22,6 @@ static jfieldID ICalTimeType_Second_FID;
static jfieldID ICalTimeType_Is_date_FID;
static jfieldID ICalTimeType_Zone_FID;
-
void initICalTimeTypeFieldIDs(JNIEnv* env, jclass clazz)
{
ICalTimeType_Year_FID = env->GetFieldID(clazz, "year", "I");
diff --git a/src/java/jniICalTimeType_cxx.h b/src/java/jniICalTimeType_cxx.h
index ac28303d..e0f6fb9e 100644
--- a/src/java/jniICalTimeType_cxx.h
+++ b/src/java/jniICalTimeType_cxx.h
@@ -2,18 +2,10 @@
FILE: jniICalTimeType_cxx.h
CREATOR: structConverter
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef _jni_ICalTimeType_H
#define _jni_ICalTimeType_H
@@ -52,7 +44,6 @@ void jni_GetAll_from_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv*
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalTimeType_initFIDs(JNIEnv *env, jclass clazz);
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalTimeType_init__J(JNIEnv* env, jobject thisICalTimeType, jlong data);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/java/jniICalTriggerType_cxx.cpp b/src/java/jniICalTriggerType_cxx.cpp
index 42cea1aa..fd1a93a4 100644
--- a/src/java/jniICalTriggerType_cxx.cpp
+++ b/src/java/jniICalTriggerType_cxx.cpp
@@ -2,18 +2,10 @@
FILE: jniICalTriggerType_cxx.cpp
CREATOR: structConverter
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#include <jni.h>
@@ -24,7 +16,6 @@
static jfieldID ICalTriggerType_Time_FID;
static jfieldID ICalTriggerType_Duration_FID;
-
void initICalTriggerTypeFieldIDs(JNIEnv* env, jclass clazz)
{
ICalTriggerType_Time_FID = env->GetFieldID(clazz, "time", "Lnet/cp/jlibical/ICalTimeType;");
diff --git a/src/java/jniICalTriggerType_cxx.h b/src/java/jniICalTriggerType_cxx.h
index 3835caf5..e71f8f25 100644
--- a/src/java/jniICalTriggerType_cxx.h
+++ b/src/java/jniICalTriggerType_cxx.h
@@ -2,18 +2,10 @@
FILE: jniICalTriggerType_cxx.h
CREATOR: structConverter
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef _jni_ICalTriggerType_H
@@ -23,7 +15,6 @@
// I forgot how to do this using a typedef in c++!!!!
#define ICalTriggerType icaltriggertype
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -42,7 +33,6 @@ void jni_GetAll_from_ICalTriggerType(struct ICalTriggerType* __ICalTriggerType_,
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalTriggerType_init__J(JNIEnv* env, jobject thisICalTriggerType, jlong data);
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalTriggerType_initFIDs(JNIEnv *env, jclass clazz);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/java/net_cp_jlibical_ICalParameter_cxx.cpp b/src/java/net_cp_jlibical_ICalParameter_cxx.cpp
index d3d52da6..b55807a8 100644
--- a/src/java/net_cp_jlibical_ICalParameter_cxx.cpp
+++ b/src/java/net_cp_jlibical_ICalParameter_cxx.cpp
@@ -1,18 +1,10 @@
/*======================================================================
FILE: net_cp_jlibical_ICalParameter_cxx.cpp
CREATOR: gnorman 1/10/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef NET_CP_JLIBICAL_ICALPARAMETER_CXX_H
diff --git a/src/java/net_cp_jlibical_ICalParameter_cxx.h b/src/java/net_cp_jlibical_ICalParameter_cxx.h
index 1949a0f2..88ba98a6 100644
--- a/src/java/net_cp_jlibical_ICalParameter_cxx.h
+++ b/src/java/net_cp_jlibical_ICalParameter_cxx.h
@@ -2,18 +2,10 @@
FILE: net_cp_jlibical_ICalParameter_cxx.h
CREATOR: javah 1/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef _Included_net_cp_jlibical_ICalParameter
#define _Included_net_cp_jlibical_ICalParameter
diff --git a/src/java/net_cp_jlibical_ICalProperty_cxx.cpp b/src/java/net_cp_jlibical_ICalProperty_cxx.cpp
index 415b696b..24846f15 100644
--- a/src/java/net_cp_jlibical_ICalProperty_cxx.cpp
+++ b/src/java/net_cp_jlibical_ICalProperty_cxx.cpp
@@ -1,18 +1,10 @@
/*======================================================================
FILE: net_cp_jlibical_ICalProperty_cxx.cpp
CREATOR: gnorman 1/10/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef NET_CP_JLIBICAL_ICALPROPERTY_CXX_H
@@ -1388,7 +1380,6 @@ JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalProperty_init__I
setCObjectPtr(env,jobj,new ICalProperty((icalproperty_kind)kind));
}
-
/*
* Class: net_cp_jlibical_ICalProperty
* Method: set_status
diff --git a/src/java/net_cp_jlibical_ICalProperty_cxx.h b/src/java/net_cp_jlibical_ICalProperty_cxx.h
index b1c71c32..bc8af40f 100644
--- a/src/java/net_cp_jlibical_ICalProperty_cxx.h
+++ b/src/java/net_cp_jlibical_ICalProperty_cxx.h
@@ -2,18 +2,10 @@
FILE: net_cp_jlibical_ICalProperty_cxx.h
CREATOR: javah 1/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef _Included_net_cp_jlibical_ICalProperty
#define _Included_net_cp_jlibical_ICalProperty
diff --git a/src/java/net_cp_jlibical_ICalValue_cxx.cpp b/src/java/net_cp_jlibical_ICalValue_cxx.cpp
index f01a9338..3068ce47 100644
--- a/src/java/net_cp_jlibical_ICalValue_cxx.cpp
+++ b/src/java/net_cp_jlibical_ICalValue_cxx.cpp
@@ -1,18 +1,10 @@
/*======================================================================
FILE: net_cp_jlibical_ICalValue_cxx.cpp
CREATOR: gnorman 1/10/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef NET_CP_JLIBICAL_ICALVALUE_CXX_H
diff --git a/src/java/net_cp_jlibical_ICalValue_cxx.h b/src/java/net_cp_jlibical_ICalValue_cxx.h
index f7ffde37..7de5cadc 100644
--- a/src/java/net_cp_jlibical_ICalValue_cxx.h
+++ b/src/java/net_cp_jlibical_ICalValue_cxx.h
@@ -2,18 +2,10 @@
FILE: net_cp_jlibical_ICalValue_cxx.h
CREATOR: javah 1/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef _Included_net_cp_jlibical_ICalValue
#define _Included_net_cp_jlibical_ICalValue
diff --git a/src/java/net_cp_jlibical_VComponent_cxx.cpp b/src/java/net_cp_jlibical_VComponent_cxx.cpp
index 1b5bb852..d7054618 100644
--- a/src/java/net_cp_jlibical_VComponent_cxx.cpp
+++ b/src/java/net_cp_jlibical_VComponent_cxx.cpp
@@ -1,18 +1,10 @@
/*======================================================================
FILE: net_cp_jlibical_VComponent_cxx.cpp
CREATOR: gnorman 1/10/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef NET_CP_JLIBICAL_VCOMPONENT_CXX_H
@@ -470,7 +462,6 @@ JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1dtend
// create a new surrogate, using aTime as the subject.
result = createNewICalTimeType(env,&aTime);
-
}
return(result);
diff --git a/src/java/net_cp_jlibical_VComponent_cxx.h b/src/java/net_cp_jlibical_VComponent_cxx.h
index 3bf9d09e..8aa703af 100644
--- a/src/java/net_cp_jlibical_VComponent_cxx.h
+++ b/src/java/net_cp_jlibical_VComponent_cxx.h
@@ -2,18 +2,10 @@
FILE: net_cp_jlibical_VComponent_cxx.h
CREATOR: javah 1/11/02
- (C) COPYRIGHT 2002, Critical Path
+ SPDX-FileCopyrightText: 2002, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef _Included_net_cp_jlibical_VComponent
#define _Included_net_cp_jlibical_VComponent
diff --git a/src/java/testjni.java b/src/java/testjni.java
index bb6a6aee..89ff875b 100644
--- a/src/java/testjni.java
+++ b/src/java/testjni.java
@@ -1,3 +1,10 @@
+/*======================================================================
+ FILE: testjni.java
+ CREATOR:
+ SPDX-FileCopyrightText: 2002, Critical Path
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+======================================================================*/
+
package net.cp.jlibical;
import java.lang.String;
diff --git a/src/libical-glib/CMakeLists.txt b/src/libical-glib/CMakeLists.txt
index de5e6210..967b4b98 100644
--- a/src/libical-glib/CMakeLists.txt
+++ b/src/libical-glib/CMakeLists.txt
@@ -1,5 +1,12 @@
+# SPDX-FileCopyrightText: Milan Crha <mcrha@redhat.com>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
add_definitions(-Dlibical_ical_EXPORTS)
+# a C11 compliant compiler is required to build this library
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_C_STANDARD_REQUIRED ON)
+
# build ical-glib-src-generator
add_executable(ical-glib-src-generator
tools/generator.c
@@ -85,9 +92,14 @@ else()
endif()
add_custom_command (
- OUTPUT ${LIBICAL_GLIB_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/libical-glib-private.h ${CMAKE_CURRENT_BINARY_DIR}/i-cal-forward-declarations.h
- COMMAND ${ical-glib-src-generator_EXE} "${CMAKE_CURRENT_SOURCE_DIR}/tools" "${CMAKE_CURRENT_SOURCE_DIR}/api"
+ OUTPUT
+ ${LIBICAL_GLIB_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/libical-glib-private.h
+ ${CMAKE_CURRENT_BINARY_DIR}/i-cal-forward-declarations.h
+ COMMAND
+ ${ical-glib-src-generator_EXE} "${CMAKE_CURRENT_SOURCE_DIR}/tools" "${CMAKE_CURRENT_SOURCE_DIR}/api"
DEPENDS ${ical-glib-src-generator_EXE} ${xml_files}
+ COMMENT "Generate libical-glib headers"
)
configure_file(
@@ -124,7 +136,11 @@ target_link_libraries(ical-glib PRIVATE ical ${GLIB_LIBRARIES})
if(NOT SHARED_ONLY AND NOT STATIC_ONLY)
add_library(ical-glib-static STATIC ${LIBICAL_GLIB_SOURCES})
add_dependencies(ical-glib-static ical-header)
- target_compile_options(ical-glib-static PUBLIC ${GLIB_CFLAGS} -DG_LOG_DOMAIN="libical-glib" -DLIBICAL_GLIB_COMPILATION)
+ target_compile_options(ical-glib-static
+ PUBLIC ${GLIB_CFLAGS}
+ -DG_LOG_DOMAIN="libical-glib"
+ -DLIBICAL_GLIB_COMPILATION
+ )
target_link_libraries(ical-glib-static ${GLIB_LIBRARIES})
endif()
@@ -172,7 +188,14 @@ if(HAVE_INTROSPECTION)
set(ICalGLib_${LIB_VERSION}_gir_VERSION ${LIBICAL_GLIB_GIR_VERSION_STRING})
set(ICalGLib_${LIB_VERSION}_gir_LIBRARY "ICalGLib")
set(ICalGLib_${LIB_VERSION}_gir_INCLUDES GObject-2.0 GLib-2.0)
- set(ICalGLib_${LIB_VERSION}_gir_CFLAGS ${_includes} ${GLIB_CFLAGS} -DLIBICAL_GLIB_COMPILATION -I${CMAKE_CURRENT_BINARY_DIR} -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_BINARY_DIR}/src/libical -I${CMAKE_SOURCE_DIR}/src/libical -I${CMAKE_BINARY_DIR}/src/libical-glib)
+ set(ICalGLib_${LIB_VERSION}_gir_CFLAGS ${GLIB_CFLAGS}
+ -DLIBICAL_GLIB_COMPILATION
+ -I${CMAKE_CURRENT_BINARY_DIR}
+ -I${CMAKE_CURRENT_SOURCE_DIR}
+ -I${CMAKE_BINARY_DIR}/src/libical
+ -I${CMAKE_SOURCE_DIR}/src/libical
+ -I${CMAKE_BINARY_DIR}/src/libical-glib
+ )
set(ICalGLib_${LIB_VERSION}_gir_LIBS ical-glib)
set(ICalGLib_${LIB_VERSION}_gir_FILES ${LIBICAL_GLIB_GIR_SOURCES})
@@ -182,7 +205,7 @@ if(HAVE_INTROSPECTION)
endif()
if(ICAL_GLIB_VAPI)
- add_custom_target(vala ALL)
+ add_custom_target(vala ALL COMMENT "Target to run vala")
set(gir_fullname ${CMAKE_BINARY_DIR}/src/libical-glib/ICalGLib-${LIBICAL_GLIB_GIR_VERSION_STRING}.gir)
set(metadata_fullname ${CMAKE_CURRENT_BINARY_DIR}/ICalGLib-${LIBICAL_GLIB_GIR_VERSION_STRING}.metadata)
set(vapi_file ${CMAKE_CURRENT_BINARY_DIR}/libical-glib.vapi)
@@ -206,9 +229,10 @@ if(ICAL_GLIB_VAPI)
DEPENDS
${gir_fullname}
${metadata_fullname}
+ COMMENT "Run the tool to generate the Vala API"
)
- add_custom_target(valafile DEPENDS ${vapi_file})
+ add_custom_target(valafile DEPENDS ${vapi_file} COMMENT "Target to run valafile")
add_dependencies(vala valafile)
diff --git a/src/libical-glib/api/i-cal-array.xml b/src/libical-glib/api/i-cal-array.xml
index bd7641da..5e8f4ba6 100644
--- a/src/libical-glib/api/i-cal-array.xml
+++ b/src/libical-glib/api/i-cal-array.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Array" native="icalarray" is_possible_global="true" destroy_func="icalarray_free">
<method name="i_cal_array_size" corresponds="CUSTOM" kind="other" since="1.0">
diff --git a/src/libical-glib/api/i-cal-attach.xml b/src/libical-glib/api/i-cal-attach.xml
index d361ee81..970a02cb 100644
--- a/src/libical-glib/api/i-cal-attach.xml
+++ b/src/libical-glib/api/i-cal-attach.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Attach" native="icalattach" destroy_func="icalattach_unref" new_full_extra_code="if (owner) { icalattach_ref (native); owner = NULL; }">
<method name="i_cal_attach_new_from_url" corresponds="icalattach_new_from_url" kind="constructor" since="1.0">
diff --git a/src/libical-glib/api/i-cal-comp-iter.xml b/src/libical-glib/api/i-cal-comp-iter.xml
index 549db8aa..9f690b66 100644
--- a/src/libical-glib/api/i-cal-comp-iter.xml
+++ b/src/libical-glib/api/i-cal-comp-iter.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="CompIter" native="struct icalcompiter" is_bare="true" default_native="i_cal_comp_iter_new_default ()">
<method name="i_cal_comp_iter_new_default" corresponds="CUSTOM" kind="private" since="1.0" annotation="skip">
diff --git a/src/libical-glib/api/i-cal-component.xml b/src/libical-glib/api/i-cal-component.xml
index 0f8bba47..f466978a 100644
--- a/src/libical-glib/api/i-cal-component.xml
+++ b/src/libical-glib/api/i-cal-component.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Component" native="icalcomponent" destroy_func="icalcomponent_free" includes="libical-glib/i-cal-parameter.h">
<method name="i_cal_component_new" corresponds="icalcomponent_new" kind="constructor" since="1.0">
@@ -19,8 +11,8 @@
<returns type="ICalComponent *" annotation="transfer full" comment="The newly created #ICalComponent."/>
<comment xml:space="preserve">Creates a new #ICalComponent with specific type.</comment>
</method>
- <method name="i_cal_component_clone" corresponds="icalcomponent_new_clone" kind="clone" since="1.0">
- <parameter type="ICalComponent *" name="component" comment="The #ICalComponent to be created"/>
+ <method name="i_cal_component_clone" corresponds="icalcomponent_clone" kind="clone" since="3.1">
+ <parameter type="const ICalComponent *" name="component" comment="The #ICalComponent to be created."/>
<returns type="ICalComponent *" annotation="transfer full" comment="The newly deeply cloned #ICalComponent."/>
<comment xml:space="preserve">Deeply clone a #ICalComponent.</comment>
</method>
diff --git a/src/libical-glib/api/i-cal-datetimeperiod.xml b/src/libical-glib/api/i-cal-datetimeperiod.xml
index bfeadab1..4a393740 100644
--- a/src/libical-glib/api/i-cal-datetimeperiod.xml
+++ b/src/libical-glib/api/i-cal-datetimeperiod.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Datetimeperiod" native="struct icaldatetimeperiodtype" is_bare="true" default_native="i_cal_datetimeperiod_new_default ()" includes="libical-glib/i-cal-time.h, libical-glib/i-cal-period.h">
<method name="i_cal_datetimeperiod_new_default" corresponds="CUSTOM" annotation="skip" kind="private" since="1.0">
diff --git a/src/libical-glib/api/i-cal-derived-parameter.xml b/src/libical-glib/api/i-cal-derived-parameter.xml
index a0799a74..4b85800d 100644
--- a/src/libical-glib/api/i-cal-derived-parameter.xml
+++ b/src/libical-glib/api/i-cal-derived-parameter.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="DerivedParameter">
<enum name="ICalParameterKind" native_name="icalparameter_kind" default_native="I_CAL_NO_PARAMETER">
diff --git a/src/libical-glib/api/i-cal-derived-property.xml b/src/libical-glib/api/i-cal-derived-property.xml
index 24e31ef5..3ca15403 100644
--- a/src/libical-glib/api/i-cal-derived-property.xml
+++ b/src/libical-glib/api/i-cal-derived-property.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="DerivedProperty">
<enum name="ICalPropertyKind" native_name="icalproperty_kind" default_native="I_CAL_NO_PROPERTY">
diff --git a/src/libical-glib/api/i-cal-derived-value.xml b/src/libical-glib/api/i-cal-derived-value.xml
index 5f965756..92d94b8a 100644
--- a/src/libical-glib/api/i-cal-derived-value.xml
+++ b/src/libical-glib/api/i-cal-derived-value.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="DerivedValue">
<enum name="ICalValueKind" native_name="icalvalue_kind" default_native="I_CAL_NO_VALUE">
diff --git a/src/libical-glib/api/i-cal-duration.xml b/src/libical-glib/api/i-cal-duration.xml
index bffab54b..053cbee5 100644
--- a/src/libical-glib/api/i-cal-duration.xml
+++ b/src/libical-glib/api/i-cal-duration.xml
@@ -1,21 +1,13 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Duration" native="struct icaldurationtype" is_bare="true" default_native="icaldurationtype_null_duration()">
<method name="i_cal_duration_is_neg" corresponds="CUSTOM" kind="get" since="1.0">
- <parameter type="ICalDuration *" name="duration" comment="The #ICalDuration to be queried"/>
+ <parameter type="ICalDuration *" name="duration" comment="The #ICalDuration to be queried"/>
<returns type="gboolean" comment="The is_neg." />
<comment xml:space="preserve">Gets the is_neg of #ICalDuration.</comment>
<custom> g_return_val_if_fail (duration != NULL, 0);
@@ -116,7 +108,7 @@
<method name="i_cal_duration_as_ical_string" corresponds="icaldurationtype_as_ical_string_r" kind="others" since="1.0">
<parameter type="ICalDuration *" name="duration" comment="The #ICalDuration to be converted"/>
<returns type="gchar *" annotation="transfer full" comment="The duration in string" />
- <comment xml:space="preserve">Converts the #ICalDuration to the representation in string.</comment>
+ <comment xml:space="preserve">Converts the #ICalDuration to the representation in string</comment>
</method>
<method name="i_cal_duration_new_null_duration" corresponds="icaldurationtype_null_duration" kind="constructor" since="1.0">
<returns type="ICalDuration *" annotation="transfer full" comment="The newly created #ICalDuration" />
diff --git a/src/libical-glib/api/i-cal-enums.xml b/src/libical-glib/api/i-cal-enums.xml
index 61e12a79..ac8a747a 100644
--- a/src/libical-glib/api/i-cal-enums.xml
+++ b/src/libical-glib/api/i-cal-enums.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Enums">
<enum name="ICalComponentKind" native_name="icalcomponent_kind" default_native="I_CAL_NO_COMPONENT">
diff --git a/src/libical-glib/api/i-cal-error.xml b/src/libical-glib/api/i-cal-error.xml
index e2692f71..9589ddd5 100644
--- a/src/libical-glib/api/i-cal-error.xml
+++ b/src/libical-glib/api/i-cal-error.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Error">
<enum name="ICalErrorEnum" native_name="icalerrorenum" default_native="I_CAL_UNKNOWN_ERROR">
diff --git a/src/libical-glib/api/i-cal-geo.xml b/src/libical-glib/api/i-cal-geo.xml
index cf647976..644f5edf 100644
--- a/src/libical-glib/api/i-cal-geo.xml
+++ b/src/libical-glib/api/i-cal-geo.xml
@@ -1,25 +1,17 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Geo" native="struct icalgeotype" is_bare="true" default_native="i_cal_geo_new_default ()">
<method name="i_cal_geo_new_default" corresponds="CUSTOM" annotation="skip" kind="private" since="1.0">
<returns type="struct icalgeotype" annotation="transfer full" comment="The newly created #ICalGeo" />
<comment xml:space="preserve">Creates a new default #ICalGeo.</comment>
<custom> struct icalgeotype geotype;
- geotype.lat = 0;
- geotype.lon = 0;
+ memset(geotype.lat, 0, ICAL_GEO_LEN);
+ memset(geotype.lon, 0, ICAL_GEO_LEN);
return geotype;</custom>
</method>
<method name="i_cal_geo_new" corresponds="CUSTOM" kind="constructor" since="1.0">
@@ -28,10 +20,9 @@
<returns type="ICalGeo *" annotation="transfer full" comment="The newly created #ICalGeo." />
<comment xml:space="preserve">Creates a new #ICalGeo.</comment>
<custom> struct icalgeotype geo;
-
geo = i_cal_geo_new_default();
- geo.lat = lat;
- geo.lon = lon;
+ g_ascii_dtostr(geo.lat, ICAL_GEO_LEN, lat);
+ g_ascii_dtostr(geo.lon, ICAL_GEO_LEN, lon);
return i_cal_geo_new_full(geo);</custom>
</method>
@@ -41,7 +32,7 @@
<comment xml:space="preserve">Creates a new #ICalGeo, copy of @geo.</comment>
<custom> struct icalgeotype *src;
- g_return_val_if_fail(I_CAL_IS_GEO(geo), NULL);
+ g_return_val_if_fail(I_CAL_IS_GEO((ICalGeo *)geo), NULL);
src = (struct icalgeotype *)i_cal_object_get_native((ICalObject *)geo);
g_return_val_if_fail(src != NULL, NULL);
@@ -52,28 +43,36 @@
<parameter type="ICalGeo *" name="geo" comment="The #ICalGeo to be queried"/>
<returns type="gdouble" comment="The latitude." />
<comment xml:space="preserve">Gets the latitude of #ICalGeo.</comment>
- <custom> g_return_val_if_fail (geo != NULL, 0);
- return ((struct icalgeotype *)i_cal_object_get_native ((ICalObject *)geo))->lat;</custom>
+ <custom> struct icalgeotype *native;
+ g_return_val_if_fail (geo != NULL, 0);
+ native = (struct icalgeotype *)i_cal_object_get_native ((ICalObject *)geo);
+ return g_ascii_strtod(native->lat, NULL);</custom>
</method>
<method name="i_cal_geo_set_lat" corresponds="CUSTOM" kind="set" since="1.0">
<parameter type="ICalGeo *" name="geo" comment="The #ICalGeo to be set"/>
<parameter type="gdouble" name="lat" comment="The latitude"/>
<comment>Sets the latitude of #ICalGeo.</comment>
- <custom> g_return_if_fail (geo != NULL &amp;&amp; I_CAL_IS_GEO (geo));
- ((struct icalgeotype *)i_cal_object_get_native ((ICalObject *)geo))->lat = lat;</custom>
+ <custom> struct icalgeotype *native;
+ g_return_if_fail (geo != NULL &amp;&amp; I_CAL_IS_GEO (geo));
+ native = (struct icalgeotype *)i_cal_object_get_native ((ICalObject *)geo);
+ g_ascii_dtostr(native->lat, ICAL_GEO_LEN, lat);</custom>
</method>
<method name="i_cal_geo_get_lon" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalGeo *" name="geo" comment="The #ICalGeo to be queried"/>
<returns type="gdouble" comment="The longitude." />
<comment xml:space="preserve">Gets the longitude of #ICalGeo.</comment>
- <custom> g_return_val_if_fail (geo != NULL, 0);
- return ((struct icalgeotype *)i_cal_object_get_native ((ICalObject *)geo))->lon;</custom>
+ <custom> struct icalgeotype *native;
+ g_return_val_if_fail (geo != NULL, 0);
+ native = (struct icalgeotype *)i_cal_object_get_native ((ICalObject *)geo);
+ return g_ascii_strtod(native->lon, NULL);</custom>
</method>
<method name="i_cal_geo_set_lon" corresponds="CUSTOM" kind="set" since="1.0">
<parameter type="ICalGeo *" name="geo" comment="The #ICalGeo to be set"/>
<parameter type="gdouble" name="lon" comment="The longitude"/>
<comment>Sets the longitude of #ICalGeo.</comment>
- <custom> g_return_if_fail (geo != NULL &amp;&amp; I_CAL_IS_GEO (geo));
- ((struct icalgeotype *)i_cal_object_get_native ((ICalObject *)geo))->lon = lon;</custom>
+ <custom> struct icalgeotype *native;
+ g_return_if_fail (geo != NULL &amp;&amp; I_CAL_IS_GEO (geo));
+ native = (struct icalgeotype *)i_cal_object_get_native ((ICalObject *)geo);
+ g_ascii_dtostr(native->lon, ICAL_GEO_LEN, lon);</custom>
</method>
</structure>
diff --git a/src/libical-glib/api/i-cal-memory.xml b/src/libical-glib/api/i-cal-memory.xml
index 49980a60..ffb2cac0 100644
--- a/src/libical-glib/api/i-cal-memory.xml
+++ b/src/libical-glib/api/i-cal-memory.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Memory">
<method name="i_cal_memory_tmp_buffer" corresponds="icalmemory_tmp_buffer" since="1.0">
diff --git a/src/libical-glib/api/i-cal-mime.xml b/src/libical-glib/api/i-cal-mime.xml
index 2fa40f9f..f2b1ff3c 100644
--- a/src/libical-glib/api/i-cal-mime.xml
+++ b/src/libical-glib/api/i-cal-mime.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Mime">
<declaration position="header">/**
diff --git a/src/libical-glib/api/i-cal-parameter.xml b/src/libical-glib/api/i-cal-parameter.xml
index 7b1b4a84..a3a6f919 100644
--- a/src/libical-glib/api/i-cal-parameter.xml
+++ b/src/libical-glib/api/i-cal-parameter.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Parameter" native="icalparameter" destroy_func="icalparameter_free">
<method name="i_cal_parameter_new" corresponds="icalparameter_new" kind="constructor" since="1.0">
@@ -19,8 +11,8 @@
<returns type="ICalParameter *" annotation="transfer full" comment="The newly created #ICalParameter." />
<comment xml:space="preserve">Creates a new #ICalParameter according to the kind type.</comment>
</method>
- <method name="i_cal_parameter_clone" corresponds="icalparameter_new_clone" kind="clone" since="1.0">
- <parameter type="ICalParameter *" name="p" annotation="in" comment="The #ICalParameter to be cloned"/>
+ <method name="i_cal_parameter_clone" corresponds="icalparameter_clone" kind="clone" since="3.1">
+ <parameter type="const ICalParameter *" name="p" annotation="in" comment="The #ICalParameter to be cloned"/>
<returns type="ICalParameter *" annotation="transfer full" comment="The newly created #ICalParameter with the same properties as the @p." />
<comment xml:space="preserve">Deep clone a #ICalParameter.</comment>
</method>
diff --git a/src/libical-glib/api/i-cal-parser.xml b/src/libical-glib/api/i-cal-parser.xml
index ede94772..7bca47fa 100644
--- a/src/libical-glib/api/i-cal-parser.xml
+++ b/src/libical-glib/api/i-cal-parser.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Parser" native="icalparser" destroy_func="icalparser_free">
<enum name="ICalParserState" native_name="icalparserstate" default_native="I_CAL_PARSER_ERROR">
diff --git a/src/libical-glib/api/i-cal-period.xml b/src/libical-glib/api/i-cal-period.xml
index 1b02bbc6..8e3fc2ca 100644
--- a/src/libical-glib/api/i-cal-period.xml
+++ b/src/libical-glib/api/i-cal-period.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Period" native="struct icalperiodtype" is_bare="true" default_native="icalperiodtype_null_period ()">
<method name="i_cal_period_get_start" corresponds="CUSTOM" kind="get" since="1.0">
diff --git a/src/libical-glib/api/i-cal-property.xml b/src/libical-glib/api/i-cal-property.xml
index 028a39d3..5e874b66 100644
--- a/src/libical-glib/api/i-cal-property.xml
+++ b/src/libical-glib/api/i-cal-property.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Property" native="icalproperty" destroy_func="icalproperty_free">
<method name="i_cal_property_new" corresponds="icalproperty_new" kind="constructor" since="1.0">
@@ -19,8 +11,8 @@
<returns type="ICalProperty *" annotation="transfer full" comment="The newly created #ICalProperty with the type @kind."/>
<comment xml:space="preserve">Creates a #ICalProperty of the target type.</comment>
</method>
- <method name="i_cal_property_clone" corresponds="icalproperty_new_clone" kind="clone" since="1.0">
- <parameter type="ICalProperty *" name="prop" comment="The #ICalProperty to be cloned"/>
+ <method name="i_cal_property_clone" corresponds="icalproperty_clone" kind="clone" since="3.1">
+ <parameter type="const ICalProperty *" name="prop" comment="The #ICalProperty to be cloned."/>
<returns type="ICalProperty *" annotation="transfer full" comment="The newly created #ICalProperty deeply cloned from @prop."/>
<comment xml:space="preserve">Deeply clone a #ICalProperty.</comment>
</method>
diff --git a/src/libical-glib/api/i-cal-recur-iterator.xml b/src/libical-glib/api/i-cal-recur-iterator.xml
index f5286836..7e0ad916 100644
--- a/src/libical-glib/api/i-cal-recur-iterator.xml
+++ b/src/libical-glib/api/i-cal-recur-iterator.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="RecurIterator" native="icalrecur_iterator" destroy_func="icalrecur_iterator_free">
<method name="i_cal_recur_iterator_new" corresponds="icalrecur_iterator_new" kind="constructor" since="1.0">
@@ -32,6 +24,12 @@
<comment xml:space="preserve">Sets the date-time at which the iterator will start, where 'start' is a value between DTSTART and UNTIL.
Note: CAN NOT be used with RRULEs that contain COUNT.</comment>
</method>
+ <method name="i_cal_recur_iterator_set_end" corresponds="icalrecur_iterator_set_end" since="3.1">
+ <parameter type="ICalRecurIterator *" name="iterator" comment="The iterator"/>
+ <parameter type="ICalTime *" name="end" comment="The date-time at which the iterator will stop"/>
+ <returns type="gint" comment="1 if succeeded, 0 if failed"/>
+ <comment xml:space="preserve">Sets the date-time at which the iterator will stop at the latest. Values equal to or greater than end will not be returned by the iterator.</comment>
+ </method>
<method name="i_cal_recur_iterator_free" corresponds="icalrecur_iterator_free" annotation="skip" kind="destructor" since="1.0">
<parameter type="ICalRecurIterator *" name="iterator" comment="The iterator to be freed"/>
<comment xml:space="preserve">Frees an iterator.</comment>
diff --git a/src/libical-glib/api/i-cal-recur.xml b/src/libical-glib/api/i-cal-recur.xml
index 870ea61b..e1d689b4 100644
--- a/src/libical-glib/api/i-cal-recur.xml
+++ b/src/libical-glib/api/i-cal-recur.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Recur">
<method name="i_cal_recur_expand_recurrence" corresponds="CUSTOM" since="1.0">
diff --git a/src/libical-glib/api/i-cal-recurrence.xml b/src/libical-glib/api/i-cal-recurrence.xml
index be71e6f8..70dfe838 100644
--- a/src/libical-glib/api/i-cal-recurrence.xml
+++ b/src/libical-glib/api/i-cal-recurrence.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Recurrence" native="struct icalrecurrencetype" is_bare="true" default_native="i_cal_recurrence_new_default ()">
<enum name="ICalRecurrenceFrequency" native_name="icalrecurrencetype_frequency" default_native="I_CAL_NO_RECURRENCE">
@@ -93,6 +85,12 @@
<returns type="gint" comment="The decoded day of the week. 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc"/>
<comment xml:space="preserve">Decodes a day to a position of the weekday.</comment>
</method>
+ <method name="i_cal_recurrence_encode_day" corresponds="icalrecurrencetype_encode_day" since="3.0.5">
+ <parameter type="ICalRecurrenceWeekday" name="weekday" comment="The #ICalRecurrenceWeekday to use."/>
+ <parameter type="gint" name="position" comment="The position to use. 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc"/>
+ <returns type="gshort" comment="Encoded @weekday and @position into a single value"/>
+ <comment xml:space="preserve">Encodes the @weekday and @position into a single value, which can by split by i_cal_recurrence_day_day_of_week() and i_cal_recurrence_day_position().</comment>
+ </method>
<method name="i_cal_recurrence_month_is_leap" corresponds="icalrecurrencetype_month_is_leap" since="2.0">
<parameter type="gshort" name="month" comment="The month to be decoded"/>
<returns type="gboolean" comment="Whether this month is a leap month."/>
@@ -101,6 +99,13 @@
<method name="i_cal_recurrence_month_month" corresponds="icalrecurrencetype_month_month" since="2.0">
<parameter type="gshort" name="month" comment="The month to be decoded"/>
<returns type="gint" comment="The actual month number regardless of the leap flag."/>
+ <comment xml:space="preserve">Decode a month from an encoded value by i_cal_recurrence_encode_month().</comment>
+ </method>
+ <method name="i_cal_recurrence_encode_month" corresponds="icalrecurrencetype_encode_month" since="3.0.5">
+ <parameter type="gint" name="month" comment="The month to be encoded"/>
+ <parameter type="gboolean" name="is_leap" comment="%TRUE, when the month is leap, %FALSE otherwise"/>
+ <returns type="gshort" comment="Encoded @month and @is_leap"/>
+ <comment xml:space="preserve">Encodes the @month and the @is_leap flag into a single value, which can be split by i_cal_recurrence_month_is_leap() and i_cal_recurrence_month_month().</comment>
</method>
<method name="i_cal_recurrence_new_from_string" corresponds="icalrecurrencetype_from_string" since="1.0">
<parameter type="const gchar *" name="str" comment="The string representation of the #ICalRecurrence"/>
@@ -186,11 +191,18 @@
<method name="i_cal_recurrence_get_by_second_array" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalRecurrence *" name="recur" comment="The #ICalRecurrence"/>
<returns type="GArray *" annotation="transfer full, element-type gshort" comment="The by_second of #ICalRecurrence."/>
- <comment>Gets the by_second array from #ICalRecurrence. The array size if I_CAL_BY_SECOND_SIZE.</comment>
+ <comment>Gets the by_second array from #ICalRecurrence. The array has a maximum size of I_CAL_BY_SECOND_SIZE.</comment>
<custom> GArray *array;
+ struct icalrecurrencetype *native_recurrence;
+ guint size;
g_return_val_if_fail (recur != NULL &amp;&amp; I_CAL_IS_RECURRENCE (recur), NULL);
+ native_recurrence = (struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur);
array = g_array_new (FALSE, TRUE, sizeof (gshort));
- g_array_append_vals (array, ((struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur))->by_second, I_CAL_BY_SECOND_SIZE);
+ for (size = 0; size &lt; I_CAL_BY_SECOND_SIZE; size++) {
+ if (native_recurrence->by_second[size] == I_CAL_RECURRENCE_ARRAY_MAX)
+ break;
+ }
+ g_array_append_vals (array, native_recurrence->by_second, size);
return array;</custom>
</method>
<method name="i_cal_recurrence_set_by_second_array" corresponds="CUSTOM" kind="set" since="1.0">
@@ -233,11 +245,18 @@
<method name="i_cal_recurrence_get_by_minute_array" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalRecurrence *" name="recur" comment="The #ICalRecurrence"/>
<returns type="GArray *" annotation="transfer full, element-type gshort" comment="The by_minute of #ICalRecurrence."/>
- <comment>Gets the by_minute array from #ICalRecurrence. The array size is I_CAL_BY_MINUTE_SIZE.</comment>
+ <comment>Gets the by_minute array from #ICalRecurrence. The array has a maximum size of I_CAL_BY_MINUTE_SIZE.</comment>
<custom> GArray *array;
+ struct icalrecurrencetype *native_recurrence;
+ guint size;
g_return_val_if_fail (recur != NULL &amp;&amp; I_CAL_IS_RECURRENCE (recur), NULL);
+ native_recurrence = (struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur);
array = g_array_new (FALSE, FALSE, sizeof (gshort));
- g_array_append_vals (array, ((struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur))->by_minute, I_CAL_BY_MINUTE_SIZE);
+ for (size = 0; size &lt; I_CAL_BY_MINUTE_SIZE; size++) {
+ if (native_recurrence->by_minute[size] == I_CAL_RECURRENCE_ARRAY_MAX)
+ break;
+ }
+ g_array_append_vals (array, native_recurrence->by_minute, size);
return array;</custom>
</method>
<method name="i_cal_recurrence_set_by_minute_array" corresponds="CUSTOM" kind="set" since="1.0">
@@ -280,11 +299,18 @@
<method name="i_cal_recurrence_get_by_hour_array" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalRecurrence *" name="recur" comment="The #ICalRecurrence"/>
<returns type="GArray *" annotation="transfer full, element-type gshort" comment="The by_hour of #ICalRecurrence."/>
- <comment>Gets the by_hour array from #ICalRecurrence. The array size is I_CAL_BY_HOUR_SIZE.</comment>
+ <comment>Gets the by_hour array from #ICalRecurrence. The array has a maximum size of I_CAL_BY_HOUR_SIZE.</comment>
<custom> GArray *array;
+ struct icalrecurrencetype *native_recurrence;
+ guint size;
g_return_val_if_fail (recur != NULL &amp;&amp; I_CAL_IS_RECURRENCE (recur), NULL);
array = g_array_new (FALSE, FALSE, sizeof (gshort));
- g_array_append_vals (array, ((struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur))->by_hour, I_CAL_BY_HOUR_SIZE);
+ native_recurrence = (struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur);
+ for (size = 0; size &lt; I_CAL_BY_HOUR_SIZE; size++) {
+ if (native_recurrence->by_hour[size] == I_CAL_RECURRENCE_ARRAY_MAX)
+ break;
+ }
+ g_array_append_vals (array, native_recurrence->by_hour, size);
return array;</custom>
</method>
<method name="i_cal_recurrence_set_by_hour_array" corresponds="CUSTOM" kind="set" since="1.0">
@@ -327,11 +353,18 @@
<method name="i_cal_recurrence_get_by_day_array" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalRecurrence *" name="recur" comment="The #ICalRecurrence"/>
<returns type="GArray *" annotation="transfer full, element-type gshort" comment="The by_day of #ICalRecurrence."/>
- <comment>Gets the by_day array from #ICalRecurrence. The array size is I_CAL_BY_DAY_SIZE.</comment>
+ <comment>Gets the by_day array from #ICalRecurrence. The array has a maximum size of I_CAL_BY_DAY_SIZE.</comment>
<custom> GArray *array;
+ struct icalrecurrencetype *native_recurrence;
+ guint size;
g_return_val_if_fail (recur != NULL &amp;&amp; I_CAL_IS_RECURRENCE (recur), NULL);
array = g_array_new (FALSE, FALSE, sizeof (gshort));
- g_array_append_vals (array, ((struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur))->by_day, I_CAL_BY_DAY_SIZE);
+ native_recurrence = (struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur);
+ for (size = 0; size &lt; I_CAL_BY_DAY_SIZE; size++) {
+ if (native_recurrence->by_day[size] == I_CAL_RECURRENCE_ARRAY_MAX)
+ break;
+ }
+ g_array_append_vals (array, native_recurrence->by_day, size);
return array;</custom>
</method>
<method name="i_cal_recurrence_set_by_day_array" corresponds="CUSTOM" kind="set" since="1.0">
@@ -374,11 +407,18 @@
<method name="i_cal_recurrence_get_by_month_day_array" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalRecurrence *" name="recur" comment="The #ICalRecurrence"/>
<returns type="GArray *" annotation="transfer full, element-type gshort" comment="The by_month_day of #ICalRecurrence."/>
- <comment>Gets the by_month_day array from #ICalRecurrence. The array size is I_CAL_BY_MONTHDAY_SIZE.</comment>
+ <comment>Gets the by_month_day array from #ICalRecurrence. The array has a maximum size of I_CAL_BY_MONTHDAY_SIZE.</comment>
<custom> GArray *array;
+ struct icalrecurrencetype *native_recurrence;
+ guint size;
g_return_val_if_fail (recur != NULL &amp;&amp; I_CAL_IS_RECURRENCE (recur), NULL);
array = g_array_new (FALSE, FALSE, sizeof (gshort));
- g_array_append_vals (array, ((struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur))->by_month_day, I_CAL_BY_MONTHDAY_SIZE);
+ native_recurrence = (struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur);
+ for (size = 0; size &lt; I_CAL_BY_MONTHDAY_SIZE; size++) {
+ if (native_recurrence->by_month_day[size] == I_CAL_RECURRENCE_ARRAY_MAX)
+ break;
+ }
+ g_array_append_vals (array, native_recurrence->by_month_day, size);
return array;</custom>
</method>
<method name="i_cal_recurrence_set_by_month_day_array" corresponds="CUSTOM" kind="set" since="1.0">
@@ -421,11 +461,18 @@
<method name="i_cal_recurrence_get_by_year_day_array" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalRecurrence *" name="recur" comment="The #ICalRecurrence"/>
<returns type="GArray *" annotation="transfer full, element-type gshort" comment="The by_year_day of #ICalRecurrence."/>
- <comment>Gets the by_year_day array from #ICalRecurrence. The array size is I_CAL_BY_YEARDAY_SIZE.</comment>
+ <comment>Gets the by_year_day array from #ICalRecurrence. The array has a maximum size of I_CAL_BY_YEARDAY_SIZE.</comment>
<custom> GArray *array;
+ struct icalrecurrencetype *native_recurrence;
+ guint size;
g_return_val_if_fail (recur != NULL &amp;&amp; I_CAL_IS_RECURRENCE (recur), NULL);
array = g_array_new (FALSE, FALSE, sizeof (gshort));
- g_array_append_vals (array, ((struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur))->by_year_day, I_CAL_BY_YEARDAY_SIZE);
+ native_recurrence = (struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur);
+ for (size = 0; size &lt; I_CAL_BY_YEARDAY_SIZE; size++) {
+ if (native_recurrence->by_year_day[size] == I_CAL_RECURRENCE_ARRAY_MAX)
+ break;
+ }
+ g_array_append_vals (array, native_recurrence->by_year_day, size);
return array;</custom>
</method>
<method name="i_cal_recurrence_set_by_year_day_array" corresponds="CUSTOM" kind="set" since="1.0">
@@ -468,11 +515,18 @@
<method name="i_cal_recurrence_get_by_week_no_array" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalRecurrence *" name="recur" comment="The #ICalRecurrence"/>
<returns type="GArray *" annotation="transfer full, element-type gshort" comment="The by_week_no of #ICalRecurrence."/>
- <comment>Gets the by_week_no array from #ICalRecurrence. The array size is I_CAL_BY_WEEKNO_SIZE.</comment>
+ <comment>Gets the by_week_no array from #ICalRecurrence. The array has a maximum size of I_CAL_BY_WEEKNO_SIZE.</comment>
<custom> GArray *array;
+ struct icalrecurrencetype *native_recurrence;
+ guint size;
g_return_val_if_fail (recur != NULL &amp;&amp; I_CAL_IS_RECURRENCE (recur), NULL);
array = g_array_new (FALSE, FALSE, sizeof (gshort));
- g_array_append_vals (array, ((struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur))->by_week_no, I_CAL_BY_WEEKNO_SIZE);
+ native_recurrence = (struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur);
+ for (size = 0; size &lt; I_CAL_BY_WEEKNO_SIZE; size++) {
+ if (native_recurrence->by_week_no[size] == I_CAL_RECURRENCE_ARRAY_MAX)
+ break;
+ }
+ g_array_append_vals (array, native_recurrence->by_week_no, size);
return array;</custom>
</method>
<method name="i_cal_recurrence_set_by_week_no_array" corresponds="CUSTOM" kind="set" since="1.0">
@@ -515,11 +569,18 @@
<method name="i_cal_recurrence_get_by_month_array" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalRecurrence *" name="recur" comment="The #ICalRecurrence"/>
<returns type="GArray *" annotation="transfer full, element-type gshort" comment="The by_month of #ICalRecurrence."/>
- <comment>Gets the by_month array from #ICalRecurrence. The array size is I_CAL_BY_MONTH_SIZE.</comment>
+ <comment>Gets the by_month array from #ICalRecurrence. The array has a maximum size of I_CAL_BY_MONTH_SIZE.</comment>
<custom> GArray *array;
+ struct icalrecurrencetype *native_recurrence;
+ guint size;
g_return_val_if_fail (recur != NULL &amp;&amp; I_CAL_IS_RECURRENCE (recur), NULL);
array = g_array_new (FALSE, FALSE, sizeof (gshort));
- g_array_append_vals (array, ((struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur))->by_month, I_CAL_BY_MONTH_SIZE);
+ native_recurrence = (struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur);
+ for (size = 0; size &lt; I_CAL_BY_MONTH_SIZE; size++) {
+ if (native_recurrence->by_month[size] == I_CAL_RECURRENCE_ARRAY_MAX)
+ break;
+ }
+ g_array_append_vals (array, native_recurrence->by_month, size);
return array;</custom>
</method>
<method name="i_cal_recurrence_set_by_month_array" corresponds="CUSTOM" kind="set" since="1.0">
@@ -562,11 +623,18 @@
<method name="i_cal_recurrence_get_by_set_pos_array" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalRecurrence *" name="recur" comment="The #ICalRecurrence"/>
<returns type="GArray *" annotation="transfer full, element-type gshort" comment="The by_set_pos of #ICalRecurrence."/>
- <comment>Gets the by_set_pos array from #ICalRecurrence. The array size is I_CAL_BY_SETPOS_SIZE.</comment>
+ <comment>Gets the by_set_pos array from #ICalRecurrence. The array has a maximum size of I_CAL_BY_SETPOS_SIZE.</comment>
<custom> GArray *array;
+ struct icalrecurrencetype *native_recurrence;
+ guint size;
g_return_val_if_fail (recur != NULL &amp;&amp; I_CAL_IS_RECURRENCE (recur), NULL);
array = g_array_new (FALSE, FALSE, sizeof (gshort));
- g_array_append_vals (array, ((struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur))->by_set_pos, I_CAL_BY_SETPOS_SIZE);
+ native_recurrence = (struct icalrecurrencetype *)i_cal_object_get_native ((ICalObject *)recur);
+ for (size = 0; size &lt; I_CAL_BY_SETPOS_SIZE; size++) {
+ if (native_recurrence->by_set_pos[size] == I_CAL_RECURRENCE_ARRAY_MAX)
+ break;
+ }
+ g_array_append_vals (array, native_recurrence->by_set_pos, size);
return array;</custom>
</method>
<method name="i_cal_recurrence_set_by_set_pos_array" corresponds="CUSTOM" kind="set" since="1.0">
diff --git a/src/libical-glib/api/i-cal-reqstat.xml b/src/libical-glib/api/i-cal-reqstat.xml
index f05b1282..dbbdd061 100644
--- a/src/libical-glib/api/i-cal-reqstat.xml
+++ b/src/libical-glib/api/i-cal-reqstat.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Reqstat" native="struct icalreqstattype" is_bare="true" default_native="i_cal_reqstat_new_default ()">
<method name="i_cal_reqstat_new_from_string" corresponds="icalreqstattype_from_string" kind="constructor" since="1.0">
@@ -51,14 +43,14 @@
<parameter type="const ICalReqstat *" name="reqstat" comment="The #ICalReqstat"/>
<returns type="const gchar *" annotation="transfer none" comment="The desc of @reqstat."/>
<comment>Gets the desc of #ICalReqstat.</comment>
- <custom> g_return_val_if_fail (reqstat != NULL &amp;&amp; I_CAL_IS_REQSTAT (reqstat), NULL);
+ <custom> g_return_val_if_fail (reqstat != NULL &amp;&amp; I_CAL_IS_REQSTAT ((ICalReqstat *)reqstat), NULL);
return ((struct icalreqstattype *)i_cal_object_get_native ((ICalObject *)reqstat))->desc;</custom>
</method>
<method name="i_cal_reqstat_get_debug" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="const ICalReqstat *" name="reqstat" comment="The #ICalReqstat"/>
<returns type="const gchar *" annotation="transfer none" comment="The debug of @reqstat."/>
<comment>Gets the debug of #ICalReqstat.</comment>
- <custom> g_return_val_if_fail (reqstat != NULL &amp;&amp; I_CAL_IS_REQSTAT (reqstat), NULL);
+ <custom> g_return_val_if_fail (reqstat != NULL &amp;&amp; I_CAL_IS_REQSTAT ((ICalReqstat *)reqstat), NULL);
return ((struct icalreqstattype *)i_cal_object_get_native ((ICalObject *)reqstat))->debug;</custom>
</method>
</structure>
diff --git a/src/libical-glib/api/i-cal-restriction.xml b/src/libical-glib/api/i-cal-restriction.xml
index 5bc4fe40..77fb117f 100644
--- a/src/libical-glib/api/i-cal-restriction.xml
+++ b/src/libical-glib/api/i-cal-restriction.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Restriction">
<enum name="ICalRestrictionKind" native_name="icalrestriction_kind" default_native="I_CAL_RESTRICTION_UNKNOWN">
diff --git a/src/libical-glib/api/i-cal-time-span.xml b/src/libical-glib/api/i-cal-time-span.xml
index 3576b0ef..ca8cfe9e 100644
--- a/src/libical-glib/api/i-cal-time-span.xml
+++ b/src/libical-glib/api/i-cal-time-span.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="TimeSpan" native="struct icaltime_span" is_bare="true" default_native="icaltime_span_new(icaltime_null_time(), icaltime_null_time(), 0)" includes="libical-glib/i-cal-time.h">
<method name="i_cal_time_span_new_timet" corresponds="CUSTOM" kind="constructor" since="3.0.5">
@@ -31,7 +23,7 @@
<returns type="ICalTimeSpan *" annotation="transfer full" comment="The newly created #ICalTimeSpan, clone of @src." />
<comment xml:space="preserve">Creates a new #ICalTimeSpan, clone of @src. Free it with g_object_unref(), when no longer needed.</comment>
<custom> struct icaltime_span *span;
- g_return_val_if_fail(I_CAL_IS_TIME_SPAN(src), NULL);
+ g_return_val_if_fail(I_CAL_IS_TIME_SPAN((ICalTimeSpan *)src), NULL);
span = ((struct icaltime_span *)i_cal_object_get_native ((ICalObject *)src));
g_return_val_if_fail (span != NULL, NULL);
return i_cal_time_span_new_full(*span);</custom>
diff --git a/src/libical-glib/api/i-cal-time.xml b/src/libical-glib/api/i-cal-time.xml
index 62f894ad..d15bb7e9 100644
--- a/src/libical-glib/api/i-cal-time.xml
+++ b/src/libical-glib/api/i-cal-time.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Time" native="struct icaltimetype" is_bare="true" default_native="icaltime_null_time()">
<method name="i_cal_time_new" corresponds="CUSTOM" kind="constructor" since="1.0">
@@ -25,7 +17,7 @@
<comment xml:space="preserve">Creates a new #ICalTime, copy of @timetype.</comment>
<custom> struct icaltimetype *itt;
- g_return_val_if_fail(I_CAL_IS_TIME(timetype), NULL);
+ g_return_val_if_fail(I_CAL_IS_TIME((ICalTime *)timetype), NULL);
itt = (struct icaltimetype *)i_cal_object_get_native ((ICalObject *)timetype);
g_return_val_if_fail(itt != NULL, NULL);
@@ -174,7 +166,7 @@
<method name="i_cal_time_normalize_inplace" corresponds="CUSTOM" since="3.0.5">
<parameter type="ICalTime *" name="tt" comment="The #ICalTime to be normalized"/>
<comment xml:space="preserve">Normalizes the @tt, so that all fields are within the normal range.</comment>
- <custom xml:space="preserve"> icaltimetype *itt;
+ <custom xml:space="preserve"> icaltimetype *itt;
g_return_if_fail(I_CAL_IS_TIME (tt));
diff --git a/src/libical-glib/api/i-cal-timezone.xml b/src/libical-glib/api/i-cal-timezone.xml
index 0900e612..0de66874 100644
--- a/src/libical-glib/api/i-cal-timezone.xml
+++ b/src/libical-glib/api/i-cal-timezone.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Timezone" native="icaltimezone" is_possible_global="true" destroy_func="i_cal_timezone_destroy">
<method name="i_cal_timezone_new" corresponds="icaltimezone_new" kind="constructor" since="1.0">
diff --git a/src/libical-glib/api/i-cal-trigger.xml b/src/libical-glib/api/i-cal-trigger.xml
index 6d3d1ffb..81cc19ec 100644
--- a/src/libical-glib/api/i-cal-trigger.xml
+++ b/src/libical-glib/api/i-cal-trigger.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Trigger" native="struct icaltriggertype" is_bare="true" default_native="icaltriggertype_from_int (0)">
<method name="i_cal_trigger_new_from_int" corresponds="icaltriggertype_from_int" kind="constructor" since="1.0">
diff --git a/src/libical-glib/api/i-cal-unknowntokenhandling.xml b/src/libical-glib/api/i-cal-unknowntokenhandling.xml
index 5c08c7ba..7d656224 100644
--- a/src/libical-glib/api/i-cal-unknowntokenhandling.xml
+++ b/src/libical-glib/api/i-cal-unknowntokenhandling.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Unknowntokenhandling">
<enum name="ICalUnknowntokenhandling" native_name="ical_unknown_token_handling" default_native="0">
diff --git a/src/libical-glib/api/i-cal-value.xml b/src/libical-glib/api/i-cal-value.xml
index 2fd33dff..c7cf2c6e 100644
--- a/src/libical-glib/api/i-cal-value.xml
+++ b/src/libical-glib/api/i-cal-value.xml
@@ -1,17 +1,9 @@
<!--
- Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
- This library is free software: you can redistribute it and/or modify it
- under the terms of version 2.1. of the GNU Lesser General Public License
- as published by the Free Software Foundation.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- This library 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 Lesser General Public License
- for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Value" native="icalvalue" destroy_func="icalvalue_free" includes="string.h">
<method name="i_cal_value_new" corresponds="icalvalue_new" kind="constructor" since="1.0">
@@ -19,8 +11,9 @@
<returns type="ICalValue *" annotation="transfer full" comment="The newly created #ICalValue."/>
<comment xml:space="preserve">Creates a new #ICalValue with specific kind.</comment>
</method>
- <method name="i_cal_value_clone" corresponds="icalvalue_new_clone" kind="clone" since="1.0">
- <parameter type="const ICalValue *" name="value" comment="The #ICalValue to be cloned"/>
+ <method name="i_cal_value_clone" corresponds="icalvalue_clone" kind="clone" since="3.1">
+ <parameter type="const ICalValue *" name="value" comment="The #ICalValue to
+be cloned."/>
<returns type="ICalValue *" annotation="transfer full" comment="The newly created #ICalValue with the same property as @value."/>
<comment xml:space="preserve">Deeply clone a #ICalValue.</comment>
</method>
diff --git a/src/libical-glib/i-cal-object.c.in b/src/libical-glib/i-cal-object.c.in
index 686c7bcd..95ab14b4 100644
--- a/src/libical-glib/i-cal-object.c.in
+++ b/src/libical-glib/i-cal-object.c.in
@@ -1,17 +1,7 @@
/*
- * Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
*
- * This library is free software: you can redistribute it and/or modify it
- * under the terms of version 2.1. of the GNU Lesser General Public License
- * as published by the Free Software Foundation.
- *
- * This library 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 Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library. If not, see <https://www.gnu.org/licenses/>.
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#ifdef HAVE_CONFIG_H
@@ -20,9 +10,6 @@
#include "i-cal-object.h"
-#define LOCK_PROPS(x) g_mutex_lock (&((x)->priv->props_lock))
-#define UNLOCK_PROPS(x) g_mutex_unlock (&((x)->priv->props_lock))
-
typedef struct _GlobalData {
GType object_type;
gpointer native;
@@ -103,7 +90,7 @@ void i_cal_object_free_global_objects(void)
}
}
-struct _ICalObjectPrivate
+typedef struct
{
GMutex props_lock; /* to guard all the below members */
@@ -113,9 +100,12 @@ struct _ICalObjectPrivate
gboolean always_destroy;
GObject *owner;
GSList *dependers; /* referenced GObject-s */
-};
+} ICalObjectPrivate;
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(ICalObject, i_cal_object, G_TYPE_OBJECT)
-G_DEFINE_ABSTRACT_TYPE(ICalObject, i_cal_object, G_TYPE_OBJECT)
+#define LOCK_PROPS(x) g_mutex_lock (&((x)->props_lock))
+#define UNLOCK_PROPS(x) g_mutex_unlock (&((x)->props_lock))
enum
{
@@ -130,17 +120,16 @@ enum
static void i_cal_object_set_property(GObject *object, guint property_id,
const GValue * value, GParamSpec * pspec)
{
- ICalObject *iobject;
+ ICalObject *iobject = I_CAL_OBJECT(object);
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
g_return_if_fail(I_CAL_IS_OBJECT(object));
- iobject = I_CAL_OBJECT(object);
-
switch (property_id) {
case PROP_NATIVE:
/* no need for LOCK_PROPS() here, these can be set only during construction time */
- g_return_if_fail(iobject->priv->native == NULL);
- iobject->priv->native = g_value_get_pointer(value);
+ g_return_if_fail(priv->native == NULL);
+ priv->native = g_value_get_pointer(value);
return;
case PROP_NATIVE_DESTROY_FUNC:
@@ -149,7 +138,7 @@ static void i_cal_object_set_property(GObject *object, guint property_id,
case PROP_IS_GLOBAL_MEMORY:
/* no need for LOCK_PROPS() here, these can be set only during construction time */
- iobject->priv->is_global_memory = g_value_get_boolean(value);
+ priv->is_global_memory = g_value_get_boolean(value);
return;
case PROP_ALWAYS_DESTROY:
@@ -167,12 +156,10 @@ static void i_cal_object_set_property(GObject *object, guint property_id,
static void i_cal_object_get_property(GObject *object, guint property_id,
GValue * value, GParamSpec * pspec)
{
- ICalObject *iobject;
+ ICalObject *iobject = I_CAL_OBJECT(object);
g_return_if_fail(I_CAL_IS_OBJECT(object));
- iobject = I_CAL_OBJECT(object);
-
switch (property_id) {
case PROP_NATIVE:
g_value_set_pointer(value, i_cal_object_get_native(iobject));
@@ -201,20 +188,19 @@ static void i_cal_object_get_property(GObject *object, guint property_id,
static void i_cal_object_finalize(GObject *object)
{
ICalObject *iobject = I_CAL_OBJECT(object);
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
- if ((iobject->priv->always_destroy || !iobject->priv->owner) &&
- !iobject->priv->is_global_memory &&
- iobject->priv->native && iobject->priv->native_destroy_func) {
- iobject->priv->native_destroy_func(iobject->priv->native);
+ if ((priv->always_destroy || !priv->owner) &&
+ !priv->is_global_memory &&
+ priv->native && priv->native_destroy_func) {
+ g_clear_pointer(&priv->native, priv->native_destroy_func);
}
- if (iobject->priv->owner) {
- g_object_unref(iobject->priv->owner);
- }
+ g_clear_object(&priv->owner);
- g_slist_free_full(iobject->priv->dependers, g_object_unref);
+ g_slist_free_full(priv->dependers, g_object_unref);
- g_mutex_clear(&iobject->priv->props_lock);
+ g_mutex_clear(&priv->props_lock);
/* Chain up to parent's method. */
G_OBJECT_CLASS(i_cal_object_parent_class)->finalize(object);
@@ -224,8 +210,6 @@ static void i_cal_object_class_init(ICalObjectClass * class)
{
GObjectClass *object_class;
- g_type_class_add_private(class, sizeof(ICalObjectPrivate));
-
object_class = G_OBJECT_CLASS(class);
object_class->set_property = i_cal_object_set_property;
object_class->get_property = i_cal_object_get_property;
@@ -319,9 +303,9 @@ static void i_cal_object_class_init(ICalObjectClass * class)
static void i_cal_object_init(ICalObject *iobject)
{
- iobject->priv = G_TYPE_INSTANCE_GET_PRIVATE(iobject, I_CAL_TYPE_OBJECT, ICalObjectPrivate);
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
- g_mutex_init(&iobject->priv->props_lock);
+ g_mutex_init(&priv->props_lock);
}
/**
@@ -354,6 +338,7 @@ i_cal_object_construct(GType object_type,
GObject *owner)
{
ICalObject *iobject;
+ ICalObjectPrivate *priv;
g_return_val_if_fail(object_type != G_TYPE_INVALID, NULL);
g_return_val_if_fail(native != NULL, NULL);
@@ -379,14 +364,15 @@ i_cal_object_construct(GType object_type,
}
iobject = g_object_new(object_type, NULL);
+ priv = i_cal_object_get_instance_private(iobject);
/* LOCK_PROPS (iobject); */
- g_warn_if_fail(iobject->priv->native == NULL);
+ g_warn_if_fail(priv->native == NULL);
- iobject->priv->native = native;
- iobject->priv->native_destroy_func = native_destroy_func;
- iobject->priv->is_global_memory = is_global_memory;
+ priv->native = native;
+ priv->native_destroy_func = native_destroy_func;
+ priv->is_global_memory = is_global_memory;
i_cal_object_set_owner(iobject, owner);
/* UNLOCK_PROPS (iobject); */
@@ -427,14 +413,15 @@ i_cal_object_construct(GType object_type,
gpointer i_cal_object_get_native(ICalObject *iobject)
{
gpointer native;
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
g_return_val_if_fail(I_CAL_IS_OBJECT(iobject), NULL);
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- native = iobject->priv->native;
+ native = priv->native;
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
return native;
}
@@ -453,15 +440,15 @@ gpointer i_cal_object_get_native(ICalObject *iobject)
gpointer i_cal_object_steal_native(ICalObject *iobject)
{
gpointer native;
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
g_return_val_if_fail(I_CAL_IS_OBJECT(iobject), NULL);
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- native = iobject->priv->native;
- iobject->priv->native = NULL;
+ native = g_steal_pointer(&priv->native);
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
return native;
}
@@ -480,14 +467,15 @@ gpointer i_cal_object_steal_native(ICalObject *iobject)
GDestroyNotify i_cal_object_get_native_destroy_func(ICalObject *iobject)
{
GDestroyNotify func;
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
g_return_val_if_fail(I_CAL_IS_OBJECT(iobject), NULL);
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- func = iobject->priv->native_destroy_func;
+ func = priv->native_destroy_func;
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
return func;
}
@@ -503,18 +491,20 @@ GDestroyNotify i_cal_object_get_native_destroy_func(ICalObject *iobject)
**/
void i_cal_object_set_native_destroy_func(ICalObject *iobject, GDestroyNotify native_destroy_func)
{
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
+
g_return_if_fail(I_CAL_IS_OBJECT(iobject));
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- if (native_destroy_func == iobject->priv->native_destroy_func) {
- UNLOCK_PROPS(iobject);
+ if (native_destroy_func == priv->native_destroy_func) {
+ UNLOCK_PROPS(priv);
return;
}
- iobject->priv->native_destroy_func = native_destroy_func;
+ priv->native_destroy_func = native_destroy_func;
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
g_object_notify(G_OBJECT(iobject), "native-destroy-func");
}
@@ -532,15 +522,16 @@ void i_cal_object_set_native_destroy_func(ICalObject *iobject, GDestroyNotify na
**/
gboolean i_cal_object_get_is_global_memory(ICalObject *iobject)
{
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
gboolean is_global_memory;
g_return_val_if_fail(I_CAL_IS_OBJECT(iobject), FALSE);
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- is_global_memory = iobject->priv->is_global_memory;
+ is_global_memory = priv->is_global_memory;
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
return is_global_memory;
}
@@ -557,24 +548,22 @@ gboolean i_cal_object_get_is_global_memory(ICalObject *iobject)
**/
void i_cal_object_set_owner(ICalObject *iobject, GObject *owner)
{
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
+
g_return_if_fail(I_CAL_IS_OBJECT(iobject));
if (owner)
g_return_if_fail(G_IS_OBJECT(owner));
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- if (owner == iobject->priv->owner) {
- UNLOCK_PROPS(iobject);
+ if (owner == priv->owner) {
+ UNLOCK_PROPS(priv);
return;
}
- if (owner) {
- g_object_ref(owner);
- }
- g_clear_object(&iobject->priv->owner);
- iobject->priv->owner = owner;
+ g_set_object(&priv->owner, owner);
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
g_object_notify(G_OBJECT(iobject), "owner");
}
@@ -594,17 +583,18 @@ void i_cal_object_set_owner(ICalObject *iobject, GObject *owner)
**/
GObject *i_cal_object_ref_owner(ICalObject *iobject)
{
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
GObject *owner;
g_return_val_if_fail(I_CAL_IS_OBJECT(iobject), NULL);
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- owner = iobject->priv->owner;
+ owner = priv->owner;
if (owner)
g_object_ref(owner);
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
return owner;
}
@@ -619,19 +609,15 @@ GObject *i_cal_object_ref_owner(ICalObject *iobject)
**/
void i_cal_object_remove_owner(ICalObject *iobject)
{
- GObject *owner;
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
g_return_if_fail(I_CAL_IS_OBJECT(iobject));
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- owner = iobject->priv->owner;
- if (owner) {
- g_object_unref(owner);
- iobject->priv->owner = NULL;
- }
+ g_clear_object(&priv->owner);
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
}
/**
@@ -648,20 +634,22 @@ void i_cal_object_remove_owner(ICalObject *iobject)
**/
void i_cal_object_add_depender(ICalObject *iobject, GObject *depender)
{
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
+
g_return_if_fail(I_CAL_IS_OBJECT(iobject));
g_return_if_fail(G_IS_OBJECT(depender));
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- if (g_slist_find(iobject->priv->dependers, depender)) {
+ if (g_slist_find(priv->dependers, depender)) {
g_warn_if_reached();
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
return;
}
- iobject->priv->dependers = g_slist_prepend(iobject->priv->dependers, g_object_ref(depender));
+ priv->dependers = g_slist_prepend(priv->dependers, g_object_ref(depender));
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
}
/**
@@ -677,21 +665,23 @@ void i_cal_object_add_depender(ICalObject *iobject, GObject *depender)
**/
void i_cal_object_remove_depender(ICalObject *iobject, GObject *depender)
{
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
+
g_return_if_fail(I_CAL_IS_OBJECT(iobject));
g_return_if_fail(G_IS_OBJECT(depender));
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- if (!g_slist_find(iobject->priv->dependers, depender)) {
+ if (!g_slist_find(priv->dependers, depender)) {
g_warn_if_reached();
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
return;
}
- iobject->priv->dependers = g_slist_remove(iobject->priv->dependers, depender);
+ priv->dependers = g_slist_remove(priv->dependers, depender);
g_object_unref(depender);
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
}
/**
@@ -706,17 +696,18 @@ void i_cal_object_remove_depender(ICalObject *iobject, GObject *depender)
**/
void i_cal_object_set_always_destroy(ICalObject *iobject, gboolean value)
{
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
gboolean changed;
g_return_if_fail(I_CAL_IS_OBJECT(iobject));
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- changed = (value ? 1 : 0) != (iobject->priv->always_destroy ? 1 : 0);
+ changed = (value ? 1 : 0) != (priv->always_destroy ? 1 : 0);
if (changed)
- iobject->priv->always_destroy = value;
+ priv->always_destroy = value;
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
if (changed)
g_object_notify(G_OBJECT(iobject), "always-destroy");
@@ -734,15 +725,16 @@ void i_cal_object_set_always_destroy(ICalObject *iobject, gboolean value)
**/
gboolean i_cal_object_get_always_destroy(ICalObject *iobject)
{
+ ICalObjectPrivate *priv = i_cal_object_get_instance_private(iobject);
gboolean value;
g_return_val_if_fail(I_CAL_IS_OBJECT(iobject), FALSE);
- LOCK_PROPS(iobject);
+ LOCK_PROPS(priv);
- value = iobject->priv->always_destroy;
+ value = priv->always_destroy;
- UNLOCK_PROPS(iobject);
+ UNLOCK_PROPS(priv);
return value;
}
diff --git a/src/libical-glib/i-cal-object.h.in b/src/libical-glib/i-cal-object.h.in
index 19438fd4..9803b5c2 100644
--- a/src/libical-glib/i-cal-object.h.in
+++ b/src/libical-glib/i-cal-object.h.in
@@ -1,17 +1,7 @@
/*
- * Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
*
- * This library is free software: you can redistribute it and/or modify it
- * under the terms of version 2.1. of the GNU Lesser General Public License
- * as published by the Free Software Foundation.
- *
- * This library 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 Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library. If not, see <https://www.gnu.org/licenses/>.
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#if !defined (__LIBICAL_GLIB_H_INSIDE__) && !defined (LIBICAL_GLIB_COMPILATION)
@@ -29,26 +19,8 @@
#define I_CAL_TYPE_OBJECT \
(i_cal_object_get_type ())
-
-#define I_CAL_OBJECT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST \
- ((obj), I_CAL_TYPE_OBJECT, ICalObject))
-
-#define I_CAL_OBJECT_CLASS(cls) \
- (G_TYPE_CHECK_CLASS_CAST \
- ((cls), I_CAL_TYPE_OBJECT, ICalObjectClass))
-
-#define I_CAL_IS_OBJECT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE \
- ((obj), I_CAL_TYPE_OBJECT))
-
-#define I_CAL_IS_OBJECT_CLASS(cls) \
- (G_TYPE_CHECK_CLASS_TYPE \
- ((cls), I_CAL_TYPE_OBJECT))
-
-#define I_CAL_OBJECT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS \
- ((obj), I_CAL_TYPE_OBJECT, ICalObjectClass))
+LIBICAL_ICAL_EXPORT
+G_DECLARE_DERIVABLE_TYPE(ICalObject, i_cal_object, I_CAL, OBJECT, GObject)
G_BEGIN_DECLS
/**
@@ -56,22 +28,12 @@ G_BEGIN_DECLS
*
* This is an ICalObject instance struct.
*/
-typedef struct _ICalObject ICalObject;
/**
* ICalObjectClass:
*
* This is an ICalObject class struct.
*/
-typedef struct _ICalObjectClass ICalObjectClass;
-typedef struct _ICalObjectPrivate ICalObjectPrivate;
-
-struct _ICalObject
-{
- /*< private > */
- GObject parent;
- ICalObjectPrivate *priv;
-};
struct _ICalObjectClass
{
@@ -79,8 +41,6 @@ struct _ICalObjectClass
GObjectClass parent_class;
};
-LIBICAL_ICAL_EXPORT GType i_cal_object_get_type(void);
-
LIBICAL_ICAL_EXPORT gpointer i_cal_object_construct(GType object_type,
gpointer native,
GDestroyNotify native_destroy_func,
diff --git a/src/libical-glib/libical-glib.pc.in b/src/libical-glib/libical-glib.pc.in
index e164cfb5..8938834f 100644
--- a/src/libical-glib/libical-glib.pc.in
+++ b/src/libical-glib/libical-glib.pc.in
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Copyright Contributors to the libical project
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
diff --git a/src/libical-glib/tools/generator.c b/src/libical-glib/tools/generator.c
index 694c5fd0..d1d3fc23 100644
--- a/src/libical-glib/tools/generator.c
+++ b/src/libical-glib/tools/generator.c
@@ -1,16 +1,7 @@
/*
- * Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
*
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of either:
- *
- * The LGPL as published by the Free Software Foundation, version
- * 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
- *
- * Or:
- *
- * The Mozilla Public License Version 2.0. You may obtain a copy of
- * the License at https://www.mozilla.org/MPL/
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#include "generator.h"
@@ -329,26 +320,6 @@ gchar *get_lower_train_from_upper_camel(const gchar *upperCamel)
return ret;
}
-void generate_header_method_get_type(FILE *out, Structure *structure)
-{
- gchar *upperCamel;
- gchar *lowerSnake;
- Method *get_type;
-
- g_return_if_fail(out != NULL && structure != NULL);
- upperCamel = g_strconcat(structure->nameSpace, structure->name, NULL);
- lowerSnake = get_lower_snake_from_upper_camel(upperCamel);
- g_free(upperCamel);
-
- get_type = method_new();
- get_type->ret = ret_new();
- get_type->ret->type = g_strdup("GType");
- get_type->name = g_strconcat(lowerSnake, "_get_type", NULL);
- g_free(lowerSnake);
- generate_header_method_proto(out, get_type, FALSE);
- method_free(get_type);
-}
-
void generate_header_method_new_full(FILE *out, Structure *structure)
{
gchar *upperCamel;
@@ -707,8 +678,6 @@ void generate_header_method_protos(FILE *out, Structure *structure)
write_str(privateHeader, privateHeaderComment);
g_free(privateHeaderComment);
generate_header_method_new_full(privateHeader, structure);
-
- generate_header_method_get_type(out, structure);
}
for (iter = g_list_first(structure->methods); iter != NULL; iter = g_list_next(iter)) {
@@ -1667,7 +1636,7 @@ gchar *get_inline_parameter(Parameter *para)
(void)g_stpcpy(buffer + strlen(buffer), translator);
(void)g_stpcpy(buffer + strlen(buffer), " (");
if (para->translator == NULL && !is_enum_type(para->type))
- (void)g_stpcpy(buffer + strlen(buffer), "I_CAL_OBJECT (");
+ (void)g_stpcpy(buffer + strlen(buffer), "I_CAL_OBJECT ((ICalObject *)");
}
(void)g_stpcpy(buffer + strlen(buffer), para->name);
@@ -2110,8 +2079,8 @@ gchar *get_source_run_time_checkers(Method *method, const gchar *namespace)
nameSpaceUpperSnake = get_upper_snake_from_upper_camel(namespace);
nameUpperSnake = get_upper_snake_from_upper_camel(trueType + i);
typeCheck =
- g_strconcat(nameSpaceUpperSnake, "_IS_", nameUpperSnake, " (", parameter->name,
- ")", NULL);
+ g_strconcat(nameSpaceUpperSnake, "_IS_", nameUpperSnake, " ((", trueType, "*)",
+ parameter->name, ")", NULL);
defaultValue = NULL;
if (method->ret != NULL) {
retTrueType = get_true_type(method->ret->type);
diff --git a/src/libical-glib/tools/generator.h b/src/libical-glib/tools/generator.h
index 4aa14693..31a4ea35 100644
--- a/src/libical-glib/tools/generator.h
+++ b/src/libical-glib/tools/generator.h
@@ -1,16 +1,7 @@
/*
- * Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
*
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of either:
- *
- * The LGPL as published by the Free Software Foundation, version
- * 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
- *
- * Or:
- *
- * The Mozilla Public License Version 2.0. You may obtain a copy of
- * the License at https://www.mozilla.org/MPL/
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#ifndef GENERATOR_H
diff --git a/src/libical-glib/tools/header-forward-declarations-template b/src/libical-glib/tools/header-forward-declarations-template
index 7ea06c29..95de7492 100644
--- a/src/libical-glib/tools/header-forward-declarations-template
+++ b/src/libical-glib/tools/header-forward-declarations-template
@@ -1,19 +1,9 @@
/* Generated file (by generator) */
/*
- * Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
*
- * This library is free software: you can redistribute it and/or modify it
- * under the terms of version 2.1. of the GNU Lesser General Public License
- * as published by the Free Software Foundation.
- *
- * This library 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 Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library. If not, see <https://www.gnu.org/licenses/>.
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#if !defined (__LIBICAL_GLIB_H_INSIDE__) && !defined (LIBICAL_GLIB_COMPILATION)
diff --git a/src/libical-glib/tools/header-header-template b/src/libical-glib/tools/header-header-template
index 9dde6369..b19012c2 100644
--- a/src/libical-glib/tools/header-header-template
+++ b/src/libical-glib/tools/header-header-template
@@ -1,19 +1,9 @@
/* Generated file (by generator) */
/*
- * Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
*
- * This library is free software: you can redistribute it and/or modify it
- * under the terms of version 2.1. of the GNU Lesser General Public License
- * as published by the Free Software Foundation.
- *
- * This library 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 Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library. If not, see <https://www.gnu.org/licenses/>.
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#ifndef LIBICAL_GLIB_H
@@ -21,10 +11,6 @@
#include <glib-object.h>
-#if !defined(LIBICAL_GLIB_UNSTABLE_API) && !defined(LIBICAL_GLIB_COMPILATION)
-#error "Define LIBICAL_GLIB_UNSTABLE_API, to indicate it's understood the libical-glib API is currently unstable"
-#endif
-
#define __LIBICAL_GLIB_H_INSIDE__
#include <libical-glib/i-cal-forward-declarations.h>
diff --git a/src/libical-glib/tools/header-structure-boilerplate-template b/src/libical-glib/tools/header-structure-boilerplate-template
index 5386360f..b07dfa62 100644
--- a/src/libical-glib/tools/header-structure-boilerplate-template
+++ b/src/libical-glib/tools/header-structure-boilerplate-template
@@ -1,21 +1,8 @@
+
#define ${namespaceLowerSnake}_TYPE_${nameLowerSnake} \
(${lowerSnake}_get_type ())
-
-#define ${upperSnake}(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST \
- ((obj), ${namespaceLowerSnake}_TYPE_${nameLowerSnake}, ${upperCamel}))
-
-#define ${upperSnake}_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST \
- ((klass), ${namespaceLowerSnake}_TYPE_${nameLowerSnake}, ${upperCamel}Class))
-
-#define ${namespaceLowerSnake}_IS_${nameLowerSnake}(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE \
- ((obj), ${namespaceLowerSnake}_TYPE_${nameLowerSnake}))
-
-#define ${namespaceLowerSnake}_IS_${nameLowerSnake}_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE \
- ((klass), ${namespaceLowerSnake}_TYPE_${nameLowerSnake}))
+LIBICAL_ICAL_EXPORT
+G_DECLARE_DERIVABLE_TYPE(${upperCamel}, ${lowerSnake}, ${namespaceLowerSnake}, ${nameLowerSnake}, ICalObject)
/**
* ${upperCamel}:
@@ -28,13 +15,6 @@
*
* This is the ${upperCamel} class.
*/
-typedef struct _${upperCamel}Class ${upperCamel}Class;
-
-struct _${upperCamel} {
- /*< private >*/
- ICalObject parent;
-};
-
struct _${upperCamel}Class {
/*< private >*/
ICalObjectClass parent;
diff --git a/src/libical-glib/tools/header-template b/src/libical-glib/tools/header-template
index f4edf16f..a51c7331 100644
--- a/src/libical-glib/tools/header-template
+++ b/src/libical-glib/tools/header-template
@@ -1,19 +1,9 @@
/* Generated file (by generator) */
/*
- * Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
*
- * This library is free software: you can redistribute it and/or modify it
- * under the terms of version 2.1. of the GNU Lesser General Public License
- * as published by the Free Software Foundation.
- *
- * This library 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 Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library. If not, see <https://www.gnu.org/licenses/>.
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#if !defined (__LIBICAL_GLIB_H_INSIDE__) && !defined (LIBICAL_GLIB_COMPILATION)
diff --git a/src/libical-glib/tools/source-template b/src/libical-glib/tools/source-template
index 8b71354e..4a354b2c 100644
--- a/src/libical-glib/tools/source-template
+++ b/src/libical-glib/tools/source-template
@@ -1,19 +1,9 @@
/* Generated file (by generator) */
/*
- * Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
*
- * This library is free software: you can redistribute it and/or modify it
- * under the terms of version 2.1. of the GNU Lesser General Public License
- * as published by the Free Software Foundation.
- *
- * This library 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 Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library. If not, see <https://www.gnu.org/licenses/>.
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#ifdef HAVE_CONFIG_H
diff --git a/src/libical-glib/tools/xml-parser.c b/src/libical-glib/tools/xml-parser.c
index a9cf2704..76e39b7f 100644
--- a/src/libical-glib/tools/xml-parser.c
+++ b/src/libical-glib/tools/xml-parser.c
@@ -1,16 +1,7 @@
/*
- * Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
*
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of either:
- *
- * The LGPL as published by the Free Software Foundation, version
- * 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
- *
- * Or:
- *
- * The Mozilla Public License Version 2.0. You may obtain a copy of
- * the License at https://www.mozilla.org/MPL/
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#include "xml-parser.h"
diff --git a/src/libical-glib/tools/xml-parser.h b/src/libical-glib/tools/xml-parser.h
index bccbb4d3..403c40c0 100644
--- a/src/libical-glib/tools/xml-parser.h
+++ b/src/libical-glib/tools/xml-parser.h
@@ -1,16 +1,8 @@
/*
- * Copyright (C) 2015 William Yu <williamyu@gnome.org>
+ * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
*
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of either:
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*
- * The LGPL as published by the Free Software Foundation, version
- * 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
- *
- * Or:
- *
- * The Mozilla Public License Version 2.0. You may obtain a copy of
- * the License at https://www.mozilla.org/MPL/
*/
#ifndef XML_PARSER_H
diff --git a/src/libical/CMakeLists.txt b/src/libical/CMakeLists.txt
index 47d11309..f53413a1 100644
--- a/src/libical/CMakeLists.txt
+++ b/src/libical/CMakeLists.txt
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
add_definitions(-Dlibical_ical_EXPORTS)
configure_file(
@@ -6,12 +9,20 @@ configure_file(
@ONLY
)
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/icaltime.h.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/icaltime.h
+)
+
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
+if(LIBICAL_DEVMODE_MEMORY_CONSISTENCY)
+ include_directories(${CMAKE_SOURCE_DIR}/src/test)
+endif()
if(ICU_FOUND)
include_directories(${ICU_INCLUDE_DIRS})
@@ -42,6 +53,7 @@ add_custom_command(
DEPENDS
${PROPERTYDEPS}
${CMAKE_SOURCE_DIR}/src/libical/icalderivedproperty.h.in
+ COMMENT "Generate icalderivedproperty.h"
)
list(APPEND BUILT_HEADERS ${CMAKE_BINARY_DIR}/src/libical/icalderivedproperty.h)
@@ -57,6 +69,7 @@ add_custom_command(
DEPENDS
${PROPERTYDEPS}
${CMAKE_SOURCE_DIR}/src/libical/icalderivedproperty.c.in
+ COMMENT "Generate icalderivedproperty.c"
)
list(APPEND BUILT_SOURCES ${CMAKE_BINARY_DIR}/src/libical/icalderivedproperty.c)
@@ -76,6 +89,7 @@ add_custom_command(
DEPENDS
${PARAMETERDEPS}
${CMAKE_SOURCE_DIR}/src/libical/icalderivedparameter.h.in
+ COMMENT "Generate icalderivedparameter.h"
)
list(APPEND BUILT_HEADERS ${CMAKE_BINARY_DIR}/src/libical/icalderivedparameter.h)
@@ -90,6 +104,7 @@ add_custom_command(
DEPENDS
${PARAMETERDEPS}
${CMAKE_SOURCE_DIR}/src/libical/icalderivedparameter.c.in
+ COMMENT "Generate icalderivedparameter.c"
)
list(APPEND BUILT_SOURCES ${CMAKE_BINARY_DIR}/src/libical/icalderivedparameter.c)
@@ -109,6 +124,7 @@ add_custom_command(
DEPENDS
${RESTRICTIONDEPS}
${CMAKE_SOURCE_DIR}/src/libical/icalrestriction.c.in
+ COMMENT "Generate icalrestriction.c"
)
list(APPEND BUILT_SOURCES ${CMAKE_BINARY_DIR}/src/libical/icalrestriction.c)
@@ -128,6 +144,7 @@ add_custom_command(
DEPENDS
${VALUEDEPS}
${CMAKE_SOURCE_DIR}/src/libical/icalderivedvalue.h.in
+ COMMENT "Generate icalderivedvalue.h"
)
list(APPEND BUILT_HEADERS ${CMAKE_BINARY_DIR}/src/libical/icalderivedvalue.h)
@@ -142,6 +159,7 @@ add_custom_command(
DEPENDS
${VALUEDEPS}
${CMAKE_SOURCE_DIR}/src/libical/icalderivedvalue.c.in
+ COMMENT "Generate icalderivedvalue.c"
)
list(APPEND BUILT_SOURCES ${CMAKE_BINARY_DIR}/src/libical/icalderivedvalue.c)
@@ -156,14 +174,13 @@ endif()
add_custom_target(
ical-header ALL
DEPENDS ${CMAKE_BINARY_DIR}/src/libical/ical.h
+ COMMENT "Target to generate the aggregate ical.h header"
)
# GObject Introspection
if(HAVE_INTROSPECTION)
include(GObjectIntrospectionMacros)
set(GObjectIntrospection_GIRS)
- #set(GObjectIntrospection_SCANNER_ARGS "--add-include-path=${CMAKE_CURRENT_SOURCE_DIR}")
- #set(GObjectIntrospection_COMPILER_ARGS "--includedir=${CMAKE_CURRENT_SOURCE_DIR}")
set(LIBICAL_GIR_VERSION_STRING "${LIBICAL_LIB_MAJOR_VERSION}.0")
set(LIB_VERSION "${LIBICAL_LIB_MAJOR_VERSION}_0")
@@ -178,7 +195,7 @@ if(HAVE_INTROSPECTION)
)
set(ICal_${LIB_VERSION}_gir_LIBRARY "ical")
set(ICal_${LIB_VERSION}_gir_INCLUDES GObject-2.0)
- set(_includes ${_includes} "-L${LIBRARY_OUTPUT_PATH}")
+ set(_includes "-L${LIBRARY_OUTPUT_PATH}")
set(ICal_${LIB_VERSION}_gir_CFLAGS ${_includes})
set(ICal_${LIB_VERSION}_gir_LIBS ical)
@@ -238,11 +255,16 @@ set(ical_LIB_SRCS
pvl.h
sspm.c
sspm.h
+ qsort_gen.c
+ qsort_gen.h
icallangbind.h
icallangbind.c
caldate.c
astime.h
)
+if(LIBICAL_DEVMODE_MEMORY_CONSISTENCY)
+ list(APPEND ical_LIB_SRCS ${PROJECT_SOURCE_DIR}/src/test/test-malloc.c)
+endif()
add_custom_command(
OUTPUT
@@ -254,6 +276,7 @@ add_custom_command(
-DICAL_FILE_H_FILE:FILEPATH=${CMAKE_BINARY_DIR}/src/libical/ical.h
-P ${CMAKE_CURRENT_SOURCE_DIR}/ical_file.cmake
DEPENDS ${ical_LIB_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/ical_file.cmake
+ COMMENT "Generate the aggregate ical.h header"
)
add_library(ical ${LIBRARY_TYPE} ${ical_LIB_SRCS})
@@ -267,8 +290,9 @@ endif()
target_include_directories(ical INTERFACE "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>")
-target_link_libraries(ical ${CMAKE_THREAD_LIBS_INIT})
-
+if(DEFINED CMAKE_THREAD_LIBS_INIT)
+ target_link_libraries(ical ${CMAKE_THREAD_LIBS_INIT})
+endif()
if(ICU_FOUND)
target_link_libraries(ical ${ICU_LIBRARIES})
endif()
@@ -334,7 +358,10 @@ if(WITH_CXX_BINDINGS)
elseif(STATIC_ONLY)
add_library(ical_cxx-static ALIAS ical_cxx)
endif()
- target_link_libraries(ical_cxx ical ${CMAKE_THREAD_LIBS_INIT})
+ target_link_libraries(ical_cxx ical)
+ if(DEFINED CMAKE_THREAD_LIBS_INIT)
+ target_link_libraries(ical_cxx ${CMAKE_THREAD_LIBS_INIT})
+ endif()
if(MSVC)
set_target_properties(ical_cxx PROPERTIES PREFIX "lib")
@@ -395,11 +422,12 @@ install(FILES
icalproperty.h
icalrecur.h
icalrestriction.h
- icaltime.h
+ ${CMAKE_BINARY_DIR}/src/libical/icaltime.h
icaltz-util.h
icaltimezone.h
icaltypes.h
icalvalue.h
+ libical_deprecated.h
libical_ical_export.h
pvl.h
sspm.h
diff --git a/src/libical/astime.h b/src/libical/astime.h
index 38b12c4f..f89ddf67 100644
--- a/src/libical/astime.h
+++ b/src/libical/astime.h
@@ -1,4 +1,8 @@
/*
+ * This work is based on work from Hiram Clawson and has been modified to the
+ * needs of the libical project. The original copyright notice is as follows:
+ */
+/*
* Copyright (c) 1986-2000, Hiram Clawson
* All rights reserved.
*
@@ -33,6 +37,18 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+/*
+ * The modifications made are licensed as follows (to distinguish between
+ * the original code and the modifications made, refer to the source code
+ * history):
+ */
+ /*======================================================================
+
+ SPDX-FileCopyrightText: 2018, Markus Minichmayr
+ https://tapkey.com
+
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+ ========================================================================*/
/**
* @file astime.h
@@ -42,6 +58,7 @@
#ifndef ICAL_ASTIME_H
#define ICAL_ASTIME_H
+#include "libical_deprecated.h"
#include "libical_ical_export.h"
typedef struct ut_instant
@@ -62,10 +79,63 @@ typedef struct ut_instant
/* Functions in caldate.c */
-/** @brief Converts Julian date to year,mo,da. */
-LIBICAL_ICAL_EXPORT long caldat(UTinstantPtr);
+/** Converts julian date to year,mo,da
+ * @deprecated use caldat_int() instead
+ */
+LIBICAL_ICAL_EXPORT LIBICAL_DEPRECATED(long caldat(UTinstantPtr));
+
+/** Returns julian day from year,mo,da
+ * @deprecated use juldat_int() instead
+ */
+LIBICAL_ICAL_EXPORT LIBICAL_DEPRECATED(double juldat(UTinstantPtr));
+
+typedef struct ut_instant_int
+{
+ long j_date0; /**< julian decimal date, 0 = 01 Jan 4713 BC */
+ long year; /**< year, valid range [-4,713, +32,767] */
+ int month; /**< [1-12] */
+ int day; /**< [1-31] */
+ int weekday; /**< [0-6] */
+ int day_of_year; /**< [1-366] */
+} UTinstantInt, *UTinstantIntPtr;
+
+/* Functions in caldate.c */
+
+/**
+ * caldat computes the day of the week, the day of the year
+ * the gregorian (or julian) calendar date
+ * from the julian decimal date.
+ * for astronomical purposes, The Gregorian calendar reform occurred
+ * on 15 Oct. 1582. This is 05 Oct 1582 by the julian calendar.
+
+ * Input: a ut_instant structure pointer, where the j_date element
+ * has been set. ( = 0 for 01 Jan 4713 B.C.)
+ *
+ * output: will set all the other elements of the structure.
+ * As a convenience, the function will also return the year.
+ *
+ * Reference: Astronomial formulae for calculators, meeus, p 23
+ * from fortran program by F. Espenak - April 1982 Page 277,
+ * 50 Year canon of solar eclipses: 1986-2035
+ *
+ */
+void caldat_int(UTinstantIntPtr);
-/** @brief Returns Julian day from year,mo,da. */
-LIBICAL_ICAL_EXPORT double juldat(UTinstantPtr);
+/**
+ * juldat computes the julian decimal date (j_date) from
+ * the gregorian (or Julian) calendar date.
+ * for astronomical purposes, The Gregorian calendar reform occurred
+ * on 15 Oct. 1582. This is 05 Oct 1582 by the julian calendar.
+ * Input: a ut_instant structure pointer where Day, Month, Year
+ * have been set for the date in question.
+ *
+ * Output: the j_date and weekday elements of the structure will be set.
+ * Also, the return value of the function will be the j_date too.
+ *
+ * Reference: Astronomial formulae for calculators, meeus, p 23
+ * from fortran program by F. Espenak - April 1982 Page 276,
+ * 50 Year canon of solar eclipses: 1986-2035
+ */
+void juldat_int(UTinstantIntPtr);
#endif
diff --git a/src/libical/caldate.c b/src/libical/caldate.c
index dc4aaae6..a04bc8b1 100644
--- a/src/libical/caldate.c
+++ b/src/libical/caldate.c
@@ -1,5 +1,9 @@
/*
- * Copyright (c) 1986-2000, Hiram Clawson
+ * This work is based on work from Hiram Clawson and has been modified to the
+ * needs of the libical project. The original copyright notice is as follows:
+ */
+/*
+ * Copyright (c) 1986-2000, Hiram Clawson
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
@@ -18,7 +22,7 @@
* Neither name of The Museum of Hiram nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior
- * written permission.
+ * written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
@@ -31,8 +35,20 @@
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
+ * THE POSSIBILITY OF SUCH DAMAGE.
*/
+/*
+ * The modifications made are licensed as follows (to distinguish between
+ * the original code and the modifications made, refer to the source code
+ * history):
+ */
+/*======================================================================
+
+ SPDX-FileCopyrightText: 2018, Markus Minichmayr
+ https://tapkey.com
+
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+ ========================================================================*/
#include "astime.h" /* time structures */
@@ -175,3 +191,91 @@ struct ut_instant * date;
date->weekday = (jd + 1L) % 7L;
return( date->j_date );
} /* end of double juldat( date ) */
+
+void caldat_int( date )
+struct ut_instant_int * date;
+{
+ long jd;
+ long ka;
+ long kb;
+ long kc;
+ long kd;
+ long ke;
+ long ialp;
+
+ jd = (long) (date->j_date0 + 1L); /* integer julian date */
+ ka = (long) jd;
+ if ( jd >= 2299161L )
+ {
+ ialp = (long) (((jd * 100LL) - 186721625LL) / 3652425LL);
+ ka = jd + 1L + ialp - ( ialp >> 2 );
+ }
+ kb = ka + 1524L;
+ kc = (long) ( ((kb * 100LL) - 12210LL) / 36525LL );
+ kd = (long) ( ( kc * 36525LL ) / 100LL );
+ ke = (long) ( (kb - kd) * 10000LL / 306001LL );
+ date->day = kb - kd - ((long) ( (ke * 306001LL) / 10000LL ));
+ if ( ke > 13L )
+ date->month = ke - 13L;
+ else
+ date->month = ke - 1L;
+ if ( (date->month == 2) && (date->day > 28) )
+ date->day = 29;
+ if ( (date->month == 2) && (date->day == 29) && (ke == 3L) )
+ date->year = kc - 4716L;
+ else if ( date->month > 2 )
+ date->year = kc - 4716L;
+ else
+ date->year = kc - 4715L;
+ date->weekday = (jd + 1L) % 7L; /* day of week */
+ if ( date->year == ((date->year >> 2) << 2) )
+ date->day_of_year =
+ ( ( 275 * date->month ) / 9)
+ - ((date->month + 9) / 12)
+ + date->day - 30;
+ else
+ date->day_of_year =
+ ( ( 275 * date->month ) / 9)
+ - (((date->month + 9) / 12) << 1)
+ + date->day - 30;
+}
+
+void juldat_int( date )
+struct ut_instant_int * date;
+{
+ long iy0, im0;
+ long ia, ib;
+ long jd;
+
+ /* conversion factors */
+ if ( date->month <= 2 )
+ {
+ iy0 = date->year - 1L;
+ im0 = date->month + 12;
+ }
+ else
+ {
+ iy0 = date->year;
+ im0 = date->month;
+ }
+ ia = iy0 / 100L;
+ ib = 2L - ia + (ia >> 2);
+ /* calculate julian date */
+ if ( date->year < 0L )
+ jd = (long) (((36525LL * iy0) - 75) / 100)
+ + (long) ((306001LL * (im0 + 1L)) / 10000)
+ + (long) date->day + 1720994L;
+ else
+ jd = (long) ((36525LL * iy0) / 100)
+ + (long) ((306001LL * (im0 + 1L)) / 10000)
+ + (long) date->day + 1720994L;
+
+ /* on or after 15 October 1582 */
+ if ((date->year > 1582)
+ || ((date->year == 1582) && (((date->month * 100) + date->day) >= 1015))
+ ) {
+ jd += ib;
+ }
+ date->j_date0 = jd;
+ date->weekday = (jd + 2L) % 7L;
+} /* end of void juldat( date ) */
diff --git a/src/libical/ical_file.cmake b/src/libical/ical_file.cmake
index e1db0cc8..59e96d77 100644
--- a/src/libical/ical_file.cmake
+++ b/src/libical/ical_file.cmake
@@ -1,8 +1,11 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
# ORDERING OF HEADERS IS SIGNIFICANT. Don't change this ordering.
# It is required to make the combined header ical.h properly.
set(COMBINEDHEADERSICAL
${TOPB}/src/libical/icalversion.h
- ${TOPS}/src/libical/icaltime.h
+ ${TOPB}/src/libical/icaltime.h
${TOPS}/src/libical/icalduration.h
${TOPS}/src/libical/icalperiod.h
${TOPS}/src/libical/icalenums.h
diff --git a/src/libical/icalarray.c b/src/libical/icalarray.c
index b2a1de49..a472c3a0 100644
--- a/src/libical/icalarray.c
+++ b/src/libical/icalarray.c
@@ -2,18 +2,10 @@
FILE: icalarray.c
CREATOR: Damon Chaplin 07 March 2001
- (C) COPYRIGHT 2001, Ximian, Inc.
+ SPDX-FileCopyrightText: 2001, Ximian, Inc.
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -22,6 +14,8 @@
#include "icalarray.h"
#include "icalerror.h"
+#include "icalmemory.h"
+#include "qsort_gen.h"
#include <stdlib.h>
#include <string.h>
@@ -32,7 +26,7 @@ icalarray *icalarray_new(size_t element_size, size_t increment_size)
{
icalarray *array;
- array = (icalarray *) malloc(sizeof(icalarray));
+ array = (icalarray *) icalmemory_new_buffer(sizeof(icalarray));
if (!array) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return NULL;
@@ -49,7 +43,7 @@ icalarray *icalarray_new(size_t element_size, size_t increment_size)
static void *icalarray_alloc_chunk(icalarray *array)
{
- void *chunk = malloc(array->element_size * array->increment_size);
+ void *chunk = icalmemory_new_buffer(array->element_size * array->increment_size);
if (!chunk) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
@@ -67,23 +61,30 @@ icalarray *icalarray_copy(icalarray *originalarray)
return NULL;
}
- array->num_elements = originalarray->num_elements;
- array->space_allocated = originalarray->space_allocated;
-
- array->chunks = malloc(chunks * sizeof(void *));
+ array->chunks = icalmemory_new_buffer(chunks * sizeof(void *));
if (array->chunks) {
for (chunk = 0; chunk < chunks; chunk++) {
array->chunks[chunk] = icalarray_alloc_chunk(array);
if (array->chunks[chunk]) {
memcpy(array->chunks[chunk], originalarray->chunks[chunk],
array->increment_size * array->element_size);
+
+ array->space_allocated += array->increment_size;
+ } else {
+ icalerror_set_errno(ICAL_ALLOCATION_ERROR);
+ icalarray_free(array);
+ return NULL;
}
}
} else {
icalerror_set_errno(ICAL_ALLOCATION_ERROR);
+ icalarray_free(array);
+ return NULL;
}
+ array->num_elements = originalarray->num_elements;
+
return array;
}
@@ -94,12 +95,12 @@ void icalarray_free(icalarray *array)
size_t chunk;
for (chunk = 0; chunk < chunks; chunk++) {
- free(array->chunks[chunk]);
+ icalmemory_free_buffer(array->chunks[chunk]);
}
- free(array->chunks);
+ icalmemory_free_buffer(array->chunks);
array->chunks = 0;
}
- free(array);
+ icalmemory_free_buffer(array);
}
void icalarray_append(icalarray *array, const void *element)
@@ -108,6 +109,10 @@ void icalarray_append(icalarray *array, const void *element)
if (array->num_elements >= array->space_allocated) {
icalarray_expand(array, 1);
+ if (array->num_elements >= array->space_allocated) {
+ /* expansion failed. Error has already been set. */
+ return;
+ }
}
pos = array->num_elements++;
@@ -133,34 +138,38 @@ void icalarray_remove_element_at(icalarray *array, size_t position)
array->num_elements--;
}
-void icalarray_sort(icalarray *array, int (*compare) (const void *, const void *))
-{
- if (array->num_elements == 0) {
- return;
- }
+struct _icalarray_sort_context {
+ icalarray *array;
+ int (*compare)(const void *, const void *);
+};
- if (array->num_elements <= array->increment_size) {
- qsort(array->chunks[0], array->num_elements, array->element_size, compare);
- } else {
- size_t pos;
- void *tmp = malloc(array->num_elements * array->element_size);
+static int icalarray_fcompare(const void *context, size_t i, size_t j) {
+ struct _icalarray_sort_context *sort_context = (struct _icalarray_sort_context *)context;
+ void *pI = icalarray_element_at(sort_context->array, i);
+ void *pJ = icalarray_element_at(sort_context->array, j);
- if (!tmp) {
- return;
- }
- for (pos = 0; pos < array->num_elements; pos++) {
- memcpy((char *)tmp + array->element_size * pos,
- icalarray_element_at(array, pos), array->element_size);
- }
+ return sort_context->compare(pI, pJ);
+}
- qsort(tmp, array->num_elements, array->element_size, compare);
+static void icalarray_fswap(void *context, size_t i, size_t j) {
+ struct _icalarray_sort_context *sort_context = (struct _icalarray_sort_context *)context;
+ void *pI = icalarray_element_at(sort_context->array, i);
+ void *pJ = icalarray_element_at(sort_context->array, j);
- for (pos = 0; pos < array->num_elements; pos++) {
- memcpy(icalarray_element_at(array, pos),
- (char *)tmp + array->element_size * pos, array->element_size);
- }
- free(tmp);
+ qsort_gen_memswap(pI, pJ, sort_context->array->element_size);
+}
+
+void icalarray_sort(icalarray *array, int (*compare) (const void *, const void *))
+{
+ struct _icalarray_sort_context sort_context;
+ sort_context.array = array;
+ sort_context.compare = compare;
+
+ if (array->num_elements <= 1) {
+ return;
}
+
+ qsort_gen(&sort_context, array->num_elements, icalarray_fcompare, icalarray_fswap);
}
static void icalarray_expand(icalarray *array, size_t space_needed)
@@ -175,7 +184,7 @@ static void icalarray_expand(icalarray *array, size_t space_needed)
num_new_chunks = 1;
}
- new_chunks = malloc((num_chunks + num_new_chunks) * sizeof(void *));
+ new_chunks = icalmemory_new_buffer((num_chunks + num_new_chunks) * sizeof(void *));
if (new_chunks) {
if (array->chunks && num_chunks) {
@@ -183,9 +192,13 @@ static void icalarray_expand(icalarray *array, size_t space_needed)
}
for (c = 0; c < num_new_chunks; c++) {
new_chunks[c + num_chunks] = icalarray_alloc_chunk(array);
+ if (!new_chunks[c + num_chunks]) {
+ num_new_chunks = c;
+ break;
+ }
}
if (array->chunks) {
- free(array->chunks);
+ icalmemory_free_buffer(array->chunks);
}
array->chunks = new_chunks;
array->space_allocated = array->space_allocated + num_new_chunks * array->increment_size;
diff --git a/src/libical/icalarray.h b/src/libical/icalarray.h
index 32ff4ae7..4c253fbc 100644
--- a/src/libical/icalarray.h
+++ b/src/libical/icalarray.h
@@ -2,18 +2,10 @@
FILE: icalarray.h
CREATOR: Damon Chaplin 07 March 2001
- (C) COPYRIGHT 2001, Ximian, Inc.
+ SPDX-FileCopyrightText: 2001, Ximian, Inc.
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
/** @file icalarray.h
@@ -27,6 +19,8 @@
#include "libical_ical_export.h"
+#include <stddef.h>
+
/**
* @typedef icalarray
* @brief A struct representing an icalarray object
diff --git a/src/libical/icalattach.c b/src/libical/icalattach.c
index 423cc27e..a2ec5fce 100644
--- a/src/libical/icalattach.c
+++ b/src/libical/icalattach.c
@@ -2,18 +2,10 @@
FILE: icalattach.c
CREATOR: acampi 28 May 02
- (C) COPYRIGHT 2002, Andrea Campi <a.campi@inet.it>
+ SPDX-FileCopyrightText: 2002, Andrea Campi <a.campi@inet.it>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -22,6 +14,7 @@
#include "icalattachimpl.h"
#include "icalerror.h"
+#include "icalmemory.h"
#include <errno.h>
#include <stdlib.h>
@@ -33,13 +26,13 @@ icalattach *icalattach_new_from_url(const char *url)
icalerror_check_arg_rz((url != NULL), "url");
- if ((attach = malloc(sizeof(icalattach))) == NULL) {
+ if ((attach = icalmemory_new_buffer(sizeof(icalattach))) == NULL) {
errno = ENOMEM;
return NULL;
}
- if ((url_copy = strdup(url)) == NULL) {
- free(attach);
+ if ((url_copy = icalmemory_strdup(url)) == NULL) {
+ icalmemory_free_buffer(attach);
errno = ENOMEM;
return NULL;
}
@@ -54,7 +47,7 @@ icalattach *icalattach_new_from_url(const char *url)
static void attach_data_free(char *data, void *free_fn_data)
{
_unused(free_fn_data);
- free(data);
+ icalmemory_free_buffer(data);
}
icalattach *icalattach_new_from_data(const char *data, icalattach_free_fn_t free_fn,
@@ -64,15 +57,15 @@ icalattach *icalattach_new_from_data(const char *data, icalattach_free_fn_t free
icalerror_check_arg_rz((data != NULL), "data");
- if ((attach = malloc(sizeof(icalattach))) == NULL) {
+ if ((attach = icalmemory_new_buffer(sizeof(icalattach))) == NULL) {
errno = ENOMEM;
return NULL;
}
if (!free_fn) {
- data = strdup(data);
+ data = icalmemory_strdup(data);
if (!data) {
- free(attach);
+ icalmemory_free_buffer(attach);
errno = ENOMEM;
return NULL;
}
@@ -107,12 +100,12 @@ void icalattach_unref(icalattach *attach)
return;
if (attach->is_url) {
- free(attach->u.url.url);
+ icalmemory_free_buffer(attach->u.url.url);
} else if (attach->u.data.free_fn) {
(* attach->u.data.free_fn) (attach->u.data.data, attach->u.data.free_fn_data);
}
- free(attach);
+ icalmemory_free_buffer(attach);
}
int icalattach_get_is_url(icalattach *attach)
diff --git a/src/libical/icalattach.h b/src/libical/icalattach.h
index 6eb7b851..b21aaf50 100644
--- a/src/libical/icalattach.h
+++ b/src/libical/icalattach.h
@@ -2,18 +2,10 @@
FILE: icalattach.h
CREATOR: acampi 28 May 02
- (C) COPYRIGHT 2002, Andrea Campi <a.campi@inet.it>
+ SPDX-FileCopyrightText: 2002, Andrea Campi <a.campi@inet.it>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
/**
diff --git a/src/libical/icalattachimpl.h b/src/libical/icalattachimpl.h
index af9975c0..7ca14441 100644
--- a/src/libical/icalattachimpl.h
+++ b/src/libical/icalattachimpl.h
@@ -2,18 +2,10 @@
FILE: icalattachimpl.h
CREATOR: acampi 28 May 02
- (C) COPYRIGHT 2000, Andrea Campi <a.campi@inet.it>
+ SPDX-FileCopyrightText: 2000, Andrea Campi <a.campi@inet.it>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALATTACHIMPL_H
diff --git a/src/libical/icalcomponent.c b/src/libical/icalcomponent.c
index c89f4cfd..e137173f 100644
--- a/src/libical/icalcomponent.c
+++ b/src/libical/icalcomponent.c
@@ -2,18 +2,10 @@
FILE: icalcomponent.c
CREATOR: eric 28 April 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -73,7 +65,7 @@ void icalcomponent_add_children(icalcomponent *impl, va_list args)
while ((vp = va_arg(args, void *)) != 0)
{
- assert(icalcomponent_isa_component(vp) != 0 || icalproperty_isa_property(vp) != 0);
+ icalassert(icalcomponent_isa_component(vp) != 0 || icalproperty_isa_property(vp) != 0);
if (icalcomponent_isa_component(vp) != 0) {
icalcomponent_add_component(impl, (icalcomponent *) vp);
@@ -91,7 +83,7 @@ static icalcomponent *icalcomponent_new_impl(icalcomponent_kind kind)
if (!icalcomponent_kind_is_valid(kind))
return NULL;
- if ((comp = (icalcomponent *) malloc(sizeof(icalcomponent))) == 0) {
+ if ((comp = (icalcomponent *) icalmemory_new_buffer(sizeof(icalcomponent))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
@@ -137,7 +129,7 @@ icalcomponent *icalcomponent_new_from_string(const char *str)
return icalparser_parse_string(str);
}
-icalcomponent *icalcomponent_new_clone(icalcomponent *old)
+icalcomponent *icalcomponent_clone(const icalcomponent *old)
{
icalcomponent *new;
icalproperty *p;
@@ -154,17 +146,22 @@ icalcomponent *icalcomponent_new_clone(icalcomponent *old)
for (itr = pvl_head(old->properties); itr != 0; itr = pvl_next(itr)) {
p = (icalproperty *) pvl_data(itr);
- icalcomponent_add_property(new, icalproperty_new_clone(p));
+ icalcomponent_add_property(new, icalproperty_clone(p));
}
for (itr = pvl_head(old->components); itr != 0; itr = pvl_next(itr)) {
c = (icalcomponent *) pvl_data(itr);
- icalcomponent_add_component(new, icalcomponent_new_clone(c));
+ icalcomponent_add_component(new, icalcomponent_clone(c));
}
return new;
}
+icalcomponent *icalcomponent_new_clone(icalcomponent *old)
+{
+ return icalcomponent_clone(old);
+}
+
icalcomponent *icalcomponent_new_x(const char *x_name)
{
icalcomponent *comp = icalcomponent_new_impl(ICAL_X_COMPONENT);
@@ -204,7 +201,7 @@ void icalcomponent_free(icalcomponent *c)
pvl_free(c->components);
if (c->x_name != 0) {
- free(c->x_name);
+ icalmemory_free_buffer(c->x_name);
}
if (c->timezones) {
@@ -221,7 +218,7 @@ void icalcomponent_free(icalcomponent *c)
c->id[0] = 'X';
c->timezones = NULL;
- free(c);
+ icalmemory_free_buffer(c);
}
}
@@ -230,7 +227,9 @@ char *icalcomponent_as_ical_string(icalcomponent *impl)
char *buf;
buf = icalcomponent_as_ical_string_r(impl);
- icalmemory_add_tmp_buffer(buf);
+ if (buf) {
+ icalmemory_add_tmp_buffer(buf);
+ }
return buf;
}
@@ -263,6 +262,9 @@ char *icalcomponent_as_ical_string_r(icalcomponent *impl)
icalerror_check_arg_rz((kind_string != 0), "Unknown kind of component");
buf = icalmemory_new_buffer(buf_size);
+ if (buf == NULL)
+ return NULL;
+
buf_ptr = buf;
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:");
@@ -276,16 +278,17 @@ char *icalcomponent_as_ical_string_r(icalcomponent *impl)
tmp_buf = icalproperty_as_ical_string_r(p);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf);
- free(tmp_buf);
+ icalmemory_free_buffer(tmp_buf);
}
for (itr = pvl_head(impl->components); itr != 0; itr = pvl_next(itr)) {
c = (icalcomponent *) pvl_data(itr);
tmp_buf = icalcomponent_as_ical_string_r(c);
-
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf);
- free(tmp_buf);
+ if (tmp_buf != NULL) {
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf);
+ icalmemory_free_buffer(tmp_buf);
+ }
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:");
@@ -324,6 +327,70 @@ int icalcomponent_isa_component(void *component)
}
}
+void icalcomponent_set_x_name(icalcomponent *comp, const char *name)
+{
+ icalerror_check_arg_rv((name != 0), "name");
+ icalerror_check_arg_rv((comp != 0), "comp");
+
+ if (comp->x_name != 0) {
+ free(comp->x_name);
+ }
+
+ comp->x_name = icalmemory_strdup(name);
+
+ if (comp->x_name == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ }
+}
+
+const char *icalcomponent_get_x_name(icalcomponent *comp)
+{
+ icalerror_check_arg_rz((comp != 0), "comp");
+
+ return comp->x_name;
+}
+
+const char *icalcomponent_get_component_name(const icalcomponent *comp)
+{
+ char *buf;
+
+ buf = icalcomponent_get_component_name_r(comp);
+ icalmemory_add_tmp_buffer(buf);
+ return buf;
+}
+
+char *icalcomponent_get_component_name_r(const icalcomponent *comp)
+{
+ const char *component_name = 0;
+ size_t buf_size = 256;
+ char *buf;
+ char *buf_ptr;
+
+ icalerror_check_arg_rz((comp != 0), "comp");
+
+ buf = icalmemory_new_buffer(buf_size);
+ buf_ptr = buf;
+
+ if (comp->kind == ICAL_X_COMPONENT && comp->x_name != 0) {
+ component_name = comp->x_name;
+ } else {
+ component_name = icalcomponent_kind_to_string(comp->kind);
+ }
+
+ if (component_name == 0) {
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ icalmemory_free_buffer(buf);
+ return 0;
+
+ } else {
+ /* _append_string will automatically grow the buffer if
+ component_name is longer than the initial buffer size */
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, component_name);
+ }
+
+ return buf;
+}
+
void icalcomponent_add_property(icalcomponent *component, icalproperty *property)
{
icalerror_check_arg_rv((component != 0), "component");
@@ -462,7 +529,8 @@ void icalcomponent_add_component(icalcomponent *parent, icalcomponent *child)
if (!parent->timezones)
parent->timezones = icaltimezone_array_new();
- icaltimezone_array_append_from_vtimezone(parent->timezones, child);
+ if (parent->timezones)
+ icaltimezone_array_append_from_vtimezone(parent->timezones, child);
/* Flag that we need to sort it before doing any binary searches. */
parent->timezones_sorted = 0;
@@ -726,7 +794,8 @@ int icalproperty_recurrence_is_excluded(icalcomponent *comp,
/** exrule_time > recurtime **/
}
- icalrecur_iterator_free(exrule_itr);
+ if (exrule_itr)
+ icalrecur_iterator_free(exrule_itr);
}
comp->property_iterator = property_iterator;
@@ -793,8 +862,8 @@ void icalcomponent_foreach_recurrence(icalcomponent *comp,
{
struct icaltimetype dtstart, dtend;
icaltime_span recurspan, basespan, limit_span;
- time_t limit_start, limit_end;
- time_t dtduration;
+ icaltime_t limit_start, limit_end;
+ icaltime_t dtduration;
icalproperty *rrule, *rdate;
pvl_elem property_iterator; /* for saving the iterator */
@@ -828,10 +897,10 @@ void icalcomponent_foreach_recurrence(icalcomponent *comp,
limit_end = icaltime_as_timet_with_zone(end,
icaltimezone_get_utc_timezone());
} else {
-#if (SIZEOF_TIME_T > 4)
- limit_end = (time_t) LONG_MAX;
+#if (SIZEOF_ICALTIME_T > 4)
+ limit_end = (icaltime_t) LONG_MAX;
#else
- limit_end = (time_t) INT_MAX;
+ limit_end = (icaltime_t) INT_MAX;
#endif
}
limit_span.start = limit_start;
@@ -1112,6 +1181,11 @@ static const struct icalcomponent_kind_map component_map[] = {
{ICAL_VPATCH_COMPONENT, "VPATCH"},
{ICAL_XPATCH_COMPONENT, "PATCH"},
+ /* Event Publishing components */
+ {ICAL_PARTICIPANT_COMPONENT, "PARTICIPANT"},
+ {ICAL_VLOCATION_COMPONENT, "VLOCATION"},
+ {ICAL_VRESOURCE_COMPONENT, "VRESOURCE"},
+
/* End of list */
{ICAL_NO_COMPONENT, ""},
};
@@ -1890,6 +1964,21 @@ icalcomponent *icalcomponent_new_xpatch(void)
return icalcomponent_new(ICAL_XPATCH_COMPONENT);
}
+icalcomponent *icalcomponent_new_participant(void)
+{
+ return icalcomponent_new(ICAL_PARTICIPANT_COMPONENT);
+}
+
+icalcomponent *icalcomponent_new_vlocation(void)
+{
+ return icalcomponent_new(ICAL_VLOCATION_COMPONENT);
+}
+
+icalcomponent *icalcomponent_new_vresource(void)
+{
+ return icalcomponent_new(ICAL_VRESOURCE_COMPONENT);
+}
+
/*
* Timezone stuff.
*/
@@ -1901,13 +1990,16 @@ void icalcomponent_merge_component(icalcomponent *comp, icalcomponent *comp_to_m
size_t i;
/* Check that both components are VCALENDAR components. */
- assert(icalcomponent_isa(comp) == ICAL_VCALENDAR_COMPONENT);
- assert(icalcomponent_isa(comp_to_merge) == ICAL_VCALENDAR_COMPONENT);
+ icalassert(icalcomponent_isa(comp) == ICAL_VCALENDAR_COMPONENT);
+ icalassert(icalcomponent_isa(comp_to_merge) == ICAL_VCALENDAR_COMPONENT);
/* Step through each subcomponent of comp_to_merge, looking for VTIMEZONEs.
For each VTIMEZONE found, check if we need to add it to comp and if we
need to rename it and all TZID references to it. */
tzids_to_rename = icalarray_new(sizeof(char *), 16);
+ if (!tzids_to_rename)
+ return;
+
subcomp = icalcomponent_get_first_component(comp_to_merge, ICAL_VTIMEZONE_COMPONENT);
while (subcomp) {
next_subcomp = icalcomponent_get_next_component(comp_to_merge, ICAL_VTIMEZONE_COMPONENT);
@@ -1925,7 +2017,7 @@ void icalcomponent_merge_component(icalcomponent *comp, icalcomponent *comp_to_m
/* Now free the tzids_to_rename array. */
for (i = 0; i < tzids_to_rename->num_elements; i++) {
- free(icalarray_element_at(tzids_to_rename, i));
+ icalmemory_free_buffer(icalarray_element_at(tzids_to_rename, i));
}
}
icalarray_free(tzids_to_rename);
@@ -1984,7 +2076,7 @@ static void icalcomponent_merge_vtimezone(icalcomponent *comp,
unique one), so we compare the VTIMEZONE components to see if they are
the same. If they are, we don't need to do anything. We make a copy of
the tzid, since the parameter may get modified in these calls. */
- tzid_copy = strdup(tzid);
+ tzid_copy = icalmemory_strdup(tzid);
if (!tzid_copy) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return;
@@ -1997,7 +2089,7 @@ static void icalcomponent_merge_vtimezone(icalcomponent *comp,
icalcomponent_handle_conflicting_vtimezones(comp, vtimezone, tzid_prop,
tzid_copy, tzids_to_rename);
}
- free(tzid_copy);
+ icalmemory_free_buffer(tzid_copy);
}
static void icalcomponent_handle_conflicting_vtimezones(icalcomponent *comp,
@@ -2041,20 +2133,20 @@ static void icalcomponent_handle_conflicting_vtimezones(icalcomponent *comp,
if (icalcomponent_compare_vtimezones(icaltimezone_get_component(zone), vtimezone)) {
/* The VTIMEZONEs match, so we can use the existing VTIMEZONE. But
we have to rename TZIDs to this TZID. */
- tzid_copy = strdup(tzid);
+ tzid_copy = icalmemory_strdup(tzid);
if (!tzid_copy) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return;
}
- existing_tzid_copy = strdup(existing_tzid);
+ existing_tzid_copy = icalmemory_strdup(existing_tzid);
if (!existing_tzid_copy) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- free(tzid_copy);
+ icalmemory_free_buffer(tzid_copy);
} else {
icalarray_append(tzids_to_rename, tzid_copy);
- free(tzid_copy);
+ icalmemory_free_buffer(tzid_copy);
icalarray_append(tzids_to_rename, existing_tzid_copy);
- free(existing_tzid_copy);
+ icalmemory_free_buffer(existing_tzid_copy);
}
return;
} else {
@@ -2071,17 +2163,17 @@ static void icalcomponent_handle_conflicting_vtimezones(icalcomponent *comp,
/* We didn't find a VTIMEZONE that matched, so we have to rename the TZID,
using the maximum numerical suffix found + 1. */
- tzid_copy = strdup(tzid);
+ tzid_copy = icalmemory_strdup(tzid);
if (!tzid_copy) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return;
}
snprintf(suffix_buf, sizeof(suffix_buf), "%i", max_suffix + 1);
- new_tzid = malloc(tzid_len + strlen(suffix_buf) + 1);
+ new_tzid = icalmemory_new_buffer(tzid_len + strlen(suffix_buf) + 1);
if (!new_tzid) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- free(tzid_copy);
+ icalmemory_free_buffer(tzid_copy);
return;
}
@@ -2089,8 +2181,8 @@ static void icalcomponent_handle_conflicting_vtimezones(icalcomponent *comp,
strcpy(new_tzid + tzid_len, suffix_buf);
icalarray_append(tzids_to_rename, tzid_copy);
icalarray_append(tzids_to_rename, new_tzid);
- free(tzid_copy);
- free(new_tzid);
+ icalmemory_free_buffer(tzid_copy);
+ icalmemory_free_buffer(new_tzid);
}
/* Returns the length of the TZID, without any trailing digits. */
@@ -2263,7 +2355,7 @@ static int icalcomponent_compare_vtimezones(icalcomponent *vtimezone1, icalcompo
/* Copy the second TZID, and set the property to the same as the first
TZID, since we don't care if these match of not. */
- tzid2_copy = strdup(tzid2);
+ tzid2_copy = icalmemory_strdup(tzid2);
if (!tzid2_copy) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
@@ -2274,25 +2366,25 @@ static int icalcomponent_compare_vtimezones(icalcomponent *vtimezone1, icalcompo
/* Now convert both VTIMEZONEs to strings and compare them. */
string1 = icalcomponent_as_ical_string_r(vtimezone1);
if (!string1) {
- free(tzid2_copy);
+ icalmemory_free_buffer(tzid2_copy);
return -1;
}
string2 = icalcomponent_as_ical_string_r(vtimezone2);
if (!string2) {
- free(string1);
- free(tzid2_copy);
+ icalmemory_free_buffer(string1);
+ icalmemory_free_buffer(tzid2_copy);
return -1;
}
cmp = strcmp(string1, string2);
- free(string1);
- free(string2);
+ icalmemory_free_buffer(string1);
+ icalmemory_free_buffer(string2);
/* Now reset the second TZID. */
icalproperty_set_tzid(prop2, tzid2_copy);
- free(tzid2_copy);
+ icalmemory_free_buffer(tzid2_copy);
return (cmp == 0) ? 1 : 0;
}
diff --git a/src/libical/icalcomponent.h b/src/libical/icalcomponent.h
index e0501bca..3774a253 100644
--- a/src/libical/icalcomponent.h
+++ b/src/libical/icalcomponent.h
@@ -2,18 +2,10 @@
FILE: icalcomponent.h
CREATOR: eric 20 March 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
/**
@@ -23,6 +15,7 @@
#ifndef ICALCOMPONENT_H
#define ICALCOMPONENT_H
+#include "libical_deprecated.h"
#include "libical_ical_export.h"
#include "icalenums.h" /* Defines icalcomponent_kind */
#include "icalproperty.h"
@@ -43,9 +36,12 @@ typedef struct icalcompiter
*/
LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new(icalcomponent_kind kind);
-/** @brief Constructor
+/**
+ * @brief Deeply clones an icalcomponent.
+ * Returns a pointer to the memory for the newly cloned icalcomponent.
+ * @since 3.1.0
*/
-LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_clone(icalcomponent *component);
+LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_clone(const icalcomponent *component);
/** @brief Constructor
*/
@@ -75,9 +71,25 @@ LIBICAL_ICAL_EXPORT icalcomponent_kind icalcomponent_isa(const icalcomponent *co
LIBICAL_ICAL_EXPORT int icalcomponent_isa_component(void *component);
-/*
- * Working with properties
+/* Deal with X components */
+
+LIBICAL_ICAL_EXPORT void icalcomponent_set_x_name(icalcomponent *comp, const char *name);
+LIBICAL_ICAL_EXPORT const char *icalcomponent_get_x_name(icalcomponent *comp);
+
+/** Returns the name of the component -- the type name converted to a
+ * string, or the value of _get_x_name if the type is and X component
*/
+LIBICAL_ICAL_EXPORT const char *icalcomponent_get_component_name(const icalcomponent *comp);
+LIBICAL_ICAL_EXPORT char *icalcomponent_get_component_name_r(const icalcomponent *comp);
+
+/**
+ * @copydoc icalcomponent_clone()
+ * @deprecated Use icalcomponent_clone() instead
+ */
+LIBICAL_ICAL_EXPORT LIBICAL_DEPRECATED(icalcomponent *icalcomponent_new_clone(
+ icalcomponent *component));
+
+/***** Working with Properties *****/
LIBICAL_ICAL_EXPORT void icalcomponent_add_property(icalcomponent *component,
icalproperty *property);
@@ -108,9 +120,7 @@ LIBICAL_ICAL_EXPORT icalproperty *icalcomponent_get_first_property(icalcomponent
LIBICAL_ICAL_EXPORT icalproperty *icalcomponent_get_next_property(icalcomponent *component,
icalproperty_kind kind);
-/*
- * Working with components
- */
+/***** Working with Components *****/
/** Return the first VEVENT, VTODO or VJOURNAL sub-component of cop, or
comp if it is one of those types */
@@ -158,7 +168,7 @@ LIBICAL_ICAL_EXPORT icalcomponent *icalcompiter_prior(icalcompiter * i);
LIBICAL_ICAL_EXPORT icalcomponent *icalcompiter_deref(icalcompiter * i);
-/* Working with embedded error properties */
+/***** Working with embedded error properties *****/
/* Check the component against itip rules and insert error properties*/
/* Working with embedded error properties */
@@ -519,4 +529,10 @@ LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vpatch(void);
LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_xpatch(void);
+LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_participant(void);
+
+LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vlocation(void);
+
+LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vresource(void);
+
#endif /* !ICALCOMPONENT_H */
diff --git a/src/libical/icalderivedparameter.c.in b/src/libical/icalderivedparameter.c.in
index f0af1fe7..0e203179 100644
--- a/src/libical/icalderivedparameter.c.in
+++ b/src/libical/icalderivedparameter.c.in
@@ -2,18 +2,9 @@
FILE: icalderivedparameters.{c,h}
CREATOR: eric 09 May 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
Contributions from:
Graham Davison (g.m.davison@computer.org)
diff --git a/src/libical/icalderivedparameter.h.in b/src/libical/icalderivedparameter.h.in
index 9bb58fca..07649533 100644
--- a/src/libical/icalderivedparameter.h.in
+++ b/src/libical/icalderivedparameter.h.in
@@ -2,18 +2,9 @@
FILE: icalparam.h
CREATOR: eric 20 March 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original code is icalparam.h
======================================================================*/
diff --git a/src/libical/icalderivedproperty.c.in b/src/libical/icalderivedproperty.c.in
index ba21c759..4d02a511 100644
--- a/src/libical/icalderivedproperty.c.in
+++ b/src/libical/icalderivedproperty.c.in
@@ -2,18 +2,10 @@
FILE: icalderivedproperty.c
CREATOR: eric 09 May 1999
- (C) COPYRIGHT 1999, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
diff --git a/src/libical/icalderivedproperty.h.in b/src/libical/icalderivedproperty.h.in
index 0ebec067..c5244dd8 100644
--- a/src/libical/icalderivedproperty.h.in
+++ b/src/libical/icalderivedproperty.h.in
@@ -2,24 +2,15 @@
FILE: icalderivedproperty.h
CREATOR: eric 09 May 1999
- (C) COPYRIGHT 1999, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALDERIVEDPROPERTY_H
#define ICALDERIVEDPROPERTY_H
-#include <time.h>
#include "icalparameter.h"
#include "icalderivedvalue.h"
#include "icalrecur.h"
diff --git a/src/libical/icalderivedvalue.c.in b/src/libical/icalderivedvalue.c.in
index dfbebba7..8dde33eb 100644
--- a/src/libical/icalderivedvalue.c.in
+++ b/src/libical/icalderivedvalue.c.in
@@ -2,18 +2,9 @@
FILE: icalvalue.c
CREATOR: eric 02 May 1999
- (C) COPYRIGHT 1999, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
Contributions from:
Graham Davison (g.m.davison@computer.org)
@@ -115,7 +106,7 @@ void icalvalue_set_x(icalvalue *impl, const char *v)
icalerror_check_arg_rv((v != 0), "v");
if (impl->x_value != 0) {
- free((void *)impl->x_value);
+ icalmemory_free_buffer((void *)impl->x_value);
}
impl->x_value = icalmemory_strdup(v);
@@ -151,12 +142,12 @@ void icalvalue_set_recur(icalvalue *impl, struct icalrecurrencetype v)
icalerror_check_value_type(value, ICAL_RECUR_VALUE);
if (impl->data.v_recur != 0) {
- free(impl->data.v_recur->rscale);
- free(impl->data.v_recur);
+ icalmemory_free_buffer(impl->data.v_recur->rscale);
+ icalmemory_free_buffer(impl->data.v_recur);
impl->data.v_recur = 0;
}
- impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype));
+ impl->data.v_recur = icalmemory_new_buffer(sizeof(struct icalrecurrencetype));
if (impl->data.v_recur == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
@@ -439,9 +430,8 @@ void icalvalue_set_geo(icalvalue *value, struct icalgeotype v)
struct icalgeotype icalvalue_get_geo(const icalvalue *value)
{
struct icalgeotype gt;
-
- gt.lat = 255.0;
- gt.lon = 255.0;
+ strcpy(gt.lat, "255.0");
+ strcpy(gt.lon, "255.0");
icalerror_check_arg_rx((value != 0), "value", gt);
icalerror_check_value_type(value, ICAL_GEO_VALUE);
diff --git a/src/libical/icalderivedvalue.h.in b/src/libical/icalderivedvalue.h.in
index 52f57418..65ed8588 100644
--- a/src/libical/icalderivedvalue.h.in
+++ b/src/libical/icalderivedvalue.h.in
@@ -2,18 +2,10 @@
FILE: icalvalue.h
CREATOR: eric 20 March 1999
- (C) COPYRIGHT 1999, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALDERIVEDVALUE_H
diff --git a/src/libical/icalduration.c b/src/libical/icalduration.c
index d142c0d5..e6780f59 100644
--- a/src/libical/icalduration.c
+++ b/src/libical/icalduration.c
@@ -2,18 +2,9 @@
FILE: icaltime.c
CREATOR: eric 02 June 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
@@ -266,13 +257,13 @@ char *icaldurationtype_as_ical_string_r(struct icaldurationtype d)
return buf;
}
-/* From Russel Steinthal */
int icaldurationtype_as_int(struct icaldurationtype dur)
{
return (int)((dur.seconds +
- (60 * dur.minutes) +
- (60 * 60 * dur.hours) +
- (60 * 60 * 24 * dur.days) + (60 * 60 * 24 * 7 * dur.weeks))
+ 60 * (dur.minutes +
+ 60 * (dur.hours +
+ 24 * (dur.days +
+ 7 * dur.weeks))))
* (dur.is_neg == 1 ? -1 : 1));
}
@@ -338,8 +329,8 @@ struct icaltimetype icaltime_add(struct icaltimetype t, struct icaldurationtype
struct icaldurationtype icaltime_subtract(struct icaltimetype t1, struct icaltimetype t2)
{
- time_t t1t = icaltime_as_timet(t1);
- time_t t2t = icaltime_as_timet(t2);
+ icaltime_t t1t = icaltime_as_timet(t1);
+ icaltime_t t2t = icaltime_as_timet(t2);
return icaldurationtype_from_int((int)(t1t - t2t));
}
diff --git a/src/libical/icalduration.h b/src/libical/icalduration.h
index 0c3fe6e8..a6723770 100644
--- a/src/libical/icalduration.h
+++ b/src/libical/icalduration.h
@@ -2,18 +2,9 @@
FILE: icalduration.h
CREATOR: eric 26 Jan 2001
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
@@ -108,7 +99,7 @@ LIBICAL_ICAL_EXPORT int icaldurationtype_as_int(struct icaldurationtype duration
*
* @par Ownership
* The string returned by this function is owned by the caller and needs to be
- * released with `free()` after it's no longer needed.
+ * released with `icalmemory_free_buffer()` after it's no longer needed.
*
* @par Usage
* ```c
@@ -121,7 +112,7 @@ LIBICAL_ICAL_EXPORT int icaldurationtype_as_int(struct icaldurationtype duration
* printf("%s\n", ical);
*
* // release string
- * free(ical);
+ * icalmemory_free_buffer(ical);
* ```
*/
LIBICAL_ICAL_EXPORT char *icaldurationtype_as_ical_string(struct icaldurationtype d);
diff --git a/src/libical/icalenums.c b/src/libical/icalenums.c
index 6f2ee32a..954a7832 100644
--- a/src/libical/icalenums.c
+++ b/src/libical/icalenums.c
@@ -2,18 +2,10 @@
FILE: icalenum.c
CREATOR: eric 29 April 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
diff --git a/src/libical/icalenums.h b/src/libical/icalenums.h
index 6d3ac09e..8c72a008 100644
--- a/src/libical/icalenums.h
+++ b/src/libical/icalenums.h
@@ -1,18 +1,9 @@
/*======================================================================
FILE: icalenums.h
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
Contributions from:
Graham Davison <g.m.davison@computer.org>
@@ -64,7 +55,11 @@ typedef enum icalcomponent_kind
ICAL_VVOTER_COMPONENT,
ICAL_XVOTE_COMPONENT,
ICAL_VPATCH_COMPONENT,
- ICAL_XPATCH_COMPONENT
+ ICAL_XPATCH_COMPONENT,
+ ICAL_PARTICIPANT_COMPONENT,
+ ICAL_VLOCATION_COMPONENT,
+ ICAL_VRESOURCE_COMPONENT,
+ ICAL_NUM_COMPONENT_TYPES /* MUST be last (unless we can put NO_COMP last) */
} icalcomponent_kind;
/***********************************************************************
diff --git a/src/libical/icalerror.c b/src/libical/icalerror.c
index e10fd72e..1e6e4602 100644
--- a/src/libical/icalerror.c
+++ b/src/libical/icalerror.c
@@ -2,18 +2,9 @@
FILE: icalerror.c
CREATOR: eric 16 May 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original code is icalerror.c
======================================================================*/
@@ -23,6 +14,7 @@
#endif
#include "icalerror.h"
+#include "icalmemory.h"
#include <stdlib.h>
@@ -38,7 +30,7 @@ static pthread_once_t icalerrno_key_once = PTHREAD_ONCE_INIT;
static void icalerrno_destroy(void *buf)
{
- free(buf);
+ icalmemory_free_buffer(buf);
pthread_setspecific(icalerrno_key, NULL);
}
@@ -56,7 +48,7 @@ icalerrorenum *icalerrno_return(void)
_errno = (icalerrorenum *) pthread_getspecific(icalerrno_key);
if (!_errno) {
- _errno = malloc(sizeof(icalerrorenum));
+ _errno = icalmemory_new_buffer(sizeof(icalerrorenum));
*_errno = ICAL_NO_ERROR;
pthread_setspecific(icalerrno_key, _errno);
}
@@ -83,13 +75,15 @@ void icalerror_stop_here(void)
void icalerror_crash_here(void)
{
+#if !defined(__clang_analyzer__)
int *p = 0;
/* coverity[var_deref_op] */
/* cppcheck-suppress nullPointer */
- *p = 1; /*clang-analyzer false positive. we want a crash*/
+ *p = 1;
/* cppcheck-suppress nullPointer */
- assert(*p);
+ icalassert(*p);
+#endif
}
void icalerror_clear_errno()
@@ -121,7 +115,7 @@ void icalerror_set_errno(icalerrorenum x)
(icalerror_get_error_state(x) == ICAL_ERROR_DEFAULT && icalerror_errors_are_fatal == 1)) {
icalerror_warn(icalerror_strerror(x));
ical_bt();
- assert(0);
+ icalassert(0);
}
}
@@ -270,11 +264,11 @@ void ical_bt(void)
strings = backtrace_symbols(stack_frames, num);
for (i = 0; i < num; i++) {
if (strings != NULL) {
- fprintf(stderr, "%s\n", strings[i]);
+ icalerrprintf("%s\n", strings[i]);
} else {
- fprintf(stderr, "%p\n", stack_frames[i]);
+ icalerrprintf("%p\n", stack_frames[i]);
}
}
- free(strings);
+ icalmemory_free_buffer(strings);
#endif
}
diff --git a/src/libical/icalerror.h b/src/libical/icalerror.h
index 90a6c438..87ed8a98 100644
--- a/src/libical/icalerror.h
+++ b/src/libical/icalerror.h
@@ -2,18 +2,9 @@
FILE: icalerror.h
CREATOR: eric 09 May 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original code is icalerror.h
======================================================================*/
@@ -187,10 +178,10 @@ LIBICAL_ICAL_EXPORT int icalerror_get_errors_are_fatal(void);
#ifdef __GNUC__ca
#define icalerror_warn(message) \
-{fprintf(stderr, "%s(), %s:%d: %s\n", __FUNCTION__, __FILE__, __LINE__, message);}
+{icalerrprintf("%s(), %s:%d: %s\n", __FUNCTION__, __FILE__, __LINE__, message);}
#else /* __GNU_C__ */
#define icalerror_warn(message) \
-{fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, message);}
+{icalerrprintf("%s:%d: %s\n", __FILE__, __LINE__, message);}
#endif /* __GNU_C__ */
/**
@@ -343,7 +334,7 @@ if(icalerror_get_error_state(x) == ICAL_ERROR_FATAL || \
icalerror_get_errors_are_fatal() == 1)){ \
icalerror_warn(icalerror_strerror(x)); \
ical_bt(); \
- assert(0); \
+ icalassert(0); \
} }
#else
/**
@@ -405,13 +396,13 @@ LIBICAL_ICAL_EXPORT void icalerror_set_errno(icalerrorenum x);
#ifdef __GNUC__
#define icalerror_assert(test,message) \
if (!(test)) { \
- fprintf(stderr, "%s(), %s:%d: %s\n", __FUNCTION__, __FILE__, __LINE__, message); \
+ icalerrprintf("%s(), %s:%d: %s\n", __FUNCTION__, __FILE__, __LINE__, message); \
icalerror_stop_here(); \
abort();}
#else /*__GNUC__*/
#define icalerror_assert(test,message) \
if (!(test)) { \
- fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, message); \
+ icalerrprintf("%s:%d: %s\n", __FILE__, __LINE__, message); \
icalerror_stop_here(); \
abort();}
#endif /*__GNUC__*/
@@ -518,7 +509,7 @@ if (!(test)) { \
#define icalerror_check_arg_re(test,arg,error) \
if (!(test)) { \
icalerror_stop_here(); \
- assert(0); \
+ icalassert(0); \
return error; \
}
diff --git a/src/libical/icallangbind.c b/src/libical/icallangbind.c
index 859d6c8e..03a973bb 100644
--- a/src/libical/icallangbind.c
+++ b/src/libical/icallangbind.c
@@ -2,18 +2,10 @@
FILE: icallangbind.c
CREATOR: eric 15 dec 2000
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -29,14 +21,14 @@
int *icallangbind_new_array(int size)
{
- int *p = (int *)malloc(size * sizeof(int));
+ int *p = (int *)icalmemory_new_buffer(size * sizeof(int));
return p; /* Caller handles failures */
}
void icallangbind_free_array(int *array)
{
- free(array);
+ icalmemory_free_buffer(array);
}
int icallangbind_access_array(int *array, int index)
@@ -195,7 +187,7 @@ char *icallangbind_property_eval_string_r(icalproperty *prop, const char *sep)
default:
{
char *str = icalvalue_as_ical_string_r(value);
- char *copy = (char *)malloc(strlen(str) + 1);
+ char *copy = (char *)icalmemory_new_buffer(strlen(str) + 1);
const char *i;
char *j;
@@ -221,8 +213,8 @@ char *icallangbind_property_eval_string_r(icalproperty *prop, const char *sep)
APPENDS(copy);
APPENDC('\'');
- free(copy);
- free(str);
+ icalmemory_free_buffer(copy);
+ icalmemory_free_buffer(str);
break;
}
}
@@ -244,7 +236,7 @@ char *icallangbind_property_eval_string_r(icalproperty *prop, const char *sep)
v = strchr(copy, '=');
if (v == 0) {
- free(copy);
+ icalmemory_free_buffer(copy);
continue;
}
@@ -260,7 +252,7 @@ char *icallangbind_property_eval_string_r(icalproperty *prop, const char *sep)
APPENDC('\'');
APPENDS(v);
APPENDC('\'');
- free(copy);
+ icalmemory_free_buffer(copy);
}
APPENDC('}');
diff --git a/src/libical/icallangbind.h b/src/libical/icallangbind.h
index c5ff8715..1ad4e10e 100644
--- a/src/libical/icallangbind.h
+++ b/src/libical/icallangbind.h
@@ -2,18 +2,10 @@
FILE: icallangbind.h
CREATOR: eric 25 jan 2001
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALLANGBIND_H
diff --git a/src/libical/icalmemory.c b/src/libical/icalmemory.c
index 6c1bd9ca..2b5d0490 100644
--- a/src/libical/icalmemory.c
+++ b/src/libical/icalmemory.c
@@ -2,29 +2,9 @@
FILE: icalmemory.c
CREATOR: eric 30 June 1999
- Copyright (C) 2000 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
-
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -33,6 +13,9 @@
#include "icalmemory.h"
#include "icalerror.h"
+#if defined(MEMORY_CONSISTENCY)
+#include "test-malloc.h"
+#endif
#include <stdlib.h>
@@ -74,10 +57,10 @@ static void icalmemory_free_ring_byval(buffer_ring * br)
for (i = 0; i < BUFFER_RING_SIZE; i++) {
if (br->ring[i] != 0) {
- free(br->ring[i]);
+ icalmemory_free_buffer(br->ring[i]);
}
}
- free(br);
+ icalmemory_free_buffer(br);
}
#if defined(HAVE_PTHREAD)
@@ -109,7 +92,7 @@ static void icalmemory_free_tmp_buffer(void *buf)
return;
}
- free(buf);
+ icalmemory_free_buffer(buf);
}
#endif
@@ -122,7 +105,9 @@ static buffer_ring *buffer_ring_new(void)
buffer_ring *br;
int i;
- br = (buffer_ring *) malloc(sizeof(buffer_ring));
+ br = (buffer_ring *) icalmemory_new_buffer(sizeof(buffer_ring));
+ if (!br)
+ return NULL;
for (i = 0; i < BUFFER_RING_SIZE; i++) {
br->ring[i] = 0;
@@ -182,6 +167,9 @@ static buffer_ring *get_buffer_ring(void)
void icalmemory_add_tmp_buffer(void *buf)
{
buffer_ring *br = get_buffer_ring();
+ if (!br) {
+ return;
+ }
/* Wrap around the ring */
if (++(br->pos) == BUFFER_RING_SIZE) {
@@ -190,7 +178,7 @@ void icalmemory_add_tmp_buffer(void *buf)
/* Free buffers as their slots are overwritten */
if (br->ring[br->pos] != 0) {
- free(br->ring[br->pos]);
+ icalmemory_free_buffer(br->ring[br->pos]);
}
/* Assign the buffer to a slot */
@@ -210,7 +198,7 @@ void *icalmemory_tmp_buffer(size_t size)
size = MIN_BUFFER_SIZE;
}
- buf = (void *)malloc(size);
+ buf = (void *)icalmemory_new_buffer(size);
if (buf == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
@@ -229,6 +217,8 @@ void icalmemory_free_ring()
buffer_ring *br;
br = get_buffer_ring();
+ if (!br)
+ return;
icalmemory_free_ring_byval(br);
#if defined(HAVE_PTHREAD)
@@ -241,7 +231,15 @@ void icalmemory_free_ring()
/* Like strdup, but the buffer is on the ring. */
char *icalmemory_tmp_copy(const char *str)
{
- char *b = icalmemory_tmp_buffer(strlen(str) + 1);
+ char *b;
+
+ if (!str)
+ return NULL;
+
+ b = icalmemory_tmp_buffer(strlen(str) + 1);
+
+ if (!b)
+ return NULL;
strcpy(b, str);
@@ -250,7 +248,67 @@ char *icalmemory_tmp_copy(const char *str)
char *icalmemory_strdup(const char *s)
{
- return strdup(s);
+ size_t l;
+ char *res;
+
+ if (!s)
+ return NULL;
+
+ l = (strlen(s) + 1) * sizeof(char);
+ res = (char *) icalmemory_new_buffer(l);
+ if (res == NULL)
+ return NULL;
+
+ memcpy(res, s, l);
+
+ return res;
+}
+
+#if defined(MEMORY_CONSISTENCY)
+static icalmemory_malloc_f global_icalmem_malloc = &test_malloc;
+#elif defined(ICALMEMORY_DEFAULT_MALLOC) && !defined(S_SPLINT_S)
+static icalmemory_malloc_f global_icalmem_malloc = &ICALMEMORY_DEFAULT_MALLOC;
+#else
+static icalmemory_malloc_f global_icalmem_malloc = NULL;
+#endif
+
+#if defined(MEMORY_CONSISTENCY)
+static icalmemory_realloc_f global_icalmem_realloc = &test_realloc;
+#elif defined(ICALMEMORY_DEFAULT_REALLOC) && !defined(S_SPLINT_S)
+static icalmemory_realloc_f global_icalmem_realloc = &ICALMEMORY_DEFAULT_REALLOC;
+#else
+static icalmemory_realloc_f global_icalmem_realloc = NULL;
+#endif
+
+#if defined(MEMORY_CONSISTENCY)
+static icalmemory_free_f global_icalmem_free = &test_free;
+#elif defined(ICALMEMORY_DEFAULT_FREE) && !defined(S_SPLINT_S)
+static icalmemory_free_f global_icalmem_free = &ICALMEMORY_DEFAULT_FREE;
+#else
+static icalmemory_free_f global_icalmem_free = NULL;
+#endif
+
+void icalmemory_set_mem_alloc_funcs(icalmemory_malloc_f f_malloc,
+ icalmemory_realloc_f f_realloc,
+ icalmemory_free_f f_free)
+{
+ global_icalmem_malloc = f_malloc;
+ global_icalmem_realloc = f_realloc;
+ global_icalmem_free = f_free;
+}
+
+void icalmemory_get_mem_alloc_funcs(icalmemory_malloc_f *f_malloc,
+ icalmemory_realloc_f *f_realloc,
+ icalmemory_free_f *f_free) {
+ if (f_malloc) {
+ *f_malloc = global_icalmem_malloc;
+ }
+ if (f_realloc) {
+ *f_realloc = global_icalmem_realloc;
+ }
+ if (f_free) {
+ *f_free = global_icalmem_free;
+ }
}
/*
@@ -260,7 +318,14 @@ char *icalmemory_strdup(const char *s)
void *icalmemory_new_buffer(size_t size)
{
- void *b = malloc(size);
+ void *b;
+
+ if (global_icalmem_malloc == NULL) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
+
+ b = global_icalmem_malloc(size);
if (b == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
@@ -274,7 +339,14 @@ void *icalmemory_new_buffer(size_t size)
void *icalmemory_resize_buffer(void *buf, size_t size)
{
- void *b = realloc(buf, size);
+ void *b;
+
+ if (global_icalmem_realloc == NULL) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
+
+ b = global_icalmem_realloc(buf, size);
if (b == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
@@ -286,7 +358,12 @@ void *icalmemory_resize_buffer(void *buf, size_t size)
void icalmemory_free_buffer(void *buf)
{
- free(buf);
+ if (global_icalmem_free == NULL) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return;
+ }
+
+ global_icalmem_free(buf);
}
void icalmemory_append_string(char **buf, char **pos, size_t *buf_size, const char *string)
@@ -314,7 +391,11 @@ void icalmemory_append_string(char **buf, char **pos, size_t *buf_size, const ch
*buf_size = (*buf_size) * 2 + final_length;
- new_buf = realloc(*buf, *buf_size);
+ new_buf = icalmemory_resize_buffer(*buf, *buf_size);
+ if (!new_buf) {
+ // an error was set in the resize function, so we just return here.
+ return;
+ }
new_pos = (void *)((size_t) new_buf + data_length);
@@ -351,7 +432,11 @@ void icalmemory_append_char(char **buf, char **pos, size_t *buf_size, char ch)
*buf_size = (*buf_size) * 2 + final_length + 1;
- new_buf = realloc(*buf, *buf_size);
+ new_buf = icalmemory_resize_buffer(*buf, *buf_size);
+ if (!new_buf) {
+ // an error was set in the resize function, so we just return here.
+ return;
+ }
new_pos = (void *)((size_t) new_buf + data_length);
diff --git a/src/libical/icalmemory.h b/src/libical/icalmemory.h
index a57a5c74..39541d2d 100644
--- a/src/libical/icalmemory.h
+++ b/src/libical/icalmemory.h
@@ -2,18 +2,9 @@
FILE: icalmemory.h
CREATOR: eric 30 June 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Initial Developer of the Original Code is Eric Busboom
======================================================================*/
@@ -103,7 +94,11 @@ LIBICAL_ICAL_EXPORT char *icalmemory_tmp_copy(const char *str);
* Adds an externally allocated buffer to the ring. This ensures that libical
* will `free()` the buffer automatically, either after BUFFER_RING_SIZE other
* buffers have been created or added, or after ::icalmemory_free_ring() has
- * been called.
+ * been called. Note that freeing the buffers is done using the
+ * icalmemory_free_buffer() function, which by default is a wrapper around stdlib's
+ * free() function. However, if the memory management functions are
+ * customized by the user, the user must make sure to only pass in buffers
+ * that have been allocated in a compatible manner.
*
* @par Error handling
* No error is raised if @a buf is `NULL`.
@@ -141,9 +136,42 @@ LIBICAL_ICAL_EXPORT void icalmemory_add_tmp_buffer(void *buf);
*/
LIBICAL_ICAL_EXPORT void icalmemory_free_ring(void);
-/* Non-tmp buffers must be freed. These are mostly wrappers around
- * malloc, etc, but are used so the caller can change the memory
- * allocators in a future version of the library */
+typedef void *(*icalmemory_malloc_f)(size_t);
+typedef void *(*icalmemory_realloc_f)(void *, size_t);
+typedef void (*icalmemory_free_f)(void *);
+
+/**
+ * @brief Configures the functions to use for memory management.
+ *
+ * @param f_malloc The function to use for memory allocation.
+ * @param f_realloc The function to use for memory reallocation.
+ * @param f_free The function to use for memory deallocation.
+ *
+ * This function configures the library to use the specified functions for
+ * memory management. By default the standard system memory management
+ * functions malloc(), realloc() and free() are used.
+ *
+ * Note: The memory management functions configured via this
+ * functions are used throughout the core libical component but not within
+ * other components like libicalvcal.
+ * @since 3.1.0
+ */
+LIBICAL_ICAL_EXPORT void icalmemory_set_mem_alloc_funcs(icalmemory_malloc_f f_malloc,
+ icalmemory_realloc_f f_realloc,
+ icalmemory_free_f f_free);
+
+/**
+ * @brief Returns the functions used for memory management.
+ *
+ * @param f_malloc A pointer to the function to use for memory allocation.
+ * @param f_realloc A pointer to the function to use for memory reallocation.
+ * @param f_free A pointer to the function to use for memory deallocation.
+ *
+ * Retrieves the functions used by the library for memory management.
+ * @since 3.1.0
+ */
+LIBICAL_ICAL_EXPORT void icalmemory_get_mem_alloc_funcs(icalmemory_malloc_f *f_malloc,
+ icalmemory_realloc_f *f_realloc, icalmemory_free_f *f_free);
/**
* @brief Creates new buffer with the specified size.
@@ -156,12 +184,15 @@ LIBICAL_ICAL_EXPORT void icalmemory_free_ring(void);
* ::ICAL_NEWFAILED_ERROR and returns `NULL`.
*
* @par Ownership
- * Buffers created with this method are owned by the caller. The must be
- * released with the appropriate icalmemory_free_buffer() method.
+ * Buffers created with this method are owned by the caller. They must be
+ * released with the icalmemory_free_buffer() method.
*
* This creates a new (non-temporary) buffer of the specified @a size. All
* buffers returned by this method are zeroed-out.
*
+ * By default this function delegates to stdlib's malloc() but
+ * the used function can be changed via icalmemory_set_mem_alloc_funcs().
+ *
* @par Usage
* ```c
* // create buffer
@@ -194,6 +225,9 @@ LIBICAL_ICAL_EXPORT void *icalmemory_new_buffer(size_t size);
* appropriate icalmemory_free_buffer() method. The old buffer, @a buf, can not
* be used anymore after calling this method.
*
+ * By default this function delegates to stdlib's realloc() but
+ * the used function can be configured via icalmemory_set_mem_alloc_funcs().
+ *
* @par Usage
* ```c
* // create new buffer
@@ -220,6 +254,9 @@ LIBICAL_ICAL_EXPORT void *icalmemory_resize_buffer(void *buf, size_t size);
* @sa icalmemory_new_buffer()
*
* Releases the memory of the buffer.
+ *
+ * By default this function delegates to stdlib's free() but
+ * the used function can be configured via icalmemory_set_mem_alloc_funcs().
*/
LIBICAL_ICAL_EXPORT void icalmemory_free_buffer(void *buf);
@@ -323,17 +360,19 @@ LIBICAL_ICAL_EXPORT void icalmemory_append_char(char **buf, char **pos, size_t *
*
* @par Ownership
* The returned string is owned by the caller and needs to be released with the
- * appropriate `free()` method.
+ * `icalmemory_free_buffer()` method.
*
- * A wrapper around `strdup()`. Partly to trap calls to `strdup()`, partly
- * because in `-ansi`, `gcc` on Red Hat claims that `strdup()` is undeclared.
+ * Replaces `strdup()`. The function uses icalmemory_new_buffer() for memory
+ * allocation. It also helps trapping calls to `strdup()` and solves the
+ * problem that in `-ansi`, `gcc` on Red Hat claims that `strdup()` is
+ * undeclared.
*
* @par Usage
* ```c
* const char *my_str = "LibIcal";
* char *dup = icalmemory_strdup(my_str);
* printf("%s\n", dup);
- * free(dup);
+ * icalmemory_free_buffer(dup);
* ```
*/
LIBICAL_ICAL_EXPORT char *icalmemory_strdup(const char *s);
diff --git a/src/libical/icalmime.c b/src/libical/icalmime.c
index 45268f71..84359657 100644
--- a/src/libical/icalmime.c
+++ b/src/libical/icalmime.c
@@ -2,18 +2,10 @@
FILE: icalmime.c
CREATOR: eric 26 July 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
======================================================================*/
@@ -49,7 +41,7 @@ static void *icalmime_text_new_part(void)
struct text_part *impl;
- if ((impl = (struct text_part *)malloc(sizeof(struct text_part))) == 0) {
+ if ((impl = (struct text_part *)icalmemory_new_buffer(sizeof(struct text_part))) == 0) {
return 0;
}
@@ -77,7 +69,7 @@ static void *icalmime_textcalendar_end_part(void *part)
icalcomponent *c = icalparser_parse_string(impl->buf);
icalmemory_free_buffer(impl->buf);
- free(impl);
+ icalmemory_free_buffer(impl);
return c;
}
@@ -88,7 +80,7 @@ static void *icalmime_text_end_part_r(void *part)
struct text_part *impl = (struct text_part *)part;
buf = impl->buf;
- free(impl);
+ icalmemory_free_buffer(impl);
return buf;
}
@@ -166,7 +158,7 @@ icalcomponent *icalmime_parse(char *(*get_string) (char *s, size_t size, void *d
int i, last_level = 0;
icalcomponent *root = 0, *parent = 0, *comp = 0, *last = 0;
- if ((parts = (struct sspm_part *)malloc(NUM_PARTS * sizeof(struct sspm_part))) == 0) {
+ if ((parts = (struct sspm_part *)icalmemory_new_buffer(NUM_PARTS * sizeof(struct sspm_part))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
@@ -185,7 +177,7 @@ icalcomponent *icalmime_parse(char *(*get_string) (char *s, size_t size, void *d
const char *minor = sspm_minor_type_string(parts[i].header.minor);
if (parts[i].header.minor == SSPM_UNKNOWN_MINOR_TYPE) {
- assert(parts[i].header.minor_text != 0);
+ icalassert(parts[i].header.minor_text != 0);
minor = parts[i].header.minor_text;
}
@@ -195,7 +187,7 @@ icalcomponent *icalmime_parse(char *(*get_string) (char *s, size_t size, void *d
if (comp == 0) {
/* HACK Handle Error */
- assert(0);
+ icalassert(0);
}
if (parts[i].header.error != SSPM_NO_ERROR) {
@@ -245,7 +237,7 @@ icalcomponent *icalmime_parse(char *(*get_string) (char *s, size_t size, void *d
icalcomponent_add_property(
comp,
icalproperty_new_xlicmimecontenttype(mimeTypeCopy));
- free(mimeTypeCopy);
+ icalmemory_free_buffer(mimeTypeCopy);
}
if (parts[i].header.encoding != SSPM_NO_ENCODING) {
@@ -288,7 +280,7 @@ icalcomponent *icalmime_parse(char *(*get_string) (char *s, size_t size, void *d
icalcomponent_add_property(
comp,
icalproperty_new_description(descStr));
- free(descStr);
+ icalmemory_free_buffer(descStr);
parts[i].data = 0;
}
@@ -322,16 +314,16 @@ icalcomponent *icalmime_parse(char *(*get_string) (char *s, size_t size, void *d
icalcomponent_add_component(parent, comp);
} else {
- assert(0);
+ icalassert(0);
}
last = comp;
last_level = parts[i].level;
- assert(parts[i].data == 0);
+ icalassert(parts[i].data == 0);
}
sspm_free_parts(parts, NUM_PARTS);
- free(parts);
+ icalmemory_free_buffer(parts);
return root;
}
@@ -342,7 +334,7 @@ int icalmime_test(char *(*get_string) (char *s, size_t size, void *d), void *dat
struct sspm_part *parts;
int i;
- if ((parts = (struct sspm_part *)malloc(NUM_PARTS * sizeof(struct sspm_part))) == 0) {
+ if ((parts = (struct sspm_part *)icalmemory_new_buffer(NUM_PARTS * sizeof(struct sspm_part))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
@@ -363,7 +355,7 @@ int icalmime_test(char *(*get_string) (char *s, size_t size, void *d), void *dat
sspm_write_mime(parts, NUM_PARTS, &out, "To: bob@bob.org");
printf("%s\n", out);
- free(out);
+ icalmemory_free_buffer(out);
return 0;
}
diff --git a/src/libical/icalmime.h b/src/libical/icalmime.h
index ea2e1a0d..8dca137c 100644
--- a/src/libical/icalmime.h
+++ b/src/libical/icalmime.h
@@ -2,18 +2,10 @@
FILE: icalmime.h
CREATOR: eric 26 July 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALMIME_H
diff --git a/src/libical/icalparameter.c b/src/libical/icalparameter.c
index f27dc8c7..e4bf5842 100644
--- a/src/libical/icalparameter.c
+++ b/src/libical/icalparameter.c
@@ -2,18 +2,9 @@
FILE: icalderivedparameters.{c,h}
CREATOR: eric 09 May 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original code is icalderivedparameters.{c,h}
@@ -36,7 +27,7 @@ LIBICAL_ICAL_EXPORT struct icalparameter_impl *icalparameter_new_impl(icalparame
{
struct icalparameter_impl *v;
- if ((v = (struct icalparameter_impl *)malloc(sizeof(struct icalparameter_impl))) == 0) {
+ if ((v = (struct icalparameter_impl *)icalmemory_new_buffer(sizeof(struct icalparameter_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
@@ -67,21 +58,21 @@ void icalparameter_free(icalparameter *param)
}
if (param->string != 0) {
- free((void *)param->string);
+ icalmemory_free_buffer((void *)param->string);
}
if (param->x_name != 0) {
- free((void *)param->x_name);
+ icalmemory_free_buffer((void *)param->x_name);
}
memset(param, 0, sizeof(icalparameter));
param->parent = 0;
param->id[0] = 'X';
- free(param);
+ icalmemory_free_buffer(param);
}
-icalparameter *icalparameter_new_clone(icalparameter *old)
+icalparameter *icalparameter_clone(const icalparameter *old)
{
struct icalparameter_impl *new;
@@ -116,6 +107,11 @@ icalparameter *icalparameter_new_clone(icalparameter *old)
return new;
}
+icalparameter *icalparameter_new_clone(icalparameter *old)
+{
+ return icalparameter_clone(old);
+}
+
icalparameter *icalparameter_new_from_string(const char *str)
{
char *eq;
@@ -136,7 +132,7 @@ icalparameter *icalparameter_new_from_string(const char *str)
if (eq == 0) {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- free(cpy);
+ icalmemory_free_buffer(cpy);
return 0;
}
@@ -148,7 +144,7 @@ icalparameter *icalparameter_new_from_string(const char *str)
if (kind == ICAL_NO_PARAMETER) {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- free(cpy);
+ icalmemory_free_buffer(cpy);
return 0;
}
@@ -160,7 +156,7 @@ icalparameter *icalparameter_new_from_string(const char *str)
icalparameter_set_iana_name(param, cpy);
}
- free(cpy);
+ icalmemory_free_buffer(cpy);
return param;
}
@@ -292,7 +288,7 @@ char *icalparameter_as_ical_string_r(icalparameter *param)
if (param->kind == ICAL_NO_PARAMETER ||
param->kind == ICAL_ANY_PARAMETER || kind_string == 0) {
icalerror_set_errno(ICAL_BADARG_ERROR);
- free(buf);
+ icalmemory_free_buffer(buf);
return 0;
}
@@ -310,7 +306,7 @@ char *icalparameter_as_ical_string_r(icalparameter *param)
icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
} else {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- free(buf);
+ icalmemory_free_buffer(buf);
return 0;
}
@@ -347,7 +343,7 @@ void icalparameter_set_xname(icalparameter *param, const char *v)
icalerror_check_arg_rv((v != 0), "v");
if (param->x_name != 0) {
- free((void *)param->x_name);
+ icalmemory_free_buffer((void *)param->x_name);
}
param->x_name = icalmemory_strdup(v);
@@ -370,7 +366,7 @@ void icalparameter_set_xvalue(icalparameter *param, const char *v)
icalerror_check_arg_rv((v != 0), "v");
if (param->string != 0) {
- free((void *)param->string);
+ icalmemory_free_buffer((void *)param->string);
}
param->string = icalmemory_strdup(v);
diff --git a/src/libical/icalparameter.h b/src/libical/icalparameter.h
index 494cc529..93cd4855 100644
--- a/src/libical/icalparameter.h
+++ b/src/libical/icalparameter.h
@@ -2,18 +2,10 @@
FILE: icalparam.h
CREATOR: eric 20 March 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
/**
@@ -26,6 +18,7 @@
#ifndef ICALPARAMETER_H
#define ICALPARAMETER_H
+#include "libical_deprecated.h"
#include "libical_ical_export.h"
#include "icalderivedparameter.h"
@@ -81,7 +74,7 @@ LIBICAL_ICAL_EXPORT icalparameter *icalparameter_new(icalparameter_kind kind);
* icalparameter *param = icalparameter_new_from_string("ROLE=CHAIR");
*
* // clone the parameter
- * icalparameter *clone = icalparameter_new_clone(param);
+ * icalparameter *clone = icalparameter_clone(param);
*
* if(clone) {
* // use clone ...
@@ -91,8 +84,15 @@ LIBICAL_ICAL_EXPORT icalparameter *icalparameter_new(icalparameter_kind kind);
* icalparameter_free(param);
* icalparameter_free(clone);
* ```
+ * @since 3.1.0
+ */
+LIBICAL_ICAL_EXPORT icalparameter *icalparameter_clone(const icalparameter *p);
+
+/**
+ * @copydoc icalparameter_clone()
+ * @deprecated Use icalparameter_clone() instead
*/
-LIBICAL_ICAL_EXPORT icalparameter *icalparameter_new_clone(icalparameter *p);
+LIBICAL_ICAL_EXPORT LIBICAL_DEPRECATED(icalparameter *icalparameter_new_clone(icalparameter *p));
/**
* @brief Creates new icalparameter object from string
@@ -157,9 +157,10 @@ LIBICAL_ICAL_EXPORT icalparameter *icalparameter_new_from_value_string(icalparam
* @param parameter The icalparameter to free
*
* This method needs to be used on all parameter objects returned
- * from any of the `_new()` methods including icalparameter_new(), icalparameter_new_clone(),
- * icalparameter_new_from_string() and icalparameter_new_from_value_string(),
- * when they are not needed anymore and to be released.
+ * from any of the `_new()` methods including icalparameter_new(),
+ * icalparameter_new_from_string() and icalparameter_new_from_value_string()
+ * and on cloned parameter objects returned by icalparameter_clone()
+ * when these object are not needed anymore and to be released.
*
* @par Usage
* ```c
@@ -222,9 +223,9 @@ LIBICAL_ICAL_EXPORT char *icalparameter_as_ical_string(icalparameter *parameter)
*
* @par Ownership
* Strings returned by this method are owned by the caller, thus they need
- * to be manually `free()`d after use. A version of this function which returns
- * strings that do not need to be freed manually is
- * icalparameter_as_ical_string().
+ * to be manually `icalmemory_free_buffer()`d after use.
+ * A version of this function which returns strings that do not
+ * need to be freed manually is icalparameter_as_ical_string().
*
* @par Usage
* ```c
@@ -233,7 +234,7 @@ LIBICAL_ICAL_EXPORT char *icalparameter_as_ical_string(icalparameter *parameter)
* if(param) {
* char *str = icalparameter_as_ical_string(param);
* printf("%s\n", str);
- * free(str);
+ * icalmemory_free_buffer(str);
* }
*
* icalparameter_free(param);
diff --git a/src/libical/icalparameter_cxx.cpp b/src/libical/icalparameter_cxx.cpp
index 73654e96..70510533 100644
--- a/src/libical/icalparameter_cxx.cpp
+++ b/src/libical/icalparameter_cxx.cpp
@@ -3,18 +3,10 @@
* @author fnguyen (12/10/01)
* @brief Implementation of C++ Wrapper for icalparameter.c
*
- * (C) COPYRIGHT 2001, Critical Path
+ * SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
*/
#include "icalparameter_cxx.h"
@@ -24,7 +16,7 @@ ICalParameter::ICalParameter() : imp(icalparameter_new(ICAL_ANY_PARAMETER))
{
}
-ICalParameter::ICalParameter(const ICalParameter &v) : imp(icalparameter_new_clone(v.imp))
+ICalParameter::ICalParameter(const ICalParameter &v) : imp(icalparameter_clone(v.imp))
{
if (imp == NULL) {
throw icalerrno;
@@ -39,7 +31,7 @@ ICalParameter &ICalParameter::operator=(const ICalParameter &v)
if (imp != NULL) {
icalparameter_free(imp);
- imp = icalparameter_new_clone(v.imp);
+ imp = icalparameter_clone(v.imp);
if (imp == NULL) {
throw icalerrno;
}
diff --git a/src/libical/icalparameter_cxx.h b/src/libical/icalparameter_cxx.h
index 81c4d9e6..dfe98bbc 100644
--- a/src/libical/icalparameter_cxx.h
+++ b/src/libical/icalparameter_cxx.h
@@ -3,18 +3,10 @@
* @author fnguyen (12/10/01)
* @brief Definition of C++ Wrapper for icalparameter.c
*
- * (C) COPYRIGHT 2001, Critical Path
+ * SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
*/
#ifndef ICALPARAMETER_CXX_H
diff --git a/src/libical/icalparameterimpl.h b/src/libical/icalparameterimpl.h
index 0d710978..67b4c76f 100644
--- a/src/libical/icalparameterimpl.h
+++ b/src/libical/icalparameterimpl.h
@@ -2,18 +2,9 @@
FILE: icalparameterimpl.h
CREATOR: eric 09 May 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original code is icalderivedparameters.{c,h}
diff --git a/src/libical/icalparser.c b/src/libical/icalparser.c
index d1aaa268..2ae783fd 100644
--- a/src/libical/icalparser.c
+++ b/src/libical/icalparser.c
@@ -2,31 +2,11 @@
FILE: icalparser.c
CREATOR: eric 04 August 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
-
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
-
- The Initial Developer of the Original Code is Eric Busboom
+ The Initial Developer of the Original Code is Eric Busboom
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -46,6 +26,7 @@
#define TMP_BUF_SIZE 80
#define MAXIMUM_ALLOWED_PARAMETERS 100
#define MAXIMUM_ALLOWED_MULTIPLE_VALUES 500
+#define MAXIMUM_ALLOWED_ERRORS 100 // Limit the number of errors created by insert_error
struct icalparser_impl
{
@@ -58,6 +39,7 @@ struct icalparser_impl
int version;
int level;
int lineno;
+ int error_count;
icalparser_state state;
pvl_list components;
@@ -100,7 +82,7 @@ icalparser *icalparser_new(void)
{
struct icalparser_impl *impl = 0;
- if ((impl = (struct icalparser_impl *)malloc(sizeof(struct icalparser_impl))) == 0) {
+ if ((impl = (struct icalparser_impl *)icalmemory_new_buffer(sizeof(struct icalparser_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
@@ -113,6 +95,7 @@ icalparser *icalparser_new(void)
impl->buffer_full = 0;
impl->continuation_line = 0;
impl->lineno = 0;
+ impl->error_count = 0;
memset(impl->temp, 0, TMP_BUF_SIZE);
return (icalparser *) impl;
@@ -132,7 +115,7 @@ void icalparser_free(icalparser *parser)
pvl_free(parser->components);
- free(parser);
+ icalmemory_free_buffer(parser);
}
void icalparser_set_gen_data(icalparser *parser, void *data)
@@ -223,20 +206,28 @@ static void parser_decode_param_value(char *value)
char *in, *out;
for (in = out = value; *in; in++, out++) {
- if (*in == '^' && strspn(in+1, "n^'")) {
- switch (*++in) {
+ int found_escaped_char = 0;
+
+ if (*in == '^') {
+ switch (*(in + 1)) {
case 'n':
*out = '\n';
+ found_escaped_char = 1;
break;
-
case '^':
*out = '^';
+ found_escaped_char = 1;
break;
case '\'':
*out = '"';
+ found_escaped_char = 1;
break;
}
+ }
+
+ if (found_escaped_char) {
+ ++in;
} else {
*out = *in;
}
@@ -316,7 +307,7 @@ static char *parser_get_param_name_heap(char *line, char **end)
*end = *end + 1;
next = (**end == '"') ? *end : parser_get_next_char('"', *end, 0);
if (next == 0) {
- free(str);
+ icalmemory_free_buffer(str);
*end = NULL;
return 0;
}
@@ -550,7 +541,7 @@ char *icalparser_get_line(icalparser *parser,
} else {
/* No data in output; return and signal that there
is no more input */
- free(line);
+ icalmemory_free_buffer(line);
return 0;
}
}
@@ -595,11 +586,15 @@ char *icalparser_get_line(icalparser *parser,
return line;
}
-static void insert_error(icalcomponent *comp, const char *text,
+static void insert_error(icalparser *parser, icalcomponent *comp, const char *text,
const char *message, icalparameter_xlicerrortype type)
{
char temp[1024];
+ if (parser->error_count > MAXIMUM_ALLOWED_ERRORS) {
+ return;
+ }
+
if (text == 0) {
snprintf(temp, 1024, "%s:", message);
} else {
@@ -609,6 +604,8 @@ static void insert_error(icalcomponent *comp, const char *text,
icalcomponent_add_property(
comp,
icalproperty_vanew_xlicerror(temp, icalparameter_new_xlicerrortype(type), (void *)0));
+
+ parser->error_count++;
}
static int line_is_blank(char *line)
@@ -648,8 +645,8 @@ icalcomponent *icalparser_parse(icalparser *parser,
/* This is bad news... assert? */
}
- assert(parser->root_component == 0);
- assert(pvl_count(parser->components) == 0);
+ icalassert(parser->root_component == 0);
+ icalassert(pvl_count(parser->components) == 0);
if (root == 0) {
/* Just one component */
@@ -669,7 +666,7 @@ icalcomponent *icalparser_parse(icalparser *parser,
} else {
/* Badness */
- assert(0);
+ icalassert(0);
}
c = 0;
@@ -722,7 +719,7 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
if (tail) {
insert_error(
- tail, line,
+ parser, tail, line,
"Got a data line, but could not find a property name or component begin tag",
ICAL_XLICERRORTYPE_COMPONENTPARSEERROR);
}
@@ -749,11 +746,15 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
comp_kind = icalenum_string_to_component_kind(str);
- c = icalcomponent_new(comp_kind);
+ if (comp_kind == ICAL_X_COMPONENT) {
+ c = icalcomponent_new_x(str);
+ } else {
+ c = icalcomponent_new(comp_kind);
+ }
if (c == 0) {
c = icalcomponent_new(ICAL_XLICINVALID_COMPONENT);
- insert_error(c, str, "Parse error in component name",
+ insert_error(parser, c, str, "Parse error in component name",
ICAL_XLICERRORTYPE_COMPONENTPARSEERROR);
}
@@ -803,7 +804,7 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
(void)icalparser_clean(parser); /* may reset parser->root_component */
}
- assert(pvl_count(parser->components) == 0);
+ icalassert(pvl_count(parser->components) == 0);
parser->state = ICALPARSER_SUCCESS;
rtrn = parser->root_component;
@@ -854,7 +855,7 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
} else {
icalcomponent *tail = pvl_data(pvl_tail(parser->components));
- insert_error(tail, str, "Parse error in property name",
+ insert_error(parser, tail, str, "Parse error in property name",
ICAL_XLICERRORTYPE_PROPERTYPARSEERROR);
tail = 0;
@@ -905,7 +906,7 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
if (name_heap == 0) {
/* 'tail' defined above */
- insert_error(tail, str, "Can't parse parameter name",
+ insert_error(parser, tail, str, "Can't parse parameter name",
ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR);
tail = 0;
break;
@@ -1016,7 +1017,7 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
/* Change for mozilla */
/* have the option of being flexible towards unsupported parameters */
#if ICAL_ERRORS_ARE_FATAL == 1
- insert_error(tail, str, "Can't parse parameter name",
+ insert_error(parser, tail, str, "Can't parse parameter name",
ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR);
tail = 0;
parser->state = ICALPARSER_ERROR;
@@ -1058,7 +1059,7 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
if (param == 0) {
/* 'tail' defined above */
- insert_error(tail, str, "Can't parse parameter value",
+ insert_error(parser, tail, str, "Can't parse parameter value",
ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR);
tail = 0;
@@ -1086,7 +1087,7 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
char *tmp_buf = icalmemory_tmp_buffer(tmp_buf_len);
snprintf(tmp_buf, tmp_buf_len, "%s %s", err_str, prop_str);
- insert_error(tail, str, tmp_buf,
+ insert_error(parser, tail, str, tmp_buf,
ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR);
value_kind = icalproperty_kind_to_value_kind(prop_kind);
@@ -1145,7 +1146,7 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
if (vcount > 0) {
/* Actually, only clone after the second value */
- icalproperty *clone = icalproperty_new_clone(prop);
+ icalproperty *clone = icalproperty_clone(prop);
icalcomponent *tail = pvl_data(pvl_tail(parser->components));
icalcomponent_add_property(tail, clone);
@@ -1167,7 +1168,7 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
icalvalue_kind_to_string(value_kind),
icalproperty_kind_to_string(prop_kind));
- insert_error(tail, str, temp, ICAL_XLICERRORTYPE_VALUEPARSEERROR);
+ insert_error(parser, tail, str, temp, ICAL_XLICERRORTYPE_VALUEPARSEERROR);
/* Remove the troublesome property */
icalcomponent_remove_property(tail, prop);
@@ -1206,7 +1207,7 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
snprintf(temp, sizeof(temp), "No value for %s property. Removing entire property",
icalproperty_kind_to_string(prop_kind));
- insert_error(tail, str, temp, ICAL_XLICERRORTYPE_VALUEPARSEERROR);
+ insert_error(parser, tail, str, temp, ICAL_XLICERRORTYPE_VALUEPARSEERROR);
/* Remove the troublesome property */
icalcomponent_remove_property(tail, prop);
@@ -1230,7 +1231,7 @@ icalcomponent *icalparser_add_line(icalparser *parser, char *line)
if (pvl_data(pvl_tail(parser->components)) == 0 && parser->level == 0) {
/* HACK. Does this clause ever get executed? */
parser->state = ICALPARSER_SUCCESS;
- assert(0);
+ icalassert(0);
return parser->root_component;
} else {
parser->state = ICALPARSER_IN_PROGRESS;
@@ -1254,7 +1255,7 @@ icalcomponent *icalparser_clean(icalparser *parser)
while ((tail = pvl_data(pvl_tail(parser->components))) != 0) {
- insert_error(tail, " ",
+ insert_error(parser, tail, " ",
"Missing END tag for this component. Closing component at end of input.",
ICAL_XLICERRORTYPE_COMPONENTPARSEERROR);
@@ -1348,6 +1349,9 @@ icalcomponent *icalparser_parse_string(const char *str)
d.str = str;
p = icalparser_new();
+ if (!p)
+ return NULL;
+
icalparser_set_gen_data(p, &d);
icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR, ICAL_ERROR_NONFATAL);
diff --git a/src/libical/icalparser.h b/src/libical/icalparser.h
index 067200b4..7d3c4dd5 100644
--- a/src/libical/icalparser.h
+++ b/src/libical/icalparser.h
@@ -2,18 +2,9 @@
FILE: icalparser.h
CREATOR: eric 20 April 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original code is icalparser.h
======================================================================*/
diff --git a/src/libical/icalperiod.c b/src/libical/icalperiod.c
index 0dc3cb01..f3e57aab 100644
--- a/src/libical/icalperiod.c
+++ b/src/libical/icalperiod.c
@@ -2,18 +2,9 @@
FILE: icalperiod.c
CREATOR: eric 02 June 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libical/icalperiod.h b/src/libical/icalperiod.h
index 4b1034e9..410a3bc4 100644
--- a/src/libical/icalperiod.h
+++ b/src/libical/icalperiod.h
@@ -2,18 +2,9 @@
FILE: icalperiod.h
CREATOR: eric 26 Jan 2001
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libical/icalproperty.c b/src/libical/icalproperty.c
index 15dc7320..66e2fd2a 100644
--- a/src/libical/icalproperty.c
+++ b/src/libical/icalproperty.c
@@ -2,18 +2,9 @@
FILE: icalproperty.c
CREATOR: eric 28 April 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original code is icalproperty.c
======================================================================*/
@@ -67,7 +58,7 @@ icalproperty *icalproperty_new_impl(icalproperty_kind kind)
if (!icalproperty_kind_is_valid(kind))
return NULL;
- if ((prop = (icalproperty *) malloc(sizeof(icalproperty))) == 0) {
+ if ((prop = (icalproperty *) icalmemory_new_buffer(sizeof(icalproperty))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
@@ -91,7 +82,7 @@ icalproperty *icalproperty_new(icalproperty_kind kind)
return (icalproperty *) icalproperty_new_impl(kind);
}
-icalproperty *icalproperty_new_clone(icalproperty *old)
+icalproperty *icalproperty_clone(const icalproperty *old)
{
icalproperty *new;
pvl_elem p;
@@ -101,7 +92,7 @@ icalproperty *icalproperty_new_clone(icalproperty *old)
icalerror_check_arg_rz((new != 0), "new");
if (old->value != 0) {
- new->value = icalvalue_new_clone(old->value);
+ new->value = icalvalue_clone(old->value);
}
if (old->x_name != 0) {
@@ -116,7 +107,7 @@ icalproperty *icalproperty_new_clone(icalproperty *old)
}
for (p = pvl_head(old->parameters); p != 0; p = pvl_next(p)) {
- icalparameter *param = icalparameter_new_clone(pvl_data(p));
+ icalparameter *param = icalparameter_clone(pvl_data(p));
if (param == 0) {
icalproperty_free(new);
@@ -130,6 +121,11 @@ icalproperty *icalproperty_new_clone(icalproperty *old)
return new;
}
+icalproperty *icalproperty_new_clone(icalproperty *old)
+{
+ return icalproperty_clone(old);
+}
+
icalproperty *icalproperty_new_from_string(const char *str)
{
size_t buf_size = 1024;
@@ -155,7 +151,7 @@ icalproperty *icalproperty_new_from_string(const char *str)
if (comp == 0) {
icalerror_set_errno(ICAL_PARSE_ERROR);
- free(buf);
+ icalmemory_free_buffer(buf);
return 0;
}
@@ -166,7 +162,7 @@ icalproperty *icalproperty_new_from_string(const char *str)
icalcomponent_remove_property(comp, prop);
icalcomponent_free(comp);
- free(buf);
+ icalmemory_free_buffer(buf);
if (errors > 0) {
icalproperty_free(prop);
@@ -198,7 +194,7 @@ void icalproperty_free(icalproperty *p)
pvl_free(p->parameters);
if (p->x_name != 0) {
- free(p->x_name);
+ icalmemory_free_buffer(p->x_name);
}
p->kind = ICAL_NO_PROPERTY;
@@ -208,7 +204,7 @@ void icalproperty_free(icalproperty *p)
p->x_name = 0;
p->id[0] = 'X';
- free(p);
+ icalmemory_free_buffer(p);
}
/* This returns where the start of the next line should be. chars_left does
@@ -417,13 +413,13 @@ char *icalproperty_as_ical_string_r(icalproperty *prop)
}
if (kind == ICAL_VALUE_PARAMETER) {
- free((char *)kind_string);
+ icalmemory_free_buffer((char *)kind_string);
continue;
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, ";");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
- free((char *)kind_string);
+ icalmemory_free_buffer((char *)kind_string);
}
/* Append value */
@@ -442,7 +438,7 @@ char *icalproperty_as_ical_string_r(icalproperty *prop)
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "ERROR: No Value");
#endif
}
- free(str);
+ icalmemory_free_buffer(str);
} else {
#if ICAL_ALLOW_EMPTY_PROPERTIES == 0
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "ERROR: No Value");
@@ -595,13 +591,13 @@ char *icalproperty_get_parameter_as_string_r(icalproperty *prop, const char *nam
if (t == 0) {
icalerror_set_errno(ICAL_INTERNAL_ERROR);
- free(str);
+ icalmemory_free_buffer(str);
return 0;
}
/* Strip the property name and the equal sign */
pv = icalmemory_strdup(t + 1);
- free(str);
+ icalmemory_free_buffer(str);
/* Is the string quoted? */
pvql = strchr(pv, '"');
@@ -611,13 +607,13 @@ char *icalproperty_get_parameter_as_string_r(icalproperty *prop, const char *nam
/* Strip everything up to the first quote */
str = icalmemory_strdup(pvql + 1);
- free(pv);
+ icalmemory_free_buffer(pv);
/* Search for the end quote */
pvqr = strrchr(str, '"');
if (pvqr == 0) {
icalerror_set_errno(ICAL_INTERNAL_ERROR);
- free(str);
+ icalmemory_free_buffer(str);
return 0;
}
@@ -807,7 +803,7 @@ void icalproperty_set_value_from_string(icalproperty *prop, const char *str, con
if (nval == 0) {
/* icalvalue_new_from_string sets errno */
- assert(icalerrno != ICAL_NO_ERROR);
+ icalassert(icalerrno != ICAL_NO_ERROR);
return;
}
@@ -847,7 +843,7 @@ void icalproperty_set_x_name(icalproperty *prop, const char *name)
icalerror_check_arg_rv((prop != 0), "prop");
if (prop->x_name != 0) {
- free(prop->x_name);
+ icalmemory_free_buffer(prop->x_name);
}
prop->x_name = icalmemory_strdup(name);
diff --git a/src/libical/icalproperty.h b/src/libical/icalproperty.h
index e326eb24..fdc4f57f 100644
--- a/src/libical/icalproperty.h
+++ b/src/libical/icalproperty.h
@@ -2,23 +2,16 @@
FILE: icalproperty.h
CREATOR: eric 20 March 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALPROPERTY_H
#define ICALPROPERTY_H
+#include "libical_deprecated.h"
#include "libical_ical_export.h"
#include "icalderivedproperty.h" /* To get icalproperty_kind enumerations */
@@ -30,7 +23,12 @@ LIBICAL_ICAL_EXPORT icalproperty *icalproperty_new(icalproperty_kind kind);
LIBICAL_ICAL_EXPORT icalproperty *icalproperty_new_impl(icalproperty_kind kind);
-LIBICAL_ICAL_EXPORT icalproperty *icalproperty_new_clone(icalproperty *prop);
+/** @brief Deeply clones an icalproperty.
+ *
+ * Returns a pointer to the memory for the newly cloned icalproperty.
+ * @since 3.1.0
+ */
+LIBICAL_ICAL_EXPORT icalproperty *icalproperty_clone(const icalproperty *prop);
LIBICAL_ICAL_EXPORT icalproperty *icalproperty_new_from_string(const char *str);
@@ -178,4 +176,10 @@ LIBICAL_ICAL_EXPORT int icalproperty_enum_belongs_to_property(icalproperty_kind
*/
LIBICAL_ICAL_EXPORT void icalproperty_normalize(icalproperty *prop);
+/**
+ * @copydoc icalproperty_clone()
+ * @deprecated use icalproperty_clone() instead
+ */
+LIBICAL_ICAL_EXPORT LIBICAL_DEPRECATED(icalproperty *icalproperty_new_clone(icalproperty *prop));
+
#endif /*ICALPROPERTY_H */
diff --git a/src/libical/icalproperty_cxx.cpp b/src/libical/icalproperty_cxx.cpp
index fd2a7e48..6a377fec 100644
--- a/src/libical/icalproperty_cxx.cpp
+++ b/src/libical/icalproperty_cxx.cpp
@@ -3,18 +3,10 @@
* @author fnguyen (12/10/01)
* @brief Implementation of C++ Wrapper for icalproperty.c
*
- * (C) COPYRIGHT 2001, Critical Path
+ * SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
*/
#include "icalproperty_cxx.h"
@@ -26,7 +18,7 @@ ICalProperty::ICalProperty() : imp(icalproperty_new(ICAL_ANY_PROPERTY))
{
}
-ICalProperty::ICalProperty(const ICalProperty &v) : imp(icalproperty_new_clone(v.imp))
+ICalProperty::ICalProperty(const ICalProperty &v) : imp(icalproperty_clone(v.imp))
{
if (imp == NULL) {
throw icalerrno;
@@ -41,7 +33,7 @@ ICalProperty &ICalProperty::operator=(const ICalProperty &v)
if (imp != NULL) {
icalproperty_free(imp);
- imp = icalproperty_new_clone(v.imp);
+ imp = icalproperty_clone(v.imp);
if (imp == NULL) {
throw icalerrno;
}
diff --git a/src/libical/icalproperty_cxx.h b/src/libical/icalproperty_cxx.h
index e243dd2e..c81acfde 100644
--- a/src/libical/icalproperty_cxx.h
+++ b/src/libical/icalproperty_cxx.h
@@ -3,18 +3,10 @@
* @author fnguyen (12/10/01)
* @brief Definition of C++ Wrapper for icalproperty.c
*
- * (C) COPYRIGHT 2001, Critical Path
+ * SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
*/
#ifndef ICALPROPERTY_CXX_H
diff --git a/src/libical/icalproperty_p.h b/src/libical/icalproperty_p.h
index f8114a9e..dd0c9614 100644
--- a/src/libical/icalproperty_p.h
+++ b/src/libical/icalproperty_p.h
@@ -1,18 +1,10 @@
/*======================================================================
FILE: icalproperty_p.h
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALPROPERTY_P_H
diff --git a/src/libical/icalrecur.c b/src/libical/icalrecur.c
index 522fe28d..96d4190f 100644
--- a/src/libical/icalrecur.c
+++ b/src/libical/icalrecur.c
@@ -2,18 +2,10 @@
FILE: icalrecur.c
CREATOR: eric 16 May 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
========================================================================*/
/**
@@ -142,6 +134,13 @@
#include <stddef.h> /* For offsetof() macro */
#include <stdlib.h>
+#if defined(HAVE_PTHREAD)
+#include <pthread.h>
+static pthread_mutex_t invalid_rrule_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+static ical_invalid_rrule_handling invalidRruleHandling = ICAL_RRULE_TREAT_AS_ERROR;
+
#if defined(HAVE_LIBICU)
#include <unicode/ucal.h>
#include <unicode/ustring.h>
@@ -162,12 +161,12 @@
#define ICAL_BY_YEARDAY_SIZE 367 /* 1 to 366 */
#endif
-#if (SIZEOF_TIME_T > 4)
+#if (SIZEOF_ICALTIME_T > 4)
/** Arbitrarily go up to 1000th anniversary of Gregorian calendar, since
- 64-bit time_t values get us up to the tm_year limit of 2+ billion years. */
+ 64-bit icaltime_t values get us up to the tm_year limit of 2+ billion years. */
#define MAX_TIME_T_YEAR 2582
#else
-/** This is the last year we will go up to, since 32-bit time_t values
+/** This is the last year we will go up to, since 32-bit icaltime_t values
only go up to the start of 2038. */
#define MAX_TIME_T_YEAR 2037
#endif
@@ -196,10 +195,10 @@ int icalrecurrencetype_rscale_is_supported(void)
/****************** Enumeration Routines ******************/
-static struct freq_map
+static const struct freq_map
{
icalrecurrencetype_frequency kind;
- const char *str;
+ const char str[9];
} freq_map[] = {
{ICAL_SECONDLY_RECURRENCE, "SECONDLY"},
{ICAL_MINUTELY_RECURRENCE, "MINUTELY"},
@@ -208,7 +207,7 @@ static struct freq_map
{ICAL_WEEKLY_RECURRENCE, "WEEKLY"},
{ICAL_MONTHLY_RECURRENCE, "MONTHLY"},
{ICAL_YEARLY_RECURRENCE, "YEARLY"},
- {ICAL_NO_RECURRENCE, 0}
+ {ICAL_NO_RECURRENCE, ""}
};
icalrecurrencetype_frequency icalrecur_string_to_freq(const char *str)
@@ -235,15 +234,15 @@ const char *icalrecur_freq_to_string(icalrecurrencetype_frequency kind)
return 0;
}
-static struct skip_map
+static const struct skip_map
{
icalrecurrencetype_skip kind;
- const char *str;
+ const char str[9];
} skip_map[] = {
{ICAL_SKIP_BACKWARD, "BACKWARD"},
{ICAL_SKIP_FORWARD, "FORWARD"},
{ICAL_SKIP_OMIT, "OMIT"},
- {ICAL_SKIP_UNDEFINED, 0}
+ {ICAL_SKIP_UNDEFINED, ""}
};
icalrecurrencetype_skip icalrecur_string_to_skip(const char *str)
@@ -270,10 +269,10 @@ const char *icalrecur_skip_to_string(icalrecurrencetype_skip kind)
return 0;
}
-static struct wd_map
+static const struct wd_map
{
icalrecurrencetype_weekday wd;
- const char *str;
+ const char str[3];
} wd_map[] = {
{ICAL_SUNDAY_WEEKDAY, "SU"},
{ICAL_MONDAY_WEEKDAY, "MO"},
@@ -282,7 +281,7 @@ static struct wd_map
{ICAL_THURSDAY_WEEKDAY, "TH"},
{ICAL_FRIDAY_WEEKDAY, "FR"},
{ICAL_SATURDAY_WEEKDAY, "SA"},
- {ICAL_NO_WEEKDAY, 0}
+ {ICAL_NO_WEEKDAY, ""}
};
const char *icalrecur_weekday_to_string(icalrecurrencetype_weekday kind)
@@ -323,6 +322,86 @@ struct icalrecur_parser
struct icalrecurrencetype rt;
};
+enum byrule
+{
+ NO_CONTRACTION = -1,
+ BY_MONTH = 0,
+ BY_WEEK_NO = 1,
+ BY_YEAR_DAY = 2,
+ BY_MONTH_DAY = 3,
+ BY_DAY = 4,
+ BY_HOUR = 5,
+ BY_MINUTE = 6,
+ BY_SECOND = 7,
+ BY_SET_POS = 8
+};
+
+#define NUM_BY_PARTS 9
+
+enum expand_table
+{
+ UNKNOWN = 0,
+ CONTRACT = 1,
+ EXPAND = 2,
+ ILLEGAL = 3
+};
+
+struct expand_split_map_struct
+{
+ icalrecurrencetype_frequency frequency;
+
+ /* Elements of the 'map' array correspond to the BYxxx rules:
+ Second,Minute,Hour,Day,Month Day,Year Day,Week No,Month,SetPos */
+
+ short map[NUM_BY_PARTS];
+};
+
+/**
+ * The split map indicates, for a particular interval, whether a BY_*
+ * rule part expands the number of instances in the occurrence set or
+ * contracts it. 1=> contract, 2=>expand, and 3 means the pairing is
+ * not allowed.
+ */
+
+static const struct expand_split_map_struct expand_map[] = {
+ /* M W YD MD D h m s P */
+ {ICAL_SECONDLY_RECURRENCE, { 1, 3, 1, 1, 1, 1, 1, 1, 1 }},
+ {ICAL_MINUTELY_RECURRENCE, { 1, 3, 1, 1, 1, 1, 1, 2, 1 }},
+ {ICAL_HOURLY_RECURRENCE, { 1, 3, 1, 1, 1, 1, 2, 2, 1 }},
+ {ICAL_DAILY_RECURRENCE, { 1, 3, 3, 1, 1, 2, 2, 2, 1 }},
+ {ICAL_WEEKLY_RECURRENCE, { 1, 3, 3, 3, 2, 2, 2, 2, 1 }},
+ {ICAL_MONTHLY_RECURRENCE, { 1, 3, 3, 2, 2, 2, 2, 2, 1 }},
+ {ICAL_YEARLY_RECURRENCE, { 2, 2, 2, 2, 2, 2, 2, 2, 1 }},
+ {ICAL_NO_RECURRENCE, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }} //krazy:exclude=style
+};
+
+static struct recur_map
+{
+ const char *str;
+ size_t offset;
+ int size;
+ int min;
+} recur_map[] = {
+ { "BYMONTH", offsetof(struct icalrecurrencetype, by_month),
+ ICAL_BY_MONTH_SIZE, 1 },
+ { "BYWEEKNO", offsetof(struct icalrecurrencetype, by_week_no),
+ ICAL_BY_WEEKNO_SIZE, -1 },
+ { "BYYEARDAY", offsetof(struct icalrecurrencetype, by_year_day),
+ ICAL_BY_YEARDAY_SIZE, -1 },
+ { "BYMONTHDAY", offsetof(struct icalrecurrencetype, by_month_day),
+ ICAL_BY_MONTHDAY_SIZE, -1 },
+ { "BYDAY", offsetof(struct icalrecurrencetype, by_day),
+ ICAL_BY_DAY_SIZE, 0 },
+ { "BYHOUR", offsetof(struct icalrecurrencetype, by_hour),
+ ICAL_BY_HOUR_SIZE, 0 },
+ { "BYMINUTE", offsetof(struct icalrecurrencetype, by_minute),
+ ICAL_BY_MINUTE_SIZE, 0 },
+ { "BYSECOND", offsetof(struct icalrecurrencetype, by_second),
+ ICAL_BY_SECOND_SIZE, 0 },
+ { "BYSETPOS", offsetof(struct icalrecurrencetype, by_set_pos),
+ ICAL_BY_SETPOS_SIZE, -1 },
+};
+
static const char *icalrecur_first_clause(struct icalrecur_parser *parser)
{
char *idx;
@@ -506,7 +585,7 @@ static int icalrecur_add_bydayrules(struct icalrecur_parser *parser,
icalrecurrencetype_weekday wd;
if (i == ICAL_BY_DAY_SIZE) {
- free(vals_copy);
+ icalmemory_free_buffer(vals_copy);
return -1;
}
@@ -537,15 +616,15 @@ static int icalrecur_add_bydayrules(struct icalrecur_parser *parser,
/* Sanity check value */
if (wd == ICAL_NO_WEEKDAY || weekno >= ICAL_BY_WEEKNO_SIZE) {
- free(vals_copy);
+ icalmemory_free_buffer(vals_copy);
return -1;
}
- array[i++] = (short)(sign * (wd + 8 * weekno));
+ array[i++] = icalrecurrencetype_encode_day(wd, sign * weekno);
array[i] = ICAL_RECURRENCE_ARRAY_MAX;
}
- free(vals_copy);
+ icalmemory_free_buffer(vals_copy);
sort_bydayrules(parser);
@@ -555,6 +634,7 @@ static int icalrecur_add_bydayrules(struct icalrecur_parser *parser,
struct icalrecurrencetype icalrecurrencetype_from_string(const char *str)
{
struct icalrecur_parser parser;
+ enum byrule byrule;
memset(&parser, 0, sizeof(parser));
icalrecurrencetype_clear(&parser.rt);
@@ -656,76 +736,22 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char *str)
sort_bydayrules(&parser);
}
}
- } else if (strcasecmp(name, "BYSECOND") == 0) {
- if (parser.rt.by_second[0] != ICAL_RECURRENCE_ARRAY_MAX) {
- /* Don't allow multiple BYSECONDs */
- r = -1;
- } else {
- r = icalrecur_add_byrules(&parser, parser.rt.by_second,
- 0, ICAL_BY_SECOND_SIZE, value);
- }
- } else if (strcasecmp(name, "BYMINUTE") == 0) {
- if (parser.rt.by_minute[0] != ICAL_RECURRENCE_ARRAY_MAX) {
- /* Don't allow multiple BYMINUTEs */
- r = -1;
- } else {
- r = icalrecur_add_byrules(&parser, parser.rt.by_minute,
- 0, ICAL_BY_MINUTE_SIZE, value);
- }
- } else if (strcasecmp(name, "BYHOUR") == 0) {
- if (parser.rt.by_hour[0] != ICAL_RECURRENCE_ARRAY_MAX) {
- /* Don't allow multiple BYHOURs */
- r = -1;
- } else {
- r = icalrecur_add_byrules(&parser, parser.rt.by_hour,
- 0, ICAL_BY_HOUR_SIZE, value);
- }
- } else if (strcasecmp(name, "BYDAY") == 0) {
- if (parser.rt.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
- /* Don't allow multiple BYDAYs */
- r = -1;
- } else {
- r = icalrecur_add_bydayrules(&parser, value);
- }
- } else if (strcasecmp(name, "BYMONTHDAY") == 0) {
- if (parser.rt.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
- /* Don't allow multiple BYMONTHDAYs */
- r = -1;
- } else {
- r = icalrecur_add_byrules(&parser, parser.rt.by_month_day,
- -1, ICAL_BY_MONTHDAY_SIZE, value);
- }
- } else if (strcasecmp(name, "BYYEARDAY") == 0) {
- if (parser.rt.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
- /* Don't allow multiple BYYEARDAYs */
- r = -1;
- } else {
- r = icalrecur_add_byrules(&parser, parser.rt.by_year_day,
- -1, ICAL_BY_YEARDAY_SIZE, value);
- }
- } else if (strcasecmp(name, "BYWEEKNO") == 0) {
- if (parser.rt.by_week_no[0] != ICAL_RECURRENCE_ARRAY_MAX) {
- /* Don't allow multiple BYWEEKNOs */
- r = -1;
- } else {
- r = icalrecur_add_byrules(&parser, parser.rt.by_week_no,
- -1, ICAL_BY_WEEKNO_SIZE, value);
- }
- } else if (strcasecmp(name, "BYMONTH") == 0) {
- if (parser.rt.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) {
- /* Don't allow multiple BYMONTHs */
- r = -1;
- } else {
- r = icalrecur_add_byrules(&parser, parser.rt.by_month,
- 1, ICAL_BY_MONTH_SIZE, value);
- }
- } else if (strcasecmp(name, "BYSETPOS") == 0) {
- if (parser.rt.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) {
- /* Don't allow multiple BYSETPOSs */
- r = -1;
- } else {
- r = icalrecur_add_byrules(&parser, parser.rt.by_set_pos,
- -1, ICAL_BY_SETPOS_SIZE, value);
+ } else if (strncasecmp(name, "BY", 2) == 0) {
+ r = -1;
+
+ for (byrule = 0; byrule < NUM_BY_PARTS; byrule++) {
+ if (strcasecmp(name+2, recur_map[byrule].str+2) == 0) {
+ if (byrule == BY_DAY) {
+ r = icalrecur_add_bydayrules(&parser, value);
+ } else {
+ short *array = (short *)(recur_map[byrule].offset + (size_t) &parser.rt);
+ r = icalrecur_add_byrules(&parser, array,
+ recur_map[byrule].min,
+ recur_map[byrule].size,
+ value);
+ }
+ break;
+ }
}
} else {
r = -1;
@@ -739,45 +765,39 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char *str)
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
}
if (parser.rt.rscale) {
- free(parser.rt.rscale);
+ icalmemory_free_buffer(parser.rt.rscale);
}
icalrecurrencetype_clear(&parser.rt);
break;
}
}
- free(parser.copy);
+ for (byrule = 0; byrule < NUM_BY_PARTS; byrule++) {
+ short *array = (short *)(recur_map[byrule].offset + (size_t) &parser.rt);
+
+ if (array[0] != ICAL_RECURRENCE_ARRAY_MAX &&
+ expand_map[parser.rt.freq].map[byrule] == ILLEGAL) {
+ ical_invalid_rrule_handling rruleHandlingSetting =
+ ical_get_invalid_rrule_handling_setting();
+
+ if (rruleHandlingSetting == ICAL_RRULE_TREAT_AS_ERROR) {
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ if (parser.rt.rscale) {
+ icalmemory_free_buffer(parser.rt.rscale);
+ }
+ icalrecurrencetype_clear(&parser.rt);
+ break;
+ } else {
+ array[0] = ICAL_RECURRENCE_ARRAY_MAX;
+ }
+ }
+ }
+
+ icalmemory_free_buffer(parser.copy);
return parser.rt;
}
-static struct recur_map
-{
- const char *str;
- size_t offset;
- int limit;
-} recur_map[] = {
- { ";BYSECOND=", offsetof(struct icalrecurrencetype, by_second),
- ICAL_BY_SECOND_SIZE - 1 },
- { ";BYMINUTE=", offsetof(struct icalrecurrencetype, by_minute),
- ICAL_BY_MINUTE_SIZE - 1 },
- { ";BYHOUR=", offsetof(struct icalrecurrencetype, by_hour),
- ICAL_BY_HOUR_SIZE - 1 },
- { ";BYDAY=", offsetof(struct icalrecurrencetype, by_day),
- ICAL_BY_DAY_SIZE - 1 },
- { ";BYMONTHDAY=", offsetof(struct icalrecurrencetype, by_month_day),
- ICAL_BY_MONTHDAY_SIZE - 1 },
- { ";BYYEARDAY=", offsetof(struct icalrecurrencetype, by_year_day),
- ICAL_BY_YEARDAY_SIZE - 1 },
- { ";BYWEEKNO=", offsetof(struct icalrecurrencetype, by_week_no),
- ICAL_BY_WEEKNO_SIZE - 1 },
- { ";BYMONTH=", offsetof(struct icalrecurrencetype, by_month),
- ICAL_BY_MONTH_SIZE - 1 },
- { ";BYSETPOS=", offsetof(struct icalrecurrencetype, by_set_pos),
- ICAL_BY_SETPOS_SIZE - 1 },
- { 0, 0, 0 }
-};
-
char *icalrecurrencetype_as_string(struct icalrecurrencetype *recur)
{
char *buf;
@@ -805,6 +825,13 @@ char *icalrecurrencetype_as_string_r(struct icalrecurrencetype *recur)
if (recur->rscale != 0) {
icalmemory_append_string(&str, &str_p, &buf_sz, "RSCALE=");
icalmemory_append_string(&str, &str_p, &buf_sz, recur->rscale);
+
+ /* Omit is the default, so no need to write that out */
+ if (recur->skip != ICAL_SKIP_OMIT) {
+ const char *skipstr = icalrecur_skip_to_string(recur->skip);
+ icalmemory_append_string(&str, &str_p, &buf_sz, ";SKIP=");
+ icalmemory_append_string(&str, &str_p, &buf_sz, skipstr);
+ }
icalmemory_append_char(&str, &str_p, &buf_sz, ';');
}
@@ -812,43 +839,35 @@ char *icalrecurrencetype_as_string_r(struct icalrecurrencetype *recur)
icalmemory_append_string(&str, &str_p, &buf_sz,
icalrecur_freq_to_string(recur->freq));
- if (recur->until.year != 0) {
-
- temp[0] = 0;
- if (recur->until.is_date) {
- print_date_to_string(temp, &(recur->until));
- } else {
- print_datetime_to_string(temp, &(recur->until));
- }
-
- icalmemory_append_string(&str, &str_p, &buf_sz, ";UNTIL=");
- icalmemory_append_string(&str, &str_p, &buf_sz, temp);
- }
-
- else if (recur->count != 0) {
- snprintf(temp, sizeof(temp), "%d", recur->count);
- icalmemory_append_string(&str, &str_p, &buf_sz, ";COUNT=");
- icalmemory_append_string(&str, &str_p, &buf_sz, temp);
- }
-
+ /* 1 is the default, so no need to write that out */
if (recur->interval != 1) {
snprintf(temp, sizeof(temp), "%d", recur->interval);
icalmemory_append_string(&str, &str_p, &buf_sz, ";INTERVAL=");
icalmemory_append_string(&str, &str_p, &buf_sz, temp);
}
- for (j = 0; recur_map[j].str != 0; j++) {
+ /* Monday is the default, so no need to write that out */
+ if (recur->week_start != ICAL_MONDAY_WEEKDAY &&
+ recur->week_start != ICAL_NO_WEEKDAY) {
+ int dow = icalrecurrencetype_day_day_of_week(recur->week_start);
+ const char *daystr = icalrecur_weekday_to_string(dow);
+ icalmemory_append_string(&str, &str_p, &buf_sz, ";WKST=");
+ icalmemory_append_string(&str, &str_p, &buf_sz, daystr);
+ }
+
+ for (j = 0; j < NUM_BY_PARTS; j++) {
short *array = (short *)(recur_map[j].offset + (size_t) recur);
- int limit = recur_map[j].limit;
+ int limit = recur_map[j].size - 1;
/* Skip unused arrays */
if (array[0] != ICAL_RECURRENCE_ARRAY_MAX) {
+ icalmemory_append_char(&str, &str_p, &buf_sz, ';');
icalmemory_append_string(&str, &str_p, &buf_sz, recur_map[j].str);
+ icalmemory_append_char(&str, &str_p, &buf_sz, '=');
- for (i = 0;
- i < limit && array[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) {
- if (j == 3) { /* BYDAY */
+ for (i = 0; i < limit && array[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) {
+ if (j == BY_DAY) {
int pos = icalrecurrencetype_day_position(array[i]);
int dow = icalrecurrencetype_day_day_of_week(array[i]);
const char *daystr = icalrecur_weekday_to_string(dow);
@@ -860,7 +879,7 @@ char *icalrecurrencetype_as_string_r(struct icalrecurrencetype *recur)
icalmemory_append_string(&str, &str_p, &buf_sz, temp);
}
- } else if (j == 7 /* BYMONTH */ &&
+ } else if (j == BY_MONTH &&
icalrecurrencetype_month_is_leap(array[i])) {
snprintf(temp, sizeof(temp), "%dL",
icalrecurrencetype_month_month(array[i]));
@@ -878,19 +897,22 @@ char *icalrecurrencetype_as_string_r(struct icalrecurrencetype *recur)
}
}
- /* Monday is the default, so no need to write that out */
- if (recur->week_start != ICAL_MONDAY_WEEKDAY &&
- recur->week_start != ICAL_NO_WEEKDAY) {
- int dow = icalrecurrencetype_day_day_of_week(recur->week_start);
- const char *daystr = icalrecur_weekday_to_string(dow);
- icalmemory_append_string(&str, &str_p, &buf_sz, ";WKST=");
- icalmemory_append_string(&str, &str_p, &buf_sz, daystr);
+ if (recur->until.year != 0) {
+ temp[0] = 0;
+ if (recur->until.is_date) {
+ print_date_to_string(temp, &(recur->until));
+ } else {
+ print_datetime_to_string(temp, &(recur->until));
+ }
+
+ icalmemory_append_string(&str, &str_p, &buf_sz, ";UNTIL=");
+ icalmemory_append_string(&str, &str_p, &buf_sz, temp);
}
- if (recur->rscale != 0 && recur->skip != ICAL_SKIP_OMIT) {
- const char *skipstr = icalrecur_skip_to_string(recur->skip);
- icalmemory_append_string(&str, &str_p, &buf_sz, ";SKIP=");
- icalmemory_append_string(&str, &str_p, &buf_sz, skipstr);
+ else if (recur->count != 0) {
+ snprintf(temp, sizeof(temp), "%d", recur->count);
+ icalmemory_append_string(&str, &str_p, &buf_sz, ";COUNT=");
+ icalmemory_append_string(&str, &str_p, &buf_sz, temp);
}
return str;
@@ -898,20 +920,6 @@ char *icalrecurrencetype_as_string_r(struct icalrecurrencetype *recur)
/************************* occurrence iteration routines ******************/
-enum byrule
-{
- NO_CONTRACTION = -1,
- BY_SECOND = 0,
- BY_MINUTE = 1,
- BY_HOUR = 2,
- BY_DAY = 3,
- BY_MONTH_DAY = 4,
- BY_YEAR_DAY = 5,
- BY_WEEK_NO = 6,
- BY_MONTH = 7,
- BY_SET_POS
-};
-
/* Number of bits in an unsigned long */
#define BITS_PER_LONG (8 * sizeof(unsigned long))
@@ -928,6 +936,7 @@ struct icalrecur_iterator_impl
struct icaltimetype rstart; /* DTSTART in RSCALE */
struct icaltimetype istart; /* Gregorian start time for iterator */
+ struct icaltimetype iend; /* Gregorian end time for iterator */
struct icaltimetype last; /* last time returned from iterator */
int occurrence_no; /* number of steps made on the iterator */
@@ -954,10 +963,10 @@ struct icalrecur_iterator_impl
short days_index;
enum byrule byrule;
- short by_indices[9];
- short orig_data[9]; /**< 1 if there was data in the byrule */
+ short by_indices[NUM_BY_PARTS];
+ short orig_data[NUM_BY_PARTS]; /**< 1 if there was data in the byrule */
- short *by_ptrs[9]; /**< Pointers into the by_* array elements of the rule */
+ short *by_ptrs[NUM_BY_PARTS]; /**< Pointers into the by_* array elements of the rule */
};
@@ -994,43 +1003,6 @@ int icalrecur_iterator_sizeof_byarray(short *byarray)
return array_itr;
}
-enum expand_table
-{
- UNKNOWN = 0,
- CONTRACT = 1,
- EXPAND = 2,
- ILLEGAL = 3
-};
-
-/**
- * The split map indicates, for a particular interval, whether a BY_*
- * rule part expands the number of instances in the occurrence set or
- * contracts it. 1=> contract, 2=>expand, and 3 means the pairing is
- * not allowed.
- */
-
-struct expand_split_map_struct
-{
- icalrecurrencetype_frequency frequency;
-
- /* Elements of the 'map' array correspond to the BYxxx rules:
- Second,Minute,Hour,Day,Month Day,Year Day,Week No,Month,SetPos */
-
- short map[BY_SET_POS+1];
-};
-
-static const struct expand_split_map_struct expand_map[] = {
- /* s m h D MD YD W M P */
- {ICAL_SECONDLY_RECURRENCE, { 1, 1, 1, 1, 1, 1, 3, 1, 1 }},
- {ICAL_MINUTELY_RECURRENCE, { 2, 1, 1, 1, 1, 1, 3, 1, 1 }},
- {ICAL_HOURLY_RECURRENCE, { 2, 2, 1, 1, 1, 1, 3, 1, 1 }},
- {ICAL_DAILY_RECURRENCE, { 2, 2, 2, 1, 1, 3, 3, 1, 1 }},
- {ICAL_WEEKLY_RECURRENCE, { 2, 2, 2, 2, 3, 3, 3, 1, 1 }},
- {ICAL_MONTHLY_RECURRENCE, { 2, 2, 2, 2, 2, 3, 3, 1, 1 }},
- {ICAL_YEARLY_RECURRENCE, { 2, 2, 2, 2, 2, 2, 2, 2, 1 }},
- {ICAL_NO_RECURRENCE, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }} //krazy:exclude=style
-};
-
static int has_by_data(icalrecur_iterator *impl, enum byrule byrule)
{
return (impl->orig_data[byrule] == 1);
@@ -1679,7 +1651,7 @@ static void reset_period_start(icalrecur_iterator *impl)
icalarray *icalrecurrencetype_rscale_supported_calendars(void)
{
icalarray *calendars = icalarray_new(sizeof(const char **), 1);
- const char *cal = "gregorian";
+ const char *cal = "GREGORIAN";
icalarray_append(calendars, &cal);
@@ -1841,6 +1813,11 @@ static void __increment_month(icalrecur_iterator *impl, int inc)
impl->last.month = impl->last.month % 12;
+ if (impl->last.month < 0) {
+ impl->last.month = impl->last.month + 12;
+ years--;
+ }
+
impl->last.month++;
if (years != 0) {
@@ -1917,11 +1894,13 @@ static void reset_period_start(icalrecur_iterator *impl)
#endif /* HAVE_LIBICU */
static int __iterator_set_start(icalrecur_iterator *impl, icaltimetype start);
-static void increment_month(icalrecur_iterator *impl);
+static void increment_month(icalrecur_iterator *impl, int inc);
static int expand_month_days(icalrecur_iterator *impl, int year, int month);
static int expand_year_days(icalrecur_iterator *impl, int year);
static int next_yearday(icalrecur_iterator *impl,
- void (*next_period)(icalrecur_iterator *));
+ void (*next_period)(icalrecur_iterator *, int));
+static int prev_yearday(icalrecur_iterator *impl,
+ void (*next_period)(icalrecur_iterator *, int));
static void adjust_to_byday(icalrecur_iterator *impl)
{
@@ -1978,7 +1957,7 @@ icalrecur_iterator *icalrecur_iterator_new(struct icalrecurrencetype rule,
return 0;
}
- if (!(impl = (icalrecur_iterator *)malloc(sizeof(icalrecur_iterator)))) {
+ if (!(impl = (icalrecur_iterator *)icalmemory_new_buffer(sizeof(icalrecur_iterator)))) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
@@ -1987,6 +1966,7 @@ icalrecur_iterator *icalrecur_iterator_new(struct icalrecurrencetype rule,
impl->dtstart = dtstart;
impl->rule = rule;
+ impl->iend = icaltime_null_time();
/* Set up convenience pointers to make the code simpler. Allows
us to iterate through all of the BY* arrays in the rule. */
@@ -2001,7 +1981,7 @@ icalrecur_iterator *icalrecur_iterator_new(struct icalrecurrencetype rule,
impl->by_ptrs[BY_SECOND] = impl->rule.by_second;
impl->by_ptrs[BY_SET_POS] = impl->rule.by_set_pos;
- memset(impl->orig_data, 0, 9 * sizeof(short));
+ memset(impl->orig_data, 0, NUM_BY_PARTS * sizeof(short));
/* Note which by rules had data in them when the iterator was
created. We can't use the actual by_x arrays, because the
@@ -2029,12 +2009,18 @@ icalrecur_iterator *icalrecur_iterator_new(struct icalrecurrencetype rule,
/* Check if the recurrence rule is legal */
- for (byrule = BY_SECOND; byrule <= BY_SET_POS; byrule++) {
+ for (byrule = 0; byrule < NUM_BY_PARTS; byrule++) {
if (expand_map[freq].map[byrule] == ILLEGAL &&
- impl->by_ptrs[byrule][0] != ICAL_RECURRENCE_ARRAY_MAX) {
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- free(impl);
- return 0;
+ has_by_data(impl, byrule)) {
+ ical_invalid_rrule_handling rruleHandlingSetting =
+ ical_get_invalid_rrule_handling_setting();
+ if (rruleHandlingSetting == ICAL_RRULE_IGNORE_INVALID) {
+ impl->orig_data[byrule] = 0;
+ } else {
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ icalmemory_free_buffer(impl);
+ return 0;
+ }
}
}
@@ -2076,7 +2062,7 @@ void icalrecur_iterator_free(icalrecur_iterator *i)
}
#endif
- free(i);
+ icalmemory_free_buffer(i);
}
/** Calculate the number of days between 2 dates */
@@ -2120,10 +2106,8 @@ static int __day_diff(icalrecur_iterator *impl, icaltimetype a, icaltimetype b)
/** increment_month is different than the other increment_* routines --
it figures out the interval for itself, and uses BYMONTH data if
available. */
-static void increment_month(icalrecur_iterator *impl)
+static void increment_month(icalrecur_iterator *impl, int inc)
{
- int inc = impl->rule.interval;
-
__increment_month(impl, inc);
if (has_by_data(impl, BY_MONTH)) {
@@ -2188,7 +2172,7 @@ static int next_unit(icalrecur_iterator *impl,
int end_of_data = 0;
- assert(has_by_unit || this_frequency);
+ icalassert(has_by_unit || this_frequency);
if (next_sub_unit && next_sub_unit(impl) == 0) {
return 0;
@@ -2247,6 +2231,78 @@ static int next_day(icalrecur_iterator *impl)
NULL, &increment_monthday, NULL);
}
+static int prev_unit(icalrecur_iterator *impl,
+ int by_unit, icalrecurrencetype_frequency frequency,
+ int (*prev_sub_unit)(icalrecur_iterator *),
+ void (*set_unit)(icalrecur_iterator *, int),
+ void (*increment_unit)(icalrecur_iterator *, int),
+ void (*increment_super_unit)(icalrecur_iterator *, int))
+{
+ int has_by_unit = (by_unit > NO_CONTRACTION) &&
+ (impl->by_ptrs[by_unit][0] != ICAL_RECURRENCE_ARRAY_MAX);
+ int this_frequency = (impl->rule.freq == frequency);
+
+ int end_of_data = 0;
+
+ icalassert(has_by_unit || this_frequency);
+
+ if (prev_sub_unit && prev_sub_unit(impl) == 0) {
+ return 0;
+ }
+
+ if (has_by_unit) {
+ /* Ignore the frequency and use the byrule data */
+
+ impl->by_indices[by_unit]--;
+
+ if (impl->by_indices[by_unit] < 0) {
+ impl->by_indices[by_unit] =
+ icalrecur_iterator_sizeof_byarray(impl->by_ptrs[by_unit]) - 1;
+
+ end_of_data = 1;
+ }
+
+ set_unit(impl, impl->by_ptrs[by_unit][impl->by_indices[by_unit]]);
+
+ } else if (!has_by_unit && this_frequency) {
+ /* Compute the next value from the last time and the freq interval */
+ increment_unit(impl, -impl->rule.interval);
+ }
+
+ /* If we have gone through all of the units on the BY list, then we
+ need to move to the next larger unit */
+
+ if (has_by_unit && end_of_data && this_frequency) {
+ increment_super_unit(impl, -1);
+ }
+
+ return end_of_data;
+}
+
+static int prev_second(icalrecur_iterator *impl)
+{
+ return prev_unit(impl, BY_SECOND, ICAL_SECONDLY_RECURRENCE, NULL,
+ &set_second, &increment_second, &increment_minute);
+}
+
+static int prev_minute(icalrecur_iterator *impl)
+{
+ return prev_unit(impl, BY_MINUTE, ICAL_MINUTELY_RECURRENCE, &prev_second,
+ &set_minute, &increment_minute, &increment_hour);
+}
+
+static int prev_hour(icalrecur_iterator *impl)
+{
+ return prev_unit(impl, BY_HOUR, ICAL_HOURLY_RECURRENCE, &prev_minute,
+ &set_hour, &increment_hour, &increment_monthday);
+}
+
+static int prev_day(icalrecur_iterator *impl)
+{
+ return prev_unit(impl, NO_CONTRACTION, ICAL_DAILY_RECURRENCE, &prev_hour,
+ NULL, &increment_monthday, NULL);
+}
+
static int check_set_position(icalrecur_iterator *impl, int set_pos)
{
int i;
@@ -2493,12 +2549,12 @@ static int expand_month_days(icalrecur_iterator *impl, int year, int month)
return 0;
}
-static void __next_month(icalrecur_iterator *impl)
+static void __next_month(icalrecur_iterator *impl, int inc)
{
struct icaltimetype this;
/* Increment to and expand the next month */
- increment_month(impl);
+ increment_month(impl, inc);
this = occurrence_as_icaltime(impl, 0);
expand_month_days(impl, this.year, this.month);
}
@@ -2508,6 +2564,11 @@ static int next_month(icalrecur_iterator *impl)
return next_yearday(impl, &__next_month);
}
+static int prev_month(icalrecur_iterator *impl)
+{
+ return prev_yearday(impl, &__next_month);
+}
+
static int next_weekday_by_week(icalrecur_iterator *impl)
{
int end_of_data = 0;
@@ -2577,7 +2638,70 @@ static int next_week(icalrecur_iterator *impl)
return end_of_data;
}
-/** For INTERVAL=YEARLY, set up the year days bitmask in the iterator to
+static int prev_weekday_by_week(icalrecur_iterator *impl)
+{
+ int end_of_data = 0;
+ int start_of_week, dow;
+
+ if (prev_hour(impl) == 0) {
+ return 0;
+ }
+
+ if (!has_by_data(impl, BY_DAY)) {
+ return 1;
+ }
+
+ /* If we get here, we need to step to the previous day */
+
+ BYDAYIDX--; /* Look at previous elem in BYDAY array */
+
+ /* Are we at the end of the BYDAY array? */
+ if (BYDAYIDX < 0) {
+ BYDAYIDX = icalrecur_iterator_sizeof_byarray(impl->by_ptrs[BY_DAY]) - 1;
+ end_of_data = 1; /* Signal that we're at the end */
+ }
+
+ /* Add the day of week offset to the start of this week, and use
+ that to get the next day */
+ /* ignore position of dow ("4FR"), only use dow ("FR") */
+ dow = icalrecurrencetype_day_day_of_week(BYDAYPTR[BYDAYIDX]);
+ dow -= impl->rule.week_start; /* Set Sunday to be 0 */
+ if (dow < 0) {
+ dow += 7;
+ }
+
+ start_of_week = get_start_of_week(impl);
+
+ if (dow + start_of_week < 1) {
+ /* The selected date is in the previous year. */
+ increment_year(impl, -1);
+ }
+
+ set_day_of_year(impl, start_of_week + dow);
+
+ return end_of_data;
+}
+
+static int prev_week(icalrecur_iterator *impl)
+{
+ int end_of_data = 0;
+
+ /* Decrement to the previous week day,
+ if there is data at a level less than a week */
+ if (prev_weekday_by_week(impl) == 0) {
+ return 0; /* Have not reached start of week yet */
+ }
+
+ /* If we get here, we have decremented through the entire week, and
+ can decrement to the previous week */
+
+ /* Jump to the previous week */
+ increment_monthday(impl, 7 * -impl->rule.interval);
+
+ return end_of_data;
+}
+
+/* For INTERVAL=YEARLY, set up the year days bitmask in the iterator to
list all of the days of the current year that are specified in this
rule. */
static int expand_year_days(icalrecur_iterator *impl, int year)
@@ -2758,12 +2882,12 @@ static int expand_year_days(icalrecur_iterator *impl, int year)
return 0;
}
-static void __next_year(icalrecur_iterator *impl)
+static void __next_year(icalrecur_iterator *impl, int inc)
{
struct icaltimetype this;
/* Increment to and expand the next year */
- increment_year(impl, impl->rule.interval);
+ increment_year(impl, inc);
this = occurrence_as_icaltime(impl, 0);
expand_year_days(impl, this.year);
}
@@ -2773,6 +2897,11 @@ static int next_year(icalrecur_iterator *impl)
return next_yearday(impl, &__next_year);
}
+static int prev_year(icalrecur_iterator *impl)
+{
+ return prev_yearday(impl, &__next_year);
+}
+
static short daymask_find_next_bit(icalrecur_iterator *impl)
{
unsigned long *days = impl->days;
@@ -2829,8 +2958,64 @@ static short daymask_find_next_bit(icalrecur_iterator *impl)
return days_index;
}
+static short daymask_find_prev_bit(icalrecur_iterator *impl)
+{
+ unsigned long *days = impl->days;
+ short days_index = impl->days_index - 1;
+ unsigned long v;
+ short startBitIndex;
+ int wordIdx;
+
+ if (days_index <= -ICAL_YEARDAYS_MASK_OFFSET)
+ return -ICAL_YEARDAYS_MASK_OFFSET;
+
+ // Prepare the first word, where searching might not start at the beginning
+ startBitIndex = days_index + ICAL_YEARDAYS_MASK_OFFSET;
+ wordIdx = (int)(startBitIndex / BITS_PER_LONG);
+ v = days[wordIdx];
+ v <<= BITS_PER_LONG - (startBitIndex % BITS_PER_LONG) - 1;
+
+ if (!v) {
+ // so the first word didn't contain any bits of interest.
+ days_index -= (startBitIndex % BITS_PER_LONG) +1;
+
+ // Are there more empty words leading? Skip them.
+ while (days_index > -ICAL_YEARDAYS_MASK_OFFSET) {
+ wordIdx--;
+ v = days[wordIdx];
+
+ if (v)
+ break;
+
+ days_index -= BITS_PER_LONG;
+ }
+ }
+
+ if (v) {
+
+ // We found a word containing the next bit but don't know the exact
+ // position yet. Do a b-search to find it.
+
+ unsigned long mask;
+ int maskSize = (int)(BITS_PER_LONG / 2);
+ mask = ((((unsigned long)1) << maskSize) - 1) << maskSize;
+
+ while (maskSize) {
+
+ if ((v & mask) == 0) {
+ v <<= maskSize;
+ days_index -= maskSize;
+ }
+ maskSize /= 2;
+ mask <<= maskSize;
+ }
+ }
+
+ return days_index;
+}
+
static int next_yearday(icalrecur_iterator *impl,
- void (*next_period)(icalrecur_iterator *))
+ void (*next_period)(icalrecur_iterator *, int))
{
if (next_hour(impl) == 0) {
return 0;
@@ -2847,7 +3032,7 @@ static int next_yearday(icalrecur_iterator *impl,
for (;;) {
/* Increment to and expand the next period */
- next_period(impl);
+ next_period(impl, impl->rule.interval);
if (impl->days_index < ICAL_YEARDAYS_MASK_SIZE) {
break; /* break when a matching day is found */
@@ -2865,6 +3050,38 @@ static int next_yearday(icalrecur_iterator *impl,
return 1;
}
+static int prev_yearday(icalrecur_iterator *impl,
+ void (*next_period)(icalrecur_iterator *, int))
+{
+ if (prev_hour(impl) == 0) {
+ return 0;
+ }
+
+ /* We may have skipped fwd/bwd a month/year with previous occurrence.
+ Reset the period start date so we can decrement properly */
+ reset_period_start(impl);
+
+ /* Find previous year day that is set */
+ impl->days_index = daymask_find_prev_bit(impl);
+
+ while (impl->days_index <= -ICAL_YEARDAYS_MASK_OFFSET) {
+ /* Decrement to and expand the previous period */
+ next_period(impl, -impl->rule.interval);
+
+ impl->days_index = ICAL_YEARDAYS_MASK_SIZE;
+ impl->days_index = daymask_find_prev_bit(impl);
+ }
+
+ if (impl->days_index < 1) {
+ /* Day is in previous year */
+ increment_year(impl, -1);
+ }
+
+ set_day_of_year(impl, impl->days_index);
+
+ return 1;
+}
+
int icalrecur_check_rulepart(icalrecur_iterator *impl,
int v, enum byrule byrule)
{
@@ -2988,14 +3205,13 @@ struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *impl)
impl->last = occurrence_as_icaltime(impl, 1);
- /* Ignore times that are after the MAX year or the UNTIL time */
+ /* Ignore times that are after the MAX year,
+ or the UNTIL time, or the end time */
if (impl->last.year > MAX_TIME_T_YEAR ||
(!icaltime_is_null_time(impl->rule.until) &&
- icaltime_compare(impl->last, impl->rule.until) > 0)) {
- return icaltime_null_time();
- }
- if (impl->last.year > MAX_TIME_T_YEAR) {
- /* HACK */
+ icaltime_compare(impl->last, impl->rule.until) > 0) ||
+ (!icaltime_is_null_time(impl->iend) &&
+ icaltime_compare(impl->last, impl->iend) >= 0)) {
return icaltime_null_time();
}
@@ -3007,6 +3223,83 @@ struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *impl)
return impl->last;
}
+struct icaltimetype icalrecur_iterator_prev(icalrecur_iterator *impl)
+{
+ /* Quit if last time is before the DTSTART time */
+ if (!impl || icaltime_compare(impl->last, impl->dtstart) < 0) {
+ return icaltime_null_time();
+ }
+
+#if 0 // Mostly for testing -- users probably don't want/expect this
+ /* If last time is valid, return it */
+ if (impl->rule.count != 0 && impl->occurrence_no == impl->rule.count &&
+ (icaltime_is_null_time(impl->iend) ||
+ icaltime_compare(impl->last, impl->iend) <= 0) &&
+ check_contracting_rules(impl)) {
+
+ impl->occurrence_no--;
+ return impl->last;
+ }
+#endif
+
+ /* Iterate until we get the next valid time */
+ do {
+ switch (impl->rule.freq) {
+
+ case ICAL_SECONDLY_RECURRENCE:
+ prev_second(impl);
+ break;
+
+ case ICAL_MINUTELY_RECURRENCE:
+ prev_minute(impl);
+ break;
+
+ case ICAL_HOURLY_RECURRENCE:
+ prev_hour(impl);
+ break;
+
+ case ICAL_DAILY_RECURRENCE:
+ prev_day(impl);
+ break;
+
+ case ICAL_WEEKLY_RECURRENCE:
+ prev_week(impl);
+ break;
+
+ case ICAL_MONTHLY_RECURRENCE:
+ prev_month(impl);
+ break;
+
+ case ICAL_YEARLY_RECURRENCE:
+ prev_year(impl);
+ break;
+
+ default:
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return icaltime_null_time();
+ }
+
+ impl->last = occurrence_as_icaltime(impl, 1);
+
+ /* Ignore times that are before the DTSTART time */
+ if (icaltime_compare(impl->last, impl->dtstart) < 0 ||
+ (!icaltime_is_null_time(impl->istart) &&
+ icaltime_compare(impl->last, impl->istart) < 0)) {
+ return icaltime_null_time();
+ }
+
+ } while (impl->last.year > MAX_TIME_T_YEAR ||
+ (!icaltime_is_null_time(impl->rule.until) &&
+ icaltime_compare(impl->last, impl->rule.until) > 0) ||
+ (!icaltime_is_null_time(impl->iend) &&
+ icaltime_compare(impl->last, impl->iend) > 0) ||
+ !check_contracting_rules(impl));
+
+ impl->occurrence_no--;
+
+ return impl->last;
+}
+
static int __iterator_set_start(icalrecur_iterator *impl, icaltimetype start)
{
icalrecurrencetype_frequency freq = impl->rule.freq;
@@ -3078,7 +3371,7 @@ static int __iterator_set_start(icalrecur_iterator *impl, icaltimetype start)
if (impl->days_index < ICAL_YEARDAYS_MASK_SIZE) {
break; /* break when a matching day is found */
}
- increment_month(impl);
+ increment_month(impl, impl->rule.interval);
start = occurrence_as_icaltime(impl, 0);
}
@@ -3191,6 +3484,74 @@ int icalrecur_iterator_set_start(icalrecur_iterator *impl,
return __iterator_set_start(impl, start);
}
+int icalrecur_iterator_set_end(icalrecur_iterator *impl,
+ struct icaltimetype end)
+{
+ /* Convert end to same time zone as DTSTART */
+ end = icaltime_convert_to_zone(end, (icaltimezone *)impl->dtstart.zone);
+
+ impl->iend = end;
+
+ return 1;
+}
+
+int icalrecur_iterator_set_range(icalrecur_iterator *impl,
+ struct icaltimetype from,
+ struct icaltimetype to)
+{
+ if (impl->rule.count > 0 || icaltime_is_null_time(from)) {
+ /* Can't set a range without 'from' or if we need to count occurrences */
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+
+ if (!icaltime_is_null_time(to) && icaltime_compare(to, from) < 0) {
+ /* Setting up for the reverse iterator */
+ const icaltimezone *zone = impl->dtstart.zone;
+
+ /* Convert 'from' to same time zone as DTSTART */
+ from = icaltime_convert_to_zone(from, (icaltimezone *) zone);
+
+ if (icaltime_compare(from, impl->rule.until) > 0) {
+ /* If 'from' is after UNTIL, use UNTIL */
+ from = impl->rule.until;
+ } else if (icaltime_compare(from, impl->dtstart) < 0) {
+ /* If 'from' is before START, we're done */
+ impl->last = from;
+ return 1;
+ }
+
+ if (!__iterator_set_start(impl, from))
+ return 0;
+
+ /* __iterator_set_start() may back us up earlier than 'from'
+ Iterate forward until we are later than 'from'.
+ */
+ while (icaltime_compare(impl->last, from) < 0) {
+ (void)icalrecur_iterator_next(impl);
+ }
+
+ /* Convert 'to' to same time zone as DTSTART */
+ to = icaltime_convert_to_zone(to, (icaltimezone *) zone);
+
+ if (icaltime_compare(to, impl->dtstart) < 0) {
+ /* If 'to' is before DTSTART, use DTSTART */
+ to = impl->dtstart;
+ }
+
+ impl->istart = to;
+ impl->iend = from;
+ impl->days_index = 0;
+ } else {
+ if (!icalrecur_iterator_set_start(impl, from))
+ return 0;
+
+ icalrecur_iterator_set_end(impl, to);
+ }
+
+ return 1;
+}
+
/************************** Type Routines **********************/
void icalrecurrencetype_clear(struct icalrecurrencetype *recur)
@@ -3223,13 +3584,10 @@ int icalrecurrencetype_day_position(short day)
return pos;
}
-/*
- * The 'month' element of the by_month array is encoded to allow
- * representation of the "L" leap suffix (RFC 7529).
- * These routines decode the month values.
- *
- * The "L" suffix is encoded by setting a high-order bit.
- */
+short icalrecurrencetype_encode_day(enum icalrecurrencetype_weekday weekday, int position)
+{
+ return (weekday + (8 * abs(position))) * ((position < 0) ? -1 : 1);
+}
int icalrecurrencetype_month_is_leap(short month)
{
@@ -3241,16 +3599,21 @@ int icalrecurrencetype_month_month(short month)
return (month & ~LEAP_MONTH);
}
+short icalrecurrencetype_encode_month(int month, int is_leap)
+{
+ return month | (is_leap ? LEAP_MONTH : 0);
+}
+
int icalrecur_expand_recurrence(const char *rule,
- time_t start, int count, time_t *array)
+ icaltime_t start, int count, icaltime_t *array)
{
struct icalrecurrencetype recur;
icalrecur_iterator *ritr;
- time_t tt;
+ icaltime_t tt;
struct icaltimetype icstart, next;
int i = 0;
- memset(array, 0, count * sizeof(time_t));
+ memset(array, 0, count * sizeof(icaltime_t));
icstart = icaltime_from_timet_with_zone(start, 0, 0);
@@ -3270,7 +3633,37 @@ int icalrecur_expand_recurrence(const char *rule,
icalrecur_iterator_free(ritr);
}
if(recur.rscale)
- free(recur.rscale);
+ icalmemory_free_buffer(recur.rscale);
return 1;
}
+
+ical_invalid_rrule_handling ical_get_invalid_rrule_handling_setting(void)
+{
+ ical_invalid_rrule_handling myHandling;
+
+#if defined(HAVE_PTHREAD)
+ pthread_mutex_lock(&invalid_rrule_mutex);
+#endif
+
+ myHandling = invalidRruleHandling;
+
+#if defined(HAVE_PTHREAD)
+ pthread_mutex_unlock(&invalid_rrule_mutex);
+#endif
+
+ return myHandling;
+}
+
+void ical_set_invalid_rrule_handling_setting(ical_invalid_rrule_handling newSetting)
+{
+#if defined(HAVE_PTHREAD)
+ pthread_mutex_lock(&invalid_rrule_mutex);
+#endif
+
+ invalidRruleHandling = newSetting;
+
+#if defined(HAVE_PTHREAD)
+ pthread_mutex_unlock(&invalid_rrule_mutex);
+#endif
+}
diff --git a/src/libical/icalrecur.h b/src/libical/icalrecur.h
index 2ae9c02d..b541362f 100644
--- a/src/libical/icalrecur.h
+++ b/src/libical/icalrecur.h
@@ -2,18 +2,10 @@
FILE: icalrecur.h
CREATOR: eric 20 March 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
========================================================================*/
/**
@@ -241,6 +233,8 @@ LIBICAL_ICAL_EXPORT void icalrecurrencetype_clear(struct icalrecurrencetype *r);
*
* The day's position in the period ( Nth-ness) and the numerical
* value of the day are encoded together as: pos*7 + dow.
+ *
+ * A position of 0 means 'any' or 'every'.
*/
LIBICAL_ICAL_EXPORT enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day);
@@ -252,14 +246,36 @@ LIBICAL_ICAL_EXPORT enum icalrecurrencetype_weekday icalrecurrencetype_day_day_o
*/
LIBICAL_ICAL_EXPORT int icalrecurrencetype_day_position(short day);
+/** Encodes the @p weekday and @p position into a form, which can be stored
+ * to icalrecurrencetype::by_day array. Use icalrecurrencetype_day_day_of_week()
+ * and icalrecurrencetype_day_position() to split the encoded value back into the parts.
+ * @since 3.1
+ */
+LIBICAL_ICAL_EXPORT short icalrecurrencetype_encode_day(enum icalrecurrencetype_weekday weekday,
+ int position);
+
/*
* Routines to decode the 'month' element of the by_month array
*/
+/**
+ * The @p month element of the by_month array is encoded to allow
+ * representation of the "L" leap suffix (RFC 7529).
+ * These routines decode the month values.
+ *
+ * The "L" suffix is encoded by setting a high-order bit.
+ */
LIBICAL_ICAL_EXPORT int icalrecurrencetype_month_is_leap(short month);
LIBICAL_ICAL_EXPORT int icalrecurrencetype_month_month(short month);
+/** Encodes the @p month and the @p is_leap into a form, which can be stored
+ * to icalrecurrencetype::by_month array. Use icalrecurrencetype_month_is_leap()
+ * and icalrecurrencetype_month_month() to split the encoded value back into the parts
+ * @since 3.1
+ */
+LIBICAL_ICAL_EXPORT short icalrecurrencetype_encode_month(int month, int is_leap);
+
/*
* Recurrence rule parser
*/
@@ -291,23 +307,72 @@ LIBICAL_ICAL_EXPORT icalrecur_iterator *icalrecur_iterator_new(struct icalrecurr
LIBICAL_ICAL_EXPORT int icalrecur_iterator_set_start(icalrecur_iterator *impl,
struct icaltimetype start);
-/** Gets the next occurrence from an iterator. */
+/** Set the date-time at which the iterator will stop at the latest.
+ * Values equal to or greater than end will not be returned by the iterator.
+*/
+LIBICAL_ICAL_EXPORT int icalrecur_iterator_set_end(icalrecur_iterator *impl,
+ struct icaltimetype end);
+
+/**
+ * Sets the date-times over which the iterator will run,
+ * where @p from is a value between DTSTART and UNTIL.
+ *
+ * If @p to is null time, the forward iterator will return values
+ * up to and including UNTIL (if present), otherwise up to the year 2582.
+ *
+ * if @p to is non-null time and later than @p from,
+ * the forward iterator will return values up to and including 'to'.
+ *
+ * If @p to is non-null time and earlier than @p from,
+ * the reverse iterator will be set to start at @p from
+ * and will return values down to and including @p to.
+ *
+ * NOTE: CAN NOT be used with RRULEs that contain COUNT.
+ * @since 3.1
+ */
+LIBICAL_ICAL_EXPORT int icalrecur_iterator_set_range(icalrecur_iterator *impl,
+ struct icaltimetype from,
+ struct icaltimetype to);
+
+/**
+ * Gets the next occurrence from an iterator.
+ */
LIBICAL_ICAL_EXPORT struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *);
+/**
+ * Gets the previous occurrence from an iterator.
+ * @since 3.1
+ */
+LIBICAL_ICAL_EXPORT struct icaltimetype icalrecur_iterator_prev(icalrecur_iterator *);
+
/** Frees the iterator. */
LIBICAL_ICAL_EXPORT void icalrecur_iterator_free(icalrecur_iterator *);
/** @brief Fills an array with the 'count' number of occurrences generated by
* the rrule.
*
- * Specifically, this fills @p array up with at most 'count' time_t values, each
+ * Specifically, this fills @p array up with at most 'count' icaltime_t values, each
* representing an occurrence time in seconds past the POSIX epoch.
*
* Note that the times are returned in UTC, but the times
* are calculated in local time. You will have to convert the results
* back into local time before using them.
*/
-LIBICAL_ICAL_EXPORT int icalrecur_expand_recurrence(const char *rule, time_t start,
- int count, time_t *array);
+LIBICAL_ICAL_EXPORT int icalrecur_expand_recurrence(const char *rule, icaltime_t start,
+ int count, icaltime_t *array);
+
+/* ical_invalid_rrule_handling :
+ * How should the ICAL library handle RRULEs with invalid BYxxx part combos?
+ */
+typedef enum ical_invalid_rrule_handling
+{
+ ICAL_RRULE_TREAT_AS_ERROR = 0,
+ ICAL_RRULE_IGNORE_INVALID = 1
+} ical_invalid_rrule_handling;
+
+LIBICAL_ICAL_EXPORT ical_invalid_rrule_handling ical_get_invalid_rrule_handling_setting(void);
+
+LIBICAL_ICAL_EXPORT void ical_set_invalid_rrule_handling_setting(
+ ical_invalid_rrule_handling newSetting);
-#endif
+#endif /* ICALRECUR_H */
diff --git a/src/libical/icalrestriction.c.in b/src/libical/icalrestriction.c.in
index f5fd77cc..d1758d3b 100644
--- a/src/libical/icalrestriction.c.in
+++ b/src/libical/icalrestriction.c.in
@@ -1,18 +1,10 @@
/*======================================================================
File: icalrestriction.c
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
/*#line 7 "icalrestriction.c.in"*/
@@ -28,34 +20,29 @@
/* Define the structs for the restrictions. these data are filled out
in machine generated code below */
-struct icalrestriction_property_record;
+struct icalrestriction_record;
-typedef const char *(*restriction_func) (const struct icalrestriction_property_record * rec,
+typedef const char *(*restriction_func) (const struct icalrestriction_record * rec,
icalcomponent *comp, icalproperty *prop);
-typedef struct icalrestriction_property_record
+typedef struct icalrestriction_record
{
icalproperty_method method;
icalcomponent_kind component;
icalproperty_kind property;
- icalrestriction_kind restriction;
- restriction_func function;
-} icalrestriction_property_record;
-
-typedef struct icalrestriction_component_record
-{
- icalproperty_method method;
- icalcomponent_kind component;
icalcomponent_kind subcomponent;
icalrestriction_kind restriction;
restriction_func function;
-} icalrestriction_component_record;
+} icalrestriction_record;
-static const icalrestriction_property_record *icalrestriction_get_property_restriction(
- icalproperty_method method, icalcomponent_kind component, icalproperty_kind property);
+static const icalrestriction_record *icalrestriction_get_restriction(
+ const icalrestriction_record *start,
+ icalproperty_method method, icalcomponent_kind component,
+ icalproperty_kind property, icalcomponent_kind subcomp);
-static const icalrestriction_property_record null_prop_record =
- { ICAL_METHOD_NONE, ICAL_NO_COMPONENT, ICAL_NO_PROPERTY, ICAL_RESTRICTION_UNKNOWN, NULL };
+static const icalrestriction_record null_restriction_record =
+ { ICAL_METHOD_NONE, ICAL_NO_COMPONENT,
+ ICAL_NO_PROPERTY, ICAL_NO_COMPONENT, ICAL_RESTRICTION_UNKNOWN, NULL };
/** Each row gives the result of comparing a restriction against a count.
The columns in each row represent 0,1,2+. '-1' indicates
@@ -104,276 +91,323 @@ int icalrestriction_compare(icalrestriction_kind restr, int count)
/* Special case routines */
-static const char *icalrestriction_may_be_draft_final_canceled(
- const icalrestriction_property_record *rec, icalcomponent *comp, icalproperty *prop)
+static const char *icalrestriction_validate_status_value(
+ const icalrestriction_record *rec, icalcomponent *comp, icalproperty *prop)
{
- icalproperty_status stat = icalproperty_get_status(prop);
+ icalproperty_status stat;
- _unused(rec);
_unused(comp);
- if (!(stat == ICAL_STATUS_DRAFT ||
- stat == ICAL_STATUS_FINAL ||
- stat == ICAL_STATUS_CANCELLED)) {
- return
- "Failed iTIP restrictions for STATUS property. "
- "Value must be one of DRAFT, FINAL, or CANCELED";
+ if (!prop) {
+ return 0;
+ }
+
+ stat = icalproperty_get_status(prop);
+
+ if (rec->method == ICAL_METHOD_CANCEL) {
+ switch (rec->component) {
+ case ICAL_VEVENT_COMPONENT:
+ case ICAL_VTODO_COMPONENT:
+ /* Hack. see rfc5546, 3.2.5 CANCEL for property STATUS. I don't
+ understand the note */
+ break;
+
+ case ICAL_VJOURNAL_COMPONENT:
+ case ICAL_VPOLL_COMPONENT:
+ if (stat != ICAL_STATUS_CANCELLED) {
+ return
+ "Failed iTIP restrictions for STATUS property. "
+ "Value must be CANCELLED";
+ }
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (rec->component) {
+ case ICAL_VEVENT_COMPONENT:
+ switch (rec->method) {
+ case ICAL_METHOD_PUBLISH:
+ case ICAL_METHOD_COUNTER:
+ if (!(stat == ICAL_STATUS_TENTATIVE ||
+ stat == ICAL_STATUS_CONFIRMED ||
+ stat == ICAL_STATUS_CANCELLED)) {
+ return
+ "Failed iTIP restrictions for STATUS property. "
+ "Value must be one of TENTATIVE, CONFIRMED or CANCELED";
+ }
+ break;
+
+ case ICAL_METHOD_REQUEST:
+ case ICAL_METHOD_ADD:
+ if (!(stat == ICAL_STATUS_TENTATIVE ||
+ stat == ICAL_STATUS_CONFIRMED)) {
+ return
+ "Failed iTIP restrictions for STATUS property. "
+ "Value must be one of TENTATIVE or CONFIRMED";
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case ICAL_VTODO_COMPONENT:
+ switch (rec->method) {
+ case ICAL_METHOD_REQUEST:
+ case ICAL_METHOD_ADD:
+ case ICAL_METHOD_COUNTER:
+ if (!(stat == ICAL_STATUS_COMPLETED ||
+ stat == ICAL_STATUS_NEEDSACTION ||
+ stat == ICAL_STATUS_INPROCESS)) {
+ return
+ "Failed iTIP restrictions for STATUS property. "
+ "Value must be one of COMPLETED, NEEDS-ACTION or IN-PROCESS";
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
}
return 0;
}
-static const char *icalrestriction_may_be_comp_need_process(const icalrestriction_property_record *
- rec, icalcomponent *comp,
- icalproperty *prop)
+static const char *icalrestriction_must_be_recurring(const icalrestriction_record * rec,
+ icalcomponent *comp, icalproperty *prop)
{
- icalproperty_status stat = icalproperty_get_status(prop);
-
_unused(rec);
_unused(comp);
-
- if (!(stat == ICAL_STATUS_COMPLETED ||
- stat == ICAL_STATUS_NEEDSACTION || stat == ICAL_STATUS_INPROCESS)) {
- return
- "Failed iTIP restrictions for STATUS property. "
- "Value must be one of COMPLETED, NEEDS-ACTION or IN-PROCESS";
- }
-
+ _unused(prop);
return 0;
}
-static const char *icalrestriction_may_be_tent_conf(const icalrestriction_property_record * rec,
- icalcomponent *comp, icalproperty *prop)
+const char *icalrestriction_must_if_tz_ref(const icalrestriction_record * rec,
+ icalcomponent *comp, icalproperty *prop)
{
- icalproperty_status stat = icalproperty_get_status(prop);
-
_unused(rec);
_unused(comp);
-
- if (!(stat == ICAL_STATUS_TENTATIVE || stat == ICAL_STATUS_CONFIRMED)) {
- return
- "Failed iTIP restrictions for STATUS property. "
- "Value must be one of TENTATIVE or CONFIRMED";
- }
-
+ _unused(prop);
return 0;
}
-static const char *icalrestriction_may_be_tent_conf_cancel(const icalrestriction_property_record *
- rec, icalcomponent *comp,
- icalproperty *prop)
+static const char *icalrestriction_no_dtend(const icalrestriction_record * rec,
+ icalcomponent *comp, icalproperty *prop)
{
- icalproperty_status stat = icalproperty_get_status(prop);
-
_unused(rec);
- _unused(comp);
- if (!(stat == ICAL_STATUS_TENTATIVE ||
- stat == ICAL_STATUS_CONFIRMED || stat == ICAL_STATUS_CANCELLED)) {
+ if (prop != NULL &&
+ icalcomponent_get_first_property(comp, ICAL_DTEND_PROPERTY)) {
return
- "Failed iTIP restrictions for STATUS property. "
- "Value must be one of TENTATIVE, CONFIRMED or CANCELED";
+ "Failed iTIP restrictions for DTEND property. "
+ "The component must not have both DURATION and DTEND";
}
return 0;
}
-static const char *icalrestriction_must_be_cancel_if_present(
- const icalrestriction_property_record *rec, icalcomponent *comp, icalproperty *prop)
+static const char *icalrestriction_no_duration(const icalrestriction_record * rec,
+ icalcomponent *comp, icalproperty *prop)
{
- /* This routine will not be called if prop == 0 */
- icalproperty_status stat = icalproperty_get_status(prop);
-
_unused(rec);
- _unused(comp);
- if (stat != ICAL_STATUS_CANCELLED) {
- return "Failed iTIP restrictions for STATUS property. Value must be CANCELLED";
+ if (prop != NULL &&
+ icalcomponent_get_first_property(comp, ICAL_DURATION_PROPERTY)) {
+ return
+ "Failed iTIP restrictions for DURATION property. "
+ "The component must not have both DTEND and DURATION";
}
return 0;
}
-static const char *icalrestriction_must_be_canceled_no_attendee(
- const icalrestriction_property_record *rec, icalcomponent *comp, icalproperty *prop)
+static int _check_restriction(icalcomponent *comp,
+ const icalrestriction_record *record,
+ int count, icalproperty *prop)
{
- _unused(rec);
- _unused(comp);
- _unused(prop);
-
- /* Hack. see rfc5546, 3.2.5 CANCEL for property STATUS. I don't
- understand the note */
+ icalrestriction_kind restr;
+ const char *funcr = 0;
+ int compare;
- return 0;
-}
+ restr = record->restriction;
-static const char *icalrestriction_must_be_recurring(const icalrestriction_property_record * rec,
- icalcomponent *comp, icalproperty *prop)
-{
- _unused(rec);
- _unused(comp);
- _unused(prop);
- return 0;
-}
+ if (restr == ICAL_RESTRICTION_ONEEXCLUSIVE ||
+ restr == ICAL_RESTRICTION_ONEMUTUAL) {
-static const char *icalrestriction_must_have_duration(const icalrestriction_property_record * rec,
- icalcomponent *comp, icalproperty *prop)
-{
- _unused(rec);
- _unused(prop);
- if (!icalcomponent_get_first_property(comp, ICAL_DURATION_PROPERTY)) {
- return
- "Failed iTIP restrictions for DURATION property. "
- "This component must have a DURATION property";
+ /* First treat is as a 0/1 restriction */
+ restr = ICAL_RESTRICTION_ZEROORONE;
}
- return 0;
-}
+ compare = icalrestriction_compare(restr, count);
-static const char *icalrestriction_must_have_repeat(const icalrestriction_property_record * rec,
- icalcomponent *comp, icalproperty *prop)
-{
- _unused(rec);
- _unused(prop);
- if (!icalcomponent_get_first_property(comp, ICAL_REPEAT_PROPERTY)) {
- return
- "Failed iTIP restrictions for REPEAT property. "
- "This component must have a REPEAT property";
- }
+ assert(compare != -1);
- return 0;
-}
+ if (compare == 0) {
+#define TMP_BUF_SIZE 1024
+ char temp[TMP_BUF_SIZE];
+ icalproperty *errProp;
+ icalparameter *errParam;
+ const char *type, *kind;
-const char *icalrestriction_must_if_tz_ref(const icalrestriction_property_record * rec,
- icalcomponent *comp, icalproperty *prop)
-{
- _unused(rec);
- _unused(comp);
- _unused(prop);
- return 0;
-}
+ if (record->subcomponent != ICAL_NO_COMPONENT) {
+ type = "component";
+ kind = icalenum_component_kind_to_string(record->subcomponent);
+ } else {
+ type = "property";
+ kind = icalenum_property_kind_to_string(record->property);
+ }
-static const char *icalrestriction_no_dtend(const icalrestriction_property_record * rec,
- icalcomponent *comp, icalproperty *prop)
-{
- _unused(rec);
- _unused(prop);
- if (icalcomponent_get_first_property(comp, ICAL_DTEND_PROPERTY)) {
- return
- "Failed iTIP restrictions for DTEND property. "
- "The component must not have both DURATION and DTEND";
+ snprintf(temp, TMP_BUF_SIZE,
+ "Failed iTIP restrictions for %s %s. "
+ "Expected %s instances of the %s and got %d",
+ kind, type, restr_string_map[restr], type, count);
+ errParam = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP);
+ errProp = icalproperty_vanew_xlicerror(temp, errParam, (void *)0);
+ icalcomponent_add_property(comp, errProp);
+ icalproperty_free(errProp);
}
- return 0;
-}
-
-static const char *icalrestriction_no_duration(const icalrestriction_property_record * rec,
- icalcomponent *comp, icalproperty *prop)
-{
- _unused(rec);
- _unused(comp);
- _unused(prop);
-
- /* _no_dtend takes care of this one */
- return 0;
-}
+ if (record->function != NULL) {
+ funcr = record->function(record, comp, prop);
+ }
-static const char *icalrestriction_must_be_email(const icalrestriction_property_record * rec,
- icalcomponent *comp, icalproperty *prop)
-{
- icalproperty_action stat = icalproperty_get_action(prop);
+ if (funcr != 0) {
+ icalproperty *errProp;
+ icalparameter *errParam;
- _unused(rec);
- _unused(comp);
+ errParam = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP);
+ errProp = icalproperty_vanew_xlicerror(funcr, errParam, (void *)0);
+ icalcomponent_add_property(comp, errProp);
+ icalproperty_free(errProp);
- if (!(stat == ICAL_ACTION_EMAIL)) {
- return "Failed iTIP restrictions for ACTION property. Value must be EMAIL.";
+ compare = 0;
}
- return 0;
+ return compare;
}
-static int icalrestriction_check_component(icalproperty_method method, icalcomponent *comp)
+static int icalrestriction_check_component(icalproperty_method method,
+ icalcomponent *comp)
{
- icalproperty_kind kind;
- icalcomponent_kind comp_kind;
- icalrestriction_kind restr;
- const icalrestriction_property_record *prop_record;
- const char *funcr = 0;
- icalproperty *prop;
-
+ icalcomponent_kind comp_kind, inner_kind;
+ icalproperty_kind prop_kind;
+ const icalrestriction_record *start_record;
+ icalproperty *method_prop = NULL;
+ icalcomponent *inner_comp;
+ const char *errStr = NULL;
int count;
int compare;
int valid = 1;
comp_kind = icalcomponent_isa(comp);
+ switch (comp_kind) {
+ case ICAL_VCALENDAR_COMPONENT:
+ if (!icalcomponent_get_first_real_component(comp)) {
+
+ errStr = "Failed iTIP restrictions for VCALENDAR component. "
+ "Expected one or more \"real\" sub-components and got 0";
+ }
+
+ /* Get the Method property from the component */
+ method_prop = icalcomponent_get_first_property(comp, ICAL_METHOD_PROPERTY);
+ break;
+
+ case ICAL_VTIMEZONE_COMPONENT:
+ if (!icalcomponent_get_first_component(comp, ICAL_XSTANDARD_COMPONENT) &&
+ !icalcomponent_get_first_component(comp, ICAL_XDAYLIGHT_COMPONENT)) {
+
+ errStr = "Failed iTIP restrictions for VTIMEZONE component. "
+ "Expected one or more STANDARD/DAYLIGHT sub-components and got 0";
+ }
+
+ method = ICAL_METHOD_NONE;
+ break;
+
+ default:
+ break;
+ }
+
+ if (errStr != NULL) {
+ icalproperty *errProp;
+ icalparameter *errParam;
+
+ errParam = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP);
+ errProp = icalproperty_vanew_xlicerror(errStr, errParam, (void *)0);
+ icalcomponent_add_property(comp, errProp);
+ icalproperty_free(errProp);
+
+ valid = 0;
+ }
+
/* Check all of the properties in this component */
- for (kind = ICAL_ANY_PROPERTY + 1; kind != ICAL_NO_PROPERTY; kind++) {
- count = icalcomponent_count_properties(comp, kind);
+ start_record = icalrestriction_get_restriction(NULL, method, comp_kind,
+ ICAL_ANY_PROPERTY,
+ ICAL_NO_COMPONENT);
- prop_record = icalrestriction_get_property_restriction(method, comp_kind, kind);
+ if (start_record != &null_restriction_record) {
- restr = prop_record->restriction;
+ for (prop_kind = ICAL_ANY_PROPERTY + 1;
+ prop_kind != ICAL_NO_PROPERTY; prop_kind++) {
- if (restr == ICAL_RESTRICTION_ONEEXCLUSIVE || restr == ICAL_RESTRICTION_ONEMUTUAL) {
+ const icalrestriction_record *record =
+ icalrestriction_get_restriction(start_record, method, comp_kind,
+ prop_kind, ICAL_NO_COMPONENT);
- /* First treat is as a 0/1 restriction */
- restr = ICAL_RESTRICTION_ZEROORONE;
- compare = icalrestriction_compare(restr, count);
+ icalproperty *prop =
+ icalcomponent_get_first_property(comp, prop_kind);
- } else {
+ count = icalcomponent_count_properties(comp, prop_kind);
- compare = icalrestriction_compare(restr, count);
- }
+ compare = _check_restriction(comp, record, count, prop);
- assert(compare != -1);
-
- if (compare == 0) {
-#if !defined(__COVERITY__)
- /* Coverity doesn't think the memory allocated by icalparameter_new_xlicerrortype()
- * is freed, even though it should be freed in icalproperty_free()
- */
- #define TMP_BUF_SIZE 1024
- char temp[TMP_BUF_SIZE];
- icalproperty *errProp;
-
- snprintf(temp, TMP_BUF_SIZE,
- "Failed iTIP restrictions for %s property. "
- "Expected %s instances of the property and got %d",
- icalenum_property_kind_to_string(kind), restr_string_map[restr], count);
- errProp =
- icalproperty_vanew_xlicerror(
- temp,
- icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP), (void *)0);
- icalcomponent_add_property(comp, errProp);
- icalproperty_free(errProp);
-#endif
+ valid = valid && compare;
}
+ }
- prop = icalcomponent_get_first_property(comp, kind);
+ /* Now check the inner components */
- if (prop != 0 && prop_record->function != NULL) {
- funcr = prop_record->function(prop_record, comp, prop);
- }
+ start_record = icalrestriction_get_restriction(start_record, method, comp_kind,
+ ICAL_NO_PROPERTY,
+ ICAL_ANY_COMPONENT);
- if (funcr != 0) {
-#if !defined(__COVERITY__)
- /* Coverity doesn't think the memory allocated by icalparameter_new_xlicerrortype()
- * is freed, even though it should be freed in icalproperty_free()
- */
- icalproperty *errProp;
-
- errProp =
- icalproperty_vanew_xlicerror(
- funcr,
- icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP), (void *)0);
- icalcomponent_add_property(comp, errProp);
- icalproperty_free(errProp);
- compare = 0;
-#endif
+ if (start_record != &null_restriction_record) {
+
+ for (inner_kind = ICAL_NO_COMPONENT + 3;
+ inner_kind != ICAL_NUM_COMPONENT_TYPES; inner_kind++) {
+
+ const icalrestriction_record *record =
+ icalrestriction_get_restriction(start_record, method, comp_kind,
+ ICAL_NO_PROPERTY, inner_kind);
+
+ count = icalcomponent_count_components(comp, inner_kind);
+
+ compare = _check_restriction(comp, record, count, NULL);
+
+ valid = valid && compare;
}
+ }
+
+ if (method_prop == 0) {
+ method = ICAL_METHOD_NONE;
+ } else {
+ method = icalproperty_get_method(method_prop);
+ }
+
+ for (inner_comp = icalcomponent_get_first_component(comp, ICAL_ANY_COMPONENT);
+ inner_comp != 0;
+ inner_comp = icalcomponent_get_next_component(comp, ICAL_ANY_COMPONENT)) {
+
+ compare = icalrestriction_check_component(method, inner_comp);
valid = valid && compare;
}
@@ -384,15 +418,10 @@ static int icalrestriction_check_component(icalproperty_method method, icalcompo
int icalrestriction_check(icalcomponent *outer_comp)
{
icalcomponent_kind comp_kind;
- icalproperty_method method;
- icalcomponent *inner_comp;
- icalproperty *method_prop;
int valid;
icalerror_check_arg_rz((outer_comp != 0), "outer comp");
- /* Get the Method value from the outer component */
-
comp_kind = icalcomponent_isa(outer_comp);
if (comp_kind != ICAL_VCALENDAR_COMPONENT) {
@@ -400,43 +429,198 @@ int icalrestriction_check(icalcomponent *outer_comp)
return 0;
}
- method_prop = icalcomponent_get_first_property(outer_comp, ICAL_METHOD_PROPERTY);
-
- if (method_prop == 0) {
- method = ICAL_METHOD_NONE;
- } else {
- method = icalproperty_get_method(method_prop);
- }
-
/* Check the VCALENDAR wrapper */
valid = icalrestriction_check_component(ICAL_METHOD_NONE, outer_comp);
- /* Now check the inner components */
+ return valid;
+}
- for (inner_comp = icalcomponent_get_first_component(outer_comp, ICAL_ANY_COMPONENT);
- inner_comp != 0;
- inner_comp = icalcomponent_get_next_component(outer_comp, ICAL_ANY_COMPONENT)) {
- valid = valid && icalrestriction_check_component(method, inner_comp);
+static const char *icalrestriction_validate_valarm_prop(
+ const icalrestriction_record *rec, icalcomponent *comp, icalproperty *prop)
+{
+ icalrestriction_record record =
+ { ICAL_METHOD_NONE, ICAL_VALARM_COMPONENT,
+ rec->property, ICAL_NO_COMPONENT, ICAL_RESTRICTION_UNKNOWN, NULL };
+ const icalrestriction_record *myrec = NULL;
+ enum icalproperty_action action = ICAL_ACTION_NONE;
+ icalproperty *action_prop;
+ int count = 0;
+
+ switch (rec->subcomponent) {
+ case ICAL_NO_COMPONENT:
+ action_prop = icalcomponent_get_first_property(comp, ICAL_ACTION_PROPERTY);
+
+ if (action_prop) {
+ action = icalproperty_get_action(action_prop);
+ }
+
+ if (prop) {
+ if (rec->restriction == ICAL_RESTRICTION_ZEROPLUS ||
+ rec->restriction == ICAL_RESTRICTION_ONEPLUS) {
+ count = icalcomponent_count_properties(comp, rec->property);
+ } else {
+ count = 1;
+ }
+ }
+
+ switch (rec->property) {
+ case ICAL_DURATION_PROPERTY:
+ if (count &&
+ !icalcomponent_get_first_property(comp, ICAL_DURATION_PROPERTY)) {
+ return
+ "Failed iTIP restrictions for REPEAT property. "
+ "This component must have a REPEAT property "
+ "if it has a DURATION property";
+ }
+ break;
+
+ case ICAL_REPEAT_PROPERTY:
+ if (count &&
+ !icalcomponent_get_first_property(comp, ICAL_DURATION_PROPERTY)) {
+ return
+ "Failed iTIP restrictions for DURATION property. "
+ "This component must have a DURATION property "
+ "if it has a REPEAT property";
+ }
+ break;
+
+ case ICAL_ATTACH_PROPERTY:
+ if (count) {
+ switch (action) {
+ case ICAL_ACTION_AUDIO:
+ case ICAL_ACTION_PROCEDURE:
+ record.restriction = ICAL_RESTRICTION_ZEROORONE;
+ myrec = &record;
+ break;
+
+ case ICAL_ACTION_DISPLAY:
+ record.restriction = ICAL_RESTRICTION_ZERO;
+ myrec = &record;
+ break;
+
+ default:
+ break;
+ }
+ break;
+ }
+ break;
+
+ case ICAL_ATTENDEE_PROPERTY:
+ switch (action) {
+ case ICAL_ACTION_AUDIO:
+ case ICAL_ACTION_DISPLAY:
+ case ICAL_ACTION_PROCEDURE:
+ if (count) {
+ record.restriction = ICAL_RESTRICTION_ZERO;
+ myrec = &record;
+ }
+ break;
+
+ case ICAL_ACTION_EMAIL:
+ if (!count) {
+ record.restriction = ICAL_RESTRICTION_ONEPLUS;
+ myrec = &record;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case ICAL_DESCRIPTION_PROPERTY:
+ switch (action) {
+ case ICAL_ACTION_AUDIO:
+ if (count) {
+ record.restriction = ICAL_RESTRICTION_ZERO;
+ myrec = &record;
+ }
+ break;
+
+ case ICAL_ACTION_DISPLAY:
+ case ICAL_ACTION_EMAIL:
+ if (!count) {
+ record.restriction = ICAL_RESTRICTION_ONE;
+ myrec = &record;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case ICAL_SUMMARY_PROPERTY:
+ switch (action) {
+ case ICAL_ACTION_AUDIO:
+ case ICAL_ACTION_DISPLAY:
+ case ICAL_ACTION_PROCEDURE:
+ if (count) {
+ record.restriction = ICAL_RESTRICTION_ZERO;
+ myrec = &record;
+ }
+ break;
+
+ case ICAL_ACTION_EMAIL:
+ if (!count) {
+ record.restriction = ICAL_RESTRICTION_ONE;
+ myrec = &record;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case ICAL_VLOCATION_COMPONENT:
+ if (!icalcomponent_get_first_property(comp, ICAL_PROXIMITY_PROPERTY)) {
+ return
+ "Failed iTIP restrictions for VLOCATION component. "
+ "This component must only appear in a VALARM component "
+ "if the VALARM has a PROXIMITY property.";
+ }
+ break;
+
+ default:
+ break;
}
- return valid;
+ if (myrec) {
+ _check_restriction(comp, myrec, count, NULL);
+ }
+
+ return 0;
}
<insert_code_here>
-static const icalrestriction_property_record *icalrestriction_get_property_restriction(
- icalproperty_method method, icalcomponent_kind component, icalproperty_kind property)
+static const icalrestriction_record *icalrestriction_get_restriction(
+ const icalrestriction_record *start,
+ icalproperty_method method, icalcomponent_kind component,
+ icalproperty_kind property, icalcomponent_kind subcomp)
{
- int i;
+ const icalrestriction_record *rec;
+
+ if (!start) {
+ start = &icalrestriction_records[0];
+ }
- for (i = 0; icalrestriction_property_records[i].restriction != ICAL_RESTRICTION_NONE; i++) {
+ for (rec = start; rec && rec->restriction != ICAL_RESTRICTION_NONE; rec++) {
- if (method == icalrestriction_property_records[i].method &&
- component == icalrestriction_property_records[i].component &&
- property == icalrestriction_property_records[i].property) {
- return &icalrestriction_property_records[i];
+ if (method == rec->method &&
+ (component == ICAL_ANY_COMPONENT ||
+ (component == rec->component &&
+ (property == ICAL_ANY_PROPERTY || property == rec->property) &&
+ (subcomp == ICAL_ANY_COMPONENT || subcomp == rec->subcomponent)))) {
+ return rec;
}
}
- return &null_prop_record;
+ return &null_restriction_record;
}
diff --git a/src/libical/icalrestriction.h b/src/libical/icalrestriction.h
index 752cf457..47d9d07a 100644
--- a/src/libical/icalrestriction.h
+++ b/src/libical/icalrestriction.h
@@ -2,18 +2,9 @@
FILE: icalrestriction.h
CREATOR: eric 24 April 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original code is icalrestriction.h
diff --git a/src/libical/icaltime.c b/src/libical/icaltime.c
index fe03aee5..93eebf6c 100644
--- a/src/libical/icaltime.c
+++ b/src/libical/icaltime.c
@@ -2,20 +2,11 @@
FILE: icaltime.c
CREATOR: eric 02 June 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
The timegm code is Copyright (c) 2001-2006, NLnet Labs. All rights reserved.
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
@@ -77,16 +68,16 @@ static int icaltime_leap_days(int y1, int y2)
/*
* Code adapted from Python 2.4.1 sources (Lib/calendar.py).
*/
-static time_t icaltime_timegm(const struct tm *tm)
+static icaltime_t icaltime_timegm(const struct tm *tm)
{
int year;
- time_t days;
- time_t hours;
- time_t minutes;
- time_t seconds;
+ icaltime_t days;
+ icaltime_t hours;
+ icaltime_t minutes;
+ icaltime_t seconds;
year = 1900 + tm->tm_year;
- days = (time_t)(365 * (year - 1970) + icaltime_leap_days(1970, year));
+ days = (icaltime_t)(365 * (year - 1970) + icaltime_leap_days(1970, year));
days += days_in_year_passed_month[0][tm->tm_mon];
if (tm->tm_mon > 1 && icaltime_is_leap_year(year))
@@ -102,15 +93,15 @@ static time_t icaltime_timegm(const struct tm *tm)
/*
* Function to convert a struct tm time specification
- * to an ANSI time_t using the specified time zone.
+ * to an ANSI-compatible icaltime_t using the specified time zone.
* This is different from the standard mktime() function
* in that we don't want the automatic adjustments for
* local daylight savings time applied to the result.
* This function expects well-formed input.
*/
-static time_t make_time(struct tm *tm, int tzm)
+static icaltime_t make_time(struct tm *tm, int tzm)
{
- time_t tim;
+ icaltime_t tim;
int febs;
static int days[] = { -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 };
@@ -118,25 +109,25 @@ static time_t make_time(struct tm *tm, int tzm)
/* check that month specification within range */
if (tm->tm_mon < 0 || tm->tm_mon > 11)
- return ((time_t) - 1);
+ return ((icaltime_t) - 1);
-#if (SIZEOF_TIME_T == 4)
+#if (SIZEOF_ICALTIME_T == 4)
/* check that year specification within range */
if (tm->tm_year < 70 || tm->tm_year > 138)
- return ((time_t) - 1);
+ return ((icaltime_t) - 1);
/* check for upper bound of Jan 17, 2038 (to avoid possibility of
32-bit arithmetic overflow) */
if (tm->tm_year == 138) {
if (tm->tm_mon > 0) {
- return ((time_t) - 1);
+ return ((icaltime_t) - 1);
} else if (tm->tm_mday > 17) {
- return ((time_t) - 1);
+ return ((icaltime_t) - 1);
}
}
-#endif /* SIZEOF_TIME_T */
+#endif /* SIZEOF_ICALTIME_T */
/*
* calculate elapsed days since start of the epoch (midnight Jan
@@ -144,7 +135,7 @@ static time_t make_time(struct tm *tm, int tzm)
* (number of leap days to subtract)
*/
- tim = (time_t) ((tm->tm_year - 70) * 365 + ((tm->tm_year - 1) / 4) - 17);
+ tim = (icaltime_t) ((tm->tm_year - 70) * 365 + ((tm->tm_year - 1) / 4) - 17);
/* adjust: no leap days every 100 years, except every 400 years. */
@@ -186,7 +177,7 @@ static time_t make_time(struct tm *tm, int tzm)
return (tim);
}
-struct icaltimetype icaltime_from_timet_with_zone(const time_t tm, const int is_date,
+struct icaltimetype icaltime_from_timet_with_zone(const icaltime_t tm, const int is_date,
const icaltimezone *zone)
{
struct icaltimetype tt;
@@ -195,8 +186,8 @@ struct icaltimetype icaltime_from_timet_with_zone(const time_t tm, const int is_
utc_zone = icaltimezone_get_utc_timezone();
- /* Convert the time_t to a struct tm in UTC time. We can trust gmtime for this. */
- if (!gmtime_r(&tm, &t))
+ /* Convert the icaltime_t to a struct tm in UTC time. We can trust gmtime for this. */
+ if (!icalgmtime_r(&tm, &t))
return is_date ? icaltime_null_date () : icaltime_null_time ();
tt.year = t.tm_year + 1900;
@@ -226,18 +217,18 @@ struct icaltimetype icaltime_from_timet_with_zone(const time_t tm, const int is_
struct icaltimetype icaltime_current_time_with_zone(const icaltimezone *zone)
{
- return icaltime_from_timet_with_zone(time(NULL), 0, zone);
+ return icaltime_from_timet_with_zone(icaltime(NULL), 0, zone);
}
struct icaltimetype icaltime_today(void)
{
- return icaltime_from_timet_with_zone(time(NULL), 1, NULL);
+ return icaltime_from_timet_with_zone(icaltime(NULL), 1, NULL);
}
-time_t icaltime_as_timet(const struct icaltimetype tt)
+icaltime_t icaltime_as_timet(const struct icaltimetype tt)
{
struct tm stm;
- time_t t;
+ icaltime_t t;
/* If the time is the special null time, return 0. */
if (icaltime_is_null_time(tt)) {
@@ -265,11 +256,11 @@ time_t icaltime_as_timet(const struct icaltimetype tt)
return t;
}
-time_t icaltime_as_timet_with_zone(const struct icaltimetype tt, const icaltimezone *zone)
+icaltime_t icaltime_as_timet_with_zone(const struct icaltimetype tt, const icaltimezone *zone)
{
icaltimezone *utc_zone;
struct tm stm;
- time_t t;
+ icaltime_t t;
struct icaltimetype local_tt;
utc_zone = icaltimezone_get_utc_timezone();
@@ -466,38 +457,32 @@ int icaltime_days_in_month(const int month, const int year)
/* 1-> Sunday, 7->Saturday */
int icaltime_day_of_week(const struct icaltimetype t)
{
- UTinstant jt;
+ UTinstantInt jt;
- memset(&jt, 0, sizeof(UTinstant));
+ memset(&jt, 0, sizeof(UTinstantInt));
jt.year = t.year;
jt.month = t.month;
jt.day = t.day;
- jt.i_hour = 0;
- jt.i_minute = 0;
- jt.i_second = 0;
- (void)juldat(&jt);
+ juldat_int(&jt);
return jt.weekday + 1;
}
int icaltime_start_doy_week(const struct icaltimetype t, int fdow)
{
- UTinstant jt;
+ UTinstantInt jt;
int delta;
- memset(&jt, 0, sizeof(UTinstant));
+ memset(&jt, 0, sizeof(UTinstantInt));
jt.year = t.year;
jt.month = t.month;
jt.day = t.day;
- jt.i_hour = 0;
- jt.i_minute = 0;
- jt.i_second = 0;
- (void)juldat(&jt);
- (void)caldat(&jt);
+ juldat_int(&jt);
+ caldat_int(&jt);
delta = jt.weekday - (fdow - 1);
if (delta < 0) {
@@ -508,19 +493,16 @@ int icaltime_start_doy_week(const struct icaltimetype t, int fdow)
int icaltime_week_number(const struct icaltimetype ictt)
{
- UTinstant jt;
+ UTinstantInt jt;
- memset(&jt, 0, sizeof(UTinstant));
+ memset(&jt, 0, sizeof(UTinstantInt));
jt.year = ictt.year;
jt.month = ictt.month;
jt.day = ictt.day;
- jt.i_hour = 0;
- jt.i_minute = 0;
- jt.i_second = 0;
- (void)juldat(&jt);
- (void)caldat(&jt);
+ juldat_int(&jt);
+ caldat_int(&jt);
return (jt.day_of_year - jt.weekday) / 7;
}
diff --git a/src/libical/icaltime.h b/src/libical/icaltime.h.cmake
index 816eac6f..b5e93860 100644
--- a/src/libical/icaltime.h
+++ b/src/libical/icaltime.h.cmake
@@ -2,18 +2,9 @@
FILE: icaltime.h
CREATOR: eric 02 June 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
@@ -37,7 +28,7 @@
* - icaltime_null_date()
* - icaltime_current_time_with_zone()
* - icaltime_today()
- * - icaltime_from_timet_with_zone(time_t tm, int is_date,
+ * - icaltime_from_timet_with_zone(icaltime_t tm, int is_date,
* icaltimezone *zone)
* - icaltime_from_day_of_year(int doy, int year)
*
@@ -83,6 +74,7 @@
#include "libical_ical_export.h"
#include <time.h>
+#define icaltime_t ${ICAL_ICALTIME_T_TYPE}
/* An opaque struct representing a timezone. We declare this here to avoid
a circular dependency. */
@@ -94,8 +86,8 @@ typedef struct _icaltimezone icaltimezone;
/** icaltime_span is returned by icalcomponent_get_span() */
struct icaltime_span
{
- time_t start; /**< in UTC */
- time_t end; /**< in UTC */
+ icaltime_t start; /**< in UTC */
+ icaltime_t end; /**< in UTC */
int is_busy; /**< 1->busy time, 0-> free time */
};
@@ -169,7 +161,7 @@ LIBICAL_ICAL_EXPORT struct icaltimetype icaltime_today(void);
* target timezone with no need to store the source timezone.
*
*/
-LIBICAL_ICAL_EXPORT struct icaltimetype icaltime_from_timet_with_zone(const time_t tm,
+LIBICAL_ICAL_EXPORT struct icaltimetype icaltime_from_timet_with_zone(const icaltime_t tm,
const int is_date,
const icaltimezone *zone);
@@ -201,7 +193,7 @@ LIBICAL_ICAL_EXPORT struct icaltimetype icaltime_from_day_of_year(const int doy,
*
* The return value is defined for dates starting with 1902-01-01 until 10000-01-01 (excl.).
*/
-LIBICAL_ICAL_EXPORT time_t icaltime_as_timet(const struct icaltimetype);
+LIBICAL_ICAL_EXPORT icaltime_t icaltime_as_timet(const struct icaltimetype);
/** @brief Returns the time as seconds past the UNIX epoch, using the
* given timezone.
@@ -209,9 +201,9 @@ LIBICAL_ICAL_EXPORT time_t icaltime_as_timet(const struct icaltimetype);
* This convenience method combines a call to icaltime_convert_to_zone()
* with a call to icaltime_as_timet().
* If the input timezone is null, no conversion is done; that is, the
- * time is simply returned as time_t in its native timezone.
+ * time is simply returned as icaltime_t in its native timezone.
*/
-LIBICAL_ICAL_EXPORT time_t icaltime_as_timet_with_zone(const struct icaltimetype tt,
+LIBICAL_ICAL_EXPORT icaltime_t icaltime_as_timet_with_zone(const struct icaltimetype tt,
const icaltimezone *zone);
/**
diff --git a/src/libical/icaltimezone.c b/src/libical/icaltimezone.c
index e57c08d2..b272c0f0 100644
--- a/src/libical/icaltimezone.c
+++ b/src/libical/icaltimezone.c
@@ -2,18 +2,10 @@
FILE: icaltimezone.c
CREATOR: Damon Chaplin 15 March 2001
- (C) COPYRIGHT 2001, Damon Chaplin <damon@ximian.com>
+ SPDX-FileCopyrightText: 2001, Damon Chaplin <damon@ximian.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
//krazy:excludeall=cpp
@@ -85,12 +77,12 @@ static char s_ical_tzid_prefix[BUILTIN_TZID_PREFIX_LEN] = {0};
the timezone changes. */
#define ICALTIMEZONE_EXTRA_COVERAGE 5
-#if (SIZEOF_TIME_T > 4)
+#if (SIZEOF_ICALTIME_T > 4)
/** Arbitrarily go up to 1000th anniversary of Gregorian calendar, since
- 64-bit time_t values get us up to the tm_year limit of 2+ billion years. */
+ 64-bit icaltime_t values get us up to the tm_year limit of 2+ billion years. */
#define ICALTIMEZONE_MAX_YEAR 2582
#else
-/** This is the maximum year we will expand to, since 32-bit time_t values
+/** This is the maximum year we will expand to, since 32-bit icaltime_t values
only go up to the start of 2038. */
#define ICALTIMEZONE_MAX_YEAR 2037
#endif
@@ -212,7 +204,7 @@ icaltimezone *icaltimezone_new(void)
{
icaltimezone *zone;
- zone = (icaltimezone *) malloc(sizeof(icaltimezone));
+ zone = (icaltimezone *) icalmemory_new_buffer(sizeof(icaltimezone));
if (!zone) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return NULL;
@@ -227,7 +219,7 @@ icaltimezone *icaltimezone_copy(icaltimezone *originalzone)
{
icaltimezone *zone;
- zone = (icaltimezone *) malloc(sizeof(icaltimezone));
+ zone = (icaltimezone *) icalmemory_new_buffer(sizeof(icaltimezone));
if (!zone) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return NULL;
@@ -235,13 +227,13 @@ icaltimezone *icaltimezone_copy(icaltimezone *originalzone)
memcpy(zone, originalzone, sizeof(icaltimezone));
if (zone->tzid != NULL) {
- zone->tzid = strdup(zone->tzid);
+ zone->tzid = icalmemory_strdup(zone->tzid);
}
if (zone->location != NULL) {
- zone->location = strdup(zone->location);
+ zone->location = icalmemory_strdup(zone->location);
}
if (zone->tznames != NULL) {
- zone->tznames = strdup(zone->tznames);
+ zone->tznames = icalmemory_strdup(zone->tznames);
}
icaltimezone_changes_lock();
@@ -261,7 +253,7 @@ void icaltimezone_free(icaltimezone *zone, int free_struct)
{
icaltimezone_reset(zone);
if (free_struct)
- free(zone);
+ icalmemory_free_buffer(zone);
}
/** @brief Resets the icaltimezone to the initial state, freeing most of the
@@ -270,13 +262,13 @@ void icaltimezone_free(icaltimezone *zone, int free_struct)
static void icaltimezone_reset(icaltimezone *zone)
{
if (zone->tzid)
- free(zone->tzid);
+ icalmemory_free_buffer(zone->tzid);
if (zone->location)
- free(zone->location);
+ icalmemory_free_buffer(zone->location);
if (zone->tznames)
- free(zone->tznames);
+ icalmemory_free_buffer(zone->tznames);
if (zone->component)
icalcomponent_free(zone->component);
@@ -329,9 +321,9 @@ static int icaltimezone_get_vtimezone_properties(icaltimezone *zone, icalcompone
}
if (zone->tzid) {
- free(zone->tzid);
+ icalmemory_free_buffer(zone->tzid);
}
- zone->tzid = strdup(tzid);
+ zone->tzid = icalmemory_strdup(tzid);
if (zone->component) {
icalcomponent_free(zone->component);
@@ -339,12 +331,12 @@ static int icaltimezone_get_vtimezone_properties(icaltimezone *zone, icalcompone
zone->component = component;
if (zone->location) {
- free(zone->location);
+ icalmemory_free_buffer(zone->location);
}
zone->location = icaltimezone_get_location_from_vtimezone(component);
if (zone->tznames) {
- free(zone->tznames);
+ icalmemory_free_buffer(zone->tznames);
}
zone->tznames = icaltimezone_get_tznames_from_vtimezone(component);
@@ -361,7 +353,7 @@ char *icaltimezone_get_location_from_vtimezone(icalcomponent *component)
if (prop) {
location = icalproperty_get_location(prop);
if (location)
- return strdup(location);
+ return icalmemory_strdup(location);
}
prop = icalcomponent_get_first_property(component, ICAL_X_PROPERTY);
@@ -370,7 +362,7 @@ char *icaltimezone_get_location_from_vtimezone(icalcomponent *component)
if (name && !strcasecmp(name, "X-LIC-LOCATION")) {
location = icalproperty_get_x(prop);
if (location)
- return strdup(location);
+ return icalmemory_strdup(location);
}
prop = icalcomponent_get_next_property(component, ICAL_X_PROPERTY);
}
@@ -463,11 +455,11 @@ char *icaltimezone_get_tznames_from_vtimezone(icalcomponent *component)
char *tznames;
if (!strcmp(standard_tzname, daylight_tzname))
- return strdup(standard_tzname);
+ return icalmemory_strdup(standard_tzname);
standard_len = strlen(standard_tzname);
daylight_len = strlen(daylight_tzname);
- tznames = malloc(standard_len + daylight_len + 2);
+ tznames = icalmemory_new_buffer(standard_len + daylight_len + 2);
strcpy(tznames, standard_tzname);
tznames[standard_len] = '/';
strcpy(tznames + standard_len + 1, daylight_tzname);
@@ -477,7 +469,7 @@ char *icaltimezone_get_tznames_from_vtimezone(icalcomponent *component)
/* If either of the TZNAMEs was found just return that, else NULL. */
tznames = standard_tzname ? standard_tzname : daylight_tzname;
- return tznames ? strdup(tznames) : NULL;
+ return tznames ? icalmemory_strdup(tznames) : NULL;
}
}
@@ -1431,9 +1423,9 @@ static int get_offset(icaltimezone *zone)
struct tm local;
struct icaltimetype tt;
int offset;
- const time_t now = time(NULL);
+ const icaltime_t now = icaltime(NULL);
- if (!gmtime_r(&now, &local))
+ if (!icalgmtime_r(&now, &local))
return 0;
tt = tm_to_icaltimetype(&local);
@@ -1575,7 +1567,7 @@ static int parse_coord(char *coord, int len, int *degrees, int *minutes, int *se
} else if (len == 8) {
sscanf(coord + 1, "%3d%2d%2d", degrees, minutes, seconds);
} else {
- fprintf(stderr, "Invalid coordinate: %s\n", coord);
+ icalerrprintf("Invalid coordinate: %s\n", coord);
return 1;
}
@@ -1605,7 +1597,7 @@ static int fetch_lat_long_from_string(const char *str,
sptr++;
}
len = (ptrdiff_t) (sptr - temp);
- lat = (char *)malloc(len + 1);
+ lat = (char *)icalmemory_new_buffer(len + 1);
memset(lat, '\0', len + 1);
strncpy(lat, temp, len);
lat[len] = '\0';
@@ -1647,11 +1639,11 @@ static int fetch_lat_long_from_string(const char *str,
latitude_seconds) == 1 ||
parse_coord(lon, (int)strlen(lon),
longitude_degrees, longitude_minutes, longitude_seconds) == 1) {
- free(lat);
+ icalmemory_free_buffer(lat);
return 1;
}
- free(lat);
+ icalmemory_free_buffer(lat);
return 0;
}
@@ -1704,7 +1696,7 @@ static void icaltimezone_parse_zone_tab(void)
filename_len += strlen(zonetab);
filename_len += 2; /* for dir separator and final '\0' */
- filename = (char *)malloc(filename_len);
+ filename = (char *)icalmemory_new_buffer(filename_len);
if (!filename) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return;
@@ -1712,7 +1704,7 @@ static void icaltimezone_parse_zone_tab(void)
snprintf(filename, filename_len, "%s/%s", zonedir, zonetab);
fp = fopen(filename, "r");
- free(filename);
+ icalmemory_free_buffer(filename);
icalerror_assert(fp, "Cannot open the zonetab file for reading");
if (!fp) {
icalerror_set_errno(ICAL_INTERNAL_ERROR);
@@ -1732,7 +1724,7 @@ static void icaltimezone_parse_zone_tab(void)
if (sscanf(buf, "%1000s", location) != 1) { /*limit location to 1000chars */
/*increase as needed */
/*see location and buf declarations */
- fprintf(stderr, "Invalid timezone description line: %s\n", buf);
+ icalerrprintf("Invalid timezone description line: %s\n", buf);
continue;
}
} else if (sscanf(buf, "%4d%2d%2d %4d%2d%2d %1000s", /*limit location to 1000chars */
@@ -1742,7 +1734,7 @@ static void icaltimezone_parse_zone_tab(void)
&latitude_seconds,
&longitude_degrees, &longitude_minutes,
&longitude_seconds, location) != 7) {
- fprintf(stderr, "Invalid timezone description line: %s\n", buf);
+ icalerrprintf("Invalid timezone description line: %s\n", buf);
continue;
}
} else {
@@ -1751,13 +1743,13 @@ static void icaltimezone_parse_zone_tab(void)
&latitude_seconds,
&longitude_degrees, &longitude_minutes,
&longitude_seconds, location)) {
- fprintf(stderr, "Invalid timezone description line: %s\n", buf);
+ icalerrprintf("Invalid timezone description line: %s\n", buf);
continue;
}
}
icaltimezone_init(&zone);
- zone.location = strdup(location);
+ zone.location = icalmemory_strdup(location);
if (latitude_degrees >= 0) {
zone.latitude =
@@ -1803,7 +1795,7 @@ void icaltimezone_release_zone_tab(void)
builtin_timezones = NULL;
for (i = 0; i < mybuiltin_timezones->num_elements; i++) {
- free(((icaltimezone *) icalarray_element_at(mybuiltin_timezones, i))->location);
+ icalmemory_free_buffer(((icaltimezone *) icalarray_element_at(mybuiltin_timezones, i))->location);
}
icalarray_free(mybuiltin_timezones);
}
@@ -1839,7 +1831,7 @@ static void icaltimezone_load_builtin_timezone(icaltimezone *zone)
filename_len = strlen(get_zone_directory()) + strlen(zone->location) + 6;
- filename = (char *)malloc(filename_len);
+ filename = (char *)icalmemory_new_buffer(filename_len);
if (!filename) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
goto out;
@@ -1848,7 +1840,7 @@ static void icaltimezone_load_builtin_timezone(icaltimezone *zone)
snprintf(filename, filename_len, "%s/%s.ics", get_zone_directory(), zone->location);
fp = fopen(filename, "r");
- free(filename);
+ icalmemory_free_buffer(filename);
if (!fp) {
icalerror_set_errno(ICAL_FILE_ERROR);
goto out;
@@ -1856,7 +1848,7 @@ static void icaltimezone_load_builtin_timezone(icaltimezone *zone)
/* ##### B.# Sun, 11 Nov 2001 04:04:29 +1100
this is where the MALFORMEDDATA error is being set, after the call to 'icalparser_parse'
- fprintf(stderr, "** WARNING ** %s: %d %s\n",
+ icalerrprintf("** WARNING ** %s: %d %s\n",
__FILE__, __LINE__, icalerror_strerror(icalerrno));
*/
@@ -1880,11 +1872,11 @@ static void icaltimezone_load_builtin_timezone(icaltimezone *zone)
const char *tzid_prefix = icaltimezone_tzid_prefix();
new_tzid_len = strlen(tzid_prefix) + strlen(zone->location) + 1;
- new_tzid = (char *)malloc(sizeof(char) * (new_tzid_len + 1));
+ new_tzid = (char *)icalmemory_new_buffer(sizeof(char) * (new_tzid_len + 1));
if(new_tzid) {
snprintf(new_tzid, new_tzid_len, "%s%s", tzid_prefix, zone->location);
icalproperty_set_tzid(prop, new_tzid);
- free(new_tzid);
+ icalmemory_free_buffer(new_tzid);
} else {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
}
@@ -2003,7 +1995,7 @@ static void format_utc_offset(int utc_offset, char *buffer, size_t buffer_size)
hours, and daylight saving shouldn't change it by more than a few hours.
(The maximum offset is 15 hours 56 minutes at present.) */
if (hours < 0 || hours >= 24 || minutes < 0 || minutes >= 60 || seconds < 0 || seconds >= 60) {
- fprintf(stderr, "Warning: Strange timezone offset: H:%i M:%i S:%i\n",
+ icalerrprintf("Warning: Strange timezone offset: H:%i M:%i S:%i\n",
hours, minutes, seconds);
}
@@ -2139,7 +2131,7 @@ static const char *get_zone_directory(void)
zislashp1 = zislash + 1;
strcat(dirname, (char *)zislashp1);
if (stat(dirname, &st) == 0 && S_ISDIR(st.st_mode)) {
- cache = strdup(dirname);
+ cache = icalmemory_strdup(dirname);
return cache;
}
}
@@ -2154,7 +2146,7 @@ void set_zone_directory(const char *path)
if (zone_files_directory)
free_zone_directory();
- zone_files_directory = malloc(strlen(path) + 1);
+ zone_files_directory = icalmemory_new_buffer(strlen(path) + 1);
if (zone_files_directory != NULL)
strcpy(zone_files_directory, path);
@@ -2163,7 +2155,7 @@ void set_zone_directory(const char *path)
void free_zone_directory(void)
{
if (zone_files_directory != NULL) {
- free(zone_files_directory);
+ icalmemory_free_buffer(zone_files_directory);
zone_files_directory = NULL;
}
}
diff --git a/src/libical/icaltimezone.h b/src/libical/icaltimezone.h
index 90951ac4..01677150 100644
--- a/src/libical/icaltimezone.h
+++ b/src/libical/icaltimezone.h
@@ -2,18 +2,10 @@
FILE: icaltimezone.h
CREATOR: Damon Chaplin 15 March 2001
- (C) COPYRIGHT 2001, Damon Chaplin <damon@ximian.com>
+ SPDX-FileCopyrightText: 2001, Damon Chaplin <damon@ximian.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
/**
* @file icaltimezone.h
diff --git a/src/libical/icaltimezoneimpl.h b/src/libical/icaltimezoneimpl.h
index 5f869521..63725f03 100644
--- a/src/libical/icaltimezoneimpl.h
+++ b/src/libical/icaltimezoneimpl.h
@@ -2,18 +2,10 @@
FILE: icaltimezoneimpl.h
CREATOR: glenn 07 March 2010
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALTIMEZONEIMPL_H
diff --git a/src/libical/icaltypes.c b/src/libical/icaltypes.c
index 97007134..99cbb42e 100644
--- a/src/libical/icaltypes.c
+++ b/src/libical/icaltypes.c
@@ -2,18 +2,10 @@
FILE: icaltypes.c
CREATOR: eric 16 May 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
#include <config.h>
diff --git a/src/libical/icaltypes.h b/src/libical/icaltypes.h
index ea77caab..bad766b5 100644
--- a/src/libical/icaltypes.h
+++ b/src/libical/icaltypes.h
@@ -2,18 +2,10 @@
FILE: icaltypes.h
CREATOR: eric 20 March 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALTYPES_H
@@ -30,10 +22,11 @@ struct icaldatetimeperiodtype
struct icalperiodtype period;
};
+#define ICAL_GEO_LEN 16
struct icalgeotype
{
- double lat;
- double lon;
+ char lat[ICAL_GEO_LEN];
+ char lon[ICAL_GEO_LEN];
};
struct icaltriggertype
@@ -74,28 +67,6 @@ LIBICAL_ICAL_EXPORT const char *icalreqstattype_as_string(struct icalreqstattype
LIBICAL_ICAL_EXPORT char *icalreqstattype_as_string_r(struct icalreqstattype);
-struct icaltimezonephase
-{
- const char *tzname;
- int is_stdandard; /* 1 = standard tme, 0 = daylight savings time */
- struct icaltimetype dtstart;
- int offsetto;
- int tzoffsetfrom;
- const char *comment;
- struct icaldatetimeperiodtype rdate;
- const char *rrule;
-};
-
-struct icaltimezonetype
-{
- const char *tzid;
- struct icaltimetype last_mod;
- const char *tzurl;
-
- /* Array of phases. The end of the array is a phase with tzname == 0 */
- struct icaltimezonephase *phases;
-};
-
/* ical_unknown_token_handling :
* How should the ICAL library handle components, properties and parameters with
* unknown names?
diff --git a/src/libical/icaltz-util.c b/src/libical/icaltz-util.c
index 3a942e4e..4c307056 100644
--- a/src/libical/icaltz-util.c
+++ b/src/libical/icaltz-util.c
@@ -2,18 +2,9 @@
* Authors :
* Chenthill Palanisamy <pchenthill@novell.com>
*
- * Copyright 2007, Novell, Inc.
+ * SPDX-FileCopyrightText: 2007, Novell, Inc.
*
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of either:
- *
- * The LGPL as published by the Free Software Foundation, version
- * 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
- *
- * Or:
- *
- * The Mozilla Public License Version 2.0. You may obtain a copy of
- * the License at https://www.mozilla.org/MPL/
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
//krazy:excludeall=cpp
@@ -24,6 +15,7 @@
#include "icaltz-util.h"
#include "icalerror.h"
#include "icaltimezone.h"
+#include "icalmemory.h"
#include <stdlib.h>
#include <limits.h>
@@ -82,6 +74,7 @@
#define bswap_64 __builtin_bswap64
#endif
+//@cond PRIVATE
typedef struct
{
char magic[4];
@@ -95,9 +88,11 @@ typedef struct
char charcnt[4];
} tzinfo;
-static const char *zdir = NULL;
+/* fullpath to the system zoneinfo directory (where zone.tab lives) */
+static char s_zoneinfopath[MAXPATHLEN] = {0};
-static const char *search_paths[] = {
+/* A few well-known locations for system zoneinfo; can be overridden with TZDIR environment */
+static const char *s_zoneinfo_search_paths[] = {
"/usr/share/zoneinfo",
"/usr/lib/zoneinfo",
"/etc/zoneinfo",
@@ -123,9 +118,10 @@ typedef struct
typedef struct
{
- time_t transition;
+ icaltime_t transition;
long int change;
} leap;
+//@endcond
static int decode(const void *ptr)
{
@@ -186,35 +182,56 @@ static char *zname_from_stridx(char *str, size_t idx)
size = i - idx;
str += idx;
- ret = (char *)malloc(size + 1);
+ ret = (char *)icalmemory_new_buffer(size + 1);
ret = strncpy(ret, str, size);
ret[size] = '\0';
return ret;
}
-static void set_zonedir(void)
+static void set_zoneinfopath(void)
{
char file_path[MAXPATHLEN];
const char *fname = ZONES_TAB_SYSTEM_FILENAME;
- size_t i, num_search_paths;
+ size_t i, num_zi_search_paths;
+
+ /* Search for the zone.tab file in the dir specified by the TZDIR environment */
+ const char *env_tzdir = getenv("TZDIR");
+ if (env_tzdir != NULL) {
+ snprintf(file_path, MAXPATHLEN, "%s/%s", env_tzdir, fname);
+ if (!access (file_path, F_OK|R_OK)) {
+ strncpy(s_zoneinfopath, env_tzdir, MAXPATHLEN-1);
+ return;
+ }
+ }
- num_search_paths = sizeof(search_paths) / sizeof(search_paths[0]);
- for (i = 0; i < num_search_paths; i++) {
- snprintf(file_path, MAXPATHLEN, "%s/%s", search_paths[i], fname);
+ /* Else, search for zone.tab in a list of well-known locations */
+ num_zi_search_paths = sizeof(s_zoneinfo_search_paths) / sizeof(s_zoneinfo_search_paths[0]);
+ for (i = 0; i < num_zi_search_paths; i++) {
+ snprintf(file_path, MAXPATHLEN, "%s/%s", s_zoneinfo_search_paths[i], fname);
if (!access(file_path, F_OK | R_OK)) {
- zdir = search_paths[i];
+ strncpy(s_zoneinfopath, s_zoneinfo_search_paths[i], MAXPATHLEN-1);
break;
}
}
}
+void icaltzutil_set_zone_directory(const char *zonepath)
+{
+ if ((zonepath == NULL) || (zonepath[0] == '\0')) {
+ memset(s_zoneinfopath, 0, MAXPATHLEN);
+ } else {
+ strncpy(s_zoneinfopath, zonepath, MAXPATHLEN-1);
+ }
+}
+
const char *icaltzutil_get_zone_directory(void)
{
- if (!zdir)
- set_zonedir();
+ if (s_zoneinfopath[0] == '\0') {
+ set_zoneinfopath();
+ }
- return zdir;
+ return s_zoneinfopath;
}
static int calculate_pos(icaltimetype icaltime)
@@ -245,7 +262,7 @@ static char *parse_posix_zone(char *p, ttinfo *type)
size = strcspn(p, "-+0123456789,\n");
}
- type->zname = (char *) malloc(size + 1);
+ type->zname = (char *) icalmemory_new_buffer(size + 1);
strncpy(type->zname, p, size);
type->zname[size] = '\0';
p += size;
@@ -269,7 +286,7 @@ static char *parse_posix_zone(char *p, ttinfo *type)
return p;
}
-#define nth_weekday(week, day) ((day + (8 * abs(week))) * ((week < 0) ? -1 : 1))
+#define nth_weekday(week, day) (icalrecurrencetype_encode_day(day, week))
static char *parse_posix_rule(char *p,
struct icalrecurrencetype *recur, icaltimetype *t)
@@ -419,7 +436,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
const char *zonedir;
FILE *f = NULL;
char *full_path = NULL;
- time_t *transitions = NULL;
+ icaltime_t *transitions = NULL;
char *r_trans = NULL, *temp;
int *trans_idx = NULL;
ttinfo *types = NULL;
@@ -459,7 +476,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
}
size = strlen(zonedir) + strlen(location) + 2;
- full_path = (char *)malloc(size);
+ full_path = (char *)icalmemory_new_buffer(size);
if (full_path == NULL) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
goto error;
@@ -481,7 +498,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
break;
case '2':
case '3':
- if (sizeof(time_t) == 8) {
+ if (sizeof(icaltime_t) == 8) {
trans_size = 8;
}
break;
@@ -523,24 +540,24 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
}
/* read data block */
- transitions = calloc(num_trans+1, sizeof(time_t)); // +1 for TZ string
+ transitions = icalmemory_new_buffer((num_trans+1) * sizeof(icaltime_t)); // +1 for TZ string
if (transitions == NULL) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
goto error;
}
- r_trans = calloc(num_trans, (size_t)trans_size);
+ r_trans = icalmemory_new_buffer(num_trans * (size_t)trans_size);
if (r_trans == NULL) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
goto error;
}
- trans_idx = calloc(num_trans+1, sizeof(int)); // +1 for TZ string
+ trans_idx = icalmemory_new_buffer((num_trans+1) * sizeof(int)); // +1 for TZ string
if (trans_idx == NULL) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
goto error;
}
if (num_trans == 0) {
// Add one transition using time type 0 at 19011213T204552Z
- transitions[0] = (time_t)INT_MIN;
+ transitions[0] = (icaltime_t)INT_MIN;
trans_idx[0] = 0;
num_trans = 1;
} else {
@@ -549,16 +566,16 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
for (i = 0; i < num_trans; i++) {
trans_idx[i] = fgetc(f);
if (trans_size == 8) {
- transitions[i] = (time_t) decode64(r_trans);
+ transitions[i] = (icaltime_t) decode64(r_trans);
} else {
- transitions[i] = (time_t) decode(r_trans);
+ transitions[i] = (icaltime_t) decode(r_trans);
}
r_trans += trans_size;
}
r_trans = temp;
}
- types = calloc(num_types+2, sizeof(ttinfo)); // +2 for TZ string
+ types = icalmemory_new_buffer((num_types+2) * sizeof(ttinfo)); // +2 for TZ string
if (types == NULL) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
goto error;
@@ -577,7 +594,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
types[i].gmtoff = decode(a);
}
- znames = (char *)malloc(num_chars);
+ znames = (char *)icalmemory_new_buffer(num_chars);
if (znames == NULL) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
goto error;
@@ -586,7 +603,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
/* We got all the information which we need */
- leaps = calloc(num_leaps, sizeof(leap));
+ leaps = icalmemory_new_buffer(num_leaps * sizeof(leap));
if (leaps == NULL) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
goto error;
@@ -596,9 +613,9 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
EFREAD(c, (size_t)trans_size, 1, f);
if (trans_size == 8) {
- leaps[i].transition = (time_t)decode64(c);
+ leaps[i].transition = (icaltime_t)decode64(c);
} else {
- leaps[i].transition = (time_t)decode(c);
+ leaps[i].transition = (icaltime_t)decode(c);
}
EFREAD(c, 4, 1, f);
@@ -714,7 +731,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
/* Add tzid property */
size = strlen(icaltimezone_tzid_prefix()) + strlen(location) + 1;
- tzid = (char *)malloc(size);
+ tzid = (char *)icalmemory_new_buffer(size);
if (tzid == NULL) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
goto error;
@@ -731,7 +748,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
for (i = 0; i < num_trans; i++) {
int by_day = 0;
- time_t start;
+ icaltime_t start;
enum icalrecurrencetype_weekday dow = ICAL_NO_WEEKDAY;
prev_idx = idx;
@@ -890,34 +907,34 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
fclose(f);
if (full_path)
- free(full_path);
+ icalmemory_free_buffer(full_path);
if (transitions)
- free(transitions);
+ icalmemory_free_buffer(transitions);
if (r_trans)
- free(r_trans);
+ icalmemory_free_buffer(r_trans);
if (trans_idx)
- free(trans_idx);
+ icalmemory_free_buffer(trans_idx);
if (types) {
for (i = 0; i < num_types; i++) {
if (types[i].zname) {
- free(types[i].zname);
+ icalmemory_free_buffer(types[i].zname);
}
}
- free(types);
+ icalmemory_free_buffer(types);
}
if (znames)
- free(znames);
+ icalmemory_free_buffer(znames);
if (leaps)
- free(leaps);
+ icalmemory_free_buffer(leaps);
if (tzid)
- free(tzid);
+ icalmemory_free_buffer(tzid);
return tz_comp;
}
diff --git a/src/libical/icaltz-util.h b/src/libical/icaltz-util.h
index 5c1b111b..25879748 100644
--- a/src/libical/icaltz-util.h
+++ b/src/libical/icaltz-util.h
@@ -2,18 +2,9 @@
* Authors :
* Chenthill Palanisamy <pchenthill@novell.com>
*
- * Copyright 2007, Novell, Inc.
+ * SPDX-FileCopyrightText: 2007, Novell, Inc.
*
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of either:
- *
- * The LGPL as published by the Free Software Foundation, version
- * 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
- *
- * Or:
- *
- * The Mozilla Public License Version 2.0. You may obtain a copy of
- * the License at https://www.mozilla.org/MPL/
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#ifndef ICALTZUTIL_H
@@ -28,8 +19,34 @@
#define ZONES_TAB_SYSTEM_FILENAME "zone.tab"
#endif
+/**
+ * Returns the fullpath to the system zoneinfo directory (where zone.tab lives).
+ * The returned value points to static memory inside the library and should not try to be freed.
+ *
+ * If the TZDIR variable appears in the environment, it will be searched first for zone.tab.
+ * If zone.tab is not located in TZDIR (or if TZDIR is not in the environment), then a
+ * list of well-known paths where the system zone.tab typically is installed is searched.
+ */
LIBICAL_ICAL_EXPORT const char *icaltzutil_get_zone_directory(void);
-LIBICAL_ICAL_EXPORT icalcomponent *icaltzutil_fetch_timezone(const char *location);
+/**
+ * Sets the fullpath to the zoneinfo directory (zone.tab must reside in there).
+ * @param A const character string containing the fullpath to the zoneinfo directory.
+ *
+ * The internal zoneinfo path can be cleared if @p zonepath is empty or NULL.
+ * @since 3.1
+ */
+LIBICAL_ICAL_EXPORT void icaltzutil_set_zone_directory(const char *zonepath);
+
+/**
+ * Returns a pointer to a timezone icalcomponent corresponding to the specified location
+ * (a file residing in the zoneinfo).
+ *
+ * @param location is a string containing the name of a location with a timezone file
+ * found under the zoneinfo data.
+ *
+ * @since 3.1 no longer publicly accessible
+ */
+LIBICAL_ICAL_NO_EXPORT icalcomponent *icaltzutil_fetch_timezone(const char *location);
#endif
diff --git a/src/libical/icalvalue.c b/src/libical/icalvalue.c
index c18fad02..9945f02f 100644
--- a/src/libical/icalvalue.c
+++ b/src/libical/icalvalue.c
@@ -2,18 +2,9 @@
FILE: icalvalue.c
CREATOR: eric 02 May 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
Contributions from:
Graham Davison <g.m.davison@computer.org>
@@ -42,7 +33,7 @@ LIBICAL_ICAL_EXPORT struct icalvalue_impl *icalvalue_new_impl(icalvalue_kind kin
if (!icalvalue_kind_is_valid(kind))
return NULL;
- if ((v = (struct icalvalue_impl *)malloc(sizeof(struct icalvalue_impl))) == 0) {
+ if ((v = (struct icalvalue_impl *)icalmemory_new_buffer(sizeof(struct icalvalue_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
@@ -63,7 +54,7 @@ icalvalue *icalvalue_new(icalvalue_kind kind)
return (icalvalue *) icalvalue_new_impl(kind);
}
-icalvalue *icalvalue_new_clone(const icalvalue *old)
+icalvalue *icalvalue_clone(const icalvalue *old)
{
struct icalvalue_impl *new;
@@ -166,10 +157,15 @@ icalvalue *icalvalue_new_clone(const icalvalue *old)
return new;
}
+icalvalue *icalvalue_new_clone(const icalvalue *old)
+{
+ return icalvalue_clone(old);
+}
+
static char *icalmemory_strdup_and_dequote(const char *str)
{
const char *p;
- char *out = (char *)malloc(sizeof(char) * strlen(str) + 1);
+ char *out = (char *)icalmemory_new_buffer(sizeof(char) * strlen(str) + 1);
char *pout;
int wroteNull = 0;
@@ -307,6 +303,7 @@ static char *icalmemory_strdup_and_quote(const icalvalue *value, const char *unq
if ((icalproperty_isa(value->parent) == ICAL_CATEGORIES_PROPERTY) ||
(icalproperty_isa(value->parent) == ICAL_RESOURCES_PROPERTY) ||
(icalproperty_isa(value->parent) == ICAL_POLLPROPERTIES_PROPERTY) ||
+ (icalproperty_isa(value->parent) == ICAL_LOCATIONTYPE_PROPERTY) ||
(icalproperty_isa(value->parent) == ICAL_X_PROPERTY)) {
icalmemory_append_char(&str, &str_p, &buf_sz, *p);
break;
@@ -361,23 +358,20 @@ static icalvalue *icalvalue_new_enum(icalvalue_kind kind, int x_type, const char
}
/**
- * Transforms a simple float number string into a double.
+ * Extracts a simple floating point number as a substring.
* The decimal separator (if any) of the double has to be '.'
* The code is locale *independent* and does *not* change the locale.
* It should be thread safe.
- * If you want a code that does the same job with a decimal separator
- * dependent on the current locale, then use strtof() from libc.
*/
-static int simple_str_to_double(const char *from, double *result, char **to)
+static int simple_str_to_doublestr(const char *from, char *result, int result_len, char **to)
{
-#define TMP_NUM_SIZE 100
char *start = NULL, *end = NULL, *cur = (char *)from;
- char tmp_buf[TMP_NUM_SIZE + 1]; /*hack */
#if !defined(HAVE_GETNUMBERFORMAT)
struct lconv *loc_data = localeconv();
#endif
int i = 0;
+ double dtest;
/*sanity checks */
if (!from || !result) {
@@ -389,8 +383,7 @@ static int simple_str_to_double(const char *from, double *result, char **to)
cur++;
start = cur;
- /* copy the part that looks like a double into tmp_buf
- * so that we can call strtof() on it.
+ /* copy the part that looks like a double into result.
* during the copy, we give ourselves a chance to convert the '.'
* into the decimal separator of the current locale.
*/
@@ -398,33 +391,36 @@ static int simple_str_to_double(const char *from, double *result, char **to)
++cur;
}
end = cur;
- if (end - start + 1 > 100) {
+ if (end - start + 1 > result_len) {
/*huh hoh, number is too big. getting out */
return 1;
}
- memset(tmp_buf, 0, TMP_NUM_SIZE + 1);
/* copy the float number string into tmp_buf, and take
* care to have the (optional) decimal separator be the one
* of the current locale.
*/
#if !defined(HAVE_GETNUMBERFORMAT)
- for (i = 0; i < end - from; ++i) {
+ for (i = 0; i < end - start; ++i) {
if (start[i] == '.' && loc_data && loc_data->decimal_point && loc_data->decimal_point[0]
&& loc_data->decimal_point[0] != '.') {
/*replace '.' by the digit separator of the current locale */
- tmp_buf[i] = loc_data->decimal_point[0];
+ result[i] = loc_data->decimal_point[0];
} else {
- tmp_buf[i] = start[i];
+ result[i] = start[i];
}
}
#else
- GetNumberFormat(LOCALE_SYSTEM_DEFAULT, 0, start, NULL, tmp_buf, TMP_NUM_SIZE);
+ GetNumberFormat(LOCALE_SYSTEM_DEFAULT, 0, start, NULL, result, result_len);
#endif
if (to) {
*to = end;
}
- *result = atof(tmp_buf);
+
+ /* now try to convert to a floating point number, to check for validity only */
+ if (sscanf(result, "%lf", &dtest) != 1) {
+ return 1;
+ }
return 0;
}
@@ -565,7 +561,7 @@ static icalvalue *icalvalue_new_from_string_with_error(icalvalue_kind kind,
char *dequoted_str = icalmemory_strdup_and_dequote(str);
value = icalvalue_new_text(dequoted_str);
- free(dequoted_str);
+ icalmemory_free_buffer(dequoted_str);
break;
}
@@ -584,13 +580,14 @@ static icalvalue *icalvalue_new_from_string_with_error(icalvalue_kind kind,
case ICAL_GEO_VALUE:
{
char *cur = NULL;
- struct icalgeotype geo = { 0.0, 0.0 };
+ struct icalgeotype geo;
+ memset(geo.lat, 0, ICAL_GEO_LEN);
+ memset(geo.lon, 0, ICAL_GEO_LEN);
- if (simple_str_to_double(str, &geo.lat, &cur)) {
+ if (simple_str_to_doublestr(str, geo.lat, ICAL_GEO_LEN, &cur)) {
goto geo_parsing_error;
}
-
- /*skip white spaces */
+ /* skip white spaces */
while (cur && isspace((int)*cur)) {
++cur;
}
@@ -602,12 +599,12 @@ static icalvalue *icalvalue_new_from_string_with_error(icalvalue_kind kind,
++cur;
- /*skip white spaces */
+ /* skip white spaces */
while (cur && isspace((int)*cur)) {
++cur;
}
- if (simple_str_to_double(cur, &geo.lon, &cur)) {
+ if (simple_str_to_doublestr(cur, geo.lon, ICAL_GEO_LEN, &cur)) {
goto geo_parsing_error;
}
value = icalvalue_new_geo(geo);
@@ -636,7 +633,7 @@ static icalvalue *icalvalue_new_from_string_with_error(icalvalue_kind kind,
if (rt.freq != ICAL_NO_RECURRENCE) {
value = icalvalue_new_recur(rt);
}
- free(rt.rscale);
+ icalmemory_free_buffer(rt.rscale);
break;
}
@@ -723,7 +720,7 @@ static icalvalue *icalvalue_new_from_string_with_error(icalvalue_kind kind,
char *dequoted_str = icalmemory_strdup_and_dequote(str);
value = icalvalue_new_x(dequoted_str);
- free(dequoted_str);
+ icalmemory_free_buffer(dequoted_str);
}
break;
@@ -777,7 +774,7 @@ void icalvalue_free(icalvalue *v)
}
if (v->x_value != 0) {
- free(v->x_value);
+ icalmemory_free_buffer(v->x_value);
}
switch (v->kind) {
@@ -797,7 +794,7 @@ void icalvalue_free(icalvalue *v)
case ICAL_QUERY_VALUE:
{
if (v->data.v_string != 0) {
- free((void *)v->data.v_string);
+ icalmemory_free_buffer((void *)v->data.v_string);
v->data.v_string = 0;
}
break;
@@ -805,8 +802,8 @@ void icalvalue_free(icalvalue *v)
case ICAL_RECUR_VALUE:
{
if (v->data.v_recur != 0) {
- free(v->data.v_recur->rscale);
- free((void *)v->data.v_recur);
+ icalmemory_free_buffer(v->data.v_recur->rscale);
+ icalmemory_free_buffer((void *)v->data.v_recur);
v->data.v_recur = 0;
}
break;
@@ -823,7 +820,7 @@ void icalvalue_free(icalvalue *v)
v->parent = 0;
memset(&(v->data), 0, sizeof(v->data));
v->id[0] = 'X';
- free(v);
+ icalmemory_free_buffer(v);
}
int icalvalue_is_valid(const icalvalue *value)
@@ -1074,7 +1071,7 @@ static char *icalvalue_float_as_ical_string_r(const icalvalue *value)
/* bypass current locale in order to make
sure snprintf uses a '.' as a separator
set locate to 'C' and keep old locale */
- old_locale = strdup(setlocale(LC_NUMERIC, NULL));
+ old_locale = icalmemory_strdup(setlocale(LC_NUMERIC, NULL));
(void)setlocale(LC_NUMERIC, "C");
str = (char *)icalmemory_new_buffer(40);
@@ -1083,7 +1080,7 @@ static char *icalvalue_float_as_ical_string_r(const icalvalue *value)
/* restore saved locale */
(void)setlocale(LC_NUMERIC, old_locale);
- free(old_locale);
+ icalmemory_free_buffer(old_locale);
return str;
}
@@ -1101,16 +1098,16 @@ static char *icalvalue_geo_as_ical_string_r(const icalvalue *value)
/* bypass current locale in order to make
* sure snprintf uses a '.' as a separator
* set locate to 'C' and keep old locale */
- old_locale = strdup(setlocale(LC_NUMERIC, NULL));
+ old_locale = icalmemory_strdup(setlocale(LC_NUMERIC, NULL));
(void)setlocale(LC_NUMERIC, "C");
str = (char *)icalmemory_new_buffer(80);
- snprintf(str, 80, "%f;%f", data.lat, data.lon);
+ snprintf(str, 80, "%s;%s", data.lat, data.lon);
/* restore saved locale */
(void)setlocale(LC_NUMERIC, old_locale);
- free(old_locale);
+ icalmemory_free_buffer(old_locale);
return str;
}
@@ -1392,8 +1389,8 @@ icalparameter_xliccomparetype icalvalue_compare(const icalvalue *a, const icalva
temp1 = icalvalue_as_ical_string_r(a);
temp2 = icalvalue_as_ical_string_r(b);
r = strcmp(temp1, temp2);
- free(temp1);
- free(temp2);
+ icalmemory_free_buffer(temp1);
+ icalmemory_free_buffer(temp2);
if (r > 0) {
return ICAL_XLICCOMPARETYPE_GREATER;
@@ -1499,12 +1496,12 @@ int icalvalue_encode_ical_string(const char *szText, char *szEncText, int nMaxBu
if ((int)strlen(ptr) >= nMaxBufferLen) {
icalvalue_free(value);
- free(ptr);
+ icalmemory_free_buffer(ptr);
return 0;
}
strcpy(szEncText, ptr);
- free(ptr);
+ icalmemory_free_buffer(ptr);
icalvalue_free((icalvalue *) value);
diff --git a/src/libical/icalvalue.h b/src/libical/icalvalue.h
index b3f899ba..d6946dcc 100644
--- a/src/libical/icalvalue.h
+++ b/src/libical/icalvalue.h
@@ -2,23 +2,16 @@
FILE: icalvalue.h
CREATOR: eric 20 March 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALVALUE_H
#define ICALVALUE_H
+#include "libical_deprecated.h"
#include "libical_ical_export.h"
#include "icalvalueimpl.h"
@@ -29,7 +22,12 @@
LIBICAL_ICAL_EXPORT icalvalue *icalvalue_new(icalvalue_kind kind);
-LIBICAL_ICAL_EXPORT icalvalue *icalvalue_new_clone(const icalvalue *value);
+/** @brief Deeply clones an icalvalue.
+ *
+ * Returns a pointer to the memory for the newly cloned icalvalue.
+ * @since 3.1.0
+ */
+LIBICAL_ICAL_EXPORT icalvalue *icalvalue_clone(const icalvalue *value);
LIBICAL_ICAL_EXPORT icalvalue *icalvalue_new_from_string(icalvalue_kind kind, const char *str);
@@ -48,6 +46,12 @@ LIBICAL_ICAL_EXPORT int icalvalue_isa_value(void *);
LIBICAL_ICAL_EXPORT icalparameter_xliccomparetype icalvalue_compare(const icalvalue *a,
const icalvalue *b);
+/**
+ * @copydoc icalvalue_clone()
+ * @deprecated Use icalvalue_clone() instead
+ */
+LIBICAL_ICAL_EXPORT LIBICAL_DEPRECATED(icalvalue *icalvalue_new_clone(const icalvalue *value));
+
/* Special, non autogenerated value accessors */
/* Defined in icalderivedvalue.h */
diff --git a/src/libical/icalvalue_cxx.cpp b/src/libical/icalvalue_cxx.cpp
index 3aed4963..f737bd4b 100644
--- a/src/libical/icalvalue_cxx.cpp
+++ b/src/libical/icalvalue_cxx.cpp
@@ -1,18 +1,10 @@
/*======================================================================
FILE: icalvalue_cxx.cpp
CREATOR: fnguyen 12/21/01
- (C) COPYRIGHT 2001, Critical Path
+ SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -26,7 +18,7 @@ ICalValue::ICalValue() : imp(icalvalue_new(ICAL_ANY_VALUE))
{
}
-ICalValue::ICalValue(const ICalValue &v) : imp(icalvalue_new_clone(v.imp))
+ICalValue::ICalValue(const ICalValue &v) : imp(icalvalue_clone(v.imp))
{
if (imp == NULL) {
throw icalerrno;
@@ -41,7 +33,7 @@ ICalValue &ICalValue::operator=(const ICalValue &v)
if (imp != NULL) {
icalvalue_free(imp);
- imp = icalvalue_new_clone(v.imp);
+ imp = icalvalue_clone(v.imp);
if (imp == NULL) {
throw icalerrno;
}
diff --git a/src/libical/icalvalue_cxx.h b/src/libical/icalvalue_cxx.h
index 95124d59..b922debf 100644
--- a/src/libical/icalvalue_cxx.h
+++ b/src/libical/icalvalue_cxx.h
@@ -1,18 +1,10 @@
/*======================================================================
FILE: icalvalue_cxx.h
CREATOR: fnguyen 12/13/01
- (C) COPYRIGHT 2001, Critical Path
+ SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALVALUE_CXX_H
diff --git a/src/libical/icalvalueimpl.h b/src/libical/icalvalueimpl.h
index 570409bd..0cd2f65f 100644
--- a/src/libical/icalvalueimpl.h
+++ b/src/libical/icalvalueimpl.h
@@ -2,18 +2,9 @@
FILE: icalvalue.c
CREATOR: eric 02 May 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
Contributions from:
Graham Davison (g.m.davison@computer.org)
diff --git a/src/libical/icalversion.h.cmake b/src/libical/icalversion.h.cmake
index 83fa2f54..06ea6ab3 100644
--- a/src/libical/icalversion.h.cmake
+++ b/src/libical/icalversion.h.cmake
@@ -2,18 +2,10 @@
FILE: icalversion.h
CREATOR: eric 20 March 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICAL_VERSION_H
diff --git a/src/libical/icptrholder_cxx.h b/src/libical/icptrholder_cxx.h
index bd63fe5a..95b65e5c 100644
--- a/src/libical/icptrholder_cxx.h
+++ b/src/libical/icptrholder_cxx.h
@@ -25,18 +25,10 @@
* VComponentTmpPtr p;// VComponentTmpPtr is an instantiation of this template
* for (p=component.get_first_component; p!= 0; p=component.get_next_component) {
*
- * (C) COPYRIGHT 2001, Critical Path
+ * SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
*/
#ifndef ICPTRHOLDER_CXX_H
@@ -106,13 +98,13 @@ public:
T *operator->() const
{
- assert(ptr);
+ icalassert(ptr);
return ptr;
}
T &operator*()
{
- assert(ptr);
+ icalassert(ptr);
return *ptr;
}
diff --git a/src/libical/libical_deprecated.h b/src/libical/libical_deprecated.h
new file mode 100644
index 00000000..06fc28f1
--- /dev/null
+++ b/src/libical/libical_deprecated.h
@@ -0,0 +1,24 @@
+/**
+ SPDX-FileCopyrightText: Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
+
+#ifndef LIBICAL_DEPRECATED_H
+#define LIBICAL_DEPRECATED_H
+
+/* Deprecated function macro */
+#if defined(NO_DEPRECATION_WARNINGS)
+#define LIBICAL_DEPRECATED(x) x
+#else
+#if !defined(LIBICAL_DEPRECATED)
+#ifdef __GNUC__
+#define LIBICAL_DEPRECATED(x) x __attribute__((deprecated))
+#elif defined(_MSC_VER)
+#define LIBICAL_DEPRECATED(x) __declspec(deprecated) x
+#else
+#define LIBICAL_DEPRECATED(x) x
+#endif
+#endif
+#endif
+
+#endif
diff --git a/src/libical/libical_ical_export.h b/src/libical/libical_ical_export.h
index 2a2cb030..a4d7f66f 100644
--- a/src/libical/libical_ical_export.h
+++ b/src/libical/libical_ical_export.h
@@ -1,3 +1,8 @@
+/**
+ SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
+
#ifndef LIBICAL_ICAL_EXPORT_H
#define LIBICAL_ICAL_EXPORT_H
diff --git a/src/libical/pvl.c b/src/libical/pvl.c
index 960941a7..0695a342 100644
--- a/src/libical/pvl.c
+++ b/src/libical/pvl.c
@@ -2,18 +2,10 @@
FILE: pvl.c
CREATOR: eric November, 1995
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -22,6 +14,8 @@
#include "pvl.h"
+#include "icalmemory.h"
+
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
@@ -80,7 +74,7 @@ pvl_list pvl_newlist()
{
struct pvl_list_t *L;
- if ((L = (struct pvl_list_t *)malloc(sizeof(struct pvl_list_t))) == 0) {
+ if ((L = (struct pvl_list_t *)icalmemory_new_buffer(sizeof(struct pvl_list_t))) == 0) {
errno = ENOMEM;
return 0;
}
@@ -102,7 +96,7 @@ void pvl_free(pvl_list l)
pvl_clear(l);
- free(L);
+ icalmemory_free_buffer(L);
}
/**
@@ -124,7 +118,7 @@ pvl_elem pvl_new_element(void *d, pvl_elem next, pvl_elem prior)
{
struct pvl_elem_t *E;
- if ((E = (struct pvl_elem_t *)malloc(sizeof(struct pvl_elem_t))) == 0) {
+ if ((E = (struct pvl_elem_t *)icalmemory_new_buffer(sizeof(struct pvl_elem_t))) == 0) {
errno = ENOMEM;
return 0;
}
@@ -275,7 +269,7 @@ void pvl_insert_ordered(pvl_list L, pvl_comparef f, void *d)
/* badness, choke */
#if !defined(lint)
- assert(0);
+ icalassert(0);
#endif
}
@@ -384,7 +378,7 @@ void *pvl_remove(pvl_list L, pvl_elem E)
E->next = 0;
E->d = 0;
- free(E);
+ icalmemory_free_buffer(E);
return data;
}
diff --git a/src/libical/pvl.h b/src/libical/pvl.h
index 50feef16..50369ef3 100644
--- a/src/libical/pvl.h
+++ b/src/libical/pvl.h
@@ -2,18 +2,10 @@
FILE: pvl.h
CREATOR: eric November, 1995
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICAL_PVL_H
diff --git a/src/libical/qsort_gen.c b/src/libical/qsort_gen.c
new file mode 100644
index 00000000..556eb683
--- /dev/null
+++ b/src/libical/qsort_gen.c
@@ -0,0 +1,135 @@
+/*======================================================================
+ FILE: qsort_gen.c
+
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
+ The code in this file was initially authored as part of the PDCLib project
+ and placed in the public domain. The initial copyright notice was as follows:
+
+ "This file is part of the Public Domain C Library (PDCLib).
+ Permission is granted to use, modify, and / or redistribute at will.
+
+ This implementation is taken from Paul Edward's PDPCLIB.
+
+ Original code is credited to Raymond Gardner, Englewood CO.
+ Minor mods are credited to Paul Edwards.
+ Some reformatting and simplification done by Martin Baute."
+
+ Modifications have been made by Markus Minichmayr to allow more generic use.
+======================================================================*/
+
+#include <stdlib.h>
+
+/* Wrapper for _PDCLIB_memswp protects against multiple argument evaluation. */
+void qsort_gen_memswap(void *m1, void *m2, size_t size)
+{
+ char *p1 = (char *)m1;
+ char *p2 = (char *)m2;
+ char tmp;
+
+ while (size) {
+ tmp = *p1;
+ *p1 = *p2;
+ *p2 = tmp;
+ size--;
+ p1++;
+ p2++;
+ }
+}
+
+/* For small sets, insertion sort is faster than quicksort.
+ T is the threshold below which insertion sort will be used.
+ Must be 3 or larger.
+*/
+#define T 7
+
+/* Macros for handling the QSort stack */
+#define PREPARE_STACK size_t stack[STACKSIZE]; size_t* stackptr = stack
+#define PUSH(base, limit) stackptr[0] = base; stackptr[1] = limit; stackptr += 2
+#define POP(base, limit) stackptr -= 2; base = stackptr[0]; limit = stackptr[1]
+/* TODO: Stack usage is log2(nmemb) (minus what T shaves off the worst case).
+ Worst-case nmemb is platform dependent and should probably be
+ configured.
+*/
+#define STACKSIZE 64
+
+void qsort_gen(void *list, size_t nitems,
+ int(*compar)(const void *, size_t, size_t),
+ void(*swapr)(void *, size_t, size_t))
+{
+ size_t i;
+ size_t j;
+ size_t base_ = 0;
+ size_t limit = nitems;
+ PREPARE_STACK;
+
+ for (;;) {
+ if ((limit - base_) > T) { /* QSort for more than T elements. */
+ /* We work from second to last - first will be pivot element. */
+ i = base_ + 1;
+ j = limit - 1;
+ /* We swap first with middle element, then sort that with second
+ and last element so that eventually first element is the median
+ of the three - avoiding pathological pivots.
+ TODO: Instead of middle element, chose one randomly.
+ */
+ swapr(list, (limit - base_) / 2 + base_, base_);
+ if (compar(list, i, j) > 0) {
+ swapr(list, i, j);
+ }
+ if (compar(list, base_, j) > 0) {
+ swapr(list, base_, j);
+ }
+ if (compar(list, i, base_) > 0) {
+ swapr(list, i, base_);
+ }
+
+ /* Now we have the median for pivot element, entering main Quicksort. */
+ for (;;) {
+ do {
+ /* move i right until *i >= pivot */
+ i ++;
+ } while (compar(list, i, base_) < 0);
+ do {
+ /* move j left until *j <= pivot */
+ j --;
+ } while (compar(list, j, base_) > 0);
+ if (i > j) {
+ /* break loop if pointers crossed */
+ break;
+ }
+ /* else swap elements, keep scanning */
+ swapr(list, i, j);
+ }
+ /* move pivot into correct place */
+ swapr(list, base_, j);
+ /* larger subfile base / limit to stack, sort smaller */
+ if (j - base_ > limit - i) {
+ /* left is larger */
+ PUSH(base_, j);
+ base_ = i;
+ } else {
+ /* right is larger */
+ PUSH(i, limit);
+ limit = j;
+ }
+ } else {
+ /* insertion sort for less than T elements */
+ for (j = base_, i = j + 1; i < limit; j = i, i++) {
+ for (; compar(list, j, j + 1) > 0; j --) {
+ swapr(list, j, j + 1);
+ if (j == base_) {
+ break;
+ }
+ }
+ }
+ if (stackptr != stack) {
+ /* if any entries on stack */
+ POP(base_, limit);
+ } else {
+ /* else stack empty, done */
+ break;
+ }
+ }
+ }
+}
diff --git a/src/libical/qsort_gen.h b/src/libical/qsort_gen.h
new file mode 100644
index 00000000..32532127
--- /dev/null
+++ b/src/libical/qsort_gen.h
@@ -0,0 +1,45 @@
+/*======================================================================
+ FILE: qsort_gen.h
+
+ SPDX-FileCopyrightText: 2018, Markus Minichmayr <markus@tapkey.com>
+
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
+ The Initial Developer of the Original Code is Markus Minichmayr.
+======================================================================*/
+
+#ifndef QSORT_GEN_H
+#define QSORT_GEN_H
+
+/**
+ * @file qsort_gen.h
+ * @brief An implementation of qsort that is more flexible than the version
+ * provided with stdlib.
+ *
+ * In contrast to the qsort provided with stdlib, this version doesn't assume
+ * that the data to be sorted is stored in a contiguous block of memory.
+ */
+
+/**
+ * @brief Sort an arbitrary list of items using the qsort algorithm.
+ * interpreted by this function but passed to the compar and swapr functions.
+ * @param nitems The number of items in the list.
+ * @param compar The comparator function. The function receives the pointer
+ * to the list to be sorted and the indices of the elements to be compared.
+ * @param swapr The function used to swap two elements within the list. The
+ * function receives the pointer to the list to be sorted and the indices of
+ * the elements to be compared.
+ */
+void qsort_gen(void *list, size_t nitems,
+ int(*compar)(const void *, size_t, size_t),
+ void(*swapr)(void *, size_t, size_t));
+
+/**
+ * @brief Swaps two arbitrary blocks of memory.
+ * @param m1 Pointer to the first block of memory.
+ * @param m2 Pointer to the second block of memory.
+ * @param size Size of the memory blocks to be swapped.
+ */
+void qsort_gen_memswap(void *m1, void *m2, size_t size);
+
+#endif /* QSORT_GEN_H */
diff --git a/src/libical/sspm.c b/src/libical/sspm.c
index 72ebf3be..e05d22f7 100644
--- a/src/libical/sspm.c
+++ b/src/libical/sspm.c
@@ -2,29 +2,9 @@
FILE: sspm.c Parse Mime
CREATOR: eric 25 June 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
-
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Initial Developer of the Original Code is Eric Busboom
======================================================================*/
@@ -35,6 +15,8 @@
#include "sspm.h"
+#include "icalmemory.h"
+
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
@@ -136,7 +118,7 @@ static char *sspm_strdup(const char *str)
{
char *s;
- s = strdup(str);
+ s = icalmemory_strdup(str);
return s;
}
@@ -397,7 +379,7 @@ static struct sspm_action_map get_action(struct mime_impl *impl,
return sspm_action_map[i];
}
}
- assert(i < len); /*should return before now */
+ icalassert(i < len); /*should return before now */
return sspm_action_map[0];
}
@@ -426,11 +408,11 @@ static enum sspm_major_type sspm_find_major_content_type(char *type)
for (i = 0; major_content_type_map[i].type != SSPM_UNKNOWN_MAJOR_TYPE; i++) {
if (strncmp(ltype, major_content_type_map[i].str,
strlen(major_content_type_map[i].str)) == 0) {
- free(ltype);
+ icalmemory_free_buffer(ltype);
return major_content_type_map[i].type;
}
}
- free(ltype);
+ icalmemory_free_buffer(ltype);
return major_content_type_map[i].type; /* Should return SSPM_UNKNOWN_MINOR_TYPE */
}
@@ -442,7 +424,7 @@ static enum sspm_minor_type sspm_find_minor_content_type(char *type)
char *p = strchr(ltype, '/');
if (p == 0) {
- free(ltype);
+ icalmemory_free_buffer(ltype);
return SSPM_UNKNOWN_MINOR_TYPE;
}
@@ -450,12 +432,12 @@ static enum sspm_minor_type sspm_find_minor_content_type(char *type)
for (i = 0; minor_content_type_map[i].type != SSPM_UNKNOWN_MINOR_TYPE; i++) {
if (strncmp(p, minor_content_type_map[i].str, strlen(minor_content_type_map[i].str)) == 0) {
- free(ltype);
+ icalmemory_free_buffer(ltype);
return minor_content_type_map[i].type;
}
}
- free(ltype);
+ icalmemory_free_buffer(ltype);
return minor_content_type_map[i].type; /* Should return SSPM_UNKNOWN_MINOR_TYPE */
}
@@ -523,7 +505,7 @@ static void sspm_build_header(struct sspm_header *header, char *line)
char *p = strchr(val, '/');
if (header->minor_text != 0) {
- free(header->minor_text);
+ icalmemory_free_buffer(header->minor_text);
}
if (p != 0) {
p++; /* Skip the '/' */
@@ -536,7 +518,7 @@ static void sspm_build_header(struct sspm_header *header, char *line)
}
if (boundary != 0) {
if (header->boundary != 0) {
- free(header->boundary);
+ icalmemory_free_buffer(header->boundary);
}
header->boundary = sspm_strdup(boundary);
}
@@ -559,7 +541,7 @@ static void sspm_build_header(struct sspm_header *header, char *line)
header->encoding = SSPM_UNKNOWN_ENCODING;
}
- free(lencoding);
+ icalmemory_free_buffer(lencoding);
header->def = 0;
@@ -567,14 +549,13 @@ static void sspm_build_header(struct sspm_header *header, char *line)
char *cid = sspm_value(line);
if (header->content_id != 0) {
- free(header->content_id);
+ icalmemory_free_buffer(header->content_id);
}
-
header->content_id = sspm_strdup(cid);
header->def = 0;
}
- free(val);
- free(prop);
+ icalmemory_free_buffer(val);
+ icalmemory_free_buffer(prop);
}
static char *sspm_get_next_line(struct mime_impl *impl)
@@ -604,7 +585,7 @@ static void sspm_set_error(struct sspm_header *header, enum sspm_error error, ch
header->error = error;
if (header->error_text != 0) {
- free(header->error_text);
+ icalmemory_free_buffer(header->error_text);
}
header->def = 0;
@@ -653,7 +634,7 @@ static void sspm_read_header(struct mime_impl *impl, struct sspm_header *header)
impl->state = IN_HEADER;
current_line++;
- assert(strlen(buf) < TMP_BUF_SIZE);
+ icalassert(strlen(buf) < TMP_BUF_SIZE);
strncpy(header_lines[current_line], buf, TMP_BUF_SIZE);
header_lines[current_line][TMP_BUF_SIZE - 1] = '\0';
@@ -685,7 +666,7 @@ static void sspm_read_header(struct mime_impl *impl, struct sspm_header *header)
buf_start++;
}
- assert(strlen(buf_start) + strlen(last_line) < TMP_BUF_SIZE);
+ icalassert(strlen(buf_start) + strlen(last_line) < TMP_BUF_SIZE);
strncat(last_line, buf_start, TMP_BUF_SIZE - strlen(last_line) - 1);
@@ -743,8 +724,8 @@ static void sspm_make_part(struct mime_impl *impl,
sspm_set_error(header, SSPM_UNEXPECTED_BOUNDARY_ERROR, line);
/* Read until the paired terminating boundary */
- if ((boundary = (char *)malloc(strlen(line) + 5)) == 0) {
- fprintf(stderr, "Out of memory");
+ if ((boundary = (char *)icalmemory_new_buffer(strlen(line) + 5)) == 0) {
+ icalerrprintf("Out of memory");
abort();
}
strcpy(boundary, line);
@@ -755,7 +736,7 @@ static void sspm_make_part(struct mime_impl *impl,
break;
}
}
- free(boundary);
+ icalmemory_free_buffer(boundary);
break;
}
@@ -781,8 +762,8 @@ static void sspm_make_part(struct mime_impl *impl,
sspm_set_error(parent_header, SSPM_WRONG_BOUNDARY_ERROR, msg);
/* Read until the paired terminating boundary */
- if ((boundary = (char *)malloc(strlen(line) + 5)) == 0) {
- fprintf(stderr, "Out of memory");
+ if ((boundary = (char *)icalmemory_new_buffer(strlen(line) + 5)) == 0) {
+ icalerrprintf("Out of memory");
abort();
}
strcpy(boundary, line);
@@ -792,7 +773,7 @@ static void sspm_make_part(struct mime_impl *impl,
break;
}
}
- free(boundary);
+ icalmemory_free_buffer(boundary);
}
} else {
char *data = 0;
@@ -800,8 +781,8 @@ static void sspm_make_part(struct mime_impl *impl,
*size = strlen(line);
- data = (char *)malloc(*size + 2);
- assert(data != 0);
+ data = (char *)icalmemory_new_buffer(*size + 2);
+ icalassert(data != 0);
if (header->encoding == SSPM_BASE64_ENCODING) {
rtrn = decode_base64(data, line, size);
} else if (header->encoding == SSPM_QUOTED_PRINTABLE_ENCODING) {
@@ -819,7 +800,7 @@ static void sspm_make_part(struct mime_impl *impl,
action.add_line(part, header, data, *size);
- free(data);
+ icalmemory_free_buffer(data);
}
}
@@ -881,7 +862,7 @@ static void *sspm_make_multipart_subpart(struct mime_impl *impl, struct sspm_hea
while ((line = sspm_get_next_line(impl)) != 0) {
if (sspm_is_mime_boundary(line)) {
- assert(parent_header != 0);
+ icalassert(parent_header != 0);
/* Check if it is the right boundary */
if (!sspm_is_mime_terminating_boundary(line) &&
@@ -900,8 +881,8 @@ static void *sspm_make_multipart_subpart(struct mime_impl *impl, struct sspm_hea
sspm_set_error(parent_header, SSPM_WRONG_BOUNDARY_ERROR, msg);
/* Read until the paired terminating boundary */
- if ((boundary = (char *)malloc(strlen(line) + 5)) == 0) {
- fprintf(stderr, "Out of memory");
+ if ((boundary = (char *)icalmemory_new_buffer(strlen(line) + 5)) == 0) {
+ icalerrprintf("Out of memory");
abort();
}
strcpy(boundary, line);
@@ -911,7 +892,7 @@ static void *sspm_make_multipart_subpart(struct mime_impl *impl, struct sspm_hea
break;
}
}
- free(boundary);
+ icalmemory_free_buffer(boundary);
return 0;
}
@@ -1025,22 +1006,22 @@ int sspm_parse_mime(struct sspm_part *parts,
static void sspm_free_header(struct sspm_header *header)
{
if (header->boundary != 0) {
- free(header->boundary);
+ icalmemory_free_buffer(header->boundary);
}
if (header->minor_text != 0) {
- free(header->minor_text);
+ icalmemory_free_buffer(header->minor_text);
}
if (header->charset != 0) {
- free(header->charset);
+ icalmemory_free_buffer(header->charset);
}
if (header->filename != 0) {
- free(header->filename);
+ icalmemory_free_buffer(header->filename);
}
if (header->content_id != 0) {
- free(header->content_id);
+ icalmemory_free_buffer(header->content_id);
}
if (header->error_text != 0) {
- free(header->error_text);
+ icalmemory_free_buffer(header->error_text);
}
}
@@ -1143,7 +1124,7 @@ char *decode_base64(char *dest, char *src, size_t *size)
cc = -1;
}
- assert(cc < 64);
+ icalassert(cc < 64);
/* If we've reached the end, fill the remaining slots in
the bucket and do a final conversion */
@@ -1227,7 +1208,7 @@ static void sspm_append_char(struct sspm_buffer *buf, char ch)
buf->buf_size = (buf->buf_size) * 2 + final_length + 1;
- new_buf = realloc(buf->buffer, buf->buf_size);
+ new_buf = icalmemory_resize_buffer(buf->buffer, buf->buf_size);
new_pos = (void *)((size_t) new_buf + data_length);
@@ -1256,7 +1237,7 @@ void sspm_append_string(struct sspm_buffer *buf, const char *string)
buf->buf_size = (buf->buf_size) * 2 + final_length;
- new_buf = realloc(buf->buffer, buf->buf_size);
+ new_buf = icalmemory_resize_buffer(buf->buffer, buf->buf_size);
new_pos = (void *)((size_t) new_buf + data_length);
@@ -1351,7 +1332,7 @@ static void sspm_write_base64(struct sspm_buffer *buf, char *inbuf, int size)
break;
default:
- assert(0);
+ icalassert(0);
}
for (i = 0; i < 4; i++) {
@@ -1386,7 +1367,7 @@ static void sspm_encode_base64(struct sspm_buffer *buf, char *data, size_t size)
inbuf[0] = inbuf[1] = inbuf[2] = 0;
}
- assert(lpos % 4 == 0);
+ icalassert(lpos % 4 == 0);
if (lpos == 72) {
sspm_append_string(buf, "\n");
@@ -1424,7 +1405,7 @@ static void sspm_write_header(struct sspm_buffer *buf, struct sspm_header *heade
minor = sspm_minor_type_string(header->minor);
if (header->minor == SSPM_UNKNOWN_MINOR_TYPE) {
- assert(header->minor_text != 0);
+ icalassert(header->minor_text != 0);
minor = header->minor_text;
}
@@ -1472,7 +1453,7 @@ static void sspm_write_part(struct sspm_buffer *buf, struct sspm_part *part, int
}
if (part->header.encoding == SSPM_BASE64_ENCODING) {
- assert(part->data_size != 0);
+ icalassert(part->data_size != 0);
sspm_encode_base64(buf, part->data, part->data_size);
} else if (part->header.encoding == SSPM_QUOTED_PRINTABLE_ENCODING) {
sspm_encode_quoted_printable(buf, part->data);
@@ -1500,7 +1481,7 @@ static void sspm_write_multipart_part(struct sspm_buffer *buf,
while (parts[*part_num].header.major != SSPM_NO_MAJOR_TYPE && level == parent_level + 1) {
- assert(header->boundary != NULL);
+ icalassert(header->boundary != NULL);
sspm_append_string(buf, header->boundary);
sspm_append_char(buf, '\n');
@@ -1530,7 +1511,7 @@ int sspm_write_mime(struct sspm_part *parts, size_t num_parts,
_unused(num_parts);
- buf.buffer = malloc(4096);
+ buf.buffer = icalmemory_new_buffer(4096);
buf.buffer[0] = '\0';
buf.pos = buf.buffer;
buf.buf_size = 10;
diff --git a/src/libical/sspm.h b/src/libical/sspm.h
index 6a98e812..0247babe 100644
--- a/src/libical/sspm.h
+++ b/src/libical/sspm.h
@@ -2,31 +2,11 @@
FILE: sspm.h Mime Parser
CREATOR: eric 25 June 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
-
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
-
- The Initial Developer of the Original Code is Eric Busboom
+ The Initial Developer of the Original Code is Eric Busboom
======================================================================*/
#ifndef ICAL_SSPM_H
diff --git a/src/libical/vcomponent_cxx.cpp b/src/libical/vcomponent_cxx.cpp
index bdf2a78d..0b42145c 100644
--- a/src/libical/vcomponent_cxx.cpp
+++ b/src/libical/vcomponent_cxx.cpp
@@ -3,18 +3,10 @@
* @author fnguyen (12/10/01)
* @brief Implementation of C++ Wrapper for icalcomponent.c
*
- * (C) COPYRIGHT 2001, Critical Path
+ * SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
*/
#ifdef HAVE_CONFIG_H
@@ -37,7 +29,7 @@ VComponent::VComponent() : imp(icalcomponent_new(ICAL_ANY_COMPONENT))
{
}
-VComponent::VComponent(const VComponent &v) : imp(icalcomponent_new_clone(v.imp))
+VComponent::VComponent(const VComponent &v) : imp(icalcomponent_clone(v.imp))
{
if (imp == NULL) {
throw icalerrno;
@@ -52,7 +44,7 @@ VComponent &VComponent::operator=(const VComponent &v)
if (imp != NULL) {
icalcomponent_free(imp);
- imp = icalcomponent_new_clone(v.imp);
+ imp = icalcomponent_clone(v.imp);
if (imp == NULL) {
throw icalerrno;
}
diff --git a/src/libical/vcomponent_cxx.h b/src/libical/vcomponent_cxx.h
index 62c065c8..677d7568 100644
--- a/src/libical/vcomponent_cxx.h
+++ b/src/libical/vcomponent_cxx.h
@@ -3,18 +3,10 @@
* @author fnguyen (12/10/01)
* @brief C++ classes for the icalcomponent wrapper (VToDo VEvent, etc..).
*
- * (C) COPYRIGHT 2001, Critical Path
+ * SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
*/
#ifndef ICAL_VCOMPONENT_CXX_H
diff --git a/src/libicalss/CMakeLists.txt b/src/libicalss/CMakeLists.txt
index 7857cb56..1982ddc8 100644
--- a/src/libicalss/CMakeLists.txt
+++ b/src/libicalss/CMakeLists.txt
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
add_definitions(-Dlibical_icalss_EXPORTS)
include_directories(
@@ -22,6 +25,7 @@ endif()
add_custom_target(
icalss-header ALL
DEPENDS ${CMAKE_BINARY_DIR}/src/libicalss/icalss.h
+ COMMENT "Target to generate the aggregate libicalss header"
)
########### next target ###############
@@ -75,6 +79,7 @@ add_custom_command(
-DBDB_FOUND=${BDB_FOUND}
-P ${CMAKE_CURRENT_SOURCE_DIR}/icalss_file.cmake
DEPENDS ${icalss_LIB_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/icalss_file.cmake
+ COMMENT "Generate the aggregate libicalss header"
)
add_library(icalss ${LIBRARY_TYPE} ${icalss_LIB_SRCS})
@@ -144,7 +149,10 @@ if(WITH_CXX_BINDINGS)
add_library(icalss_cxx-static ALIAS icalss_cxx)
endif()
- target_link_libraries(icalss_cxx icalss ical_cxx ${CMAKE_THREAD_LIBS_INIT})
+ target_link_libraries(icalss_cxx icalss ical_cxx)
+ if(DEFINED CMAKE_THREAD_LIBS_INIT)
+ target_link_libraries(icalss_cxx ${CMAKE_THREAD_LIBS_INIT})
+ endif()
if(MSVC)
set_target_properties(icalss_cxx PROPERTIES PREFIX "lib")
diff --git a/src/libicalss/icalbdbset.c b/src/libicalss/icalbdbset.c
index 9066311f..76216847 100644
--- a/src/libicalss/icalbdbset.c
+++ b/src/libicalss/icalbdbset.c
@@ -1,18 +1,10 @@
/*======================================================================
FILE: icalbdbset.c
- (C) COPYRIGHT 2001, Critical Path
+ SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
diff --git a/src/libicalss/icalbdbset.h b/src/libicalss/icalbdbset.h
index 1fe2e2cf..079ae393 100644
--- a/src/libicalss/icalbdbset.h
+++ b/src/libicalss/icalbdbset.h
@@ -1,18 +1,10 @@
/*======================================================================
FILE: icalbdbset.h
- (C) COPYRIGHT 2001, Critical Path
+ SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALBDBSET_H
diff --git a/src/libicalss/icalbdbset_cxx.h b/src/libicalss/icalbdbset_cxx.h
index 976d0d2f..1f676b89 100644
--- a/src/libicalss/icalbdbset_cxx.h
+++ b/src/libicalss/icalbdbset_cxx.h
@@ -3,18 +3,9 @@
* @author dml 12/12/01
* @brief Definition of C++ Wrapper for icalbdbset.c
*
- * (C) COPYRIGHT 2001, Critical Path
+ * SPDX-FileCopyrightText: 2001, Critical Path
*
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of either:
- *
- * The LGPL as published by the Free Software Foundation, version
- * 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
- *
- * Or:
- *
- * The Mozilla Public License Version 2.0. You may obtain a copy of
- * the License at https://www.mozilla.org/MPL/
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#ifndef ICALBDBSET_CXX_H
diff --git a/src/libicalss/icalbdbsetimpl.h b/src/libicalss/icalbdbsetimpl.h
index a5a60a47..a88df55e 100644
--- a/src/libicalss/icalbdbsetimpl.h
+++ b/src/libicalss/icalbdbsetimpl.h
@@ -1,18 +1,10 @@
/*======================================================================
FILE: icalbdbsetimpl.h
- (C) COPYRIGHT 2001, Critical Path
+ SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALBDBSETIMPL_H
diff --git a/src/libicalss/icalcalendar.c b/src/libicalss/icalcalendar.c
index 5d50f121..61130efd 100644
--- a/src/libicalss/icalcalendar.c
+++ b/src/libicalss/icalcalendar.c
@@ -2,18 +2,10 @@
FILE: icalcalendar.c
CREATOR: eric 23 December 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
diff --git a/src/libicalss/icalcalendar.h b/src/libicalss/icalcalendar.h
index ac424be0..4cf005cc 100644
--- a/src/libicalss/icalcalendar.h
+++ b/src/libicalss/icalcalendar.h
@@ -2,18 +2,9 @@
FILE: icalcalendar.h
CREATOR: eric 23 December 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libicalss/icalclassify.c b/src/libicalss/icalclassify.c
index 55f28a11..7450d8d1 100644
--- a/src/libicalss/icalclassify.c
+++ b/src/libicalss/icalclassify.c
@@ -2,18 +2,10 @@
FILE: icalclassify.c
CREATOR: ebusboom 23 aug 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -49,7 +41,7 @@ char *icalclassify_lowercase(const char *str)
return 0;
}
- xnew = icalmemory_strdup(str);
+ xnew = strdup(str);
for (p = xnew; *p != 0; p++) {
*p = tolower((int)*p);
}
@@ -89,7 +81,7 @@ icalcomponent *icalclassify_find_overlaps(icalset *set, icalcomponent *comp)
if (compspan.start < span.end && compspan.end > span.start) {
- icalcomponent *clone = icalcomponent_new_clone(c);
+ icalcomponent *clone = icalcomponent_clone(c);
icalcomponent_add_component(return_set, clone);
}
@@ -292,8 +284,8 @@ int icalssutil_is_rescheduled(icalcomponent *a, icalcomponent *b)
temp1 = icalproperty_as_ical_string_r(p1);
temp2 = icalproperty_as_ical_string_r(p2);
cmp = strcmp(temp1, temp2);
- free(temp1);
- free(temp2);
+ icalmemory_free_buffer(temp1);
+ icalmemory_free_buffer(temp2);
if (p1 && cmp != 0) {
return 1;
diff --git a/src/libicalss/icalclassify.h b/src/libicalss/icalclassify.h
index 04b1e237..1d39a057 100644
--- a/src/libicalss/icalclassify.h
+++ b/src/libicalss/icalclassify.h
@@ -2,18 +2,10 @@
FILE: icalclassify.h
CREATOR: eric 21 Aug 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
=========================================================================*/
#ifndef ICALCLASSIFY_H
diff --git a/src/libicalss/icalcluster.c b/src/libicalss/icalcluster.c
index 06597fbb..27861fe8 100644
--- a/src/libicalss/icalcluster.c
+++ b/src/libicalss/icalcluster.c
@@ -2,18 +2,10 @@
FILE: icalcluster.c
CREATOR: acampi 13 March 2002
- Copyright (C) 2002 Andrea Campi <a.campi@inet.it>
+ SPDX-FileCopyrightText: 2002 Andrea Campi <a.campi@inet.it>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
/**
@@ -51,12 +43,6 @@ static icalcluster *icalcluster_new_impl(void)
return impl;
}
-/**
- * @brief Create a cluster with a key/value pair.
- *
- * @todo Always do a deep copy.
- */
-
icalcluster *icalcluster_new(const char *key, icalcomponent *data)
{
struct icalcluster_impl *impl = icalcluster_new_impl();
@@ -72,7 +58,7 @@ icalcluster *icalcluster_new(const char *key, icalcomponent *data)
impl->data = icalcomponent_new(ICAL_XROOT_COMPONENT);
icalcomponent_add_component(impl->data, data);
} else {
- impl->data = icalcomponent_new_clone(data);
+ impl->data = icalcomponent_clone(data);
}
} else {
impl->data = icalcomponent_new(ICAL_XROOT_COMPONENT);
@@ -85,18 +71,23 @@ icalcluster *icalcluster_new(const char *key, icalcomponent *data)
* @brief Deep clone an icalcluster to a new one
*/
-icalcluster *icalcluster_new_clone(const icalcluster *data)
+icalcluster *icalcluster_clone(const icalcluster *data)
{
struct icalcluster_impl *old = (struct icalcluster_impl *)data;
struct icalcluster_impl *impl = icalcluster_new_impl();
impl->key = strdup(old->key);
- impl->data = icalcomponent_new_clone(old->data);
+ impl->data = icalcomponent_clone(old->data);
impl->changed = 0;
return impl;
}
+icalcluster *icalcluster_new_clone(const icalcluster *data)
+{
+ return icalcluster_clone(data);
+}
+
void icalcluster_free(icalcluster *impl)
{
icalerror_check_arg_rv((impl != 0), "cluster");
diff --git a/src/libicalss/icalcluster.h b/src/libicalss/icalcluster.h
index c5d2e960..31195bb0 100644
--- a/src/libicalss/icalcluster.h
+++ b/src/libicalss/icalcluster.h
@@ -2,32 +2,35 @@
FILE: icalcluster.h
CREATOR: acampi 13 March 2002
- Copyright (C) 2002 Andrea Campi <a.campi@inet.it>
+ SPDX-FileCopyrightText: 2002 Andrea Campi <a.campi@inet.it>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALCLUSTER_H
#define ICALCLUSTER_H
+#include "libical_deprecated.h"
#include "libical_icalss_export.h"
#include "icalcomponent.h"
#include "icalerror.h"
typedef struct icalcluster_impl icalcluster;
+/**
+ * @brief Create a cluster with a key/value pair.
+ *
+ * @todo Always do a deep copy.
+ */
LIBICAL_ICALSS_EXPORT icalcluster *icalcluster_new(const char *key, icalcomponent *data);
-LIBICAL_ICALSS_EXPORT icalcluster *icalcluster_new_clone(const icalcluster *cluster);
+/**
+ * Deeply clone an icalcluster.
+ * Returns a pointer to the memory for the newly cloned icalcluster.
+ * @since 3.1.0
+*/
+LIBICAL_ICALSS_EXPORT icalcluster *icalcluster_clone(const icalcluster *cluster);
LIBICAL_ICALSS_EXPORT void icalcluster_free(icalcluster *cluster);
@@ -56,4 +59,11 @@ LIBICAL_ICALSS_EXPORT icalcomponent *icalcluster_get_first_component(icalcluster
LIBICAL_ICALSS_EXPORT icalcomponent *icalcluster_get_next_component(icalcluster *cluster);
+/**
+ * @copydoc icalcluster_clone()
+ * @deprecated use icalcluster_clone() instead
+ */
+LIBICAL_ICALSS_EXPORT LIBICAL_DEPRECATED(icalcluster *icalcluster_new_clone(
+ const icalcluster *cluster));
+
#endif /* !ICALCLUSTER_H */
diff --git a/src/libicalss/icalclusterimpl.h b/src/libicalss/icalclusterimpl.h
index e0cea3dd..642827fd 100644
--- a/src/libicalss/icalclusterimpl.h
+++ b/src/libicalss/icalclusterimpl.h
@@ -2,18 +2,10 @@
FILE: icalfilesetimpl.h
CREATOR: acampi 13 March 2002
- Copyright (C) 2002 Andrea Campi <a.campi@inet.it>
+ SPDX-FileCopyrightText: 2002 Andrea Campi <a.campi@inet.it>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALCLUSTERIMPL_H
diff --git a/src/libicalss/icaldirset.c b/src/libicalss/icaldirset.c
index 02c08667..eecf22e4 100644
--- a/src/libicalss/icaldirset.c
+++ b/src/libicalss/icaldirset.c
@@ -3,18 +3,9 @@
FILE: icaldirset.c
CREATOR: eric 28 November 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libicalss/icaldirset.h b/src/libicalss/icaldirset.h
index d3c3e35e..edab10e2 100644
--- a/src/libicalss/icaldirset.h
+++ b/src/libicalss/icaldirset.h
@@ -2,18 +2,9 @@
FILE: icaldirset.h
CREATOR: eric 28 November 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libicalss/icaldirsetimpl.h b/src/libicalss/icaldirsetimpl.h
index 800e987d..2c0f5ecf 100644
--- a/src/libicalss/icaldirsetimpl.h
+++ b/src/libicalss/icaldirsetimpl.h
@@ -2,18 +2,9 @@
FILE: icaldirsetimpl.h
CREATOR: eric 21 Aug 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libicalss/icalfileset.c b/src/libicalss/icalfileset.c
index 57e787c5..2778025c 100644
--- a/src/libicalss/icalfileset.c
+++ b/src/libicalss/icalfileset.c
@@ -2,18 +2,9 @@
FILE: icalfileset.c
CREATOR: eric 23 December 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
@@ -27,6 +18,7 @@
#include "icalfilesetimpl.h"
#include "icalparser.h"
#include "icalvalue.h"
+#include "icalmemory.h"
#include <errno.h>
#include <stdlib.h>
@@ -112,7 +104,7 @@ icalset *icalfileset_init(icalset *set, const char *path, void *options_in)
}
if (options->cluster) {
- fset->cluster = icalcomponent_new_clone(icalcluster_get_component(options->cluster));
+ fset->cluster = icalcomponent_clone(icalcluster_get_component(options->cluster));
fset->changed = 1;
}
@@ -397,11 +389,11 @@ icalerrorenum icalfileset_commit(icalset *set)
if (sz != (IO_SSIZE_T) strlen(str)) {
perror("write");
icalerror_set_errno(ICAL_FILE_ERROR);
- free(str);
+ icalmemory_free_buffer(str);
return ICAL_FILE_ERROR;
}
- free(str);
+ icalmemory_free_buffer(str);
write_size += sz;
}
diff --git a/src/libicalss/icalfileset.h b/src/libicalss/icalfileset.h
index 23060e34..04de522d 100644
--- a/src/libicalss/icalfileset.h
+++ b/src/libicalss/icalfileset.h
@@ -2,18 +2,9 @@
FILE: icalfileset.h
CREATOR: eric 23 December 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libicalss/icalfilesetimpl.h b/src/libicalss/icalfilesetimpl.h
index 6d7ffeab..b2bb72e2 100644
--- a/src/libicalss/icalfilesetimpl.h
+++ b/src/libicalss/icalfilesetimpl.h
@@ -2,18 +2,9 @@
FILE: icalfilesetimpl.h
CREATOR: eric 23 December 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libicalss/icalgauge.c b/src/libicalss/icalgauge.c
index 101254f6..0bafb05d 100644
--- a/src/libicalss/icalgauge.c
+++ b/src/libicalss/icalgauge.c
@@ -2,18 +2,9 @@
FILE: icalgauge.c
CREATOR: eric 23 December 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libicalss/icalgauge.h b/src/libicalss/icalgauge.h
index be6c7440..ee07952a 100644
--- a/src/libicalss/icalgauge.h
+++ b/src/libicalss/icalgauge.h
@@ -2,18 +2,9 @@
FILE: icalgauge.h
CREATOR: eric 23 December 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libicalss/icalgaugeimpl.h b/src/libicalss/icalgaugeimpl.h
index 3b07240e..a9423162 100644
--- a/src/libicalss/icalgaugeimpl.h
+++ b/src/libicalss/icalgaugeimpl.h
@@ -2,18 +2,10 @@
FILE: icalgaugeimpl.h
CREATOR: eric 09 Aug 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALGAUGEIMPL_H
diff --git a/src/libicalss/icalmessage.c b/src/libicalss/icalmessage.c
index 59f844c4..2a818f06 100644
--- a/src/libicalss/icalmessage.c
+++ b/src/libicalss/icalmessage.c
@@ -2,18 +2,10 @@
FILE: icalmessage.c
CREATOR: ebusboom 07 Nov 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -22,7 +14,6 @@
#include "icalmessage.h"
#include "icalerror.h"
-#include "icalmemory.h"
#include "icalversion.h" /* for ICAL_PACKAGE, ICAL_VERSION */
#include <ctype.h>
@@ -46,7 +37,7 @@ static char *lowercase(const char *str)
return 0;
}
- n = icalmemory_strdup(str);
+ n = strdup(str);
for (p = n; *p != 0; p++) {
*p = tolower((int)*p);
@@ -100,7 +91,7 @@ static void icalmessage_copy_properties(icalcomponent *to, icalcomponent *from,
icalcomponent_add_property(
to_inner,
- icalproperty_new_clone(icalcomponent_get_first_property(from_inner, kind)));
+ icalproperty_clone(icalcomponent_get_first_property(from_inner, kind)));
}
static icalcomponent *icalmessage_new_reply_base(icalcomponent *c,
@@ -144,7 +135,7 @@ static icalcomponent *icalmessage_new_reply_base(icalcomponent *c,
return 0;
}
- icalcomponent_add_property(inner, icalproperty_new_clone(attendee));
+ icalcomponent_add_property(inner, icalproperty_clone(attendee));
/* Add PRODID and VERSION */
@@ -309,7 +300,7 @@ icalcomponent *icalmessage_new_error_reply(icalcomponent *c,
for (p = icalcomponent_get_first_property(cinner, ICAL_REQUESTSTATUS_PROPERTY);
p != 0;
p = icalcomponent_get_next_property(cinner, ICAL_REQUESTSTATUS_PROPERTY)) {
- icalcomponent_add_property(inner, icalproperty_new_clone(p));
+ icalcomponent_add_property(inner, icalproperty_clone(p));
}
}
diff --git a/src/libicalss/icalmessage.h b/src/libicalss/icalmessage.h
index 7ec629bf..20aee462 100644
--- a/src/libicalss/icalmessage.h
+++ b/src/libicalss/icalmessage.h
@@ -2,18 +2,10 @@
FILE: icalmessage.h
CREATOR: eric 07 Nov 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
=========================================================================*/
#ifndef ICALMESSAGE_H
diff --git a/src/libicalss/icalset.c b/src/libicalss/icalset.c
index 674e05b4..b98f233f 100644
--- a/src/libicalss/icalset.c
+++ b/src/libicalss/icalset.c
@@ -2,7 +2,7 @@
FILE: icalset.c
CREATOR: eric 17 Jul 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
Icalset is the "base class" for representations of a collection of
iCal components. Derived classes (actually delegates) include:
@@ -12,16 +12,7 @@
icalheapset Store components on the heap
icalmysqlset Store components in a mysql database.
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libicalss/icalset.h b/src/libicalss/icalset.h
index 23e677d8..00011e35 100644
--- a/src/libicalss/icalset.h
+++ b/src/libicalss/icalset.h
@@ -14,18 +14,9 @@
/*
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/libicalss/icalspanlist.c b/src/libicalss/icalspanlist.c
index e697d948..027777c8 100644
--- a/src/libicalss/icalspanlist.c
+++ b/src/libicalss/icalspanlist.c
@@ -2,18 +2,10 @@
FILE: icalspanlist.c
CREATOR: ebusboom 23 aug 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -215,8 +207,8 @@ void icalspanlist_dump(icalspanlist *sl)
for (itr = pvl_head(sl->spans); itr != 0; itr = pvl_next(itr)) {
struct icaltime_span *s = (struct icaltime_span *)pvl_data(itr);
if (s) {
- printf("#%02d %d start: %s", ++i, s->is_busy, ctime(&s->start));
- printf(" end : %s", ctime(&s->end));
+ printf("#%02d %d start: %s", ++i, s->is_busy, icalctime(&s->start));
+ printf(" end : %s", icalctime(&s->end));
}
}
}
@@ -229,7 +221,7 @@ struct icalperiodtype icalspanlist_next_free_time(icalspanlist *sl, struct icalt
struct icalperiodtype period;
struct icaltime_span *s;
- time_t rangett = icaltime_as_timet(t);
+ icaltime_t rangett = icaltime_as_timet(t);
period.start = icaltime_null_time();
period.end = icaltime_null_time();
@@ -290,17 +282,17 @@ struct icalperiodtype icalspanlist_next_free_time(icalspanlist *sl, struct icalt
int *icalspanlist_as_freebusy_matrix(icalspanlist *sl, int delta_t)
{
pvl_elem itr;
- time_t spanduration_secs;
+ icaltime_t spanduration_secs;
int *matrix;
- time_t matrix_slots;
- time_t sl_start, sl_end;
+ icaltime_t matrix_slots;
+ icaltime_t sl_start, sl_end;
icalerror_check_arg_rz((sl != 0), "spanlist");
if (!delta_t)
delta_t = 3600;
- /* calculate the start and end time as time_t **/
+ /* calculate the start and end time as icaltime_t **/
sl_start = icaltime_as_timet_with_zone(sl->start, icaltimezone_get_utc_timezone());
sl_end = icaltime_as_timet_with_zone(sl->end, icaltimezone_get_utc_timezone());
@@ -333,9 +325,9 @@ int *icalspanlist_as_freebusy_matrix(icalspanlist *sl, int delta_t)
struct icaltime_span *s = (struct icaltime_span *)pvl_data(itr);
if (s && s->is_busy == 1) {
- time_t offset_start = s->start / delta_t - sl_start / delta_t;
- time_t offset_end = (s->end - 1) / delta_t - sl_start / delta_t + 1;
- time_t i;
+ icaltime_t offset_start = s->start / delta_t - sl_start / delta_t;
+ icaltime_t offset_end = (s->end - 1) / delta_t - sl_start / delta_t + 1;
+ icaltime_t i;
if (offset_end >= matrix_slots)
offset_end = matrix_slots - 1;
@@ -448,7 +440,7 @@ icalspanlist *icalspanlist_from_vfreebusy(icalcomponent *comp)
period = icalproperty_get_freebusy(prop);
s->start = icaltime_as_timet_with_zone(period.start, icaltimezone_get_utc_timezone());
s->end = icaltime_as_timet_with_zone(period.end, icaltimezone_get_utc_timezone());
- ;
+
pvl_insert_ordered(sl->spans, compare_span, (void *)s);
}
/** @todo calculate start/end limits.. fill in holes? **/
diff --git a/src/libicalss/icalspanlist.h b/src/libicalss/icalspanlist.h
index fb817ef7..edd43605 100644
--- a/src/libicalss/icalspanlist.h
+++ b/src/libicalss/icalspanlist.h
@@ -2,18 +2,10 @@
FILE: icalspanlist.h
CREATOR: eric 21 Aug 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
=========================================================================*/
#ifndef ICALSPANLIST_H
#define ICALSPANLIST_H
diff --git a/src/libicalss/icalspanlist_cxx.cpp b/src/libicalss/icalspanlist_cxx.cpp
index 4f72eb50..00967518 100644
--- a/src/libicalss/icalspanlist_cxx.cpp
+++ b/src/libicalss/icalspanlist_cxx.cpp
@@ -4,18 +4,10 @@
* @brief C++ class wrapping the icalspanlist data structure
*
- (C) COPYRIGHT 2001, Critical Path
+ SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
*/
#include "icalspanlist_cxx.h"
diff --git a/src/libicalss/icalspanlist_cxx.h b/src/libicalss/icalspanlist_cxx.h
index 1698133e..775a6d9f 100644
--- a/src/libicalss/icalspanlist_cxx.h
+++ b/src/libicalss/icalspanlist_cxx.h
@@ -3,18 +3,9 @@
* @author Critical Path
* @brief C++ class wrapping the icalspanlist data structure
*
- * (C) COPYRIGHT 2001, Critical Path
+ * SPDX-FileCopyrightText: 2001, Critical Path
*
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of either:
- *
- * The LGPL as published by the Free Software Foundation, version
- * 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
- *
- * Or:
- *
- * The Mozilla Public License Version 2.0. You may obtain a copy of
- * the License at https://www.mozilla.org/MPL/
+ * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#ifndef ICALSPANLIST_CXX_H
diff --git a/src/libicalss/icalss_file.cmake b/src/libicalss/icalss_file.cmake
index df105627..8983e380 100644
--- a/src/libicalss/icalss_file.cmake
+++ b/src/libicalss/icalss_file.cmake
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
# ORDERING OF HEADERS IS SIGNIFICANT. Don't change this ordering.
# It is required to make the combined header icalss.h properly.
set(COMBINEDHEADERSICALSS
diff --git a/src/libicalss/icalsslexer.c b/src/libicalss/icalsslexer.c
index f889016c..e62e51db 100644
--- a/src/libicalss/icalsslexer.c
+++ b/src/libicalss/icalsslexer.c
@@ -1,4 +1,7 @@
-
+/**
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
#define YY_INT_ALIGNED short int
@@ -406,7 +409,7 @@ static yyconst flex_int16_t yy_accept[56] =
6, 11, 21, 21, 14, 21, 21, 13, 21, 21,
20, 12, 21, 15, 21, 21, 21, 2, 16, 21,
21, 21, 3, 1, 0
- } ;
+ };
static yyconst flex_int32_t yy_ec[256] =
{ 0,
@@ -535,18 +538,12 @@ char *yytext_ptr;
FILE: icalsslexer.l
CREATOR: eric 8 Aug 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
This program is free software; you can redistribute it and/or modify
- it under the terms of either:
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
- Or:
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
@@ -556,8 +553,6 @@ char *yytext_ptr;
#include "icalssyacc.h"
#include "icalmemory.h"
-#include <string.h> /* For strdup() */
-
const char* input_buffer;
const char* input_buffer_p;
diff --git a/src/libicalss/icalsslexer.l b/src/libicalss/icalsslexer.l
index 57d5ef58..310406f5 100644
--- a/src/libicalss/icalsslexer.l
+++ b/src/libicalss/icalsslexer.l
@@ -4,18 +4,9 @@
FILE: icalsslexer.l
CREATOR: eric 8 Aug 2000
-(C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
@@ -26,8 +17,6 @@
#include "icalgaugeimpl.h"
#include "assert.h"
-#include <string.h> /* For strdup() */
-
const char* input_buffer;
const char* input_buffer_p;
diff --git a/src/libicalss/icalssyacc.c b/src/libicalss/icalssyacc.c
index 75c383c7..29d7e6a3 100644
--- a/src/libicalss/icalssyacc.c
+++ b/src/libicalss/icalssyacc.c
@@ -2,8 +2,8 @@
/* Skeleton implementation for Bison's Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ SPDX-FileCopyrightText: 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
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
@@ -125,18 +125,12 @@
/* FILE: icalssyacc.y */
/* CREATOR: eric 08 Aug 2000 */
/* */
-/* (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com> */
+/* SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com> */
/* */
/* This program is free software; you can redistribute it and/or modify */
-/* it under the terms of either: */
/* */
-/* The LGPL as published by the Free Software Foundation, version */
-/* 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html */
/* */
-/* Or: */
/* */
-/* The Mozilla Public License Version 2.0. You may obtain a copy of */
-/* the License at https://www.mozilla.org/MPL/ */
/* */
/* The Original Code is eric. The Initial Developer of the Original */
/* Code is Eric Busboom */
diff --git a/src/libicalss/icalssyacc.h b/src/libicalss/icalssyacc.h
index f97cc4a7..e8592097 100644
--- a/src/libicalss/icalssyacc.h
+++ b/src/libicalss/icalssyacc.h
@@ -2,8 +2,8 @@
/* Skeleton interface for Bison's Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ SPDX-FileCopyrightText: 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
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
@@ -97,4 +97,3 @@ typedef union YYSTYPE
#endif
extern YYSTYPE sslval;
-
diff --git a/src/libicalss/icalssyacc.y b/src/libicalss/icalssyacc.y
index c7e60b2f..67ad6e56 100644
--- a/src/libicalss/icalssyacc.y
+++ b/src/libicalss/icalssyacc.y
@@ -3,18 +3,9 @@
/* FILE: icalssyacc.y */
/* CREATOR: eric 08 Aug 2000 */
/* */
-/* (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com> */
+/* SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com> */
/* */
-/* This program is free software; you can redistribute it and/or modify */
-/* it under the terms of either: */
-/* */
-/* The LGPL as published by the Free Software Foundation, version */
-/* 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html */
-/* */
-/* Or: */
-/* */
-/* The Mozilla Public License Version 2.0. You may obtain a copy of */
-/* the License at https://www.mozilla.org/MPL/ */
+/* SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0 */
/* */
/* The Original Code is eric. The Initial Developer of the Original */
/* Code is Eric Busboom */
diff --git a/src/libicalss/libical_icalss_export.h b/src/libicalss/libical_icalss_export.h
index 9341ad35..e099c6be 100644
--- a/src/libicalss/libical_icalss_export.h
+++ b/src/libicalss/libical_icalss_export.h
@@ -1,3 +1,8 @@
+/**
+ SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
+
#ifndef LIBICAL_ICALSS_EXPORT_H
#define LIBICAL_ICALSS_EXPORT_H
diff --git a/src/libicalvcal/CMakeLists.txt b/src/libicalvcal/CMakeLists.txt
index 80b98ee0..d9caeaf6 100644
--- a/src/libicalvcal/CMakeLists.txt
+++ b/src/libicalvcal/CMakeLists.txt
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
add_definitions(-Dlibical_vcal_EXPORTS)
include_directories(
diff --git a/src/libicalvcal/README.TXT b/src/libicalvcal/README.txt
index e2148a2c..734c30a4 100644
--- a/src/libicalvcal/README.TXT
+++ b/src/libicalvcal/README.txt
@@ -1,3 +1,12 @@
+SPDX-FileCopyrightText: 1996 Apple Computer, Inc., AT&T Corp., International
+Business Machines Corporation and Siemens Rolm Communications Inc.
+
+SPDX-License-Identifier: LicenseRef-APPLEMIT
+
+The software is provided with RESTRICTED RIGHTS. Use, duplication, or
+disclosure by the government are subject to restrictions set forth in
+DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
+
NOTE: If you used the earlier APIs released by Versit
then you will want to look at the document "migrate.doc"
included with this package. It contains a discussion of
@@ -396,8 +405,8 @@ b. vobject.h -- contains basic interfaces to the VObject APIs.
c. values of a property is determined by the property definition
itself. The vobject APIs does not attempt to enforce
- any of such definition. It is the consumer responsibility
- to know what value is expected from a property. e.g
+ any of such definition. It is the consumer's responsibility
+ to know what value is expected from a property. E.g.
most properties have unicode string value, so to access
the value of these type of properties, you will use
the vObjectUStringZValue() to read the value and
@@ -405,7 +414,7 @@ c. values of a property is determined by the property definition
Refer to the VCard and VCalendar specifications for
the definition of each property.
-d. properties name (id) are case incensitive.
+d. properties name (id) are case insensitive.
8. Brief descriptions of each APIs
===============================
@@ -948,4 +957,3 @@ file VObject Tree as Printed by printVObject API
44 GIF
44 BASE64
44 DATASIZE=1482
-
diff --git a/src/libicalvcal/icalvcal.c b/src/libicalvcal/icalvcal.c
index a4389603..01c32c6f 100644
--- a/src/libicalvcal/icalvcal.c
+++ b/src/libicalvcal/icalvcal.c
@@ -2,18 +2,9 @@
FILE: icalvcal.c
CREATOR: eric 25 May 00
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original code is icalvcal.c
@@ -118,11 +109,11 @@ static const char *get_string_value(VObject *object, int *free_string)
static void convert_floating_time_to_utc(struct icaltimetype *itt)
{
struct tm tmp_tm, utc_tm;
- time_t t;
+ icaltime_t t;
/* We assume the floating time is using the current Unix timezone.
- So we convert to a time_t using mktime(), and then back to a struct tm
- using gmtime, so it is the UTC time. */
+ So we convert to a icaltime_t using icalmktime(), and then back to a struct tm
+ using icalgmtime_r, so it is the UTC time. */
tmp_tm.tm_year = itt->year - 1900;
tmp_tm.tm_mon = itt->month - 1;
tmp_tm.tm_mday = itt->day;
@@ -131,11 +122,11 @@ static void convert_floating_time_to_utc(struct icaltimetype *itt)
tmp_tm.tm_sec = itt->second;
tmp_tm.tm_isdst = -1;
- /* Convert to a time_t. */
- t = mktime(&tmp_tm);
+ /* Convert to a icaltime_t. */
+ t = icalmktime(&tmp_tm);
/* Now convert back to a struct tm, but with a UTC time. */
- if (!gmtime_r(&t, &utc_tm)) {
+ if (!icalgmtime_r(&t, &utc_tm)) {
*itt = itt->is_date ? icaltime_null_date () : icaltime_null_time ();
return;
}
diff --git a/src/libicalvcal/icalvcal.h b/src/libicalvcal/icalvcal.h
index 4986d20d..17a8d9b6 100644
--- a/src/libicalvcal/icalvcal.h
+++ b/src/libicalvcal/icalvcal.h
@@ -2,18 +2,10 @@
FILE: icalvcal.h
CREATOR: eric 25 May 00
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALVCAL_H
diff --git a/src/libicalvcal/libical_vcal_export.h b/src/libicalvcal/libical_vcal_export.h
index 0c744759..3404c28e 100644
--- a/src/libicalvcal/libical_vcal_export.h
+++ b/src/libicalvcal/libical_vcal_export.h
@@ -1,4 +1,9 @@
+/**
+ SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
#ifndef LIBICAL_VCAL_EXPORT_H
+
#define LIBICAL_VCAL_EXPORT_H
#if !defined(S_SPLINT_S)
diff --git a/src/libicalvcal/vcaltmp.c b/src/libicalvcal/vcaltmp.c
index 2562665d..4cbabeed 100644
--- a/src/libicalvcal/vcaltmp.c
+++ b/src/libicalvcal/vcaltmp.c
@@ -14,36 +14,10 @@ Note on APIs:
*/
/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
+SPDX-FileCopyrightText: 1996 Apple Computer, Inc., AT&T Corp., International
Business Machines Corporation and Siemens Rolm Communications Inc.
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
+SPDX-License-Identifier: LicenseRef-APPLEMIT
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
disclosure by the government are subject to restrictions set forth in
@@ -76,7 +50,6 @@ VObject* vcsCreateVCal(
return vcal;
}
-
VObject* vcsAddEvent(
VObject *vcal,
char *start_date_time,
@@ -111,7 +84,6 @@ VObject* vcsAddEvent(
return vevent;
}
-
VObject* vcsAddTodo(
VObject *vcal,
char *start_date_time,
@@ -146,7 +118,6 @@ VObject* vcsAddTodo(
return vtodo;
}
-
VObject* vcsAddAAlarm(
VObject *vevent,
char *run_time,
@@ -165,7 +136,6 @@ VObject* vcsAddAAlarm(
return aalarm;
}
-
VObject* vcsAddMAlarm(
VObject *vevent,
char *run_time,
@@ -186,7 +156,6 @@ VObject* vcsAddMAlarm(
return malarm;
}
-
VObject* vcsAddDAlarm(
VObject *vevent,
char *run_time,
@@ -205,7 +174,6 @@ VObject* vcsAddDAlarm(
return dalarm;
}
-
VObject* vcsAddPAlarm(
VObject *vevent,
char *run_time,
@@ -224,7 +192,6 @@ VObject* vcsAddPAlarm(
return palarm;
}
-
#ifdef _TEST
#if 0
@@ -333,5 +300,4 @@ void main() {
#endif
-
/* end of source file vcaltmp.c */
diff --git a/src/libicalvcal/vcaltmp.h b/src/libicalvcal/vcaltmp.h
index 4c1fe11e..69f9e82b 100644
--- a/src/libicalvcal/vcaltmp.h
+++ b/src/libicalvcal/vcaltmp.h
@@ -1,34 +1,8 @@
/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
+SPDX-FileCopyrightText: 1996 Apple Computer, Inc., AT&T Corp., International
Business Machines Corporation and Siemens Rolm Communications Inc.
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
+SPDX-License-Identifier: LicenseRef-APPLEMIT
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
disclosure by the government are subject to restrictions set forth in
diff --git a/src/libicalvcal/vcc.c b/src/libicalvcal/vcc.c
index 19eb9a16..41daa87a 100644
--- a/src/libicalvcal/vcc.c
+++ b/src/libicalvcal/vcc.c
@@ -1,56 +1,109 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "vcc.h"
-#include <ctype.h>
-#include <stddef.h> /* for ptrdiff_t */
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
-#define YYPATCH 20070509
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING (yyerrflag != 0)
+#define YYPATCH 20150711
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+
+#ifndef yyparse
+#define yyparse mime_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex mime_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror mime_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar mime_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval mime_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval mime_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug mime_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs mime_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag mime_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs mime_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen mime_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred mime_defred
+#endif /* yydefred */
+
+#ifndef yydgoto
+#define yydgoto mime_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex mime_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex mime_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex mime_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable mime_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck mime_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname mime_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule mime_rule
+#endif /* yyrule */
+#define YYPREFIX "mime_"
-extern int yyparse(void);
+#define YYPURE 0
-static int yygrowstack(void);
+#line 2 "vcc.y"
/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
+SPDX-FileCopyrightText: 1996 Apple Computer, Inc., AT&T Corp., International
Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
+SPDX-License-Identifier: LicenseRef-APPLEMIT
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
disclosure by the government are subject to restrictions set forth in
@@ -68,7 +121,6 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
* be fixed in vcc.y and this file regenerated.
*/
-
/* debugging utilities */
#ifdef __DEBUG
#define DBG_(x) printf x
@@ -112,7 +164,6 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
#define yyrule mime_rule
#define YYPREFIX "mime_"
-
#ifndef _NO_LINE_FOLDING
#define _SUPPORT_LINE_FOLDING 1
#endif
@@ -120,12 +171,19 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
/* undef below if compile with MFC */
/* #define INCLUDEMFC 1 */
-#if defined(_WIN32)
+#if defined(WIN32) || defined(_WIN32)
#ifdef INCLUDEMFC
#include <afx.h>
#endif
#endif
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ctype.h>
+#include "vcc.h"
+
/**** Types, Constants ****/
#define YYDEBUG 1 /* 1 to compile in some debugging code */
@@ -134,7 +192,6 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
#define MAXLEVEL 10 /* max # of nested objects parseable */
/* (includes outermost) */
-
/**** Global Variables ****/
int mime_lineNum, mime_numErrors; /* yyerror() can use these */
static VObject* vObjList;
@@ -143,7 +200,6 @@ static VObject *curObj;
static VObject* ObjStack[MAXLEVEL];
static int ObjStackTop;
-
/* A helpful utility for the rest of the app. */
#if defined(__CPLUSPLUS__)
extern "C" {
@@ -157,7 +213,6 @@ extern "C" {
#endif
int yylex(void);
-int yyparse(void);
enum LexMode {
L_NORMAL,
@@ -192,15 +247,56 @@ static void enterAttr(const char *s1, const char *s2);
static void enterProps(const char *s);
static void enterValues(const char *value);
static void finiLex(void);
-static void mime_error_(char *s);
+static void mime_error_(const char *s);
static VObject* Parse_MIMEHelper(void);
static VObject* popVObject(void);
static int pushVObject(const char *prop);
+#line 202 "vcc.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
typedef union {
char *str;
VObject *vobj;
} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 308 "vcc.c"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
#define EQ 257
#define COLON 258
#define DOT 259
@@ -217,24 +313,25 @@ typedef union {
#define END_VEVENT 270
#define BEGIN_VTODO 271
#define END_VTODO 272
-#define ID 273
-#define STRING 274
+#define STRING 273
+#define ID 274
#define YYERRCODE 256
-short yylhs[] = { -1,
+typedef short YYINT;
+static const YYINT mime_lhs[] = { -1,
0, 7, 6, 6, 5, 5, 9, 3, 10, 3,
8, 8, 14, 11, 11, 16, 12, 12, 15, 15,
17, 18, 18, 1, 19, 13, 13, 2, 2, 21,
4, 22, 4, 20, 20, 23, 23, 23, 26, 24,
27, 24, 28, 25, 29, 25,
};
-short yylen[] = { 2,
+static const YYINT mime_len[] = { 2,
1, 0, 3, 1, 1, 1, 0, 4, 0, 3,
2, 1, 0, 5, 1, 0, 3, 1, 2, 1,
2, 1, 3, 1, 0, 4, 1, 1, 0, 0,
4, 0, 3, 2, 1, 1, 1, 1, 0, 4,
0, 3, 0, 4, 0, 3,
};
-short yydefred[] = { 0,
+static const YYINT mime_defred[] = { 0,
0, 0, 0, 5, 6, 0, 1, 0, 0, 0,
0, 0, 15, 24, 0, 0, 0, 0, 10, 0,
0, 38, 0, 0, 36, 37, 33, 3, 0, 8,
@@ -242,40 +339,40 @@ short yydefred[] = { 0,
0, 0, 0, 42, 0, 46, 0, 21, 19, 28,
0, 0, 40, 44, 0, 25, 14, 23, 0, 26,
};
-short yydgoto[] = { 3,
+static const YYINT mime_dgoto[] = { 3,
15, 51, 4, 5, 6, 7, 12, 22, 8, 9,
17, 18, 52, 42, 40, 29, 41, 48, 59, 23,
10, 11, 24, 25, 26, 33, 34, 35, 36,
};
-short yysindex[] = { -227,
- 0, 0, 0, 0, 0, 0, 0, -249, -262, -253,
- -258, -227, 0, 0, 0, -234, -249, -215, 0, 0,
- 0, 0, -223, -253, 0, 0, 0, 0, -247, 0,
- 0, 0, -249, -222, -249, -225, 0, 0, -224, 0,
- -247, -221, -220, 0, -218, 0, -206, 0, 0, 0,
- -208, -207, 0, 0, -224, 0, 0, 0, -221, 0,
+static const YYINT mime_sindex[] = { -227,
+ 0, 0, 0, 0, 0, 0, 0, -246, -260, -253,
+ -257, -227, 0, 0, 0, -234, -246, -215, 0, 0,
+ 0, 0, -223, -253, 0, 0, 0, 0, -214, 0,
+ 0, 0, -246, -222, -246, -225, 0, 0, -224, 0,
+ -214, -221, -217, 0, -218, 0, -208, 0, 0, 0,
+ -209, -207, 0, 0, -224, 0, 0, 0, -221, 0,
};
-short yyrindex[] = { 0,
- -245, -254, 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, -219, 0, -235, 0, 0, -244,
- -250, 0, 0, -213, 0, 0, 0, 0, 0, 0,
+static const YYINT mime_rindex[] = { 0,
+ -244, -254, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, -219, 0, -235, 0, 0, -251,
+ -248, 0, 0, -213, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -201, -255, 0, 0, 0, 0, -216, 0, 0, 0,
- -205, 0, 0, 0, 0, 0, 0, 0, -255, 0,
+ -201, -256, 0, 0, 0, 0, -216, 0, 0, 0,
+ -205, 0, 0, 0, 0, 0, 0, 0, -256, 0,
};
-short yygindex[] = { 0,
- -9, 0, 0, 0, 0, 47, 0, -8, 0, 0,
+static const YYINT mime_gindex[] = { 0,
+ -26, 0, 0, 0, 0, 47, 0, -8, 0, 0,
0, 0, 2, 0, 19, 0, 0, 0, 0, 38,
0, 0, 0, 0, 0, 0, 0, 0, 0,
};
#define YYTABLESIZE 268
-short yytable[] = { 16,
- 4, 30, 13, 19, 29, 43, 13, 29, 31, 27,
- 7, 39, 39, 32, 30, 20, 30, 21, 30, 14,
- 9, 45, 43, 14, 43, 41, 45, 7, 39, 47,
+static const YYINT mime_table[] = { 16,
+ 4, 30, 13, 29, 39, 19, 29, 43, 31, 13,
+ 27, 7, 47, 32, 30, 20, 30, 21, 41, 30,
+ 14, 9, 39, 45, 43, 43, 45, 14, 58, 7,
12, 30, 12, 12, 12, 12, 12, 1, 18, 2,
- 16, 22, 32, 22, 37, 58, 46, 44, 14, 53,
- 55, 56, 50, 54, 35, 57, 20, 27, 28, 49,
+ 16, 22, 32, 22, 37, 39, 46, 44, 55, 14,
+ 56, 50, 53, 54, 35, 57, 20, 27, 28, 49,
60, 38, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -298,13 +395,13 @@ short yytable[] = { 16,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 2, 0, 2,
};
-short yycheck[] = { 8,
- 0, 256, 256, 266, 260, 256, 256, 263, 17, 268,
- 256, 256, 260, 268, 269, 269, 271, 271, 273, 273,
- 266, 272, 273, 273, 33, 270, 35, 273, 273, 39,
+static const YYINT mime_check[] = { 8,
+ 0, 256, 256, 260, 256, 266, 263, 256, 17, 256,
+ 268, 256, 39, 268, 269, 269, 271, 271, 270, 274,
+ 274, 266, 274, 272, 33, 274, 35, 274, 55, 274,
266, 266, 268, 269, 270, 271, 272, 265, 258, 267,
- 260, 258, 258, 260, 268, 55, 272, 270, 273, 270,
- 257, 260, 274, 272, 268, 263, 258, 263, 12, 41,
+ 260, 258, 258, 260, 268, 260, 272, 270, 257, 274,
+ 260, 273, 270, 272, 268, 263, 258, 263, 12, 41,
59, 24, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -332,8 +429,11 @@ short yycheck[] = { 8,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 274
+#define YYUNDFTOKEN 306
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
#if YYDEBUG
-const char *yyname[] = {
+static const char *const mime_name[] = {
+
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -342,9 +442,10 @@ const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"EQ","COLON","DOT","SEMICOLON",
"SPACE","HTAB","LINESEP","NEWLINE","BEGIN_VCARD","END_VCARD","BEGIN_VCAL",
-"END_VCAL","BEGIN_VEVENT","END_VEVENT","BEGIN_VTODO","END_VTODO","ID","STRING",
+"END_VCAL","BEGIN_VEVENT","END_VEVENT","BEGIN_VTODO","END_VTODO","STRING","ID",
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"illegal-symbol",
};
-const char *yyrule[] = {
+static const char *const mime_rule[] = {
"$accept : mime",
"mime : vobjects",
"$$1 :",
@@ -392,9 +493,18 @@ const char *yyrule[] = {
"todoitem : BEGIN_VTODO $$11 items END_VTODO",
"$$12 :",
"todoitem : BEGIN_VTODO $$12 END_VTODO",
+
};
#endif
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+
/* define the initial stack-sizes */
#ifdef YYSTACKSIZE
#undef YYMAXDEPTH
@@ -403,27 +513,24 @@ const char *yyrule[] = {
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
-#define YYSTACKSIZE 500
-#define YYMAXDEPTH 500
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
#endif
#endif
-#define YYINITSTACKSIZE 500
-
-int yydebug;
-int yynerrs;
-int yyerrflag;
-int yychar;
-short *yyssp;
-YYSTYPE *yyvsp;
-YYSTYPE yyval;
-YYSTYPE yylval;
+#define YYINITSTACKSIZE 200
+typedef struct {
+ unsigned stacksize;
+ YYINT *s_base;
+ YYINT *s_mark;
+ YYINT *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
/* variables for the parser stack */
-static short *yyss;
-static short *yysslim;
-static YYSTYPE *yyvs;
-static int yystacksize;
+static YYSTACKDATA yystack;
+#line 395 "vcc.y"
static int pushVObject(const char *prop)
{
VObject *newObj;
@@ -442,7 +549,6 @@ static int pushVObject(const char *prop)
return 1; /*TRUE*/
}
-
/* This pops the recently built vCard off the stack and returns it. */
static VObject* popVObject()
{
@@ -457,13 +563,12 @@ static VObject* popVObject()
return oldObj;
}
-
static void enterValues(const char *value)
{
if (fieldedProp && *fieldedProp) {
if (value) {
- (void)addPropValue(curProp,*fieldedProp,value);
- }
+ (void) addPropValue(curProp,*fieldedProp,value);
+ }
/* else this field is empty, advance to next field */
fieldedProp++;
}
@@ -519,7 +624,6 @@ static void enterAttr(const char *s1, const char *s2)
deleteStr(s1); deleteStr(s2);
}
-
#define MAX_LEX_LOOKAHEAD_0 32
#define MAX_LEX_LOOKAHEAD 64
#define MAX_LEX_MODE_STACK_SIZE 10
@@ -809,7 +913,6 @@ static char* lexGet1Value() {
}
#endif
-
static int match_begin_name(int end) {
char *n = lexLookaheadWord();
int token = ID;
@@ -824,7 +927,6 @@ static int match_begin_name(int end) {
return 0;
}
-
#ifdef INCLUDEMFC
void initLex(const char *inputstring, unsigned long inputlen, CFile *inputfile)
#else
@@ -846,7 +948,6 @@ void initLex(const char *inputstring, unsigned long inputlen, FILE *inputfile)
lexBuf.maxToken = MAXTOKEN;
lexBuf.strs = (char*)malloc(MAXTOKEN);
lexBuf.strsLen = 0;
-
}
static void finiLex() {
@@ -859,7 +960,6 @@ static void finiLex() {
free(lexBuf.strs);
}
-
/* This parses and converts the base64 format for binary encoding into
* a decoded buffer (allocated with new). See RFC 1521.
*/
@@ -950,7 +1050,7 @@ static char * lexGetDataFromBase64()
}
}
} /* while */
- DBG_(("db: bytesLen = %lu\n", (unsigned long)bytesLen));
+ DBG_(("db: bytesLen = %lu\n", (unsigned long)bytesLen));
/* kludge: all this won't be necessary if we have tree form
representation */
if (bytes) {
@@ -1108,7 +1208,7 @@ int yylex() {
lexSkipLookahead();
c = lexLookahead();
++mime_lineNum;
- }
+ }
DBG_(("db: COLON\n"));
return COLON;
}
@@ -1155,7 +1255,6 @@ int yylex() {
return 0;
}
-
/***************************************************************************/
/*** Public Functions ****/
/***************************************************************************/
@@ -1184,7 +1283,6 @@ VObject* Parse_MIME(const char *input, unsigned long len)
return Parse_MIMEHelper();
}
-
#ifdef INCLUDEMFC
VObject* Parse_MIME_FromFile(CFile *file)
@@ -1210,7 +1308,7 @@ VObject* Parse_MIME_FromFile(FILE *file)
startPos = ftell(file);
if (!(result = Parse_MIMEHelper())) {
if (startPos >= 0)
- (void)fseek(file,startPos,SEEK_SET);
+ (void)fseek(file,startPos,SEEK_SET);
}
return result;
}
@@ -1233,7 +1331,6 @@ VObject* Parse_MIME_FromFileName(const char *fname)
#endif
-
static MimeErrorHandler mimeErrorHandler;
void registerMimeErrorHandler(MimeErrorHandler me)
@@ -1250,60 +1347,78 @@ static void mime_error(const char *s)
}
}
-static void mime_error_(char *s)
+static void mime_error_(const char *s)
{
if (mimeErrorHandler) {
mimeErrorHandler(s);
}
}
+#line 1398 "vcc.c"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(void)
+static int yygrowstack(YYSTACKDATA *data)
{
- int newsize;
- ptrdiff_t i;
- short *newss;
+ int i;
+ unsigned newsize;
+ YYINT *newss;
YYSTYPE *newvs;
- if ((newsize = yystacksize) == 0)
+ if ((newsize = data->stacksize) == 0)
newsize = YYINITSTACKSIZE;
else if (newsize >= YYMAXDEPTH)
- return -1;
+ return YYENOMEM;
else if ((newsize *= 2) > YYMAXDEPTH)
newsize = YYMAXDEPTH;
- i = (ptrdiff_t)(yyssp - yyss);
- newss = (yyss != 0)
- ? (short *)realloc(yyss, newsize * sizeof(*newss))
- : (short *)malloc(newsize * sizeof(*newss));
+ i = (int) (data->s_mark - data->s_base);
+ newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
- return -1;
+ return YYENOMEM;
- yyss = newss;
- yyssp = newss + i;
- newvs = (yyvs != 0)
- ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
- : (YYSTYPE *)malloc(newsize * sizeof(*newvs));
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
- return -1;
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
- yyvs = newvs;
- yyvsp = newvs + i;
- yystacksize = newsize;
- yysslim = yyss + newsize - 1;
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
return 0;
}
-#define YYABORT goto yyabort
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif
+
+#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
+#define YYERROR goto yyerrlab
+
int
-yyparse(void)
+YYPARSE_DECL()
{
- register int yym, yyn, yystate;
+ int yym, yyn, yystate;
#if YYDEBUG
- register const char *yys;
+ const char *yys;
if ((yys = getenv("YYDEBUG")) != 0)
{
@@ -1316,23 +1431,27 @@ yyparse(void)
yynerrs = 0;
yyerrflag = 0;
yychar = YYEMPTY;
+/* yystate = 0; never read, says scan-view */
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
- if (yyss == NULL && yygrowstack()) goto yyoverflow;
- yyssp = yyss;
- yyvsp = yyvs;
- *yyssp = yystate = 0;
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+ yystate = 0;
+ *yystack.s_mark = 0;
yyloop:
if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
if (yychar < 0)
{
- if ((yychar = yylex()) < 0) yychar = 0;
+ if ((yychar = YYLEX) < 0) yychar = YYEOF;
#if YYDEBUG
if (yydebug)
{
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
+ yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@@ -1346,12 +1465,13 @@ yyloop:
printf("%sdebug: state %d, shifting to state %d\n",
YYPREFIX, yystate, yytable[yyn]);
#endif
- if (yyssp >= yysslim && yygrowstack())
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
{
goto yyoverflow;
}
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
yychar = YYEMPTY;
if (yyerrflag > 0) --yyerrflag;
goto yyloop;
@@ -1364,11 +1484,9 @@ yyloop:
}
if (yyerrflag) goto yyinrecovery;
- yyerror("syntax error");
+ YYERROR_CALL("syntax error");
-#ifdef lint
goto yyerrlab;
-#endif
yyerrlab:
++yynerrs;
@@ -1379,20 +1497,21 @@ yyinrecovery:
yyerrflag = 3;
for (;;)
{
- if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
+ if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
+ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
#endif
- if (yyssp >= yysslim && yygrowstack())
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
{
goto yyoverflow;
}
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
goto yyloop;
}
else
@@ -1400,23 +1519,21 @@ yyinrecovery:
#if YYDEBUG
if (yydebug)
printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yyssp);
+ YYPREFIX, *yystack.s_mark);
#endif
- if (yyssp <= yyss) goto yyabort;
- --yyssp;
- --yyvsp;
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+ --yystack.s_mark;
+ --yystack.l_mark;
}
}
}
else
{
- if (yychar == 0) goto yyabort;
+ if (yychar == YYEOF) goto yyabort;
#if YYDEBUG
if (yydebug)
{
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
+ yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@@ -1433,147 +1550,174 @@ yyreduce:
#endif
yym = yylen[yyn];
if (yym)
- yyval = yyvsp[1-yym];
+ yyval = yystack.l_mark[1-yym];
else
memset(&yyval, 0, sizeof yyval);
switch (yyn)
{
case 2:
-{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; }
+#line 233 "vcc.y"
+ { addList(&vObjList, yystack.l_mark[0].vobj); curObj = 0; }
break;
case 4:
-{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; }
+#line 236 "vcc.y"
+ { addList(&vObjList, yystack.l_mark[0].vobj); curObj = 0; }
break;
case 7:
-{
+#line 245 "vcc.y"
+ {
lexPushMode(L_VCARD);
if (!pushVObject(VCCardProp)) YYERROR;
}
break;
case 8:
-{
+#line 250 "vcc.y"
+ {
lexPopMode(0);
yyval.vobj = popVObject();
}
break;
case 9:
-{
+#line 255 "vcc.y"
+ {
lexPushMode(L_VCARD);
if (!pushVObject(VCCardProp)) YYERROR;
}
break;
case 10:
-{
+#line 260 "vcc.y"
+ {
lexPopMode(0);
yyval.vobj = popVObject();
}
break;
case 13:
-{
+#line 271 "vcc.y"
+ {
lexPushMode(L_VALUES);
}
break;
case 14:
-{
+#line 275 "vcc.y"
+ {
if (lexWithinMode(L_BASE64) || lexWithinMode(L_QUOTED_PRINTABLE))
lexPopMode(0);
lexPopMode(0);
}
break;
case 16:
-{
- enterProps(yyvsp[0].str);
+#line 284 "vcc.y"
+ {
+ enterProps(yystack.l_mark[0].str);
}
break;
case 18:
-{
- enterProps(yyvsp[0].str);
+#line 289 "vcc.y"
+ {
+ enterProps(yystack.l_mark[0].str);
}
break;
case 22:
-{
- enterAttr(yyvsp[0].str,0);
+#line 302 "vcc.y"
+ {
+ enterAttr(yystack.l_mark[0].str,0);
}
break;
case 23:
-{
- enterAttr(yyvsp[-2].str,yyvsp[0].str);
-
+#line 306 "vcc.y"
+ {
+ enterAttr(yystack.l_mark[-2].str,yystack.l_mark[0].str);
}
break;
case 25:
-{ enterValues(yyvsp[-1].str); }
+#line 315 "vcc.y"
+ { enterValues(yystack.l_mark[-1].str); }
break;
case 27:
-{ enterValues(yyvsp[0].str); }
+#line 317 "vcc.y"
+ { enterValues(yystack.l_mark[0].str); }
break;
case 29:
-{ yyval.str = 0; }
+#line 321 "vcc.y"
+ { yyval.str = 0; }
break;
case 30:
-{ if (!pushVObject(VCCalProp)) YYERROR; }
+#line 326 "vcc.y"
+ { if (!pushVObject(VCCalProp)) YYERROR; }
break;
case 31:
-{ yyval.vobj = popVObject(); }
+#line 329 "vcc.y"
+ { yyval.vobj = popVObject(); }
break;
case 32:
-{ if (!pushVObject(VCCalProp)) YYERROR; }
+#line 331 "vcc.y"
+ { if (!pushVObject(VCCalProp)) YYERROR; }
break;
case 33:
-{ yyval.vobj = popVObject(); }
+#line 333 "vcc.y"
+ { yyval.vobj = popVObject(); }
break;
case 39:
-{
+#line 348 "vcc.y"
+ {
lexPushMode(L_VEVENT);
if (!pushVObject(VCEventProp)) YYERROR;
}
break;
case 40:
-{
+#line 354 "vcc.y"
+ {
lexPopMode(0);
(void)popVObject();
}
break;
case 41:
-{
+#line 359 "vcc.y"
+ {
lexPushMode(L_VEVENT);
if (!pushVObject(VCEventProp)) YYERROR;
}
break;
case 42:
-{
+#line 364 "vcc.y"
+ {
lexPopMode(0);
(void)popVObject();
}
break;
case 43:
-{
+#line 372 "vcc.y"
+ {
lexPushMode(L_VTODO);
if (!pushVObject(VCTodoProp)) YYERROR;
}
break;
case 44:
-{
+#line 378 "vcc.y"
+ {
lexPopMode(0);
(void)popVObject();
}
break;
case 45:
-{
+#line 383 "vcc.y"
+ {
lexPushMode(L_VTODO);
if (!pushVObject(VCTodoProp)) YYERROR;
}
break;
case 46:
-{
+#line 388 "vcc.y"
+ {
lexPopMode(0);
(void)popVObject();
}
break;
+#line 1759 "vcc.c"
}
- yyssp -= yym;
- yystate = *yyssp;
- yyvsp -= yym;
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)
{
@@ -1583,23 +1727,21 @@ break;
state %d\n", YYPREFIX, YYFINAL);
#endif
yystate = YYFINAL;
- *++yyssp = YYFINAL;
- *++yyvsp = yyval;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
if (yychar < 0)
{
- if ((yychar = yylex()) < 0) yychar = 0;
+ if ((yychar = YYLEX) < 0) yychar = YYEOF;
#if YYDEBUG
if (yydebug)
{
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
+ yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}
#endif
}
- if (yychar == 0) goto yyaccept;
+ if (yychar == YYEOF) goto yyaccept;
goto yyloop;
}
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
@@ -1610,22 +1752,24 @@ break;
#if YYDEBUG
if (yydebug)
printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
+to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
#endif
- if (yyssp >= yysslim && yygrowstack())
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
{
goto yyoverflow;
}
- *++yyssp = yystate;
- *++yyvsp = yyval;
+ *++yystack.s_mark = (YYINT) yystate;
+ *++yystack.l_mark = yyval;
goto yyloop;
yyoverflow:
- yyerror("yacc stack overflow");
+ YYERROR_CALL("yacc stack overflow");
yyabort:
+ yyfreestack(&yystack);
return (1);
yyaccept:
+ yyfreestack(&yystack);
return (0);
}
diff --git a/src/libicalvcal/vcc.h b/src/libicalvcal/vcc.h
index d63681c0..d3a1f163 100644
--- a/src/libicalvcal/vcc.h
+++ b/src/libicalvcal/vcc.h
@@ -1,34 +1,8 @@
/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
+SPDX-FileCopyrightText: 1996 Apple Computer, Inc., AT&T Corp., International
Business Machines Corporation and Siemens Rolm Communications Inc.
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
+SPDX-License-Identifier: LicenseRef-APPLEMIT
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
disclosure by the government are subject to restrictions set forth in
@@ -47,7 +21,7 @@ extern "C"
{
#endif
- typedef void (*MimeErrorHandler) (char *);
+ typedef void (*MimeErrorHandler) (const char *);
LIBICAL_VCAL_EXPORT void registerMimeErrorHandler(MimeErrorHandler);
diff --git a/src/libicalvcal/vcc.y b/src/libicalvcal/vcc.y
index 9643e562..b4c81760 100644
--- a/src/libicalvcal/vcc.y
+++ b/src/libicalvcal/vcc.y
@@ -1,36 +1,10 @@
%{
/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
+SPDX-FileCopyrightText: 1996 Apple Computer, Inc., AT&T Corp., International
Business Machines Corporation and Siemens Rolm Communications Inc.
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
+SPDX-License-Identifier: LicenseRef-APPLEMIT
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
disclosure by the government are subject to restrictions set forth in
@@ -113,9 +87,10 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
#endif
#endif
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <ctype.h>
#include "vcc.h"
@@ -143,14 +118,13 @@ extern "C" {
#endif
extern void Parse_Debug(const char *s);
- static void yyerror(char *s);
+ static void yyerror(const char *s);
#if defined(__CPLUSPLUS__)
};
#endif
int yylex(void);
-int yyparse(void);
enum LexMode {
L_NORMAL,
@@ -185,7 +159,7 @@ static void enterAttr(const char *s1, const char *s2);
static void enterProps(const char *s);
static void enterValues(const char *value);
static void finiLex(void);
-static void mime_error_(char *s);
+static void mime_error_(const char *s);
static VObject* Parse_MIMEHelper(void);
static VObject* popVObject(void);
static int pushVObject(const char *prop);
@@ -205,7 +179,6 @@ static int pushVObject(const char *prop);
EQ COLON DOT SEMICOLON SPACE HTAB LINESEP NEWLINE
BEGIN_VCARD END_VCARD BEGIN_VCAL END_VCAL
BEGIN_VEVENT END_VEVENT BEGIN_VTODO END_VTODO
- ID
/*
* NEWLINE is the token that would occur outside a vCard,
@@ -351,7 +324,7 @@ eventitem:
END_VEVENT
{
lexPopMode(0);
- popVObject();
+ (void)popVObject();
}
| BEGIN_VEVENT
{
@@ -361,7 +334,7 @@ eventitem:
END_VEVENT
{
lexPopMode(0);
- popVObject();
+ (void)popVObject();
}
;
@@ -375,7 +348,7 @@ todoitem:
END_VTODO
{
lexPopMode(0);
- popVObject();
+ (void)popVObject();
}
| BEGIN_VTODO
{
@@ -385,7 +358,7 @@ todoitem:
END_VTODO
{
lexPopMode(0);
- popVObject();
+ (void)popVObject();
}
;
@@ -428,7 +401,7 @@ static void enterValues(const char *value)
{
if (fieldedProp && *fieldedProp) {
if (value) {
- addPropValue(curProp,*fieldedProp,value);
+ (void) addPropValue(curProp,*fieldedProp,value);
}
/* else this field is empty, advance to next field */
fieldedProp++;
@@ -437,7 +410,7 @@ static void enterValues(const char *value)
if (value) {
char *p1, *p2;
wchar_t *p3;
- int i;
+ size_t i;
/* If the property already has a string value, we append this one,
using ';' to separate the values. */
@@ -450,7 +423,7 @@ static void enterValues(const char *value)
p3 = (wchar_t *) vObjectUStringZValue(curProp);
free(p3);
setVObjectUStringZValue_(curProp,fakeUnicode(p2,0));
- deleteStr(p2);
+ free(p2);
} else {
setVObjectUStringZValue_(curProp,fakeUnicode(value,0));
}
@@ -476,11 +449,11 @@ static void enterAttr(const char *s1, const char *s2)
setVObjectStringZValue(a,p2);
}
else
- addProp(curProp,p1);
- if (stricmp(p1,VCBase64Prop) == 0 || (s2 && stricmp(p2,VCBase64Prop)==0))
+ (void)addProp(curProp,p1);
+ if (strcasecmp(p1,VCBase64Prop) == 0 || (p2 && strcasecmp(p2,VCBase64Prop)==0))
lexPushMode(L_BASE64);
- else if (stricmp(p1,VCQuotedPrintableProp) == 0
- || (s2 && stricmp(p2,VCQuotedPrintableProp)==0))
+ else if (strcasecmp(p1,VCQuotedPrintableProp) == 0
+ || (p2 && strcasecmp(p2,VCQuotedPrintableProp)==0))
lexPushMode(L_QUOTED_PRINTABLE);
deleteStr(s1); deleteStr(s2);
}
@@ -555,7 +528,7 @@ static char lexGetc_()
char result;
return lexBuf.inputFile->Read(&result, 1) == 1 ? result : EOF;
#else
- return fgetc(lexBuf.inputFile);
+ return (char)fgetc(lexBuf.inputFile);
#endif
}
}
@@ -673,7 +646,7 @@ static void lexPushLookaheadc(int c) {
if (((char) c) == ((char) EOF)) return;
putptr = (int)lexBuf.getPtr - 1;
if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD;
- lexBuf.getPtr = putptr;
+ lexBuf.getPtr = (unsigned long)putptr;
lexBuf.buf[putptr] = c;
lexBuf.len += 1;
}
@@ -696,14 +669,14 @@ static char* lexLookaheadWord() {
lexAppendc(0);
/* restore lookahead buf. */
lexBuf.len += len;
- lexBuf.getPtr = curgetptr;
+ lexBuf.getPtr = (unsigned long)curgetptr;
return lexStr();
}
else
lexAppendc(c);
}
lexBuf.len += len; /* char that has been moved to lookahead buffer */
- lexBuf.getPtr = curgetptr;
+ lexBuf.getPtr = (unsigned long)curgetptr;
return 0;
}
@@ -780,10 +753,10 @@ static int match_begin_name(int end) {
char *n = lexLookaheadWord();
int token = ID;
if (n) {
- if (!stricmp(n,"vcard")) token = end?END_VCARD:BEGIN_VCARD;
- else if (!stricmp(n,"vcalendar")) token = end?END_VCAL:BEGIN_VCAL;
- else if (!stricmp(n,"vevent")) token = end?END_VEVENT:BEGIN_VEVENT;
- else if (!stricmp(n,"vtodo")) token = end?END_VTODO:BEGIN_VTODO;
+ if (!strcasecmp(n,"vcard")) token = end?END_VCARD:BEGIN_VCARD;
+ else if (!strcasecmp(n,"vcalendar")) token = end?END_VCAL:BEGIN_VCAL;
+ else if (!strcasecmp(n,"vevent")) token = end?END_VEVENT:BEGIN_VEVENT;
+ else if (!strcasecmp(n,"vtodo")) token = end?END_VTODO:BEGIN_VTODO;
deleteStr(n);
return token;
}
@@ -829,7 +802,7 @@ static void finiLex() {
*/
static char * lexGetDataFromBase64()
{
- unsigned long bytesLen = 0, bytesMax = 0;
+ size_t bytesLen = 0, bytesMax = 0;
int quadIx = 0, pad = 0;
unsigned long trip = 0;
unsigned char b;
@@ -884,13 +857,13 @@ static char * lexGetDataFromBase64()
trip = (trip << 6) | b;
if (++quadIx == 4) {
unsigned char outBytes[3];
- int numOut;
+ size_t numOut;
int i;
for (i = 0; i < 3; i++) {
outBytes[2-i] = (unsigned char)(trip & 0xFF);
trip >>= 8;
}
- numOut = 3 - pad;
+ numOut = (size_t)(3 - pad);
if (bytesLen + numOut > bytesMax) {
if (!bytes) {
bytesMax = 1024;
@@ -914,15 +887,15 @@ static char * lexGetDataFromBase64()
}
}
} /* while */
- DBG_(("db: bytesLen = %d\n", bytesLen));
+ DBG_(("db: bytesLen = %lu\n", (unsigned long)bytesLen));
/* kludge: all this won't be necessary if we have tree form
representation */
if (bytes) {
- setValueWithSize(curProp,bytes,(unsigned int)bytesLen);
+ (void)setValueWithSize(curProp,bytes,(unsigned int)bytesLen);
free(bytes);
}
else if (oldBytes) {
- setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen);
+ (void)setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen);
free(oldBytes);
}
return 0;
@@ -1072,7 +1045,7 @@ int yylex() {
lexSkipLookahead();
c = lexLookahead();
++mime_lineNum;
- }
+ }
DBG_(("db: COLON\n"));
return COLON;
}
@@ -1096,10 +1069,10 @@ int yylex() {
if (isalpha(c)) {
char *t = lexGetWord();
yylval.str = t;
- if (!stricmp(t, "begin")) {
+ if (!strcasecmp(t, "begin")) {
return match_begin_end_name(0);
}
- else if (!stricmp(t,"end")) {
+ else if (!strcasecmp(t,"end")) {
return match_begin_end_name(1);
}
else {
@@ -1142,7 +1115,7 @@ static VObject* Parse_MIMEHelper()
return vObjList;
}
-DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len)
+VObject* Parse_MIME(const char *input, unsigned long len)
{
initLex(input, len, 0);
return Parse_MIMEHelper();
@@ -1151,7 +1124,7 @@ DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len)
#ifdef INCLUDEMFC
-DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file)
+VObject* Parse_MIME_FromFile(CFile *file)
{
unsigned long startPos;
VObject *result;
@@ -1174,12 +1147,12 @@ VObject* Parse_MIME_FromFile(FILE *file)
startPos = ftell(file);
if (!(result = Parse_MIMEHelper())) {
if (startPos >= 0)
- fseek(file,startPos,SEEK_SET);
+ (void)fseek(file,startPos,SEEK_SET);
}
return result;
}
-DLLEXPORT(VObject*) Parse_MIME_FromFileName(const char *fname)
+VObject* Parse_MIME_FromFileName(const char *fname)
{
FILE *fp = fopen(fname,"r");
if (fp) {
@@ -1200,12 +1173,12 @@ DLLEXPORT(VObject*) Parse_MIME_FromFileName(const char *fname)
static MimeErrorHandler mimeErrorHandler;
-DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler me)
+void registerMimeErrorHandler(MimeErrorHandler me)
{
mimeErrorHandler = me;
}
-static void mime_error(char *s)
+static void mime_error(const char *s)
{
char msg[256];
if (mimeErrorHandler) {
@@ -1214,7 +1187,7 @@ static void mime_error(char *s)
}
}
-static void mime_error_(char *s)
+static void mime_error_(const char *s)
{
if (mimeErrorHandler) {
mimeErrorHandler(s);
diff --git a/src/libicalvcal/vobject.c b/src/libicalvcal/vobject.c
index 10d0cf5a..9b2484fe 100644
--- a/src/libicalvcal/vobject.c
+++ b/src/libicalvcal/vobject.c
@@ -1,34 +1,8 @@
/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
+SPDX-FileCopyrightText: 1996 Apple Computer, Inc., AT&T Corp., International
Business Machines Corporation and Siemens Rolm Communications Inc.
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
+SPDX-License-Identifier: LicenseRef-APPLEMIT
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
disclosure by the government are subject to restrictions set forth in
@@ -84,8 +58,6 @@ struct StrItem {
const char** fieldedProp;
-
-
/*----------------------------------------------------------------------
The following functions involve with memory allocation:
newVObject
@@ -144,7 +116,6 @@ void deleteStr(const char *p)
free((void*)p);
}
-
static StrItem* newStrItem(const char *s, StrItem *next)
{
StrItem *p = (StrItem*)malloc(sizeof(StrItem));
@@ -160,7 +131,6 @@ static void deleteStrItem(StrItem *p)
free((void*)p);
}
-
/*----------------------------------------------------------------------
The following function provide accesses to VObject's value.
----------------------------------------------------------------------*/
@@ -259,7 +229,6 @@ int vObjectValueType(VObject *o)
return (int)VALUE_TYPE(o);
}
-
/*----------------------------------------------------------------------
The following functions can be used to build VObject.
----------------------------------------------------------------------*/
@@ -457,8 +426,6 @@ VObject* addPropSizedValue(VObject *o, const char *p, const char *v,
return addPropSizedValue_(o,p,dupStr(v,size),size);
}
-
-
/*----------------------------------------------------------------------
The following pretty print a VObject
----------------------------------------------------------------------*/
@@ -698,7 +665,6 @@ void cleanStrTbl()
}
}
-
struct PreDefProp {
const char *name;
const char *alias;
@@ -937,7 +903,6 @@ static const struct PreDefProp propNames[] = {
{ 0,0,0,0 }
};
-
static const struct PreDefProp* lookupPropInfo(const char* str)
{
/* brute force for now, could use a hash table here. */
@@ -951,7 +916,6 @@ static const struct PreDefProp* lookupPropInfo(const char* str)
return 0;
}
-
const char* lookupProp_(const char* str)
{
int i;
@@ -965,7 +929,6 @@ const char* lookupProp_(const char* str)
return lookupStr(str);
}
-
const char* lookupProp(const char* str)
{
int i;
@@ -981,7 +944,6 @@ const char* lookupProp(const char* str)
return lookupStr(str);
}
-
/*----------------------------------------------------------------------
APIs to Output text form.
----------------------------------------------------------------------*/
@@ -1116,7 +1078,6 @@ static void initMemOFile(OFile *fp, char *s, int len)
fp->fail = 0;
}
-
static int writeBase64(OFile *fp, unsigned char *s, long len)
{
long cur = 0;
@@ -1190,8 +1151,6 @@ static void writeQPString(OFile *fp, const char *s)
}
}
-
-
static void writeVObject_(OFile *fp, VObject *o);
static void writeValue(OFile *fp, VObject *o, unsigned long size,int quote)
diff --git a/src/libicalvcal/vobject.h b/src/libicalvcal/vobject.h
index 7541be58..72cbc58f 100644
--- a/src/libicalvcal/vobject.h
+++ b/src/libicalvcal/vobject.h
@@ -1,34 +1,8 @@
/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
+SPDX-FileCopyrightText: 1996 Apple Computer, Inc., AT&T Corp., International
Business Machines Corporation and Siemens Rolm Communications Inc.
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
+SPDX-License-Identifier: LicenseRef-APPLEMIT
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
disclosure by the government are subject to restrictions set forth in
diff --git a/src/php/Makefile b/src/php/Makefile
index f371a382..7eab507e 100644
--- a/src/php/Makefile
+++ b/src/php/Makefile
@@ -1,13 +1,16 @@
+# SPDX-FileCopyrightText: Copyright Contributors to the libical project
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
all: LibicalWrap.so
LibicalWrap.so: LibicalWrap.o
- gcc -shared -L/usr/lib -rdynamic LibicalWrap.o ../libical/.libs/libical.a ../libicalss/.libs/libicalss.a -o LibicalWrap.so
+ gcc -shared -L/usr/lib -rdynamic LibicalWrap.o ../libical/.libs/libical.a ../libicalss/.libs/libicalss.a -o LibicalWrap.so
LibicalWrap.o: LibicalWrap.c
gcc -fpic -I/usr/include/php4/TSRM/ -I/usr/include/php4/ -I/usr/include/php4/Zend -I/usr/include/php4/main -c LibicalWrap.c -o LibicalWrap.o
LibicalWrap.c: LibicalWrap.i
- swig -php -o LibicalWrap.c LibicalWrap.i
+ swig -php -o LibicalWrap.c LibicalWrap.i
clean:
rm LibicalWrap.so LibicalWrap.o LibicalWrap.c
diff --git a/src/php/README b/src/php/README.txt
index 15088204..15088204 100644
--- a/src/php/README
+++ b/src/php/README.txt
diff --git a/src/php/test.php b/src/php/test.php
index 98ee7c8d..648e1dcd 100644
--- a/src/php/test.php
+++ b/src/php/test.php
@@ -1,5 +1,8 @@
<?php
+// SPDX-FileCopyrightText: Copyright Contributors to the libical project
+// SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
// '../../../../' is a dirty hack to be able to store LibicalWrap.so in my
// homedir instead of in the machine-global directory
diff --git a/src/python/Attendee.py b/src/python/Attendee.py
deleted file mode 100644
index ed6fde46..00000000
--- a/src/python/Attendee.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: Property.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-
-
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#======================================================================
-
-from LibicalWrap import *
-from Property import Property
-from types import DictType, StringType, IntType
-
-class Attendee(Property):
- """Class for Attendee properties.
-
- Usage:
- Attendee([dict])
- Attendee([address])
-
- Where:
- dict is an optional dictionary with keys of
- 'value': CAL-ADDRESS string and any parameter: parameter_value entries.
- 'name' and 'value_type' entries in dict are ignored and automatically set
- with the appropriate values.
- address is the CAL-ADDRESS (string) of the Attendee
- """
-
- def __init__(self, arg={}):
-
- assert(isinstance(arg,DictType))
-
- ref = None
-
- if arg!={}:
- ref = arg['ref']
-
- Property.__init__(self,type='ATTENDEE',ref=ref)
-
- def _doParam(self, parameter, v):
- if v!=None:
- self[parameter]=v
- return self[parameter]
-
- # Methods for accessing enumerated parameters
- def cn(self, v=None): self._doParam('CN', v)
- def cutype(self, v=None): self._doParam('CUTYPE', v)
- def dir(self, v=None): self._doParam('DIR', v)
- def delegated_from(self, v=None): self._doParam('DELEGATED-FROM', v)
- def delegated_to(self, v=None): self._doParam('DELEGATED-TO', v)
- def language(self, v=None): self._doParam('LANGUAGE', v)
- def member(self, v=None): self._doParam('MEMBER', v)
- def partstat(self, v=None): self._doParam('PARTSTAT', v)
- def role(self, v=None): self._doParam('ROLE', v)
- def rsvp(self, v=None): self._doParam('RSVP', v)
- def sent_by(self, v=None): self._doParam('SENT-BY', v)
-
-
-class Organizer(Property):
- """Class for Organizer property.
- """
-
- def __init__(self, arg={}):
-
- assert(isinstance(arg, DictType))
-
- ref = None
- if arg != {}:
- ref = arg['ref']
- Property.__init__(self, type='ORGANIZER', ref=ref)
-
-## param_t = ( 'CN', 'DIR', 'SENT-BY', 'LANGUAGE' )
-## for param in param_t:
-## self[param] = None
-## if value != None:
-## self.value(value)
-
-
- def _doParam(self, parameter, v):
- if v!=None:
- self[parameter]=v
- return self[parameter]
-
- def name(self):
- "Returns the name of the property."
- return Property.name(self)
-
- def value_type(self):
- "Returns the value type of the property."
- return self._desc['value_type']
-
- # Methods for accessing enumerated parameters
- def cn(self, v=None): self._doParam('CN', v)
- def dir(self, v=None): self._doParam('DIR', v)
- def language(self, v=None): self._doParam('LANGUAGE', v)
- def sent_by(self, v=None): self._doParam('SENT-BY', v)
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
deleted file mode 100644
index a5a593c3..00000000
--- a/src/python/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-include_directories(
- ${CMAKE_SOURCE_DIR}/src
- ${CMAKE_SOURCE_DIR}/src/libical
- ${CMAKE_SOURCE_DIR}/src/libicalss
-)
-
-########### next target ###############
-
-set(LibicalWrap_LIB_SRCS
- LibicalWrap.c
-)
-
-add_library(LibicalWrap ${LIBRARY_TYPE} ${LibicalWrap_LIB_SRCS})
-
-target_link_libraries(LibicalWrap)
-
-set_target_properties(LibicalWrap PROPERTIES
- VERSION ${LIBICAL_LIB_VERSION_STRING}
- SOVERSION ${LIBICAL_LIB_MAJOR_VERSION}
-)
-install(TARGETS LibicalWrap DESTINATION lib)
-
-########### install files ###############
-
diff --git a/src/python/ChangeLog b/src/python/ChangeLog
deleted file mode 100644
index 4cc5e099..00000000
--- a/src/python/ChangeLog
+++ /dev/null
@@ -1,129 +0,0 @@
-2001-04-04 Eric Busboom <eric@civicknowledge.com>
-
- * Component.py Added Calendar class.
-
- * Componeny.py Changed all component constructor so they cannot
- take string arguments. Now, only NewComponent() can turn an iCal
- string into a component.
-
-
-2001-04-02 Eric Busboom <eric@civicknowledge.com>
-
- * Component.py removed arguments from the Event constructor, since
- I presume that the Component derived classes will always be
- constructed with no arguments.
-
- * Property.py Split out Attendee, Organizer, Time, Duration and
- Period into their own files. Moved remaining classes to Derived
- Properties.pm
-
-
-2001-03-13 Eric Busboom <eric@civicknowledge.com>
-
- * Component.py Added Component.property()
-
-2001-03-10 Patrick Lewis <plewis@inetarena.com>
-
- * Added __str__ method to Collection.Collection
-
- * Component.Component can now be initialized without arguments
-
- * Made _singular_property and _multiple_properties (in Component)
- useful for nearly all the specific component interfaces
-
- * Changed Property.Attendee and Property.Organizer to allow creation
- with no arguments
-
- * Filled in Todo skeleton
-
- * Added test function for an Event
-
-
-2001-03-05 Eric Busboom <eric@civicknowledge.com>
-
- * Property.py Added a lot of exception code to signal failure to
- create a Property.
-
- * DerivedProperties.py Added derived property classes for RDATE
- and TRIGGER, two properties that can have one of two value types.
-
-
-2001-03-04 Eric Busboom <eric@civicknowledge.com>
-
- * Property.pm Added Property.ConstructorFailedError exception
-
- * Component.pm fixed bug in Collection.__setslice__. "," used
- instead of ":"
-
-2001-03-04 Patrick Lewis <plewis@inetarena.com>
-
- * Split Libical.py file into Component.py, Property.py, Collection.py,
- and Store.py
-
- * Added test_* functions to test.py
-
- * Changed component bindings to return a Collection when objects can
- have multiple values
-
- * Changed Component object to allow for creation of an object without
- an initial string
-
- * Added Todo and Journal events
-
-2001-02-28 Eric Busboom <eric@civicknowledge.com>
-
- * Property Remove most internal data. The property now work
- almost entirely off of the icalproperty that it holds a reference
- to. Made changes in all derived Properties to accommodate the
- change.
-
- * Property Added __del__
-
- * Component Component.properties() now caches properties that it
- constructs, so two calls to properties() to that get the same
- icalproperty will also get the same Property.
-
- * Property Added Property.__cmp__ to test equality of properties
- based on ical string values
-
-2001-02-27 Eric Busboom <eric@civicknowledge.com>
-
- * Property Added Property.ref() to set/get the reference to the
- Property's internal icalproperty
-
- * Property Property._update_value now changes the icalproperty
- value if a reference has been set.
-
- * Component re-instituted Component.properties(). The routine now
- adds a 'ref' key to the dict that holds the python pointer
- string. The C hex value of the pointer is in the 'pid' key
-
-
-2001-02-27 Patrick Lewis <plewis@inetarena.com>
-
- * Backed out changes to Component removing comp_p;
- Component.comp_p should be restored
-
-2001-02-26 Eric Busboom <eric@civicknowledge.com>
-
- * Period Added test routine,test_period()
-
- * Period implemented methods in period
-
- * Time Added addition and subtraction operators
-
-2001-02-25 Eric Busboom <eric@civicknowledge.com>
-
- * Libical.py Added test routine for time, time_test()
-
- * Libical.py Remove end of line chars ('\r\n" ) from
- Property._str__. Caller should add these lines itself
-
- * Liical.py CHanges Time._update_values to set time VALUE type
- based on use of is_date, rather than length of string.
-
- * Libical.py Removed call to _update_value in TIme::timezone
-
-
- * Libical.py changed update_value to _update_value
-
diff --git a/src/python/Collection.py b/src/python/Collection.py
deleted file mode 100644
index 389689e0..00000000
--- a/src/python/Collection.py
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: Collection.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#======================================================================
-
-from types import *
-
-class Collection:
- """A group of components that can be modified somewhat like a list.
-
- Usage:
- Collection(component, propSequence)
-
- component is a Component object
- propSequence is a list or tuple of Property (or subclass of Property)
- of objects already in component
- """
-
- def __init__(self, component, propSequence):
- self._properties = list(propSequence[:])
- self._component = component
-
- def __getslice__(self, beg, end):
- return Collection(self._component, self._properties[beg:end])
-
- def __setslice__(self, beg, end, sequence):
-
- if not isinstance(sequence,ListType):
- raise TypeError, "must assign list (not instance) to slice"
-
- oldProps = self._properties[beg:end]
-
- for p in oldProps:
- self._component.remove_property(p)
-
- self._properties[beg:end] = sequence
- for p in sequence:
- self._component.add_property(p)
-
- def __getitem__(self, i):
- return self._properties[i]
-
- def __setitem__(self, i, prop):
- self._component.remove_property(self._properties[i])
- self._component.add_property(prop)
- self._properties[i]=prop
-
- def __delitem__(self, i):
- self._component.remove_property(self._properties[i])
- del self._properties[i]
-
- def __len__(self):
- return len(self._properties)
-
- def __str__(self):
- s = "[ "
- if self._properties:
- s = s + str(self._properties[0])
- for p in self._properties[1:]:
- s = "%s, %s" % (s, p)
- s = s + " ]"
- return s
-
- def append(self, property):
- self._properties.append(property)
- self._component.add_property(property)
-
-class ComponentCollection:
-
- def __init__(self, parent, componentSequence):
- self._parent = parent
- self._components = list(componentSequence[:])
-
- def __getslice__(self, beg, end):
- return ComponentCollection(self._parent, self._components[beg:end])
-
- def __setslice__(self, beg, end, sequence):
- oldComps = self._components[beg:end]
- self._components.__setslice__(beg, end, sequence)
- for c in sequence:
- self._parent.add_component(c)
- for c in oldComps:
- self._parent.remove_component(c)
-
- def __getitem__(self, i):
- return self._components[i]
-
- def __setitem__(self, i, prop):
- self._parent.remove_component(self._components[i])
- self._parent.add_property(prop)
- self._components[i]=prop
-
- def __delitem__(self, i):
- self._parent.remove_component(self._components[i])
- del self._components[i]
-
- def __len__(self):
- return len(self._components)
-
- def __add__(self, iterable):
- for i in iterable:
- self.append(i)
-
- def append(self, property):
- self._components.append(property)
- self._parent.add_component(property)
diff --git a/src/python/Component.py b/src/python/Component.py
deleted file mode 100644
index 598e4977..00000000
--- a/src/python/Component.py
+++ /dev/null
@@ -1,816 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: Component.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#======================================================================
-
-from LibicalWrap import *
-from types import DictType, StringType, IntType
-from Property import Property
-from Collection import *
-from Attendee import Attendee, Organizer
-from Time import Time
-from Duration import Duration
-from Period import Period
-import string
-
-WrapperNULL = None
-
-# Swig objects are natively unhashable, so we hash on the pointer val.
-class SwigRefHash(dict):
- def __getitem__(self, k):
- return dict.__getitem__(self, int(k))
-
- def __setitem__(self, k, v):
- return dict.__setitem__(self, int(k), v)
-
- def __delitem__(self, k):
- dict.__delitem__(self, int(k))
-
- def has_key(self, k):
- return dict.has_key(self, int(k))
-
-class Component(object):
-
- def __init__(self,ref=None,kind=None):
-
- if ref != None:
- self._ref = ref
- elif kind != None:
- self._ref = icalcomponent_new(
- icalcomponent_string_to_kind("VCALENDAR"))
- _kind = icalcomponent_string_to_kind(kind)
- inner = icalcomponent_new(_kind)
-
- icalcomponent_add_component(self._ref,inner);
-
- else:
- raise "Could not construct component with an unspecified kind"
-
- self.cached_props = SwigRefHash()
- self.cached_comps = SwigRefHash()
-
- def __del__(self):
- if self._ref != None and icalcomponent_get_parent(self._ref) != WrapperNULL:
-
- for k in self.cached_props.keys():
- del self.cached_props[k]
-
- icalcomponent_free(self._ref)
- self._ref = None
-
- def _prop_from_ref(self,p):
-
- if(p == None or p== WrapperNULL):
- return None;
-
- d = {}
- d['value'] = icalproperty_get_value_as_string(p)
- d['name'] = icalproperty_get_property_name(p)
-
- propkind = icalproperty_string_to_kind(d['name'])
- kind = icalproperty_kind_to_value_kind(propkind)
- d['value_type'] = icalvalue_kind_to_string(kind)
- d['ref'] = p
-
-
- #~ print p, Property(ref=p).name()
- if not self.cached_props.has_key(p):
-
- if d['value_type'] == 'DATE-TIME' or d['value_type'] == 'DATE':
- prop = Time(d,)
- elif d['value_type'] == 'PERIOD':
- prop = Period(d)
- elif d['value_type'] == 'DURATION':
- prop = Duration(d)
- elif d['name'] == 'ATTACH':
- prop = Attach(d)
- elif d['name'] == 'ATTENDEE':
- prop = Attendee(d)
- elif d['name'] == 'ORGANIZER':
- prop = Organizer(d)
- else:
- prop=Property(ref=p)
-
- self.cached_props[p] = prop
-
- def property(self, type):
-
- p = icallangbind_get_first_property(self._ref,type)
-
- if p !=WrapperNULL:
- self._prop_from_ref(p)
- return self.cached_props[p]
-
- def properties(self,type='ANY'):
- """
- Returns a list of Property instances, each representing a
- property of the type 'type.'
- """
-
- props = []
-
- p = icallangbind_get_first_property(self._ref,type)
-
- while p !=WrapperNULL and p != None:
-
- self._prop_from_ref(p) # Puts property in self.cached_props
- prop = self.cached_props[p]
- props.append(prop)
- p = icallangbind_get_next_property(self._ref,type)
-
- return Collection(self,props)
-
- def add_property(self, prop):
- "Adds the property object to the component."
-
- if not isinstance(prop,Property):
- raise TypeError
-
- prop_p = prop.ref()
-
- if not prop_p:
- s = str(prop)
- prop_p = icalproperty_new_from_string(s)
-
- if prop_p == WrapperNULL:
- raise "Bad property string: " + s
-
- prop.ref(prop_p)
-
- if icalproperty_get_parent(prop_p)==WrapperNULL:
- icalcomponent_add_property(self._ref, prop_p)
- elif icalproperty_get_parent(prop_p) != self._ref:
- raise "Property is already a child of another component"
-
-
- def remove_property(self,prop):
-
- if prop.ref() and self.cached_props.has_key(prop.ref()):
-
- del self.cached_props[prop.ref()]
- icalcomponent_remove_property(self._ref,prop.ref())
-
- def components(self,type='ANY'):
- comps = []
-
- kind = icalcomponent_string_to_kind(type)
- c = icalcomponent_get_first_component(self._ref,kind);
-
- while c != WrapperNULL and c != None:
-
- if not self.cached_comps.has_key(c):
-
- self.cached_comps[c] = Component(c)
-
- comp = self.cached_comps[c]
- comps.append(comp)
- c = icalcomponent_get_next_component(self._ref,kind);
-
- return ComponentCollection(self, comps)
-
- def inner_component(self):
-
- inner = icalcomponent_get_inner(self._ref)
-
- if inner != WrapperNULL or inner is None:
- return NewComponent(inner)
-
- def add_component(self, comp):
- "Adds a child component."
-
- if not isinstance(comp,Component):
- raise ValueError("Expected a Component")
-
- if icalcomponent_get_parent(comp._ref) != WrapperNULL:
- raise "Failed to add child component. Child already has a parent";
-
- icalcomponent_add_component(self._ref,comp._ref)
-
- def remove_component(self, comp):
- "Removes a child component"
-
- if not isinstance(comp,Component):
- raise ValueError("Expected a Component")
-
- icalcomponent_remove_component(self._ref,comp._ref)
-
- def as_ical_string(self):
- return self.__str__()
-
- def __str__(self):
-
- return icalcomponent_as_ical_string(self._ref)
-
- def name(self):
- k = icalcomponent_isa(self._ref)
- return icalcomponent_kind_to_string(k)
-
- def ref(self):
- """ Returns the internal reference to the libical icalproperty """
- return self._ref
-
-def CloneComponent(c):
- "Clones a string or C icalcomponent into the right component object."
-
- wasStr=0 # Were we passed a string or an icalcomponent?
-
- if isinstance(c, Component):
- comp = icalparser_parse_string(c.as_ical_string())
- elif isinstance (c, StringType) and string.find(c,"icalcomponent") == -1:
- comp = icalparser_parse_string(c)
- else:
- comp = c
-
- if comp == None or comp == WrapperNULL:
- raise ValueError("Expected a libical reference or an iCal string")
-
- kind = icalcomponent_isa(comp)
- kindStr = icalcomponent_kind_to_string(kind)
-
- if kindStr == 'VCALENDAR':
- inner = icalcomponent_get_inner(comp)
- kind = icalcomponent_isa(inner)
- kindStr = icalcomponent_kind_to_string(kind)
-
- if kindStr == 'VEVENT':
- newComp = Event(comp)
- elif kindStr == 'VTODO':
- newComp = Todo(comp)
- elif kindStr == 'VJOURNAL':
- newComp = Journal(comp)
- else:
- newComp = Component(comp)
-
- # I don't think I need to free the component created when passed a string,
- # as it wasn't created with a _new function.
-
- return newComp
-
-
-def NewComponent(c):
- "Converts a string or C icalcomponent into the right component object."
-
- wasStr=0 # Were we passed a string or an icalcomponent?
-
- if isinstance (c, StringType) and string.find(c,"icalcomponent") == -1:
- comp = icalparser_parse_string(c)
- else:
- comp = c
-
- if comp == None or comp == WrapperNULL:
- raise ValueError("Expected a libical reference or an iCal string")
-
- kind = icalcomponent_isa(comp)
- kindStr = icalcomponent_kind_to_string(kind)
-
- if kindStr == 'VEVENT':
- newComp = Event(comp)
- elif kindStr == 'VTODO':
- newComp = Todo(comp)
- elif kindStr == 'VJOURNAL':
- newComp = Journal(comp)
- else:
- newComp = Component(comp)
-
- # I don't think I need to free the component created when passed a string,
- # as it wasn't created with a _new function.
-
- return newComp
-
-
-class GenericComponent(Component):
-
- def __init__(self,ref=None,kind=None):
-
- if ref != None:
- Component.__init__(self, ref=ref) # Call from subclasses
- elif type != None:
- Component.__init__(self, kind=kind) # Call from subclasses
- else:
- raise ValueError("Expected either a icalcomponent reference or a kind string")
-
-
- self._recurrence_set=None
-
- def _singular_property(self, name, value_type, value=None,
- property_obj=None, enumerated_values=None):
- """Sets or gets the value of a method which exists once per Component.
-
- This is a constructor method for properties without a strictly defined
- object."""
-
- # Depending on the property name, this routine will either
- # operate on the VCALENDAR container or on the inner VEVENT,
- # VTODO, or VJOURNAL
-
- if name in ['METHOD','PRODID','CALSCALE','VERSION']:
- comp = self
- else:
- comp = self.inner_component()
-
- curr_properties = comp.properties(name)
-
- # Get the value
- if value==None:
- if not curr_properties:
- return None
- elif len(curr_properties) == 1:
- return curr_properties[0]
- else:
- raise ValueError, "too many properties of type %s" % propType
-
- # Set the value
- else:
- # Check if value is in enumerated_values
- if enumerated_values:
- value = string.upper(value)
- if value not in enumerated_values:
- raise ValueError, "%s is not one of %s" \
- % (value, enumerated_values)
-
- # Create the new property
- if property_obj:
- if not isinstance(value, property_obj):
- # Create a special property_obj property
- if property_obj == Time:
- p = Time(value, name)
- ## p.value_type(value_type)
- elif property_obj == Duration:
- p = Duration(value)
- else:
- p = property_obj()
- ## p.value_type(value_type)
- p.value(value)
- else:
- p = value # value is already a property_obj
- else:
- # Create a generic property
- p = Property(name)
- ## p.value_type(value_type)
- p.value(value)
-
- if len(curr_properties) == 1:
- comp.remove_property(curr_properties[0])
- elif curr_properties:
- raise ValueError, "too many properties of type %s" % propType
-
- comp.add_property(p)
-
- # METHOD, PRODID, CALSCALE and VERSION are properties of the
- # VCALENDAR, not the inner component
-
- def method(self, v=None):
- "Sets or returns the value of the METHOD property."
- return self._singular_property("METHOD", "TEXT", v)
-
- def prodid(self, v=None):
- "Sets or returns the value of the PRODID property."
- return self._singular_property("PRODID", "TEXT", v)
-
- def calscale(self, v=None):
- "Sets or returns the value of the CALSCALE property."
- return self._singular_property("CALSCALE", "TEXT", v)
-
- def version(self, v=None):
- "Sets or returns the value of the Version property."
- return self._singular_property("VERSION", "TEXT", v)
-
- # The remaining properties are all in the inner component
-
- def clone(self):
- "Returns a copy of the object."
- return CloneComponent(self)
-
- def class_prop(self, v=None): # Class is a reserved word
- "Sets or returns the value of the CLASS property."
- if v!=None:
- v = string.upper(v)
- return self._singular_property('CLASS', 'TEXT', v)
-
- def created(self, v=None):
- """Sets or returns the value of the CREATED property.
-
- Usage:
- created(time_obj) # Set the value using a Time object
- created('19970101T123000Z') # Set using an iCalendar string
- created(982362522) # Set using seconds
- created() # Return an iCalendar string
- """
- return self._singular_property("CREATED", "DATE-TIME", v, Time)
-
- def description(self, v=None):
- "Sets or returns the value of the DESCRIPTION property."
- return self._singular_property("DESCRIPTION", "TEXT", v)
-
- def dtstamp(self, v=None):
- """Sets or returns the value of the DTSTAMP property.
-
- Usage:
- dtstamp(time_obj) # Set the value using a Time object
- dtstamp('19970101T123000Z')# Set using an iCalendar string
- dtstamp(982362522) # Set using seconds
- dtstamp() # Return an iCalendar string
- """
- return self._singular_property("DTSTAMP", "DATE-TIME", v, Time)
-
- def dtstart(self, v=None):
- """Sets or returns the value of the DTSTART property.
-
- Usage:
- dtstart(time_obj) # Set the value using a Time object
- dtstart('19970101T123000Z') # Set the value as an iCalendar string
- dtstart(982362522) # Set the value using seconds (time_t)
- dtstart() # Return the time as an iCalendar string
- """
- return self._singular_property("DTSTART", "DATE-TIME", v, Time)
-
- def last_modified(self, v=None):
- """Sets or returns the value of the LAST-MODIFIED property.
-
- Usage:
- last_modified(time_obj) # Set the value using a Time object
- last_modified('19970101T123000Z')# Set using an iCalendar string
- last_modified(982362522) # Set using seconds
- last_modified() # Return an iCalendar string
- """
- return self._singular_property("LAST-MODIFIED", "DATE-TIME", v, Time)
-
- def organizer(self, v=None):
- """Sets or gets the value of the ORGANIZER property.
-
- Usage:
- organizer(orgObj) # Set value using an organizer object
- organizer('MAILTO:jd@not.com') # Set value using a CAL-ADDRESS string
- organizer() # Return a CAL-ADDRESS string
- """
- return self._singular_property('ORGANIZER', 'CAL-ADDRESS', v,
- Organizer)
-
- def recurrence_id(self, v=None):
- """Sets or gets the value for the RECURRENCE-ID property.
-
- Usage:
- recurrence_id(recIdObj) # Set using a Recurrence_Id object
- recurrence_id("19700801T133000") # Set using an iCalendar string
- recurrence_id(8349873494) # Set using seconds from epoch
- recurrence_id() # Return an iCalendar string
- """
- return self._singular_property('RECURRENCE-ID', 'DATE-TIME', v,
- Recurrence_Id)
-
- def sequence(self, v=None):
- """Sets or gets the SEQUENCE value of the Event.
-
- Usage:
- sequence(1) # Set the value using an integer
- sequence('2') # Set the value using a string containing an integer
- sequence() # Return an integer
- """
- if isinstance(v, StringType):
- v = int(str)
- return self._singular_property('SEQUENCE', 'INTEGER', v)
-
- def summary(self, v=None):
- "Sets or gets the SUMMARY value of the Event."
- return self._singular_property('SUMMARY', 'TEXT', v)
-
- def uid(self, v=None):
- "Sets or gets the UID of the Event."
- return self._singular_property('UID', 'TEXT', v)
-
- def url(self, v=None):
- """Sets or returns the URL property."""
- return self._singular_property('URL', 'URI', v)
-
- ####
- # Not quite sure if this is how we want to handle recurrence rules, but
- # this is a start.
-
- def recurrence_set(self):
- "Returns the Events RecurrenceSet object."
- if self._recurrence_set == None: # i.e haven't initialized one
- self._recurrence_set = RecurrenceSet()
- return self._recurrence_set
-
- ###
- # Alarm interface. Returns an ComponentCollection.
-
- def alarms(self, values=None):
- """Sets or returns ALARM components.
-
- Examples:
- alarms((alarm1,)) # Set using Alarm component
- alarms() # Returns an ComponentCollection of all Alarms
- """
- if values!=None:
- for alarm in values:
- self.add_component(alarm)
- else:
- return self.components('VALARM')
-
- ####
- # Methods that deal with Properties that can occur multiple times are
- # below. They use the Collection class to return their Properties.
-
- def _multiple_properties(self, name, value_type, values,
- property_obj=None):
- "Processes set/get for Properties that can have multiple instances."
-
- comp = self.inner_component()
-
- # Set value
- if values!=None:
- if not isinstance(values, TupleType) \
- and not isinstance(values, ListType):
- raise TypeError, "%s is not a tuple or list."
-
- # Delete old properties
- for p in comp.properties(name):
- comp.remove_property(p)
-
- for v in values:
- if property_obj: # Specialized properties
- if not isinstance(v, property_obj): # Make new object
- new_prop = property_obj()
- new_prop.value(v)
- else: # Use existing object
- new_prop = v
- else: # Generic properties
- new_prop=Property(name)
- # new_prop.value_type(value_type)
- new_prop.value(v)
-
- comp.add_property(new_prop)
-
- # Get value
- else:
- return Collection(self, comp.properties(name))
-
- def attachments(self, values=None):
- """Sets or returns a Collection of Attach properties.
-
- 'values' can be a sequence containing URLs (strings) and/or file-ish
- objects.
- """
- return self._multiple_properties("ATTACH", "", value, Attach)
-
- def attendees(self, value=None):
- """Sets attendees or returns a Collection of Attendee objects.
-
- If setting the attendees, pass a sequence as the argument.
- Examples:
- # Set using Attendee objects
- attendees((attObj1, attObj2))
- # Set using a CAL-ADDRESS string
- attendees(['MAILTO:jdoe@somewhere.com'])
- # Set using a combination of Attendee objects and strings
- attendees(['MAILTO:jdoe@somewhere.com', attObj1])
- # Returns a list of Attendee objects
- attendees()
-
- When setting the attendees, any previous Attendee objects in the Event
- are overwritten. If you want to add to the Attendees, one way to do it
- is:
-
- attendees().append(Attendee('MAILTO:jdoe@nothere.com'))
- """
- return self._multiple_properties("ATTENDEE", "", value, Attendee)
-
- def categories(self, value=None):
- """Sets categories or returns a Collection of CATEGORIES properties.
-
- If setting the categories, pass a sequence as the argument.
- Examples:
- # Set using string[s]
- categories(('APPOINTMENT', 'EDUCATION'))
- # Returns a list of Category properties
- categories()
-
- When setting the attendees, any previous category Properties in the
- Event are overwritten. If you want to add to the categories, one way
- to do it is:
-
- new_cat=Property('CATEGORIES')
- new_cat.value_type('TEXT')
- new_cat.value('PERSONAL')
- categories().append(new_cat)
- """
- return self._multiple_properties("CATEGORIES", "TEXT", value)
-
- def comments(self, value=None):
- "Sets or returns a Collection of COMMENT properties."
- return self._multiple_properties('COMMENT', 'TEXT', value)
-
- def contacts(self, value=None):
- "Sets or returns a Collection of CONTACT properties."
- return self._multiple_properties('CONTACT', 'TEXT', value)
-
- def related_tos(self, value=None):
- "Sets or returns a Collection of RELATED-TO properties."
- return self._multiple_properties('RELATED-TO', 'TEXT', value)
-
- def x_properties(self, name, value=None):
- "Sets or returns a Collection of X- properties."
- return self._multiple_properties(name, 'TEXT', value)
-
-class Event(GenericComponent):
- "The iCalendar Event object."
-
- def __init__(self,ref=None):
- if ref != None:
- GenericComponent.__init__(self, ref=ref)
- else:
- GenericComponent.__init__(self, kind='VEVENT')
-
- def component_type(self):
- "Returns the type of component for the object."
- return "VEVENT"
-
- def dtend(self, v=None):
- """Sets or returns the value of the DTEND property.
-
- Usage:
- dtend(time_obj) # Set the value using a Time object
- dtend('19970101T123000Z') # Set the value as an iCalendar string
- dtend(982362522) # Set the value using seconds (time_t)
- dtend() # Return the time as an iCalendar string
-
- If the dtend value is being set and duration() has a value, the
- duration property will be removed.
- """
- if v != None:
- duration = self.properties('DURATION')
- for d in duration: # Clear DURATION properties
- self.remove_property(d)
- return self._singular_property("DTEND", "DATE-TIME", v, Time)
-
- def duration(self, v=None):
- """Sets or returns the value of the duration property.
-
- Usage:
- duration(dur_obj) # Set the value using a Duration object
- duration("P3DT12H") # Set value as an iCalendar string
- duration(3600) # Set duration using seconds
- duration() # Return duration as an iCalendar string
-
- If the duration value is being set and dtend() has a value, the dtend
- property will be removed.
- """
-
- if v != None:
- dtend = self.properties('DTEND')
- for d in dtend:
- self.remove_property(d) # Clear DTEND properties
- return self._singular_property("DURATION", "DURATION", v, Duration)
-
- def status(self, v=None):
- "Sets or returns the value of the STATUS property."
-
- # These values are only good for VEVENT components (i.e. don't copy
- # & paste into VTODO or VJOURNAL
- valid_values=('TENTATIVE', 'CONFIRMED', 'CANCELLED')
- return self._singular_property("STATUS", "TEXT", v,
- enumerated_values=valid_values)
-
- def geo(self, v=None):
- """Sets or returns the value of the GEO property.
-
- Usage:
- geo(value) or
- geo() # Returns the icalendar string
-
- 'value' is either a icalendar GEO string or a sequence with two 'float'
- numbers.
-
- Examples:
- geo('40.232;-115.9531') # Set value using string
- geo((40.232, -115.9531)) # Set value using a sequence
- geo() # Returns "40.232;-115.9531"
-
- To get the GEO property represented as a tuple and numbers instead of
- the iCalendar string, use geo_get_tuple().
- """
-
- if isinstance(v, ListType) or isinstance(v, TupleType):
- v = "%s;%s" % (float(v[0]), float(v[1]))
- return self._singular_property("GEO", "FLOAT", v)
-
- def geo_get_tuple(self):
- """Returns the GEO property as a tuple."""
-
- geo = self.geo()
- geo = split(geo, ';')
- return float(geo[0]), float(geo[1])
-
- def location(self, v=None):
- """Sets or returns the LOCATION property."""
- return self._singular_property("LOCATION", "TEXT", v)
-
- def transp(self, v=None):
- """Sets or returns the TRANSP property."""
- ok_values = ('OPAQUE', 'TRANSPARENT')
- return self._singular_property('TRANSP', 'TEXT', v,
- enumerated_values=ok_values)
-
- def resources(self, v=None):
- pass
-
-class Todo(GenericComponent):
- "The iCalendar TODO component."
-
- def __init__(self,ref=None):
- if ref != None:
- GenericComponent.__init__(self, ref=ref)
- else:
- GenericComponent.__init__(self, kind='VTODO')
-
-
- def component_type(self):
- "Returns the type of component for the object."
- return "VTODO"
-
- def completed(self, value=None):
- return self._singular_property('COMPLETED', 'DATE-TIME', value, Time)
-
- def geo(self, value=None):
- if isinstance(value, ListType) or isinstance(value, TupleType):
- v = "%s;%s" % (float(value[0]), float(value[1]))
- return self._singular_property("GEO", "FLOAT", v)
-
- def location(self, value=None):
- return self._singular_property('LOCATION', 'TEXT', value)
-
- def percent(self, value=None):
- if value!=None:
- value = str(int(value))
- return self._singular_property('PERCENT', 'INTEGER', value)
-
- def status(self, value=None):
- if value!=None:
- value=string.upper(value)
- ok_values = ('NEEDS-ACTION', 'COMPLETED', 'IN-PROCESS', 'CANCELLED')
- return self._singular_property('STATUS', 'TEXT', value,
- enumerated_values=ok_values)
-
- def due(self, value=None):
- if value != None:
- duration = self.properties('DURATION')
- for d in duration:
- self.remove_property(d) # Clear DURATION properties
- return self._singular_property('DUE', 'DATE-TIME', value, Time)
-
- def duration(self, value=None):
- if value != None:
- due = self.properties('DUE')
- for d in due:
- self.remove_property(d) # Clear DUE properties
- return self._singular_property("DURATION", "DURATION", value, Duration)
-
- def resources():
- pass
-
-class Journal(GenericComponent):
- "The iCalendar JOURNAL component."
-
- def __init__(self):
- if ref != None:
- GenericComponent.__init__(self, ref=ref)
- else:
- GenericComponent.__init__(self, kind='VJOURNAL')
-
- def component_type(self):
- "Returns the type of component for the object."
- return "VJOURNAL"
-
- def status(self, v=None):
- if v!=None:
- v = string.upper(v)
- ok_values=('DRAFT', 'FINAL', 'CANCELLED')
- return self._singular_property('STATUS', 'TEXT', v,
- enumerated_values=ok_values)
diff --git a/src/python/DerivedProperties.py b/src/python/DerivedProperties.py
deleted file mode 100644
index 3a64f96f..00000000
--- a/src/python/DerivedProperties.py
+++ /dev/null
@@ -1,151 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: DerivedProperties.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#======================================================================
-
-from Property import Property
-from Time import Time
-from Period import Period
-from Duration import Duration
-
-def RDate(arg):
-
- class RDate_Time(Time):
- def __init__(self,arg): Time.__init__(self,arg,"RDATE")
-
- class RDate_Period(Period):
- def __init__(self,arg): Period.__init__(self,arg,"RDATE")
-
- p = None
- for c in [RDate_Time, RDate_Period]:
- try: return c(arg)
- except Property.ConstructorFailedError, d: pass
- raise Property.ConstructorFailedError("Failed to construct RDATE from "+str(arg))
-
-
-def Trigger(arg):
- class Trigger_Time(Time):
- def __init__(self,arg): Time.__init__(self,arg,"TRIGGER")
-
- class Trigger_Duration(Duration):
- def __init__(self,arg): Duration.__init__(self,arg,"TRIGGER")
-
- p = None
- for c in [Trigger_Duration, Trigger_Time]:
- try: return c(arg)
- except Property.ConstructorFailedError, d: pass
- raise Property.ConstructorFailedError("Failed to construct TRIGGER from "+str(arg))
-
-
-
-class Recurrence_Id(Time):
- """Class for RECURRENCE-ID property.
-
- Usage:
- Reccurence_Id(dict) # A normal property dictionary
- Reccurence_Id("19960401") # An iCalendar string
- Reccurence_Id(8349873494) # Seconds from epoch
-
- If the 'dict' constructor is used, 'name' and 'value_type'
- entries in dict are ignored and automatically set with the appropriate
- values.
- """
-
- def __init__(self, dict={}):
- Time.__init__(self, dict)
- Property.name(self, 'RECURRENCE-ID')
-
- def name(self):
- return Property.name(self)
-
- def _doParam(self, parameter, v):
- if v!=None:
- self[parameter]=v
- return self[parameter]
-
- # Enumerated parameters
- def value_parameter(self, v=None):
- """Sets or gets the VALUE parameter value.
-
- The value passed should be either "DATE-TIME" or "DATE". Setting this
- parameter has no impact on the property's value_type. Doing something
- like:
-
- rid=Recurrence_Id("19960401") # Sets value & makes value_type="DATE"
- rid.value_parameter("DATE-TIME") # Sets the parameter VALUE=DATE-TIME
-
- Would be allowed (even though it is wrong), so pay attention.
- Verifying the component will reveal the error.
- """
- if v!=None and v!="DATE" and v!="DATE-TIME":
- raise ValueError, "%s is an invalid VALUE parameter value" % str(v)
- self._doParam("VALUE", v)
-
- def tzid(self, v=None):
- "Sets or gets the TZID parameter value."
- self._doParam("TZID", v)
-
- def range_parameter(self, v=None): # 'range' is a builtin function
- "Sets or gets the RANGE parameter value."
- if v!=None and v!="THISANDPRIOR" and v!= "THISANDFUTURE":
- raise ValueError, "%s is an invalid RANGE parameter value" % str(v)
- self._doParam("RANGE", v)
-
-class Attach(Property):
- """A class representing an ATTACH property.
-
- Usage:
- Attach(uriString [, parameter_dict])
- Attach(fileObj [, parameter_dict])
- """
-
- def __init__(self, value=None, parameter_dict={}):
- Property.__init__(self, parameter_dict)
- Property.name(self, 'ATTACH')
- self.value(value)
-
- def value(self, v=None):
- "Returns or sets the value of the property."
- if v != None:
- if isinstance(v, StringType): # Is a URI
- self._desc['value']=v
- Property.value_type(self, 'URI')
- else:
- try:
- tempStr = v.read()
- except:
- raise TypeError,"%s must be a URL string or file-ish type"\
- % str(v)
- self._desc['value'] = base64.encodestring(tempStr)
- Property.value_type(self, 'BINARY')
- else:
- return self._desc['value']
-
- def name(self):
- "Returns the name of the property."
- return Property.name(self)
-
- def value_type(self):
- return Property.value_type(self)
-
- def fmttype(self, v=None):
- "Gets or sets the FMTYPE parameter."
- if v!= None:
- self['FMTTYPE']=v
- else:
- return self['FMTTYPE']
diff --git a/src/python/Duration.py b/src/python/Duration.py
deleted file mode 100644
index 8997f59d..00000000
--- a/src/python/Duration.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: Duration.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#===============================================================
-
-from LibicalWrap import *
-from Property import Property
-from types import DictType, StringType, IntType
-
-class Duration(Property):
- """
- Represent a length of time, like 3 minutes, or 6 days, 20 seconds.
-
-
- """
-
- def __init__(self, arg, name="DURATION"):
- """
- Create a new duration from an RFC2445 string or number of seconds.
- Construct the duration from an iCalendar string or a number of seconds.
-
- Duration("P3DT2H34M45S") Construct from an iCalendar string
- Duration(3660) Construct from seconds
- """
-
- self.dur = None
-
- e=icalerror_supress("MALFORMEDDATA")
-
- if isinstance(arg, DictType):
-
- self.dur = icaldurationtype_from_string(arg['value'])
- Property.__init__(self,ref=arg['ref'])
- else:
- if isinstance(arg, StringType):
- self.dur = icaldurationtype_from_string(arg)
- elif isinstance(arg, IntType):
- self.dur = icaldurationtype_from_int(arg)
- elif isinstance(arg,Duration):
- self.dur = arg.dur
- else:
- self.dur = icaldurationtype_null_duration()
-
- Property.__init__(self,type=name)
-
- icalerror_restore("MALFORMEDDATA",e)
-
- if self.dur == None or icaldurationtype_is_null_duration(self.dur):
- raise Property.ConstructorFailedError("Failed to construct Duration from " +str(arg))
-
- try:
- self._update_value()
- except Property.UpdateFailedError:
- raise Property.ConstructorFailedError("Failed to construct Duration from " + str(arg))
-
- def _update_value(self):
-
- self.value(icaldurationtype_as_ical_string(self.dur),"DURATION")
-
- def valid(self):
- "Returns true if this is a valid duration"
-
- return not icaldurationtype_is_null_duration(self.dur)
-
- def seconds(self,v=None):
- """Return or set duration in seconds"""
- if(v != None):
- self.dur = icaldurationtype_from_int(v);
- self.dict['value'] = icaltimedurationtype_as_ical_string(self.dur)
- return icaldurationtype_as_int(self.dur)
diff --git a/src/python/Error.py b/src/python/Error.py
deleted file mode 100644
index 47fa0e7a..00000000
--- a/src/python/Error.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#======================================================================
-# FILE: Error.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-
-
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#===========================================================
-
-class LibicalError(Exception):
- "Libical Error"
-
- def __init__(self,str):
- Exception.__init__(self,str)
-
- def __str__(self):
- return Exception.__str__(self)+"\nLibical errno: "+icalerror_perror()
diff --git a/src/python/Gauge.py b/src/python/Gauge.py
deleted file mode 100644
index 44954006..00000000
--- a/src/python/Gauge.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: Gauge.py
-# CREATOR: mtearle
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#======================================================================
-
-from LibicalWrap import *
-from Error import LibicalError
-from Component import Component
-
-class Gauge:
- """
- Base class for gauge
- """
-
- class ConstructorFailedError(LibicalError):
- "Failed to create a Gauge "
-
- class CloneFailedError(LibicalError):
- "Failed to clone a component given Gauge "
-
- class CompareFailedError(LibicalError):
- "Failed to compare a component given Gauge "
-
- def __init__(self,ref=None,sql=None,expand=0):
- if ref != None:
- self._ref = ref
- elif sql != None:
- s = str(sql)
- self._ref = icalgauge_new_from_sql(s,expand)
- else:
- Gauge.ConstructorFailedError("No SQL Specified")
-
- def __del__(self):
- if self._ref != None:
- icalgauge_free(self._ref)
- self._ref = None
-
- def ref(self):
- return self._ref
-
- def compare(self, comp):
- if not isinstance(comp,Component):
- raise Gauge.CompareFailedError("Argument is not a component")
-
- if comp.ref() == None:
- raise Gauge.CompareFailedError("Argument is not a component")
-
- return icalgauge_compare(self._ref, comp.ref())
diff --git a/src/python/Libical.py b/src/python/Libical.py
deleted file mode 100644
index 20a2b975..00000000
--- a/src/python/Libical.py
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: Libical.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#======================================================================
-
-from LibicalWrap import ICAL_PACKAGE, ICAL_VERSION
-from Component import Component, NewComponent, Event, Todo, Journal
-from Property import Property, RecurrenceSet, test_enum
-from Time import Time, UTC
-from Period import Period
-from Duration import Duration
-from Attendee import Attendee, Organizer
-from DerivedProperties import RDate, Trigger,Recurrence_Id, Attach
-from Store import Store, FileStore
-from Gauge import Gauge
-
-version = ICAL_VERSION
diff --git a/src/python/LibicalWrap.i b/src/python/LibicalWrap.i
deleted file mode 100644
index 070a6d5b..00000000
--- a/src/python/LibicalWrap.i
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C -*-*/
-/*======================================================================
- FILE: ical.i
-
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
-
- The contents of this file are subject to the Mozilla Public License
- Version 1.0 (the "License"); you may not use this file except in
- compliance with the License. You may obtain a copy of the License at
- https://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS"
- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- the License for the specific language governing rights and
- limitations under the License.
-
- The original author is Eric Busboom
-
- Contributions from:
- Graham Davison (g.m.davison@computer.org)
-
- ======================================================================*/
-
-%module LibicalWrap
-
-
-%{
-#include "libical/ical.h"
-#include "libicalss/icalss.h"
-
-#include <sys/types.h> /* for size_t */
-#include <time.h>
-
-%}
-
-%pythoncode %{
-import Error
-
-%}
-
-%feature("autodoc", "1");
-
-typedef int time_t;
-
-#ifndef _DLOPEN_TEST
-%ignore icalset_register_class(icalset *set);
-#endif
-
-
-//#include "fcntl.h" /* For Open flags */
-%include "libical/ical.h"
-%include "libicalss/icalss.h"
-
-%pythoncode %{
-
-# Helper functions for overriding default swig property methods
-def _swig_set_properties(cls, properties={}):
- for propname, props in properties.items():
- if len(props) > 0:
- cls.__swig_getmethods__[propname] = props[0]
- if len(props) > 1:
- cls.__swig_setmethods__[propname] = props[1]
- # Currently not used by swig
- if len(props) > 2:
- cls.__swig_delmethods__[propname] = props[2]
-
- if _newclass:
- setattr(cls, propname, _swig_property(*props))
-
-def _swig_remove_private_properties(cls, properties=tuple()):
- # By default remove all properties
- if not properties:
- props = cls.__swig_getmethods__.copy()
- props.update(cls.__swig_setmethods__)
- #props.update(cls.__swig_delmethods__)
- properties = props.keys()
-
- for propname in properties:
- if cls.__swig_getmethods__.has_key(propname):
- del cls.__swig_getmethods__[propname]
- if cls.__swig_setmethods__.has_key(propname):
- del cls.__swig_setmethods__[propname]
- # Currently not used by swig
- #if cls.__swig_delmethods__.has_key(propname):
- # del cls.__swig_delmethods__[propname]
-
- if _newclass and hasattr(cls, propname):
- delattr(cls, propname)
-
-import new
-def _swig_add_instance_methods(klass, meth_dict={}):
- for methname, func in meth_dict.items():
- meth = new.instancemethod(func, None, klass)
- if not methname: methname = func.__name__
- func.__name__ = methname
- setattr(klass, methname, meth)
-%}
-
-
-%include "LibicalWrap_icaltimezone.i"
-%include "LibicalWrap_icaltime.i"
diff --git a/src/python/LibicalWrap_icaltime.i b/src/python/LibicalWrap_icaltime.i
deleted file mode 100644
index f82a7706..00000000
--- a/src/python/LibicalWrap_icaltime.i
+++ /dev/null
@@ -1,196 +0,0 @@
-
-/*======================================================================
- FILE: LibicalWrap_icaltime.i
-
- (C) COPYRIGHT 2010 Glenn Washburn
-
- The contents of this file are subject to the Mozilla Public License
- Version 1.0 (the "License"); you may not use this file except in
- compliance with the License. You may obtain a copy of the License at
- https://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS"
- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- the License for the specific language governing rights and
- limitations under the License.
-
- The original author is Glenn Washburn (crass@berlios.de)
-
- Contributions from:
-
- ======================================================================*/
-
-// Add some methods to the icaltimetype struct
-%extend icaltimetype {
-
- /* ***** Special methods ***** */
-
- int __cmp__(const icaltimetype b) { return icaltime_compare(*($self), b); }
-
- /* ***** Conversion methods ***** */
-
- const char* as_ical_string() { return icaltime_as_ical_string(*($self)); }
- time_t as_timet(const icaltimezone *zone=NULL) {
- return icaltime_as_timet_with_zone(*($self), zone);
- }
-
- /* ***** Accessor methods ***** */
-
- const char *get_tzid() { return icaltime_get_tzid(*($self)); }
- int day_of_year() { return icaltime_day_of_year(*($self)); }
- int day_of_week() { return icaltime_day_of_week(*($self)); }
-
- /** Returns the day of the year for the first day of the week that the
- given time is within. */
- int start_doy_week(int fdow) {
- return icaltime_start_doy_week(*($self), fdow);
- }
-
- /** Returns the week number for the week the given time is within */
- int week_number() { return icaltime_week_number(*($self)); }
-
-
- /* ***** Query methods ***** */
-
- int is_null_time() { return icaltime_is_null_time(*($self)); }
-
- /** Returns false if the time is clearly invalid, but is not null. This
- is usually the result of creating a new time type buy not clearing
- it, or setting one of the flags to an illegal value. */
- int is_valid_time() { return icaltime_is_valid_time(*($self)); }
-
- /* is_date and is_utc are both over shadowed by the struct accessors,
- but they do the same thing. */
- int is_date() { return icaltime_is_date(*($self)); }
- int is_utc() { return icaltime_is_utc(*($self)); }
-
- /* ***** Modify, compare and utility methods ***** */
-
- /** Returns -1, 0, or 1 to indicate that a<b, a==b or a>b */
- int compare(const icaltimetype b) { return icaltime_compare(*($self), b); }
-
- /** like icaltime_compare, but only use the date parts. */
- int compare_date_only(const icaltimetype b, icaltimezone *tz=NULL) {
- if (tz == NULL)
- tz = icaltimezone_get_utc_timezone();
- return icaltime_compare_date_only_tz(*($self), b, tz);
- }
-
- /** Adds or subtracts a number of days, hours, minutes and seconds. */
- void adjust(const int days, const int hours, const int minutes, const int seconds) {
- return icaltime_adjust($self, days, hours, minutes, seconds);
- }
-
- /** Normalizes the icaltime, so that all fields are within the normal range. */
- icaltimetype normalize() { return icaltime_normalize(*($self)); }
-
- icaltimetype convert_to_zone(icaltimezone *zone) {
- return icaltime_convert_to_zone(*($self), zone);
- }
-
- /* ***** Static methods ***** */
-
- static icaltimetype from_timet(const time_t tm,
- const int is_date=0, const icaltimezone *zone=NULL) {
- return icaltime_from_timet_with_zone(tm, is_date, zone);
- }
-
- static icaltimetype null_time(void) { return icaltime_null_time(); }
- static icaltimetype null_date(void) { return icaltime_null_date(); }
-
- static icaltimetype current_time(const icaltimezone *zone=NULL) {
- return icaltime_current_time_with_zone(zone);
- }
-
- static icaltimetype today(void) { return icaltime_today(); }
-
-#if 0
- static icaltimetype from_string(const char* str, const icaltimezone *zone=NULL) {
- /* return _with_zone(str, zone); */
- (void)zone;
- return icaltime_from_string(str);
- }
-#else
- /* For the time being do not allow specifying a timezone because this
- is unimplemented as of yet. */
- static icaltimetype from_string(const char* str) {
- return icaltime_from_string(str);
- }
-#endif
-
- /** Returns the number of days in the given month */
- static int days_in_month(const int month, const int year) {
- return icaltime_days_in_month(month, year);
- }
-
- /** Returns whether you've specified a leap year or not. */
- static int is_leap_year (const int year) {
- return icaltime_is_leap_year(year);
- }
-
- /** Returns the number of days in this year */
- /* static int days_in_year (const int year) { return icaltime_days_in_year(year); } */
-
-}
-
-// This is a hackish way to support adding the __str__ method to
-// a class in python. Its much easier than writing in C (that
-// I've figured out).
-%pythoncode %{
-
-def __icaltimetype_str__(self):
- return "<icaltimetype (%d, %d, %d, %d, %d, %d, %d, %d)>" % (
- self.year, self.month, self.day, self.hour, self.minute,
- self.second, self.is_date, self.is_daylight)
-icaltimetype.__str__ = __icaltimetype_str__
-
-import datetime
-def icaltimetype_as_datetime(self):
- "as_datetime() -> returns datetime object"
- return datetime.datetime(self.year, self.month, self.day, self.hour,
- self.minute, self.second, 0, self.timezone)
-icaltimetype.as_datetime = icaltimetype_as_datetime
-
-def icaltimetype_from_datetime(dt):
- "from_datetime() -> returns icaltimetype object"
- tt = icaltimetype()
-
- tt.year = dt.year
- tt.month = dt.month
- tt.day = dt.day
- tt.hour = dt.hour
- tt.minute = dt.minute
- tt.second = dt.second
- if dt.tzinfo:
- # TODO: convert to the right timezone, assume for now we are UTC
- tt.zone = 0
- tt.is_date = False
- tt.isdaylight = False
-
- return tt
-icaltimetype.from_datetime = staticmethod(icaltimetype_from_datetime)
-
-# Remove accessors to private structure members
-icaltimetype_delprops = ["is_date", "is_utc", "zone"]
-
-_swig_remove_private_properties(icaltimetype, icaltimetype_delprops)
-
-
-# Set/Overwrite icaltimetype properties
-icaltimetype_props = {
- "zone": (_LibicalWrap.icaltime_get_timezone, _LibicalWrap.icaltime_set_timezone, ),
- "is_null_time": (_LibicalWrap.icaltime_is_null_time, ),
- "is_valid_time": (_LibicalWrap.icaltime_is_valid_time, ),
- # These do essentially the same thing as the default swig generated
- # accessors is_date and is_utc, but by not defining the setter, we
- # make them immutable from python
- "is_date": (_LibicalWrap.icaltime_is_date, ),
- "is_utc": (_LibicalWrap.icaltime_is_utc, ),
-}
-
-_swig_set_properties(icaltimetype, icaltimetype_props)
-
-%}
-
-// TODO: Add icaltime_span_* to icaltime_spantype
-
diff --git a/src/python/LibicalWrap_icaltimezone.i b/src/python/LibicalWrap_icaltimezone.i
deleted file mode 100644
index 320369cd..00000000
--- a/src/python/LibicalWrap_icaltimezone.i
+++ /dev/null
@@ -1,215 +0,0 @@
-
-/*======================================================================
- FILE: LibicalWrap_icaltimezone.i
-
- (C) COPYRIGHT 2010 Glenn Washburn
-
- The contents of this file are subject to the Mozilla Public License
- Version 1.0 (the "License"); you may not use this file except in
- compliance with the License. You may obtain a copy of the License at
- https://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS"
- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- the License for the specific language governing rights and
- limitations under the License.
-
- The original author is Glenn Washburn (crass@berlios.de)
-
- Contributions from:
-
- ======================================================================*/
-
-%rename(icaltimezone) _icaltimezone;
-
-%inline %{
-#include "libical/icaltimezone.h"
-#include "libical/icaltimezoneimpl.h"
-%}
-%include "libical/icaltimezone.h"
-%include "libical/icaltimezoneimpl.h"
-
-
-%pythoncode %{
-
-import time, datetime
-
-##### Support datetime.tzinfo API #####
-# This is a "good enough" implementation right now. Make better
-# later, if needed.
-class icaltzinfo(datetime.tzinfo):
- def __init__(self, icaltimezone):
- self.tz = icaltimezone
-
- def __cmp__(self, tzinfo):
- return cmp(self.tz, self.tz)
-
- def utcoffset(self, dt):
- timet = time.mktime(dt.timetuple())
- tt = icaltimetype.from_timet(int(timet),0,None)
- utcoffset = _LibicalWrap.icaltimezone_get_utc_offset(self.tz, tt, None)
- return datetime.timedelta(utcoffset)
-
- def dst(self, dt):
- # FIXME: Since icaltimezone_get_utc_offset does all the
- # calc for dst internally and there is not function which
- # returns what we need here, we'll probably need to partly
- # reimplement icaltimezone_get_utc_offset
- return datetime.timedelta(0)
-
- def tzname(self, dt):
- return _LibicalWrap.icaltimezone_get_tzid(self.tz)
-
-# def fromutc(self, dt): pass
-
-%}
-
-
-#if 0
-
-/** Sets the prefix to be used for tzid's generated from system tzdata.
- Must be globally unique (such as a domain name owned by the developer
- of the calling application), and begin and end with forward slashes.
- Do not change or de-allocate the string buffer after calling this.
- */
-void icaltimezone_set_tzid_prefix(const char *new_prefix);
-
-/**
- * @par Accessing timezones.
- */
-
-/** Frees any builtin timezone information **/
-void icaltimezone_free_builtin_timezones(void);
-
-/** Returns the array of builtin icaltimezones. */
-icalarray* icaltimezone_get_builtin_timezones (void);
-
-/**
- * @par Converting times between timezones.
- */
-
-void icaltimezone_convert_time (struct icaltimetype *tt,
- icaltimezone *from_zone,
- icaltimezone *to_zone);
-
-
-/**
- * @par Getting offsets from UTC.
- */
-
-/** Calculates the UTC offset of a given local time in the given
- timezone. It is the number of seconds to add to UTC to get local
- time. The is_daylight flag is set to 1 if the time is in
- daylight-savings time. */
-int icaltimezone_get_utc_offset (icaltimezone *zone,
- struct icaltimetype *tt,
- int *is_daylight);
-
-/** Calculates the UTC offset of a given UTC time in the given
- timezone. It is the number of seconds to add to UTC to get local
- time. The is_daylight flag is set to 1 if the time is in
- daylight-savings time. */
-int icaltimezone_get_utc_offset_of_utc_time (icaltimezone *zone,
- struct icaltimetype *tt,
- int *is_daylight);
-
-
-/*
- * @par Handling the default location the timezone files
- */
-
-/** Sets the directory to look for the zonefiles */
-void set_zone_directory(const char *path);
-
-/** Frees the memory dedicated to the zonefile directory */
-void free_zone_directory(void);
-void icaltimezone_release_zone_tab(void);
-
-/*
- * @par Debugging Output.
- */
-
-/** Dumps information about changes in the timezone up to and including
- max_year. */
-int icaltimezone_dump_changes (icaltimezone *zone,
- int max_year,
- FILE *fp);
-
-#endif
-
-
-// Add some methods to the icaltimetype struct
-%extend _icaltimezone {
-
- /* Might want to change this to somethingmore reasonable,
- like longitude or utc offset. */
- int __cmp__(icaltimezone *zone) {
- return strcmp(icaltimezone_get_tzid($self),
- icaltimezone_get_tzid(zone));
- }
-
-}
-
-%pythoncode %{
-
-# Remove accessors to private structure members, which is all of them
-_swig_remove_private_properties(icaltimezone)
-
-def _icaltimezone_set_component_wrap(self, comp):
- ret = _LibicalWrap.icaltimezone_set_component(self, comp)
- if not ret:
- # Not successful, raise an exception because setting a property
- # has not return value to be checked.
- raise Error.LibicalError("Failed to set component to timezone")
-
-# Set/Overwrite icaltimezone properties
-icaltimezone_props = {
- "tzid": (_LibicalWrap.icaltimezone_get_tzid, ),
- "location": (_LibicalWrap.icaltimezone_get_location, ),
- "tznames": (_LibicalWrap.icaltimezone_get_tznames, ),
- "latitude": (_LibicalWrap.icaltimezone_get_latitude, ),
- "longitude": (_LibicalWrap.icaltimezone_get_longitude, ),
- "display_name": (_LibicalWrap.icaltimezone_get_display_name, ),
- "component": (_LibicalWrap.icaltimezone_get_component,
- _icaltimezone_set_component_wrap, ),
-}
-
-_swig_set_properties(icaltimezone, icaltimezone_props)
-
-# UTC = _LibicalWrap.icaltimezone_get_utc_timezone()
-
-def icaltimezone_copy(self):
- tz = _LibicalWrap.icaltimezone_copy(self)
- tz.this.acquire()
- return tz
-
-def icaltimezone_new(self):
- # Hand off the underlying pointer by setting the this attribute
- print "newing icaltimezone"
- obj = _LibicalWrap.icaltimezone_new()
- obj.this.acquire()
- try: self.this.append(obj.this)
- except: self.this = obj.this
-
-def icaltimezone_delete(self):
- # do not delete the struct because swig will do this
- if self.this.own():
- _LibicalWrap.icaltimezone_free(self, 0)
-
-icaltimezone_methods = {
- 'as_tzinfo': icaltzinfo,
- 'copy': icaltimezone_copy,
- '__init__': icaltimezone_new,
- '__del__': icaltimezone_delete,
-}
-_swig_add_instance_methods(icaltimezone, icaltimezone_methods)
-
-icaltimezone.get_builtin_timezone = staticmethod(_LibicalWrap.icaltimezone_get_builtin_timezone)
-icaltimezone.get_builtin_timezone_from_offset = staticmethod(_LibicalWrap.icaltimezone_get_builtin_timezone_from_offset)
-icaltimezone.get_builtin_timezone_from_tzid = staticmethod(_LibicalWrap.icaltimezone_get_builtin_timezone_from_tzid)
-
-#icaltimezone.free_builtin_timezones = staticmethod(_LibicalWrap.icaltimezone_free_builtin_timezones)
-#icaltimezone.get_builtin_timezones = staticmethod(_LibicalWrap.icaltimezone_get_builtin_timezones)
-
-
-%}
diff --git a/src/python/Period.py b/src/python/Period.py
deleted file mode 100644
index 60c2f304..00000000
--- a/src/python/Period.py
+++ /dev/null
@@ -1,201 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: Period.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#===========================================================
-
-from LibicalWrap import *
-from Property import Property
-from types import DictType, StringType, IntType
-from Time import Time
-from Duration import Duration
-
-class Period(Property):
- """Represent a span of time"""
- def __init__(self,arg,name='FREEBUSY'):
- """ """
-
- Property.__init__(self, type = name)
-
- self.pt=None
-
- #icalerror_clear_errno()
- e1=icalerror_supress("MALFORMEDDATA")
- e2=icalerror_supress("BADARG")
-
- if isinstance(arg, DictType):
-
-
- es=icalerror_supress("MALFORMEDDATA")
- self.pt = icalperiodtype_from_string(arg['value'])
- icalerror_restore("MALFORMEDDATA",es)
-
- Property.__init__(self, ref=arg['ref'])
- else:
- if isinstance(arg, StringType):
-
- self.pt = icalperiodtype_from_string(arg)
-
- else:
- self.pt = icalperiodtype_null_period()
-
- Property.__init__(self,type=name)
-
- icalerror_restore("MALFORMEDDATA",e1)
- icalerror_restore("BADARG",e2)
-
-
- if self.pt == None or icalperiodtype_is_null_period(self.pt):
- raise Property.ConstructorFailedError("Failed to construct Period")
-
-
- try:
- self._update_value()
- except Property.UpdateFailedError:
- raise Property.ConstructorFailedError("Failed to construct Period")
-
- def _end_is_duration(self):
- dur = self.pt.duration
- return 0 if icaldurationtype_is_null_duration(dur) else 1
-
- def _end_is_time(self):
- end = self.pt.end
- return 0 if icaltime_is_null_time(end) else 1
-
- def _update_value(self):
-
- self.value(icalperiodtype_as_ical_string(self.pt),"PERIOD")
-
-
- def valid(self):
- "Returns true if this is a valid period"
-
- return not icalperiodtype_is_null_period(self.dur)
-
- def start(self,v=None):
- """
- Return or set start time of the period. The start time may be
- expressed as an RFC2445 format string or an instance of Time.
- The return value is an instance of Time
- """
-
- if(v != None):
- if isinstance(t,Time):
- t = v
- elif isinstance(t,StringType) or isinstance(t,IntType):
- t = Time(v,"DTSTART")
- else:
- raise TypeError
-
- self.pt.start = t.tt
-
- self._update_value()
-
-
- return Time(self.pt.start.as_timet(),
- "DTSTART")
-
- def end(self,v=None):
- """
- Return or set end time of the period. The end time may be
- expressed as an RFC2445 format string or an instance of Time.
- The return value is an instance of Time.
-
- If the Period has a duration set, but not an end time, this
- method will calculate the end time from the duration. """
-
- if v != None:
-
- if isinstance(t,Time):
- t = v
- elif isinstance(t,StringType) or isinstance(t,IntType):
- t = Time(v)
- else:
- raise TypeError
-
- if(self._end_is_duration()):
- start = self.pt.start.as_timet()
- dur = t.utc_seconds()-start;
- self.pt.duration = icaldurationtype_from_int(dur)
- else:
- self.pt.end = t.tt
-
- self._update_value()
-
- if(self._end_is_time()):
- rt = Time(self.pt.end.as_timet(),
- 'DTEND')
- rt.timezone(self.timezone())
- return rt
- elif(self._end_is_duration()):
- start = self.pt.start.as_timet()
- dur = icaldurationtype_as_int(self.pt.duration)
- rt = Time(start+dur,'DTEND')
- rt.timezone(self.timezone())
- return rt
- else:
- return Time({},'DTEND')
-
-
-
- def duration(self,v=None):
- """
- Return or set the duration of the period. The duration may be
- expressed as an RFC2445 format string or an instance of Duration.
- The return value is an instance of Duration.
-
- If the period has an end time set, but not a duration, this
- method will calculate the duration from the end time. """
-
- if(v != None):
-
- if isinstance(t,Duration):
- d = v
- elif isinstance(t,StringType) or isinstance(t,IntType):
- d = Duration(v)
- else:
- raise TypeError
-
- if self._end_is_time():
- start = self.pt.start.as_timet()
- end = start + d.seconds()
-
- self.pt.end = icaltimetype.from_timet(end)
- else:
- self.pt.duration = d.dur
-
- if self._end_is_time():
- start = self.pt.start.as_timet()
- end = self.pt.end.as_timet()
-
- print "End is time " + str(end-start)
-
- return Duration(end-start,"DURATION")
-
- if self._end_is_duration():
- dur = icaldurationtype_as_int(self.pt.duration)
-
- return Duration(dur,"DURATION")
-
- return Duration(0,"DURATION")
-
-
- def timezone(self,v=None):
- """ Return or set the timezone string for this time """
- if (v != None):
- self['TZID'] = v
- return self['TZID']
diff --git a/src/python/Property.py b/src/python/Property.py
deleted file mode 100644
index 430b37aa..00000000
--- a/src/python/Property.py
+++ /dev/null
@@ -1,256 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: Property.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#======================================================================
-
-from LibicalWrap import *
-import re
-import base64
-from string import index, upper, split
-from types import StringType
-
-#def icalerror_supress(arg):
-# pass
-
-#def icalerror_restore(a,b):
-# pass
-
-def error_type():
- error = icalerror_perror()
- return error[:index(error,':')]
-
-def test_enum(prop,enum):
-
- vkind = icalvalue_string_to_kind(prop)
- if icalproperty_kind_and_string_to_enum(vkind, enum) != 0:
- return 1
-
-
-class Property(object):
- """ Represent any iCalendar Property.
-
- Usage:
- Property(dict)
-
- Where:
- dict is a dictionary with keys of 'name', 'value_type', and 'value'.
- In addition, parameter:parameter value entries may be included.
- """
-
- class ConstructorFailedError(Exception):
- "Failed to construct a property"
-
- class UpdateFailedError(Exception):
- "Failed to update the value of a property"
-
-
- def __init__(self, type = None, ref = None):
-
-
- #~ assert(ref == None or isinstance(ref,StringType))
- #~ assert(type == None or isinstance(type,StringType))
-
- self._ref = None
-
- if ref != None:
- self._ref = ref
- elif type != None:
- kind = icalproperty_string_to_kind(type)
- self._ref = icalproperty_new(kind)
-
- if type.find("X-") == 0:
- icalproperty_set_x_name(self._ref, type)
-
- if self._ref == None or self._ref == 'NULL':
- raise Property.ConstructorFailedError("Failed to construct Property: %s (%s)"%(type, ref))
-
- self._deleted = 0;
-
- # Initialize all of the required keys
-
-
- def __del__(self):
-
- self._deleted = 1;
-
- if not self._deleted and \
- self.ref() and \
- icalproperty_get_parent(self.ref()) == 'NULL':
-
- icalproperty_free(self.ref())
-
- def name(self,v=None):
- """ Returns the name of the property """
- return icalproperty_get_property_name(self._ref)
-
- def ref(self,v=None):
- """ Returns the internal reference to the libical icalproperty """
- if(v != None):
-
- if not self._deleted and self._ref and \
- icalproperty_get_parent(self._ref) == 'NULL':
-
- icalproperty_free(self._ref)
-
- self._ref = v
-
- return self._ref
-
-
- def value(self,v=None, kind = None):
- """ Returns the RFC2445 representation of the value """
-
- if(v != None):
-
- if kind != None:
- # Get the default kind of value for this property
- default_kind = icalvalue_kind_to_string(
- icalproperty_kind_to_value_kind(
- icalproperty_string_to_kind(self.name())))
-
- if(kind != default_kind):
- self.__setitem__('VALUE',kind)
- vt = kind
- elif self.__getitem__('VALUE'):
- vt = self.__getitem__('VALUE')
- print "###########", self
- else:
- vt = 'NO' # Use the kind of the existing value
-
-
- icalerror_clear_errno()
-
- #e1=icalerror_supress("MALFORMEDDATA")
- if (self.name() == None or self.name().find("X-") == 0) and type(v) is StringType:
- v = icallangbind_quote_as_ical(v)
-
- if isinstance(v, unicode):
- v = v.encode('utf8')
-
- icalproperty_set_value_from_string(self._ref,str(v),vt)
- #icalerror_restore("MALFORMEDDATA",e1)
-
- if error_type() != "NO":
- raise Property.UpdateFailedError(error_type())
-
- s = icalproperty_get_value_as_string(self._ref)
-
- return icalproperty_get_value_as_string(self._ref)
-
- def parameters(self):
- """
- Returns a list of parameters
- """
-
- params = []
-
- p = icallangbind_get_first_parameter(self._ref)
-
- while p != None:
- kv = split(icalparameter_as_ical_string(p),'=',2)
- params.append(kv[0])
- p = icallangbind_get_next_parameter(self._ref)
-
- return params
-
- def as_ical_string(self):
- "Returns the property in iCalendar text format."
- return icalproperty_as_ical_string(self._ref)
-
- def __getitem__(self,key):
- """ Returns property values by name """
- key = upper(key)
- str = icalproperty_get_parameter_as_string(self._ref,key)
-
- if(str == 'NULL'): return None
-
- return str
-
- def __setitem__(self,key,value):
- """ Set Property Values by Name """
- key = upper(key)
-
- icalproperty_set_parameter_from_string(self._ref,key,value)
-
- return self.__getitem__(key)
-
- def __delitem__(self,key):
- """ Remove Property Values by Name """
- key = upper(key)
-
- if self.__getitem__(key):
- icalproperty_remove_parameter_by_name(self._ref,key)
-
- def __str__(self):
-
- str = self.as_ical_string()
- return re.sub('\r?\n ?','',str)
-
- def __cmp__(self, other):
- s_str = str(self)
- o_str = str(other)
-
- return cmp(s_str,o_str)
-
-
-class RecurrenceSet:
- """
- Represents a set of event occurrences. This
- class controls a component's RRULE, EXRULE, RDATE and EXDATE
- properties and can produce from them a set of occurrences.
- """
-
- def __init__(self):
- pass
-
- def include(self, **params):
- """
- Include a date or rule to the set.
-
- Use date= or pass in a
- Time instance to include a date. Included dates will add an
- RDATE property or will remove an EXDATE property of the same
- date.
-
- Use rule= or pass in a string to include a rule. Included
- rules with either add a RRULE property or remove an EXRULE
- property.
-
- """
- pass
-
- def exclude(self, **params):
- """
- Exclude date or rule to the set.
-
- Use date= or pass in a Time instance to exclude a
- date. Excluded dates will add an EXDATE property or will remove
- an RDATE property of the same date.
-
- Use rule= or pass in a string to exclude a rule. Excluded
- rules with either add an EXRULE property or remove an RRULE
- property.
-
- """
- pass
-
- def occurrences(self, count=None):
- """
- Returns 'count' occurrences as a tuple of Time instances.
- """
- pass
diff --git a/src/python/Store.py b/src/python/Store.py
deleted file mode 100644
index 8c6662a2..00000000
--- a/src/python/Store.py
+++ /dev/null
@@ -1,173 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: Store.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#======================================================================
-
-from LibicalWrap import *
-from Error import LibicalError
-from Component import Component, CloneComponent
-from Gauge import Gauge
-
-class Store:
- """
- Base class for several component storage methods
- """
-
- class AddFailedError(LibicalError):
- "Failed to add a property to the file store"
-
- class ConstructorFailedError(LibicalError):
- "Failed to create a Store "
-
- def __init__(self):
- pass
-
- def path(self):
- pass
-
- def mark(self):
- pass
-
- def commit(self):
- pass
-
- def add_component(self, comp):
- pass
-
- def remove_component(self, comp):
- pass
-
- def count_components(self, kind):
- pass
-
- def select(self, gauge):
- pass
-
- def clearSelect(self):
- pass
-
- def fetch(self, uid):
- pass
-
- def fetchMatch(self, comp):
- pass
-
- def modify(self, oldc, newc):
- pass
-
- def current_component(self):
- pass
-
- def first_component(self):
- pass
-
- def next_component(self):
- pass
-
-
-class FileStore(Store):
-
- def __init__(self, file):
- e1=icalerror_supress("FILE")
- self._ref = icalfileset_new(file)
- icalerror_restore("FILE",e1)
-
- if self._ref == None or self._ref == 'NULL':
- raise Store.ConstructorFailedError(file)
-
- def __del__(self):
- icalfileset_free(self._ref)
-
- def path(self):
- return icalfileset_path(self._ref)
-
- def mark(self):
- icalfileset_mark(self._ref)
-
- def commit(self):
- icalfileset_commit(self._ref)
-
- def add_component(self, comp):
- if not isinstance(comp,Component):
- raise Store.AddFailedError("Argument is not a component")
-
- error = icalfileset_add_component(self._ref,comp.ref())
-
- def remove_component(self, comp):
- if not isinstance(comp,Component):
- raise Store.AddFailedError("Argument is not a component")
-
- error = icalfileset_remove_component(self._ref,comp.ref())
-
- def count_components(self, kind):
- _kind = icalcomponent_string_to_kind(kind)
-
- return icalfileset_count_components(self._ref, _kind)
-
- def select(self, gauge):
- error = icalfileset_select(self._ref, gauge.ref())
-
- def clearSelect(self):
- icalfileset_clear(self._ref)
-
- def fetch(self, uid):
- comp_ref = icalfileset_fetch(self._ref, uid)
-
- if comp_ref == None:
- return None
-
- return CloneComponent(comp_ref)
-
- def fetchMatch(self, comp):
- if not isinstance(comp,Component):
- raise Store.AddFailedError("Argument is not a component")
-
- comp_ref = icalfileset_fetch_match(self._ref,comp.ref())
-
- if comp_ref == None:
- return None
-
- return CloneComponent(comp_ref)
-
- def modify(self, oldc, newc):
- pass
-
- def current_component(self):
- comp_ref = icalfileset_get_current_component(self._ref)
-
- if comp_ref == None:
- return None
-
- return CloneComponent(comp_ref)
-
- def first_component(self):
- comp_ref = icalfileset_get_first_component(self._ref)
-
- if comp_ref == None:
- return None
-
- return CloneComponent(comp_ref)
-
- def next_component(self):
-
- comp_ref = icalfileset_get_next_component(self._ref)
-
- if comp_ref == None:
- return None
-
- return CloneComponent(comp_ref)
diff --git a/src/python/Time.py b/src/python/Time.py
deleted file mode 100644
index d5e092ca..00000000
--- a/src/python/Time.py
+++ /dev/null
@@ -1,219 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: Time.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#======================================================================
-
-from LibicalWrap import *
-from Property import Property
-from types import DictType, StringType, IntType, FloatType
-from Duration import Duration
-
-UTC = icaltimezone_get_utc_timezone()
-
-class Time(Property):
- """ Represent iCalendar DATE, TIME and DATE-TIME """
- def __init__(self, arg, name="DTSTART", zone=None):
- """
- Create a new Time from a string or number of seconds past the
- POSIX epoch
-
- Time("19970325T123000Z") Construct from an iCalendar string
- Time(8349873494) Construct from seconds past POSIX epoch
-
- """
- e1=icalerror_supress("MALFORMEDDATA")
- e2=icalerror_supress("BADARG")
-
- if isinstance(arg, DictType):
- # Dictionary -- used for creating from Component
- self.tt = icaltime_from_string(arg['value'])
- Property.__init__(self, ref=arg['ref'])
- else:
- if isinstance(arg, StringType):
- # Create from an iCal string
- self.tt = icaltime_from_string(arg)
- elif isinstance(arg, IntType) or \
- isinstance(arg, FloatType):
- # Create from seconds past the POSIX epoch
- if zone:
- self.tt = icaltime_from_timet_with_zone(int(arg),0,icaltimezone_get_builtin_timezone(zone))
- else:
- self.tt = icaltime_from_timet_with_zone(int(arg),0,icaltimezone_get_utc_timezone())
- elif isinstance(arg, Time):
- # Copy an instance
- self.tt = arg.tt
- else:
- self.tt = icaltime_null_time()
-
- Property.__init__(self,type=name)
-
- icalerror_restore("MALFORMEDDATA",e1)
- icalerror_restore("BADARG",e2)
-
- if icaltime_is_null_time(self.tt):
- raise Property.ConstructorFailedError("Failed to construct a Time")
-
- try:
- self._update_value()
- except Property.UpdateFailedError:
- raise Property.ConstructorFailedError("Failed to construct a Time")
-
- def _update_value(self):
- self.normalize()
- self.value(icaltime_as_ical_string(self.tt),"DATE-TIME")
-
- def valid(self):
- " Returns true if this is a valid time "
- return not icaltime_is_null_time(self.tt)
-
- def utc_seconds(self,v=None):
- """ Returns or sets time in seconds past POSIX epoch"""
- tz = icaltimezone_get_builtin_timezone(self.timezone())
- if (v!=None):
- self.tt = icaltime_from_timet_with_zone(v,0,tz)
- self._update_value()
-
- return icaltime_as_timet_with_zone(self.tt, tz)
-
- def is_utc(self):
- """ Returns a boolean indicating if time is in UTC """
- return icaltime_is_utc(self.tt)
-
- def is_date(self):
- """ Returns a boolean indicating if time is actually a date """
- return icaltime_is_date(self.tt)
-
- def timezone(self,v=None):
- """ Returns, set (if none) or alter the timezone for this time """
-
- origtz = icaltime_get_tzid(self.tt)
-
- if (v != None):
- assert(isinstance(v,StringType) )
- if (v == "UTC"):
- tz = icaltimezone_get_utc_timezone()
- del self['TZID']
- else:
- tz = icaltimezone_get_builtin_timezone(v)
-
- if not origtz:
- self.tt = icaltime_set_timezone(self.tt, tz)
- else:
- self.tt = icaltime_convert_to_zone(self.tt,tz)
-
- if (icaltime_get_tzid(self.tt) != "UTC"):
- self['TZID'] = icaltime_get_tzid(self.tt)
-
- self._update_value()
- return icaltime_get_tzid(self.tt)
-
- def normalize(self):
- self.tt = icaltime_normalize(self.tt)
-
- def __second_property(self,v=None):
- """ Get or set the seconds component of this time """
- if(v != None):
- self.tt.second = v
- self._update_value()
- return self.tt.second
- second = property(__second_property, __second_property)
-
- def __minute_property(self,v=None):
- """ Get or set the minute component of this time """
- if(v != None):
- self.tt.minute = v
- self._update_value()
- return self.tt.minute
- minute = property(__minute_property, __minute_property)
-
- def __hour_property(self,v=None):
- """ Get or set the hour component of this time """
- if(v != None):
- self.tt.hour = v
- self._update_value()
- return self.tt.hour
- hour = property(__hour_property, __hour_property)
-
- def __day_property(self,v=None):
- """ Get or set the month day component of this time """
- if(v != None):
- self.tt.day = v
- self._update_value()
- return self.tt.day
- day = property(__day_property, __day_property)
-
- def __month_property(self,v=None):
- """ Get or set the month component of this time. January is month 1 """
- if(v != None):
- self.tt.month = v
- self._update_value()
- return self.tt.month
- month = property(__month_property, __month_property)
-
- def __year_property(self,v=None):
- """ Get or set the year component of this time """
- if(v != None):
- self.tt.year = v
- self._update_value()
- return self.tt.year
- year = property(__year_property, __year_property)
-
-
- def __cmp__(self,other):
-
- if other == None:
- return cmp(self.utc_seconds(),None)
-
- return cmp(self.utc_seconds(),other.utc_seconds())
-
-
- def __add__(self,o):
-
- other = Duration(o,"DURATION")
-
- if not other.valid():
- return Duration(0,"DURATION")
-
- print self.utc_seconds(), other.seconds()
- seconds = self.utc_seconds() + other.seconds()
-
- new = Time(seconds,self.name(),self.timezone())
-
- return new
-
- def __radd_(self,o):
- return self.__add__(o)
-
-
- def __sub__(self,o):
-
-
- if isinstance(o,Time):
- # Subtract a time from this time and return a duration
- seconds = self.utc_seconds() - o.utc_seconds()
- return Duration(seconds)
- elif isinstance(o,Duration):
- # Subtract a duration from this time and return a time
- other = Duration(o)
- if(not other.valid()):
- return Time()
-
- seconds = self.utc_seconds() - other.seconds()
- return Time(seconds)
- else:
- raise TypeError, "subtraction with Time requires Time or Duration"
diff --git a/src/python/__init__.py b/src/python/__init__.py
deleted file mode 100644
index 0f399441..00000000
--- a/src/python/__init__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: __init__.py
-# CREATOR: glenn
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#======================================================================
-
-from Libical import *
diff --git a/src/python/littlefile.txt b/src/python/littlefile.txt
deleted file mode 100644
index cba08911..00000000
--- a/src/python/littlefile.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This is just a small file to test mime encoding.
-
-There isn't much here at all.
diff --git a/src/python/python-binding.txt b/src/python/python-binding.txt
deleted file mode 100644
index 514a95ab..00000000
--- a/src/python/python-binding.txt
+++ /dev/null
@@ -1,434 +0,0 @@
-
-Classes for python binding to libical
-(Indentation indicates inheritance)
-
- Component
- Event
- JournalEntry
- Todo
- FreeBusy
- Timezone
- Alarm
- AudioAlarm
- EmailAlarm
- ProcedureAlarm
- DisplayAlarm
-
- Property
- Attendee
- Organizer
- Status
- Error
-
- Time
- Period
- Date
- RecurrenceSet
-
- Timezone
- TimezonePhase
-
- Store
- FileStore
- DirStore
- CAPStore
- HeapStore
- MySQLStore
-
-
-
-Component is the central class in the design. The component can be
-though of as a container for child components and properties, or as
-representation of a specific kind of iCal object. The first
-interface offers general property and component accessors, and the
-second treats some types of objects in a special way.
-
-The general interface offers simple manipulators for child property
-and components, and it only works with immediate children. So, given
-the Component:
-
- BEGIN:VCALENDAR
- METHOD:PUBLISH
- BEGIN:VEVENT
- BEGIN:VALARM
- COMMENT: An Alarm
- END:VALARM
- END:VEVENT
- END:VCALENDAR
-
-A caller would have to descend three levels to access the COMMENT
-property in the alarm, but only one to access the METHOD property.
-
-Libical is almost entirely dedicated to the general interface; it
-includes all of the *get_first_*, *_next_next_*, *_add_* and *_remove_*
-routines.
-
-The specific interface works with derived classes of Property and
-Component. In this interface, the caller could get the COMMENT in the
-alarm in the example in two steps. First the caller would ask the
-Event object for its alarms, then the caller would ask the first
-Alarm object for its comment.
-
-The Specific interface is part of the
-derived classes of Component. This interface names all of the types of
-properties and components that can be accessed from the derived
-component type.
-
-In libical, the specific interface is primarily the "convenience
-routines in icalcomponent.h, such as:
-
-
- struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp);
- void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v);
-
- void icalcomponent_set_duration(icalcomponent* comp,
- struct icaldurationtype v);
- struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp);
-
-These routines are smarter and do more work than the general
-interface. From the general interface, you can set the DTEND
-property of a component by creating the property and adding it to a
-component. But, if the component already has a DURATION property, then
-this is an error -- a component can't have both.
-
-icalcomponent_set_dtend determines if the component already has a
-DURATION. If it does, it subtracts the dtstart time from the new
-dtend time and sets the duration to that. Otherwise, it creates aor
-changes the DTEND.
-
-Also, icalcomponent_set_duration works the same regardless if the
-component is a VCALENDAR or a VEVENT. If it is a VCALENDAR, the
-routine descends into the VEVENT before making any changes. If it is
-already a VEVENT ( or VTODO or VJOURNAL ) the routine just makes the
-changes. With icalcomponent_add_property, you need to do this check
-yourself.
-
-( There should probably be a class between Component
-and Event ,JournalEntry and Todo that names all of the properties and
-components. Then Event, JournalEntry and Todo would remove the
-accessors that did not apply to them. )
-
-Parameters are accessed as dictionaries from Property or as attributes
-of a derived class of Property. Both the names and the values of the
-parameters are strings.
-
-The Store hierarchy is a interface to various ways to store iCal
-components. Each of these has the same interface as its corresponding
-libical module:
-
- FileStore icalfileset Store iCal components in a single file
- DirStore icaldirset Use multiple files, one per month of
- DTSTART
- CAPStore Access components in a CAP server
- HeapStore Components stored in memory
- MySQLStore Components stored in a MySQL
- database.
-
-The only iCal value objects that will be implemented as Python classes
-are Time, Duration and Period. RecurrenceSet handles recurrence
-rules. It replaces the properties RRULE, RDATE, EXRULE and EXDATE.
-
-(Not all of the libical modules are implemented )
-
-
-How to Use the library
-----------------------
-
-The most common usecases will be something like this:
-
-1)Caller opens a Store object on a file, server or database. The
-caller retrieves one or more component. Some of the components will be
-booked on the user's calendar. Other components will be messages that
-other users have sent, like requests for meetings.
-
-2) The caller will use the Specific interface ( using methods specific
-to each property ) to example the component and decide what to do with
-it.
-
-3) Rarely, the caller will access the general interface to do things
-that the specific interface has not implemented or cannot manage
-well.
-
-4) Caller may create a new component, using a combination of the
-general and specific interfaces. The caller may send the message to
-another user via mail, or may submit it to the user's CAP server with
-the CAPStore class.
-
-
-Following are the methods in each of the classes.
-
-Component
- Construct from string
- Output string in ical form
-
- Get a Property by type
- Get a set of Properties by type
- Remove a Property by reference
-
- Get a Component by type
- Get a set of Components by type
- Remove a Component by reference
-
- Validate the component ( insert properties for errors )
- Count error properties
- Remove error properties
- Convert error properties into REQUEST-STATUS properties
-
-Event, JournalEntry, Todo
-
- Construct from string
- Output string in ical form
-
- There are get/set accessors for every property. These are
- listed in a later section
-
-
-FreeBusy
-
- Construct from string
- Construct from arguments
- Output string in ical form
-
- Accessors for the following properties. See below for return
- types for these properties:
-
- method
- prodid
- attendee
- dtstamp
- dtstart
- freebusy
- organizer
- uid
- comment
- contact
- request-status
- url
- duration
- sequence
-
-TimezonePhase
-
- Construct from string
- Construct from arguments
- Output string in ical form
-
- Accessors for the following properties. See below for return
- types for these properties:
-
- tzname
- offsetto
- offsetfrom
- rrule
- rdate
- comment
-
-TimeZone
-
- Construct from string
- Construct from arguments
- Output string in ical form
-
- Accessors for the following properties. See below for return
- types for these properties:
-
- tzid
- last-modified
- tzurl
- standard (returns TimezonePhase)
- daylight (returns TimezonePhase)
-
-
-Property
-
- Construct from string
- Construct from arguments
- Output string in ical form
-
- Dictionary access to parameters
-
- Get/set value
-
-Attendee
-
- Construct from string
- Construct from arguments
- Output string in ical form
-
- Access to the following properties and parameters:
- cuid
- cutype
- member
- role
- rsvp
- delto
- delfrom
- sentby
- cn
- dir
- language
-
-Organizer
-
- Access to the following properties:
- common_name
- dir
- sentby
- language
-
-
-Time
-Date
-Period
-
- Same interfaces as libical modules.
-
-RecurenceSet
- I don't know -- need to think about it more.
-
-Store
- Similar methods to the icalset modules.
-
-
-RFC2445 Properties
-
-This is a list of all of the RFC2445 properties and their associated
-VALUE type.
-
-
-Property Value
-----------------------------
-CALSCALE TEXT
-METHOD TEXT
-PRODID TEXT
-VERSION TEXT
-CATEGORIES TEXT
-CLASS TEXT
-COMMENT TEXT
-DESCRIPTION TEXT
-LOCATION TEXT
-PERCENT-COMPLETE INTEGER
-PRIORITY INTEGER
-RESOURCES TEXT
-STATUS STATUS
-SUMMARY TEXT
-COMPLETED DATE-TIME
-FREEBUSY PERIOD
-TRANSP TEXT
-TZNAME TEXT
-TZOFFSETFROM UTC-OFFSET
-TZOFFSETTO UTC-OFFSET
-TZURL URI
-TZID TEXT
-ATTENDEE CAL-ADDRESS
-CONTACT TEXT
-ORGANIZER CAL-ADDRESS
-RELATED-TO TEXT
-URL URI
-UID TEXT
-EXRULE RECUR
-RRULE RECUR
-ACTION TEXT
-REPEAT INTEGER
-CREATED DATE-TIME
-DTSTAMP DATE-TIME
-LAST-MODIFIED DATE-TIME
-SEQUENCE INTEGER
-X TEXT
-REQUEST-STATUS STRING
-ATTACH URL, BINARY
-GEO FLOAT
-DTEND DATE-TIME
-DUE DATE-TIME
-DTSTART DATE-TIME
-RECURRENCE-ID DATE-TIME
-EXDATE DATE-TIME
-RDATE DATE-TIME, PERIOD
-TRIGGER DATE-TIME, DURATION
-DURATION DURATION
-
-Some of the properties can appear multiple times in a component, other
-can appear only once. For a particular component, the number of times
-a property can apper may also change with the METHOD property
-associated with the component. This list shows which properties can
-appear multiple times for some ( but not all ) combinations of
-component type and METHOD value:
-
-ATTACH
-ATTENDEE
-CATEGORIES
-COMMENT
-CONTACT
-EXDATE
-EXRULE
-FREEBUSY
-NONE
-RDATE
-RELATEDTO
-REQUESTSTATUS
-RESOURCES
-RRULE
-TZNAME
-TZURL
-X
-
-
-This is a list of the value types and their associated python return
-types. A lowercased return type is a python builtin, and an
-uppercase-first-letter is a class in the library:
-
-
-Value Return Type
------------------------------------
-BINARY file
-BOOLEAN number
-CAL-ADDRESS string
-DATE Time
-DATE-TIME Time
-DURATION Duration
-FLOAT number
-GEO tuple
-INTEGER number
-METHOD string
-PERIOD Period
-RECUR RecurrenceSet
-TEXT string
-TIME Time
-URI string
-UTC-OFFSET number
-STATUS string
-X string
-
-
-I suspect that the Component class should use the three previous
-tables to create the property accessor methods on the fly. If the
-method generation system is general enough, we could also use it for
-other classes, such as Alarm, Timezone, Attendee, Organizer and
-Freebusy.
-
-
-Memory Handling
----------------
-
-One of the things that made the perl binding to libcal difficult was
-that if a Component (in perl) returns a reference to a child Component
-(in perl), the child Component (in perl) will contain a reference to a
-libical component. When the caller is done with the child component in
-perl, the caller just drops it and lets perl reclaim the memory.
-
-The destructor for Component needs to free the libical component that
-it holds a reference to, but the child's libical component is still
-being used by libical. So perl frees the libical component and later,
-libical tries to reference freed memory.
-
-The situation is actually a little better than that, because libical
-will throw an error when you try to free a component that is still
-attached to a parent.
-
-So, the perl library has to be able to determine when the destructor
-should free a libical component or not. The perl library calls
-icalcomponent_get_parent(), and if is it non-zero, it does not free
-the component.
-
-It is not hard, just more code, and something to watch out for.
-
diff --git a/src/python/test.py b/src/python/test.py
deleted file mode 100644
index 2de1fe61..00000000
--- a/src/python/test.py
+++ /dev/null
@@ -1,598 +0,0 @@
-#!/usr/bin/env python
-#======================================================================
-# FILE: test.py
-# CREATOR: eric
-#
-# (C) COPYRIGHT 2001, Eric Busboom <eric@civicknowledge.com>
-# (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
-#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
-#======================================================================
-
-import LibicalWrap
-from Libical import *
-
-def error_type():
- error = icalerror_perror()
- return error[:index(error,':')]
-
-comp_str = """
-BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//ABC Corporation//NONSGML My Product//EN
-METHOD:REQUEST
-BEGIN:VEVENT
-ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:MAILTO:employee-A@host.com
-COMMENT: When in the course of writing comments and nonsense text\, it
- becomes necessary to insert a newline
-DTSTART:19972512T120000
-DTSTART:19970101T120000Z
-DTSTART:19970101
-DURATION:P3DT4H25M
-FREEBUSY:19970101T120000/19970101T120000
-FREEBUSY:19970101T120000/PT3H
-FREEBUSY:19970101T120000/PT3H
-END:VEVENT
-END:VCALENDAR"""
-
-
-def test_property():
-
- print "--------------------------- Test Property ----------------------"
-
-
- liw = LibicalWrap
- icalprop = liw.icalproperty_new_from_string("ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:MAILTO:employee-A@host.com")
-
- print liw.icalproperty_as_ical_string(icalprop)
-
- p = Property(ref=icalprop)
-
- print p.name()
- print
- print "Parameters:"
- for param in p.parameters():
- print " ", param, " = ", p[param]
- print
- print p['ROLE']
-
- p['ROLE'] = 'INDIVIDUAL'
-
- print p['ROLE']
-
- p['ROLE'] = 'GROFROMBLATZ'
-
- print p['ROLE']
-
- print
-
- p['X-MAN-FAVOURITE'] = 'Wolverine'
- p['X-FILES-FAVOURITE'] = 'Mulder'
-
- print p['X-MAN-FAVOURITE']
-
- assert(p['X-MAN-FAVOURITE'] == 'Wolverine')
- assert(p['X-FILES-FAVOURITE'] == 'Mulder')
- assert(p['X-FILES-FAVOURITE'] != 'Scully')
-
- print p.value()
- p.value("mailto:Bob@bob.com")
- print p.value()
-
-
- print p.as_ical_string()
- del p['ROLE']
- del p['X-MAN-FAVOURITE']
-
- print p.as_ical_string()
-
-
- try:
- p = Property()
- except Property.ConstructorFailedError:
- pass
- else:
- assert(0)
-
- # X Property
- p = Property("X-COMMENT")
-
- p.value("This is a sentence, with punctuation; indeed: it is")
- print p
-
- p.value("This is not approved by the Ministry of Silly Walks")
- print p
-
-
- assert(test_enum('METHOD','PUBLISH'))
- assert(not test_enum('METHOD','FOO'))
-
- assert(test_enum('ACTION','AUDIO'))
- assert(not test_enum('ACTION','OPAQUE'))
-
-def test_time():
- "Test routine"
-
- print"-------------------Test Time --------------------------------"
-
- t = Time("19970325T123010Z",'DTSTART')
-
- assert(t.year == 1997)
- assert(t.month == 3)
- assert(t.day == 25)
- assert(t.hour == 12)
- assert(t.minute == 30)
- assert(t.second == 10)
- assert(t.is_utc())
- assert(not t.is_date())
-
- print t
-
- t.timezone("America/Los_Angeles")
- print str(t)
- print t.timezone()
- #assert(str(t)=='DTSTART;TZID=America/Los_Angeles:19970325T123010')
- assert(str(t)=='DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/America/Los_Angeles:19970325T053010')
-
- t.second = t.second+80
-
- t.timezone("UTC")
- print t.minute, t.second
- assert(t.minute == 31)
- assert(t.second == 30)
-
- d = Duration(3600,"DURATION")
- t2 = t + d
-
- print t2
- assert(t2.hour == 13)
-
- t2 = t - d
-
- print t2
- assert(isinstance(t2,Time))
- assert(t2.hour == 11)
-
- # test int args
- t = Time(2)
- print t
-
- # test float args
- t = Time(2.5)
- print t
-
-def test_period():
-
- print"-------------------Test Period--------------------------------"
-
- p = Period("19970101T180000Z/19970101T233000Z")
-
- print p
-
- assert(str(p) == 'FREEBUSY:19970101T180000Z/19970101T233000Z')
-
- print p.start()
- assert(str(p.start()) == 'DTSTART:19970101T180000Z')
-
- print p.end()
- assert(str(p.end()) == 'DTEND:19970101T233000Z')
-
- print p.duration()
- assert(str(p.duration()) == 'DURATION:PT5H30M')
- p = None
-
- p = Period("19970101T180000Z/PT5H30M")
- print p
-
- print p.start()
- assert(str(p.start()) == 'DTSTART:19970101T180000Z')
-
- print p.end()
- assert(str(p.end()) == 'DTEND:19970101T233000Z')
-
- print p.duration()
- assert(str(p.duration()) == 'DURATION:PT5H30M')
-
-
-def test_duration():
-
- print "-------------- Test Duration ----------------"
-
- # Ical string
-
- d = Duration("P3DT4H25M")
-
- print str(d)
-
- assert(str(d) == "DURATION:P3DT4H25M")
-
- print d.seconds()
-
- assert(d.seconds() == 275100)
-
- # seconds
-
- d = Duration(-275100)
-
- print str(d)
-
- assert(str(d) == "DURATION:-P3DT4H25M")
-
- print d.seconds()
-
- assert(d.seconds() == -275100)
-
- #error
-
- try:
- d = Duration("P10WT7M")
- print str(d)
- assert(0)
- except: pass
-
- try:
- d = Duration("Pgiberish")
- print str(d)
- assert(0)
- except:
- pass
-
-
-
-def test_attach():
-
- file = open('littlefile.txt')
- attachProp = Attach(file)
- file.close()
- attachProp.fmttype('text/ascii')
- print "\n" + attachProp.name()
- print attachProp.value_type()
- print attachProp.fmttype()
- attachProp['fmttype']=None
- print "Calling value()"
- print attachProp.value()
- print "Calling asIcalString()"
- print attachProp.as_ical_string()
-
-
-def test_component():
-
- print "------------------- Test Component ----------------------"
-
-
- c = NewComponent(comp_str);
-
- props = c.properties()
-
- for p in props:
- print p.as_ical_string()
-
- inner = c.components()[0]
-
- print inner
- print type(inner)
-
-
- props = inner.properties()
-
- for p in props:
- print p.as_ical_string()
-
- dtstart = inner.properties('DTSTART')[0]
-
- print dtstart
-
- print "\n Orig hour: ", dtstart.hour
- assert(dtstart.hour == 12)
-
- dtstart.hour = dtstart.hour + 5
-
- print "\n New hour: ", dtstart.hour
- assert(dtstart.hour == 17)
-
- attendee = inner.properties('ATTENDEE')[0]
-
- print attendee
-
- t = Time("20011111T123030")
- t.name('DTEND')
-
- inner.add_property(t)
-
-
- print c
-
- dtstart1 = inner.properties('DTSTART')[0]
- dtstart2 = inner.properties('DTSTART')[0]
- dtstart3 = inner.property('DTSTART')
-
- assert(dtstart1 is dtstart2)
- assert(dtstart1 == dtstart2)
-
- assert(dtstart1 is dtstart3)
- assert(dtstart1 == dtstart3)
-
-
- p = Property(type="SUMMARY");
- p.value("This is a summary")
-
- inner.properties().append(p)
-
- print inner.as_ical_string()
-
- p = inner.properties("SUMMARY")[0]
- assert(p!=None);
- print str(p)
- assert(str(p) == "SUMMARY:This is a summary")
-
- inner.properties()[:] = [p]
-
- print inner.as_ical_string()
-
- # test sequence
- event = Event()
-
- try:
- event.sequence("foo")
- except TypeError:
- pass
-
- event.sequence(-1)
- print event.sequence()
-
- event.sequence(1)
- event.sequence(88)
- print event.sequence()
-
-def test_event():
- print "------------ Event Class ----------------------"
-
- event = Event()
-
- event.method('REQUEST')
- event.version('2.0')
-
- event.created("20010313T123000Z")
- print "created =", event.created()
- assert (event.created() == Time("20010313T123000Z"))
-
- event.organizer("MAILTO:j_doe@nowhere.com")
- org = event.organizer()
- print org.cn()
- org.cn('Jane Doe')
- assert (isinstance(org, Organizer))
- print "organizer =", event.organizer()
- assert (event.organizer().value() == "MAILTO:j_doe@nowhere.com")
-
- event.dtstart("20010401T183000Z")
- print "dtstart =", event.dtstart()
- assert (event.dtstart()== Time("20010401T183000Z"))
-
- dtend = Time('20010401T190000Z', 'DTEND')
- event.dtend(dtend)
- assert (event.dtend() ==dtend )
- assert (event.dtend() == Time('20010401T190000Z'))
-
- att = Attendee()
- att.value('jsmith@nothere.com')
- event.attendees(('ef_hutton@listenup.com', att))
-
- event.x_properties('X-TEST',('foo', 'bar'))
- event.x_properties('X-TEST2',('foo, biz', 'bar, biz'))
-
- inner = event.components()[0]
- for e in inner.properties('X-TEST'):
- print " ", e.as_ical_string()
-
- assert(len(event.x_properties('X-TEST'))==2)
-
- event.description("A short description. Longer ones break things. Really. What does it break. The code is supposed to handle really long lines, longer, in fact, than any sane person would create except by writing a random text generator or by excerpting text from a less sane person. Actually, it did \"break\" and I had to remove an \n assert to fix it.")
- event.status('TeNtAtIvE')
-
- print event.as_ical_string()
-
-
-def test_derivedprop():
-
- print "------------ Derived Properties -----------------"
-
- p = RDate("20011111T123030")
-
- print str(p)
-
-
- p = RDate("19970101T120000/19970101T123000")
-
- print str(p)
-
- try:
- p = RDate("P3DT4H25M")
- print str(p)
- assert(0)
- except: pass
-
-
- p = Trigger("P3DT4H25M")
-
- print str(p)
-
- p = Trigger("20011111T123030")
-
- print str(p)
-
- try:
- p = Trigger("19970101T120000/19970101T123000")
- print str(p)
- assert(0)
- except: pass
-
-def test_gauge():
- print "------------ Gauge -----------------"
- event = Event()
-
- event.method('REQUEST')
- event.version('2.0')
- event.created("20010313T123000Z")
- event.organizer("MAILTO:j_doe@nowhere.com")
- org = event.organizer()
- org.cn('Jane Doe')
- event.dtstart("20010401T183000Z")
- dtend = Time('20010401T190000Z', 'DTEND')
- event.dtend(dtend)
- event.description("A short description.")
- event.status('TeNtAtIvE')
-
- print event.as_ical_string()
-
- gauge = Gauge(sql="SELECT * FROM VEVENT WHERE DTSTART > '20010401T180000Z'")
-
- assert(gauge.compare(event) == 1)
-
- gauge = Gauge(sql="SELECT * FROM VEVENT WHERE DTSTART > '20010401T190000Z'")
-
- assert(gauge.compare(event) == 0)
-
-def do_test_store(storeobj=None, *args):
- assert(storeobj != None)
- store = storeobj(*args)
- assert(store != None)
-
- print ">------------ ",
- print store.__class__,
- print "Store -----------------"
-
-
- # create fileset
-
- event = Event()
-
- event.method('REQUEST')
- event.version('2.0')
- event.created("20010313T123000Z")
- event.organizer("MAILTO:j_doe@nowhere.com")
- event.dtstart("20010401T183000Z")
- event.duration('PT3H')
-
- event.description("A short description.")
-
- # for i = 1 to 10
- # copy event
- # munge uid and increment month
- for i in range(1,11):
- newevent = event.clone()
- newevent.uid("%d@localhost" % (i,))
- newevent.dtstart().month = newevent.dtstart().month + i
-
- #print ne
- store.add_component(newevent)
-
- # commit
- store.commit()
- assert(store.count_components("VCALENDAR") == 10)
- # free
- del(store)
-
- # open again
- store = storeobj(*args)
- # assert count of components = 10
- assert(store.count_components("VCALENDAR") == 10)
-
- # print them out
- # fetch by uid
- n7 = store.fetch("7@localhost")
- print n7
- # fetch by match
-
- n7m = store.fetchMatch(n7)
- assert(str(n7) == str(n7m))
-
- # modify in memory
- n7.uid("42@localhost")
- del(store)
- del(n7)
-
- store = storeobj(*args)
- assert(store.fetch("42@localhost") == None)
- n7 = store.fetch("7@localhost")
- n7.uid("42@localhost")
- store.mark()
- store.commit()
- del(store)
- store = storeobj(*args)
- assert(store.fetch("7@localhost") == None)
-
- # fetch by gauge
-
- gauge = Gauge(sql="SELECT * FROM VEVENT WHERE DTSTART > '20010601T000000Z' AND DTSTART < '20010901T000000Z'")
-
- store.select(gauge)
-
- count = 0
-
- c = store.first_component()
- while c != None:
- print c.uid()
- print c.dtstart()
- print
- count = count + 1
- c = store.next_component()
-
- store.clearSelect()
-
- assert(count == 3)
-
- # remove all of them
- c = store.first_component()
- while c != None:
- print c.uid()
- store.remove_component(c)
- c = store.first_component()
-
- assert(store.count_components("VCALENDAR") == 0)
- store.commit()
- assert(store.count_components("VCALENDAR") == 0)
- # print them out
- # assert count of components = 0
-
-
-def test_store():
- print "------------ Store -----------------"
- do_test_store(FileStore,"filesetout.ics")
-
-def run_tests():
- print "Running unit tests for:", ICAL_PACKAGE, ICAL_VERSION
-
- test_property()
-
- test_time()
-
- test_period()
-
- test_component()
-
- test_duration()
-
- test_derivedprop()
-
- test_event()
-
- #test_attach()
-
- test_gauge()
-
- test_store()
-
-
-
-
-if __name__ == "__main__":
- run_tests()
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
index dc3db6b5..fa0bcf9b 100644
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src
@@ -20,6 +23,7 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
set(TEST_DATADIR "\"${CMAKE_SOURCE_DIR}/test-data\"")
add_definitions(-DTEST_DATADIR=${TEST_DATADIR} -DTEST_ZONEDIR="${CMAKE_SOURCE_DIR}/zoneinfo")
+# Set properties for the test
macro(setprops _name)
if(UNIX)
set_tests_properties(${_name} PROPERTIES
@@ -61,7 +65,9 @@ macro(buildme _name _srcs)
target_link_libraries(${_name} ical_cxx icalss_cxx)
endif()
- target_link_libraries(${_name} ${CMAKE_THREAD_LIBS_INIT})
+ if(DEFINED CMAKE_THREAD_LIBS_INIT)
+ target_link_libraries(${_name} ${CMAKE_THREAD_LIBS_INIT})
+ endif()
if(ICU_FOUND)
target_link_libraries(${_name} ${ICU_LIBRARIES})
endif()
@@ -70,6 +76,7 @@ macro(buildme _name _srcs)
endif()
endmacro()
+# Build the test and add the test, making sure the test properties are set
macro(testme _name _srcs)
buildme(${_name} "${_srcs}")
add_test(NAME ${_name} COMMAND ${_name})
@@ -96,6 +103,8 @@ set(regression_SRCS
regression-utils.c
regression-recur.c
regression-storage.c
+ test-malloc.c
+ test-malloc.h
)
if(WITH_CXX_BINDINGS)
list(APPEND regression_SRCS regression-cxx.cpp)
@@ -108,10 +117,10 @@ set(parser_SRCS icaltestparser.c)
buildme(parser "${parser_SRCS}")
file(GLOB TEST_FILES ${CMAKE_SOURCE_DIR}/test-data/*.ics)
-foreach(TEST_FILE ${TEST_FILES})
- get_filename_component(TEST_NAME ${TEST_FILE} NAME_WE)
- add_test(NAME parser-${TEST_NAME} COMMAND parser ${TEST_FILE})
- setprops(parser-${TEST_NAME})
+foreach(test_file ${TEST_FILES})
+ get_filename_component(test_name ${test_file} NAME_WE)
+ add_test(NAME parser-${test_name} COMMAND parser ${test_file})
+ setprops(parser-${test_name})
endforeach()
########### next target ###############
@@ -177,30 +186,31 @@ if(NOT ${CMAKE_VERSION} VERSION_LESS 3.14)
set(CMAKE_COMPARE_FILES_IGNORE_EOL TRUE)
endif()
if(NOT WIN32 OR CMAKE_COMPARE_FILES_IGNORE_EOL)
- if(NOT CYGWIN AND NOT USE_32BIT_TIME_T) #ignore_eol doesn't work on Cygwin. tests for years greater than 2037 will fail
+ #ignore_eol doesn't work on Cygwin. testing years greater than 2037 will fail
+ if(NOT CYGWIN AND NOT USE_32BIT_TIME_T)
set(icalrecurtest_SRCS icalrecur_test.c)
add_executable(icalrecurtest ${icalrecurtest_SRCS})
target_link_libraries(icalrecurtest ical icalss icalvcal)
set(test_cmd "${CMAKE_BINARY_DIR}/src/test/icalrecurtest${CMAKE_EXECUTABLE_SUFFIX}")
- if(ICU_FOUND)
- #test rscale capable rrules
- set(test_args "-r")
- if(HAVE_ICU_DANGI)
- set(reference_data "icalrecur_withicu_dangi_test.out")
- else()
- set(reference_data "icalrecur_withicu_test.out")
- endif()
- add_test(NAME icalrecurtest-r
- COMMAND ${CMAKE_COMMAND}
- -D test_cmd=${test_cmd}
- -D test_args:string=${test_args}
- -D output_blessed=${CMAKE_SOURCE_DIR}/src/test/${reference_data}
- -D output_test=${CMAKE_BINARY_DIR}/bin/test.out
- -P ${CMAKE_SOURCE_DIR}/cmake/run_test.cmake
- )
- setprops(icalrecurtest-r)
+ #test rscale capable rrules
+ set(test_args "-r")
+ if(HAVE_ICU_DANGI)
+ set(reference_data "icalrecur_withicu_dangi_test.out")
+ elseif(ICU_FOUND)
+ set(reference_data "icalrecur_withicu_test.out")
+ else()
+ set(reference_data "icalrecur_withouticu_test.out")
endif()
+ add_test(NAME icalrecurtest-r
+ COMMAND ${CMAKE_COMMAND}
+ -D test_cmd=${test_cmd}
+ -D test_args:string=${test_args}
+ -D output_blessed=${CMAKE_SOURCE_DIR}/src/test/${reference_data}
+ -D output_test=${CMAKE_BINARY_DIR}/bin/test.out
+ -P ${CMAKE_SOURCE_DIR}/cmake/run_test.cmake
+ )
+ setprops(icalrecurtest-r)
#test non-rscale rrules
set(test_args "")
diff --git a/src/test/builtin_timezones.c b/src/test/builtin_timezones.c
index 3ceb462d..334b683a 100644
--- a/src/test/builtin_timezones.c
+++ b/src/test/builtin_timezones.c
@@ -2,18 +2,10 @@
FILE: builtin_timezones.c
CREATOR: Milan Crha 26 November 2014
- (C) COPYRIGHT 2014 Milan Crha <mcrha@redhat.com>
+ SPDX-FileCopyrightText: 2014 Milan Crha <mcrha@redhat.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
diff --git a/src/test/copycluster.c b/src/test/copycluster.c
index 00384273..05961252 100644
--- a/src/test/copycluster.c
+++ b/src/test/copycluster.c
@@ -2,18 +2,9 @@
FILE: copycluster.c
CREATOR: eric 15 January 2000
- (C) COPYRIGHT 2000 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
@@ -103,7 +94,7 @@ int main(int c, char *argv[])
if (tostdout) {
printf("--------------\n%s\n", icalcomponent_as_ical_string(itr));
} else {
- (void)icalfileset_add_component(clusterout, icalcomponent_new_clone(itr));
+ (void)icalfileset_add_component(clusterout, icalcomponent_clone(itr));
}
count++;
}
diff --git a/src/test/icalattach-leak.c b/src/test/icalattach-leak.c
index d91aa398..3740742c 100644
--- a/src/test/icalattach-leak.c
+++ b/src/test/icalattach-leak.c
@@ -1,18 +1,9 @@
/*======================================================================
FILE: icalattach-leak.c
- Copyright (C) 2019 Red Hat, Inc. <www.redhat.com>
+ SPDX-FileCopyrightText: 2019 Red Hat, Inc. <www.redhat.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Initial Developer of the Original Code is Milan Crha
======================================================================*/
@@ -23,9 +14,7 @@
#include <stdio.h>
-#define LIBICAL_GLIB_UNSTABLE_API
#include "libical-glib/libical-glib.h"
-#undef LIBICAL_GLIB_UNSTABLE_API
static GSList *get_attachments(ICalComponent *comp)
{
diff --git a/src/test/icalrecur_test.c b/src/test/icalrecur_test.c
index c2d7e545..a236848d 100644
--- a/src/test/icalrecur_test.c
+++ b/src/test/icalrecur_test.c
@@ -2,18 +2,10 @@
FILE: icalrecur_test.c
CREATOR: Ken Murchison 26 September 2014
- (C) COPYRIGHT 2000 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
/*
@@ -636,8 +628,11 @@ int main(int argc, char *argv[])
if (!ritr) {
fprintf(fp, " *** %s\n", icalerror_strerror(icalerrno));
} else {
+ struct icaltimetype start;
+ start = icaltime_null_time();
+
if (r->start_at) {
- struct icaltimetype start = icaltime_from_string(r->start_at);
+ start = icaltime_from_string(r->start_at);
icalrecur_iterator_set_start(ritr, start);
}
@@ -649,10 +644,25 @@ int main(int argc, char *argv[])
sep = ",";
}
fprintf(fp, "\n");
+
+ if (r->start_at) {
+ icalrecur_iterator_set_range(ritr, start, dtstart);
+ }
+
+ sep = "";
+ fprintf(fp, "PREV-INSTANCES:");
+ for (next = icalrecur_iterator_prev(ritr);
+ !icaltime_is_null_time(next);
+ next = icalrecur_iterator_prev(ritr)) {
+
+ fprintf(fp, "%s%s", sep, icaltime_as_ical_string(next));
+ sep = ",";
+ }
+ fprintf(fp, "\n");
}
icalrecur_iterator_free(ritr);
- free(rrule.rscale);
+ icalmemory_free_buffer(rrule.rscale);
}
fclose(fp);
diff --git a/src/test/icalrecur_test.out b/src/test/icalrecur_test.out
index d06eef84..2b7ebcdf 100644
--- a/src/test/icalrecur_test.out
+++ b/src/test/icalrecur_test.out
@@ -2,286 +2,356 @@
RRULE:FREQ=YEARLY;UNTIL=20000131T140000Z;BYMONTH=1;BYDAY=SU,MO,TU,WE,TH,FR,SA
DTSTART:19980101T090000
INSTANCES:19980101T090000,19980102T090000,19980103T090000,19980104T090000,19980105T090000,19980106T090000,19980107T090000,19980108T090000,19980109T090000,19980110T090000,19980111T090000,19980112T090000,19980113T090000,19980114T090000,19980115T090000,19980116T090000,19980117T090000,19980118T090000,19980119T090000,19980120T090000,19980121T090000,19980122T090000,19980123T090000,19980124T090000,19980125T090000,19980126T090000,19980127T090000,19980128T090000,19980129T090000,19980130T090000,19980131T090000,19990101T090000,19990102T090000,19990103T090000,19990104T090000,19990105T090000,19990106T090000,19990107T090000,19990108T090000,19990109T090000,19990110T090000,19990111T090000,19990112T090000,19990113T090000,19990114T090000,19990115T090000,19990116T090000,19990117T090000,19990118T090000,19990119T090000,19990120T090000,19990121T090000,19990122T090000,19990123T090000,19990124T090000,19990125T090000,19990126T090000,19990127T090000,19990128T090000,19990129T090000,19990130T090000,19990131T090000,20000101T090000,20000102T090000,20000103T090000,20000104T090000,20000105T090000,20000106T090000,20000107T090000,20000108T090000,20000109T090000,20000110T090000,20000111T090000,20000112T090000,20000113T090000,20000114T090000,20000115T090000,20000116T090000,20000117T090000,20000118T090000,20000119T090000,20000120T090000,20000121T090000,20000122T090000,20000123T090000,20000124T090000,20000125T090000,20000126T090000,20000127T090000,20000128T090000,20000129T090000,20000130T090000,20000131T090000
+PREV-INSTANCES:20000131T090000,20000130T090000,20000129T090000,20000128T090000,20000127T090000,20000126T090000,20000125T090000,20000124T090000,20000123T090000,20000122T090000,20000121T090000,20000120T090000,20000119T090000,20000118T090000,20000117T090000,20000116T090000,20000115T090000,20000114T090000,20000113T090000,20000112T090000,20000111T090000,20000110T090000,20000109T090000,20000108T090000,20000107T090000,20000106T090000,20000105T090000,20000104T090000,20000103T090000,20000102T090000,20000101T090000,19990131T090000,19990130T090000,19990129T090000,19990128T090000,19990127T090000,19990126T090000,19990125T090000,19990124T090000,19990123T090000,19990122T090000,19990121T090000,19990120T090000,19990119T090000,19990118T090000,19990117T090000,19990116T090000,19990115T090000,19990114T090000,19990113T090000,19990112T090000,19990111T090000,19990110T090000,19990109T090000,19990108T090000,19990107T090000,19990106T090000,19990105T090000,19990104T090000,19990103T090000,19990102T090000,19990101T090000,19980131T090000,19980130T090000,19980129T090000,19980128T090000,19980127T090000,19980126T090000,19980125T090000,19980124T090000,19980123T090000,19980122T090000,19980121T090000,19980120T090000,19980119T090000,19980118T090000,19980117T090000,19980116T090000,19980115T090000,19980114T090000,19980113T090000,19980112T090000,19980111T090000,19980110T090000,19980109T090000,19980108T090000,19980107T090000,19980106T090000,19980105T090000,19980104T090000,19980103T090000,19980102T090000,19980101T090000
RRULE:FREQ=YEARLY;COUNT=10;BYMONTH=6,7
DTSTART:19970610T090000
INSTANCES:19970610T090000,19970710T090000,19980610T090000,19980710T090000,19990610T090000,19990710T090000,20000610T090000,20000710T090000,20010610T090000,20010710T090000
+PREV-INSTANCES:20010610T090000,20000710T090000,20000610T090000,19990710T090000,19990610T090000,19980710T090000,19980610T090000,19970710T090000,19970610T090000
RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=10;BYMONTH=1,2,3
DTSTART:19970310T090000
INSTANCES:19970310T090000,19990110T090000,19990210T090000,19990310T090000,20010110T090000,20010210T090000,20010310T090000,20030110T090000,20030210T090000,20030310T090000
+PREV-INSTANCES:20030210T090000,20030110T090000,20010310T090000,20010210T090000,20010110T090000,19990310T090000,19990210T090000,19990110T090000,19970310T090000
RRULE:FREQ=YEARLY;INTERVAL=3;COUNT=10;BYYEARDAY=1,100,200
DTSTART:19970101T090000
INSTANCES:19970101T090000,19970410T090000,19970719T090000,20000101T090000,20000409T090000,20000718T090000,20030101T090000,20030410T090000,20030719T090000,20060101T090000
+PREV-INSTANCES:20030719T090000,20030410T090000,20030101T090000,20000718T090000,20000409T090000,20000101T090000,19970719T090000,19970410T090000,19970101T090000
RRULE:FREQ=YEARLY;BYDAY=20MO;COUNT=3
DTSTART:19970519T090000
INSTANCES:19970519T090000,19980518T090000,19990517T090000
+PREV-INSTANCES:19980518T090000,19970519T090000
RRULE:FREQ=YEARLY;BYWEEKNO=20;BYDAY=MO;COUNT=3
DTSTART:19970512T090000
INSTANCES:19970512T090000,19980511T090000,19990517T090000
+PREV-INSTANCES:19980511T090000,19970512T090000
RRULE:FREQ=YEARLY;BYWEEKNO=20;BYDAY=MO;WKST=SU;COUNT=3
DTSTART:19970512T090000
INSTANCES:19970512T090000,19980518T090000,19990517T090000
+PREV-INSTANCES:19980518T090000,19970512T090000
RRULE:FREQ=YEARLY;BYWEEKNO=20;BYDAY=MO;WKST=FR;COUNT=3
DTSTART:19970512T090000
INSTANCES:19970519T090000,19980518T090000,19990517T090000
+PREV-INSTANCES:19980518T090000,19970519T090000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=TH;COUNT=11
DTSTART:19970313T090000
INSTANCES:19970313T090000,19970320T090000,19970327T090000,19980305T090000,19980312T090000,19980319T090000,19980326T090000,19990304T090000,19990311T090000,19990318T090000,19990325T090000
+PREV-INSTANCES:19990318T090000,19990311T090000,19990304T090000,19980326T090000,19980319T090000,19980312T090000,19980305T090000,19970327T090000,19970320T090000,19970313T090000
RRULE:FREQ=YEARLY;BYDAY=TH;BYMONTH=6,7,8;COUNT=39
DTSTART:19970605T090000
INSTANCES:19970605T090000,19970612T090000,19970619T090000,19970626T090000,19970703T090000,19970710T090000,19970717T090000,19970724T090000,19970731T090000,19970807T090000,19970814T090000,19970821T090000,19970828T090000,19980604T090000,19980611T090000,19980618T090000,19980625T090000,19980702T090000,19980709T090000,19980716T090000,19980723T090000,19980730T090000,19980806T090000,19980813T090000,19980820T090000,19980827T090000,19990603T090000,19990610T090000,19990617T090000,19990624T090000,19990701T090000,19990708T090000,19990715T090000,19990722T090000,19990729T090000,19990805T090000,19990812T090000,19990819T090000,19990826T090000
+PREV-INSTANCES:19990819T090000,19990812T090000,19990805T090000,19990729T090000,19990722T090000,19990715T090000,19990708T090000,19990701T090000,19990624T090000,19990617T090000,19990610T090000,19990603T090000,19980827T090000,19980820T090000,19980813T090000,19980806T090000,19980730T090000,19980723T090000,19980716T090000,19980709T090000,19980702T090000,19980625T090000,19980618T090000,19980611T090000,19980604T090000,19970828T090000,19970821T090000,19970814T090000,19970807T090000,19970731T090000,19970724T090000,19970717T090000,19970710T090000,19970703T090000,19970626T090000,19970619T090000,19970612T090000,19970605T090000
RRULE:FREQ=YEARLY;INTERVAL=4;BYMONTH=11;BYDAY=TU;BYMONTHDAY=2,3,4,5,6,7,8;COUNT=3
DTSTART:19961105T090000
INSTANCES:19961105T090000,20001107T090000,20041102T090000
+PREV-INSTANCES:20001107T090000,19961105T090000
RRULE:FREQ=YEARLY;UNTIL=20100326T000000Z;BYDAY=FR;BYYEARDAY=-275,-276,-277,-278,-279,-280,-281
DTSTART:20060331T020000
INSTANCES:20060331T020000,20070330T020000,20080328T020000,20090327T020000
+PREV-INSTANCES:20090327T020000,20080328T020000,20070330T020000,20060331T020000
RRULE:FREQ=YEARLY;UNTIL=20140301T115959Z
DTSTART:20120229T120000Z
INSTANCES:20120229T120000Z
+PREV-INSTANCES:20120229T120000Z
RRULE:FREQ=MONTHLY;COUNT=10;BYDAY=1FR
DTSTART:19970905T090000
INSTANCES:19970905T090000,19971003T090000,19971107T090000,19971205T090000,19980102T090000,19980206T090000,19980306T090000,19980403T090000,19980501T090000,19980605T090000
+PREV-INSTANCES:19980501T090000,19980403T090000,19980306T090000,19980206T090000,19980102T090000,19971205T090000,19971107T090000,19971003T090000,19970905T090000
RRULE:FREQ=MONTHLY;UNTIL=19971224T000000Z;BYDAY=1FR
DTSTART:19970905T090000
INSTANCES:19970905T090000,19971003T090000,19971107T090000,19971205T090000
+PREV-INSTANCES:19971205T090000,19971107T090000,19971003T090000,19970905T090000
RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=1SU,-1SU
DTSTART:19970907T090000
INSTANCES:19970907T090000,19970928T090000,19971102T090000,19971130T090000,19980104T090000,19980125T090000,19980301T090000,19980329T090000,19980503T090000,19980531T090000
+PREV-INSTANCES:19980503T090000,19980329T090000,19980301T090000,19980125T090000,19980104T090000,19971130T090000,19971102T090000,19970928T090000,19970907T090000
RRULE:FREQ=MONTHLY;COUNT=6;BYDAY=-2MO
DTSTART:19970922T090000
INSTANCES:19970922T090000,19971020T090000,19971117T090000,19971222T090000,19980119T090000,19980216T090000
+PREV-INSTANCES:19980119T090000,19971222T090000,19971117T090000,19971020T090000,19970922T090000
RRULE:FREQ=MONTHLY;BYMONTHDAY=-3;COUNT=6
DTSTART:19970928T090000
INSTANCES:19970928T090000,19971029T090000,19971128T090000,19971229T090000,19980129T090000,19980226T090000
+PREV-INSTANCES:19980129T090000,19971229T090000,19971128T090000,19971029T090000,19970928T090000
RRULE:FREQ=MONTHLY;COUNT=10;BYMONTHDAY=2,15
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970915T090000,19971002T090000,19971015T090000,19971102T090000,19971115T090000,19971202T090000,19971215T090000,19980102T090000,19980115T090000
+PREV-INSTANCES:19980102T090000,19971215T090000,19971202T090000,19971115T090000,19971102T090000,19971015T090000,19971002T090000,19970915T090000,19970902T090000
RRULE:FREQ=MONTHLY;COUNT=10;BYMONTHDAY=1,-1
DTSTART:19970930T090000
INSTANCES:19970930T090000,19971001T090000,19971031T090000,19971101T090000,19971130T090000,19971201T090000,19971231T090000,19980101T090000,19980131T090000,19980201T090000
+PREV-INSTANCES:19980131T090000,19980101T090000,19971231T090000,19971201T090000,19971130T090000,19971101T090000,19971031T090000,19971001T090000,19970930T090000
RRULE:FREQ=MONTHLY;INTERVAL=18;COUNT=10;BYMONTHDAY=10,11,12,13,14,15
DTSTART:19970910T090000
INSTANCES:19970910T090000,19970911T090000,19970912T090000,19970913T090000,19970914T090000,19970915T090000,19990310T090000,19990311T090000,19990312T090000,19990313T090000
+PREV-INSTANCES:19990312T090000,19990311T090000,19990310T090000,19970915T090000,19970914T090000,19970913T090000,19970912T090000,19970911T090000,19970910T090000
RRULE:FREQ=MONTHLY;INTERVAL=2;BYDAY=TU;COUNT=18
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970909T090000,19970916T090000,19970923T090000,19970930T090000,19971104T090000,19971111T090000,19971118T090000,19971125T090000,19980106T090000,19980113T090000,19980120T090000,19980127T090000,19980303T090000,19980310T090000,19980317T090000,19980324T090000,19980331T090000
+PREV-INSTANCES:19980324T090000,19980317T090000,19980310T090000,19980303T090000,19980127T090000,19980120T090000,19980113T090000,19980106T090000,19971125T090000,19971118T090000,19971111T090000,19971104T090000,19970930T090000,19970923T090000,19970916T090000,19970909T090000,19970902T090000
RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13;COUNT=5
DTSTART:19970902T090000
INSTANCES:19980213T090000,19980313T090000,19981113T090000,19990813T090000,20001013T090000
+PREV-INSTANCES:19990813T090000,19981113T090000,19980313T090000,19980213T090000
RRULE:FREQ=MONTHLY;BYDAY=SA;BYMONTHDAY=7,8,9,10,11,12,13;COUNT=10
DTSTART:19970913T090000
INSTANCES:19970913T090000,19971011T090000,19971108T090000,19971213T090000,19980110T090000,19980207T090000,19980307T090000,19980411T090000,19980509T090000,19980613T090000
+PREV-INSTANCES:19980509T090000,19980411T090000,19980307T090000,19980207T090000,19980110T090000,19971213T090000,19971108T090000,19971011T090000,19970913T090000
RRULE:FREQ=MONTHLY;COUNT=3;BYDAY=TU,WE,TH;BYSETPOS=3
DTSTART:19970904T090000
INSTANCES:19970904T090000,19971007T090000,19971106T090000
+PREV-INSTANCES:19971007T090000,19970904T090000
RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2;COUNT=7
DTSTART:19970929T090000
INSTANCES:19970929T090000,19971030T090000,19971127T090000,19971230T090000,19980129T090000,19980226T090000,19980330T090000
+PREV-INSTANCES:19980226T090000,19980129T090000,19971230T090000,19971127T090000,19971030T090000,19970929T090000
RRULE:FREQ=MONTHLY;BYMONTHDAY=15,30;COUNT=5
DTSTART:20070115T090000
INSTANCES:20070115T090000,20070130T090000,20070215T090000,20070315T090000,20070330T090000
+PREV-INSTANCES:20070315T090000,20070215T090000,20070130T090000,20070115T090000
RRULE:FREQ=MONTHLY;COUNT=12
DTSTART:20070131T090000
INSTANCES:20070131T090000,20070331T090000,20070531T090000,20070731T090000,20070831T090000,20071031T090000,20071231T090000,20080131T090000,20080331T090000,20080531T090000,20080731T090000,20080831T090000
+PREV-INSTANCES:20080731T090000,20080531T090000,20080331T090000,20080131T090000,20071231T090000,20071031T090000,20070831T090000,20070731T090000,20070531T090000,20070331T090000,20070131T090000
RRULE:FREQ=WEEKLY;COUNT=10
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970909T090000,19970916T090000,19970923T090000,19970930T090000,19971007T090000,19971014T090000,19971021T090000,19971028T090000,19971104T090000
+PREV-INSTANCES:19971028T090000,19971021T090000,19971014T090000,19971007T090000,19970930T090000,19970923T090000,19970916T090000,19970909T090000,19970902T090000
RRULE:FREQ=WEEKLY;UNTIL=19971224T000000Z
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970909T090000,19970916T090000,19970923T090000,19970930T090000,19971007T090000,19971014T090000,19971021T090000,19971028T090000,19971104T090000,19971111T090000,19971118T090000,19971125T090000,19971202T090000,19971209T090000,19971216T090000,19971223T090000
+PREV-INSTANCES:19971223T090000,19971216T090000,19971209T090000,19971202T090000,19971125T090000,19971118T090000,19971111T090000,19971104T090000,19971028T090000,19971021T090000,19971014T090000,19971007T090000,19970930T090000,19970923T090000,19970916T090000,19970909T090000,19970902T090000
RRULE:FREQ=WEEKLY;INTERVAL=2;WKST=SU;COUNT=13
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970916T090000,19970930T090000,19971014T090000,19971028T090000,19971111T090000,19971125T090000,19971209T090000,19971223T090000,19980106T090000,19980120T090000,19980203T090000,19980217T090000
+PREV-INSTANCES:19980203T090000,19980120T090000,19980106T090000,19971223T090000,19971209T090000,19971125T090000,19971111T090000,19971028T090000,19971014T090000,19970930T090000,19970916T090000,19970902T090000
RRULE:FREQ=WEEKLY;UNTIL=19971007T000000Z;WKST=SU;BYDAY=TU,TH
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970904T090000,19970909T090000,19970911T090000,19970916T090000,19970918T090000,19970923T090000,19970925T090000,19970930T090000,19971002T090000
+PREV-INSTANCES:19971002T090000,19970930T090000,19970925T090000,19970923T090000,19970918T090000,19970916T090000,19970911T090000,19970909T090000,19970904T090000,19970902T090000
RRULE:FREQ=WEEKLY;COUNT=10;WKST=SU;BYDAY=TU,TH
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970904T090000,19970909T090000,19970911T090000,19970916T090000,19970918T090000,19970923T090000,19970925T090000,19970930T090000,19971002T090000
+PREV-INSTANCES:19970930T090000,19970925T090000,19970923T090000,19970918T090000,19970916T090000,19970911T090000,19970909T090000,19970904T090000,19970902T090000
RRULE:FREQ=WEEKLY;INTERVAL=4;BYDAY=SU;COUNT=4
DTSTART:20150322T000000
INSTANCES:20150322T000000,20150419T000000,20150517T000000,20150614T000000
+PREV-INSTANCES:20150517T000000,20150419T000000,20150322T000000
RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=19971224T000000Z;WKST=SU;BYDAY=MO,WE,FR
DTSTART:19970901T090000
INSTANCES:19970901T090000,19970903T090000,19970905T090000,19970915T090000,19970917T090000,19970919T090000,19970929T090000,19971001T090000,19971003T090000,19971013T090000,19971015T090000,19971017T090000,19971027T090000,19971029T090000,19971031T090000,19971110T090000,19971112T090000,19971114T090000,19971124T090000,19971126T090000,19971128T090000,19971208T090000,19971210T090000,19971212T090000,19971222T090000
+PREV-INSTANCES:19971222T090000,19971212T090000,19971210T090000,19971208T090000,19971128T090000,19971126T090000,19971124T090000,19971114T090000,19971112T090000,19971110T090000,19971031T090000,19971029T090000,19971027T090000,19971017T090000,19971015T090000,19971013T090000,19971003T090000,19971001T090000,19970929T090000,19970919T090000,19970917T090000,19970915T090000,19970905T090000,19970903T090000,19970901T090000
RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=8;WKST=SU;BYDAY=TU,TH
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970904T090000,19970916T090000,19970918T090000,19970930T090000,19971002T090000,19971014T090000,19971016T090000
+PREV-INSTANCES:19971014T090000,19971002T090000,19970930T090000,19970918T090000,19970916T090000,19970904T090000,19970902T090000
RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=MO
DTSTART:19970805T090000
INSTANCES:19970805T090000,19970810T090000,19970819T090000,19970824T090000
+PREV-INSTANCES:19970819T090000,19970810T090000,19970805T090000
RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=SU
DTSTART:19970805T090000
INSTANCES:19970805T090000,19970817T090000,19970819T090000,19970831T090000
+PREV-INSTANCES:19970819T090000,19970817T090000,19970805T090000
RRULE:FREQ=WEEKLY;INTERVAL=1;COUNT=2;BYDAY=MO;
DTSTART:20141006T090000
INSTANCES:20141006T090000,20141013T090000
+PREV-INSTANCES:20141006T090000
RRULE:FREQ=DAILY;COUNT=10
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970903T090000,19970904T090000,19970905T090000,19970906T090000,19970907T090000,19970908T090000,19970909T090000,19970910T090000,19970911T090000
+PREV-INSTANCES:19970910T090000,19970909T090000,19970908T090000,19970907T090000,19970906T090000,19970905T090000,19970904T090000,19970903T090000,19970902T090000
RRULE:FREQ=DAILY;UNTIL=19971224T000000Z
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970903T090000,19970904T090000,19970905T090000,19970906T090000,19970907T090000,19970908T090000,19970909T090000,19970910T090000,19970911T090000,19970912T090000,19970913T090000,19970914T090000,19970915T090000,19970916T090000,19970917T090000,19970918T090000,19970919T090000,19970920T090000,19970921T090000,19970922T090000,19970923T090000,19970924T090000,19970925T090000,19970926T090000,19970927T090000,19970928T090000,19970929T090000,19970930T090000,19971001T090000,19971002T090000,19971003T090000,19971004T090000,19971005T090000,19971006T090000,19971007T090000,19971008T090000,19971009T090000,19971010T090000,19971011T090000,19971012T090000,19971013T090000,19971014T090000,19971015T090000,19971016T090000,19971017T090000,19971018T090000,19971019T090000,19971020T090000,19971021T090000,19971022T090000,19971023T090000,19971024T090000,19971025T090000,19971026T090000,19971027T090000,19971028T090000,19971029T090000,19971030T090000,19971031T090000,19971101T090000,19971102T090000,19971103T090000,19971104T090000,19971105T090000,19971106T090000,19971107T090000,19971108T090000,19971109T090000,19971110T090000,19971111T090000,19971112T090000,19971113T090000,19971114T090000,19971115T090000,19971116T090000,19971117T090000,19971118T090000,19971119T090000,19971120T090000,19971121T090000,19971122T090000,19971123T090000,19971124T090000,19971125T090000,19971126T090000,19971127T090000,19971128T090000,19971129T090000,19971130T090000,19971201T090000,19971202T090000,19971203T090000,19971204T090000,19971205T090000,19971206T090000,19971207T090000,19971208T090000,19971209T090000,19971210T090000,19971211T090000,19971212T090000,19971213T090000,19971214T090000,19971215T090000,19971216T090000,19971217T090000,19971218T090000,19971219T090000,19971220T090000,19971221T090000,19971222T090000,19971223T090000
+PREV-INSTANCES:19971223T090000,19971222T090000,19971221T090000,19971220T090000,19971219T090000,19971218T090000,19971217T090000,19971216T090000,19971215T090000,19971214T090000,19971213T090000,19971212T090000,19971211T090000,19971210T090000,19971209T090000,19971208T090000,19971207T090000,19971206T090000,19971205T090000,19971204T090000,19971203T090000,19971202T090000,19971201T090000,19971130T090000,19971129T090000,19971128T090000,19971127T090000,19971126T090000,19971125T090000,19971124T090000,19971123T090000,19971122T090000,19971121T090000,19971120T090000,19971119T090000,19971118T090000,19971117T090000,19971116T090000,19971115T090000,19971114T090000,19971113T090000,19971112T090000,19971111T090000,19971110T090000,19971109T090000,19971108T090000,19971107T090000,19971106T090000,19971105T090000,19971104T090000,19971103T090000,19971102T090000,19971101T090000,19971031T090000,19971030T090000,19971029T090000,19971028T090000,19971027T090000,19971026T090000,19971025T090000,19971024T090000,19971023T090000,19971022T090000,19971021T090000,19971020T090000,19971019T090000,19971018T090000,19971017T090000,19971016T090000,19971015T090000,19971014T090000,19971013T090000,19971012T090000,19971011T090000,19971010T090000,19971009T090000,19971008T090000,19971007T090000,19971006T090000,19971005T090000,19971004T090000,19971003T090000,19971002T090000,19971001T090000,19970930T090000,19970929T090000,19970928T090000,19970927T090000,19970926T090000,19970925T090000,19970924T090000,19970923T090000,19970922T090000,19970921T090000,19970920T090000,19970919T090000,19970918T090000,19970917T090000,19970916T090000,19970915T090000,19970914T090000,19970913T090000,19970912T090000,19970911T090000,19970910T090000,19970909T090000,19970908T090000,19970907T090000,19970906T090000,19970905T090000,19970904T090000,19970903T090000,19970902T090000
RRULE:FREQ=DAILY;INTERVAL=2;COUNT=20
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970904T090000,19970906T090000,19970908T090000,19970910T090000,19970912T090000,19970914T090000,19970916T090000,19970918T090000,19970920T090000,19970922T090000,19970924T090000,19970926T090000,19970928T090000,19970930T090000,19971002T090000,19971004T090000,19971006T090000,19971008T090000,19971010T090000
+PREV-INSTANCES:19971008T090000,19971006T090000,19971004T090000,19971002T090000,19970930T090000,19970928T090000,19970926T090000,19970924T090000,19970922T090000,19970920T090000,19970918T090000,19970916T090000,19970914T090000,19970912T090000,19970910T090000,19970908T090000,19970906T090000,19970904T090000,19970902T090000
RRULE:FREQ=DAILY;INTERVAL=10;COUNT=5
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970912T090000,19970922T090000,19971002T090000,19971012T090000
+PREV-INSTANCES:19971002T090000,19970922T090000,19970912T090000,19970902T090000
RRULE:FREQ=DAILY;UNTIL=20000131T140000Z;BYMONTH=1
DTSTART:19980101T090000
INSTANCES:19980101T090000,19980102T090000,19980103T090000,19980104T090000,19980105T090000,19980106T090000,19980107T090000,19980108T090000,19980109T090000,19980110T090000,19980111T090000,19980112T090000,19980113T090000,19980114T090000,19980115T090000,19980116T090000,19980117T090000,19980118T090000,19980119T090000,19980120T090000,19980121T090000,19980122T090000,19980123T090000,19980124T090000,19980125T090000,19980126T090000,19980127T090000,19980128T090000,19980129T090000,19980130T090000,19980131T090000,19990101T090000,19990102T090000,19990103T090000,19990104T090000,19990105T090000,19990106T090000,19990107T090000,19990108T090000,19990109T090000,19990110T090000,19990111T090000,19990112T090000,19990113T090000,19990114T090000,19990115T090000,19990116T090000,19990117T090000,19990118T090000,19990119T090000,19990120T090000,19990121T090000,19990122T090000,19990123T090000,19990124T090000,19990125T090000,19990126T090000,19990127T090000,19990128T090000,19990129T090000,19990130T090000,19990131T090000,20000101T090000,20000102T090000,20000103T090000,20000104T090000,20000105T090000,20000106T090000,20000107T090000,20000108T090000,20000109T090000,20000110T090000,20000111T090000,20000112T090000,20000113T090000,20000114T090000,20000115T090000,20000116T090000,20000117T090000,20000118T090000,20000119T090000,20000120T090000,20000121T090000,20000122T090000,20000123T090000,20000124T090000,20000125T090000,20000126T090000,20000127T090000,20000128T090000,20000129T090000,20000130T090000,20000131T090000
+PREV-INSTANCES:20000131T090000,20000130T090000,20000129T090000,20000128T090000,20000127T090000,20000126T090000,20000125T090000,20000124T090000,20000123T090000,20000122T090000,20000121T090000,20000120T090000,20000119T090000,20000118T090000,20000117T090000,20000116T090000,20000115T090000,20000114T090000,20000113T090000,20000112T090000,20000111T090000,20000110T090000,20000109T090000,20000108T090000,20000107T090000,20000106T090000,20000105T090000,20000104T090000,20000103T090000,20000102T090000,20000101T090000,19990131T090000,19990130T090000,19990129T090000,19990128T090000,19990127T090000,19990126T090000,19990125T090000,19990124T090000,19990123T090000,19990122T090000,19990121T090000,19990120T090000,19990119T090000,19990118T090000,19990117T090000,19990116T090000,19990115T090000,19990114T090000,19990113T090000,19990112T090000,19990111T090000,19990110T090000,19990109T090000,19990108T090000,19990107T090000,19990106T090000,19990105T090000,19990104T090000,19990103T090000,19990102T090000,19990101T090000,19980131T090000,19980130T090000,19980129T090000,19980128T090000,19980127T090000,19980126T090000,19980125T090000,19980124T090000,19980123T090000,19980122T090000,19980121T090000,19980120T090000,19980119T090000,19980118T090000,19980117T090000,19980116T090000,19980115T090000,19980114T090000,19980113T090000,19980112T090000,19980111T090000,19980110T090000,19980109T090000,19980108T090000,19980107T090000,19980106T090000,19980105T090000,19980104T090000,19980103T090000,19980102T090000,19980101T090000
RRULE:FREQ=DAILY;BYHOUR=9,10,11,12,13,14,15,16;BYMINUTE=0,20,40;COUNT=48
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970902T092000,19970902T094000,19970902T100000,19970902T102000,19970902T104000,19970902T110000,19970902T112000,19970902T114000,19970902T120000,19970902T122000,19970902T124000,19970902T130000,19970902T132000,19970902T134000,19970902T140000,19970902T142000,19970902T144000,19970902T150000,19970902T152000,19970902T154000,19970902T160000,19970902T162000,19970902T164000,19970903T090000,19970903T092000,19970903T094000,19970903T100000,19970903T102000,19970903T104000,19970903T110000,19970903T112000,19970903T114000,19970903T120000,19970903T122000,19970903T124000,19970903T130000,19970903T132000,19970903T134000,19970903T140000,19970903T142000,19970903T144000,19970903T150000,19970903T152000,19970903T154000,19970903T160000,19970903T162000,19970903T164000
+PREV-INSTANCES:19970903T162000,19970903T160000,19970903T154000,19970903T152000,19970903T150000,19970903T144000,19970903T142000,19970903T140000,19970903T134000,19970903T132000,19970903T130000,19970903T124000,19970903T122000,19970903T120000,19970903T114000,19970903T112000,19970903T110000,19970903T104000,19970903T102000,19970903T100000,19970903T094000,19970903T092000,19970903T090000,19970902T164000,19970902T162000,19970902T160000,19970902T154000,19970902T152000,19970902T150000,19970902T144000,19970902T142000,19970902T140000,19970902T134000,19970902T132000,19970902T130000,19970902T124000,19970902T122000,19970902T120000,19970902T114000,19970902T112000,19970902T110000,19970902T104000,19970902T102000,19970902T100000,19970902T094000,19970902T092000,19970902T090000
RRULE:FREQ=HOURLY;INTERVAL=3;UNTIL=19970902T170000Z
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970902T120000,19970902T150000
+PREV-INSTANCES:19970902T150000,19970902T120000,19970902T090000
RRULE:FREQ=MINUTELY;INTERVAL=15;COUNT=6
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970902T091500,19970902T093000,19970902T094500,19970902T100000,19970902T101500
+PREV-INSTANCES:19970902T100000,19970902T094500,19970902T093000,19970902T091500,19970902T090000
RRULE:FREQ=MINUTELY;INTERVAL=90;COUNT=4
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970902T103000,19970902T120000,19970902T133000
+PREV-INSTANCES:19970902T120000,19970902T103000,19970902T090000
RRULE:FREQ=DAILY;BYHOUR=9,10,11,12,13,14,15,16;BYMINUTE=0,20,40;COUNT=48
DTSTART:19970902T090000
INSTANCES:19970902T090000,19970902T092000,19970902T094000,19970902T100000,19970902T102000,19970902T104000,19970902T110000,19970902T112000,19970902T114000,19970902T120000,19970902T122000,19970902T124000,19970902T130000,19970902T132000,19970902T134000,19970902T140000,19970902T142000,19970902T144000,19970902T150000,19970902T152000,19970902T154000,19970902T160000,19970902T162000,19970902T164000,19970903T090000,19970903T092000,19970903T094000,19970903T100000,19970903T102000,19970903T104000,19970903T110000,19970903T112000,19970903T114000,19970903T120000,19970903T122000,19970903T124000,19970903T130000,19970903T132000,19970903T134000,19970903T140000,19970903T142000,19970903T144000,19970903T150000,19970903T152000,19970903T154000,19970903T160000,19970903T162000,19970903T164000
+PREV-INSTANCES:19970903T162000,19970903T160000,19970903T154000,19970903T152000,19970903T150000,19970903T144000,19970903T142000,19970903T140000,19970903T134000,19970903T132000,19970903T130000,19970903T124000,19970903T122000,19970903T120000,19970903T114000,19970903T112000,19970903T110000,19970903T104000,19970903T102000,19970903T100000,19970903T094000,19970903T092000,19970903T090000,19970902T164000,19970902T162000,19970902T160000,19970902T154000,19970902T152000,19970902T150000,19970902T144000,19970902T142000,19970902T140000,19970902T134000,19970902T132000,19970902T130000,19970902T124000,19970902T122000,19970902T120000,19970902T114000,19970902T112000,19970902T110000,19970902T104000,19970902T102000,19970902T100000,19970902T094000,19970902T092000,19970902T090000
RRULE:FREQ=WEEKLY;COUNT=35;BYDAY=SU,TH
DTSTART:20111120T100000Z
INSTANCES:20111120T100000Z,20111124T100000Z,20111127T100000Z,20111201T100000Z,20111204T100000Z,20111208T100000Z,20111211T100000Z,20111215T100000Z,20111218T100000Z,20111222T100000Z,20111225T100000Z,20111229T100000Z,20120101T100000Z,20120105T100000Z,20120108T100000Z,20120112T100000Z,20120115T100000Z,20120119T100000Z,20120122T100000Z,20120126T100000Z,20120129T100000Z,20120202T100000Z,20120205T100000Z,20120209T100000Z,20120212T100000Z,20120216T100000Z,20120219T100000Z,20120223T100000Z,20120226T100000Z,20120301T100000Z,20120304T100000Z,20120308T100000Z,20120311T100000Z,20120315T100000Z,20120318T100000Z
+PREV-INSTANCES:20120315T100000Z,20120311T100000Z,20120308T100000Z,20120304T100000Z,20120301T100000Z,20120226T100000Z,20120223T100000Z,20120219T100000Z,20120216T100000Z,20120212T100000Z,20120209T100000Z,20120205T100000Z,20120202T100000Z,20120129T100000Z,20120126T100000Z,20120122T100000Z,20120119T100000Z,20120115T100000Z,20120112T100000Z,20120108T100000Z,20120105T100000Z,20120101T100000Z,20111229T100000Z,20111225T100000Z,20111222T100000Z,20111218T100000Z,20111215T100000Z,20111211T100000Z,20111208T100000Z,20111204T100000Z,20111201T100000Z,20111127T100000Z,20111124T100000Z,20111120T100000Z
RRULE:FREQ=DAILY;UNTIL=20141206T000000Z;BYMONTH=11,12,1,2,3,4,10
DTSTART:20141030T000000Z
INSTANCES:20141030T000000Z,20141031T000000Z,20141101T000000Z,20141102T000000Z,20141103T000000Z,20141104T000000Z,20141105T000000Z,20141106T000000Z,20141107T000000Z,20141108T000000Z,20141109T000000Z,20141110T000000Z,20141111T000000Z,20141112T000000Z,20141113T000000Z,20141114T000000Z,20141115T000000Z,20141116T000000Z,20141117T000000Z,20141118T000000Z,20141119T000000Z,20141120T000000Z,20141121T000000Z,20141122T000000Z,20141123T000000Z,20141124T000000Z,20141125T000000Z,20141126T000000Z,20141127T000000Z,20141128T000000Z,20141129T000000Z,20141130T000000Z,20141201T000000Z,20141202T000000Z,20141203T000000Z,20141204T000000Z,20141205T000000Z,20141206T000000Z
+PREV-INSTANCES:20141206T000000Z,20141205T000000Z,20141204T000000Z,20141203T000000Z,20141202T000000Z,20141201T000000Z,20141130T000000Z,20141129T000000Z,20141128T000000Z,20141127T000000Z,20141126T000000Z,20141125T000000Z,20141124T000000Z,20141123T000000Z,20141122T000000Z,20141121T000000Z,20141120T000000Z,20141119T000000Z,20141118T000000Z,20141117T000000Z,20141116T000000Z,20141115T000000Z,20141114T000000Z,20141113T000000Z,20141112T000000Z,20141111T000000Z,20141110T000000Z,20141109T000000Z,20141108T000000Z,20141107T000000Z,20141106T000000Z,20141105T000000Z,20141104T000000Z,20141103T000000Z,20141102T000000Z,20141101T000000Z,20141031T000000Z,20141030T000000Z
RRULE:FREQ=YEARLY;BYWEEKNO=1,2;UNTIL=20170101T000000Z
DTSTART:20130101T000000
INSTANCES:20130101T000000,20130108T000000,20131231T000000,20140107T000000,20141230T000000,20150106T000000,20160105T000000,20160112T000000
+PREV-INSTANCES:20160112T000000,20160105T000000,20150106T000000,20141230T000000,20140107T000000,20131231T000000,20130108T000000,20130101T000000
RRULE:FREQ=YEARLY;BYYEARDAY=366;UNTIL=20200101T000000
DTSTART:20121231T120000
INSTANCES:20121231T120000,20161231T120000
+PREV-INSTANCES:20161231T120000,20121231T120000
RRULE:FREQ=YEARLY;BYDAY=-1FR;BYMONTH=10;UNTIL=20150101T000000Z
DTSTART:20101029T120000
INSTANCES:20101029T120000,20111028T120000,20121026T120000,20131025T120000,20141031T120000
+PREV-INSTANCES:20141031T120000,20131025T120000,20121026T120000,20111028T120000,20101029T120000
RRULE:FREQ=YEARLY;BYDAY=1FR;BYMONTH=4;UNTIL=20150101T000000Z
DTSTART:20100402T120000
INSTANCES:20100402T120000,20110401T120000,20120406T120000,20130405T120000,20140404T120000
+PREV-INSTANCES:20140404T120000,20130405T120000,20120406T120000,20110401T120000,20100402T120000
RRULE:FREQ=MONTHLY;BYMONTHDAY=31;COUNT=12
DTSTART:20150131T000000Z
INSTANCES:20150131T000000Z,20150331T000000Z,20150531T000000Z,20150731T000000Z,20150831T000000Z,20151031T000000Z,20151231T000000Z,20160131T000000Z,20160331T000000Z,20160531T000000Z,20160731T000000Z,20160831T000000Z
+PREV-INSTANCES:20160731T000000Z,20160531T000000Z,20160331T000000Z,20160131T000000Z,20151231T000000Z,20151031T000000Z,20150831T000000Z,20150731T000000Z,20150531T000000Z,20150331T000000Z,20150131T000000Z
RRULE:FREQ=MONTHLY;BYMONTHDAY=-31;COUNT=12
DTSTART:20150101T000000Z
INSTANCES:20150101T000000Z,20150301T000000Z,20150501T000000Z,20150701T000000Z,20150801T000000Z,20151001T000000Z,20151201T000000Z,20160101T000000Z,20160301T000000Z,20160501T000000Z,20160701T000000Z,20160801T000000Z
+PREV-INSTANCES:20160701T000000Z,20160501T000000Z,20160301T000000Z,20160101T000000Z,20151201T000000Z,20151001T000000Z,20150801T000000Z,20150701T000000Z,20150501T000000Z,20150301T000000Z,20150101T000000Z
RRULE:FREQ=YEARLY;BYYEARDAY=366;COUNT=3
DTSTART:20121231T120000
INSTANCES:20121231T120000,20161231T120000,20201231T120000
+PREV-INSTANCES:20161231T120000,20121231T120000
RRULE:FREQ=YEARLY;BYYEARDAY=-366;COUNT=3
DTSTART:20120101T120000
INSTANCES:20120101T120000,20160101T120000,20200101T120000
+PREV-INSTANCES:20160101T120000,20120101T120000
RRULE:FREQ=YEARLY;INTERVAL=2;UNTIL=20211231T140000Z;BYMONTH=2;BYDAY=WE
DTSTART:20170201T090000
START-AT:20200101T100000
INSTANCES:20210203T090000,20210210T090000,20210217T090000,20210224T090000
+PREV-INSTANCES:20190227T090000,20190220T090000,20190213T090000,20190206T090000,20170222T090000,20170215T090000,20170208T090000,20170201T090000
RRULE:FREQ=MONTHLY;UNTIL=20171229T000000Z;BYDAY=1FR
DTSTART:20170901T090000
START-AT:20170915T090000
INSTANCES:20171006T090000,20171103T090000,20171201T090000
+PREV-INSTANCES:20170901T090000
RRULE:FREQ=WEEKLY;UNTIL=20170127T000000Z;WKST=MO;BYDAY=SU,TU,TH;INTERVAL=2
DTSTART:20161229T090000
START-AT:20161231T090000
INSTANCES:20170101T090000,20170110T090000,20170112T090000,20170115T090000,20170124T090000,20170126T090000
+PREV-INSTANCES:20161229T090000
RRULE:FREQ=WEEKLY;UNTIL=20170127T000000Z;WKST=MO;BYDAY=SU,TU,TH;INTERVAL=2
DTSTART:20161229T090000
START-AT:20170102T090000
INSTANCES:20170110T090000,20170112T090000,20170115T090000,20170124T090000,20170126T090000
+PREV-INSTANCES:20170101T090000,20161229T090000
RRULE:FREQ=DAILY;UNTIL=20170131T140000Z;BYMONTH=1;INTERVAL=3
DTSTART:20170101T090000
START-AT:20170103T090000
INSTANCES:20170104T090000,20170107T090000,20170110T090000,20170113T090000,20170116T090000,20170119T090000,20170122T090000,20170125T090000,20170128T090000,20170131T090000
+PREV-INSTANCES:20170101T090000
RRULE:FREQ=HOURLY;INTERVAL=3;UNTIL=20170903T170000Z
DTSTART:20170902T090000
START-AT:20170902T230000
INSTANCES:20170903T000000,20170903T030000,20170903T060000,20170903T090000,20170903T120000,20170903T150000
+PREV-INSTANCES:20170902T210000,20170902T180000,20170902T150000,20170902T120000,20170902T090000
RRULE:FREQ=MONTHLY;INTERVAL=13;BYMONTH=5;COUNT=3
DTSTART:20100212T000000
INSTANCES:20130512T000000,20260512T000000,20390512T000000
+PREV-INSTANCES:20260512T000000,20130512T000000
RRULE:FREQ=WEEKLY;BYDAY=WE,FR;INTERVAL=2;COUNT=4
DTSTART:20190101T100000
INSTANCES:20190102T100000,20190104T100000,20190116T100000,20190118T100000
+PREV-INSTANCES:20190116T100000,20190104T100000,20190102T100000
RRULE:FREQ=YEARLY;BYWEEKNO=1,2,-1,-2;BYDAY=TU;UNTIL=20170101T000000Z
DTSTART:20130101T000000
INSTANCES:20130101T000000,20130108T000000,20131217T000000,20131224T000000,20131231T000000,20140107T000000,20141216T000000,20141223T000000,20141230T000000,20150106T000000,20151222T000000,20151229T000000,20160105T000000,20160112T000000,20161220T000000,20161227T000000
+PREV-INSTANCES:20161227T000000,20161220T000000,20160112T000000,20160105T000000,20151229T000000,20151222T000000,20150106T000000,20141230T000000,20141223T000000,20141216T000000,20140107T000000,20131231T000000,20131224T000000,20131217T000000,20130108T000000,20130101T000000
RRULE:FREQ=YEARLY;BYWEEKNO=53;BYDAY=TU,SA;UNTIL=20170101T000000Z
DTSTART:20130101T000000
INSTANCES:20151229T000000,20160102T000000
+PREV-INSTANCES:20160102T000000,20151229T000000
RRULE:FREQ=HOURLY;UNTIL=20210303T000000Z
DTSTART:20210301T142000
START-AT:20210302T100000
INSTANCES:20210302T102000,20210302T112000,20210302T122000,20210302T132000,20210302T142000,20210302T152000,20210302T162000,20210302T172000,20210302T182000,20210302T192000,20210302T202000,20210302T212000,20210302T222000,20210302T232000
+PREV-INSTANCES:20210302T092000,20210302T082000,20210302T072000,20210302T062000,20210302T052000,20210302T042000,20210302T032000,20210302T022000,20210302T012000,20210302T002000,20210301T232000,20210301T222000,20210301T212000,20210301T202000,20210301T192000,20210301T182000,20210301T172000,20210301T162000,20210301T152000,20210301T142000
diff --git a/src/test/icalrecur_withicu_dangi_test.out b/src/test/icalrecur_withicu_dangi_test.out
index 8028bb74..341a1304 100644
--- a/src/test/icalrecur_withicu_dangi_test.out
+++ b/src/test/icalrecur_withicu_dangi_test.out
@@ -6,132 +6,165 @@ INSTANCES: *** UNIMPLEMENTED: This feature has not been implemented
RRULE:RSCALE=ETHIOPIC;FREQ=YEARLY;BYMONTH=13;BYMONTHDAY=-1;COUNT=6
DTSTART:20140910
INSTANCES:20140910,20150911,20160910,20170910,20180910,20190911
+PREV-INSTANCES:20180910,20170910,20160910,20150911,20140910
RRULE:RSCALE=CHINESE;FREQ=YEARLY;UNTIL=20180101
DTSTART:20130210
INSTANCES:20130210,20140131,20150219,20160208,20170128
+PREV-INSTANCES:20170128,20160208,20150219,20140131,20130210
RRULE:RSCALE=CHINESE;FREQ=MONTHLY;COUNT=4
DTSTART:20140920
INSTANCES:20140920,20141020,20141119,20141218
+PREV-INSTANCES:20141119,20141020,20140920
RRULE:RSCALE=ISLAMIC-CIVIL;FREQ=MONTHLY;COUNT=4
DTSTART:20131025
INSTANCES:20131025,20131124,20131224,20140122
+PREV-INSTANCES:20131224,20131124,20131025
RRULE:RSCALE=ISLAMIC-CIVIL;FREQ=YEARLY;BYMONTH=9;COUNT=5
DTSTART:20130709
INSTANCES:20130709,20140629,20150618,20160607,20170527
+PREV-INSTANCES:20160607,20150618,20140629,20130709
RRULE:RSCALE=DANGI;FREQ=YEARLY;BYMONTHDAY=8;BYMONTH=4;UNTIL=20160101
DTSTART:20131025
INSTANCES:20140506,20150525
+PREV-INSTANCES:20150525,20140506
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=9;COUNT=3
DTSTART:20131025
INSTANCES:20141003,20151022,20161010
+PREV-INSTANCES:20151022,20141003
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=9L;SKIP=OMIT;COUNT=2
DTSTART:20131025
INSTANCES:20141102,21091102
+PREV-INSTANCES:20141102
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=4L;SKIP=OMIT;UNTIL=21000101
DTSTART:20131025
INSTANCES:20200601,20580531,20690530,20770531,20880530,20960531
+PREV-INSTANCES:20960531,20880530,20770531,20690530,20580531,20200601
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=9L;SKIP=FORWARD;COUNT=3
DTSTART:20131025
INSTANCES:20131112,20141102,20151121
+PREV-INSTANCES:20141102,20131112
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=9L;SKIP=BACKWARD;COUNT=3
DTSTART:20131025
INSTANCES:20141102,20151022,20161010
+PREV-INSTANCES:20151022,20141102
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=9,9L;SKIP=BACKWARD;COUNT=4
DTSTART:20131025
INSTANCES:20141003,20141102,20151022,20161010
+PREV-INSTANCES:20151022,20141102,20141003
RRULE:RSCALE=CHINESE;FREQ=YEARLY;UNTIL=20200101;INTERVAL=2
DTSTART:20130210
START-AT:20160101
INSTANCES:20170128,20190205
+PREV-INSTANCES:20150219,20130210
RRULE:RSCALE=HEBREW;FREQ=YEARLY;COUNT=4
DTSTART:20140205
INSTANCES:20140205,20160214,20190210,20220206
+PREV-INSTANCES:20190210,20160214,20140205
RRULE:RSCALE=HEBREW;FREQ=YEARLY;SKIP=FORWARD;COUNT=4
DTSTART:20140205
INSTANCES:20140205,20150224,20160214,20170303
+PREV-INSTANCES:20160214,20150224,20140205
RRULE:RSCALE=HEBREW;FREQ=YEARLY;BYMONTH=5L;BYMONTHDAY=8;SKIP=FORWARD;COUNT=5
DTSTART:20140208
INSTANCES:20140208,20150227,20160217,20170306,20180223
+PREV-INSTANCES:20170306,20160217,20150227,20140208
RRULE:RSCALE=HEBREW;FREQ=YEARLY;BYMONTH=5L;BYMONTHDAY=30;SKIP=FORWARD;COUNT=5
DTSTART:20140302
INSTANCES:20140302,20150321,20160310,20170328,20180317
+PREV-INSTANCES:20170328,20160310,20150321,20140302
RRULE:RSCALE=HEBREW;FREQ=YEARLY;BYMONTH=5L;BYMONTHDAY=-1;SKIP=FORWARD;COUNT=5
DTSTART:20140302
INSTANCES:20140302,20150320,20160310,20170327,20180316
+PREV-INSTANCES:20170327,20160310,20150320,20140302
RRULE:RSCALE=HEBREW;FREQ=YEARLY;BYMONTH=5L;BYMONTHDAY=30;SKIP=BACKWARD;COUNT=5
DTSTART:20140302
INSTANCES:20140302,20150219,20160310,20170226,20180215
+PREV-INSTANCES:20170226,20160310,20150219,20140302
RRULE:RSCALE=HEBREW;FREQ=YEARLY;BYMONTH=5L;BYMONTHDAY=-1;SKIP=BACKWARD;COUNT=5
DTSTART:20140302
INSTANCES:20140302,20150219,20160310,20170226,20180215
+PREV-INSTANCES:20170226,20160310,20150219,20140302
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;COUNT=4
DTSTART:20120229
INSTANCES:20120229,20160229,20200229,20240229
+PREV-INSTANCES:20200229,20160229,20120229
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;SKIP=BACKWARD;COUNT=4
DTSTART:20140131
INSTANCES:20140131,20140228,20140331,20140430
+PREV-INSTANCES:20140331,20140228,20140131
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;SKIP=FORWARD;COUNT=4
DTSTART:20140131
INSTANCES:20140131,20140301,20140331,20140501
+PREV-INSTANCES:20140331,20140301,20140131
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYMONTH=2;BYMONTHDAY=28,29;SKIP=FORWARD;COUNT=5
DTSTART:20150201
INSTANCES:20150228,20150301,20160228,20160229,20170228
+PREV-INSTANCES:20160229,20160228,20150301,20150228
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;INTERVAL=3;SKIP=FORWARD;COUNT=4
DTSTART:20140131
INSTANCES:20140131,20140501,20140731,20141031
+PREV-INSTANCES:20140731,20140501,20140131
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=31;COUNT=12;SKIP=FORWARD
DTSTART:20150131T000000Z
INSTANCES:20150131T000000Z,20150301T000000Z,20150331T000000Z,20150501T000000Z,20150531T000000Z,20150701T000000Z,20150731T000000Z,20150831T000000Z,20151001T000000Z,20151031T000000Z,20151201T000000Z,20151231T000000Z
+PREV-INSTANCES:20151201T000000Z,20151031T000000Z,20151001T000000Z,20150831T000000Z,20150731T000000Z,20150701T000000Z,20150531T000000Z,20150501T000000Z,20150331T000000Z,20150301T000000Z,20150131T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=-31;COUNT=12;SKIP=FORWARD
DTSTART:20150101T000000Z
INSTANCES:20150101T000000Z,20150201T000000Z,20150301T000000Z,20150401T000000Z,20150501T000000Z,20150601T000000Z,20150701T000000Z,20150801T000000Z,20150901T000000Z,20151001T000000Z,20151101T000000Z,20151201T000000Z
+PREV-INSTANCES:20151101T000000Z,20151001T000000Z,20150901T000000Z,20150801T000000Z,20150701T000000Z,20150601T000000Z,20150501T000000Z,20150401T000000Z,20150301T000000Z,20150201T000000Z,20150101T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=31;COUNT=12;SKIP=BACKWARD
DTSTART:20150131T000000Z
INSTANCES:20150131T000000Z,20150228T000000Z,20150331T000000Z,20150430T000000Z,20150531T000000Z,20150630T000000Z,20150731T000000Z,20150831T000000Z,20150930T000000Z,20151031T000000Z,20151130T000000Z,20151231T000000Z
+PREV-INSTANCES:20151130T000000Z,20151031T000000Z,20150930T000000Z,20150831T000000Z,20150731T000000Z,20150630T000000Z,20150531T000000Z,20150430T000000Z,20150331T000000Z,20150228T000000Z,20150131T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=-31;COUNT=12;SKIP=BACKWARD
DTSTART:20150101T000000Z
INSTANCES:20150101T000000Z,20150131T000000Z,20150301T000000Z,20150331T000000Z,20150501T000000Z,20150531T000000Z,20150701T000000Z,20150801T000000Z,20150831T000000Z,20151001T000000Z,20151031T000000Z,20151201T000000Z
+PREV-INSTANCES:20151031T000000Z,20151001T000000Z,20150831T000000Z,20150801T000000Z,20150701T000000Z,20150531T000000Z,20150501T000000Z,20150331T000000Z,20150301T000000Z,20150131T000000Z,20150101T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=366;SKIP=FORWARD;COUNT=9
DTSTART:20121231T120000
INSTANCES:20121231T120000,20140101T120000,20150101T120000,20160101T120000,20161231T120000,20180101T120000,20190101T120000,20200101T120000,20201231T120000
+PREV-INSTANCES:20200101T120000,20190101T120000,20180101T120000,20161231T120000,20160101T120000,20150101T120000,20140101T120000,20121231T120000
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=366;SKIP=BACKWARD;COUNT=9
DTSTART:20121231T120000
INSTANCES:20121231T120000,20131231T120000,20141231T120000,20151231T120000,20161231T120000,20171231T120000,20181231T120000,20191231T120000,20201231T120000
+PREV-INSTANCES:20191231T120000,20181231T120000,20171231T120000,20161231T120000,20151231T120000,20141231T120000,20131231T120000,20121231T120000
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=-366;SKIP=FORWARD;COUNT=9
DTSTART:20120101T120000
INSTANCES:20120101T120000,20130101T120000,20140101T120000,20150101T120000,20160101T120000,20170101T120000,20180101T120000,20190101T120000,20200101T120000
+PREV-INSTANCES:20190101T120000,20180101T120000,20170101T120000,20160101T120000,20150101T120000,20140101T120000,20130101T120000,20120101T120000
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=-366;SKIP=BACKWARD;COUNT=9
DTSTART:20120101T120000
INSTANCES:20120101T120000,20121231T120000,20131231T120000,20141231T120000,20160101T120000,20161231T120000,20171231T120000,20181231T120000,20200101T120000
+PREV-INSTANCES:20181231T120000,20171231T120000,20161231T120000,20160101T120000,20141231T120000,20131231T120000,20121231T120000,20120101T120000
diff --git a/src/test/icalrecur_withicu_test.out b/src/test/icalrecur_withicu_test.out
index 518f3d84..beb96834 100644
--- a/src/test/icalrecur_withicu_test.out
+++ b/src/test/icalrecur_withicu_test.out
@@ -6,128 +6,160 @@ INSTANCES: *** UNIMPLEMENTED: This feature has not been implemented
RRULE:RSCALE=ETHIOPIC;FREQ=YEARLY;BYMONTH=13;BYMONTHDAY=-1;COUNT=6
DTSTART:20140910
INSTANCES:20140910,20150911,20160910,20170910,20180910,20190911
+PREV-INSTANCES:20180910,20170910,20160910,20150911,20140910
RRULE:RSCALE=CHINESE;FREQ=YEARLY;UNTIL=20180101
DTSTART:20130210
INSTANCES:20130210,20140131,20150219,20160208,20170128
+PREV-INSTANCES:20170128,20160208,20150219,20140131,20130210
RRULE:RSCALE=CHINESE;FREQ=MONTHLY;COUNT=4
DTSTART:20140920
INSTANCES:20140920,20141020,20141119,20141218
+PREV-INSTANCES:20141119,20141020,20140920
RRULE:RSCALE=ISLAMIC-CIVIL;FREQ=MONTHLY;COUNT=4
DTSTART:20131025
INSTANCES:20131025,20131124,20131224,20140122
+PREV-INSTANCES:20131224,20131124,20131025
RRULE:RSCALE=ISLAMIC-CIVIL;FREQ=YEARLY;BYMONTH=9;COUNT=5
DTSTART:20130709
INSTANCES:20130709,20140629,20150618,20160607,20170527
+PREV-INSTANCES:20160607,20150618,20140629,20130709
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=9;COUNT=3
DTSTART:20131025
INSTANCES:20141003,20151022,20161010
+PREV-INSTANCES:20151022,20141003
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=9L;SKIP=OMIT;COUNT=2
DTSTART:20131025
INSTANCES:20141102,21091102
+PREV-INSTANCES:20141102
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=4L;SKIP=OMIT;UNTIL=21000101
DTSTART:20131025
INSTANCES:20200601,20580531,20690530,20770531,20880530,20960531
+PREV-INSTANCES:20960531,20880530,20770531,20690530,20580531,20200601
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=9L;SKIP=FORWARD;COUNT=3
DTSTART:20131025
INSTANCES:20131112,20141102,20151121
+PREV-INSTANCES:20141102,20131112
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=9L;SKIP=BACKWARD;COUNT=3
DTSTART:20131025
INSTANCES:20141102,20151022,20161010
+PREV-INSTANCES:20151022,20141102
RRULE:RSCALE=CHINESE;FREQ=YEARLY;BYMONTHDAY=10;BYMONTH=9,9L;SKIP=BACKWARD;COUNT=4
DTSTART:20131025
INSTANCES:20141003,20141102,20151022,20161010
+PREV-INSTANCES:20151022,20141102,20141003
RRULE:RSCALE=CHINESE;FREQ=YEARLY;UNTIL=20200101;INTERVAL=2
DTSTART:20130210
START-AT:20160101
INSTANCES:20170128,20190205
+PREV-INSTANCES:20150219,20130210
RRULE:RSCALE=HEBREW;FREQ=YEARLY;COUNT=4
DTSTART:20140205
INSTANCES:20140205,20160214,20190210,20220206
+PREV-INSTANCES:20190210,20160214,20140205
RRULE:RSCALE=HEBREW;FREQ=YEARLY;SKIP=FORWARD;COUNT=4
DTSTART:20140205
INSTANCES:20140205,20150224,20160214,20170303
+PREV-INSTANCES:20160214,20150224,20140205
RRULE:RSCALE=HEBREW;FREQ=YEARLY;BYMONTH=5L;BYMONTHDAY=8;SKIP=FORWARD;COUNT=5
DTSTART:20140208
INSTANCES:20140208,20150227,20160217,20170306,20180223
+PREV-INSTANCES:20170306,20160217,20150227,20140208
RRULE:RSCALE=HEBREW;FREQ=YEARLY;BYMONTH=5L;BYMONTHDAY=30;SKIP=FORWARD;COUNT=5
DTSTART:20140302
INSTANCES:20140302,20150321,20160310,20170328,20180317
+PREV-INSTANCES:20170328,20160310,20150321,20140302
RRULE:RSCALE=HEBREW;FREQ=YEARLY;BYMONTH=5L;BYMONTHDAY=-1;SKIP=FORWARD;COUNT=5
DTSTART:20140302
INSTANCES:20140302,20150320,20160310,20170327,20180316
+PREV-INSTANCES:20170327,20160310,20150320,20140302
RRULE:RSCALE=HEBREW;FREQ=YEARLY;BYMONTH=5L;BYMONTHDAY=30;SKIP=BACKWARD;COUNT=5
DTSTART:20140302
INSTANCES:20140302,20150219,20160310,20170226,20180215
+PREV-INSTANCES:20170226,20160310,20150219,20140302
RRULE:RSCALE=HEBREW;FREQ=YEARLY;BYMONTH=5L;BYMONTHDAY=-1;SKIP=BACKWARD;COUNT=5
DTSTART:20140302
INSTANCES:20140302,20150219,20160310,20170226,20180215
+PREV-INSTANCES:20170226,20160310,20150219,20140302
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;COUNT=4
DTSTART:20120229
INSTANCES:20120229,20160229,20200229,20240229
+PREV-INSTANCES:20200229,20160229,20120229
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;SKIP=BACKWARD;COUNT=4
DTSTART:20140131
INSTANCES:20140131,20140228,20140331,20140430
+PREV-INSTANCES:20140331,20140228,20140131
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;SKIP=FORWARD;COUNT=4
DTSTART:20140131
INSTANCES:20140131,20140301,20140331,20140501
+PREV-INSTANCES:20140331,20140301,20140131
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYMONTH=2;BYMONTHDAY=28,29;SKIP=FORWARD;COUNT=5
DTSTART:20150201
INSTANCES:20150228,20150301,20160228,20160229,20170228
+PREV-INSTANCES:20160229,20160228,20150301,20150228
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;INTERVAL=3;SKIP=FORWARD;COUNT=4
DTSTART:20140131
INSTANCES:20140131,20140501,20140731,20141031
+PREV-INSTANCES:20140731,20140501,20140131
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=31;COUNT=12;SKIP=FORWARD
DTSTART:20150131T000000Z
INSTANCES:20150131T000000Z,20150301T000000Z,20150331T000000Z,20150501T000000Z,20150531T000000Z,20150701T000000Z,20150731T000000Z,20150831T000000Z,20151001T000000Z,20151031T000000Z,20151201T000000Z,20151231T000000Z
+PREV-INSTANCES:20151201T000000Z,20151031T000000Z,20151001T000000Z,20150831T000000Z,20150731T000000Z,20150701T000000Z,20150531T000000Z,20150501T000000Z,20150331T000000Z,20150301T000000Z,20150131T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=-31;COUNT=12;SKIP=FORWARD
DTSTART:20150101T000000Z
INSTANCES:20150101T000000Z,20150201T000000Z,20150301T000000Z,20150401T000000Z,20150501T000000Z,20150601T000000Z,20150701T000000Z,20150801T000000Z,20150901T000000Z,20151001T000000Z,20151101T000000Z,20151201T000000Z
+PREV-INSTANCES:20151101T000000Z,20151001T000000Z,20150901T000000Z,20150801T000000Z,20150701T000000Z,20150601T000000Z,20150501T000000Z,20150401T000000Z,20150301T000000Z,20150201T000000Z,20150101T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=31;COUNT=12;SKIP=BACKWARD
DTSTART:20150131T000000Z
INSTANCES:20150131T000000Z,20150228T000000Z,20150331T000000Z,20150430T000000Z,20150531T000000Z,20150630T000000Z,20150731T000000Z,20150831T000000Z,20150930T000000Z,20151031T000000Z,20151130T000000Z,20151231T000000Z
+PREV-INSTANCES:20151130T000000Z,20151031T000000Z,20150930T000000Z,20150831T000000Z,20150731T000000Z,20150630T000000Z,20150531T000000Z,20150430T000000Z,20150331T000000Z,20150228T000000Z,20150131T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=-31;COUNT=12;SKIP=BACKWARD
DTSTART:20150101T000000Z
INSTANCES:20150101T000000Z,20150131T000000Z,20150301T000000Z,20150331T000000Z,20150501T000000Z,20150531T000000Z,20150701T000000Z,20150801T000000Z,20150831T000000Z,20151001T000000Z,20151031T000000Z,20151201T000000Z
+PREV-INSTANCES:20151031T000000Z,20151001T000000Z,20150831T000000Z,20150801T000000Z,20150701T000000Z,20150531T000000Z,20150501T000000Z,20150331T000000Z,20150301T000000Z,20150131T000000Z,20150101T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=366;SKIP=FORWARD;COUNT=9
DTSTART:20121231T120000
INSTANCES:20121231T120000,20140101T120000,20150101T120000,20160101T120000,20161231T120000,20180101T120000,20190101T120000,20200101T120000,20201231T120000
+PREV-INSTANCES:20200101T120000,20190101T120000,20180101T120000,20161231T120000,20160101T120000,20150101T120000,20140101T120000,20121231T120000
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=366;SKIP=BACKWARD;COUNT=9
DTSTART:20121231T120000
INSTANCES:20121231T120000,20131231T120000,20141231T120000,20151231T120000,20161231T120000,20171231T120000,20181231T120000,20191231T120000,20201231T120000
+PREV-INSTANCES:20191231T120000,20181231T120000,20171231T120000,20161231T120000,20151231T120000,20141231T120000,20131231T120000,20121231T120000
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=-366;SKIP=FORWARD;COUNT=9
DTSTART:20120101T120000
INSTANCES:20120101T120000,20130101T120000,20140101T120000,20150101T120000,20160101T120000,20170101T120000,20180101T120000,20190101T120000,20200101T120000
+PREV-INSTANCES:20190101T120000,20180101T120000,20170101T120000,20160101T120000,20150101T120000,20140101T120000,20130101T120000,20120101T120000
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=-366;SKIP=BACKWARD;COUNT=9
DTSTART:20120101T120000
INSTANCES:20120101T120000,20121231T120000,20131231T120000,20141231T120000,20160101T120000,20161231T120000,20171231T120000,20181231T120000,20200101T120000
+PREV-INSTANCES:20181231T120000,20171231T120000,20161231T120000,20160101T120000,20141231T120000,20131231T120000,20121231T120000,20120101T120000
diff --git a/src/test/icalrecur_withouticu_test.out b/src/test/icalrecur_withouticu_test.out
index 0b05ea2f..88b6b5a3 100644
--- a/src/test/icalrecur_withouticu_test.out
+++ b/src/test/icalrecur_withouticu_test.out
@@ -6,51 +6,64 @@ INSTANCES: *** UNIMPLEMENTED: This feature has not been implemented
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;COUNT=4
DTSTART:20120229
INSTANCES:20120229,20160229,20200229,20240229
+PREV-INSTANCES:20200229,20160229,20120229
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;SKIP=BACKWARD;COUNT=4
DTSTART:20140131
INSTANCES:20140131,20140228,20140331,20140430
+PREV-INSTANCES:20140331,20140228,20140131
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;SKIP=FORWARD;COUNT=4
DTSTART:20140131
INSTANCES:20140131,20140301,20140331,20140501
+PREV-INSTANCES:20140331,20140301,20140131
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYMONTH=2;BYMONTHDAY=28,29;SKIP=FORWARD;COUNT=5
DTSTART:20150201
INSTANCES:20150228,20150301,20160228,20160229,20170228
+PREV-INSTANCES:20160229,20160228,20150301,20150228
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;INTERVAL=3;SKIP=FORWARD;COUNT=4
DTSTART:20140131
INSTANCES:20140131,20140501,20140731,20141031
+PREV-INSTANCES:20140731,20140501,20140131
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=31;COUNT=12;SKIP=FORWARD
DTSTART:20150131T000000Z
INSTANCES:20150131T000000Z,20150301T000000Z,20150331T000000Z,20150501T000000Z,20150531T000000Z,20150701T000000Z,20150731T000000Z,20150831T000000Z,20151001T000000Z,20151031T000000Z,20151201T000000Z,20151231T000000Z
+PREV-INSTANCES:20151201T000000Z,20151031T000000Z,20151001T000000Z,20150831T000000Z,20150731T000000Z,20150701T000000Z,20150531T000000Z,20150501T000000Z,20150331T000000Z,20150301T000000Z,20150131T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=-31;COUNT=12;SKIP=FORWARD
DTSTART:20150101T000000Z
INSTANCES:20150101T000000Z,20150201T000000Z,20150301T000000Z,20150401T000000Z,20150501T000000Z,20150601T000000Z,20150701T000000Z,20150801T000000Z,20150901T000000Z,20151001T000000Z,20151101T000000Z,20151201T000000Z
+PREV-INSTANCES:20151101T000000Z,20151001T000000Z,20150901T000000Z,20150801T000000Z,20150701T000000Z,20150601T000000Z,20150501T000000Z,20150401T000000Z,20150301T000000Z,20150201T000000Z,20150101T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=31;COUNT=12;SKIP=BACKWARD
DTSTART:20150131T000000Z
INSTANCES:20150131T000000Z,20150228T000000Z,20150331T000000Z,20150430T000000Z,20150531T000000Z,20150630T000000Z,20150731T000000Z,20150831T000000Z,20150930T000000Z,20151031T000000Z,20151130T000000Z,20151231T000000Z
+PREV-INSTANCES:20151130T000000Z,20151031T000000Z,20150930T000000Z,20150831T000000Z,20150731T000000Z,20150630T000000Z,20150531T000000Z,20150430T000000Z,20150331T000000Z,20150228T000000Z,20150131T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=MONTHLY;BYMONTHDAY=-31;COUNT=12;SKIP=BACKWARD
DTSTART:20150101T000000Z
INSTANCES:20150101T000000Z,20150131T000000Z,20150301T000000Z,20150331T000000Z,20150501T000000Z,20150531T000000Z,20150701T000000Z,20150801T000000Z,20150831T000000Z,20151001T000000Z,20151031T000000Z,20151201T000000Z
+PREV-INSTANCES:20151031T000000Z,20151001T000000Z,20150831T000000Z,20150801T000000Z,20150701T000000Z,20150531T000000Z,20150501T000000Z,20150331T000000Z,20150301T000000Z,20150131T000000Z,20150101T000000Z
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=366;SKIP=FORWARD;COUNT=9
DTSTART:20121231T120000
INSTANCES:20121231T120000,20140101T120000,20150101T120000,20160101T120000,20161231T120000,20180101T120000,20190101T120000,20200101T120000,20201231T120000
+PREV-INSTANCES:20200101T120000,20190101T120000,20180101T120000,20161231T120000,20160101T120000,20150101T120000,20140101T120000,20121231T120000
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=366;SKIP=BACKWARD;COUNT=9
DTSTART:20121231T120000
INSTANCES:20121231T120000,20131231T120000,20141231T120000,20151231T120000,20161231T120000,20171231T120000,20181231T120000,20191231T120000,20201231T120000
+PREV-INSTANCES:20191231T120000,20181231T120000,20171231T120000,20161231T120000,20151231T120000,20141231T120000,20131231T120000,20121231T120000
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=-366;SKIP=FORWARD;COUNT=9
DTSTART:20120101T120000
INSTANCES:20120101T120000,20130101T120000,20140101T120000,20150101T120000,20160101T120000,20170101T120000,20180101T120000,20190101T120000,20200101T120000
+PREV-INSTANCES:20190101T120000,20180101T120000,20170101T120000,20160101T120000,20150101T120000,20140101T120000,20130101T120000,20120101T120000
RRULE:RSCALE=GREGORIAN;FREQ=YEARLY;BYYEARDAY=-366;SKIP=BACKWARD;COUNT=9
DTSTART:20120101T120000
INSTANCES:20120101T120000,20121231T120000,20131231T120000,20141231T120000,20160101T120000,20161231T120000,20171231T120000,20181231T120000,20200101T120000
+PREV-INSTANCES:20181231T120000,20171231T120000,20161231T120000,20160101T120000,20141231T120000,20131231T120000,20121231T120000,20120101T120000
diff --git a/src/test/icaltestparser.c b/src/test/icaltestparser.c
index c301a74f..c3a27abf 100644
--- a/src/test/icaltestparser.c
+++ b/src/test/icaltestparser.c
@@ -2,18 +2,9 @@
FILE: icaltestparser.c
CREATOR: eric 20 June 1999
- (C) COPYRIGHT 1999 The Software Studio <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999 The Software Studio <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original author is Eric Busboom
======================================================================*/
diff --git a/src/test/icaltm_test.c b/src/test/icaltm_test.c
index 141d49e4..b3ccad34 100644
--- a/src/test/icaltm_test.c
+++ b/src/test/icaltm_test.c
@@ -1,18 +1,9 @@
/*======================================================================
FILE: icaltm_test.c
- Copyright (C) 2017 Red Hat, Inc. <www.redhat.com>
+ SPDX-FileCopyrightText: 2017 Red Hat, Inc. <www.redhat.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Initial Developer of the Original Code is Milan Crha
======================================================================*/
diff --git a/src/test/libical-glib/CMakeLists.txt b/src/test/libical-glib/CMakeLists.txt
index 4d239dba..2f88b115 100644
--- a/src/test/libical-glib/CMakeLists.txt
+++ b/src/test/libical-glib/CMakeLists.txt
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Milan Crha <mcrha@redhat.com>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
find_program(PYTHON3 python3)
set_package_properties(PYTHON3 PROPERTIES TYPE REQUIRED PURPOSE "Required by the libical build system.")
add_feature_info("libical-glib testing" PYTHON3 "python3 is required to run the regression tests")
@@ -19,9 +22,22 @@ list(APPEND TEST_FILES
)
if(PYTHON3)
+ set(GI_TYPELIB_PATH_STR "${CMAKE_BINARY_DIR}/src/libical-glib")
+ if(DEFINED GI_TYPELIB_PATH)
+ if($ENV{GI_TYPELIB_PATH})
+ set(GI_TYPELIB_PATH_STR "${GI_TYPELIB_PATH_STR}:$ENV{GI_TYPELIB_PATH}")
+ endif()
+ endif()
+ set(LD_LIBRARY_PATH_STR "${LIBRARY_OUTPUT_PATH}")
+ if(DEFINED LD_LIBRARY_PATH)
+ if($ENV{LD_LIBRARY_PATH})
+ set(LD_LIBRARY_PATH_STR "${LD_LIBRARY_PATH_STR}:$ENV{LD_LIBRARY_PATH}")
+ endif()
+ endif()
+
list(APPEND test_env
- "GI_TYPELIB_PATH=${CMAKE_BINARY_DIR}/src/libical-glib;$ENV{GI_TYPELIB_PATH}"
- "LD_LIBRARY_PATH=${LIBRARY_OUTPUT_PATH};$ENV{LD_LIBRARY_PATH}"
+ "GI_TYPELIB_PATH=${GI_TYPELIB_PATH_STR}"
+ "LD_LIBRARY_PATH=${LD_LIBRARY_PATH_STR}"
"ZONEINFO_DIRECTORY=${CMAKE_SOURCE_DIR}/zoneinfo"
)
diff --git a/src/test/libical-glib/array.py b/src/test/libical-glib/array.py
index 77d9550a..4d72ad0d 100755..100644
--- a/src/test/libical-glib/array.py
+++ b/src/test/libical-glib/array.py
@@ -1,80 +1,71 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./array.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./array.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
+''' Test Python bindings for libical arrays '''
+import gi
gi.require_version('ICalGLib', '3.0')
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
-from gi.repository import ICalGLib
-
-array = ICalGLib.Timezone.array_new();
+array = ICalGLib.Timezone.array_new()
-#TEST APPEND
-zone0 = ICalGLib.Timezone.get_builtin_timezone("Pacific/Midway");
-zone1 = ICalGLib.Timezone.get_builtin_timezone("America/Vancouver");
-zone2 = ICalGLib.Timezone.get_builtin_timezone("Atlantic/Bermuda");
-zone3 = ICalGLib.Timezone.get_builtin_timezone("Africa/Casablanca");
-zone4 = ICalGLib.Timezone.get_builtin_timezone("Asia/Irkutsk");
+# TEST APPEND
+zone0 = ICalGLib.Timezone.get_builtin_timezone("Pacific/Midway")
+zone1 = ICalGLib.Timezone.get_builtin_timezone("America/Vancouver")
+zone2 = ICalGLib.Timezone.get_builtin_timezone("Atlantic/Bermuda")
+zone3 = ICalGLib.Timezone.get_builtin_timezone("Africa/Casablanca")
+zone4 = ICalGLib.Timezone.get_builtin_timezone("Asia/Irkutsk")
-ICalGLib.Timezone.array_append_from_vtimezone(array, zone0.get_component());
-ICalGLib.Timezone.array_append_from_vtimezone(array, zone1.get_component());
-ICalGLib.Timezone.array_append_from_vtimezone(array, zone2.get_component());
-ICalGLib.Timezone.array_append_from_vtimezone(array, zone3.get_component());
-ICalGLib.Timezone.array_append_from_vtimezone(array, zone4.get_component());
+ICalGLib.Timezone.array_append_from_vtimezone(array, zone0.get_component())
+ICalGLib.Timezone.array_append_from_vtimezone(array, zone1.get_component())
+ICalGLib.Timezone.array_append_from_vtimezone(array, zone2.get_component())
+ICalGLib.Timezone.array_append_from_vtimezone(array, zone3.get_component())
+ICalGLib.Timezone.array_append_from_vtimezone(array, zone4.get_component())
assert array.size() == 5
-z0 = ICalGLib.Timezone.array_element_at(array, 0);
-assert(z0.get_location() == zone0.get_location());
-z1 = ICalGLib.Timezone.array_element_at(array, 1);
-assert(z1.get_location() == zone1.get_location());
-z2 = ICalGLib.Timezone.array_element_at(array, 2);
-assert(z2.get_location() == zone2.get_location());
-z3 = ICalGLib.Timezone.array_element_at(array, 3);
-assert(z3.get_location() == zone3.get_location());
-z4 = ICalGLib.Timezone.array_element_at(array, 4);
-assert(z4.get_location() == zone4.get_location());
+z0 = ICalGLib.Timezone.array_element_at(array, 0)
+assert z0.get_location() == zone0.get_location()
+z1 = ICalGLib.Timezone.array_element_at(array, 1)
+assert z1.get_location() == zone1.get_location()
+z2 = ICalGLib.Timezone.array_element_at(array, 2)
+assert z2.get_location() == zone2.get_location()
+z3 = ICalGLib.Timezone.array_element_at(array, 3)
+assert z3.get_location() == zone3.get_location()
+z4 = ICalGLib.Timezone.array_element_at(array, 4)
+assert z4.get_location() == zone4.get_location()
-array2 = array.copy();
+array2 = array.copy()
assert array2.size() == 5
-z0 = ICalGLib.Timezone.array_element_at(array2, 0);
-assert(z0.get_location() == zone0.get_location());
-z1 = ICalGLib.Timezone.array_element_at(array2, 1);
-assert(z1.get_location() == zone1.get_location());
-z2 = ICalGLib.Timezone.array_element_at(array2, 2);
-assert(z2.get_location() == zone2.get_location());
-z3 = ICalGLib.Timezone.array_element_at(array2, 3);
-assert(z3.get_location() == zone3.get_location());
-z4 = ICalGLib.Timezone.array_element_at(array2, 4);
-assert(z4.get_location() == zone4.get_location());
+z0 = ICalGLib.Timezone.array_element_at(array2, 0)
+assert z0.get_location() == zone0.get_location()
+z1 = ICalGLib.Timezone.array_element_at(array2, 1)
+assert z1.get_location() == zone1.get_location()
+z2 = ICalGLib.Timezone.array_element_at(array2, 2)
+assert z2.get_location() == zone2.get_location()
+z3 = ICalGLib.Timezone.array_element_at(array2, 3)
+assert z3.get_location() == zone3.get_location()
+z4 = ICalGLib.Timezone.array_element_at(array2, 4)
+assert z4.get_location() == zone4.get_location()
-array.remove_element_at(2);
+array.remove_element_at(2)
assert array.size() == 4
-z0 = ICalGLib.Timezone.array_element_at(array, 0);
-assert(z0.get_location() == zone0.get_location());
-z1 = ICalGLib.Timezone.array_element_at(array, 1);
-assert(z1.get_location() == zone1.get_location());
-z3 = ICalGLib.Timezone.array_element_at(array, 2);
-assert(z3.get_location() == zone3.get_location());
-z4 = ICalGLib.Timezone.array_element_at(array, 3);
-assert(z4.get_location() == zone4.get_location());
+z0 = ICalGLib.Timezone.array_element_at(array, 0)
+assert z0.get_location() == zone0.get_location()
+z1 = ICalGLib.Timezone.array_element_at(array, 1)
+assert z1.get_location() == zone1.get_location()
+z3 = ICalGLib.Timezone.array_element_at(array, 2)
+assert z3.get_location() == zone3.get_location()
+z4 = ICalGLib.Timezone.array_element_at(array, 3)
+assert z4.get_location() == zone4.get_location()
diff --git a/src/test/libical-glib/attach.py b/src/test/libical-glib/attach.py
index 4a5492ac..cf1f5cfd 100755..100644
--- a/src/test/libical-glib/attach.py
+++ b/src/test/libical-glib/attach.py
@@ -1,39 +1,30 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./attach.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./attach.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
+''' Test Python bindings for libical attachments '''
+import gi
gi.require_version('ICalGLib', '3.0')
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
-from gi.repository import ICalGLib
-
-dummy_url = "https://people.gnome.org/~engagement/logos/GnomeLogoVertical.svg";
-dummy_data = "It's a super large attachment";
+dummyUrl = "https://people.gnome.org/~engagement/logos/GnomeLogoVertical.svg"
+dummyData = "It's a super large attachment"
-attach_url = ICalGLib.Attach.new_from_url(dummy_url);
-assert(attach_url.get_is_url() == 1);
+attachUrl = ICalGLib.Attach.new_from_url(dummyUrl)
+assert attachUrl.get_is_url() == 1
-retrieved_url = attach_url.get_url();
-assert(retrieved_url == dummy_url);
+retrievedUrl = attachUrl.get_url()
+assert retrievedUrl == dummyUrl
-attach_data = ICalGLib.Attach.new_from_data(dummy_data, None, None);
-assert(attach_data.get_is_url() == 0);
-retrieved_data = attach_data.get_data();
-assert(retrieved_data == dummy_data);
+attach_data = ICalGLib.Attach.new_from_data(dummyData, None, None)
+assert attach_data.get_is_url() == 0
+retrieved_data = attach_data.get_data()
+assert retrieved_data == dummyData
diff --git a/src/test/libical-glib/component.py b/src/test/libical-glib/component.py
index cc6cfa6a..e16e3d22 100755..100644
--- a/src/test/libical-glib/component.py
+++ b/src/test/libical-glib/component.py
@@ -1,33 +1,23 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./component.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./component.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
-
-gi.require_version('ICalGLib', '3.0')
+# pylint: disable=missing-function-docstring,missing-class-docstring
-from gi.repository import ICalGLib
+''' Test Python bindings for libical components '''
-import os
-import sys
+import gi
+gi.require_version('ICalGLib', '3.0')
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
-event_str1 = \
+eventStr1 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:test1\n" \
@@ -42,7 +32,7 @@ event_str1 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str2 = \
+eventStr2 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:test2\n" \
@@ -57,7 +47,7 @@ event_str2 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str3 = \
+eventStr3 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:test3\n" \
@@ -72,7 +62,7 @@ event_str3 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str4 = \
+eventStr4 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:test4\n" \
@@ -87,7 +77,7 @@ event_str4 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VCALENDAR\n"
-event_str5 = \
+eventStr5 = \
"BEGIN:VCALENDAR\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:test5\n" \
@@ -102,7 +92,7 @@ event_str5 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VCALENDAR\n"
-recurring_str = \
+recurringStr = \
"BEGIN:VEVENT\r\n" \
"UID:recurring\r\n" \
"DTSTAMP:20180403T101443Z\r\n" \
@@ -116,211 +106,221 @@ recurring_str = \
#############################################################
-class TestCounter:
+
+class TestCounter: # pylint: disable=too-few-public-methods
counter = 0
+
def inc(self):
self.counter = self.counter + 1
+
def foreachTZIDCb(param, user_data):
+ del param
user_data.inc()
+
def foreachRecurrenceCb(comp, span, user_data):
+ del comp
+ del span
user_data.inc()
#############################################################
-def main():
- #Test as_ical_string
- comp = ICalGLib.Component.new_from_string(event_str1);
- string = comp.as_ical_string();
-
- #Test new_clone
- clone = comp.clone();
- string1 = clone.as_ical_string();
- assert(string == string1);
- assert(comp.is_valid() == 1);
- assert(comp.isa_component() == 1);
- assert(comp.isa() == ICalGLib.ComponentKind.VEVENT_COMPONENT);
-
- #Test check_restrictions
- assert(comp.check_restrictions() == 0);
-
- #Test count_errors
- assert(comp.count_errors() == 0);
-
- #Test kind_is_valid
- assert(ICalGLib.Component.kind_is_valid(ICalGLib.ComponentKind.VEVENT_COMPONENT) == True);
-
- #Test kind_to_string
- kind_string = ICalGLib.Component.kind_to_string(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- assert(ICalGLib.Component.kind_from_string(kind_string) == ICalGLib.ComponentKind.VEVENT_COMPONENT);
-
- #Test child component manipulation
- parent = ICalGLib.Component.new_from_string(event_str1);
- comp1 = ICalGLib.Component.new_from_string(event_str2);
- comp2 = ICalGLib.Component.new_from_string(event_str3);
- comp3 = ICalGLib.Component.new_from_string(event_str4);
- comp4 = ICalGLib.Component.new_from_string(event_str5);
-
- parent.add_component(comp1);
- parent.add_component(comp2);
- parent.add_component(comp3);
- parent.add_component(comp4);
-
- assert parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT) == 3;
- assert parent.count_components(ICalGLib.ComponentKind.VCALENDAR_COMPONENT) == 1;
-
- #Traverse with internal API.
- count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
+
+def main(): # pylint: disable=too-many-statements,too-many-locals
+ # Test as_ical_string
+ comp = ICalGLib.Component.new_from_string(eventStr1)
+ string = comp.as_ical_string()
+
+ # Test new_clone
+ clone = comp.clone()
+ string1 = clone.as_ical_string()
+ assert string == string1
+ assert comp.is_valid() == 1
+ assert comp.isa_component() == 1
+ assert comp.isa() == ICalGLib.ComponentKind.VEVENT_COMPONENT
+
+ # Test check_restrictions
+ assert comp.check_restrictions() == 0
+
+ # Test count_errors
+ assert comp.count_errors() == 0
+
+ # Test kind_is_valid
+ assert ICalGLib.Component.kind_is_valid(ICalGLib.ComponentKind.VEVENT_COMPONENT) is True
+
+ # Test kind_to_string
+ kindString = ICalGLib.Component.kind_to_string(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ assert ICalGLib.Component.kind_from_string(kindString) == ICalGLib.ComponentKind.VEVENT_COMPONENT
+
+ # Test child component manipulation
+ parent = ICalGLib.Component.new_from_string(eventStr1)
+ comp1 = ICalGLib.Component.new_from_string(eventStr2)
+ comp2 = ICalGLib.Component.new_from_string(eventStr3)
+ comp3 = ICalGLib.Component.new_from_string(eventStr4)
+ comp4 = ICalGLib.Component.new_from_string(eventStr5)
+
+ parent.add_component(comp1)
+ parent.add_component(comp2)
+ parent.add_component(comp3)
+ parent.add_component(comp4)
+
+ assert parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT) == 3
+ assert parent.count_components(ICalGLib.ComponentKind.VCALENDAR_COMPONENT) == 1
+
+ # Traverse with internal API.
+ count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
for i in range(0, count):
prefix = "test"
- index = i+2;
- assert(child_component.get_summary() == prefix + str(index));
- if (i != count-1):
- child_component = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
-
- #Traverse with external API.
- iter = parent.begin_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = iter.deref();
+ index = i + 2
+ assert childComponent.get_summary() == prefix + str(index)
+ if i != count - 1:
+ childComponent = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+
+ # Traverse with external API.
+ iterator = parent.begin_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = iterator.deref()
for i in range(0, count):
prefix = "test"
- index = i+2;
- assert(child_component.get_summary() == prefix + str(index));
- if (i != count-1):
- child_component = iter.next();
+ index = i + 2
+ assert childComponent.get_summary() == prefix + str(index)
+ if i != count - 1:
+ childComponent = iterator.next()
- iter = parent.end_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = iter.prior();
+ iterator = parent.end_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = iterator.prior()
for i in range(0, count):
prefix = "test"
- index = count + 1 - i;
- assert(child_component.get_summary() == prefix + str(index));
- if (i != count - 1):
- child_component = iter.prior();
-
- #Traverse and remove with external API.
- iter = parent.begin_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = iter.deref();
+ index = count + 1 - i
+ assert childComponent.get_summary() == prefix + str(index)
+ if i != count - 1:
+ childComponent = iterator.prior()
+
+ # Traverse and remove with external API.
+ iterator = parent.begin_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = iterator.deref()
for i in range(0, count):
- if (i != count - 1):
- iter.next();
- parent.remove_component(child_component);
- if (i != count - 1):
- child_component = iter.deref();
- assert parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT) == 0;
-
- #Test property mainpulation
- property_string = "SUMMARY:Bastille Day Party";
- string_property = ICalGLib.Property.new_from_string(property_string);
- component = ICalGLib.Component.new(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- component.add_property(string_property);
- assert(component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 1);
- component.remove_property(string_property);
- assert(component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 0);
-
- component.add_property(string_property);
- property_string2 = "SUMMARY:event-uid-123";
- string_property2 = ICalGLib.Property.new_from_string(property_string2);
- component.add_property(string_property2);
- component.add_property(ICalGLib.Property.new_from_string("SUMMARY:20140306T090000"));
- assert(component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 3);
- property1 = component.get_first_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY);
- assert(property1.as_ical_string().split('\n', 1)[0] == "SUMMARY:Bastille Day Party\r");
- property2 = component.get_next_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY);
- assert(property2.as_ical_string().split('\n', 1)[0] == "SUMMARY:event-uid-123\r");
- property3 = component.get_next_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY);
- assert(property3.as_ical_string().split('\n', 1)[0] == "SUMMARY:20140306T090000\r");
-
- #Test getters and setters
- #Test get_dtstart and get_dtend
- comp = ICalGLib.Component.new_from_string(event_str1);
- dtstart = comp.get_dtstart();
- start_string = ICalGLib.Time.as_ical_string(dtstart);
- assert(start_string == "20140306T090000");
- dtend = comp.get_dtend();
- end_string = dtend.as_ical_string();
- assert(end_string == "20140306T093000");
-
- #Test span
- span = comp.get_span();
- assert(span.get_start() == 1394096400);
- assert(span.get_end() == 1394098200);
- assert(span.get_is_busy() == 1);
- utc = ICalGLib.Timezone.get_utc_timezone();
- comp.set_dtstart(ICalGLib.Time.new_from_timet_with_zone(1494096400, 0, utc));
- comp.set_dtend(ICalGLib.Time.new_from_timet_with_zone(1494098200, 0, utc));
- span = comp.get_span();
- assert(span.get_start() == 1494096400);
- assert(span.get_end() == 1494098200);
- assert(span.get_is_busy() == 1);
-
- #Test set_summary/get_summary
- assert(comp.get_summary() == "test1");
- comp.set_summary("newSummary");
- assert(comp.get_summary() == "newSummary");
-
- #Test set_comment/get_comment
- assert(comp.get_comment() == None);
- comp.set_comment("newcomment");
- assert(comp.get_comment() == "newcomment");
-
- #Test set_uid/get_uid
- assert(comp.get_uid() == "event-uid-123");
- comp.set_uid("newuid");
- assert(comp.get_uid() == "newuid");
-
- #Test set_relcalid/get_relcalid
- assert(comp.get_relcalid() == None);
- comp.set_relcalid("newrelcalid");
- assert(comp.get_relcalid() == "newrelcalid");
-
- #Test set_description/get_description
- assert(comp.get_description() == None);
- comp.set_description("newdescription");
- assert(comp.get_description() == "newdescription");
-
- #Test set_location/get_location
- assert(comp.get_location() == "Location");
- comp.set_location("newlocation");
- assert(comp.get_location() == "newlocation");
-
- #Test set_sequence/get_sequence
- assert(comp.get_sequence() == 0);
- comp.set_sequence(5);
- assert(comp.get_sequence() == 5);
-
- #Call comp_foreach_tzid
- comp = ICalGLib.Component.new_from_string(event_str1);
+ if i != count - 1:
+ iterator.next()
+ parent.remove_component(childComponent)
+ if i != count - 1:
+ childComponent = iterator.deref()
+ assert parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT) == 0
+
+ # Test property mainpulation
+ propertyString = "SUMMARY:Bastille Day Party"
+ stringProperty = ICalGLib.Property.new_from_string(propertyString)
+ component = ICalGLib.Component.new(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ component.add_property(stringProperty)
+ assert component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 1
+ component.remove_property(stringProperty)
+ assert component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 0
+
+ component.add_property(stringProperty)
+ propertyString2 = "SUMMARY:event-uid-123"
+ stringProperty2 = ICalGLib.Property.new_from_string(propertyString2)
+ component.add_property(stringProperty2)
+ component.add_property(ICalGLib.Property.new_from_string("SUMMARY:20140306T090000"))
+ assert component.count_properties(ICalGLib.PropertyKind.SUMMARY_PROPERTY) == 3
+ property1 = component.get_first_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY)
+ assert property1.as_ical_string().split('\n', 1)[0] == "SUMMARY:Bastille Day Party\r"
+ property2 = component.get_next_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY)
+ assert property2.as_ical_string().split('\n', 1)[0] == "SUMMARY:event-uid-123\r"
+ property3 = component.get_next_property(ICalGLib.PropertyKind.SUMMARY_PROPERTY)
+ assert property3.as_ical_string().split('\n', 1)[0] == "SUMMARY:20140306T090000\r"
+
+ # Test getters and setters
+ # Test get_dtstart and get_dtend
+ comp = ICalGLib.Component.new_from_string(eventStr1)
+ dtstart = comp.get_dtstart()
+ startString = ICalGLib.Time.as_ical_string(dtstart)
+ assert startString == "20140306T090000"
+ dtend = comp.get_dtend()
+ endString = dtend.as_ical_string()
+ assert endString == "20140306T093000"
+
+ # Test span
+ span = comp.get_span()
+ assert span.get_start() == 1394096400
+ assert span.get_end() == 1394098200
+ assert span.get_is_busy() == 1
+ utc = ICalGLib.Timezone.get_utc_timezone()
+ comp.set_dtstart(ICalGLib.Time.new_from_timet_with_zone(1494096400, 0, utc))
+ comp.set_dtend(ICalGLib.Time.new_from_timet_with_zone(1494098200, 0, utc))
+ span = comp.get_span()
+ assert span.get_start() == 1494096400
+ assert span.get_end() == 1494098200
+ assert span.get_is_busy() == 1
+
+ # Test set_summary/get_summary
+ assert comp.get_summary() == "test1"
+ comp.set_summary("newSummary")
+ assert comp.get_summary() == "newSummary"
+
+ # Test set_comment/get_comment
+ assert comp.get_comment() is None
+ comp.set_comment("newcomment")
+ assert comp.get_comment() == "newcomment"
+
+ # Test set_uid/get_uid
+ assert comp.get_uid() == "event-uid-123"
+ comp.set_uid("newuid")
+ assert comp.get_uid() == "newuid"
+
+ # Test set_relcalid/get_relcalid
+ assert comp.get_relcalid() is None
+ comp.set_relcalid("newrelcalid")
+ assert comp.get_relcalid() == "newrelcalid"
+
+ # Test set_description/get_description
+ assert comp.get_description() is None
+ comp.set_description("newdescription")
+ assert comp.get_description() == "newdescription"
+
+ # Test set_location/get_location
+ assert comp.get_location() == "Location"
+ comp.set_location("newlocation")
+ assert comp.get_location() == "newlocation"
+
+ # Test set_sequence/get_sequence
+ assert comp.get_sequence() == 0
+ comp.set_sequence(5)
+ assert comp.get_sequence() == 5
+
+ # Call comp_foreach_tzid
+ comp = ICalGLib.Component.new_from_string(eventStr1)
counter = TestCounter()
- comp.foreach_tzid(foreachTZIDCb, counter);
+ comp.foreach_tzid(foreachTZIDCb, counter)
assert counter.counter == 2
counter = TestCounter()
- comp = ICalGLib.Component.new_from_string(recurring_str)
- comp.foreach_recurrence(ICalGLib.Time.new_from_string("20180321T000000Z"), ICalGLib.Time.new_from_string("20180323T235959Z"), foreachRecurrenceCb, counter)
+ comp = ICalGLib.Component.new_from_string(recurringStr)
+ comp.foreach_recurrence(ICalGLib.Time.new_from_string("20180321T000000Z"),
+ ICalGLib.Time.new_from_string("20180323T235959Z"), foreachRecurrenceCb, counter)
assert counter.counter == 3
- comp = ICalGLib.Component.new_from_string(event_str1);
+ comp = ICalGLib.Component.new_from_string(eventStr1)
prop = comp.get_first_property(ICalGLib.PropertyKind.DTSTART_PROPERTY)
prop.remove_parameter_by_kind(ICalGLib.ParameterKind.TZID_PARAMETER)
- tz = ICalGLib.Timezone.get_builtin_timezone("Europe/Prague")
+ zone = ICalGLib.Timezone.get_builtin_timezone("Europe/Prague")
- ICalGLib.Timezone.set_tzid_prefix(tz.get_tzid().replace("Europe/Prague", ""))
+ ICalGLib.Timezone.set_tzid_prefix(zone.get_tzid().replace("Europe/Prague", ""))
- prop.set_parameter(ICalGLib.Parameter.new_tzid(tz.get_tzid()))
+ prop.set_parameter(ICalGLib.Parameter.new_tzid(zone.get_tzid()))
itt = prop.get_datetime_with_component(comp)
- assert itt.get_timezone() != None
+ assert itt.get_timezone() is not None
assert itt.get_timezone().get_location() == "Europe/Prague"
itt = prop.get_datetime_with_component(None)
- assert itt.get_timezone() != None
+ assert itt.get_timezone() is not None
assert itt.get_timezone().get_location() == "Europe/Prague"
itt = comp.get_dtstart()
- assert itt.get_timezone() != None
+ assert itt.get_timezone() is not None
assert itt.get_timezone().get_location() == "Europe/Prague"
+
if __name__ == "__main__":
main()
diff --git a/src/test/libical-glib/comprehensive.py b/src/test/libical-glib/comprehensive.py
index ff2804a8..765e10e2 100755..100644
--- a/src/test/libical-glib/comprehensive.py
+++ b/src/test/libical-glib/comprehensive.py
@@ -1,30 +1,21 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./comprehensive.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./comprehensive.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
+''' Comprehensive testing for Python libical bindings '''
+import gi
gi.require_version('ICalGLib', '3.0')
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
-from gi.repository import ICalGLib
-
-event_str1 = \
+eventStr1 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:parent\n" \
@@ -39,7 +30,7 @@ event_str1 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str2 = \
+eventStr2 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:childEvent1\n" \
@@ -54,7 +45,7 @@ event_str2 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str3 = \
+eventStr3 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:childEvent2\n" \
@@ -69,7 +60,7 @@ event_str3 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VEVENT\n"
-event_str4 = \
+eventStr4 = \
"BEGIN:VEVENT\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:childEvent3\n" \
@@ -84,7 +75,7 @@ event_str4 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VCALENDAR\n"
-event_str5 = \
+eventStr5 = \
"BEGIN:VCALENDAR\n" \
"UID:event-uid-123\n" \
"SUMMARY;LANGUAGE=en-US:childCalendar1\n" \
@@ -99,7 +90,7 @@ event_str5 = \
"LOCATION;LANGUAGE=en-US:Location\n" \
"END:VCALENDAR\n"
-combined_string = \
+combinedString = \
"BEGIN:VEVENT\r\n" \
"UID:event-uid-123\r\n" \
"SUMMARY;LANGUAGE=en-US:parent\r\n" \
@@ -166,67 +157,69 @@ combined_string = \
"END:VCALENDAR\r\n" \
"END:VEVENT\r\n"
-def main():
- #Test child component manipulation
- parent = ICalGLib.Component.new_from_string(event_str1);
- comp1 = ICalGLib.Component.new_from_string(event_str2);
- comp2 = ICalGLib.Component.new_from_string(event_str3);
- comp3 = ICalGLib.Component.new_from_string(event_str4);
- comp4 = ICalGLib.Component.new_from_string(event_str5);
- parent.add_component(comp1);
- parent.add_component(comp2);
- parent.add_component(comp3);
- parent.add_component(comp4);
+def main(): # pylint: disable=too-many-locals
+ ''' Test child component manipulation '''
+ parent = ICalGLib.Component.new_from_string(eventStr1)
+ comp1 = ICalGLib.Component.new_from_string(eventStr2)
+ comp2 = ICalGLib.Component.new_from_string(eventStr3)
+ comp3 = ICalGLib.Component.new_from_string(eventStr4)
+ comp4 = ICalGLib.Component.new_from_string(eventStr5)
- assert parent.as_ical_string() == combined_string;
+ parent.add_component(comp1)
+ parent.add_component(comp2)
+ parent.add_component(comp3)
+ parent.add_component(comp4)
- count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
+ assert parent.as_ical_string() == combinedString
+
+ count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
for i in range(0, count):
- if (child_component.get_summary() == "childEvent2"):
- child_component.set_summary("childEventTwo");
+ if childComponent.get_summary() == "childEvent2":
+ childComponent.set_summary("childEventTwo")
- start = ICalGLib.Time.new_from_string("20141115T211923");
- end = ICalGLib.Time.new_from_string("20141115T221923");
- child_component.set_dtstart(start);
- child_component.set_dtend(end);
+ start = ICalGLib.Time.new_from_string("20141115T211923")
+ end = ICalGLib.Time.new_from_string("20141115T221923")
+ childComponent.set_dtstart(start)
+ childComponent.set_dtend(end)
- child_component.set_dtstamp(start);
- child_component.set_location("East Lansing, MI, US");
+ childComponent.set_dtstamp(start)
+ childComponent.set_location("East Lansing, MI, US")
- child_component.set_relcalid("relcalid for childEventTwo");
- recur_string = "RRULE:FREQ=DAILY;INTERVAL=10;COUNT=5";
- property = ICalGLib.Property.new_from_string(recur_string);
- child_component.add_property(property);
- if (i != count-1):
- child_component = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
+ childComponent.set_relcalid("relcalid for childEventTwo")
+ recurString = "RRULE:FREQ=DAILY;INTERVAL=10;COUNT=5"
+ recurProperty = ICalGLib.Property.new_from_string(recurString)
+ childComponent.add_property(recurProperty)
+ if i != count-1:
+ childComponent = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
- modifiedCombinedString = parent.as_ical_string();
- newParent = ICalGLib.Component.new_from_string(modifiedCombinedString);
+ modifiedCombinedString = parent.as_ical_string()
+ ICalGLib.Component.new_from_string(modifiedCombinedString)
- count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT);
- child_component = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
+ count = parent.count_components(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+ childComponent = parent.get_first_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
for i in range(0, count):
- if (child_component.get_summary() == "childEventTwo"):
- child_component.set_summary("childEventTwo");
-
- dtstart = child_component.get_dtstart();
- start_string = ICalGLib.Time.as_ical_string(dtstart);
- assert(start_string == "20141115T211923");
- dtend = child_component.get_dtend();
- end_string = ICalGLib.Time.as_ical_string(dtend);
- assert(end_string == "20141115T221923");
-
- timestamp = child_component.get_dtstamp();
- assert(ICalGLib.Time.as_ical_string(timestamp) == "20141115T211923");
- assert(child_component.get_location() == "East Lansing, MI, US");
- assert(child_component.get_relcalid() == "relcalid for childEventTwo");
-
- recurProperty = child_component.get_first_property(ICalGLib.PropertyKind.RRULE_PROPERTY);
- assert recurProperty.as_ical_string() == "RRULE:FREQ=DAILY;COUNT=5;INTERVAL=10\r\n";
- if (i != count-1):
- child_component = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT);
+ if childComponent.get_summary() == "childEventTwo":
+ childComponent.set_summary("childEventTwo")
+
+ dtstart = childComponent.get_dtstart()
+ startString = ICalGLib.Time.as_ical_string(dtstart)
+ assert startString == "20141115T211923"
+ dtend = childComponent.get_dtend()
+ endString = ICalGLib.Time.as_ical_string(dtend)
+ assert endString == "20141115T221923"
+
+ timestamp = childComponent.get_dtstamp()
+ assert ICalGLib.Time.as_ical_string(timestamp) == "20141115T211923"
+ assert childComponent.get_location() == "East Lansing, MI, US"
+ assert childComponent.get_relcalid() == "relcalid for childEventTwo"
+
+ recurProperty = childComponent.get_first_property(ICalGLib.PropertyKind.RRULE_PROPERTY)
+ assert recurProperty.as_ical_string() == "RRULE:FREQ=DAILY;INTERVAL=10;COUNT=5\r\n"
+ if i != count-1:
+ childComponent = parent.get_next_component(ICalGLib.ComponentKind.VEVENT_COMPONENT)
+
if __name__ == "__main__":
main()
diff --git a/src/test/libical-glib/duration.py b/src/test/libical-glib/duration.py
index 114970ad..76e739d7 100755..100644
--- a/src/test/libical-glib/duration.py
+++ b/src/test/libical-glib/duration.py
@@ -1,42 +1,34 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./duration-type.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./duration-type.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
+''' Test Python bindings for libical duration '''
+import gi
gi.require_version('ICalGLib', '3.0')
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
-from gi.repository import ICalGLib
-length = 1000000000;
-bad_string = "This is a bad string";
+length = 1000000000
+badString = "This is a bad string"
-duration = ICalGLib.Duration.new_from_int(length);
-assert(duration.as_int() == length);
-length_in_string = duration.as_ical_string();
-duration1 = ICalGLib.Duration.new_from_string(length_in_string);
-assert(duration1.as_ical_string() == length_in_string);
-assert(length == duration1.as_int());
+duration = ICalGLib.Duration.new_from_int(length)
+assert duration.as_int() == length
+length_in_string = duration.as_ical_string()
+duration1 = ICalGLib.Duration.new_from_string(length_in_string)
+assert duration1.as_ical_string() == length_in_string
+assert length == duration1.as_int()
-duration = ICalGLib.Duration.new_from_string(bad_string);
-duration_bad = ICalGLib.Duration.new_bad_duration();
-assert(duration.as_ical_string() == duration_bad.as_ical_string());
-assert(duration.is_bad_duration() == 1);
-duration_null = ICalGLib.Duration.new_null_duration();
-assert(duration_null.is_null_duration() == 1);
+duration = ICalGLib.Duration.new_from_string(badString)
+durationBad = ICalGLib.Duration.new_bad_duration()
+assert duration.as_ical_string() == durationBad.as_ical_string()
+assert duration.is_bad_duration() == 1
+duration_null = ICalGLib.Duration.new_null_duration()
+assert duration_null.is_null_duration() == 1
diff --git a/src/test/libical-glib/error.py b/src/test/libical-glib/error.py
index e501a984..a998b01d 100755..100644
--- a/src/test/libical-glib/error.py
+++ b/src/test/libical-glib/error.py
@@ -1,44 +1,35 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./error.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./error.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
+''' Test Python bindings for libical error handling '''
+import gi
gi.require_version('ICalGLib', '3.0')
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
-from gi.repository import ICalGLib
-
-message = "This is a stinky error!";
+message = "This is a stinky error!"
-string_rep = ICalGLib.error_strerror(ICalGLib.ErrorEnum.NEWFAILED_ERROR);
-assert(string_rep == "NEWFAILED: Failed to create a new object via a *_new() routine")
-string_perror = ICalGLib.error_perror();
-assert(string_perror == "NO: No error");
+string_rep = ICalGLib.error_strerror(ICalGLib.ErrorEnum.NEWFAILED_ERROR)
+assert string_rep == "NEWFAILED: Failed to create a new object via a *_new() routine"
+string_perror = ICalGLib.error_perror()
+assert string_perror == "NO: No error"
-ICalGLib.error_set_error_state(ICalGLib.ErrorEnum.NEWFAILED_ERROR, ICalGLib.ErrorState.FATAL);
-state = ICalGLib.error_get_error_state(ICalGLib.ErrorEnum.NEWFAILED_ERROR);
-assert(state == ICalGLib.ErrorState.FATAL);
+ICalGLib.error_set_error_state(ICalGLib.ErrorEnum.NEWFAILED_ERROR, ICalGLib.ErrorState.FATAL)
+state = ICalGLib.error_get_error_state(ICalGLib.ErrorEnum.NEWFAILED_ERROR)
+assert state == ICalGLib.ErrorState.FATAL
-ICalGLib.error_stop_here();
-enumeration = ICalGLib.errno_return();
-string_rep = ICalGLib.error_strerror(enumeration);
-assert(string_rep == "NO: No error");
+ICalGLib.error_stop_here()
+enumeration = ICalGLib.errno_return()
+string_rep = ICalGLib.error_strerror(enumeration)
+assert string_rep == "NO: No error"
-state = ICalGLib.error_supress(message);
-ICalGLib.error_restore(message, state);
+state = ICalGLib.error_supress(message)
+ICalGLib.error_restore(message, state)
diff --git a/src/test/libical-glib/misc.py b/src/test/libical-glib/misc.py
index d10648b8..8bfc2072 100755..100644
--- a/src/test/libical-glib/misc.py
+++ b/src/test/libical-glib/misc.py
@@ -1,28 +1,19 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./misc.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./misc.py
###############################################################################
#
-# Copyright (C) 2019 Red Hat Inc. <www.redhat.com>
+# SPDX-FileCopyrightText: 2019 Red Hat Inc. <www.redhat.com>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
+''' Test Python bindings for libical miscellaneous types '''
+import gi
gi.require_version('ICalGLib', '3.0')
-
-from gi.repository import ICalGLib
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
geo = ICalGLib.Geo.new(10.0, 20.0)
assert geo.get_lat() == 10.0
@@ -31,21 +22,21 @@ geo_clone = geo.clone()
assert geo.get_lat() == geo_clone.get_lat()
assert geo.get_lon() == geo_clone.get_lon()
geo_clone.set_lat(30.0)
-geo_clone.set_lon(40.0);
+geo_clone.set_lon(40.0)
assert geo_clone.get_lat() == 30.0
assert geo_clone.get_lon() == 40.0
assert geo.get_lat() != geo_clone.get_lat()
assert geo.get_lon() != geo_clone.get_lon()
-start = ICalGLib.Time.new_from_string("20190130T111213Z");
+start = ICalGLib.Time.new_from_string("20190130T111213Z")
end = ICalGLib.Time.new_from_string("20190203T100908Z")
-span = ICalGLib.TimeSpan.new(start, end, 0);
+span = ICalGLib.TimeSpan.new(start, end, 0)
assert span.get_start() == start.as_timet()
assert span.get_end() == end.as_timet()
assert span.get_is_busy() == 0
-start = ICalGLib.Time.new_from_string("20190330T131415Z");
+start = ICalGLib.Time.new_from_string("20190330T131415Z")
end = ICalGLib.Time.new_from_string("20190403T070605Z")
-span = ICalGLib.TimeSpan.new(start, end, 1);
+span = ICalGLib.TimeSpan.new(start, end, 1)
assert span.get_start() == start.as_timet()
assert span.get_end() == end.as_timet()
assert span.get_is_busy() == 1
diff --git a/src/test/libical-glib/parameter.py b/src/test/libical-glib/parameter.py
index 5a0c6230..17f2aa06 100755..100644
--- a/src/test/libical-glib/parameter.py
+++ b/src/test/libical-glib/parameter.py
@@ -1,72 +1,63 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./parameter.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./parameter.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
+''' Test Python bindings for Libical parameter '''
+import gi
gi.require_version('ICalGLib', '3.0')
-
-from gi.repository import ICalGLib
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
# Test interaction with gchar
-altrep = "This is an altrep";
-parameter = ICalGLib.Parameter.new_altrep(altrep);
-retrieved_altrep = parameter.get_altrep();
-assert(retrieved_altrep == altrep);
-another_altrep = "This is an another altrep";
-parameter.set_altrep(another_altrep);
-retrieved_altrep = parameter.get_altrep();
-assert(retrieved_altrep == another_altrep);
+altrep = "This is an altrep"
+parameter = ICalGLib.Parameter.new_altrep(altrep)
+retrievedAltrep = parameter.get_altrep()
+assert retrievedAltrep == altrep
+anotherAltrep = "This is an another altrep"
+parameter.set_altrep(anotherAltrep)
+retrievedAltrep = parameter.get_altrep()
+assert retrievedAltrep == anotherAltrep
# Test interaction with enum
-action = ICalGLib.ParameterAction.X;
-parameter = ICalGLib.Parameter.new_actionparam(action);
-retrieved_action = parameter.get_actionparam();
-assert(retrieved_action == action);
-action = ICalGLib.ParameterAction.ASK;
-parameter.set_actionparam(action);
-retrieved_action = parameter.get_actionparam();
-assert(retrieved_action == action);
+action = ICalGLib.ParameterAction.X
+parameter = ICalGLib.Parameter.new_actionparam(action)
+retrievedAction = parameter.get_actionparam()
+assert retrievedAction == action
+action = ICalGLib.ParameterAction.ASK
+parameter.set_actionparam(action)
+retrievedAction = parameter.get_actionparam()
+assert retrievedAction == action
# Test general utilities
-kind = ICalGLib.ParameterKind.ACTIONPARAM_PARAMETER;
-parameter = ICalGLib.Parameter.new(kind);
-assert(parameter.isa() == kind);
-assert(parameter.isa_parameter() == 1);
-string = parameter.as_ical_string();
-assert(string == None);
-clone = parameter.clone();
-assert(clone.isa() == kind);
-assert(clone.isa_parameter() == 1);
-string = clone.as_ical_string();
-assert(string == None);
-
-string = ICalGLib.Parameter.kind_to_string(kind);
-assert(string == "ACTIONPARAM");
-assert(ICalGLib.Parameter.kind_from_string(string) == kind);
-
-value = "This is a value";
-typevalue = string + "=" + value;
-parameter = ICalGLib.Parameter.new_from_string(typevalue);
-assert(parameter.as_ical_string() == typevalue);
-assert(parameter.isa() == kind);
-assert(parameter.isa_parameter() == 1);
-
-another_parameter = ICalGLib.Parameter.new_from_value_string(kind, value);
-assert(another_parameter.as_ical_string() == typevalue);
+kind = ICalGLib.ParameterKind.ACTIONPARAM_PARAMETER
+parameter = ICalGLib.Parameter.new(kind)
+assert parameter.isa() == kind
+assert parameter.isa_parameter() == 1
+string = parameter.as_ical_string()
+assert string is None
+clone = parameter.clone()
+assert clone.isa() == kind
+assert clone.isa_parameter() == 1
+string = clone.as_ical_string()
+assert string is None
+
+string = ICalGLib.Parameter.kind_to_string(kind)
+assert string == "ACTIONPARAM"
+assert ICalGLib.Parameter.kind_from_string(string) == kind
+
+value = "This is a value"
+typevalue = string + "=" + value
+parameter = ICalGLib.Parameter.new_from_string(typevalue)
+assert parameter.as_ical_string() == typevalue
+assert parameter.isa() == kind
+assert parameter.isa_parameter() == 1
+
+anotherParameter = ICalGLib.Parameter.new_from_value_string(kind, value)
+assert anotherParameter.as_ical_string() == typevalue
diff --git a/src/test/libical-glib/period.py b/src/test/libical-glib/period.py
index bcc49706..92b54012 100755..100644
--- a/src/test/libical-glib/period.py
+++ b/src/test/libical-glib/period.py
@@ -1,81 +1,72 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./period-type.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./period-type.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
+''' Test Python bindings for libical period '''
+import gi
gi.require_version('ICalGLib', '3.0')
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
-from gi.repository import ICalGLib
-
-string = "19970101T183248Z/19970102T071625Z";
+string = "19970101T183248Z/19970102T071625Z"
-period = ICalGLib.Period.new_from_string(string);
-retrieved_string = period.as_ical_string();
-assert(retrieved_string == string);
+period = ICalGLib.Period.new_from_string(string)
+retrievedString = period.as_ical_string()
+assert retrievedString == string
-null_period = ICalGLib.Period.new_null_period();
-assert(null_period.is_null_period() == 1);
-assert(period.is_null_period() == 0);
+nullPeriod = ICalGLib.Period.new_null_period()
+assert nullPeriod.is_null_period() == 1
+assert period.is_null_period() == 0
-assert(null_period.is_valid_period() == 1);
-assert(period.is_valid_period() == 1);
+assert nullPeriod.is_valid_period() == 1
+assert period.is_valid_period() == 1
-start = period.get_start();
-assert(start.get_year() == 1997);
-assert(start.get_month() == 1);
-assert(start.get_day() == 1);
-assert(start.get_hour() == 18);
-assert(start.get_minute() == 32);
-assert(start.get_second() == 48);
+start = period.get_start()
+assert start.get_year() == 1997
+assert start.get_month() == 1
+assert start.get_day() == 1
+assert start.get_hour() == 18
+assert start.get_minute() == 32
+assert start.get_second() == 48
-end = period.get_end();
-assert(end.get_year() == 1997);
-assert(end.get_month() == 1);
-assert(end.get_day() == 2);
-assert(end.get_hour() == 7);
-assert(end.get_minute() == 16);
-assert(end.get_second() == 25);
+end = period.get_end()
+assert end.get_year() == 1997
+assert end.get_month() == 1
+assert end.get_day() == 2
+assert end.get_hour() == 7
+assert end.get_minute() == 16
+assert end.get_second() == 25
-duration = period.get_duration();
-assert(duration.as_int() == 0);
+duration = period.get_duration()
+assert duration.as_int() == 0
-string = "19970101T182346Z/PT5H30M";
-period = ICalGLib.Period.new_from_string(string);
-retrieved_string = period.as_ical_string();
-assert(retrieved_string == string);
+string = "19970101T182346Z/PT5H30M"
+period = ICalGLib.Period.new_from_string(string)
+retrieved_string = period.as_ical_string()
+assert retrieved_string == string
-start = period.get_start();
-assert(start.get_year() == 1997);
-assert(start.get_month() == 1);
-assert(start.get_day() == 1);
-assert(start.get_hour() == 18);
-assert(start.get_minute() == 23);
-assert(start.get_second() == 46);
+start = period.get_start()
+assert start.get_year() == 1997
+assert start.get_month() == 1
+assert start.get_day() == 1
+assert start.get_hour() == 18
+assert start.get_minute() == 23
+assert start.get_second() == 46
-end = period.get_end();
-assert(end.get_year() == 0);
-assert(end.get_month() == 0);
-assert(end.get_day() == 0);
-assert(end.get_hour() == 0);
-assert(end.get_minute() == 0);
-assert(end.get_second() == 0);
+end = period.get_end()
+assert end.get_year() == 0
+assert end.get_month() == 0
+assert end.get_day() == 0
+assert end.get_hour() == 0
+assert end.get_minute() == 0
+assert end.get_second() == 0
-duration = period.get_duration();
-assert(duration.as_ical_string() == "PT5H30M");
+duration = period.get_duration()
+assert duration.as_ical_string() == "PT5H30M"
diff --git a/src/test/libical-glib/property.py b/src/test/libical-glib/property.py
index 23de9b5d..dad268a4 100755..100644
--- a/src/test/libical-glib/property.py
+++ b/src/test/libical-glib/property.py
@@ -1,104 +1,95 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./property.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./property.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
+''' Test Python bindings for libical properties '''
+import gi
gi.require_version('ICalGLib', '3.0')
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
+
+actionProperty = ICalGLib.Property.new(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY)
+actionPropertyClone = actionProperty.clone()
+assert actionPropertyClone.as_ical_string() == actionProperty.as_ical_string()
+
+propertyString = "SUMMARY:Bastille Day Party"
+stringProperty = ICalGLib.Property.new_from_string(propertyString)
+stringPropertyClone = stringProperty.clone()
+assert stringProperty.as_ical_string() == stringPropertyClone.as_ical_string()
+assert stringProperty.isa() == ICalGLib.PropertyKind.SUMMARY_PROPERTY
+assert stringProperty.isa_property() == 1
+assert stringProperty.get_property_name() == "SUMMARY"
+
+altrep1 = "This is an altrep 1"
+parameter1 = ICalGLib.Parameter.new_altrep(altrep1)
+altrep2 = "This is an altrep 2"
+parameter2 = ICalGLib.Parameter.new_altrep(altrep2)
+stringProperty.add_parameter(parameter1)
+stringProperty.add_parameter(parameter2)
+stringProperty.set_parameter_from_string("ACTIONPARAM", "This is a action param")
+
+assert stringProperty.count_parameters() == 3
+retrieved_parameter1 = stringProperty.get_first_parameter(ICalGLib.ParameterKind.ALTREP_PARAMETER)
+assert retrieved_parameter1.as_ical_string() == parameter1.as_ical_string()
+retrieved_parameter2 = stringProperty.get_next_parameter(ICalGLib.ParameterKind.ALTREP_PARAMETER)
+assert retrieved_parameter2.as_ical_string() == parameter2.as_ical_string()
+retrieved_parameter3 = stringProperty.get_first_parameter(ICalGLib.ParameterKind.ACTIONPARAM_PARAMETER)
+assert retrieved_parameter3.as_ical_string() == "ACTIONPARAM=This is a action param"
+
+stringProperty.remove_parameter_by_kind(ICalGLib.ParameterKind.CHARSET_PARAMETER)
+assert stringProperty.count_parameters() == 3
+stringProperty.remove_parameter_by_kind(ICalGLib.ParameterKind.ALTREP_PARAMETER)
+assert stringProperty.count_parameters() == 2
+stringProperty.remove_parameter_by_name("ACTIONPARAM")
+assert stringProperty.count_parameters() == 1
-from gi.repository import ICalGLib
-
-action_property = ICalGLib.Property.new(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY);
-action_property_clone = action_property.clone();
-assert(action_property_clone.as_ical_string() == action_property.as_ical_string());
-
-property_string = "SUMMARY:Bastille Day Party";
-string_property = ICalGLib.Property.new_from_string(property_string);
-string_property_clone = string_property.clone();
-assert(string_property.as_ical_string() == string_property_clone.as_ical_string());
-assert(string_property.isa() == ICalGLib.PropertyKind.SUMMARY_PROPERTY);
-assert(string_property.isa_property() == 1);
-assert(string_property.get_property_name() == "SUMMARY");
-
-altrep1 = "This is an altrep 1";
-parameter1 = ICalGLib.Parameter.new_altrep(altrep1);
-altrep2 = "This is an altrep 2";
-parameter2 = ICalGLib.Parameter.new_altrep(altrep2);
-string_property.add_parameter(parameter1);
-string_property.add_parameter(parameter2);
-string_property.set_parameter_from_string("ACTIONPARAM", "This is a action param");
-
-assert(string_property.count_parameters() == 3);
-retrieved_parameter1 = string_property.get_first_parameter(ICalGLib.ParameterKind.ALTREP_PARAMETER);
-assert(retrieved_parameter1.as_ical_string() == parameter1.as_ical_string());
-retrieved_parameter2 = string_property.get_next_parameter(ICalGLib.ParameterKind.ALTREP_PARAMETER);
-assert(retrieved_parameter2.as_ical_string() == parameter2.as_ical_string());
-retrieved_parameter3 = string_property.get_first_parameter(ICalGLib.ParameterKind.ACTIONPARAM_PARAMETER);
-assert(retrieved_parameter3.as_ical_string() == "ACTIONPARAM=This is a action param");
-
-string_property.remove_parameter_by_kind(ICalGLib.ParameterKind.CHARSET_PARAMETER);
-assert(string_property.count_parameters() == 3);
-string_property.remove_parameter_by_kind(ICalGLib.ParameterKind.ALTREP_PARAMETER);
-assert(string_property.count_parameters() == 2);
-string_property.remove_parameter_by_name("ACTIONPARAM");
-assert(string_property.count_parameters() == 1);
-
-kind = ICalGLib.ValueKind.ATTACH_VALUE;
-string = "This is a link";
-value_from_string = ICalGLib.Value.new_from_string(kind, string);
-string_property.set_value(value_from_string);
-string_from_property_api = string_property.get_value_as_string();
-assert(string_from_property_api == string);
-value_got_from_property = string_property.get_value();
-assert(value_got_from_property.as_ical_string() == string);
-string_property.set_value_from_string(string, ICalGLib.Value.kind_to_string(kind));
-string_from_property_api = string_property.get_value_as_string();
-assert(string_from_property_api == string);
-value_got_from_property = string_property.get_value();
-assert(value_got_from_property.as_ical_string() == string);
-
-string_property.set_x_name("This is an x name!");
-assert(string_property.get_x_name() == "This is an x name!");
-
-valuekind_from_parametervalue = ICalGLib.Parameter.value_to_value_kind(ICalGLib.ParameterValue.BINARY);
-assert(valuekind_from_parametervalue == ICalGLib.ValueKind.BINARY_VALUE);
-
-valuekind_from_property_kind = ICalGLib.Property.kind_to_value_kind(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY);
-assert(valuekind_from_property_kind == ICalGLib.ValueKind.DATETIME_VALUE);
-propertyKind = ICalGLib.Value.kind_to_property_kind(valuekind_from_property_kind);
-assert(propertyKind == ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY);
-string = ICalGLib.Property.kind_to_string(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY);
-assert(string == "ACKNOWLEDGED");
-kind = ICalGLib.Property.kind_from_string(string);
-assert(kind == ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY);
-
-string = ICalGLib.Property.method_to_string(ICalGLib.PropertyMethod.PUBLISH);
-assert(ICalGLib.Property.method_from_string(string) == ICalGLib.PropertyMethod.PUBLISH);
-
-string = ICalGLib.Property.enum_to_string(ICalGLib.PropertyMethod.PUBLISH);
-assert(string == "PUBLISH");
-
-#Test i_cal_value_set_parent. No error will be thrown.
-property_string = "SUMMARY:Bastille Day Party";
-string_property = ICalGLib.Property.new_from_string(property_string);
kind = ICalGLib.ValueKind.ATTACH_VALUE
string = "This is a link"
value_from_string = ICalGLib.Value.new_from_string(kind, string)
-value_from_string.set_parent(string_property)
+stringProperty.set_value(value_from_string)
+string_from_property_api = stringProperty.get_value_as_string()
+assert string_from_property_api == string
+value_got_from_property = stringProperty.get_value()
+assert value_got_from_property.as_ical_string() == string
+stringProperty.set_value_from_string(string, ICalGLib.Value.kind_to_string(kind))
+string_from_property_api = stringProperty.get_value_as_string()
+assert string_from_property_api == string
+value_got_from_property = stringProperty.get_value()
+assert value_got_from_property.as_ical_string() == string
+
+stringProperty.set_x_name("This is an x name!")
+assert stringProperty.get_x_name() == "This is an x name!"
+
+valuekind_from_parametervalue = ICalGLib.Parameter.value_to_value_kind(ICalGLib.ParameterValue.BINARY)
+assert valuekind_from_parametervalue == ICalGLib.ValueKind.BINARY_VALUE
+
+valuekind_from_property_kind = ICalGLib.Property.kind_to_value_kind(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY)
+assert valuekind_from_property_kind == ICalGLib.ValueKind.DATETIME_VALUE
+propertyKind = ICalGLib.Value.kind_to_property_kind(valuekind_from_property_kind)
+assert propertyKind == ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY
+string = ICalGLib.Property.kind_to_string(ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY)
+assert string == "ACKNOWLEDGED"
+kind = ICalGLib.Property.kind_from_string(string)
+assert kind == ICalGLib.PropertyKind.ACKNOWLEDGED_PROPERTY
+
+string = ICalGLib.Property.method_to_string(ICalGLib.PropertyMethod.PUBLISH)
+assert ICalGLib.Property.method_from_string(string) == ICalGLib.PropertyMethod.PUBLISH
+
+string = ICalGLib.Property.enum_to_string(ICalGLib.PropertyMethod.PUBLISH)
+assert string == "PUBLISH"
+
+# Test i_cal_value_set_parent. No error will be thrown.
+propertyString = "SUMMARY:Bastille Day Party"
+stringProperty = ICalGLib.Property.new_from_string(propertyString)
+kind = ICalGLib.ValueKind.ATTACH_VALUE
+string = "This is a link"
+value_from_string = ICalGLib.Value.new_from_string(kind, string)
+value_from_string.set_parent(stringProperty)
value_from_string.set_parent(None)
diff --git a/src/test/libical-glib/recurrence.py b/src/test/libical-glib/recurrence.py
index e4320df0..1d8a121f 100755..100644
--- a/src/test/libical-glib/recurrence.py
+++ b/src/test/libical-glib/recurrence.py
@@ -1,66 +1,52 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./recurrence-type.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./recurrence-type.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
+''' Test Python bindings for libical recurrence '''
+import gi
gi.require_version('ICalGLib', '3.0')
-
-from gi.repository import ICalGLib
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
weekday = ICalGLib.Recurrence.day_day_of_week(0)
-assert(weekday == ICalGLib.RecurrenceWeekday.NO_WEEKDAY)
+assert weekday == ICalGLib.RecurrenceWeekday.NO_WEEKDAY
weekday = ICalGLib.Recurrence.day_day_of_week(1)
-assert(weekday == ICalGLib.RecurrenceWeekday.SUNDAY_WEEKDAY)
+assert weekday == ICalGLib.RecurrenceWeekday.SUNDAY_WEEKDAY
+
+assert ICalGLib.Recurrence.day_position(15) == 1
+assert ICalGLib.Recurrence.day_position(16) == 2
+assert ICalGLib.Recurrence.day_position(25) == 3
+
+encoded = ICalGLib.Recurrence.encode_day(ICalGLib.RecurrenceWeekday.MONDAY_WEEKDAY, 0)
+assert ICalGLib.Recurrence.day_day_of_week(encoded) == ICalGLib.RecurrenceWeekday.MONDAY_WEEKDAY
+assert ICalGLib.Recurrence.day_position(encoded) == 0
+
+encoded = ICalGLib.Recurrence.encode_day(ICalGLib.RecurrenceWeekday.THURSDAY_WEEKDAY, -3)
+assert ICalGLib.Recurrence.day_day_of_week(encoded) == ICalGLib.RecurrenceWeekday.THURSDAY_WEEKDAY
+assert ICalGLib.Recurrence.day_position(encoded) == -3
+
+encoded = ICalGLib.Recurrence.encode_day(ICalGLib.RecurrenceWeekday.FRIDAY_WEEKDAY, 2)
+assert ICalGLib.Recurrence.day_day_of_week(encoded) == ICalGLib.RecurrenceWeekday.FRIDAY_WEEKDAY
+assert ICalGLib.Recurrence.day_position(encoded) == 2
+
+encoded = ICalGLib.Recurrence.encode_month(3, 0)
+assert ICalGLib.Recurrence.month_month(encoded) == 3
+assert not ICalGLib.Recurrence.month_is_leap(encoded)
-assert(ICalGLib.Recurrence.day_position(15) == 1)
-assert(ICalGLib.Recurrence.day_position(16) == 2)
-assert(ICalGLib.Recurrence.day_position(25) == 3)
+encoded = ICalGLib.Recurrence.encode_month(12, 1)
+assert ICalGLib.Recurrence.month_month(encoded) == 12
+assert ICalGLib.Recurrence.month_is_leap(encoded)
string = "COUNT=10;FREQ=DAILY"
recurrence = ICalGLib.Recurrence.new_from_string(string)
-assert(recurrence.to_string() == "FREQ=DAILY;COUNT=10")
-
-by_second = recurrence.get_by_second_array()
-# The value is dependent on the libical version.
-assert len(by_second) == 61 or len(by_second) == 62
-by_minute = recurrence.get_by_minute_array()
-assert len(by_minute) == 61
-by_hour = recurrence.get_by_hour_array()
-assert len(by_hour) == 25
-by_day = recurrence.get_by_day_array()
-# The value is dependent on the libical version.
-assert len(by_day) == 364 or len(by_day) == 386
-by_month_day = recurrence.get_by_month_day_array()
-assert len(by_month_day) == 32
-by_year_day = recurrence.get_by_year_day_array()
-# The value is dependent on the libical version.
-assert len(by_year_day) == 367 or len(by_year_day) == 386
-by_week_no = recurrence.get_by_week_no_array()
-# The value is dependent on the libical version.
-assert len(by_week_no) == 54 or len(by_week_no) == 56
-by_month = recurrence.get_by_month_array()
-# The value is dependent on the libical version.
-assert len(by_month) == 13 or len(by_month) == 14
-by_set_pos = recurrence.get_by_set_pos_array()
-# The value is dependent on the libical version.
-assert len(by_set_pos) == 367 or len(by_set_pos) == 386
+assert recurrence.to_string() == "FREQ=DAILY;COUNT=10"
recurrence.set_by_second(0, 1)
recurrence.set_by_second(1, ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX)
@@ -68,8 +54,8 @@ assert recurrence.get_by_second(0) == 1
assert recurrence.get_by_second(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
array = recurrence.get_by_second_array()
assert array[0] == 1
-assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 100, 101 ]
+assert len(array) == 1
+array = [100, 101]
assert len(array) == 2
recurrence.set_by_second_array(array)
assert recurrence.get_by_second(0) == 100
@@ -78,7 +64,7 @@ assert recurrence.get_by_second(2) == ICalGLib.RecurrenceArrayMaxValues.RECURREN
array = recurrence.get_by_second_array()
assert array[0] == 100
assert array[1] == 101
-assert array[2] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
+assert len(array) == 2
recurrence.set_by_minute(0, 2)
recurrence.set_by_minute(1, ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX)
@@ -86,8 +72,8 @@ assert recurrence.get_by_minute(0) == 2
assert recurrence.get_by_minute(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
array = recurrence.get_by_minute_array()
assert array[0] == 2
-assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 200, 201 ]
+assert len(array) == 1
+array = [200, 201]
assert len(array) == 2
recurrence.set_by_minute_array(array)
assert recurrence.get_by_minute(0) == 200
@@ -96,7 +82,7 @@ assert recurrence.get_by_minute(2) == ICalGLib.RecurrenceArrayMaxValues.RECURREN
array = recurrence.get_by_minute_array()
assert array[0] == 200
assert array[1] == 201
-assert array[2] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
+assert len(array) == 2
recurrence.set_by_hour(0, 3)
recurrence.set_by_hour(1, ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX)
@@ -104,8 +90,8 @@ assert recurrence.get_by_hour(0) == 3
assert recurrence.get_by_hour(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
array = recurrence.get_by_hour_array()
assert array[0] == 3
-assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 300, 301 ]
+assert len(array) == 1
+array = [300, 301]
assert len(array) == 2
recurrence.set_by_hour_array(array)
assert recurrence.get_by_hour(0) == 300
@@ -114,7 +100,7 @@ assert recurrence.get_by_hour(2) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE
array = recurrence.get_by_hour_array()
assert array[0] == 300
assert array[1] == 301
-assert array[2] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
+assert len(array) == 2
recurrence.set_by_day(0, 4)
recurrence.set_by_day(1, ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX)
@@ -122,8 +108,8 @@ assert recurrence.get_by_day(0) == 4
assert recurrence.get_by_day(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
array = recurrence.get_by_day_array()
assert array[0] == 4
-assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 400, 401 ]
+assert len(array) == 1
+array = [400, 401]
assert len(array) == 2
recurrence.set_by_day_array(array)
assert recurrence.get_by_day(0) == 400
@@ -132,7 +118,7 @@ assert recurrence.get_by_day(2) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_
array = recurrence.get_by_day_array()
assert array[0] == 400
assert array[1] == 401
-assert array[2] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
+assert len(array) == 2
recurrence.set_by_month_day(0, 5)
recurrence.set_by_month_day(1, ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX)
@@ -140,8 +126,8 @@ assert recurrence.get_by_month_day(0) == 5
assert recurrence.get_by_month_day(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
array = recurrence.get_by_month_day_array()
assert array[0] == 5
-assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 500, 501 ]
+assert len(array) == 1
+array = [500, 501]
assert len(array) == 2
recurrence.set_by_month_day_array(array)
assert recurrence.get_by_month_day(0) == 500
@@ -150,7 +136,7 @@ assert recurrence.get_by_month_day(2) == ICalGLib.RecurrenceArrayMaxValues.RECUR
array = recurrence.get_by_month_day_array()
assert array[0] == 500
assert array[1] == 501
-assert array[2] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
+assert len(array) == 2
recurrence.set_by_year_day(0, 6)
recurrence.set_by_year_day(1, ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX)
@@ -158,8 +144,8 @@ assert recurrence.get_by_year_day(0) == 6
assert recurrence.get_by_year_day(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
array = recurrence.get_by_year_day_array()
assert array[0] == 6
-assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 600, 601 ]
+assert len(array) == 1
+array = [600, 601]
assert len(array) == 2
recurrence.set_by_year_day_array(array)
assert recurrence.get_by_year_day(0) == 600
@@ -168,7 +154,7 @@ assert recurrence.get_by_year_day(2) == ICalGLib.RecurrenceArrayMaxValues.RECURR
array = recurrence.get_by_year_day_array()
assert array[0] == 600
assert array[1] == 601
-assert array[2] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
+assert len(array) == 2
recurrence.set_by_week_no(0, 7)
recurrence.set_by_week_no(1, ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX)
@@ -176,8 +162,8 @@ assert recurrence.get_by_week_no(0) == 7
assert recurrence.get_by_week_no(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
array = recurrence.get_by_week_no_array()
assert array[0] == 7
-assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 700, 701 ]
+assert len(array) == 1
+array = [700, 701]
assert len(array) == 2
recurrence.set_by_week_no_array(array)
assert recurrence.get_by_week_no(0) == 700
@@ -186,7 +172,7 @@ assert recurrence.get_by_week_no(2) == ICalGLib.RecurrenceArrayMaxValues.RECURRE
array = recurrence.get_by_week_no_array()
assert array[0] == 700
assert array[1] == 701
-assert array[2] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
+assert len(array) == 2
recurrence.set_by_month(0, 8)
recurrence.set_by_month(1, ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX)
@@ -194,8 +180,8 @@ assert recurrence.get_by_month(0) == 8
assert recurrence.get_by_month(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
array = recurrence.get_by_month_array()
assert array[0] == 8
-assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 800, 801 ]
+assert len(array) == 1
+array = [800, 801]
assert len(array) == 2
recurrence.set_by_month_array(array)
assert recurrence.get_by_month(0) == 800
@@ -204,7 +190,7 @@ assert recurrence.get_by_month(2) == ICalGLib.RecurrenceArrayMaxValues.RECURRENC
array = recurrence.get_by_month_array()
assert array[0] == 800
assert array[1] == 801
-assert array[2] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
+assert len(array) == 2
recurrence.set_by_set_pos(0, 9)
recurrence.set_by_set_pos(1, ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX)
@@ -212,8 +198,8 @@ assert recurrence.get_by_set_pos(0) == 9
assert recurrence.get_by_set_pos(1) == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
array = recurrence.get_by_set_pos_array()
assert array[0] == 9
-assert array[1] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
-array = [ 900, 901 ]
+assert len(array) == 1
+array = [900, 901]
assert len(array) == 2
recurrence.set_by_set_pos_array(array)
assert recurrence.get_by_set_pos(0) == 900
@@ -222,7 +208,7 @@ assert recurrence.get_by_set_pos(2) == ICalGLib.RecurrenceArrayMaxValues.RECURRE
array = recurrence.get_by_set_pos_array()
assert array[0] == 900
assert array[1] == 901
-assert array[2] == ICalGLib.RecurrenceArrayMaxValues.RECURRENCE_ARRAY_MAX
+assert len(array) == 2
recurrence.set_by_second(0, 13)
by_second = recurrence.get_by_second_array()
@@ -230,49 +216,49 @@ assert by_second[0] == 13
recurrence = ICalGLib.Recurrence.new_from_string(string)
-assert(ICalGLib.Recurrence.weekday_from_string("MO") == ICalGLib.RecurrenceWeekday.MONDAY_WEEKDAY)
+assert ICalGLib.Recurrence.weekday_from_string("MO") == ICalGLib.RecurrenceWeekday.MONDAY_WEEKDAY
start = 100000
result = ICalGLib.recur_expand_recurrence(string, start, 10)
-secs_per_day = 24*60*60
+secsPerDay = 24*60*60
for i in range(0, 9):
- assert(result[i] == start + i*secs_per_day)
+ assert result[i] == start + i*secsPerDay
string = "19970101T183248Z/19970102T071625Z"
period = ICalGLib.Period.new_from_string(string)
start = period.get_start()
-iter = ICalGLib.RecurIterator.new(recurrence, start)
-timetype = iter.next()
+iterator = ICalGLib.RecurIterator.new(recurrence, start)
+timetype = iterator.next()
day = timetype.get_day()
ref = 1
while day != 0:
- assert(day == ref)
+ assert day == ref
ref += 1
- timetype = iter.next()
+ timetype = iterator.next()
day = timetype.get_day()
recurrence = ICalGLib.Recurrence.new_from_string("FREQ=YEARLY;COUNT=10")
start = ICalGLib.Time.new_from_string("20161224T000000Z")
-iter = ICalGLib.RecurIterator.new(recurrence, start)
+iterator = ICalGLib.RecurIterator.new(recurrence, start)
start = ICalGLib.Time.new_from_string("20181224T000000Z")
-assert ICalGLib.RecurIterator.set_start(iter, start) == 0
+assert ICalGLib.RecurIterator.set_start(iterator, start) == 0
recurrence = ICalGLib.Recurrence.new_from_string("FREQ=YEARLY")
start = ICalGLib.Time.new_from_string("20161224T000000Z")
-iter = ICalGLib.RecurIterator.new(recurrence, start)
+iterator = ICalGLib.RecurIterator.new(recurrence, start)
start = ICalGLib.Time.new_from_string("20181224T000000Z")
-assert ICalGLib.RecurIterator.set_start(iter, start) == 1
-timetype = iter.next()
+assert ICalGLib.RecurIterator.set_start(iterator, start) == 1
+timetype = iterator.next()
assert timetype.get_year() == 2018
-timetype = iter.next()
+timetype = iterator.next()
assert timetype.get_year() == 2019
diff --git a/src/test/libical-glib/timezone.py b/src/test/libical-glib/timezone.py
index ec027a1b..2d3a7bac 100755..100644
--- a/src/test/libical-glib/timezone.py
+++ b/src/test/libical-glib/timezone.py
@@ -1,31 +1,22 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./timezone.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./timezone.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
-
-gi.require_version('ICalGLib', '3.0')
-
-from gi.repository import ICalGLib
+''' Test Python bindings for libical timezone '''
-import os
import sys
+import os
+
+import gi
+gi.require_version('ICalGLib', '3.0')
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
try:
zoneinfodir = os.environ['ZONEINFO_DIRECTORY']
@@ -35,70 +26,70 @@ except KeyError:
if not os.path.isdir(zoneinfodir):
print("Error: The ZONEINFO_DIRECTORY environment variable isn't properly set")
sys.exit(1)
-ICalGLib.Timezone.set_zone_directory(zoneinfodir);
-ICalGLib.Timezone.set_tzid_prefix("/citadel.org/");
+ICalGLib.Timezone.set_zone_directory(zoneinfodir)
+ICalGLib.Timezone.set_tzid_prefix("/citadel.org/")
-la = ICalGLib.Timezone.get_builtin_timezone("America/Los_Angeles");
-chicago = ICalGLib.Timezone.get_builtin_timezone("America/Chicago");
-assert la.get_tzid().find("Los_Angeles") != -1;
-assert la.get_location() == "America/Los_Angeles";
-assert la.get_tznames() == "PST/PDT";
+la = ICalGLib.Timezone.get_builtin_timezone("America/Los_Angeles")
+chicago = ICalGLib.Timezone.get_builtin_timezone("America/Chicago")
+assert la.get_tzid().find("Los_Angeles") != -1
+assert la.get_location() == "America/Los_Angeles"
+assert la.get_tznames() == "PST/PDT"
-la_copy = la.copy();
-assert la_copy.get_tzid() == la.get_tzid();
-assert la_copy.get_location() == la.get_location();
+la_copy = la.copy()
+assert la_copy.get_tzid() == la.get_tzid()
+assert la_copy.get_location() == la.get_location()
-timezones = ICalGLib.Timezone.get_builtin_timezones();
-timezone = ICalGLib.Timezone.array_element_at(timezones, 0);
+timezones = ICalGLib.Timezone.get_builtin_timezones()
+timezone = ICalGLib.Timezone.array_element_at(timezones, 0)
if not ICalGLib.Timezone.get_builtin_tzdata():
- assert timezone.get_display_name() == "Europe/Andorra";
-assert timezones.size() > 0;
+ assert timezone.get_display_name() == "Europe/Andorra"
+assert timezones.size() > 0
-from_tzid = ICalGLib.Timezone.get_builtin_timezone_from_tzid(la.get_tzid());
-assert from_tzid.get_location() == "America/Los_Angeles";
+from_tzid = ICalGLib.Timezone.get_builtin_timezone_from_tzid(la.get_tzid())
+assert from_tzid.get_location() == "America/Los_Angeles"
-utc = ICalGLib.Timezone.get_utc_timezone();
-assert utc.get_display_name() == "UTC";
-utc2 = ICalGLib.Timezone.get_utc_timezone();
+utc = ICalGLib.Timezone.get_utc_timezone()
+assert utc.get_display_name() == "UTC"
+utc2 = ICalGLib.Timezone.get_utc_timezone()
assert utc == utc2
-time = ICalGLib.Time.new();
-before = time.get_hour();
-ICalGLib.Time.convert_timezone(time, la, chicago);
-after = time.get_hour();
-assert abs(after - before) == 2;
-ICalGLib.Time.set_timezone(time, utc);
-assert ICalGLib.Time.get_timezone(time) == utc;
-ICalGLib.Time.set_timezone(time, la);
-assert ICalGLib.Time.get_timezone(time) == la;
+time = ICalGLib.Time.new()
+before = time.get_hour()
+ICalGLib.Time.convert_timezone(time, la, chicago)
+after = time.get_hour()
+assert abs(after - before) == 2
+ICalGLib.Time.set_timezone(time, utc)
+assert ICalGLib.Time.get_timezone(time) == utc
+ICalGLib.Time.set_timezone(time, la)
+assert ICalGLib.Time.get_timezone(time) == la
timeclone = time.clone()
assert time != timeclone
time = ICalGLib.Time.convert_to_zone(time, chicago)
timeclone.convert_to_zone_inplace(chicago)
-assert time.get_year() == timeclone.get_year();
-assert time.get_month() == timeclone.get_month();
-assert time.get_day() == timeclone.get_day();
-assert time.get_hour() == timeclone.get_hour();
-assert time.get_minute() == timeclone.get_minute();
-assert time.get_second() == timeclone.get_second();
-assert time.get_timezone() == timeclone.get_timezone();
-assert time.is_date() == timeclone.is_date();
-assert time.is_daylight() == timeclone.is_daylight();
-assert time.is_utc() == timeclone.is_utc();
-
-timeclone = ICalGLib.Time.clone(time);
-assert time != timeclone;
-assert ICalGLib.Time.get_year(time) == ICalGLib.Time.get_year(timeclone);
-assert ICalGLib.Time.get_month(time) == ICalGLib.Time.get_month(timeclone);
-assert ICalGLib.Time.get_day(time) == ICalGLib.Time.get_day(timeclone);
-assert ICalGLib.Time.get_hour(time) == ICalGLib.Time.get_hour(timeclone);
-assert ICalGLib.Time.get_minute(time) == ICalGLib.Time.get_minute(timeclone);
-assert ICalGLib.Time.get_second(time) == ICalGLib.Time.get_second(timeclone);
-assert ICalGLib.Time.get_timezone(time) == ICalGLib.Time.get_timezone(timeclone);
-assert ICalGLib.Time.is_date(time) == ICalGLib.Time.is_date(timeclone);
-assert ICalGLib.Time.is_daylight(time) == ICalGLib.Time.is_daylight(timeclone);
-assert ICalGLib.Time.is_utc(time) == ICalGLib.Time.is_utc(timeclone);
+assert time.get_year() == timeclone.get_year()
+assert time.get_month() == timeclone.get_month()
+assert time.get_day() == timeclone.get_day()
+assert time.get_hour() == timeclone.get_hour()
+assert time.get_minute() == timeclone.get_minute()
+assert time.get_second() == timeclone.get_second()
+assert time.get_timezone() == timeclone.get_timezone()
+assert time.is_date() == timeclone.is_date()
+assert time.is_daylight() == timeclone.is_daylight()
+assert time.is_utc() == timeclone.is_utc()
+
+timeclone = ICalGLib.Time.clone(time)
+assert time != timeclone
+assert ICalGLib.Time.get_year(time) == ICalGLib.Time.get_year(timeclone)
+assert ICalGLib.Time.get_month(time) == ICalGLib.Time.get_month(timeclone)
+assert ICalGLib.Time.get_day(time) == ICalGLib.Time.get_day(timeclone)
+assert ICalGLib.Time.get_hour(time) == ICalGLib.Time.get_hour(timeclone)
+assert ICalGLib.Time.get_minute(time) == ICalGLib.Time.get_minute(timeclone)
+assert ICalGLib.Time.get_second(time) == ICalGLib.Time.get_second(timeclone)
+assert ICalGLib.Time.get_timezone(time) == ICalGLib.Time.get_timezone(timeclone)
+assert ICalGLib.Time.is_date(time) == ICalGLib.Time.is_date(timeclone)
+assert ICalGLib.Time.is_daylight(time) == ICalGLib.Time.is_daylight(timeclone)
+assert ICalGLib.Time.is_utc(time) == ICalGLib.Time.is_utc(timeclone)
time.set_date(2019, 1, 24)
assert time.get_year() == 2019
@@ -122,19 +113,19 @@ assert array[0] == 12
assert array[1] == 11
assert array[2] == 10
-component = la.get_component();
-timezone = ICalGLib.Timezone.new();
-timezone.set_component(ICalGLib.Component.clone(component));
-assert timezone.get_location() == la.get_location();
-
-array = ICalGLib.Timezone.array_new();
-ICalGLib.Timezone.array_append_from_vtimezone(array, ICalGLib.Component.clone(la.get_component()));
-ICalGLib.Timezone.array_append_from_vtimezone(array, ICalGLib.Component.clone(chicago.get_component()));
-assert array.size() == 2;
-timezone1 = ICalGLib.Timezone.array_element_at(array, 0);
-assert timezone1.get_display_name() == la.get_display_name();
-timezone2 = ICalGLib.Timezone.array_element_at(array, 1);
-assert timezone2.get_display_name() == chicago.get_display_name();
+component = la.get_component()
+timezone = ICalGLib.Timezone.new()
+timezone.set_component(ICalGLib.Component.clone(component))
+assert timezone.get_location() == la.get_location()
+
+array = ICalGLib.Timezone.array_new()
+ICalGLib.Timezone.array_append_from_vtimezone(array, ICalGLib.Component.clone(la.get_component()))
+ICalGLib.Timezone.array_append_from_vtimezone(array, ICalGLib.Component.clone(chicago.get_component()))
+assert array.size() == 2
+timezone1 = ICalGLib.Timezone.array_element_at(array, 0)
+assert timezone1.get_display_name() == la.get_display_name()
+timezone2 = ICalGLib.Timezone.array_element_at(array, 1)
+assert timezone2.get_display_name() == chicago.get_display_name()
ICalGLib.Timezone.free_builtin_timezones()
ICalGLib.Object.free_global_objects()
diff --git a/src/test/libical-glib/value.py b/src/test/libical-glib/value.py
index 7be64644..9c94e248 100755..100644
--- a/src/test/libical-glib/value.py
+++ b/src/test/libical-glib/value.py
@@ -1,83 +1,74 @@
#!/usr/bin/env python3
-#GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./value.py
+# GI_TYPELIB_PATH=$PREFIX/lib/girepository-1.0/ ./value.py
###############################################################################
#
-# Copyright (C) 2015 William Yu <williamyu@gnome.org>
+# SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
#
-# This library is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.txt
-#
-# Or:
-#
-# The Mozilla Public License Version 2.0. You may obtain a copy of
-# the License at https://www.mozilla.org/MPL/
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
#
###############################################################################
-import gi
+''' Test Python bindings for libical value '''
+import gi
gi.require_version('ICalGLib', '3.0')
+from gi.repository import ICalGLib # nopep8 # pylint: disable=wrong-import-position
-from gi.repository import ICalGLib
-
-kind = ICalGLib.ValueKind.ATTACH_VALUE;
-value = ICalGLib.Value.new(kind);
-assert(value.is_valid() == 1);
-assert(value.isa() == kind);
-assert(value.isa_value() == 1);
+kind = ICalGLib.ValueKind.ATTACH_VALUE
+value = ICalGLib.Value.new(kind)
+assert value.is_valid() == 1
+assert value.isa() == kind
+assert value.isa_value() == 1
-string = "This is a link";
-value_from_string = ICalGLib.Value.new_from_string(kind, string);
-assert(value_from_string.as_ical_string() == string);
-assert(value_from_string.is_valid() == 1);
-assert(value_from_string.isa() == kind);
-assert(value_from_string.isa_value() == 1);
+string = "This is a link"
+value_from_string = ICalGLib.Value.new_from_string(kind, string)
+assert value_from_string.as_ical_string() == string
+assert value_from_string.is_valid() == 1
+assert value_from_string.isa() == kind
+assert value_from_string.isa_value() == 1
-value_from_string_clone = value_from_string.clone();
-assert(value_from_string_clone.as_ical_string() == string);
-assert(value_from_string_clone.is_valid() == 1);
-assert(value_from_string_clone.isa() == kind);
-assert(value_from_string_clone.isa_value() == 1);
+value_from_string_clone = value_from_string.clone()
+assert value_from_string_clone.as_ical_string() == string
+assert value_from_string_clone.is_valid() == 1
+assert value_from_string_clone.isa() == kind
+assert value_from_string_clone.isa_value() == 1
-value_a = ICalGLib.Value.new(ICalGLib.ValueKind.RECUR_VALUE);
-value_b = ICalGLib.Value.new(ICalGLib.ValueKind.ATTACH_VALUE);
-compare_result = ICalGLib.Value.compare(value_a, value_b);
-assert(compare_result == ICalGLib.ParameterXliccomparetype.NOTEQUAL);
+value_a = ICalGLib.Value.new(ICalGLib.ValueKind.RECUR_VALUE)
+value_b = ICalGLib.Value.new(ICalGLib.ValueKind.ATTACH_VALUE)
+compare_result = ICalGLib.Value.compare(value_a, value_b)
+assert compare_result == ICalGLib.ParameterXliccomparetype.NOTEQUAL
-string_a = "a string";
-string_b = "a string";
-value_a = ICalGLib.Value.new_from_string(kind, string_a);
-value_b = ICalGLib.Value.new_from_string(kind, string_b);
-compare_result = ICalGLib.Value.compare(value_a, value_b);
-assert(compare_result == ICalGLib.ParameterXliccomparetype.EQUAL);
+stringA = "a string"
+stringB = "a string"
+value_a = ICalGLib.Value.new_from_string(kind, stringA)
+value_b = ICalGLib.Value.new_from_string(kind, stringB)
+compare_result = ICalGLib.Value.compare(value_a, value_b)
+assert compare_result == ICalGLib.ParameterXliccomparetype.EQUAL
-string_a = "a string";
-string_b = "b string";
-value_a = ICalGLib.Value.new_from_string(kind, string_a);
-value_b = ICalGLib.Value.new_from_string(kind, string_b);
-compare_result = ICalGLib.Value.compare(value_a, value_b);
-assert(compare_result == ICalGLib.ParameterXliccomparetype.NOTEQUAL);
+stringA = "a string"
+stringB = "b string"
+value_a = ICalGLib.Value.new_from_string(kind, stringA)
+value_b = ICalGLib.Value.new_from_string(kind, stringB)
+compare_result = ICalGLib.Value.compare(value_a, value_b)
+assert compare_result == ICalGLib.ParameterXliccomparetype.NOTEQUAL
-kind_string = ICalGLib.Value.kind_to_string(kind);
-assert(kind_string == "ATTACH");
-converted_kind = ICalGLib.Value.kind_from_string(kind_string);
-assert(converted_kind == kind);
+kind_string = ICalGLib.Value.kind_to_string(kind)
+assert kind_string == "ATTACH"
+converted_kind = ICalGLib.Value.kind_from_string(kind_string)
+assert converted_kind == kind
-szText = "This is a text\nand this is a new line";
-after_encoded_szText = "This is a text\\nand this is a new line";
-before_decoded_szText = "This is a text\\\nand this is a new line";
-result = ICalGLib.Value.encode_ical_string(szText);
-assert(result == after_encoded_szText);
+szText = "This is a text\nand this is a new line"
+afterEncodedSZText = "This is a text\\nand this is a new line"
+beforeDecodedSZText = "This is a text\\\nand this is a new line"
+result = ICalGLib.Value.encode_ical_string(szText)
+assert result == afterEncodedSZText
-result = ICalGLib.Value.decode_ical_string(before_decoded_szText);
-assert(result == szText);
+result = ICalGLib.Value.decode_ical_string(beforeDecodedSZText)
+assert result == szText
-szText = "Simple text";
-result = ICalGLib.Value.encode_ical_string(szText);
+szText = "Simple text"
+result = ICalGLib.Value.encode_ical_string(szText)
assert result == szText
-result = ICalGLib.Value.decode_ical_string(result);
+result = ICalGLib.Value.decode_ical_string(result)
assert result == szText
diff --git a/src/test/outgoing.ics b/src/test/outgoing.ics
index 9f9fd3fd..6cd463a8 100644
--- a/src/test/outgoing.ics
+++ b/src/test/outgoing.ics
@@ -185,8 +185,8 @@ SUMMARY
SEQUENCE
:0
COMMENT
- :Unfortunately\, I have another commitment that conflicts with this
- meeting. I am delegating my attendance to Bob.
+ :Unfortunately\, I have another commitment that conflicts with this
+ meeting. I am delegating my attendance to Bob.
ATTENDEE
;ROLE=CHAIR
;CUTYPE=INDIVIDUAL
@@ -279,8 +279,8 @@ SUMMARY
SEQUENCE
:0
COMMENT
- :Unfortunately\, I have another commitment that conflicts with this
- meeting. I am delegating my attendance to Bob.
+ :Unfortunately\, I have another commitment that conflicts with this
+ meeting. I am delegating my attendance to Bob.
ATTENDEE
;ROLE=CHAIR
;CUTYPE=INDIVIDUAL
@@ -373,8 +373,8 @@ SUMMARY
SEQUENCE
:0
COMMENT
- :Unfortunately\, I have another commitment that conflicts with this
- meeting. I am delegating my attendance to Bob.
+ :Unfortunately\, I have another commitment that conflicts with this
+ meeting. I am delegating my attendance to Bob.
ATTENDEE
;ROLE=CHAIR
;CUTYPE=INDIVIDUAL
@@ -467,8 +467,8 @@ SUMMARY
SEQUENCE
:0
COMMENT
- :Unfortunately\, I have another commitment that conflicts with this
- meeting. I am delegating my attendance to Bob.
+ :Unfortunately\, I have another commitment that conflicts with this
+ meeting. I am delegating my attendance to Bob.
ATTENDEE
;ROLE=CHAIR
;CUTYPE=INDIVIDUAL
diff --git a/src/test/process.c b/src/test/process.c
index 5bfa25ff..f2816154 100644
--- a/src/test/process.c
+++ b/src/test/process.c
@@ -2,18 +2,10 @@
FILE: process.c
CREATOR: eric 11 February 2000
- (C) COPYRIGHT 2000 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -150,7 +142,7 @@ int main(int argc, char *argv[])
if (overlaps == 0) {
/* No overlaps, book the meeting */
-/* icalset_add_component(cal,icalcomponent_new_clone(c));*/
+/* icalset_add_component(cal,icalcomponent_clone(c));*/
/* Return a reply */
reply =
@@ -186,7 +178,7 @@ int main(int argc, char *argv[])
next_time =
icalspanlist_next_free_time(spanl, icalcomponent_get_dtstart(c));
- newc = icalcomponent_new_clone(c);
+ newc = icalcomponent_clone(c);
icalcomponent_set_dtstart(newc, next_time.start);
diff --git a/src/test/recur.c b/src/test/recur.c
index 01552802..014ede09 100644
--- a/src/test/recur.c
+++ b/src/test/recur.c
@@ -2,7 +2,7 @@
FILE: recur.c
CREATOR: ebusboom 8jun00
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
DESCRIPTION:
@@ -10,16 +10,8 @@
./recur ../../test-data/recur.txt
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -45,8 +37,8 @@ static void recur_callback(icalcomponent *comp, struct icaltime_span *span, void
{
_unused(comp);
_unused(data);
- printf("cb: %s", ctime(&span->start));
- printf(" %s\n", ctime(&span->end));
+ printf("cb: %s", icalctime(&span->start));
+ printf(" %s\n", icalctime(&span->end));
}
int main(int argc, char *argv[])
@@ -57,7 +49,7 @@ int main(int argc, char *argv[])
icalproperty *desc, *dtstart, *rrule;
struct icalrecurrencetype recur;
icalrecur_iterator *ritr;
- time_t tt;
+ icaltime_t tt;
const char *file;
icalerror_set_error_state(ICAL_PARSE_ERROR, ICAL_ERROR_NONFATAL);
@@ -114,7 +106,7 @@ int main(int argc, char *argv[])
tt = icaltime_as_timet(start);
- printf("#### %s\n", ctime(&tt));
+ printf("#### %s\n", icalctime(&tt));
icalrecur_iterator_free(ritr);
@@ -123,7 +115,7 @@ int main(int argc, char *argv[])
!icaltime_is_null_time(next);
next = icalrecur_iterator_next(ritr)) {
tt = icaltime_as_timet(next);
- printf(" %s", ctime(&tt));
+ printf(" %s", icalctime(&tt));
}
icalrecur_iterator_free(ritr);
diff --git a/src/test/regression-classify.c b/src/test/regression-classify.c
index 7e5d4aa7..a5f3af0c 100644
--- a/src/test/regression-classify.c
+++ b/src/test/regression-classify.c
@@ -1,18 +1,10 @@
/*======================================================================
FILE: regression-classify.c
- Copyright (C) 2002 Paul Lindner <lindner@users.sf.net>
+ SPDX-FileCopyrightText: 2002 Paul Lindner <lindner@users.sf.net>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
diff --git a/src/test/regression-component.c b/src/test/regression-component.c
index 2df42abc..0541a61b 100644
--- a/src/test/regression-component.c
+++ b/src/test/regression-component.c
@@ -1,18 +1,9 @@
/*======================================================================
FILE: regression-component.c
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original author is Eric Busboom
======================================================================*/
@@ -310,9 +301,9 @@ static void print_span(int c, struct icaltime_span span)
*/
void test_icalcomponent_get_span()
{
- time_t tm1 = 973378800; /*Sat Nov 4 23:00:00 UTC 2000,
+ icaltime_t tm1 = 973378800; /*Sat Nov 4 23:00:00 UTC 2000,
Sat Nov 4 15:00:00 PST 2000 */
- time_t tm2 = 973382400; /*Sat Nov 5 00:00:00 UTC 2000
+ icaltime_t tm2 = 973382400; /*Sat Nov 5 00:00:00 UTC 2000
Sat Nov 4 16:00:00 PST 2000 */
struct icaldurationtype dur;
struct icaltime_span span;
@@ -321,7 +312,7 @@ void test_icalcomponent_get_span()
int tnum = 0;
/** test 0
- * Direct assigning time_t means they will be interpreted as UTC
+ * Direct assigning icaltime_t means they will be interpreted as UTC
*/
span.start = tm1;
span.end = tm2;
diff --git a/src/test/regression-cxx.cpp b/src/test/regression-cxx.cpp
index 6bb33b3a..dbe3ae49 100644
--- a/src/test/regression-cxx.cpp
+++ b/src/test/regression-cxx.cpp
@@ -1,16 +1,8 @@
/**
- (C) COPYRIGHT 2001, Critical Path
+ SPDX-FileCopyrightText: 2001, Critical Path
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
*/
#ifdef HAVE_CONFIG_H
diff --git a/src/test/regression-recur.c b/src/test/regression-recur.c
index e11112e6..dee65679 100644
--- a/src/test/regression-recur.c
+++ b/src/test/regression-recur.c
@@ -2,20 +2,12 @@
FILE: regression-recur.c
CREATOR: ebusboom 8jun00
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
DESCRIPTION:
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
@@ -69,8 +61,8 @@ static void recur_callback(icalcomponent *comp, struct icaltime_span *span, void
_unused(comp);
if (VERBOSE) {
- printf("recur: %s", ctime(&span->start));
- printf(" %s", ctime(&span->end));
+ printf("recur: %s", icalctime(&span->start));
+ printf(" %s", icalctime(&span->end));
}
*num_recurs = *num_recurs + 1;
}
@@ -83,7 +75,7 @@ void test_recur_file()
icalproperty *desc, *dtstart, *rrule;
struct icalrecurrencetype recur;
icalrecur_iterator *ritr;
- time_t tt;
+ icaltime_t tt;
const char *file;
int num_recurs_found = 0;
icalfileset_options options = { O_RDONLY, 0644, 0, NULL };
@@ -147,7 +139,7 @@ void test_recur_file()
tt = icaltime_as_timet(start);
if (VERBOSE)
- printf("#### %s\n", ctime(&tt));
+ printf("#### %s\n", icalctime(&tt));
icalrecur_iterator_free(ritr);
@@ -157,7 +149,7 @@ void test_recur_file()
next = icalrecur_iterator_next(ritr)) {
tt = icaltime_as_timet(next);
if (VERBOSE)
- printf(" %s", ctime(&tt));
+ printf(" %s", icalctime(&tt));
}
icalrecur_iterator_free(ritr);
diff --git a/src/test/regression-storage.c b/src/test/regression-storage.c
index eb11f6d5..ad63da0a 100644
--- a/src/test/regression-storage.c
+++ b/src/test/regression-storage.c
@@ -2,20 +2,11 @@
FILE: regression-storage.c
CREATOR: eric 03 April 1999
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
DESCRIPTION:
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original author is Eric Busboom
The original code is usecases.c
@@ -167,7 +158,7 @@ void test_fileset_extended(void)
start.month = month;
end.month = month;
- clone = icalcomponent_new_clone(c);
+ clone = icalcomponent_clone(c);
ok("Making clone of output file", (clone != 0));
assert(clone != 0);
@@ -350,7 +341,7 @@ void test_bdbset()
start.month = month;
end.month = month;
- clone = icalcomponent_new_clone(c);
+ clone = icalcomponent_clone(c);
assert(clone != 0);
event = icalcomponent_get_first_component(clone, ICAL_VEVENT_COMPONENT);
assert(event != 0);
@@ -672,7 +663,7 @@ void test_dirset_extended(void)
/* Change the dtstart and dtend times in the component
pointed to by Itr */
- (void)icalcomponent_new_clone(itr);
+ (void)icalcomponent_clone(itr);
inner = icalcomponent_get_first_component(itr, ICAL_VEVENT_COMPONENT);
ok("Duplicating component...", (icalerrno == ICAL_NO_ERROR) && (inner != 0));
@@ -712,7 +703,7 @@ void test_dirset_extended(void)
if (VERBOSE)
printf("\n----------\n%s\n---------\n", icalcomponent_as_ical_string(inner));
- error = icaldirset_add_component(s, icalcomponent_new_clone(itr));
+ error = icaldirset_add_component(s, icalcomponent_clone(itr));
ok("Adding component to dirset", (icalerrno == ICAL_NO_ERROR));
assert(error == ICAL_NO_ERROR);
diff --git a/src/test/regression-utils.c b/src/test/regression-utils.c
index 431cef85..3536f0ad 100644
--- a/src/test/regression-utils.c
+++ b/src/test/regression-utils.c
@@ -1,18 +1,9 @@
/*======================================================================
FILE: regression-utils.c
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original author is Eric Busboom
======================================================================*/
@@ -23,6 +14,9 @@
#include "libical/ical.h"
+#include "test-malloc.h"
+#include "regression.h"
+
#include <stdlib.h>
int QUIET = 0;
@@ -30,12 +24,12 @@ int VERBOSE = 1;
static char ictt_str[1024];
-const char *ical_timet_string(const time_t t)
+const char *ical_timet_string(const icaltime_t t)
{
struct tm tmp, stm;
memset(&tmp, 0, sizeof(tmp));
- if (gmtime_r(&t, &tmp)) {
+ if (icalgmtime_r(&t, &tmp)) {
stm = tmp;
} else {
memset(&stm, 0, sizeof(stm));
@@ -68,10 +62,10 @@ const char *ictt_as_string(struct icaltimetype t)
char *icaltime_as_ctime(struct icaltimetype t)
{
- time_t tt;
+ icaltime_t tt;
tt = icaltime_as_timet(t);
- snprintf(ictt_str, sizeof(ictt_str), "%s", ctime(&tt));
+ snprintf(ictt_str, sizeof(ictt_str), "%s", icalctime(&tt));
return ictt_str;
}
@@ -93,7 +87,7 @@ void die_on_errors_set(int val)
die_on_errors = val;
}
-void _ok(const char *test_name, int success, char *file, int linenum, const char *test)
+void _ok(const char *test_name, int success, const char *file, int linenum, const char *test)
{
testnumber++;
@@ -114,7 +108,7 @@ void _ok(const char *test_name, int success, char *file, int linenum, const char
}
}
-void _is(const char *test_name, const char *str1, const char *str2, char *file, int linenum)
+void _is(const char *test_name, const char *str1, const char *str2, const char *file, int linenum)
{
int diff;
@@ -135,7 +129,7 @@ void _is(const char *test_name, const char *str1, const char *str2, char *file,
}
}
-void _int_is(char *test_name, int i1, int i2, char *file, int linenum)
+void _int_is(const char *test_name, int i1, int i2, const char *file, int linenum)
{
_ok(test_name, (i1 == i2), file, linenum, "");
@@ -196,7 +190,6 @@ int test_end(void)
printf("%s%d/%d ", prefix, this_set, failed_tests[i].test);
}
printf("\n");
-
} else {
printf("\n All Tests Successful.\n");
}
@@ -204,6 +197,24 @@ int test_end(void)
return failed;
}
+/**
+ * Bring all memory that is allocated as side effect into a stable state, so we can calculate
+ * stable memory allocation statistics.
+ */
+static void cleanup_nondeterministic_memory() {
+
+ // icalerrno_return() allocates a buffer on it's first use per thread. Let's allocate it
+ // now, so it doesn't disturb our test statistics.
+ icalerrno_return();
+
+ // Built-in timezones are cached by libical. By freeing them, they don't influence our statistics.
+ icaltimezone_free_builtin_timezones();
+
+ // Memory that was added to the ring buffer is not required to be freed by the caller, so
+ // we free it here to keep our statistics clean.
+ icalmemory_free_ring();
+}
+
void test_run(const char *test_name, void (*test_fcn) (void), int do_test, int headeronly)
{
static int test_set = 1;
@@ -212,7 +223,29 @@ void test_run(const char *test_name, void (*test_fcn) (void), int do_test, int h
test_header(test_name, test_set);
if (!headeronly && (do_test == 0 || do_test == test_set)) {
+
+ struct testmalloc_statistics mem_statistics;
+
+ // Clean up cached and other kind of non-deterministic memory.
+ cleanup_nondeterministic_memory();
+
+ // Now that we are in a stable state, reset the memory statistics and start counting.
+ testmalloc_reset();
+
+ // Run the test.
(*test_fcn) ();
+
+ // Before getting the statistics, clean up any non-deterministic memory again, so it
+ // doesn't influence the statistics.
+ cleanup_nondeterministic_memory();
+
+ // Now we should get clean statistics.
+ testmalloc_get_statistics(&mem_statistics);
+
+ ok("no memory leaked",
+ (mem_statistics.mem_allocated_current == 0) &&
+ (mem_statistics.blocks_allocated == 0));
+
if (!QUIET)
printf("\n");
}
diff --git a/src/test/regression.c b/src/test/regression.c
index 8ec1948d..4dfe2a19 100644
--- a/src/test/regression.c
+++ b/src/test/regression.c
@@ -2,28 +2,23 @@
FILE: regression.c
CREATOR: eric 03 April 1999
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original author is Eric Busboom
The original code is regression.c
======================================================================*/
//krazy:skip
+
+# define NO_DEPRECATION_WARNINGS // do not complain about our own deprecated usage
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "regression.h"
+#include "libical/astime.h"
+#include "test-malloc.h"
#include "libical/ical.h"
#include "libicalss/icalss.h"
#include "libicalvcal/icalvcal.h"
@@ -186,9 +181,9 @@ void test_values()
str_is("icalvalue_as_ical_string()", icalvalue_as_ical_string(v), "cap://value/2");
- copy = icalvalue_new_clone(v);
+ copy = icalvalue_clone(v);
- str_is("icalvalue_new_clone()", icalvalue_as_ical_string(copy), "cap://value/2");
+ str_is("icalvalue_clone()", icalvalue_as_ical_string(copy), "cap://value/2");
icalvalue_free(v);
icalvalue_free(copy);
@@ -199,8 +194,8 @@ void test_values()
ok("icalvalue_set_boolean(2)", (2 == icalvalue_get_boolean(v)));
str_is("icalvalue_as_ical_string()", icalvalue_as_ical_string(v), "TRUE");
- copy = icalvalue_new_clone(v);
- str_is("icalvalue_new_clone()", icalvalue_as_ical_string(copy), "TRUE");
+ copy = icalvalue_clone(v);
+ str_is("icalvalue_clone()", icalvalue_as_ical_string(copy), "TRUE");
icalvalue_free(v);
icalvalue_free(copy);
@@ -211,8 +206,8 @@ void test_values()
str_is("icalvalue_set_x(test2)", icalvalue_get_x(v), "test2");
str_is("icalvalue_as_ical_string()", icalvalue_as_ical_string(v), "test2");
- copy = icalvalue_new_clone(v);
- str_is("icalvalue_new_clone()", icalvalue_as_ical_string(copy), "test2");
+ copy = icalvalue_clone(v);
+ str_is("icalvalue_clone()", icalvalue_as_ical_string(copy), "test2");
icalvalue_free(v);
icalvalue_free(copy);
@@ -222,8 +217,8 @@ void test_values()
icalvalue_set_datetime(v, icaltime_from_timet_with_zone(1023404802 - 3600, 0, NULL));
str_is("icalvalue_set_datetime()", icalvalue_as_ical_string(v), "20020606T220642");
- copy = icalvalue_new_clone(v);
- str_is("icalvalue_new_clone()", icalvalue_as_ical_string(v), "20020606T220642");
+ copy = icalvalue_clone(v);
+ str_is("icalvalue_clone()", icalvalue_as_ical_string(v), "20020606T220642");
icalvalue_free(v);
icalvalue_free(copy);
@@ -319,12 +314,12 @@ void test_properties()
}
str_is("icalproperty_as_ical_string()", icalproperty_as_ical_string(prop), test_ical_str_good);
- clone = icalproperty_new_clone(prop);
+ clone = icalproperty_clone(prop);
if (VERBOSE) {
printf("Clone:\n %s\n", icalproperty_as_ical_string(prop));
}
- str_is("icalproperty_new_clone()", icalproperty_as_ical_string(prop), test_ical_str_good);
+ str_is("icalproperty_clone()", icalproperty_as_ical_string(prop), test_ical_str_good);
icalproperty_free(clone);
icalproperty_free(prop);
@@ -801,7 +796,7 @@ void test_memory()
ok("final buffer size == 806", (bufsize == 806));
- free(f);
+ icalmemory_free_buffer(f);
bufsize = 4;
@@ -890,7 +885,7 @@ void test_memory()
if (VERBOSE)
printf("Char-by-Char buffer: %s\n", f);
- free(f);
+ icalmemory_free_buffer(f);
for (i = 0; i < 100; i++) {
f = icalmemory_tmp_buffer(bufsize);
@@ -955,7 +950,7 @@ void test_dirset()
/* Change the dtstart and dtend times in the component
pointed to by Itr */
- clone = icalcomponent_new_clone(itr);
+ clone = icalcomponent_clone(itr);
assert(icalerrno == ICAL_NO_ERROR);
assert(clone != 0);
@@ -1027,7 +1022,7 @@ void test_compare()
icalvalue *v1, *v2;
v1 = icalvalue_new_caladdress("cap://value/1");
- v2 = icalvalue_new_clone(v1);
+ v2 = icalvalue_clone(v1);
ok("compare value and clone", (icalvalue_compare(v1, v2) == ICAL_XLICCOMPARETYPE_EQUAL));
@@ -1140,7 +1135,15 @@ void test_restriction()
icalproperty_vanew_dtend(atime,
icalparameter_new_tzid("America/New_York"),
(void *)0),
- icalproperty_new_location("1CP Conference Room 4350"), (void *)0), (void *)0);
+ icalproperty_new_location("1CP Conference Room 4350"),
+ icalcomponent_vanew(ICAL_VALARM_COMPONENT,
+ icalproperty_new_action(ICAL_ACTION_EMAIL),
+ icalproperty_new_repeat(0),
+ icalcomponent_vanew(ICAL_VLOCATION_COMPONENT,
+ (void *)0),
+ (void *)0),
+ (void *)0),
+ (void *)0);
valid = icalrestriction_check(comp);
(void)icalcomponent_as_ical_string(comp);
@@ -1192,7 +1195,7 @@ void test_calendar()
c = icalcalendar_get_properties(calendar);
- error = icalfileset_add_component(c, icalcomponent_new_clone(comp));
+ error = icalfileset_add_component(c, icalcomponent_clone(comp));
ok("Adding Clone Component to dirset", (error == ICAL_NO_ERROR));
@@ -1209,17 +1212,17 @@ void print_occur(struct icalrecurrencetype recur, struct icaltimetype start)
struct icaltimetype next;
icalrecur_iterator *ritr;
- time_t tt = icaltime_as_timet(start);
+ icaltime_t tt = icaltime_as_timet(start);
printf("#### %s\n", icalrecurrencetype_as_string(&recur));
- printf("#### %s\n", ctime(&tt));
+ printf("#### %s\n", icalctime(&tt));
ritr = icalrecur_iterator_new(recur, start);
for (next = icalrecur_iterator_next(ritr);
!icaltime_is_null_time(next);
next = icalrecur_iterator_next(ritr)) {
tt = icaltime_as_timet(next);
- printf(" %s", ctime(&tt));
+ printf(" %s", icalctime(&tt));
}
icalrecur_iterator_free(ritr);
@@ -1229,7 +1232,7 @@ void test_recur()
{
struct icalrecurrencetype rt;
struct icaltimetype start;
- time_t array[25];
+ icaltime_t array[25];
int i;
rt = icalrecurrencetype_from_string(
@@ -1250,27 +1253,111 @@ void test_recur()
for (i = 0; i < 25 && array[i] != 0; i++) {
if (VERBOSE) {
- printf(" %s", ctime(&(array[i])));
+ printf(" %s", icalctime(&(array[i])));
}
}
/* test_increment();*/
}
+void test_recur_encode_by_day()
+{
+ struct icalrecurrencetype rt;
+ int ii;
+
+ rt = icalrecurrencetype_from_string("FREQ=WEEKLY;BYDAY=WE");
+ ok("Is weekly recurrence", (rt.freq == ICAL_WEEKLY_RECURRENCE));
+ ok("The by_day[0] is set", (rt.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX));
+ ok("The by_day[1] is not set", (rt.by_day[1] == ICAL_RECURRENCE_ARRAY_MAX));
+ ok("The day of week is Wednesday", (icalrecurrencetype_day_day_of_week(rt.by_day[0]) == ICAL_WEDNESDAY_WEEKDAY));
+ ok("The position is 0", (icalrecurrencetype_day_position(rt.by_day[0]) == 0));
+ ok("Encoded value matches", (icalrecurrencetype_encode_day(ICAL_WEDNESDAY_WEEKDAY, 0) == rt.by_day[0]));
+
+ rt = icalrecurrencetype_from_string("FREQ=MONTHLY;BYDAY=2FR");
+ ok("Is monthly recurrence", (rt.freq == ICAL_MONTHLY_RECURRENCE));
+ ok("The by_day[0] is set", (rt.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX));
+ ok("The by_day[1] is not set", (rt.by_day[1] == ICAL_RECURRENCE_ARRAY_MAX));
+ ok("The day of week is Friday", (icalrecurrencetype_day_day_of_week(rt.by_day[0]) == ICAL_FRIDAY_WEEKDAY));
+ ok("The position is 2", (icalrecurrencetype_day_position(rt.by_day[0]) == 2));
+ ok("Encoded value matches", (icalrecurrencetype_encode_day(ICAL_FRIDAY_WEEKDAY, 2) == rt.by_day[0]));
+
+ rt = icalrecurrencetype_from_string("FREQ=YEARLY;BYDAY=-3MO");
+ ok("Is yearly recurrence", (rt.freq == ICAL_YEARLY_RECURRENCE));
+ ok("The by_day[0] is set", (rt.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX));
+ ok("The by_day[1] is not set", (rt.by_day[1] == ICAL_RECURRENCE_ARRAY_MAX));
+ ok("The day of week is Monday", (icalrecurrencetype_day_day_of_week(rt.by_day[0]) == ICAL_MONDAY_WEEKDAY));
+ ok("The position is -3", (icalrecurrencetype_day_position(rt.by_day[0]) == -3));
+ ok("Encoded value matches", (icalrecurrencetype_encode_day(ICAL_MONDAY_WEEKDAY, -3) == rt.by_day[0]));
+
+ for (ii = -5; ii <= 5; ii++) {
+ icalrecurrencetype_weekday wd;
+
+ for (wd = ICAL_SUNDAY_WEEKDAY; wd <= ICAL_SATURDAY_WEEKDAY; wd++) {
+ short encoded;
+
+ if (VERBOSE)
+ printf(" Trying weekday %d and position %d\n", wd, ii);
+
+ encoded = icalrecurrencetype_encode_day(wd, ii);
+
+ ok("Decoded day of week matches", (icalrecurrencetype_day_day_of_week(encoded) == wd));
+ ok("Decoded position matches", (icalrecurrencetype_day_position(encoded) == ii));
+ }
+ }
+}
+
+void test_recur_encode_by_month()
+{
+ struct icalrecurrencetype rt;
+ int ii, jj;
+
+ rt = icalrecurrencetype_from_string("FREQ=WEEKLY;BYMONTH=2");
+ ok("Is weekly recurrence", (rt.freq == ICAL_WEEKLY_RECURRENCE));
+ ok("The by_month[0] is set", (rt.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX));
+ ok("The by_month[1] is not set", (rt.by_month[1] == ICAL_RECURRENCE_ARRAY_MAX));
+ ok("The month is 2", (icalrecurrencetype_month_month(rt.by_month[0]) == 2));
+ ok("Is not leap month", (icalrecurrencetype_month_is_leap(rt.by_month[0]) == 0));
+ ok("Encoded value matches", (icalrecurrencetype_encode_month(2, 0) == rt.by_month[0]));
+
+ rt = icalrecurrencetype_from_string("FREQ=MONTHLY;BYMONTH=3L");
+ if (rt.freq != ICAL_NO_RECURRENCE) {
+ ok("Is monthly recurrence", (rt.freq == ICAL_MONTHLY_RECURRENCE));
+ ok("The by_month[0] is set", (rt.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX));
+ ok("The by_month[1] is not set", (rt.by_month[1] == ICAL_RECURRENCE_ARRAY_MAX));
+ ok("The month is 3", (icalrecurrencetype_month_month(rt.by_month[0]) == 3));
+ ok("Is leap month", (icalrecurrencetype_month_is_leap(rt.by_month[0]) != 0));
+ ok("Encoded value matches", (icalrecurrencetype_encode_month(3, 1) == rt.by_month[0]));
+ }
+
+ for (ii = 0; ii <= 1; ii++) {
+ for (jj = 1; jj <= 12; jj++) {
+ short encoded;
+
+ if (VERBOSE)
+ printf(" Trying month %d as %sleap\n", jj, ii ? "" : "not ");
+
+ encoded = icalrecurrencetype_encode_month(jj, ii);
+
+ ok("Decoded month matches", (icalrecurrencetype_month_month(encoded) == jj));
+ ok("Decoded is-leap matches", ((icalrecurrencetype_month_is_leap(encoded) ? 1 : 0) == ii));
+ }
+ }
+}
+
void test_expand_recurrence()
{
- time_t arr[10];
- time_t now = 931057385;
+ icaltime_t arr[10];
+ icaltime_t now = 931057385;
int i, numfound = 0;
icalrecur_expand_recurrence("FREQ=MONTHLY;BYDAY=MO,WE", now, 5, arr);
if (VERBOSE)
- printf("Start %s", ctime(&now));
+ printf("Start %s", icalctime(&now));
for (i = 0; i < 5; i++) {
numfound++;
if (VERBOSE)
- printf("i=%d %s\n", i, ctime(&arr[i]));
+ printf("i=%d %s\n", i, icalctime(&arr[i]));
}
int_is("Get an array of 5 items", numfound, 5);
}
@@ -1299,7 +1386,7 @@ void icalrecurrencetype_test()
struct icalrecurrencetype r = icalvalue_get_recur(v);
struct icaltimetype t = icaltime_from_timet_with_zone(time(0), 0, NULL);
struct icaltimetype next;
- time_t tt;
+ icaltime_t tt;
struct icalrecur_iterator_impl *itr =
(struct icalrecur_iterator_impl *)icalrecur_iterator_new(r, t);
@@ -1309,7 +1396,7 @@ void icalrecurrencetype_test()
next = icalrecur_iterator_next(itr);
tt = icaltime_as_timet(next);
- printf("%s", ctime(&tt));
+ printf("%s", icalctime(&tt));
} while (!icaltime_is_null_time(next));
@@ -1323,7 +1410,7 @@ void test_recur_parameter_bug()
{
static const char test_icalcomp_str[] =
"BEGIN:VEVENT\r\n"
- "RRULE;X-EVOLUTION-ENDDATE=20030209T081500:FREQ=DAILY;COUNT=10;INTERVAL=6\r\n"
+ "RRULE;X-EVOLUTION-ENDDATE=20030209T081500:FREQ=DAILY;INTERVAL=6;COUNT=10\r\n"
"END:VEVENT\r\n";
icalcomponent *icalcomp;
@@ -1675,8 +1762,8 @@ void do_test_time(const char *zone)
{
struct icaltimetype ictt, icttutc, icttzone, icttdayl,
icttla, icttny, icttphoenix, icttlocal, icttnorm;
- time_t tt, tt2, tt_p200;
- time_t offset_tz;
+ icaltime_t tt, tt2, tt_p200;
+ icaltime_t offset_tz;
icalvalue *v;
short day_of_week, start_day_of_week, day_of_year;
icaltimezone *azone, *utczone;
@@ -1689,7 +1776,7 @@ void do_test_time(const char *zone)
/* Test new API */
if (VERBOSE) {
- printf("\n---> From time_t \n");
+ printf("\n---> From icaltime_t \n");
}
tt = 1025127869; /* stick with a constant... Wed, 26 Jun 2002 21:44:29 GMT */
@@ -1699,7 +1786,7 @@ void do_test_time(const char *zone)
}
ictt = icaltime_from_timet_with_zone(tt, 0, NULL);
- str_is("Floating time from time_t", ictt_as_string(ictt), "2002-06-26 21:44:29 (floating)");
+ str_is("Floating time from icaltime_t", ictt_as_string(ictt), "2002-06-26 21:44:29 (floating)");
ictt = icaltime_from_timet_with_zone(tt, 0, azone);
#if ADD_TESTS_REQUIRING_INVESTIGATION
@@ -1777,7 +1864,7 @@ void do_test_time(const char *zone)
tt = icaltime_as_timet(ictt);
- ok("test icaltime -> time_t for 20001103T183030Z", (tt == 973276230));
+ ok("test icaltime -> icaltime_t for 20001103T183030Z", (tt == 973276230));
/* Fri Nov 3 10:30:30 PST 2000 in PST
Fri Nov 3 18:30:30 PST 2000 in UTC */
@@ -1802,7 +1889,7 @@ void do_test_time(const char *zone)
/** add test case here.. **/
if (VERBOSE) {
- printf("\n As time_t \n");
+ printf("\n As icaltime_t \n");
}
tt2 = icaltime_as_timet(ictt);
@@ -1822,7 +1909,7 @@ void do_test_time(const char *zone)
printf("20001103T183030 : %s\n", ictt_as_string(icttlocal));
}
- offset_tz = (time_t) (-icaltimezone_get_utc_offset_of_utc_time(azone, &ictt, 0));
+ offset_tz = (icaltime_t) (-icaltimezone_get_utc_offset_of_utc_time(azone, &ictt, 0));
if (VERBOSE)
printf("offset_tz : %ld\n", (long)offset_tz);
@@ -1920,7 +2007,7 @@ void do_test_time(const char *zone)
icaltimezone_get_builtin_timezone("America/Phoenix"));
if (VERBOSE) {
- printf("Orig (ctime): %s\n", ical_timet_string(tt));
+ printf("Orig (icalctime): %s\n", ical_timet_string(tt));
printf("Orig (ical) : %s\n", ictt_as_string(ictt));
printf("UTC : %s\n", ictt_as_string(icttutc));
printf("Los Angeles : %s\n", ictt_as_string(icttla));
@@ -1933,7 +2020,7 @@ void do_test_time(const char *zone)
if (VERBOSE) {
printf("\n Daylight Savings \n");
- printf("Orig (ctime): %s\n", ical_timet_string(tt));
+ printf("Orig (icalctime): %s\n", ical_timet_string(tt));
printf("Orig (ical) : %s\n", ictt_as_string(ictt));
printf("NY : %s\n", ictt_as_string(icttny));
}
@@ -1961,7 +2048,7 @@ void do_test_time(const char *zone)
icaltimezone_get_builtin_timezone("America/Los_Angeles"));
if (VERBOSE) {
- printf("\nOrig (ctime): %s\n", ical_timet_string(tt));
+ printf("\nOrig (icalctime): %s\n", ical_timet_string(tt));
printf("Orig (ical) : %s\n", ictt_as_string(ictt));
printf("LA : %s\n", ictt_as_string(icttla));
}
@@ -2163,7 +2250,7 @@ void test_icalset()
icalcomponent *clone;
- clone = icalcomponent_new_clone(c);
+ clone = icalcomponent_clone(c);
(void)icalset_add_component(d, clone);
@@ -2178,12 +2265,12 @@ void test_overlaps()
{
icalcomponent *cset, *c;
icalset *set;
- time_t tm1 = 973378800; /*Sat Nov 4 23:00:00 UTC 2000,
+ icaltime_t tm1 = 973378800; /*Sat Nov 4 23:00:00 UTC 2000,
Sat Nov 4 15:00:00 PST 2000 */
- time_t tm2 = 973382400; /*Sat Nov 5 00:00:00 UTC 2000
+ icaltime_t tm2 = 973382400; /*Sat Nov 5 00:00:00 UTC 2000
Sat Nov 4 16:00:00 PST 2000 */
- time_t hh = 1800; /* one half hour */
+ icaltime_t hh = 1800; /* one half hour */
icalfileset_options options = { O_RDONLY, 0644, 0, NULL };
set = icalset_new(ICAL_FILE_SET, TEST_DATADIR "/overlaps.ics", &options);
@@ -2594,7 +2681,7 @@ void test_recur_parser()
const char *str;
str =
- "FREQ=YEARLY;UNTIL=20000131T090000Z;BYDAY=-1TU,3WE,-4FR,SA,SU;BYYEARDAY=34,65,76,78;BYMONTH=1,2,3,4,8";
+ "FREQ=YEARLY;BYMONTH=1,2,3,4,8;BYYEARDAY=34,65,76,78;BYDAY=-1TU,3WE,-4FR,SA,SU;UNTIL=20000131T090000Z";
rt = icalrecurrencetype_from_string(str);
str_is(str, icalrecurrencetype_as_string(&rt), str);
@@ -2609,10 +2696,19 @@ void test_recur_parser()
icalerror_restore("BADARG", es);
ok("COUNT + UNTIL not allowed", rt.freq == ICAL_NO_RECURRENCE);
+ /* Try to parse a RRULE with illegal BY* part combination */
str = "FREQ=DAILY;COUNT=3;BYDAY=-1TU,3WE,-4FR,SA,SU;BYYEARDAY=34,65,76,78;BYMONTH=1,2,3,4,8";
+ es = icalerror_supress("MALFORMEDDATA");
+ rt = icalrecurrencetype_from_string(str);
+ icalerror_restore("MALFORMEDDATA", es);
+ ok("DAILY + BYYEARDAY not allowed", rt.freq == ICAL_NO_RECURRENCE);
+
+ /* Parse the same RRULE but ignore invalid BY* parts */
+ ical_set_invalid_rrule_handling_setting(ICAL_RRULE_IGNORE_INVALID);
rt = icalrecurrencetype_from_string(str);
- str_is(str, icalrecurrencetype_as_string(&rt), str);
+ str_is(str, icalrecurrencetype_as_string(&rt),
+ "FREQ=DAILY;BYMONTH=1,2,3,4,8;BYDAY=-1TU,3WE,-4FR,SA,SU;COUNT=3");
/* Try to parse an RRULE value with UNTIL + COUNT */
str = "FREQ=YEARLY;UNTIL=20000131T090000Z;COUNT=3";
@@ -2621,7 +2717,89 @@ void test_recur_parser()
rt = icalrecurrencetype_from_string(str);
icalerror_restore("MALFORMEDDATA", es);
ok(str, rt.freq == ICAL_NO_RECURRENCE);
- free(v);
+ icalmemory_free_buffer(v);
+}
+
+static int test_juldat_caldat_instance(long year, int month, int day) {
+
+ struct icaltimetype t;
+ struct ut_instant originalInstant;
+
+ memset(&t, 0, sizeof(t));
+ t.year = year;
+ t.month = month;
+ t.day = day;
+
+ memset(&originalInstant, 0, sizeof(originalInstant));
+ originalInstant.year = year;
+ originalInstant.month = month;
+ originalInstant.day = day;
+
+ juldat(&originalInstant);
+ caldat(&originalInstant);
+
+ if (icaltime_day_of_week(t) != originalInstant.weekday + 1)
+ return -1;
+
+ if (icaltime_start_doy_week(t, 1) != originalInstant.day_of_year - originalInstant.weekday)
+ return -1;
+
+ if (icaltime_week_number(t) != (originalInstant.day_of_year - originalInstant.weekday) / 7)
+ return -1;
+
+ return 0;
+}
+
+/*
+ * This test verifies the caldat_int and juldat_int functions. The functions are reworked versions
+ * of the original caldat and juldat functions but avoid using floating point arithmetic. As the
+ * new functions are not exported, the test cannot access them directly. It therefore checks the
+ * output of the icaltime_day_of_week, icaltime_start_doy_week and icaltime_week_number functions
+ * which are based on the functions to be tested.
+ */
+void test_juldat_caldat() {
+
+ int i;
+ int failed = 0;
+
+ ok("juldat and caldat return the expected values for specified min input values", test_juldat_caldat_instance(-4713, 1, 1) == 0);
+ ok("juldat and caldat return the expected values for specified max input values", test_juldat_caldat_instance(+32767, 12, 31) == 0);
+
+ ok("juldat and caldat return the expected values before end of julian calendar", test_juldat_caldat_instance(1582, 10, 4) == 0);
+ ok("juldat and caldat return the expected values at end of julian calendar", test_juldat_caldat_instance(1582, 10, 5) == 0);
+ ok("juldat and caldat return the expected values before introduction of gregorian calendar", test_juldat_caldat_instance(1582, 10, 14) == 0);
+ ok("juldat and caldat return the expected values at introduction of gregorian calendar", test_juldat_caldat_instance(1582, 10, 15) == 0);
+ ok("juldat and caldat return the expected values after introduction of gregorian calendar", test_juldat_caldat_instance(1582, 10, 16) == 0);
+
+ for (i = 0; i < 2582; i++) {
+
+ long y = i;
+
+ failed |= (test_juldat_caldat_instance(y, 1, 1) != 0);
+ failed |= (test_juldat_caldat_instance(y, 2, 28) != 0);
+
+ // Not every year has a leap day, but juldat_int/caldat_int should still produce
+ // the same output as the original implementation.
+ failed |= (test_juldat_caldat_instance(y, 2, 29) != 0);
+ failed |= (test_juldat_caldat_instance(y, 3, 1) != 0);
+ failed |= (test_juldat_caldat_instance(y, 12, 31) != 0);
+ }
+ ok("juldat and caldat return the expected values for random input values", failed == 0);
+
+ failed = 0;
+ for (i = 0; i < 10000; i++) {
+ /* coverity[dc.weak_crypto] */
+ long y = rand() % 2582;
+ int m = rand() % 12 + 1;
+
+ // Might produce some invalid dates, but juldat_int/caldat_int should still produce
+ // the same output as the original implementation.
+ int d = rand() % 31 + 1;
+
+ failed |= (test_juldat_caldat_instance(y, m, d) != 0);
+ }
+
+ ok("juldat and caldat return the expected values for random input values", failed == 0);
}
char *ical_strstr(const char *haystack, const char *needle)
@@ -2687,7 +2865,7 @@ void test_doy()
stm.tm_year = tt1.year - 1900;
stm.tm_isdst = -1;
- (void)mktime(&stm);
+ (void)icalmktime(&stm);
doy = icaltime_day_of_year(tt1);
@@ -3269,7 +3447,7 @@ void test_file_locks()
(void)icalfileset_add_component(fs, c);
- c2 = icalcomponent_new_clone(c);
+ c2 = icalcomponent_clone(c);
(void)icalfileset_add_component(fs, c2);
@@ -3305,7 +3483,7 @@ void test_file_locks()
icalcomponent_set_duration(c, d);
icalcomponent_set_summary(c, "Child");
- c2 = icalcomponent_new_clone(c);
+ c2 = icalcomponent_clone(c);
icalcomponent_set_summary(c2, "Child");
(void)icalfileset_add_component(fs, c2);
@@ -3338,7 +3516,7 @@ void test_file_locks()
icalcomponent_set_duration(c, d);
icalcomponent_set_summary(c, "Parent");
- c2 = icalcomponent_new_clone(c);
+ c2 = icalcomponent_clone(c);
icalcomponent_set_summary(c2, "Parent");
(void)icalfileset_add_component(fs, c2);
@@ -4195,6 +4373,86 @@ void test_comma_in_quoted_value(void)
icalcomponent_free(c);
}
+void test_geo_props(void)
+{
+ int estate;
+ icalcomponent *c;
+ icalproperty *p;
+
+ c = icalparser_parse_string("BEGIN:VEVENT\n" "GEO:49.42612;7.75473\n" "END:VEVENT\n");
+ ok("icalparser_parse_string()", (c != NULL));
+ if (!c) {
+ exit(EXIT_FAILURE);
+ }
+ if (VERBOSE)
+ printf("%s", icalcomponent_as_ical_string(c));
+ p = icalcomponent_get_first_property(c, ICAL_GEO_PROPERTY);
+ str_is("icalproperty_get_value_as_string() works",
+ icalproperty_get_value_as_string(p), "49.42612;7.75473");
+ icalcomponent_free(c);
+
+ c = icalparser_parse_string("BEGIN:VEVENT\n" "GEO:-0;+0\n" "END:VEVENT\n");
+ ok("icalparser_parse_string()", (c != NULL));
+ if (!c) {
+ exit(EXIT_FAILURE);
+ }
+ if (VERBOSE)
+ printf("%s", icalcomponent_as_ical_string(c));
+ p = icalcomponent_get_first_property(c, ICAL_GEO_PROPERTY);
+ str_is("icalproperty_get_value_as_string() works",
+ icalproperty_get_value_as_string(p), "-0;+0");
+ icalcomponent_free(c);
+
+ /* failure situations */
+ estate = icalerror_get_errors_are_fatal();
+ icalerror_set_errors_are_fatal(0);
+ c = icalparser_parse_string("BEGIN:VEVENT\n" "GEO:-0a;+0\n" "END:VEVENT\n");
+ if (!c) {
+ exit(EXIT_FAILURE);
+ }
+ if (VERBOSE)
+ printf("%s", icalcomponent_as_ical_string(c));
+ p = icalcomponent_get_first_property(c, ICAL_GEO_PROPERTY);
+ ok("expected fail icalcomponent_get_first_property()", (p == NULL));
+ icalcomponent_free(c);
+
+ c = icalparser_parse_string("BEGIN:VEVENT\n" "GEO:16.815151515151515151;+0\n" "END:VEVENT\n");
+ if (!c) {
+ exit(EXIT_FAILURE);
+ }
+ if (VERBOSE)
+ printf("%s", icalcomponent_as_ical_string(c));
+ p = icalcomponent_get_first_property(c, ICAL_GEO_PROPERTY);
+ ok("expected fail icalcomponent_get_first_property()", (p == NULL));
+ icalcomponent_free(c);
+
+ icalerror_set_errors_are_fatal(estate);
+}
+
+void test_zoneinfo_stuff(void)
+{
+#if defined(HAVE_SETENV)
+ setenv("TZDIR", TEST_DATADIR, 1);
+#else
+ char tzdir[256] = {0};
+ strncat(tzdir, "TZDIR=" TEST_DATADIR, 255);
+ putenv(tzdir);
+#endif
+ icaltzutil_set_zone_directory(NULL); /*resets to empty */
+ str_is("icaltzutil_get_zone_directory by TZDIR", icaltzutil_get_zone_directory(), TEST_DATADIR);
+ icaltzutil_set_zone_directory("foo");
+ str_is("icaltzutil_get_zone_directory", icaltzutil_get_zone_directory(), "foo");
+
+ /* reset the environment */
+#if defined(HAVE_SETENV)
+ unsetenv("TZDIR");
+#else
+ strcpy(tzdir, "TZDIR=");
+ putenv(tzdir);
+#endif
+ icaltzutil_set_zone_directory(NULL);
+}
+
void test_tzid_with_utc_time(void)
{
const char *strcomp =
@@ -4455,7 +4713,7 @@ void test_timezone_from_builtin(void)
comp = icaltimezone_get_component(zone);
strcomp = icalcomponent_as_ical_string_r(comp);
comp = icalcomponent_new_from_string(strcomp);
- free(strcomp);
+ icalmemory_free_buffer(strcomp);
ok("VTIMEZONE icalcomponent_new_from_string()", (comp != NULL));
@@ -4509,6 +4767,39 @@ void test_icalvalue_decode_ical_string(void)
ok("Properly decoded", (strcmp(buff, "a\\") == 0));
}
+static int test_icalarray_sort_compare_char(const void* p1, const void* p2) {
+
+ char c1 = *((char*)p1);
+ char c2 = *((char*)p2);
+
+ return (c1 < c2) ? -1 : ((c1 > c2) ? 1 : 0);
+}
+
+void test_icalarray_sort(void)
+{
+ /* this test is based on the work from the PDCLib project */
+
+ char presort[] = { "shreicnyjqpvozxmbt" };
+ char sorted1[] = { "bcehijmnopqrstvxyz" };
+ unsigned int i;
+
+ icalarray * array = icalarray_new(1, 2);
+
+ for (i = 0; i < sizeof(presort)-1; i++) {
+ icalarray_append(array, &presort[i]);
+ }
+
+ icalarray_sort(array, test_icalarray_sort_compare_char);
+
+ for (i = 0; i < sizeof(presort)-1; i++) {
+ void* pItem = icalarray_element_at(array, i);
+ char c = *((char*)pItem);
+ ok("icalarray_sort - item sorted as expected", c == sorted1[i]);
+ }
+
+ icalarray_free(array);
+}
+
void test_icalcomponent_normalize(void)
{
const char *calStr1 =
@@ -4804,7 +5095,6 @@ static void test_implicit_dtend_duration(void)
int_is("icaltime_compare(start, end)", 0, icaltime_compare(start, end));
icalcomponent_free(c);
-
c = icalcomponent_vanew(
ICAL_VCALENDAR_COMPONENT,
icalcomponent_vanew(
@@ -4968,7 +5258,7 @@ void test_icaltime_as_timet(void)
ok("icaltime_from_string translates 19970717T235959Z to 869183999", icaltime_as_timet(icaltime_from_string("19970717T235959Z")) == 869183999);
ok("icaltime_from_string translates 20241202T235959Z to 1733183999", icaltime_as_timet(icaltime_from_string("20241202T235959Z")) == 1733183999);
ok("icaltime_from_string translates 20371231T235959Z to 2145916799", icaltime_as_timet(icaltime_from_string("20371231T235959Z")) == 2145916799);
-#if (SIZEOF_TIME_T > 4)
+#if (SIZEOF_ICALTIME_T > 4)
ok("icaltime_from_string translates 20520419T235959Z to 2597183999", icaltime_as_timet(icaltime_from_string("20520419T235959Z")) == 2597183999);
ok("icaltime_from_string translates 20790905T235959Z to 3461183999", icaltime_as_timet(icaltime_from_string("20790905T235959Z")) == 3461183999);
ok("icaltime_from_string translates 21000101T235959Z to 4102531199", icaltime_as_timet(icaltime_from_string("21000101T235959Z")) == 4102531199);
@@ -5012,6 +5302,17 @@ int main(int argc, char *argv[])
int do_header = 0;
int failed_count = 0;
+#if !defined(MEMORY_CONSISTENCY)
+ // With MEMORY_CONSISTENCY we are building the entire library using the
+ // test_* functions; therefore, no need to set them here again.
+
+ // We specify special versions of malloc et al. that perform some extra verifications.
+ // Most notably they ensure, that memory allocated with icalmemory_new_buffer() is freed
+ // using icalmemory_free() rather than using free() directly and vice versa. Failing to
+ // do so would cause the test to fail with assertions or access violations.
+ icalmemory_set_mem_alloc_funcs(&test_malloc, &test_realloc, &test_free);
+#endif
+
set_zone_directory(TEST_ZONEDIR);
icaltimezone_set_tzid_prefix(TESTS_TZID_PREFIX);
@@ -5054,6 +5355,7 @@ int main(int argc, char *argv[])
test_run("Test time parser functions", test_time_parser, do_test, do_header);
test_run("Test icaltime_as_timet", test_icaltime_as_timet, do_test, do_header);
test_run("Test time", test_time, do_test, do_header);
+ test_run("Test calculation of DOY and WD", test_juldat_caldat, do_test, do_header);
test_run("Test day of Year", test_doy, do_test, do_header);
test_run("Test duration", test_duration, do_test, do_header);
test_run("Test period", test_period, do_test, do_header);
@@ -5061,6 +5363,8 @@ int main(int argc, char *argv[])
test_run("Test day of year of week start", test_start_of_week, do_test, do_header);
test_run("Test recur parser", test_recur_parser, do_test, do_header);
test_run("Test recur", test_recur, do_test, do_header);
+ test_run("Test recur encode by_day", test_recur_encode_by_day, do_test, do_header);
+ test_run("Test recur encode by_month", test_recur_encode_by_month, do_test, do_header);
test_run("Test Recurring Events File", test_recur_file, do_test, do_header);
test_run("Test parameter bug", test_recur_parameter_bug, do_test, do_header);
test_run("Test Array Expansion", test_expand_recurrence, do_test, do_header);
@@ -5127,6 +5431,7 @@ int main(int argc, char *argv[])
do_header);
test_run("Test comma in quoted value of x property", test_comma_in_quoted_value, do_test,
do_header);
+ test_run("Test setting/unsetting zoneinfo dir", test_zoneinfo_stuff, do_test, do_header);
test_run("Test TZID with UTC time", test_tzid_with_utc_time, do_test, do_header);
test_run("Test kind_to_string", test_kind_to_string, do_test, do_header);
test_run("Test string_to_kind", test_string_to_kind, do_test, do_header);
@@ -5134,12 +5439,15 @@ int main(int argc, char *argv[])
test_run("Test timezone from builtin", test_timezone_from_builtin, do_test, do_header);
test_run("Test icalvalue_decode_ical_string", test_icalvalue_decode_ical_string, do_test, do_header);
+ test_run("Test icalarray_sort", test_icalarray_sort, do_test, do_header);
+
test_run("Test icalcomponent_normalize", test_icalcomponent_normalize, do_test, do_header);
test_run("Test builtin compat TZID", test_builtin_compat_tzid, do_test, do_header);
test_run("Test VCC vCard parse", test_vcc_vcard_parse, do_test, do_header);
test_run("Test implicit DTEND and DURATION for VEVENT and VTODO", test_implicit_dtend_duration, do_test, do_header);
test_run("Test icalvalue resets timezone on set", test_icalvalue_resets_timezone_on_set, do_test, do_header);
test_run("Test removing TZID from DUE with icalcomponent_set_due", test_remove_tzid_from_due, do_test, do_header);
+ test_run("Test geo precision", test_geo_props, do_test, do_header);
test_run("Test commas in x-property", test_comma_in_xproperty, do_test, do_header);
test_run("Test icalcomponent_vanew with lastmodified property", test_icalcomponent_with_lastmodified, do_test, do_header);
diff --git a/src/test/regression.h b/src/test/regression.h
index 9c5aab88..55531793 100644
--- a/src/test/regression.h
+++ b/src/test/regression.h
@@ -2,18 +2,10 @@
FILE: regression.c
CREATOR: eric 03 April 1999
- (C) COPYRIGHT 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
======================================================================*/
#ifndef TEST_REGRESSION_H
#define TEST_REGRESSION_H
@@ -52,7 +44,7 @@ extern "C"
void test_bdbset(void);
/* regression-utils.c */
- const char *ical_timet_string(const time_t t);
+ const char *ical_timet_string(const icaltime_t t);
const char *ictt_as_string(struct icaltimetype t);
char *icaltime_as_ctime(struct icaltimetype t);
diff --git a/src/test/stow.c b/src/test/stow.c
index 2d3e4473..dc3607a0 100644
--- a/src/test/stow.c
+++ b/src/test/stow.c
@@ -2,18 +2,9 @@
FILE: stow.c
CREATOR: eric 29 April 2000
- (C) COPYRIGHT 2000 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Initial Developer of the Original Code is Eric Busboom
======================================================================*/
@@ -303,11 +294,11 @@ icalcomponent *make_reply(icalcomponent *comp, icalproperty *return_status,
icalproperty_new_method(ICAL_METHOD_REPLY),
icalcomponent_vanew(
ICAL_VEVENT_COMPONENT,
- icalproperty_new_clone(
+ icalproperty_clone(
icalcomponent_get_first_property(inner, ICAL_DTSTAMP_PROPERTY)),
- icalproperty_new_clone(
+ icalproperty_clone(
icalcomponent_get_first_property(inner, ICAL_ORGANIZER_PROPERTY)),
- icalproperty_new_clone(
+ icalproperty_clone(
icalcomponent_get_first_property(inner, ICAL_UID_PROPERTY)),
icalproperty_new_attendee(attendee),
0),
@@ -323,7 +314,7 @@ icalcomponent *make_reply(icalcomponent *comp, icalproperty *return_status,
for (p = icalcomponent_get_first_property(inner, ICAL_REQUESTSTATUS_PROPERTY);
p != 0;
p = icalcomponent_get_next_property(inner, ICAL_REQUESTSTATUS_PROPERTY)) {
- icalcomponent_add_property(rinner, icalproperty_new_clone(p));
+ icalcomponent_add_property(rinner, icalproperty_clone(p));
}
if (return_status != 0) {
diff --git a/src/test/test-malloc.c b/src/test/test-malloc.c
new file mode 100644
index 00000000..6a29d211
--- /dev/null
+++ b/src/test/test-malloc.c
@@ -0,0 +1,178 @@
+/*======================================================================
+FILE: test-malloc.c
+
+SPDX-FileCopyrightText: 2018-2022, Markus Minichmayr <markus@tapkey.com>
+
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
+======================================================================*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "test-malloc.h"
+#include "icalerror.h"
+#if !defined(MEMORY_CONSISTENCY)
+#include "regression.h"
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+struct testmalloc_statistics global_testmalloc_statistics;
+static int global_testmalloc_remaining_attempts = -1;
+
+#define TESTMALLOC_MAGIC_NO 0x1234abcd
+struct testmalloc_hdr {
+ uint32_t magic_no;
+ size_t size;
+};
+
+struct testmalloc_hdrlayout {
+ struct testmalloc_hdr hdr;
+ int data;
+};
+
+#define TESTMALLOC_HDR_SIZE ((size_t) &((struct testmalloc_hdrlayout*) 0)->data)
+
+void *test_malloc(size_t size) {
+
+ void *block;
+ struct testmalloc_hdr *hdr;
+
+ global_testmalloc_statistics.malloc_cnt++;
+ if (global_testmalloc_remaining_attempts == 0) {
+ global_testmalloc_statistics.malloc_failed_cnt++;
+ return NULL;
+ }
+
+ block = malloc(size + TESTMALLOC_HDR_SIZE);
+ if (block == NULL) {
+ global_testmalloc_statistics.malloc_failed_cnt++;
+ return NULL;
+ }
+
+ hdr = (struct testmalloc_hdr *)block;
+ hdr->magic_no = TESTMALLOC_MAGIC_NO;
+ hdr->size = size;
+
+ global_testmalloc_statistics.mem_allocated_current += size;
+ if (global_testmalloc_statistics.mem_allocated_current > global_testmalloc_statistics.mem_allocated_max) {
+ global_testmalloc_statistics.mem_allocated_max = global_testmalloc_statistics.mem_allocated_current;
+ }
+
+ global_testmalloc_statistics.blocks_allocated++;
+
+ if (global_testmalloc_remaining_attempts > 0) {
+ global_testmalloc_remaining_attempts--;
+ }
+
+ return (void*) &((struct testmalloc_hdrlayout *) hdr)->data;
+}
+
+void *test_realloc(void *p, size_t size) {
+
+ struct testmalloc_hdr *hdr;
+ size_t old_size;
+
+ global_testmalloc_statistics.realloc_cnt++;
+ if (global_testmalloc_remaining_attempts == 0) {
+ global_testmalloc_statistics.realloc_failed_cnt++;
+ return NULL;
+ }
+
+ if (p == NULL) {
+ global_testmalloc_statistics.realloc_failed_cnt++;
+ return NULL;
+ }
+
+ hdr = (struct testmalloc_hdr *) (((uint8_t *) p) - TESTMALLOC_HDR_SIZE);
+ if (hdr->magic_no != TESTMALLOC_MAGIC_NO) {
+ global_testmalloc_statistics.realloc_failed_cnt++;
+ return NULL;
+ }
+
+ old_size = hdr->size;
+ hdr->magic_no = 0;
+
+ // cppcheck-suppress memleakOnRealloc; the mem block p passed to this function stays valid.
+ hdr = (struct testmalloc_hdr *)realloc(hdr, size + TESTMALLOC_HDR_SIZE);
+ if (hdr == NULL) {
+ global_testmalloc_statistics.realloc_failed_cnt++;
+ return NULL;
+ }
+
+ hdr->magic_no = TESTMALLOC_MAGIC_NO;
+ hdr->size = size;
+
+ global_testmalloc_statistics.mem_allocated_current += size - old_size;
+ if (global_testmalloc_statistics.mem_allocated_current > global_testmalloc_statistics.mem_allocated_max) {
+ global_testmalloc_statistics.mem_allocated_max = global_testmalloc_statistics.mem_allocated_current;
+ }
+
+ if (global_testmalloc_remaining_attempts > 0) {
+ global_testmalloc_remaining_attempts--;
+ }
+
+ return (void *) &((struct testmalloc_hdrlayout *)hdr)->data;
+}
+
+void test_free(void *p) {
+
+ struct testmalloc_hdr *hdr;
+ size_t old_size;
+
+ if (p == NULL) {
+ return;
+ }
+
+ global_testmalloc_statistics.free_cnt++;
+
+ hdr = (struct testmalloc_hdr *) (((uint8_t *) p) - TESTMALLOC_HDR_SIZE);
+
+ // The main objective of this check is to ensure, that only memory, that has been allocated via icalmemory is freed
+ // via icalmemory_free(). A side objective is to make sure, the block of memory hasn't been corrupted.
+ if (hdr->magic_no != TESTMALLOC_MAGIC_NO) {
+
+ // If we end up here, then probably either of the following happened:
+ // * The calling code tries to free a block of memory via icalmemory_free() that has been allocated outside of
+ // icalmemory, e.g. via malloc().
+ // * The header in front of the memory block being freed has been corrupted.
+
+#if !defined(MEMORY_CONSISTENCY)
+ ok("freed memory was allocated via icalmemory and has not been corrupted",
+ hdr->magic_no == TESTMALLOC_MAGIC_NO);
+#endif
+ icalerror_assert(hdr->magic_no == TESTMALLOC_MAGIC_NO,
+ "freed memory was allocated via icalmemory and has been corrupted");
+ global_testmalloc_statistics.free_failed_cnt++;
+ return;
+ }
+
+ old_size = hdr->size;
+ hdr->magic_no = 0;
+
+ free(hdr);
+
+ global_testmalloc_statistics.mem_allocated_current -= old_size;
+ global_testmalloc_statistics.blocks_allocated--;
+}
+
+void testmalloc_reset() {
+ memset(&global_testmalloc_statistics, 0, sizeof(global_testmalloc_statistics));
+ global_testmalloc_remaining_attempts = -1;
+}
+
+/** Sets the maximum number of malloc or realloc attempts that will succeed. If
+* the number is negative, no limit will be applied. */
+void testmalloc_set_max_successful_allocs(int n) {
+ global_testmalloc_remaining_attempts = n;
+}
+
+void testmalloc_get_statistics(struct testmalloc_statistics *statistics) {
+
+ if (statistics) {
+ *statistics = global_testmalloc_statistics;
+ }
+}
diff --git a/src/test/test-malloc.h b/src/test/test-malloc.h
new file mode 100644
index 00000000..636310ac
--- /dev/null
+++ b/src/test/test-malloc.h
@@ -0,0 +1,59 @@
+/*======================================================================
+FILE: test-malloc.h
+
+SPDX-FileCopyrightText: 2018-2022, Markus Minichmayr <markus@tapkey.com>
+
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
+======================================================================*/
+
+#ifndef TESTMALLOC_H
+#define TESTMALLOC_H
+
+#include <stdint.h>
+
+struct testmalloc_statistics {
+ int malloc_cnt;
+ int realloc_cnt;
+ int free_cnt;
+
+ int malloc_failed_cnt;
+ int realloc_failed_cnt;
+ int free_failed_cnt;
+
+ size_t mem_allocated_max;
+ size_t mem_allocated_current;
+ int blocks_allocated;
+};
+
+/** Allocates the specified amount of memory and returns a pointer to the allocated memory.
+ * Memory allocated using this function must be freed using test_free().
+ * The number of allocations that can be made using this function can be limited via
+ * testmalloc_set_max_successful_allocs().
+ */
+void *test_malloc(size_t size);
+
+/** Resizes the specified buffer.
+ * Can only be used with memory that has previously been allocated using test_malloc().
+ */
+void *test_realloc(void *p, size_t size);
+
+/** Frees a block of memory that has previously been allocated via the test_malloc() function. Specifying memory that
+ * has not been allocated via test_malloc() causes an assertion.
+ */
+void test_free(void *p);
+
+/** Resets the memory management statistics and sets the number of successful
+ * allocations limit to infinite.
+ */
+void testmalloc_reset();
+
+/** Sets the maximum number of malloc or realloc attempts that will succeed. If
+ * the number is negative, no limit will be applied.
+ */
+void testmalloc_set_max_successful_allocs(int n);
+
+/** Gets current memory allocation statistics. */
+void testmalloc_get_statistics(struct testmalloc_statistics *statistics);
+
+#endif /* !TESTMALLOC_H */
diff --git a/src/test/testmime.c b/src/test/testmime.c
index c9ce6a2c..2fd05cde 100644
--- a/src/test/testmime.c
+++ b/src/test/testmime.c
@@ -2,18 +2,9 @@
FILE:
CREATOR: eric 25 June 2000
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Initial Developer of the Original Code is Eric Busboom
======================================================================*/
diff --git a/src/test/testvcal.c b/src/test/testvcal.c
index 96650f44..f38df8a8 100644
--- a/src/test/testvcal.c
+++ b/src/test/testvcal.c
@@ -2,18 +2,9 @@
FILE: testvcal.c
CREATOR: eric 26 May 2000
- (C) COPYRIGHT 2000 Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000 Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
diff --git a/src/test/timezones.c b/src/test/timezones.c
index 935e912d..0285e3b5 100644
--- a/src/test/timezones.c
+++ b/src/test/timezones.c
@@ -1,18 +1,9 @@
/*
======================================================================
- (C) COPYRIGHT 2008, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2008, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
@@ -39,9 +30,9 @@ int main()
int verbose = 0;
int day;
- time_t start_time;
+ icaltime_t start_time;
struct tm start_tm;
- time_t curr_time;
+ icaltime_t curr_time;
struct tm curr_tm;
struct icaltimetype curr_tt;
int failed = 0;
@@ -82,19 +73,19 @@ int main()
* determine current local time and date: always use midday in
* the current zone and first day of first month in the year
*/
- start_time = time(NULL);
- (void)localtime_r(&start_time, &start_tm);
+ start_time = icaltime(NULL);
+ (void)icallocaltime_r(&start_time, &start_tm);
start_tm.tm_hour = 12;
start_tm.tm_min = 0;
start_tm.tm_sec = 0;
start_tm.tm_mday = 1;
start_tm.tm_mon = 0;
- start_time = mktime(&start_tm);
+ start_time = icalmktime(&start_tm);
/* check time conversion for the next 365 days */
for (day = 0, curr_time = start_time; day < 365; day++, curr_time += 24 * 60 * 60) {
/* determine date/time with glibc */
- localtime_r(&curr_time, &curr_tm);
+ icallocaltime_r(&curr_time, &curr_tm);
/* determine date/time with libical */
curr_tt = icaltime_from_timet_with_zone(curr_time, 0, utc_zone);
curr_tt.zone = utc_zone; /* workaround: icaltime_from_timet_with_zone()
@@ -114,7 +105,7 @@ int main()
if (verbose || curr_failed != failed) {
struct tm utc_tm;
- if (!gmtime_r(&curr_time, &utc_tm))
+ if (!icalgmtime_r(&curr_time, &utc_tm))
memset(&utc_tm, 0, sizeof(utc_tm));
printf(