summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cmake-format.py240
-rw-r--r--.krazy10
-rw-r--r--.pep82
-rw-r--r--.pre-commit-config.yaml19
-rw-r--r--.pylintrc625
-rw-r--r--.reuse/dep539
-rw-r--r--.travis.yml13
-rw-r--r--CMakeLists.txt454
-rw-r--r--ConfigureChecks.cmake7
-rw-r--r--Install.txt8
-rw-r--r--LICENSE.LGPL21.txt516
-rw-r--r--LICENSE.txt (renamed from LICENSE)0
-rw-r--r--LICENSES/BSD-3-Clause.txt11
-rw-r--r--LICENSES/CC0-1.0.txt121
-rw-r--r--LICENSES/LGPL-2.1-only.txt175
-rw-r--r--LICENSES/LicenseRef-APPLEMIT.txt29
-rw-r--r--LICENSES/LicenseRef-CISST.txt157
-rw-r--r--LICENSES/MPL-2.0.txt (renamed from LICENSE.MPL2.txt)0
-rw-r--r--LICENSES/Unlicense.txt10
-rw-r--r--LibIcalConfig.cmake.in3
-rw-r--r--README.md42
-rw-r--r--ReleaseNotes.txt58
-rw-r--r--appveyor.yml7
-rw-r--r--cmake/Kitware/modules/FindICU.cmake438
-rw-r--r--cmake/Kitware/modules/SelectLibraryConfigurations.cmake80
-rw-r--r--cmake/Toolchain-Linux-GCC-i686.cmake29
-rw-r--r--cmake/Toolchain-OSX-GCC-i686.cmake29
-rw-r--r--cmake/Toolchain-QNX-common.cmake (renamed from cmake/Toolchain-QNX66.cmake)30
-rw-r--r--cmake/Toolchain-QNX650-armv7.cmake (renamed from cmake/Toolchain-QNX65.cmake)24
-rw-r--r--cmake/Toolchain-QNX650-x86.cmake88
-rw-r--r--cmake/Toolchain-QNX660-armv7.cmake21
-rw-r--r--cmake/Toolchain-QNX660-common.cmake23
-rw-r--r--cmake/Toolchain-QNX660-x86.cmake21
-rw-r--r--cmake/Toolchain-QNX700-aarch64.cmake22
-rw-r--r--cmake/Toolchain-QNX700-armv7.cmake22
-rw-r--r--cmake/Toolchain-QNX700-common.cmake27
-rw-r--r--cmake/Toolchain-QNX700-x86.cmake22
-rw-r--r--cmake/Toolchain-QNX700-x86_64.cmake22
-rw-r--r--cmake/Toolchain-RPI.cmake30
-rw-r--r--cmake/Toolchain-Yocto.cmake30
-rw-r--r--cmake/Toolchain-blackberry-armv7le.cmake30
-rw-r--r--cmake/Toolchain-iMX6.cmake31
-rw-r--r--cmake/Toolchain-iOS.cmake130
-rw-r--r--cmake/Toolchain-jetson-tk1.cmake29
-rw-r--r--cmake/modules/FindBDB.cmake4
-rw-r--r--cmake/modules/FindBerkeleyDB.cmake240
-rw-r--r--cmake/modules/FindGLib.cmake5
-rw-r--r--cmake/modules/FindGObjectIntrospection.cmake8
-rw-r--r--cmake/modules/FindLibXML.cmake5
-rw-r--r--cmake/modules/FindWcecompat.cmake6
-rw-r--r--cmake/modules/GObjectIntrospectionMacros.cmake97
-rw-r--r--cmake/modules/GtkDoc.cmake56
-rw-r--r--cmake/modules/LibIcalMacrosInternal.cmake49
-rw-r--r--cmake/run_test.cmake9
-rw-r--r--config.h.cmake38
-rw-r--r--design-data/CMakeLists.txt2
-rw-r--r--design-data/components.txt5
-rw-r--r--design-data/parameters.csv26
-rw-r--r--design-data/params-in-prop.txt7
-rw-r--r--design-data/properties.csv30
-rw-r--r--design-data/restrictions.csv550
-rw-r--r--design-data/value-types.csv17
-rw-r--r--doc/CMakeLists.txt15
-rw-r--r--doc/Doxyfile.cmake70
-rw-r--r--doc/Mainpage.dox37
-rw-r--r--doc/UsingLibical.md77
-rw-r--r--doc/reference/CMakeLists.txt3
-rw-r--r--doc/reference/libical-glib/CMakeLists.txt2
-rw-r--r--examples/CMakeLists.txt9
-rw-r--r--examples/access_components.c18
-rw-r--r--examples/access_properties_and_parameters.c11
-rw-r--r--examples/changenames.pl4
-rw-r--r--examples/errors.c12
-rw-r--r--examples/main.c8
-rw-r--r--examples/parse_text.c7
-rw-r--r--libical.pc.in3
-rw-r--r--scripts/CMakeLists.txt2
-rwxr-xr-xscripts/buildtests.sh161
-rw-r--r--[-rwxr-xr-x]scripts/mkderivedcomponents.pl27
-rw-r--r--[-rwxr-xr-x]scripts/mkderivedparameters.pl10
-rw-r--r--[-rwxr-xr-x]scripts/mkderivedproperties.pl12
-rw-r--r--[-rwxr-xr-x]scripts/mkderivedvalues.pl14
-rw-r--r--[-rwxr-xr-x]scripts/mkrestrictiontable.pl44
-rw-r--r--scripts/readvaluesfile.pl56
-rw-r--r--scripts/set_compiler_env.bat3
-rwxr-xr-xscripts/setup-travis.sh3
-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.c13
-rw-r--r--src/Net-ICal-Libical/netical_wrap.doc2
-rw-r--r--src/Net-ICal-Libical/test-data/2446.mime2
-rw-r--r--src/Net-ICal-Libical/test-data/rfc2446.ics2
-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.java2
-rw-r--r--src/java/ICalProperty.java3
-rw-r--r--src/java/ICalRecurrenceType.java2
-rw-r--r--src/java/ICalTimeType.java3
-rw-r--r--src/java/ICalTriggerType.java3
-rw-r--r--src/java/ICalValue.java3
-rw-r--r--src/java/VAgenda.java3
-rw-r--r--src/java/VAlarm.java3
-rw-r--r--src/java/VCalendar.java3
-rw-r--r--src/java/VComponent.java3
-rw-r--r--src/java/VEvent.java3
-rw-r--r--src/java/VFreeBusy.java7
-rw-r--r--src/java/VQuery.java3
-rw-r--r--src/java/VToDo.java3
-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.c44
-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.c104
-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.c98
-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.h4
-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)15
-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/Makefile3
-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.txt23
-rw-r--r--src/python/ChangeLog128
-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.i195
-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.txt433
-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/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
-rw-r--r--test-data/CMakeLists.txt2
-rw-r--r--test-data/zone.tab3
-rw-r--r--uninstall.cmake.in7
373 files changed, 8620 insertions, 10978 deletions
diff --git a/.cmake-format.py b/.cmake-format.py
new file mode 100644
index 00000000..f1e33624
--- /dev/null
+++ b/.cmake-format.py
@@ -0,0 +1,240 @@
+# ----------------------------------
+# Options affecting listfile parsing
+# ----------------------------------
+with section("parse"):
+
+ # Specify structure for custom cmake functions
+ additional_commands = { 'foo': { 'flags': ['BAR', 'BAZ'],
+ 'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}}
+
+ # Override configurations per-command where available
+ override_spec = {}
+
+ # Specify variable tags.
+ vartags = []
+
+ # Specify property tags.
+ proptags = []
+
+# -----------------------------
+# Options affecting formatting.
+# -----------------------------
+with section("format"):
+
+ # Disable formatting entirely, making cmake-format a no-op
+ disable = False
+
+ # How wide to allow formatted cmake files
+ line_width = 120
+
+ # How many spaces to tab for indent
+ tab_size = 2
+
+ # If true, lines are indented using tab characters (utf-8 0x09) instead of
+ # <tab_size> space characters (utf-8 0x20). In cases where the layout would
+ # require a fractional tab character, the behavior of the fractional
+ # indentation is governed by <fractional_tab_policy>
+ use_tabchars = False
+
+ # If <use_tabchars> is True, then the value of this variable indicates how
+ # fractional indentions are handled during whitespace replacement. If set to
+ # 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set
+ # to `round-up` fractional indentation is replaced with a single tab character
+ # (utf-8 0x09) effectively shifting the column to the next tabstop
+ fractional_tab_policy = 'use-space'
+
+ # If an argument group contains more than this many sub-groups (parg or kwarg
+ # groups) then force it to a vertical layout.
+ max_subgroups_hwrap = 2
+
+ # If a positional argument group contains more than this many arguments, then
+ # force it to a vertical layout.
+ max_pargs_hwrap = 6
+
+ # If a cmdline positional group consumes more than this many lines without
+ # nesting, then invalidate the layout (and nest)
+ max_rows_cmdline = 2
+
+ # If true, separate flow control names from their parentheses with a space
+ separate_ctrl_name_with_space = False
+
+ # If true, separate function names from parentheses with a space
+ separate_fn_name_with_space = False
+
+ # If a statement is wrapped to more than one line, than dangle the closing
+ # parenthesis on its own line.
+ dangle_parens = False
+
+ # If the trailing parenthesis must be 'dangled' on its on line, then align it
+ # to this reference: `prefix`: the start of the statement, `prefix-indent`:
+ # the start of the statement, plus one indentation level, `child`: align to
+ # the column of the arguments
+ dangle_align = 'prefix'
+
+ # If the statement spelling length (including space and parenthesis) is
+ # smaller than this amount, then force reject nested layouts.
+ min_prefix_chars = 4
+
+ # If the statement spelling length (including space and parenthesis) is larger
+ # than the tab width by more than this amount, then force reject un-nested
+ # layouts.
+ max_prefix_chars = 10
+
+ # If a candidate layout is wrapped horizontally but it exceeds this many
+ # lines, then reject the layout.
+ max_lines_hwrap = 2
+
+ # What style line endings to use in the output.
+ line_ending = 'unix'
+
+ # Format command names consistently as 'lower' or 'upper' case
+ command_case = 'lower'
+
+ # Format keywords consistently as 'lower' or 'upper' case
+ keyword_case = 'upper'
+
+ # A list of command names which should always be wrapped
+ always_wrap = []
+
+ # If true, the argument lists which are known to be sortable will be sorted
+ # lexicographicall
+ enable_sort = True
+
+ # If true, the parsers may infer whether or not an argument list is sortable
+ # (without annotation).
+ autosort = False
+
+ # By default, if cmake-format cannot successfully fit everything into the
+ # desired linewidth it will apply the last, most agressive attempt that it
+ # made. If this flag is True, however, cmake-format will print error, exit
+ # with non-zero status code, and write-out nothing
+ require_valid_layout = False
+
+ # A dictionary mapping layout nodes to a list of wrap decisions. See the
+ # documentation for more information.
+ layout_passes = {}
+
+# ------------------------------------------------
+# Options affecting comment reflow and formatting.
+# ------------------------------------------------
+with section("markup"):
+
+ # What character to use for bulleted lists
+ bullet_char = '*'
+
+ # What character to use as punctuation after numerals in an enumerated list
+ enum_char = '.'
+
+ # If comment markup is enabled, don't reflow the first comment block in each
+ # listfile. Use this to preserve formatting of your copyright/license
+ # statements.
+ first_comment_is_literal = False
+
+ # If comment markup is enabled, don't reflow any comment block which matches
+ # this (regex) pattern. Default is `None` (disabled).
+ literal_comment_pattern = None
+
+ # Regular expression to match preformat fences in comments default=
+ # ``r'^\s*([`~]{3}[`~]*)(.*)$'``
+ fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$'
+
+ # Regular expression to match rulers in comments default=
+ # ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'``
+ ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$'
+
+ # If a comment line matches starts with this pattern then it is explicitly a
+ # trailing comment for the preceeding argument. Default is '#<'
+ explicit_trailing_pattern = '#<'
+
+ # If a comment line starts with at least this many consecutive hash
+ # characters, then don't lstrip() them off. This allows for lazy hash rulers
+ # where the first hash char is not separated by space
+ hashruler_min_length = 10
+
+ # If true, then insert a space between the first hash char and remaining hash
+ # chars in a hash ruler, and normalize its length to fill the column
+ canonicalize_hashrulers = True
+
+ # enable comment markup parsing and reflow
+ enable_markup = True
+
+# ----------------------------
+# Options affecting the linter
+# ----------------------------
+with section("lint"):
+
+ # a list of lint codes to disable
+ disabled_codes = []
+
+ # regular expression pattern describing valid function names
+ function_pattern = '[0-9a-z_]+'
+
+ # regular expression pattern describing valid macro names
+ macro_pattern = '[0-9a-z_]+'
+
+ # regular expression pattern describing valid names for variables with global
+ # (cache) scope
+ global_var_pattern = '[A-Z][0-9A-Z_]+'
+
+ # regular expression pattern describing valid names for variables with global
+ # scope (but internal semantic)
+ internal_var_pattern = '[A-Z][0-9A-Z_]+'
+
+ # regular expression pattern describing valid names for variables with local
+ # scope
+ local_var_pattern = '[a-z][a-z0-9_]+'
+
+ # regular expression pattern describing valid names for privatedirectory
+ # variables
+ private_var_pattern = '[0-9a-z_]+'
+
+ # regular expression pattern describing valid names for public directory
+ # variables
+ public_var_pattern = '.*'
+
+ # regular expression pattern describing valid names for function/macro
+ # arguments and loop variables.
+ argument_var_pattern = '[a-z_][a-z0-9_]+'
+
+ # regular expression pattern describing valid names for keywords used in
+ # functions or macros
+ keyword_pattern = '[A-Z][0-9A-Z_]+'
+
+ # In the heuristic for C0201, how many conditionals to match within a loop in
+ # before considering the loop a parser.
+ max_conditionals_custom_parser = 2
+
+ # Require at least this many newlines between statements
+ min_statement_spacing = 1
+
+ # Require no more than this many newlines between statements
+ max_statement_spacing = 2
+ max_returns = 6
+ max_branches = 15
+ max_arguments = 10
+ max_localvars = 15
+ max_statements = 50
+
+# -------------------------------
+# Options affecting file encoding
+# -------------------------------
+with section("encode"):
+
+ # If true, emit the unicode byte-order mark (BOM) at the start of the file
+ emit_byteorder_mark = False
+
+ # Specify the encoding of the input file. Defaults to utf-8
+ input_encoding = 'utf-8'
+
+ # Specify the encoding of the output file. Defaults to utf-8. Note that cmake
+ # only claims to support utf-8 so be careful when using anything else
+ output_encoding = 'utf-8'
+
+# -------------------------------------
+# Miscellaneous configurations options.
+# -------------------------------------
+with section("misc"):
+
+ # A dictionary containing any per-command configuration overrides. Currently
+ # only `command_case` is supported.
+ per_command = {}
diff --git a/.krazy b/.krazy
index 464591a3..ddd2a447 100644
--- a/.krazy
+++ b/.krazy
@@ -2,19 +2,21 @@ CHECKSETS foss,c++
EXCLUDE dpointer
+EXTRA copyright-reuse,license-reuse
EXTRA crud,camelcase
EXTRA style
#Skip foo_export.h
SKIP libical_.*_export\.h
+#Skip installed macro headers
+SKIP libical_deprecated\.h
#Skip examples
SKIP /examples/
#For now skip java
SKIP /java/
-#For now skip python
-SKIP /python/
+SKIP \.cmake-format\.py
#For now skip perl
SKIP /Net-ICal-Libical/
@@ -30,11 +32,11 @@ SKIP /src/libical/caldate\.c
SKIP /cmake/Kitware/
SKIP /cmake/modules/GObjectIntrospectionMacros\.cmake|/cmake/modules/FindGObjectIntrospection\.cmake
SKIP /doc/Doxyfile\.cmake
-SKIP /cmake/Toolchain-iOS.cmake|/cmake/Toolchain-QNX65.cmake|/cmake/Toolchain-QNX66.cmake|/cmake/Toolchain-android.cmake|/cmake/modules/FindBerkeleyDB.cmake
+SKIP /cmake/Toolchain-QNX|/cmake/modules/FindBerkeleyDB.cmake|/uninstall.cmake.in
#Skip zoneinfo
SKIP /zoneinfo/
-STYLE_LINEMAX 100
+STYLE_LINEMAX 120
STYLE_PYTHONSTYLE_OFFSET 4
STYLE_CMAKESTYLE_OFFSET 2
diff --git a/.pep8 b/.pep8
new file mode 100644
index 00000000..9d54e0f1
--- /dev/null
+++ b/.pep8
@@ -0,0 +1,2 @@
+[pycodestyle]
+max_line_length = 120
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a454c2ab..365a23fe 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -17,10 +17,25 @@ repos:
# rev: v13.0.0
# hooks:
# - id: clang-format
+- repo: https://github.com/PyCQA/pylint
+ rev: v2.15.4
+ hooks:
+ - id: pylint
+ exclude: ^(.cmake-format.py)
+- repo: https://github.com/pre-commit/mirrors-autopep8
+ rev: v1.7.0
+ hooks:
+ - id: autopep8
+ exclude: ^(.cmake-format.py)
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell
+- repo: https://github.com/cheshirekow/cmake-format-precommit
+ rev: v0.6.13
+ hooks:
+ - id: cmake-lint
+ exclude: (cmake/Toolchain-|.h.cmake|/Doxyfile.cmake)
- repo: https://github.com/markdownlint/markdownlint
rev: v0.12.0
hooks:
@@ -28,3 +43,7 @@ repos:
entry: mdl
language: ruby
files: \.(md|mdown|markdown)$
+- repo: https://github.com/fsfe/reuse-tool
+ rev: v1.0.0
+ hooks:
+ - id: reuse
diff --git a/.pylintrc b/.pylintrc
new file mode 100644
index 00000000..c851378a
--- /dev/null
+++ b/.pylintrc
@@ -0,0 +1,625 @@
+[MAIN]
+
+# Analyse import fallback blocks. This can be used to support both Python 2 and
+# 3 compatible code, which means that the block might have code that exists
+# only in one or another interpreter, leading to false positives when analysed.
+analyse-fallback-blocks=no
+
+# Load and enable all available extensions. Use --list-extensions to see a list
+# all available extensions.
+#enable-all-extensions=
+
+# In error mode, messages with a category besides ERROR or FATAL are
+# suppressed, and no reports are done by default. Error mode is compatible with
+# disabling specific errors.
+#errors-only=
+
+# Always return a 0 (non-error) status code, even if lint errors are found.
+# This is primarily useful in continuous integration scripts.
+#exit-zero=
+
+# A comma-separated list of package or module names from where C extensions may
+# be loaded. Extensions are loading into the active Python interpreter and may
+# run arbitrary code.
+extension-pkg-allow-list=
+
+# A comma-separated list of package or module names from where C extensions may
+# be loaded. Extensions are loading into the active Python interpreter and may
+# run arbitrary code. (This is an alternative name to extension-pkg-allow-list
+# for backward compatibility.)
+extension-pkg-whitelist=
+
+# Return non-zero exit code if any of these messages/categories are detected,
+# even if score is above --fail-under value. Syntax same as enable. Messages
+# specified are enabled, while categories only check already-enabled messages.
+fail-on=
+
+# Specify a score threshold under which the program will exit with error.
+fail-under=10
+
+# Interpret the stdin as a python script, whose filename needs to be passed as
+# the module_or_package argument.
+#from-stdin=
+
+# Files or directories to be skipped. They should be base names, not paths.
+ignore=CVS
+
+# Add files or directories matching the regular expressions patterns to the
+# ignore-list. The regex matches against paths and can be in Posix or Windows
+# format. Because '\' represents the directory delimiter on Windows systems, it
+# can't be used as an escape character.
+ignore-paths=
+
+# Files or directories matching the regular expression patterns are skipped.
+# The regex matches against base names, not paths. The default value ignores
+# Emacs file locks
+ignore-patterns=^\.#|.cmake-format.py
+
+# List of module names for which member attributes should not be checked
+# (useful for modules/projects where namespaces are manipulated during runtime
+# and thus existing member attributes cannot be deduced by static analysis). It
+# supports qualified module names, as well as Unix pattern matching.
+ignored-modules=gi
+
+# Python code to execute, usually for sys.path manipulation such as
+# pygtk.require().
+#init-hook=
+
+# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
+# number of processors available to use, and will cap the count on Windows to
+# avoid hangs.
+jobs=1
+
+# Control the amount of potential inferred values when inferring a single
+# object. This can help the performance when dealing with large functions or
+# complex, nested conditions.
+limit-inference-results=100
+
+# List of plugins (as comma separated values of python module names) to load,
+# usually to register additional checkers.
+load-plugins=
+
+# Pickle collected data for later comparisons.
+persistent=yes
+
+# Minimum Python version to use for version dependent checks. Will default to
+# the version used to run pylint.
+py-version=3.10
+
+# Discover python modules and packages in the file system subtree.
+recursive=no
+
+# When enabled, pylint would attempt to guess common misconfiguration and emit
+# user-friendly hints instead of false-positive error messages.
+suggestion-mode=yes
+
+# Allow loading of arbitrary C extensions. Extensions are imported into the
+# active Python interpreter and may run arbitrary code.
+unsafe-load-any-extension=no
+
+# In verbose mode, extra non-checker-related info will be displayed.
+#verbose=
+
+
+[REPORTS]
+
+# Python expression which should return a score less than or equal to 10. You
+# have access to the variables 'fatal', 'error', 'warning', 'refactor',
+# 'convention', and 'info' which contain the number of messages in each
+# category, as well as 'statement' which is the total number of statements
+# analyzed. This score is used by the global evaluation report (RP0004).
+evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
+
+# Template used to display messages. This is a python new-style format string
+# used to format the message information. See doc for all details.
+msg-template=
+
+# Set the output format. Available formats are text, parseable, colorized, json
+# and msvs (visual studio). You can also give a reporter class, e.g.
+# mypackage.mymodule.MyReporterClass.
+#output-format=
+
+# Tells whether to display a full report or only the messages.
+reports=no
+
+# Activate the evaluation score.
+score=yes
+
+
+[MESSAGES CONTROL]
+
+# Only show warnings with the listed confidence levels. Leave empty to show
+# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
+# UNDEFINED.
+confidence=HIGH,
+ CONTROL_FLOW,
+ INFERENCE,
+ INFERENCE_FAILURE,
+ UNDEFINED
+
+# Disable the message, report, category or checker with the given id(s). You
+# can either give multiple identifiers separated by comma (,) or put this
+# option multiple times (only on the command line, not in the configuration
+# file where it should appear only once). You can also use "--disable=all" to
+# disable everything first and then re-enable specific checks. For example, if
+# you want to run only the similarities checker, you can use "--disable=all
+# --enable=similarities". If you want to run only the classes checker, but have
+# no Warning level messages displayed, use "--disable=all --enable=classes
+# --disable=W".
+disable=raw-checker-failed,
+ bad-inline-option,
+ locally-disabled,
+ file-ignored,
+ suppressed-message,
+ useless-suppression,
+ deprecated-pragma,
+ use-symbolic-message-instead,
+ unknown-option-value,
+ R0801
+
+# Enable the message, report, category or checker with the given id(s). You can
+# either give multiple identifier separated by comma (,) or put this option
+# multiple time (only on the command line, not in the configuration file where
+# it should appear only once). See also the "--disable" option for examples.
+enable=c-extension-no-member
+
+
+[DESIGN]
+
+# List of regular expressions of class ancestor names to ignore when counting
+# public methods (see R0903)
+exclude-too-few-public-methods=
+
+# List of qualified class names to ignore when counting class parents (see
+# R0901)
+ignored-parents=
+
+# Maximum number of arguments for function / method.
+max-args=5
+
+# Maximum number of attributes for a class (see R0902).
+max-attributes=7
+
+# Maximum number of boolean expressions in an if statement (see R0916).
+max-bool-expr=5
+
+# Maximum number of branch for function / method body.
+max-branches=12
+
+# Maximum number of locals for function / method body.
+max-locals=15
+
+# Maximum number of parents for a class (see R0901).
+max-parents=7
+
+# Maximum number of public methods for a class (see R0904).
+max-public-methods=20
+
+# Maximum number of return / yield for function / method body.
+max-returns=6
+
+# Maximum number of statements in function / method body.
+max-statements=50
+
+# Minimum number of public methods for a class (see R0903).
+min-public-methods=2
+
+
+[EXCEPTIONS]
+
+# Exceptions that will emit a warning when caught.
+overgeneral-exceptions=BaseException,
+ Exception
+
+
+[FORMAT]
+
+# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
+expected-line-ending-format=
+
+# Regexp for a line that is allowed to be longer than the limit.
+ignore-long-lines=^\s*(# )?<?https?://\S+>?$
+
+# Number of spaces of indent required inside a hanging or continued line.
+indent-after-paren=4
+
+# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
+# tab).
+indent-string=' '
+
+# Maximum number of characters on a single line.
+max-line-length=120
+
+# Maximum number of lines in a module.
+max-module-lines=1000
+
+# Allow the body of a class to be on the same line as the declaration if body
+# contains single statement.
+single-line-class-stmt=no
+
+# Allow the body of an if to be on the same line as the test if there is no
+# else.
+single-line-if-stmt=no
+
+
+[IMPORTS]
+
+# List of modules that can be imported at any level, not just the top level
+# one.
+allow-any-import-level=
+
+# Allow wildcard imports from modules that define __all__.
+allow-wildcard-with-all=no
+
+# Deprecated modules which should not be used, separated by a comma.
+deprecated-modules=
+
+# Output a graph (.gv or any supported image format) of external dependencies
+# to the given file (report RP0402 must not be disabled).
+ext-import-graph=
+
+# Output a graph (.gv or any supported image format) of all (i.e. internal and
+# external) dependencies to the given file (report RP0402 must not be
+# disabled).
+import-graph=
+
+# Output a graph (.gv or any supported image format) of internal dependencies
+# to the given file (report RP0402 must not be disabled).
+int-import-graph=
+
+# Force import order to recognize a module as part of the standard
+# compatibility libraries.
+known-standard-library=
+
+# Force import order to recognize a module as part of a third party library.
+known-third-party=enchant
+
+# Couples of modules and preferred modules, separated by a comma.
+preferred-modules=
+
+
+[LOGGING]
+
+# The type of string formatting that logging methods do. `old` means using %
+# formatting, `new` is for `{}` formatting.
+logging-format-style=old
+
+# Logging modules to check that the string format arguments are in logging
+# function parameter format.
+logging-modules=logging
+
+
+[METHOD_ARGS]
+
+# List of qualified names (i.e., library.method) which require a timeout
+# parameter e.g. 'requests.api.get,requests.api.post'
+timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request
+
+
+[MISCELLANEOUS]
+
+# List of note tags to take in consideration, separated by a comma.
+notes=FIXME,
+ XXX,
+ TODO
+
+# Regular expression of note tags to take in consideration.
+notes-rgx=
+
+
+[SIMILARITIES]
+
+# Comments are removed from the similarity computation
+ignore-comments=yes
+
+# Docstrings are removed from the similarity computation
+ignore-docstrings=yes
+
+# Imports are removed from the similarity computation
+ignore-imports=yes
+
+# Signatures are removed from the similarity computation
+ignore-signatures=yes
+
+# Minimum lines number of a similarity.
+min-similarity-lines=4
+
+
+[SPELLING]
+
+# Limits count of emitted suggestions for spelling mistakes.
+max-spelling-suggestions=4
+
+# Spelling dictionary name. Available dictionaries: en (aspell), en_AG
+# (hunspell), en_AU (aspell), en_BS (hunspell), en_BW (hunspell), en_BZ
+# (hunspell), en_CA (aspell), en_DK (hunspell), en_GB (aspell), en_GH
+# (hunspell), en_HK (hunspell), en_IE (hunspell), en_IN (hunspell), en_JM
+# (hunspell), en_MW (hunspell), en_NA (hunspell), en_NG (hunspell), en_NZ
+# (hunspell), en_PH (hunspell), en_SG (hunspell), en_TT (hunspell), en_US
+# (aspell), en_ZA (hunspell), en_ZM (hunspell), en_ZW (hunspell).
+spelling-dict=
+
+# List of comma separated words that should be considered directives if they
+# appear at the beginning of a comment and should not be checked.
+spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
+
+# List of comma separated words that should not be checked.
+spelling-ignore-words=
+
+# A path to a file that contains the private dictionary; one word per line.
+spelling-private-dict-file=
+
+# Tells whether to store unknown words to the private dictionary (see the
+# --spelling-private-dict-file option) instead of raising a message.
+spelling-store-unknown-words=no
+
+
+[STRING]
+
+# This flag controls whether inconsistent-quotes generates a warning when the
+# character used as a quote delimiter is used inconsistently within a module.
+check-quote-consistency=no
+
+# This flag controls whether the implicit-str-concat should generate a warning
+# on implicit string concatenation in sequences defined over several lines.
+check-str-concat-over-line-jumps=no
+
+
+[TYPECHECK]
+
+# List of decorators that produce context managers, such as
+# contextlib.contextmanager. Add to this list to register other decorators that
+# produce valid context managers.
+contextmanager-decorators=contextlib.contextmanager
+
+# List of members which are set dynamically and missed by pylint inference
+# system, and so shouldn't trigger E1101 when accessed. Python regular
+# expressions are accepted.
+generated-members=
+
+# Tells whether to warn about missing members when the owner of the attribute
+# is inferred to be None.
+ignore-none=yes
+
+# This flag controls whether pylint should warn about no-member and similar
+# checks whenever an opaque object is returned when inferring. The inference
+# can return multiple potential results while evaluating a Python object, but
+# some branches might not be evaluated, which results in partial inference. In
+# that case, it might be useful to still emit no-member and other checks for
+# the rest of the inferred objects.
+ignore-on-opaque-inference=yes
+
+# List of symbolic message names to ignore for Mixin members.
+ignored-checks-for-mixins=no-member,
+ not-async-context-manager,
+ not-context-manager,
+ attribute-defined-outside-init
+
+# List of class names for which member attributes should not be checked (useful
+# for classes with dynamically set attributes). This supports the use of
+# qualified names.
+ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace
+
+# Show a hint with possible names when a member name was not found. The aspect
+# of finding the hint is based on edit distance.
+missing-member-hint=yes
+
+# The minimum edit distance a name should have in order to be considered a
+# similar match for a missing member name.
+missing-member-hint-distance=1
+
+# The total number of similar names that should be taken in consideration when
+# showing a hint for a missing member.
+missing-member-max-choices=1
+
+# Regex pattern to define which classes are considered mixins.
+mixin-class-rgx=.*[Mm]ixin
+
+# List of decorators that change the signature of a decorated function.
+signature-mutators=
+
+
+[VARIABLES]
+
+# List of additional names supposed to be defined in builtins. Remember that
+# you should avoid defining new builtins when possible.
+additional-builtins=
+
+# Tells whether unused global variables should be treated as a violation.
+allow-global-unused-variables=yes
+
+# List of names allowed to shadow builtins
+allowed-redefined-builtins=
+
+# List of strings which can identify a callback function by name. A callback
+# name must start or end with one of those strings.
+callbacks=cb_,
+ _cb
+
+# A regular expression matching the name of dummy variables (i.e. expected to
+# not be used).
+dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
+
+# Argument names that match this expression will be ignored.
+ignored-argument-names=_.*|^ignored_|^unused_
+
+# Tells whether we should check for unused import in __init__ files.
+init-import=no
+
+# List of qualified module names which can have objects that can redefine
+# builtins.
+redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
+
+
+[BASIC]
+
+# Naming style matching correct argument names.
+argument-naming-style=snake_case
+
+# Regular expression matching correct argument names. Overrides argument-
+# naming-style. If left empty, argument names will be checked with the set
+# naming style.
+#argument-rgx=
+
+# Naming style matching correct attribute names.
+attr-naming-style=snake_case
+
+# Regular expression matching correct attribute names. Overrides attr-naming-
+# style. If left empty, attribute names will be checked with the set naming
+# style.
+#attr-rgx=
+
+# Bad variable names which should always be refused, separated by a comma.
+bad-names=foo,
+ bar,
+ baz,
+ toto,
+ tutu,
+ tata
+
+# Bad variable names regexes, separated by a comma. If names match any regex,
+# they will always be refused
+bad-names-rgxs=
+
+# Naming style matching correct class attribute names.
+class-attribute-naming-style=any
+
+# Regular expression matching correct class attribute names. Overrides class-
+# attribute-naming-style. If left empty, class attribute names will be checked
+# with the set naming style.
+#class-attribute-rgx=
+
+# Naming style matching correct class constant names.
+class-const-naming-style=UPPER_CASE
+
+# Regular expression matching correct class constant names. Overrides class-
+# const-naming-style. If left empty, class constant names will be checked with
+# the set naming style.
+#class-const-rgx=
+
+# Naming style matching correct class names.
+class-naming-style=PascalCase
+
+# Regular expression matching correct class names. Overrides class-naming-
+# style. If left empty, class names will be checked with the set naming style.
+#class-rgx=
+
+# Naming style matching correct constant names.
+const-naming-style=camelCase
+
+# Regular expression matching correct constant names. Overrides const-naming-
+# style. If left empty, constant names will be checked with the set naming
+# style.
+#const-rgx=
+
+# Minimum line length for functions/classes that require docstrings, shorter
+# ones are exempt.
+docstring-min-length=-1
+
+# Naming style matching correct function names.
+function-naming-style=camelCase
+
+# Regular expression matching correct function names. Overrides function-
+# naming-style. If left empty, function names will be checked with the set
+# naming style.
+#function-rgx=
+
+# Good variable names which should always be accepted, separated by a comma.
+good-names=i,
+ j,
+ k,
+ ex,
+ Run,
+ _
+
+# Good variable names regexes, separated by a comma. If names match any regex,
+# they will always be accepted
+good-names-rgxs=
+
+# Include a hint for the correct naming format with invalid-name.
+include-naming-hint=no
+
+# Naming style matching correct inline iteration names.
+inlinevar-naming-style=any
+
+# Regular expression matching correct inline iteration names. Overrides
+# inlinevar-naming-style. If left empty, inline iteration names will be checked
+# with the set naming style.
+#inlinevar-rgx=
+
+# Naming style matching correct method names.
+method-naming-style=snake_case
+
+# Regular expression matching correct method names. Overrides method-naming-
+# style. If left empty, method names will be checked with the set naming style.
+#method-rgx=
+
+# Naming style matching correct module names.
+module-naming-style=snake_case
+
+# Regular expression matching correct module names. Overrides module-naming-
+# style. If left empty, module names will be checked with the set naming style.
+#module-rgx=
+
+# Colon-delimited sets of names that determine each other's naming style when
+# the name regexes allow several styles.
+name-group=
+
+# Regular expression which should only match function or class names that do
+# not require a docstring.
+no-docstring-rgx=^_
+
+# List of decorators that produce properties, such as abc.abstractproperty. Add
+# to this list to register other decorators that produce valid properties.
+# These decorators are taken in consideration only for invalid-name.
+property-classes=abc.abstractproperty
+
+# Regular expression matching correct type variable names. If left empty, type
+# variable names will be checked with the set naming style.
+#typevar-rgx=
+
+# Naming style matching correct variable names.
+variable-naming-style=camelCase
+
+# Regular expression matching correct variable names. Overrides variable-
+# naming-style. If left empty, variable names will be checked with the set
+# naming style.
+#variable-rgx=
+
+
+[CLASSES]
+
+# Warn about protected attribute access inside special methods
+check-protected-access-in-special-methods=no
+
+# List of method names used to declare (i.e. assign) instance attributes.
+defining-attr-methods=__init__,
+ __new__,
+ setUp,
+ __post_init__
+
+# List of member names, which should be excluded from the protected access
+# warning.
+exclude-protected=_asdict,
+ _fields,
+ _replace,
+ _source,
+ _make
+
+# List of valid names for the first argument in a class method.
+valid-classmethod-first-arg=cls
+
+# List of valid names for the first argument in a metaclass class method.
+valid-metaclass-classmethod-first-arg=cls
+
+
+[REFACTORING]
+
+# Maximum number of nested blocks for function / method body
+max-nested-blocks=5
+
+# Complete name of functions that never returns. When checking for
+# inconsistent-return-statements if a never returning function is called then
+# it will be considered as an explicit return statement and no message will be
+# printed.
+never-returning-functions=sys.exit,argparse.parse_error
diff --git a/.reuse/dep5 b/.reuse/dep5
new file mode 100644
index 00000000..bfa19252
--- /dev/null
+++ b/.reuse/dep5
@@ -0,0 +1,39 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: libical
+Upstream-Contact: Allen Winter <winter@kde.org>
+Source: https://github.com/libical/libical
+
+#misc documentation
+Files: AUTHORS Install.txt README.md ReleaseNotes.txt TEST THANKS TODO doc/AddingOrModifyingComponents.txt doc/UsingLibical.md examples/access-usecases.txt src/Net-ICal-Libical/README.txt src/php/README.txt src/Net-ICal-Libical/MANIFEST src/Net-ICal-Libical/netical_wrap.doc
+Copyright: Copyright Contributors to the libical project
+License: LGPL-2.1-only OR MPL-2.0
+
+#tool configuration files
+Files: .clang-tidy .cmake-format.py .codespellrc .dir-locals.el .gitignore .krazy .mdlrc .mdlrc.rb .pre-commit-config.yaml .pylintrc .pep8 .travis.yml appveyor.yml
+Copyright: Copyright Contributors to the libical project
+License: BSD-3-Clause
+
+#other not-easy-to-comment source files
+Files: src/libical-glib/ICalGLib.metadata.in src/libical-glib/tools/header-structure-boilerplate-template src/libical-glib/tools/source-structure-boilerplate-template doc/reference/libical-glib/libical-glib-docs.sgml.in src/Net-ICal-Libical/netical_wrap.c src/libical/qsort_gen.c
+Copyright: Copyright Contributors to the libical project
+License: LGPL-2.1-only OR MPL-2.0
+
+#timezones
+Files: zoneinfo/*
+Copyright: Copyright Contributors to the libical project
+License: CC0-1.0
+
+#design data
+Files: design-data/*
+Copyright: Copyright Contributors to the libical project
+License: LGPL-2.1-only OR MPL-2.0
+
+#testing data
+Files: test-data/*.ics test-data/*.vcf test-data/*.data test-data/*.tab test-data/*.txt src/test/*.ics src/test/*.out src/Net-ICal-Libical/test-data/*
+Copyright: Copyright Contributors to the libical project
+License: LGPL-2.1-only OR MPL-2.0
+
+#debian packaging
+Files: debian/*
+Copyright: Copyright Contributors to the libical project
+License: LGPL-2.1-only OR MPL-2.0
diff --git a/.travis.yml b/.travis.yml
index 98999fae..a875b8f4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,18 +1,20 @@
env:
global:
- - secure: "NlWO/NTPlOU6cowOMuPOvjAprXVwIjmpHHf9CoMR71E2c/eBFFKIHj10kXuyFwz2KihHAIExmo9OlGtGniNWobvIrVrabO3dsOSb6UGbPAQkzQiyQLKsDNQAZx3nMuWEKBtMsVRee6rd7/2uGTY4WB5Ot3VhrUYcN1FoRgQQ9gk="
+ - secure: "ChnqFkoV8/D0UVy7NTrAmjb9EIeahSTk7zUks9NjkJj6qvUZe6vRQHDYfj+5gusf/YKyF+F6ikDGOa+NAKDmu2ynVyx+LsduB8oGr1PRbeefTDS2PkBF3b3muh+KmT9Y2/sZKH25WwrfVVSruIr9SH+TJwRNl/ZPPEpH0lhk88VsK16Dxrhvm2npT1il51FVuWTNmuLoE/bVsxWeh0I1Eu2oKur3sUQNO0Vl3dKVKrzISvzWYxeEO8hvsUyOT3wElbfa5lz6ErP+E+pZRGsG0ekmmGVXuAU6EwbASbsqiged03XGq3tQucU+teUiCEuyL4ynE+UoxSfMZcqWvuQEp45ZDSPPNeLeUDEwXyvLX/ptBvd5960xZa3nRjPPA+qBYBgQz+AzErFtRLw2fXpMjZ400vlobOUpNOaleLU1NSkkNLLOIAUpWknD2weguAy0pbPCG67IGbnUCoaF6nJv4/VVQDDvOOgTTIJZwNAMh58mq5BsIscFTHkIpV6aAANsj8QLNsXUDGKCPy6Xd6qsKS0HUm2/pQFp/GUrjfkWKP4yPhjZ/57WibjumAqrLdn/H2IRHXGeQS/4nR0rqLM3k3h4+cUI2P2srywfusuxUTbOWT0nP/v11WoDRjGE8WLkxafdMlB8MDYqMQmO7REIDxpPm5ARg/KWQdXq/63q0Yk="
matrix:
include:
- os: linux
- dist: trusty
+ dist: xenial
- os: osx
env:
- PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig # needed to find homebrew's libxml2 an libffi on osx
- XML_CATALOG_FILES=/usr/local/etc/xml/catalog # homebrew installed libxml2 catalog
- EXTRA_BUILD_FLAGS="-DENABLE_GTK_DOC=false" # Disable Gtk-Doc on OSX
-before_install: ./scripts/setup-travis.sh
+before_install:
+ - ./scripts/setup-travis.sh
+ - echo -n | openssl s_client -connect https://scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
language: c
compiler:
@@ -25,11 +27,8 @@ script:
- make
- make test
+dist: xenial
addons:
- apt:
- packages:
- - cmake
- - cmake-data
coverity_scan:
project:
name: libical/libical
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5c411f4..09e37fc3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,8 @@
# This is the top-level CMakeLists.txt file for the libical project.
#
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+#
# Pass the following variables to cmake to control the build:
# (See doc/UsingLibical.md for more information)
#
@@ -33,6 +36,10 @@
# Default=false (build shared and static libs)
# Takes precedence over STATIC_ONLY
#
+# -DENABLE_LTO_BUILD=[true|false]
+# Build a link-time optimized version (requires gcc or clang)
+# Default=false (do not build a link time optimized version)
+#
# -DGOBJECT_INTROSPECTION=[true|false]
# Set to build GObject introspection "typelib" files
# Requires GObject Introspection development package (version MIN_GOBJECT_INTROSPECTION)
@@ -62,25 +69,46 @@
# Set to build using a 32bit time_t (ignored unless building with MSVC on Windows)
# Default=false (use the default size of time_t)
#
+# -DLIBICAL_ENABLE_64BIT_ICALTIME_T=[true|false]
+# Redirect icaltime_t (and related functions) to a 64-bit version of time_t rather than to the
+# C standard library time_t. Intended for use on 32-bit systems which have a 64-bit time_t
+# (such as `__time64_t` on Windows) available.
+# Default=false (use plain time_t)
+#
# -DLIBICAL_BUILD_TESTING=[true|false]
# Set to build the test suite
# Default=true
#
+# ## DO NOT USE IF YOU ARE AN END-USER. FOR THE DEVELOPERS ONLY!!
## Special CMake Options for Developers
#
-# -DABI_DUMPER=[true|false]
+# -DLIBICAL_DEVMODE_ABI_DUMPER=[true|false]
# Build for the abi-dumper (requires gcc)
# Default=false
#
-# -DADDRESS_SANITIZER=[true|false]
+# -DLIBICAL_DEVMODE_MEMORY_CONSISTENCY=[true|false]
+# Build using special memory consistency versions of malloc(), realloc() and free()
+# 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.
+# Default=false
+#
+# -DLIBICAL_DEVMODE_ADDRESS_SANITIZER=[true|false]
# Build with the address sanitizer (requires gcc or clang)
+# Default=false
#
-# -DTHREAD_SANITIZER=[true|false]
+# -DLIBICAL_DEVMODE_THREAD_SANITIZER=[true|false]
# Build with the thread sanitizer (requires gcc or clang)
+# Default=false
+#
+# -DLIBICAL_DEVMODE_UNDEFINED_SANITIZER=[true|false]
+# Build with the undefined sanitizer (requires gcc or clang)
+# Default=false
#
-cmake_minimum_required(VERSION 3.1.0) #first line, to shutup a cygwin warning
+cmake_minimum_required(VERSION 3.11.0) #first line, to shutup a cygwin warning
project(libical C) #CXX is optional for the bindings
cmake_policy(SET CMP0003 NEW)
@@ -95,11 +123,26 @@ if(POLICY CMP0074)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Kitware/modules")
#Include CMake capabilities
+include(LibIcalMacrosInternal)
include(FeatureSummary)
+# Exit for blacklisted compilers that don't support necessary C standards
+# MSVC++ < 2013 aka 1800
+set(BAD_C_MESSAGE "")
+if(MSVC)
+ if(MSVC_VERSION LESS 1800)
+ set(BAD_C_MESSAGE "MSVC 2013 or higher")
+ endif()
+endif()
+if(BAD_C_MESSAGE)
+ message(FATAL_ERROR
+ "\nSorry, ${BAD_C_MESSAGE} is required to build this software. "
+ "Please retry using a modern C compiler that supports the C99 standard."
+ )
+endif()
+
# Enable the test harness
enable_testing()
@@ -112,12 +155,12 @@ endif()
set(LIBICAL_LIB_MAJOR_VERSION "3")
set(LIBICAL_LIB_MINOR_VERSION "0")
-set(LIBICAL_LIB_PATCH_VERSION "17")
+set(LIBICAL_LIB_PATCH_VERSION "95")
set(LIBICAL_LIB_VERSION_STRING
"${LIBICAL_LIB_MAJOR_VERSION}.${LIBICAL_LIB_MINOR_VERSION}.${LIBICAL_LIB_PATCH_VERSION}"
)
-set(PROJECT_VERSION "${LIBICAL_LIB_MAJOR_VERSION}.${LIBICAL_LIB_MINOR_VERSION}")
+set(PROJECT_VERSION "3.1")
set(PROJECT_URL "https://libical.github.io/libical/")
# library build types
@@ -128,6 +171,8 @@ set(LIBRARY_TYPE SHARED)
option(WITH_CXX_BINDINGS "Build the C++ bindings." True)
if(WITH_CXX_BINDINGS)
enable_language(CXX)
+ set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(CMAKE_CXX_COMPILER)
add_definitions(-DWITH_CXX_BINDINGS)
else()
@@ -144,21 +189,14 @@ add_feature_info(
"build the C++ bindings. Requires a C++ compiler"
)
-option(STATIC_ONLY "Build static libraries only.")
-add_feature_info(
- "Option STATIC_ONLY"
- STATIC_ONLY
- "build static libraries only"
-)
+libical_option(STATIC_ONLY "Build static libraries only." False)
if(STATIC_ONLY)
set(LIBRARY_TYPE STATIC)
endif()
-option(SHARED_ONLY "Build shared (dynamic) libraries only. Takes precedence over STATIC_ONLY")
-add_feature_info(
- "Option SHARED_ONLY"
- SHARED_ONLY
- "build shared libraries only"
+libical_option(SHARED_ONLY
+ "Build shared (dynamic) libraries only. Takes precedence over STATIC_ONLY."
+ False
)
if(SHARED_ONLY)
set(STATIC_ONLY False)
@@ -195,14 +233,18 @@ endif()
# libicu is highly recommended for RSCALE support
# libicu can be found at http://www.icu-project.org
-# RSCALE info at https://tools.ietf.org/html/rfc7529
-if(NOT "$ENV{ICU_BASE}" STREQUAL "") #support the old ICU_BASE env
- set(ICU_ROOT $ENV{ICU_BASE})
+# RSCALE info at http://tools.ietf.org/html/rfc7529
+if(DEFINED ICU_BASE) #to make --warn-uninitialized happy
+ if(NOT "$ENV{ICU_BASE}" STREQUAL "") #support the old ICU_BASE env
+ set(ICU_ROOT $ENV{ICU_BASE})
+ endif()
endif()
-if(NOT "$ENV{ICU_ROOT}")
- #Use the homebrew version. MacOS provided ICU doesn't provide development files
- if(APPLE)
- set(ICU_ROOT "/usr/local/opt/icu4c")
+if(DEFINED ICU_ROOT) #to make --warn-uninitialized happy
+ if(NOT "$ENV{ICU_ROOT}")
+ #Use the homebrew version. MacOS provided ICU doesn't provide development files
+ if(APPLE)
+ set(ICU_ROOT "/usr/local/opt/icu4c")
+ endif()
endif()
endif()
find_package(ICU COMPONENTS uc i18n)
@@ -216,7 +258,6 @@ add_feature_info(
"build in RSCALE support"
)
if(ICU_FOUND)
- set(REQUIRES_PRIVATE_ICU "Requires.private: icu-i18n") #for libical.pc
set(HAVE_LIBICU 1)
if(ICU_VERSION VERSION_GREATER 50)
set(HAVE_ICU_DANGI TRUE)
@@ -235,18 +276,21 @@ if(ICU_FOUND)
get_filename_component(ICU_EXEC ${ICU_MAKECONV_EXECUTABLE} DIRECTORY)
else()
message(FATAL_ERROR
- "Unable locate the ICU runtime path. Is your ICU installation broken?")
+ "Unable to locate the ICU runtime path. Is your ICU installation broken?")
endif()
- set(ICU_BINARY_DIR ${ICU_EXEC} CACHE STRING DOC "Runtime binaries directory for the ICU library")
+ set(ICU_BINARY_DIR ${ICU_EXEC} CACHE STRING "Runtime binaries directory for the ICU library")
endif()
# compile in Berkeley DB support
-if(NOT "$ENV{BerkeleyDB_ROOT_DIR}")
- if(APPLE)
- #Use the homebrew version. Xcode's version doesn't work for us.
- set(BerkeleyDB_ROOT_DIR "/usr/local/opt/berkeley-db")
+if(DEFINED BerkeleyDB_ROOT_DIR) #to make --warn-uninitialized happy
+ if(NOT "$ENV{BerkeleyDB_ROOT_DIR}")
+ if(APPLE)
+ #Use the homebrew version. Xcode's version doesn't work for us.
+ set(BerkeleyDB_ROOT_DIR "/usr/local/opt/berkeley-db")
+ endif()
endif()
endif()
+set(BerkeleyDB_FIND_QUIETLY True)
find_package(BerkeleyDB)
set_package_properties(BerkeleyDB PROPERTIES
TYPE OPTIONAL
@@ -257,6 +301,7 @@ add_feature_info(
BerkeleyDB_FOUND
"build in support for Berkeley DB storage"
)
+set(BDB_FOUND False)
if(BerkeleyDB_FOUND)
set(HAVE_BDB True)
add_definitions(-DDB_DBM_HSEARCH=0) #set to 1 if hsearch support is needed
@@ -266,15 +311,17 @@ if(BerkeleyDB_FOUND)
set(BDB_LIBRARY ${BerkeleyDB_LIBRARIES})
endif()
+# C99 compliant compiler is required
+set(CMAKE_C_STANDARD 99)
+set(CMAKE_C_STANDARD_REQUIRED ON)
+
# MSVC specific definitions
if(WIN32)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DYY_NO_UNISTD_H)
- option(USE_32BIT_TIME_T "Build using a 32bit time_t (ignored unless building with MSVC on Windows).")
- add_feature_info(
- "Option USE_32BIT_TIME_T"
- USE_32BIT_TIME_T
- "build using 32-bit time_t"
+ libical_option(USE_32BIT_TIME_T
+ "Build using a 32bit time_t (ignored unless building with MSVC on Windows)."
+ False
)
if(USE_32BIT_TIME_T)
add_definitions(-D_USE_32BIT_TIME_T)
@@ -287,9 +334,28 @@ if(WIN32)
add_definitions(-DBIG_ENDIAN=0 -DLITTLE_ENDIAN=1 -DBYTE_ORDER=BIG_ENDIAN)
endif()
+# define icaltime_t
+libical_option(LIBICAL_ENABLE_64BIT_ICALTIME_T
+ "Redirect icaltime_t and related functions to a 64-bit version of time_t rather than to the \
+ C standard library time_t. Intended for use on 32-bit systems which have a 64-bit time_t available. \
+ May not be implemented on all platforms yet"
+ False
+)
+if(LIBICAL_ENABLE_64BIT_ICALTIME_T)
+ if(MSVC)
+ set(ICAL_ICALTIME_T_TYPE "__time64_t")
+ else()
+ message(FATAL_ERROR
+ "Option LIBICAL_ENABLE_64BIT_ICALTIME_T is not supported with this compiler or architecture.")
+ endif()
+else()
+ set(ICAL_ICALTIME_T_TYPE "time_t")
+endif()
+
# Use GNUInstallDirs
include(GNUInstallDirs)
+set(BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE STRING "User executables directory name" FORCE)
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "Library directory name" FORCE)
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING "Include directory name" FORCE)
set(SHARE_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR} CACHE STRING "Share directory name")
@@ -304,15 +370,9 @@ else()
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
endif()
-if(APPLE)
- set(CMAKE_INSTALL_NAME_DIR ${LIB_DESTINATION})
-endif()
-
-option(ICAL_ERRORS_ARE_FATAL "icalerror_* calls will abort instead of internally signaling an error.")
-add_feature_info(
- "Option ICAL_ERRORS_ARE_FATAL"
- ICAL_ERRORS_ARE_FATAL
- "icalerror_* calls will abort instead of internally signaling an error"
+libical_option(ICAL_ERRORS_ARE_FATAL
+ "icalerror_* calls will abort instead of internally signaling an error."
+ False
)
if(ICAL_ERRORS_ARE_FATAL)
set(ICAL_ERRORS_ARE_FATAL 1)
@@ -320,11 +380,9 @@ else()
set(ICAL_ERRORS_ARE_FATAL 0)
endif()
-option(ICAL_ALLOW_EMPTY_PROPERTIES "Prevent empty properties from being replaced with X-LIC-ERROR properties.")
-add_feature_info(
- "Option ICAL_ALLOW_EMPTY_PROPERTIES"
- ICAL_ALLOW_EMPTY_PROPERTIES
- "prevents empty properties from being replaced with X-LIC-ERROR properties"
+libical_option(ICAL_ALLOW_EMPTY_PROPERTIES
+ "Prevents empty properties from being replaced with X-LIC-ERROR properties."
+ False
)
if(ICAL_ALLOW_EMPTY_PROPERTIES)
set(ICAL_ALLOW_EMPTY_PROPERTIES 1)
@@ -332,18 +390,23 @@ else()
set(ICAL_ALLOW_EMPTY_PROPERTIES 0)
endif()
-option(USE_BUILTIN_TZDATA "(Careful) Build using libical's built-in timezone data, else use the system timezone data on non-Windows systems. ALWAYS true on Windows. Non-Windows users should know what they're doing if they choose not to use system provided timezone data. The libical project does not guarantee that the built-in timezone data is up-to-date.")
+if(WIN32 OR WINCE)
+ set(DEF_USE_BUILTIN_TZDATA True)
+else()
+ set(DEF_USE_BUILTIN_TZDATA False)
+endif()
+libical_option(USE_BUILTIN_TZDATA
+ "(Careful) Build using libical's built-in timezone data, else use the system timezone data on non-Windows systems. \
+ ALWAYS true on Windows. Non-Windows users should know what they're doing if they choose not to use system provided \
+ timezone data. The libical project does not guarantee that the built-in timezone data is up-to-date."
+ ${DEF_USE_BUILTIN_TZDATA}
+)
mark_as_advanced(USE_BUILTIN_TZDATA)
if(USE_BUILTIN_TZDATA)
set(USE_BUILTIN_TZDATA 1)
else()
set(USE_BUILTIN_TZDATA 0)
endif()
-add_feature_info(
- "Option USE_BUILTIN_TZDATA"
- USE_BUILTIN_TZDATA
- "use our own timezone data rather then the system timezone data"
-)
if(WIN32 OR WINCE)
#Always use builtin tzdata on Windows systems.
if(NOT USE_BUILTIN_TZDATA)
@@ -370,11 +433,10 @@ set(INSTALL_TARGETS_DEFAULT_ARGS
find_package(PkgConfig QUIET)
set(MIN_GOBJECT_INTROSPECTION "0.6.7")
-option(GOBJECT_INTROSPECTION "Build GObject introspection \"typelib\" files. Requires GObject Introspection development package ${MIN_GOBJECT_INTROSPECTION} or higher.")
-add_feature_info(
- "Option GOBJECT_INTROSPECTION"
- GOBJECT_INTROSPECTION
- "build GObject introspection \"typelib\" files"
+libical_option(GOBJECT_INTROSPECTION
+ "Build GObject introspection \"typelib\" files. \
+ Requires GObject Introspection development package ${MIN_GOBJECT_INTROSPECTION} or higher."
+ False
)
if(GOBJECT_INTROSPECTION)
if(NOT PKG_CONFIG_FOUND)
@@ -408,19 +470,7 @@ if(GOBJECT_INTROSPECTION)
endif()
endif()
-option(ICAL_BUILD_DOCS "Build documentation" True)
-add_feature_info(
- "Option ICAL_BUILD_DOCS"
- ICAL_BUILD_DOCS
- "build API documentation and reference manual"
-)
-
-option(ICAL_GLIB_VAPI "Build Vala \"vapi\" files.")
-add_feature_info(
- "Option ICAL_GLIB_VAPI"
- ICAL_GLIB_VAPI
- "build Vala \"vapi\" files"
-)
+libical_option(ICAL_GLIB_VAPI "Build Vala \"vapi\" files." False)
if(ICAL_GLIB_VAPI)
if(STATIC_ONLY)
message(FATAL_ERROR
@@ -451,13 +501,12 @@ if(ICAL_GLIB_VAPI)
endif()
endif()
-set(MIN_GLIB "2.32")
+set(MIN_GLIB "2.44")
set(MIN_LIBXML "2.7.3")
-option(ICAL_GLIB "Build libical-glib interface. Requires glib ${MIN_GLIB} and libxml ${MIN_LIBXML} development packages or higher." True)
-add_feature_info(
- "Option ICAL_GLIB"
- ICAL_GLIB
- "build libical-glib interface"
+libical_option(ICAL_GLIB
+ "Build libical-glib interface. \
+ Requires glib ${MIN_GLIB} and libxml ${MIN_LIBXML} development packages or higher."
+ True
)
if(ICAL_GLIB)
if(NOT PKG_CONFIG_FOUND)
@@ -503,97 +552,85 @@ endif()
#
# Compiler settings
#
-if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
- include(CheckCCompilerFlag)
- check_c_compiler_flag(-Wunused-but-set-variable HAVE_GCC_UNUSED_BUT_SET)
- check_c_compiler_flag(-Wlogical-op HAVE_GCC_LOGICAL_OP)
- check_c_compiler_flag(-Wsizeof-pointer-memaccess HAVE_GCC_POINTER_MEMACCESS)
- check_c_compiler_flag(-Wformat-security HAVE_GCC_FORMAT_SECURITY)
- check_c_compiler_flag(-Wredundant-decls HAVE_GCC_REDUNDANT_DECLS)
- check_c_compiler_flag(-Wunreachable-code HAVE_GCC_UNREACHABLE_CODE)
- check_c_compiler_flag(-Wvarargs HAVE_GCC_VARARGS)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -Wno-deprecated -Wall -Wno-unknown-pragmas -Wextra -Winit-self -Wunused -Wno-div-by-zero -Wundef -Wpointer-arith -Wtype-limits -Wwrite-strings -Werror=return-type")
- if(HAVE_GCC_UNUSED_BUT_SET)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-variable")
- endif()
- if(HAVE_GCC_LOGICAL_OP)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlogical-op")
- endif()
- if(HAVE_GCC_POINTER_MEMACCESS)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsizeof-pointer-memaccess")
- endif()
- if(HAVE_GCC_FORMAT_SECURITY)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat -Wformat-security")
- endif()
- if(HAVE_GCC_REDUNDANT_DECLS)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls")
- endif()
- if(HAVE_GCC_UNREACHABLE_CODE)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunreachable-code")
- endif()
- if(HAVE_GCC_VARARGS)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wvarargs")
- endif()
+set(CMAKE_C_COMPILER_IS_CLANG False)
+set(CMAKE_C_COMPILER_IS_GCC False)
+if(DEFINED CMAKE_C_COMPILER_ID)
+ if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
+ set(CMAKE_C_COMPILER_IS_CLANG True)
+ elseif("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+ set(CMAKE_C_COMPILER_IS_GCC True)
+ endif()
+endif()
+if(CMAKE_C_COMPILER_IS_GCC OR CMAKE_C_COMPILER_IS_CLANG)
+ set(CMAKE_C_FLAGS
+ "${CMAKE_C_FLAGS} -fvisibility=hidden \
+ -Wno-deprecated -Wall -Wno-unknown-pragmas -Wextra -Winit-self -Wunused -Wno-div-by-zero \
+ -Wundef -Wpointer-arith -Wtype-limits -Wwrite-strings -Werror=return-type"
+ )
+ libical_add_cflag(-Wunused-but-set-variable UNUSED_BUT_SET)
+ libical_add_cflag(-Wlogical-op LOGICAL_OP)
+ libical_add_cflag(-Wsizeof-pointer-memaccess POINTER_MEMACCESS)
+ libical_add_cflag(-Wformat-security FORMAT_SECURITY)
+ libical_add_cflag(-Wredundant-decls REDUNDANT_DECLS)
+ libical_add_cflag(-Wunreachable-code UNREACHABLE_CODE)
+ libical_add_cflag(-Wvarargs VARARGS)
if(CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE -D_GNU_SOURCE")
endif()
endif()
-if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
+if(CMAKE_C_COMPILER_IS_CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments")
endif()
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
-if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
- include(CheckCXXCompilerFlag)
- check_cxx_compiler_flag(-Wunused-but-set-variable HAVE_GXX_UNUSED_BUT_SET)
- check_cxx_compiler_flag(-Wlogical-op HAVE_GXX_LOGICAL_OP)
- check_cxx_compiler_flag(-Wsizeof-pointer-memaccess HAVE_GXX_POINTER_MEMACCESS)
- check_cxx_compiler_flag(-Wreorder HAVE_GXX_REORDER)
- check_cxx_compiler_flag(-Wformat-security HAVE_GXX_FORMAT_SECURITY)
- check_cxx_compiler_flag(-Wredundant-decls HAVE_GXX_REDUNDANT_DECLS)
- check_cxx_compiler_flag(-Wunreachable-code HAVE_GXX_UNREACHABLE_CODE)
- check_cxx_compiler_flag(-Wvarargs HAVE_GXX_VARARGS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Weffc++ -Wno-deprecated -Wall -Wextra -Woverloaded-virtual -Winit-self -Wunused -Wno-div-by-zero -Wundef -Wpointer-arith -Wtype-limits -Wwrite-strings -Werror=return-type")
- if(HAVE_GXX_UNUSED_BUT_SET)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-but-set-variable")
- endif()
- if(HAVE_GXX_LOGICAL_OP)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op")
- endif()
- if(HAVE_GXX_POINTER_MEMACCESS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsizeof-pointer-memaccess")
- endif()
- if(HAVE_GXX_REORDER)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wreorder")
- endif()
- if(HAVE_GXX_FORMAT_SECURITY)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wformat-security")
- endif()
- if(HAVE_GXX_REDUNDANT_DECLS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wredundant-decls")
- endif()
- if(HAVE_GXX_UNREACHABLE_CODE)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunreachable-code")
- endif()
- if(HAVE_GXX_VARARGS)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wvarargs")
+set(CMAKE_CXX_COMPILER_IS_CLANG False)
+set(CMAKE_CXX_COMPILER_IS_GCC False)
+if(DEFINED CMAKE_CXX_COMPILER_ID)
+ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+ set(CMAKE_CXX_COMPILER_IS_CLANG True)
+ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ set(CMAKE_CXX_COMPILER_IS_GCC True)
endif()
+endif()
+if(CMAKE_CXX_COMPILER_IS_GCC OR CMAKE_CXX_COMPILER_IS_CLANG)
+ set(CMAKE_CXX_FLAGS
+ "${CMAKE_CXX_FLAGS} -fvisibility=hidden \
+ -Weffc++ -Wno-deprecated -Wall -Wextra -Woverloaded-virtual -Winit-self -Wunused \
+ -Wno-div-by-zero -Wundef -Wpointer-arith -Wtype-limits -Wwrite-strings -Werror=return-type"
+ )
+ libical_add_cxxflag(-Wunused-but-set-variable UNUSED_BUT_SET)
+ libical_add_cxxflag(-Wlogical-op LOGICAL_OP)
+ libical_add_cxxflag(-Wsizeof-pointer-memaccess POINTER_MEMACCESS)
+ libical_add_cxxflag(-Wreorder REORDER)
+ libical_add_cxxflag(-Wformat-security FORMAT_SECURITY)
+ libical_add_cxxflag(-Wredundant-decls REDUNDANT_DECLS)
+ libical_add_cxxflag(-Wunreachable-code UNREACHABLE_CODE)
+ libical_add_cxxflag(-Wvarargs VARARGS)
if(CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE -D_GNU_SOURCE")
endif()
endif()
-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+if(CMAKE_CXX_COMPILER_IS_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+#some test programs need to know if we are using 32-bit time
+if(SIZEOF_TIME_T EQUAL 4)
+ set(USE_32BIT_TIME_T TRUE)
+endif()
+
################ Developer Options #####################
-option(ABI_DUMPER "(Developer-only) Build for abi-dumper." False)
-mark_as_advanced(ABI_DUMPER)
-if(ABI_DUMPER)
- if(CMAKE_COMPILER_IS_GNUCC)
+libical_deprecated_option(ABI_DUMPER
+ LIBICAL_DEVMODE_ABI_DUMPER
+ "(Developer-only) Build for abi-dumper."
+ False
+)
+mark_as_advanced(LIBICAL_DEVMODE_ABI_DUMPER)
+if(LIBICAL_DEVMODE_ABI_DUMPER)
+ if(CMAKE_C_COMPILER_IS_GCC)
set(CMAKE_C_FLAGS "-g -Og")
set(CMAKE_CXX_FLAGS "-g -Og")
else()
@@ -602,10 +639,24 @@ if(ABI_DUMPER)
endif()
endif()
-option(ADDRESS_SANITIZER "(Developer-only) Build with the address sanitizer." False)
-mark_as_advanced(ADDRESS_SANITIZER)
-if(ADDRESS_SANITIZER)
- if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
+libical_option(LIBICAL_DEVMODE_MEMORY_CONSISTENCY
+ "(Developer-only) Build with memory consistency functions."
+ False
+)
+if(LIBICAL_DEVMODE_MEMORY_CONSISTENCY)
+ set(CMAKE_BUILD_TYPE "Debug")
+ add_definitions(-DMEMORY_CONSISTENCY)
+endif()
+mark_as_advanced(LIBICAL_DEVMODE_MEMORY_CONSISTENCY)
+
+libical_deprecated_option(ADDRESS_SANITIZER
+ LIBICAL_DEVMODE_ADDRESS_SANITIZER
+ "(Developer-only) Build with the address sanitizer."
+ False
+)
+mark_as_advanced(LIBICAL_DEVMODE_ADDRESS_SANITIZER)
+if(LIBICAL_DEVMODE_ADDRESS_SANITIZER)
+ if(CMAKE_C_COMPILER_IS_GCC OR CMAKE_C_COMPILER_IS_CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -g -DADDRESS_SANITIZER")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g -DADDRESS_SANITIZER")
else()
@@ -628,10 +679,14 @@ if(ADDRESS_SANITIZER)
endif()
endif()
-option(THREAD_SANITIZER "(Developer-only) Build with the thread sanitizer." False)
-mark_as_advanced(THREAD_SANITIZER)
-if(THREAD_SANITIZER)
- if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
+libical_deprecated_option(THREAD_SANITIZER
+ LIBICAL_DEVMODE_THREAD_SANITIZER
+ "(Developer-only) Build with the thread sanitizer."
+ False
+)
+mark_as_advanced(LIBICAL_DEVMODE_THREAD_SANITIZER)
+if(LIBICAL_DEVMODE_THREAD_SANITIZER)
+ if(CMAKE_C_COMPILER_IS_GCC OR CMAKE_C_COMPILER_IS_CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread -O1 -g -DTHREAD_SANITIZER")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -O1 -g -DTHREAD_SANITIZER")
else()
@@ -654,17 +709,65 @@ if(THREAD_SANITIZER)
endif()
endif()
-#some test programs need to know if we are using 32-bit time
-if(SIZEOF_TIME_T EQUAL 4)
- set(USE_32BIT_TIME_T TRUE)
+libical_deprecated_option(UNDEFINED_SANITIZER
+ LIBICAL_DEVMODE_UNDEFINED_SANITIZER
+ "(Developer-only) Build with the undefined sanitizer."
+ False
+)
+mark_as_advanced(LIBICAL_DEVMODE_UNDEFINED_SANITIZER)
+if(LIBICAL_DEVMODE_UNDEFINED_SANITIZER)
+ if(CMAKE_C_COMPILER_IS_GCC OR CMAKE_C_COMPILER_IS_CLANG)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -O1 -g -DUNDEFINED_SANITIZER -lubsan")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -O1 -g -DUNDEFINED_SANITIZER -lubsan")
+ else()
+ message(FATAL_ERROR
+ "You are trying to build with the undefined sanitizer using a non-GCC or Clang compiler.")
+ endif()
+ if(GOBJECT_INTROSPECTION)
+ message(STATUS
+ "Warning: Building the undefined sanitizer with GObject Introspection is is not supported. "
+ "Turning-off GObject Introspection."
+ )
+ set(HAVE_INTROSPECTION False)
+ endif()
+ if(ICAL_GLIB)
+ message(STATUS
+ "Warning: Building the undefined sanitizer with the GObject interface is not supported. "
+ "Turning-off the GObject interface."
+ )
+ set(ICAL_GLIB False)
+ endif()
endif()
-option(LIBICAL_BUILD_TESTING "Build tests." True)
-add_feature_info(
- "Option LIBICAL_BUILD_TESTING"
- LIBICAL_BUILD_TESTING
- "build tests"
-)
+libical_option(ENABLE_LTO_BUILD "Build a link-time optimized version." False)
+if(ENABLE_LTO_BUILD)
+ if(CMAKE_C_COMPILER_IS_GCC)
+ libical_add_cflag(-flto LTO)
+ if(C_SUPPORTS_LTO)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlto-type-mismatch -fuse-linker-plugin")
+ set(CMAKE_AR "gcc-ar")
+ set(CMAKE_RANLIB "gcc-ranlib")
+ else()
+ message(FATAL_ERROR
+ "Your C compiler ${CMAKE_C_COMPILER_ID} does not support the LTO building.")
+ endif()
+ if(WITH_CXX_BINDINGS AND CMAKE_CXX_COMPILER_IS_GCC)
+ include(CheckCXXCompilerFlag)
+ libical_add_cxxflag(-flto LTO)
+ if(CXX_SUPPORTS_LTO)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlto-type-mismatch -fuse-linker-plugin")
+ else()
+ message(FATAL_ERROR
+ "Your C++ compiler ${CMAKE_CXX_COMPILER_ID} does not support LTO building.")
+ endif()
+ endif()
+ else()
+ message(FATAL_ERROR
+ "Build link-time optimization using a non-GCC compiler is currently not supported.")
+ endif()
+endif()
+
+libical_option(LIBICAL_BUILD_TESTING "Build tests." True)
################# build subdirs ########################
@@ -678,6 +781,7 @@ if(USE_BUILTIN_TZDATA)
add_subdirectory(zoneinfo)
endif()
+libical_option(ICAL_BUILD_DOCS "Build documentation" True)
if(ICAL_BUILD_DOCS)
add_subdirectory(doc) # needs to go last, for the build source files
endif()
@@ -697,7 +801,16 @@ if(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR})
else()
set(includedir "\${prefix}/include")
endif()
-set(PTHREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}")
+if(DEFINED CMAKE_THREAD_LIBS_INIT)
+ set(PTHREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}")
+else()
+ set(PTHREAD_LIBS "")
+endif()
+if(ICU_FOUND)
+ set(REQUIRES_PRIVATE_ICU "Requires.private: icu-i18n") #for libical.pc
+else()
+ set(REQUIRES_PRIVATE_ICU "")
+endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/libical.pc.in
@@ -745,6 +858,7 @@ if(NOT TARGET uninstall)
add_custom_target(uninstall
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake"
+ COMMENT "Target for uninstalling everything"
)
endif()
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index b568c10c..a7a0181a 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
include(CheckIncludeFiles)
check_include_files(byteswap.h HAVE_BYTESWAP_H)
check_include_files(dirent.h HAVE_DIRENT_H)
@@ -61,6 +64,9 @@ if(MSVC_VERSION GREATER 1899)
set(HAVE_SNPRINTF true)
endif()
+if(NOT DEFINED CMAKE_REQUIRED_LIBRARIES)
+ set(CMAKE_REQUIRED_LIBRARIES "")
+endif()
#GetNumberFormat is not implemented on wine correctly
#(see https://forum.winehq.org/viewtopic.php?t=27809) which results in
#error when building. That means if linux user has installed wine,
@@ -85,6 +91,7 @@ if(WIN32 AND MSVC AND USE_32BIT_TIME_T)
else()
check_type_size(time_t SIZEOF_TIME_T)
endif()
+check_type_size(${ICAL_ICALTIME_T_TYPE} SIZEOF_ICALTIME_T)
check_type_size(wint_t SIZEOF_WINT_T)
include(FindThreads)
diff --git a/Install.txt b/Install.txt
index 56cd64ea..5333b896 100644
--- a/Install.txt
+++ b/Install.txt
@@ -10,10 +10,12 @@ passing -DCMAKE_INSTALL_PREFIX=/install/path to cmake.
To build a debug version pass -DCMAKE_BUILD_TYPE=Debug to cmake.
To build libical you will need:
- - CMake version 3.1.0 or higher
+ - a C99-compliant C compiler (let us know if the build fails with your C compiler)
+ - a C11-compliant C compiler for libical-glib
+ - a C++11 compliant compiler for C++ bindings
+ - CMake version 3.11.0 or higher
- Perl
- libicu (not required but strongly recommended)
- - a C compiler (let us know if the build fails with your C compiler)
Building on Unix with gcc or clang:
% mkdir build
@@ -151,7 +153,7 @@ This C library can be built with bindings for these other languages:
Don't forget to set (or append to, as needed) the GI_TYPELIB_PATH environment
variable to $PREFIX/lib/girepository-1.0 (or $PREFIX/lib64/girepository-1.0).
-* There are Java, Perl, PHP and Python bindings but they are old and haven't
+* There are Java, Perl and PHP bindings but they are old and haven't
been tested in a very long time. Volunteers wanted.
== Tweaking the Library Behavior ==
diff --git a/LICENSE.LGPL21.txt b/LICENSE.LGPL21.txt
deleted file mode 100644
index eeb9f8a4..00000000
--- a/LICENSE.LGPL21.txt
+++ /dev/null
@@ -1,516 +0,0 @@
-
- Libical is Copyright (C) 2010-2017 Klaralvdalens Datakonsult AB.
-
- You may use, distribute and copy Libical under the terms of the
- GNU Lesser General Public License version 2.1, which is displayed below.
-
--------------------------------------------------------------------------
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes a de-facto standard. To achieve this, non-free programs must
-be allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at least
- three years, to give the same user the materials specified in
- Subsection 6a, above, for a charge no more than the cost of
- performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms
-of the ordinary General Public License).
-
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should
-have at least the "copyright" line and a pointer to where the full
-notice is found.
-
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- 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, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or
-your school, if any, to sign a "copyright disclaimer" for the library,
-if necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James
- Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/LICENSE b/LICENSE.txt
index b2bf441f..b2bf441f 100644
--- a/LICENSE
+++ b/LICENSE.txt
diff --git a/LICENSES/BSD-3-Clause.txt b/LICENSES/BSD-3-Clause.txt
new file mode 100644
index 00000000..086d3992
--- /dev/null
+++ b/LICENSES/BSD-3-Clause.txt
@@ -0,0 +1,11 @@
+Copyright (c) <year> <owner>.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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.
diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt
new file mode 100644
index 00000000..0e259d42
--- /dev/null
+++ b/LICENSES/CC0-1.0.txt
@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+ warranties of any kind concerning the Work, express, implied,
+ statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non
+ infringement, or the absence of latent or other defects, accuracy, or
+ the present or absence of errors, whether or not discoverable, all to
+ the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person's Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to
+ this CC0 or use of the Work.
diff --git a/LICENSES/LGPL-2.1-only.txt b/LICENSES/LGPL-2.1-only.txt
new file mode 100644
index 00000000..c9aa5301
--- /dev/null
+++ b/LICENSES/LGPL-2.1-only.txt
@@ -0,0 +1,175 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+
+Version 2.1, February 1999
+
+Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.]
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.
+
+This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
+
+When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
+
+To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
+
+For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.
+
+We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.
+
+To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
+
+Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.
+
+Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.
+
+When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
+
+We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.
+
+For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
+
+In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
+
+Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
+
+The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
+
+A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
+
+The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
+
+"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
+
+1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
+
+(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
+
+Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
+
+This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
+
+4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.
+
+If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
+
+5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
+
+However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
+
+When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
+
+If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
+
+Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
+
+6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
+
+You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
+
+ a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
+
+For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
+
+7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
+
+ b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
+
+8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
+
+10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
+
+11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
+
+14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Libraries
+
+If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).
+
+To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
+
+ one line to give the library's name and an idea of what it does.
+ Copyright (C) year name of author
+
+ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
+
+ 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in
+the library `Frob' (a library for tweaking knobs) written
+by James Random Hacker.
+
+signature of Ty Coon, 1 April 1990
+Ty Coon, President of Vice
+That's all there is to it!
diff --git a/LICENSES/LicenseRef-APPLEMIT.txt b/LICENSES/LicenseRef-APPLEMIT.txt
new file mode 100644
index 00000000..179b87f6
--- /dev/null
+++ b/LICENSES/LicenseRef-APPLEMIT.txt
@@ -0,0 +1,29 @@
+(Similar to, but predates the Apple MIT License by at least 10 years.)
+
+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.
diff --git a/LICENSES/LicenseRef-CISST.txt b/LICENSES/LicenseRef-CISST.txt
new file mode 100644
index 00000000..de00e154
--- /dev/null
+++ b/LICENSES/LicenseRef-CISST.txt
@@ -0,0 +1,157 @@
+This license applies to the cmake/Toolchain-QNX-* files only.
+
+CISST Software License Agreement
+
+Version 1.0 (October 30, 2006)
+
+PURPOSE
+
+The Johns Hopkins University's Engineering Research Center for
+Computer-Integrated Surgical Systems and Technology (CISST ERC) has
+developed a software package ("CISST") that provides C++ libraries to
+facilitate the development of computer-integrated surgery systems.
+This Software License Agreement ("Agreement") covers downloads from
+the CISST package maintained by The Johns Hopkins University ("JHU").
+If you distribute Software (as defined below) downloaded from CISST,
+all of the paragraphs of this Agreement must be included with and
+apply to such Software.
+
+Your downloading, copying, modifying, displaying, distributing or use
+of any software, documentation, and/or data from CISST (collectively,
+the "Software") constitutes acceptance of all of the terms and
+conditions of this Agreement. If you do not agree to such terms and
+conditions, you have no right to download, copy, modify, display,
+distribute or use the Software.
+
+DOWNLOADING AGREEMENT - License from JHU with Right to Sublicense
+("Software License").
+
+1. As used in this Software License, "you" means the individual
+ downloading and/or using, reproducing, modifying, displaying and/or
+ distributing the Software and the institution or entity which
+ employs or is otherwise affiliated with such individual in
+ connection therewith. The Johns Hopkins University ("JHU") hereby
+ grants you, with right to sublicense, with respect to JHU's rights
+ in the software, documentation, and data, if any, which is the
+ subject of this Software License (collectively, the "Software"), a
+ royalty-free, non-exclusive license to use, reproduce, make
+ derivative works of, display and distribute the Software, provided
+ that:
+
+ (a) you accept and adhere to all of the terms and conditions of
+ this Software License;
+
+ (b) in connection with any copy of or sublicense of all or any
+ portion of the Software, all of the terms and conditions in
+ this Software License shall appear in and shall apply to such
+ copy and such sublicense, including without limitation all
+ source and executable forms and on any user documentation that
+ includes license information, prefaced with the following
+ words: "All or portions of this licensed product have been
+ obtained under license from The Johns Hopkins University and
+ are subject to the following terms and conditions:"
+
+ (c) you preserve and maintain all applicable attributions,
+ copyright notices and licenses included in or applicable to the
+ Software;
+
+ (d) modified versions of the Software must be clearly identified
+ and marked as such, and must not be misrepresented as being the
+ original Software; and
+
+ (e) you consider making, but are under no obligation to make, the
+ source code of any of your modifications to the Software freely
+ available to others on an open source basis.
+
+2. The license granted in this Software License includes without
+ limitation the right to (i) incorporate the Software into
+ proprietary programs (subject to any restrictions applicable to
+ such programs), (ii) add your own copyright statement to your
+ modifications of the Software, and (iii) provide additional or
+ different license terms and conditions in your sublicenses of
+ modifications of the Software; provided that in each case your use,
+ reproduction or distribution of such modifications otherwise
+ complies with the conditions stated in this Software License.
+
+3. This Software License does not grant any rights with respect to
+ third party software, except those rights that JHU has been
+ authorized by a third party to grant to you, and accordingly you
+ are solely responsible for (i) obtaining any permissions from third
+ parties that you need to use, reproduce, make derivative works of,
+ display and distribute the Software, and (ii) informing your
+ sublicensees, including without limitation your end-users, of their
+ obligations to secure any such required permissions.
+
+4. The Software, as provided by JHU, was designed for research
+ purposes only and was not reviewed or approved by the Food and Drug
+ Administration or by any other agency. YOU ACKNOWLEDGE AND AGREE
+ THAT CLINICAL USE OF THE JHU SOFTWARE IS NEITHER RECOMMENDED NOR
+ ADVISED. Any modification or commercialization of the Software,
+ whether for clinical use or otherwise, is at the sole risk of the
+ party or parties engaged therein. You further agree to use,
+ reproduce, make derivative works of, display and distribute the
+ Software in compliance with all applicable governmental laws,
+ regulations and orders, including without limitation those relating
+ to export and import control.
+
+5. The Software is provided "AS IS" and neither JHU nor any
+ contributor to the software (each a "Contributor") shall have any
+ obligation to provide maintenance, support, updates, enhancements
+ or modifications thereto. JHU AND ALL CONTRIBUTORS MAKE NO WARRANTY
+ THAT ALL ERRORS, BUGS, DEFICIENCIES, DEFECTS AND MALFUNCTIONS HAVE
+ BEEN OR CAN BE ELIMINATED FROM THE SOFTWARE, AND, JHU AND ALL
+ CONTRIBUTORS SHALL IN NO EVENT BE RESPONSIBLE FOR LOSSES OF ANY
+ KIND RESULTING FROM THE USE OF THE SOFTWARE, OR ANY PART THEREOF,
+ INCLUDING, WITHOUT LIMITATION ANY LIABILITY FOR BUSINESS EXPENSE,
+ MACHINE DOWNTIME, OR DAMAGES CAUSED TO LICENSEE BY ANY ERROR, BUG,
+ DEFICIENCY, DEFECT OR MALFUNCITON. JHU AND ALL CONTRIBUTORS
+ SPECIFICALLY DISCLAIM ALL EXPRESS AND IMPLIED WARRANTIES OF ANY
+ KIND INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NON-INFRINGEMENT. IN NO EVENT SHALL JHU OR ANY CONTRIBUTOR BE
+ LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
+ EXEMPLARY OR CONSEQUENTIAL DAMAGES HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY ARISING IN ANY WAY RELATED TO THE SOFTWARE, EVEN IF
+ JHU OR ANY CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES. TO THE MAXIMUM EXTENT NOT PROHIBITED BY LAW OR REGULATION,
+ YOU FURTHER ASSUME ALL LIABILITY FOR YOUR USE, REPRODUCTION, MAKING
+ OF DERIVATIVE WORKS, DISPLAY, LICENSE OR DISTRIBUTION OF THE
+ SOFTWARE AND AGREE TO INDEMNIFY AND HOLD HARMLESS JHU AND ALL
+ CONTRIBUTORS FROM AND AGAINST ANY AND ALL CLAIMS, SUITS, ACTIONS,
+ DEMANDS AND JUDGMENTS ARISING THERE FROM.
+
+6. None of the names, logos or trademarks of JHU or any of JHU's
+ affiliates or any of the Contributors, or any funding agency, may
+ be used to endorse or promote products produced in whole or in part
+ by operation of the Software or derived from or based on the
+ Software without specific prior written permission from the
+ applicable party.
+
+7. Any use, reproduction or distribution of the Software which is not
+ in accordance with this Software License shall automatically revoke
+ all rights granted to you under this Software License.
+
+8. This Software License does not grant any rights in or to any
+ intellectual property owned by JHU or any Contributor except those
+ rights expressly granted hereunder.
+
+MISCELLANEOUS
+
+This Agreement shall be governed by and construed in accordance with
+the laws of The State of Maryland without regard to principles of
+conflicts of law. As specifically provided by MD. Anno. Code, CL,
+Section 21-104, the Parties agree that this Agreement shall not be
+governed by the Uniform Computer Information Transactions Act (UCITA)
+as adopted in Maryland under Title 21 of the Commercial Law Article of
+the Maryland Annotated Code, as amended from time to time. This
+agreement shall be governed by the common law of Maryland relating to
+written agreements, as well as other statutory provisions, other than
+UCITA which may apply, and shall be interpreted and enforced as if
+UCITA had never been adopted in Maryland. The Parties further agree
+that electronic self-help shall not be permitted under this Agreement.
+This Agreement shall supersede and replace any license terms that you
+may have agreed to previously with respect to CISST.
+
+This Software License was derived, with permission, from the 3D Slicer
+Software License Agreement, Version 1.0 (December 20, 2005), created
+by The Brigham & Women's Hospital, Inc.
diff --git a/LICENSE.MPL2.txt b/LICENSES/MPL-2.0.txt
index d0a1fa14..d0a1fa14 100644
--- a/LICENSE.MPL2.txt
+++ b/LICENSES/MPL-2.0.txt
diff --git a/LICENSES/Unlicense.txt b/LICENSES/Unlicense.txt
new file mode 100644
index 00000000..cde4ac69
--- /dev/null
+++ b/LICENSES/Unlicense.txt
@@ -0,0 +1,10 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
+
+In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
diff --git a/LibIcalConfig.cmake.in b/LibIcalConfig.cmake.in
index 9b7f7bb8..a307ee29 100644
--- a/LibIcalConfig.cmake.in
+++ b/LibIcalConfig.cmake.in
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Christophe Giboudeaux <cgiboudeaux@gmx.com>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
@PACKAGE_INIT@
set_and_check(LibIcal_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
diff --git a/README.md b/README.md
index f1634cd8..150fefa4 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
-# Libical
+# Libical — an implementation of iCalendar protocols and data formats
[![Appveyor status](https://ci.appveyor.com/api/projects/status/github/libical/libical?branch=master?svg=true)](https://ci.appveyor.com/api/projects/status/github/libical/libical)
[![Packaging status](https://repology.org/badge/tiny-repos/libical.svg)](https://repology.org/metapackage/libical)
-## Introduction
+## About
Libical — an implementation of iCalendar protocols and data formats
@@ -17,8 +17,11 @@ and protocol data units. The iCalendar specification describes how
calendar clients can communicate with calendar servers so users can
store their calendar data and arrange meetings with other users.
-Libical implements [RFC5545][], [RFC5546][], [RFC7529][]; the
-CalDav scheduling extensions in [RFC6638][]; iCalendar extensions in [RFC7986][];
+## RFCs {#rfcs}
+
+Libical implements [RFC5545][], [RFC5546][], [RFC7529][];
+the CalDav scheduling extensions in [RFC6638][];
+iCalendar extensions in [RFC7986][], [RFC9073][], [RFC9074][];
plus the iCalendar iMIP protocol in [RFC6047][].
[RFC5545]: https://tools.ietf.org/html/rfc5545
@@ -27,11 +30,8 @@ plus the iCalendar iMIP protocol in [RFC6047][].
[RFC6638]: https://tools.ietf.org/html/rfc6638
[RFC6047]: https://tools.ietf.org/html/rfc6047
[RFC7986]: https://tools.ietf.org/html/rfc7986
-
-The libical-glib API is currently unstable and can change with any release.
-Until it is considered stable, there should be defined LIBICAL_GLIB_UNSTABLE_API=1
-before including <libical-glib/libical-glib.h>, to indicate that the library user
-is aware of it and is prepared to change the calls anytime.
+[RFC9073]: https://tools.ietf.org/html/rfc9073
+[RFC9074]: https://tools.ietf.org/html/rfc9074
## License
@@ -45,8 +45,8 @@ for a copy of this license.
This dual license ensures that the library can be incorporated into
both proprietary code and GPL'd programs, and will benefit from improvements
-made by programmers in both realms. I will only accept changes into
-my version of the library if they are similarly dual-licensed.
+made by programmers in both realms. We (the libical developers) will only
+accept changes to this library if they are similarly dual-licensed.
## Building
@@ -54,20 +54,17 @@ See the top-level [Install.txt](Install.txt) file.
## Documentation
-There is rudimentary, unfinished documentation in the `doc/` directory,
-see [UsingLibical.md](doc/UsingLibical.md)
-and annotated examples in `examples/` and the test code in `src/test/`.
+Documentation is hosted at <https://libical.github.io/libical/apidocs/>.
-Additionally, progress is underway to add API documentation,
-which is available [here](https://libical.github.io/libical/apidocs/index.html)
+For a conceptual overview of the library, see [Using Libical](doc/UsingLibical.md).
+There is other rudimentary, unfinished documentation in the `doc/` directory of the
+source distribution, annotated examples in `examples/` and the test code in `src/test/`.
## Acknowledgments
-Portions of this distribution are (C) Copyright 1996 Apple Computer,
-Inc., AT&T Corp., International Business Machines Corporation and
-Siemens Rolm Communications Inc. See
-[src/libicalvcal/README.TXT](src/libicalvcal/README.txt) for
-details.
+Portions of this distribution are (C) Copyright 1996 Apple Computer,Inc., AT&T Corp.,
+International Business Machines Corporation and Siemens Rolm Communications Inc.
+See [src/libicalvcal/README.TXT](src/libicalvcal/README.txt) for details.
## Libical Users
@@ -82,8 +79,7 @@ In no particular order:
* [GNOME Notes](https://wiki.gnome.org/Apps/Notes)
* [GNOME Todo](https://wiki.gnome.org/Apps/Todo)
* and more GNOME apps...
-* KDE:
- * [Kontact](https://kontact.kde.org):
+* KDE's [Kontact Suite](https://kontact.kde.org) including:
* [Akonadi framework](https://kontact.kde.org/components/akonadi.html)
* [KOrganizer calendar and scheduling component](https://kontact.kde.org/components/korganizer.html)
* and more KDE apps...
diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt
index 0c122207..d4d2dbed 100644
--- a/ReleaseNotes.txt
+++ b/ReleaseNotes.txt
@@ -1,6 +1,59 @@
Release Highlights
==================
+Version 3.1.0 (NOT RELEASED YET):
+--------------------------------
+ * REUSE compliant licensing
+ * Requires MSVC 2013 or higher (when building on Windows with MSVC)
+ * Requires CMake v3.11.0 or higher
+ * For the C++ bindings, requires a C++11 compliant compiler
+ * The old src/python code is removed in favor of the glib-introspection generated
+ Python bindings. Requires building with -DGOBJECT_INTROSPECTION=ON
+ * New CMake option "LIBICAL_ENABLE_64BIT_ICALTIME_T" to use 64-bit time_t implementations
+ on 32-bit systems (where available and supported. Windows-only so far)
+ * libical-glib requires glib 2.38 or higher
+ * libical-glib requires a C11 compliant compiler
+ * draft-ietf-calext-eventpub-extensions-19 (RFC 9073) support added
+ * draft-ietf-calext-valarm-extensions-07 (RFC 9074) support added
+ * libical-glib API is considered stable; no longer need to define LIBICAL_GLIB_UNSTABLE_API=1
+ before including <libical-glib/libical-glib.h>
+ * Allow previous recurrence iteration
+ * Improved performance of recurrence iterators
+ * GEO property has arbitrary precision (values are internally stored as strings, not doubles)
+ * All ical*_new_clone() functions have been deprecated in favour of ical*_clone()
+ * Added support for Event Publishing (RFC 9073) and VALARM (RFC 9074) Extensions
+ * icaltzutil_get_zone_directory() can use the TZDIR environment to find system zoneinfo
+ * New publicly available functions:
+ + icalrecurrencetype_encode_day
+ + icalrecurrencetype_encode_month
+ + icaltzutil_set_zone_directory
+ + icalcomponent_clone
+ + icalproperty_clone
+ + icalparameter_clone
+ + icalvalue_clone
+ + icalcluster_clone
+ + icalrecur_iterator_prev
+ + icalcomponent_set_x_name
+ + icalcomponent_get_x_name
+ + icalcomponent_get_component_name
+ + icalcomponent_get_component_name_r
+ + ical_set_invalid_rrule_handling_setting
+ + ical_get_invalid_rrule_handling_setting
+ * Deprecated functions:
+ + caldat (replaced by internal function icaldat_int())
+ + juldat (replaced by internal function juldat_int())
+ + icalcomponent_new_clone
+ + icalproperty_new_clone
+ + icalparameter_new_clone
+ + icalvalue_new_clone
+ + icalcluster_new_clone
+ * No longer publicly available functions:
+ + icaltzutil_fetch_timezone
+ * Removed unused declarations:
+ (were in the public headers but not used at all)
+ + struct icaltimezonetype
+ + struct icaltimezonephase
+
Version 3.0.17 (UNRELEASED):
----------------------------
* Improved Android support
@@ -74,6 +127,7 @@ Version 3.0.9 (16 January 2021):
* Fix reading TZif files with empty v1 data (use v2+ whenever possible)
* Add backwards compatibility for previous TZIDs
* Built-in timezones updated to tzdata2020d
+ * icalrecurrencetype_from_string() will reject any RRULE that contains a rule-part that occurs more than once
* Fix build with newer libicu
* Fix cross-compile support in libical-glib
@@ -90,8 +144,8 @@ Version 3.0.7 (15 December 2019):
* Fix a multithreading race condition
* More fuzzification fixes
-Version 3.0.6 (14 Sep 2019):
-----------------------------
+Version 3.0.6 (14 Sept 2019):
+-----------------------------
* Handle both COUNT and UNTIL in RRULEs
* Fix RRULE BYDAY with INTERVAL=2 conflict
* Various fuzzification fixes
diff --git a/appveyor.yml b/appveyor.yml
index 3ab7db24..89a35591 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -43,7 +43,7 @@ configuration:
- Debug
install:
- - sh: if [ "`uname -s`" = "Darwin" ]; then export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig; export XML_CATALOG_FILES=/usr/local/etc/xml/catalog; rm -f /usr/local/include/X11; brew install pkg-config ninja gtk-doc glib libxml2 icu4c berkeley-db gobject-introspection vala; else sudo apt-get -y install gtk-doc-tools xml-core libdb-dev gobject-introspection libgirepository1.0-dev valac; fi
+ - sh: if [ "`uname -s`" = "Darwin" ]; then export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig; export XML_CATALOG_FILES=/usr/local/etc/xml/catalog; rm -f /usr/local/include/X11; brew install pkg-config ninja gtk-doc glib libxml2 icu4c berkeley-db; else sudo apt-get -y install gtk-doc-tools xml-core libdb-dev gobject-introspection libgirepository1.0-dev valac; fi
before_build:
- cmd: call scripts\set_compiler_env.bat
@@ -51,8 +51,9 @@ before_build:
build_script:
- mkdir build
- cd build
- - cmd: cmake -G Ninja -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DLIBICAL_BUILD_TESTING=True -DENABLE_GTK_DOC=True -DICAL_GLIB=False ..
- - sh: if [ "`uname -s`" = "Darwin" ]; then BUILD_EXTRAS="False"; else BUILD_EXTRAS="True"; fi; cmake -G Ninja -DCMAKE_BUILD_TYPE=$CONFIGURATION -DLIBICAL_BUILD_TESTING=True -DENABLE_GTK_DOC=True -DICAL_GLIB=True -DGOBJECT_INTROSPECTION=$BUILD_EXTRAS -DICAL_GLIB_VAPI=$BUILD_EXTRAS ..
+ - cmd: cmake --warn-uninitialized -Werror=dev -G Ninja -DLIBICAL_DEVMODE_MEMORY_CONSISTENCY=True -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DLIBICAL_BUILD_TESTING=True -DENABLE_GTK_DOC=True -DICAL_GLIB=False ..
+ - sh: if [ "`uname -s`" = "Darwin" ]; then cmake --warn-uninitialized -Werror=dev -G Ninja -DLIBICAL_DEVMODE_MEMORY_CONSISTENCY=True -DCMAKE_BUILD_TYPE=$CONFIGURATION -DLIBICAL_BUILD_TESTING=True -DENABLE_GTK_DOC=True -DICAL_GLIB=True -DGOBJECT_INTROSPECTION=False -DICAL_GLIB_VAPI=False ..; else cmake --warn-uninitialized -Werror=dev -G Ninja -DLIBICAL_DEVMODE_MEMORY_CONSISTENCY=False -DCMAKE_BUILD_TYPE=$CONFIGURATION -DLIBICAL_BUILD_TESTING=True -DENABLE_GTK_DOC=True -DICAL_GLIB=True -DGOBJECT_INTROSPECTION=True -DICAL_GLIB_VAPI=True ..; fi;
+
- cmake --build .
- cmd: cmake --build . --target install
- sh: sudo cmake --build . --target install
diff --git a/cmake/Kitware/modules/FindICU.cmake b/cmake/Kitware/modules/FindICU.cmake
deleted file mode 100644
index 4fa16bf1..00000000
--- a/cmake/Kitware/modules/FindICU.cmake
+++ /dev/null
@@ -1,438 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#[=======================================================================[.rst:
-FindICU
--------
-
-.. versionadded:: 3.7
-
-Find the International Components for Unicode (ICU) libraries and
-programs.
-
-This module supports multiple components.
-Components can include any of: ``data``, ``i18n``, ``io``, ``le``,
-``lx``, ``test``, ``tu`` and ``uc``.
-
-Note that on Windows ``data`` is named ``dt`` and ``i18n`` is named
-``in``; any of the names may be used, and the appropriate
-platform-specific library name will be automatically selected.
-
-.. versionadded:: 3.11
- Added support for static libraries on Windows.
-
-This module reports information about the ICU installation in
-several variables. General variables::
-
- ICU_VERSION - ICU release version
- ICU_FOUND - true if the main programs and libraries were found
- ICU_LIBRARIES - component libraries to be linked
- ICU_INCLUDE_DIRS - the directories containing the ICU headers
-
-Imported targets::
-
- ICU::<C>
-
-Where ``<C>`` is the name of an ICU component, for example
-``ICU::i18n``; ``<C>`` is lower-case.
-
-ICU programs are reported in::
-
- ICU_GENCNVAL_EXECUTABLE - path to gencnval executable
- ICU_ICUINFO_EXECUTABLE - path to icuinfo executable
- ICU_GENBRK_EXECUTABLE - path to genbrk executable
- ICU_ICU-CONFIG_EXECUTABLE - path to icu-config executable
- ICU_GENRB_EXECUTABLE - path to genrb executable
- ICU_GENDICT_EXECUTABLE - path to gendict executable
- ICU_DERB_EXECUTABLE - path to derb executable
- ICU_PKGDATA_EXECUTABLE - path to pkgdata executable
- ICU_UCONV_EXECUTABLE - path to uconv executable
- ICU_GENCFU_EXECUTABLE - path to gencfu executable
- ICU_MAKECONV_EXECUTABLE - path to makeconv executable
- ICU_GENNORM2_EXECUTABLE - path to gennorm2 executable
- ICU_GENCCODE_EXECUTABLE - path to genccode executable
- ICU_GENSPREP_EXECUTABLE - path to gensprep executable
- ICU_ICUPKG_EXECUTABLE - path to icupkg executable
- ICU_GENCMN_EXECUTABLE - path to gencmn executable
-
-ICU component libraries are reported in::
-
- ICU_<C>_FOUND - ON if component was found; ``<C>`` is upper-case.
- ICU_<C>_LIBRARIES - libraries for component; ``<C>`` is upper-case.
-
-ICU datafiles are reported in::
-
- ICU_MAKEFILE_INC - Makefile.inc
- ICU_PKGDATA_INC - pkgdata.inc
-
-This module reads hints about search results from::
-
- ICU_ROOT - the root of the ICU installation
-
-The environment variable ``ICU_ROOT`` may also be used; the
-ICU_ROOT variable takes precedence.
-
-The following cache variables may also be set::
-
- ICU_<P>_EXECUTABLE - the path to executable <P>; ``<P>`` is upper-case.
- ICU_INCLUDE_DIR - the directory containing the ICU headers
- ICU_<C>_LIBRARY - the library for component <C>; ``<C>`` is upper-case.
-
-.. note::
-
- In most cases none of the above variables will require setting,
- unless multiple ICU versions are available and a specific version
- is required.
-
-Other variables one may set to control this module are::
-
- ICU_DEBUG - Set to ON to enable debug output from FindICU.
-#]=======================================================================]
-
-# Written by Roger Leigh <rleigh@codelibre.net>
-
-set(icu_programs
- gencnval
- icuinfo
- genbrk
- icu-config
- genrb
- gendict
- derb
- pkgdata
- uconv
- gencfu
- makeconv
- gennorm2
- genccode
- gensprep
- icupkg
- gencmn)
-
-set(icu_data
- Makefile.inc
- pkgdata.inc)
-
-# The ICU checks are contained in a function due to the large number
-# of temporary variables needed.
-function(_ICU_FIND)
- # Set up search paths, taking compiler into account. Search ICU_ROOT,
- # with ICU_ROOT in the environment as a fallback if unset.
- if(ICU_ROOT)
- list(APPEND icu_roots "${ICU_ROOT}")
- else()
- if(NOT "$ENV{ICU_ROOT}" STREQUAL "")
- file(TO_CMAKE_PATH "$ENV{ICU_ROOT}" NATIVE_PATH)
- list(APPEND icu_roots "${NATIVE_PATH}")
- set(ICU_ROOT "${NATIVE_PATH}"
- CACHE PATH "Location of the ICU installation" FORCE)
- endif()
- endif()
-
- # Find include directory
- list(APPEND icu_include_suffixes "include")
- find_path(ICU_INCLUDE_DIR
- NAMES "unicode/utypes.h"
- HINTS ${icu_roots}
- PATH_SUFFIXES ${icu_include_suffixes}
- DOC "ICU include directory")
- set(ICU_INCLUDE_DIR "${ICU_INCLUDE_DIR}" PARENT_SCOPE)
-
- # Get version
- if(ICU_INCLUDE_DIR AND EXISTS "${ICU_INCLUDE_DIR}/unicode/uvernum.h")
- file(STRINGS "${ICU_INCLUDE_DIR}/unicode/uvernum.h" icu_header_str
- REGEX "^#define[\t ]+U_ICU_VERSION[\t ]+\".*\".*")
-
- string(REGEX REPLACE "^#define[\t ]+U_ICU_VERSION[\t ]+\"([^ \\n]*)\".*"
- "\\1" icu_version_string "${icu_header_str}")
- set(ICU_VERSION "${icu_version_string}")
- set(ICU_VERSION "${icu_version_string}" PARENT_SCOPE)
- unset(icu_header_str)
- unset(icu_version_string)
- endif()
-
- if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- # 64-bit binary directory
- set(_bin64 "bin64")
- # 64-bit library directory
- set(_lib64 "lib64")
- endif()
-
-
- # Find all ICU programs
- list(APPEND icu_binary_suffixes "${_bin64}" "bin" "sbin")
- foreach(program ${icu_programs})
- string(TOUPPER "${program}" program_upcase)
- set(cache_var "ICU_${program_upcase}_EXECUTABLE")
- set(program_var "ICU_${program_upcase}_EXECUTABLE")
- find_program("${cache_var}"
- NAMES "${program}"
- HINTS ${icu_roots}
- PATH_SUFFIXES ${icu_binary_suffixes}
- DOC "ICU ${program} executable"
- NO_PACKAGE_ROOT_PATH
- )
- mark_as_advanced(cache_var)
- set("${program_var}" "${${cache_var}}" PARENT_SCOPE)
- endforeach()
-
- # Find all ICU libraries
- list(APPEND icu_library_suffixes "${_lib64}" "lib")
- set(ICU_REQUIRED_LIBS_FOUND ON)
- set(static_prefix )
- # static icu libraries compiled with MSVC have the prefix 's'
- if(MSVC)
- set(static_prefix "s")
- endif()
- foreach(component ${ICU_FIND_COMPONENTS})
- string(TOUPPER "${component}" component_upcase)
- set(component_cache "ICU_${component_upcase}_LIBRARY")
- set(component_cache_release "${component_cache}_RELEASE")
- set(component_cache_debug "${component_cache}_DEBUG")
- set(component_found "ICU_${component_upcase}_FOUND")
- set(component_found_compat "${component_upcase}_FOUND")
- set(component_libnames "icu${component}")
- set(component_debug_libnames "icu${component}d")
-
- # Special case deliberate library naming mismatches between Unix
- # and Windows builds
- unset(component_libnames)
- unset(component_debug_libnames)
- list(APPEND component_libnames "icu${component}")
- list(APPEND component_debug_libnames "icu${component}d")
- if(component STREQUAL "data")
- list(APPEND component_libnames "icudt")
- # Note there is no debug variant at present
- list(APPEND component_debug_libnames "icudtd")
- endif()
- if(component STREQUAL "dt")
- list(APPEND component_libnames "icudata")
- # Note there is no debug variant at present
- list(APPEND component_debug_libnames "icudatad")
- endif()
- if(component STREQUAL "i18n")
- list(APPEND component_libnames "icuin")
- list(APPEND component_debug_libnames "icuind")
- endif()
- if(component STREQUAL "in")
- list(APPEND component_libnames "icui18n")
- list(APPEND component_debug_libnames "icui18nd")
- endif()
-
- if(static_prefix)
- unset(static_component_libnames)
- unset(static_component_debug_libnames)
- foreach(component_libname ${component_libnames})
- list(APPEND static_component_libnames
- ${static_prefix}${component_libname})
- endforeach()
- foreach(component_libname ${component_debug_libnames})
- list(APPEND static_component_debug_libnames
- ${static_prefix}${component_libname})
- endforeach()
- list(APPEND component_libnames ${static_component_libnames})
- list(APPEND component_debug_libnames ${static_component_debug_libnames})
- endif()
- find_library("${component_cache_release}"
- NAMES ${component_libnames}
- HINTS ${icu_roots}
- PATH_SUFFIXES ${icu_library_suffixes}
- DOC "ICU ${component} library (release)"
- NO_PACKAGE_ROOT_PATH
- )
- find_library("${component_cache_debug}"
- NAMES ${component_debug_libnames}
- HINTS ${icu_roots}
- PATH_SUFFIXES ${icu_library_suffixes}
- DOC "ICU ${component} library (debug)"
- NO_PACKAGE_ROOT_PATH
- )
- include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
- select_library_configurations(ICU_${component_upcase})
- mark_as_advanced("${component_cache_release}" "${component_cache_debug}")
- if(${component_cache})
- set("${component_found}" ON)
- set("${component_found_compat}" ON)
- list(APPEND ICU_LIBRARY "${${component_cache}}")
- endif()
- mark_as_advanced("${component_found}")
- mark_as_advanced("${component_found_compat}")
- set("${component_cache}" "${${component_cache}}" PARENT_SCOPE)
- set("${component_found}" "${${component_found}}" PARENT_SCOPE)
- set("${component_found_compat}" "${${component_found_compat}}" PARENT_SCOPE)
- if(component_found OR component_found_compat)
- if (ICU_FIND_REQUIRED_${component})
- list(APPEND ICU_LIBS_FOUND "${component} (required)")
- else()
- list(APPEND ICU_LIBS_FOUND "${component} (optional)")
- endif()
- else()
- if (ICU_FIND_REQUIRED_${component})
- set(ICU_REQUIRED_LIBS_FOUND OFF)
- list(APPEND ICU_LIBS_NOTFOUND "${component} (required)")
- else()
- list(APPEND ICU_LIBS_NOTFOUND "${component} (optional)")
- endif()
- endif()
- endforeach()
- set(_ICU_REQUIRED_LIBS_FOUND "${ICU_REQUIRED_LIBS_FOUND}" PARENT_SCOPE)
- set(ICU_LIBRARY "${ICU_LIBRARY}" PARENT_SCOPE)
-
- # Find all ICU data files
- if(CMAKE_LIBRARY_ARCHITECTURE)
- list(APPEND icu_data_suffixes
- "${_lib64}/${CMAKE_LIBRARY_ARCHITECTURE}/icu/${ICU_VERSION}"
- "lib/${CMAKE_LIBRARY_ARCHITECTURE}/icu/${ICU_VERSION}"
- "${_lib64}/${CMAKE_LIBRARY_ARCHITECTURE}/icu"
- "lib/${CMAKE_LIBRARY_ARCHITECTURE}/icu")
- endif()
- list(APPEND icu_data_suffixes
- "${_lib64}/icu/${ICU_VERSION}"
- "lib/icu/${ICU_VERSION}"
- "${_lib64}/icu"
- "lib/icu")
- foreach(data ${icu_data})
- string(TOUPPER "${data}" data_upcase)
- string(REPLACE "." "_" data_upcase "${data_upcase}")
- set(cache_var "ICU_${data_upcase}")
- set(data_var "ICU_${data_upcase}")
- find_file("${cache_var}"
- NAMES "${data}"
- HINTS ${icu_roots}
- PATH_SUFFIXES ${icu_data_suffixes}
- DOC "ICU ${data} data file")
- mark_as_advanced(cache_var)
- set("${data_var}" "${${cache_var}}" PARENT_SCOPE)
- endforeach()
-
- if(NOT ICU_FIND_QUIETLY)
- if(ICU_LIBS_FOUND)
- message(STATUS "Found the following ICU libraries:")
- foreach(found ${ICU_LIBS_FOUND})
- message(STATUS " ${found}")
- endforeach()
- endif()
- if(ICU_LIBS_NOTFOUND)
- message(STATUS "The following ICU libraries were not found:")
- foreach(notfound ${ICU_LIBS_NOTFOUND})
- message(STATUS " ${notfound}")
- endforeach()
- endif()
- endif()
-
- if(ICU_DEBUG)
- message(STATUS "--------FindICU.cmake search debug--------")
- message(STATUS "ICU binary path search order: ${icu_roots}")
- message(STATUS "ICU include path search order: ${icu_roots}")
- message(STATUS "ICU library path search order: ${icu_roots}")
- message(STATUS "----------------")
- endif()
-endfunction()
-
-_ICU_FIND()
-
-#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ICU
- FOUND_VAR ICU_FOUND
- REQUIRED_VARS ICU_INCLUDE_DIR
- ICU_LIBRARY
- _ICU_REQUIRED_LIBS_FOUND
- VERSION_VAR ICU_VERSION
- FAIL_MESSAGE "Failed to find all ICU components")
-
-unset(_ICU_REQUIRED_LIBS_FOUND)
-
-if(ICU_FOUND)
- set(ICU_INCLUDE_DIRS "${ICU_INCLUDE_DIR}")
- set(ICU_LIBRARIES "${ICU_LIBRARY}")
- foreach(_ICU_component ${ICU_FIND_COMPONENTS})
- string(TOUPPER "${_ICU_component}" _ICU_component_upcase)
- set(_ICU_component_cache "ICU_${_ICU_component_upcase}_LIBRARY")
- set(_ICU_component_cache_release "ICU_${_ICU_component_upcase}_LIBRARY_RELEASE")
- set(_ICU_component_cache_debug "ICU_${_ICU_component_upcase}_LIBRARY_DEBUG")
- set(_ICU_component_lib "ICU_${_ICU_component_upcase}_LIBRARIES")
- set(_ICU_component_found "ICU_${_ICU_component_upcase}_FOUND")
- set(_ICU_imported_target "ICU::${_ICU_component}")
- if(${_ICU_component_found})
- set("${_ICU_component_lib}" "${${_ICU_component_cache}}")
- if(NOT TARGET ${_ICU_imported_target})
- add_library(${_ICU_imported_target} UNKNOWN IMPORTED)
- if(ICU_INCLUDE_DIR)
- set_target_properties(${_ICU_imported_target} PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${ICU_INCLUDE_DIR}")
- endif()
- if(EXISTS "${${_ICU_component_cache}}")
- set_target_properties(${_ICU_imported_target} PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
- IMPORTED_LOCATION "${${_ICU_component_cache}}")
- endif()
- if(EXISTS "${${_ICU_component_cache_release}}")
- set_property(TARGET ${_ICU_imported_target} APPEND PROPERTY
- IMPORTED_CONFIGURATIONS RELEASE)
- set_target_properties(${_ICU_imported_target} PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
- IMPORTED_LOCATION_RELEASE "${${_ICU_component_cache_release}}")
- endif()
- if(EXISTS "${${_ICU_component_cache_debug}}")
- set_property(TARGET ${_ICU_imported_target} APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(${_ICU_imported_target} PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
- IMPORTED_LOCATION_DEBUG "${${_ICU_component_cache_debug}}")
- endif()
- if(CMAKE_DL_LIBS AND _ICU_component STREQUAL "uc")
- set_target_properties(${_ICU_imported_target} PROPERTIES
- INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
- endif()
- endif()
- endif()
- unset(_ICU_component_upcase)
- unset(_ICU_component_cache)
- unset(_ICU_component_lib)
- unset(_ICU_component_found)
- unset(_ICU_imported_target)
- endforeach()
-endif()
-
-if(ICU_DEBUG)
- message(STATUS "--------FindICU.cmake results debug--------")
- message(STATUS "ICU found: ${ICU_FOUND}")
- message(STATUS "ICU_VERSION number: ${ICU_VERSION}")
- message(STATUS "ICU_ROOT directory: ${ICU_ROOT}")
- message(STATUS "ICU_INCLUDE_DIR directory: ${ICU_INCLUDE_DIR}")
- message(STATUS "ICU_LIBRARIES: ${ICU_LIBRARIES}")
-
- foreach(program IN LISTS icu_programs)
- string(TOUPPER "${program}" program_upcase)
- set(program_lib "ICU_${program_upcase}_EXECUTABLE")
- message(STATUS "${program} program: ${program_lib}=${${program_lib}}")
- unset(program_upcase)
- unset(program_lib)
- endforeach()
-
- foreach(data IN LISTS icu_data)
- string(TOUPPER "${data}" data_upcase)
- string(REPLACE "." "_" data_upcase "${data_upcase}")
- set(data_lib "ICU_${data_upcase}")
- message(STATUS "${data} data: ${data_lib}=${${data_lib}}")
- unset(data_upcase)
- unset(data_lib)
- endforeach()
-
- foreach(component IN LISTS ICU_FIND_COMPONENTS)
- string(TOUPPER "${component}" component_upcase)
- set(component_lib "ICU_${component_upcase}_LIBRARIES")
- set(component_found "ICU_${component_upcase}_FOUND")
- set(component_found_compat "${component_upcase}_FOUND")
- message(STATUS "${component} library found: ${component_found}=${${component_found}}")
- message(STATUS "${component} library found (compat name): ${component_found_compat}=${${component_found_compat}}")
- message(STATUS "${component} library: ${component_lib}=${${component_lib}}")
- unset(component_upcase)
- unset(component_lib)
- unset(component_found)
- unset(component_found_compat)
- endforeach()
- message(STATUS "----------------")
-endif()
-
-unset(icu_programs)
diff --git a/cmake/Kitware/modules/SelectLibraryConfigurations.cmake b/cmake/Kitware/modules/SelectLibraryConfigurations.cmake
deleted file mode 100644
index 50ee9fe7..00000000
--- a/cmake/Kitware/modules/SelectLibraryConfigurations.cmake
+++ /dev/null
@@ -1,80 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#[=======================================================================[.rst:
-SelectLibraryConfigurations
----------------------------
-
-.. code-block:: cmake
-
- select_library_configurations(basename)
-
-This macro takes a library base name as an argument, and will choose
-good values for the variables
-
-::
-
- basename_LIBRARY
- basename_LIBRARIES
- basename_LIBRARY_DEBUG
- basename_LIBRARY_RELEASE
-
-depending on what has been found and set.
-
-If only ``basename_LIBRARY_RELEASE`` is defined, ``basename_LIBRARY`` will
-be set to the release value, and ``basename_LIBRARY_DEBUG`` will be set
-to ``basename_LIBRARY_DEBUG-NOTFOUND``. If only ``basename_LIBRARY_DEBUG``
-is defined, then ``basename_LIBRARY`` will take the debug value, and
-``basename_LIBRARY_RELEASE`` will be set to ``basename_LIBRARY_RELEASE-NOTFOUND``.
-
-If the generator supports configuration types, then ``basename_LIBRARY``
-and ``basename_LIBRARIES`` will be set with debug and optimized flags
-specifying the library to be used for the given configuration. If no
-build type has been set or the generator in use does not support
-configuration types, then ``basename_LIBRARY`` and ``basename_LIBRARIES``
-will take only the release value, or the debug value if the release one
-is not set.
-#]=======================================================================]
-
-# This macro was adapted from the FindQt4 CMake module and is maintained by Will
-# Dicharry <wdicharry@stellarscience.com>.
-
-macro(select_library_configurations basename)
- if(NOT ${basename}_LIBRARY_RELEASE)
- set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.")
- endif()
- if(NOT ${basename}_LIBRARY_DEBUG)
- set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.")
- endif()
-
- get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
- if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
- NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND
- ( _isMultiConfig OR CMAKE_BUILD_TYPE ) )
- # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
- # single-config generators, set optimized and debug libraries
- set( ${basename}_LIBRARY "" )
- foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
- list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
- endforeach()
- foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG )
- list( APPEND ${basename}_LIBRARY debug "${_libname}" )
- endforeach()
- elseif( ${basename}_LIBRARY_RELEASE )
- set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
- elseif( ${basename}_LIBRARY_DEBUG )
- set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} )
- else()
- set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND")
- endif()
-
- set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" )
-
- if( ${basename}_LIBRARY )
- set( ${basename}_FOUND TRUE )
- endif()
-
- mark_as_advanced( ${basename}_LIBRARY_RELEASE
- ${basename}_LIBRARY_DEBUG
- )
-endmacro()
diff --git a/cmake/Toolchain-Linux-GCC-i686.cmake b/cmake/Toolchain-Linux-GCC-i686.cmake
index 4fe6d1c0..8bf12272 100644
--- a/cmake/Toolchain-Linux-GCC-i686.cmake
+++ b/cmake/Toolchain-Linux-GCC-i686.cmake
@@ -1,34 +1,11 @@
# Toolchain file for 32bit builds on 64bit Linux hosts
#
-# Copyright (c) 2013-2016 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
-# All rights reserved.
-#
+# SPDX-FileCopyrightText: 2013-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Volker Krause <volker.krause@kdab.com>
# Author: Filipe Azevedo <filipe.azevedo@kdab.com>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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.
+
+# SPDX-License-Identifier: BSD-3-Clause
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "i686")
diff --git a/cmake/Toolchain-OSX-GCC-i686.cmake b/cmake/Toolchain-OSX-GCC-i686.cmake
index 42644b01..d76b27af 100644
--- a/cmake/Toolchain-OSX-GCC-i686.cmake
+++ b/cmake/Toolchain-OSX-GCC-i686.cmake
@@ -1,34 +1,11 @@
# Toolchain file for 32bit builds on 64bit OSX hosts
#
-# Copyright (c) 2013-2016 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
-# All rights reserved.
-#
+# SPDX-FileCopyrightText: 2013-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Volker Krause <volker.krause@kdab.com>
# Author: Filipe Azevedo <filipe.azevedo@kdab.com>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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.
+
+# SPDX-License-Identifier: BSD-3-Clause
set(CMAKE_SYSTEM_NAME "Darwin")
set(CMAKE_SYSTEM_PROCESSOR "i686")
diff --git a/cmake/Toolchain-QNX66.cmake b/cmake/Toolchain-QNX-common.cmake
index dafeb610..fa6899a3 100644
--- a/cmake/Toolchain-QNX66.cmake
+++ b/cmake/Toolchain-QNX-common.cmake
@@ -1,18 +1,18 @@
#
-# (C) Copyright 2009 Johns Hopkins University (JHU), All Rights
-# Reserved.
-#
+# SPDX-FileCopyrightText: 2009 Johns Hopkins University (JHU), All Rights Reserved.
+# SPDX-FileCopyrightText: 2012-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
+# SPDX-License-Identifier: LicenseRef-CISST
+
# --- begin cisst license - do not edit ---
#
-# This software is provided "as is" under an open source license, with
-# no warranty. The complete license can be found in license.txt and
-# https://www.cisst.org/cisst/license.txt.
+# This software is provided "as is" under an open source license, with no warranty.
+# The complete license can be found in LICENSES/LicenseRef-CISST.txt.
#
# --- end cisst license ---
SET(CMAKE_SYSTEM_NAME QNX)
-SET(CMAKE_SYSTEM_VERSION 6.6.0)
-SET(CMAKE_SYSTEM_PROCESSOR armv7)
+SET(CMAKE_SYSTEM_VERSION ${QNX_VERSION})
+SET(CMAKE_SYSTEM_PROCESSOR ${QNX_PROCESSOR})
SET(TOOLCHAIN QNX)
#SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".a")
@@ -28,14 +28,14 @@ ENDIF(CMAKE_HOST_WIN32)
FIND_PATH(QNX_HOST
NAME usr/bin/qcc${HOST_EXECUTABLE_SUFFIX}
- PATHS $ENV{QNX_HOST} C:/qnx660/host/win32/x86
+ PATHS $ENV{QNX_HOST} ${QNX_HOST_HINT}
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
)
FIND_PATH(QNX_TARGET
NAME usr/include/qconfig.mk
- PATHS $ENV{QNX_TARGET} C:/qnx660/target/qnx6
+ PATHS $ENV{QNX_TARGET} ${QNX_TARGET_HINT}
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
)
@@ -58,7 +58,9 @@ IF(CMAKE_HOST_WIN32)
SET(ENV{PATH} "$ENV{PATH};${QNX_HOST}/usr/bin")
ENDIF(CMAKE_HOST_WIN32)
-SET(CMAKE_MAKE_PROGRAM "${QNX_HOST}/usr/bin/make${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Make Program")
+if(CMAKE_GENERATOR MATCHES "Makefiles")
+ SET(CMAKE_MAKE_PROGRAM "${QNX_HOST}/usr/bin/make${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Make Program")
+endif()
SET(CMAKE_SH "${QNX_HOST}/usr/bin/sh${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX shell Program")
SET(CMAKE_AR "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ar${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ar Program")
SET(CMAKE_RANLIB "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ranlib${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ranlib Program")
@@ -80,10 +82,8 @@ SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
-SET(CMAKE_FIND_ROOT_PATH ${QNX_TARGET})
+LIST(APPEND CMAKE_FIND_ROOT_PATH ${QNX_TARGET})
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
-SET(CMAKE_C_FLAGS "-Vgcc_ntoarmv7le" CACHE STRING "qcc c flags" FORCE)
-SET(CMAKE_CXX_FLAGS "-Vgcc_ntoarmv7le -lang-c++" CACHE STRING "qcc cxx flags" FORCE)
diff --git a/cmake/Toolchain-QNX65.cmake b/cmake/Toolchain-QNX650-armv7.cmake
index 2c5772e4..4ba1dc89 100644
--- a/cmake/Toolchain-QNX65.cmake
+++ b/cmake/Toolchain-QNX650-armv7.cmake
@@ -1,18 +1,17 @@
#
-# (C) Copyright 2009 Johns Hopkins University (JHU), All Rights
-# Reserved.
-#
+# SPDX-FileCopyrightText: 2009 Johns Hopkins University (JHU), All Rights Reserved.
+# SPDX-License-Identifier: LicenseRef-CISST
+
# --- begin cisst license - do not edit ---
#
-# This software is provided "as is" under an open source license, with
-# no warranty. The complete license can be found in license.txt and
-# https://www.cisst.org/cisst/license.txt.
+# This software is provided "as is" under an open source license, with no warranty.
+# The complete license can be found in LICENSES/LicenseRef-CISST.txt.
#
# --- end cisst license ---
SET(CMAKE_SYSTEM_NAME QNX)
SET(CMAKE_SYSTEM_VERSION 6.5.0)
-SET(CMAKE_SYSTEM_PROCESSOR x86)
+SET(CMAKE_SYSTEM_PROCESSOR armv7)
SET(TOOLCHAIN QNX)
#SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".a")
@@ -67,22 +66,23 @@ SET(CMAKE_OBJDUMP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objdump
SET(CMAKE_LINKER "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ld" CACHE PATH "QNX Linker Program")
SET(CMAKE_STRIP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-strip${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Strip Program")
-SET(CMAKE_C_COMPILER ${QNX_HOST}/usr/bin/qcc)
+SET(CMAKE_C_COMPILER ${QNX_HOST}/usr/bin/qcc${HOST_EXECUTABLE_SUFFIX})
SET(CMAKE_C_FLAGS_DEBUG "-g")
SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
-SET(CMAKE_CXX_COMPILER ${QNX_HOST}/usr/bin/qcc)
+SET(CMAKE_CXX_COMPILER ${QNX_HOST}/usr/bin/qcc${HOST_EXECUTABLE_SUFFIX})
SET(CMAKE_CXX_FLAGS_DEBUG "-g")
SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
SET(CMAKE_FIND_ROOT_PATH ${QNX_TARGET})
-SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_C_FLAGS "-Vgcc_ntoarmv7le" CACHE STRING "qcc c flags" FORCE)
SET(CMAKE_CXX_FLAGS "-Vgcc_ntoarmv7le -lang-c++" CACHE STRING "qcc cxx flags" FORCE)
diff --git a/cmake/Toolchain-QNX650-x86.cmake b/cmake/Toolchain-QNX650-x86.cmake
new file mode 100644
index 00000000..550abd47
--- /dev/null
+++ b/cmake/Toolchain-QNX650-x86.cmake
@@ -0,0 +1,88 @@
+#
+# SPDX-FileCopyrightText: 2009 Johns Hopkins University (JHU), All Rights Reserved.
+# SPDX-License-Identifier: LicenseRef-CISST
+
+# --- begin cisst license - do not edit ---
+#
+# This software is provided "as is" under an open source license, with no warranty.
+# The complete license can be found in LICENSES/LicenseRef-CISST.txt.
+#
+# --- end cisst license ---
+
+SET(CMAKE_SYSTEM_NAME QNX)
+SET(CMAKE_SYSTEM_VERSION 6.5.0)
+SET(CMAKE_SYSTEM_PROCESSOR x86)
+SET(TOOLCHAIN QNX)
+
+#SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".a")
+
+SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")
+SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
+SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
+
+IF(CMAKE_HOST_WIN32)
+ SET(HOST_EXECUTABLE_SUFFIX ".exe")
+ENDIF(CMAKE_HOST_WIN32)
+
+FIND_PATH(QNX_HOST
+ NAME usr/bin/qcc${HOST_EXECUTABLE_SUFFIX}
+ PATHS $ENV{QNX_HOST} C:/QNX650/host/win32/x86
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+)
+
+FIND_PATH(QNX_TARGET
+ NAME usr/include/qnx_errno.h
+ PATHS $ENV{QNX_TARGET} C:/QNX650/target/qnx6
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+)
+
+IF(CMAKE_HOST_WIN32)
+ FIND_PATH(QNX_CONFIGURATION
+ NAME bin/qnxactivate.exe
+ PATHS $ENV{QNX_CONFIGURATION}
+ "C:/Program Files/QNX Software Systems/qconfig"
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ )
+ENDIF(CMAKE_HOST_WIN32)
+
+SET(ENV{QNX_HOST} ${QNX_HOST})
+SET(ENV{QNX_TARGET} ${QNX_TARGET})
+IF(CMAKE_HOST_WIN32)
+ SET(ENV{QNX_CONFIGURATION} ${QNX_CONFIGURATION})
+ SET(ENV{PATH} "$ENV{PATH};${QNX_HOST}/usr/bin")
+ENDIF(CMAKE_HOST_WIN32)
+
+SET(CMAKE_MAKE_PROGRAM "${QNX_HOST}/usr/bin/make${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Make Program")
+SET(CMAKE_SH "${QNX_HOST}/usr/bin/sh${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX shell Program")
+SET(CMAKE_AR "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ar${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ar Program")
+SET(CMAKE_RANLIB "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ranlib${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ranlib Program")
+SET(CMAKE_NM "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-nm${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX nm Program")
+SET(CMAKE_OBJCOPY "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objcopy${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX objcopy Program")
+SET(CMAKE_OBJDUMP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objdump${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX objdump Program")
+SET(CMAKE_LINKER "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ld" CACHE PATH "QNX Linker Program")
+SET(CMAKE_STRIP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-strip${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Strip Program")
+
+SET(CMAKE_C_COMPILER ${QNX_HOST}/usr/bin/qcc${HOST_EXECUTABLE_SUFFIX})
+SET(CMAKE_C_FLAGS_DEBUG "-g")
+SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
+SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
+SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
+
+SET(CMAKE_CXX_COMPILER ${QNX_HOST}/usr/bin/qcc${HOST_EXECUTABLE_SUFFIX})
+SET(CMAKE_CXX_FLAGS_DEBUG "-g")
+SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
+
+SET(CMAKE_FIND_ROOT_PATH ${QNX_TARGET})
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+SET(CMAKE_C_FLAGS "-Vgcc_ntox86" CACHE STRING "qcc c flags" FORCE)
+SET(CMAKE_CXX_FLAGS "-Vgcc_ntox86 -lang-c++" CACHE STRING "qcc cxx flags" FORCE)
diff --git a/cmake/Toolchain-QNX660-armv7.cmake b/cmake/Toolchain-QNX660-armv7.cmake
new file mode 100644
index 00000000..690448be
--- /dev/null
+++ b/cmake/Toolchain-QNX660-armv7.cmake
@@ -0,0 +1,21 @@
+#
+# SPDX-FileCopyrightText: 2009 Johns Hopkins University (JHU), All Rights Reserved.
+# SPDX-License-Identifier: LicenseRef-CISST
+
+# --- begin cisst license - do not edit ---
+#
+# This software is provided "as is" under an open source license, with no warranty.
+# The complete license can be found in LICENSES/LicenseRef-CISST.txt.
+#
+# --- end cisst license ---
+
+set(QNX_VERSION 6.6.0)
+set(QNX_PROCESSOR armv7)
+
+set(QNX_HOST_HINT "C:/qnx660/host/win32/x86")
+set(QNX_TARGET_HINT "C:/qnx660/target/qnx6")
+
+set(CMAKE_C_FLAGS "-Vgcc_ntoarmv7le" CACHE STRING "qcc c flags" FORCE)
+set(CMAKE_CXX_FLAGS "-Vgcc_ntoarmv7le -lang-c++" CACHE STRING "qcc cxx flags" FORCE)
+
+include("${CMAKE_CURRENT_LIST_DIR}/Toolchain-QNX660-common.cmake")
diff --git a/cmake/Toolchain-QNX660-common.cmake b/cmake/Toolchain-QNX660-common.cmake
new file mode 100644
index 00000000..2ef67777
--- /dev/null
+++ b/cmake/Toolchain-QNX660-common.cmake
@@ -0,0 +1,23 @@
+#
+# SPDX-FileCopyrightText: 2009 Johns Hopkins University (JHU), All Rights Reserved.
+# SPDX-License-Identifier: LicenseRef-CISST
+
+# --- begin cisst license - do not edit ---
+#
+# This software is provided "as is" under an open source license, with no warranty.
+# The complete license can be found in LICENSES/LicenseRef-CISST.txt.
+#
+# --- end cisst license ---
+
+include("${CMAKE_CURRENT_LIST_DIR}/Toolchain-QNX-common.cmake")
+
+# QNX 6.6.0 ships with a QCC 4.7.3 (based on the same GCC version)
+#
+# HACK: CMake does not support getting compile features from QCC
+# work-around by telling CMake the available compile features manually
+
+set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
+set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters")
+set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
diff --git a/cmake/Toolchain-QNX660-x86.cmake b/cmake/Toolchain-QNX660-x86.cmake
new file mode 100644
index 00000000..05385213
--- /dev/null
+++ b/cmake/Toolchain-QNX660-x86.cmake
@@ -0,0 +1,21 @@
+#
+# SPDX-FileCopyrightText: 2009 Johns Hopkins University (JHU), All Rights Reserved.
+# SPDX-License-Identifier: LicenseRef-CISST
+
+# --- begin cisst license - do not edit ---
+#
+# This software is provided "as is" under an open source license, with no warranty.
+# The complete license can be found in LICENSES/LicenseRef-CISST.txt.
+#
+# --- end cisst license ---
+
+set(QNX_VERSION 6.6.0)
+set(QNX_PROCESSOR x86)
+
+set(QNX_HOST_HINT "C:/qnx660/host/win32/x86")
+set(QNX_TARGET_HINT "C:/qnx660/target/qnx6")
+
+set(CMAKE_C_FLAGS "-Vgcc_ntox86" CACHE STRING "qcc c flags" FORCE)
+set(CMAKE_CXX_FLAGS "-Vgcc_ntox86 -lang-c++" CACHE STRING "qcc cxx flags" FORCE)
+
+include("${CMAKE_CURRENT_LIST_DIR}/Toolchain-QNX660-common.cmake")
diff --git a/cmake/Toolchain-QNX700-aarch64.cmake b/cmake/Toolchain-QNX700-aarch64.cmake
new file mode 100644
index 00000000..26137535
--- /dev/null
+++ b/cmake/Toolchain-QNX700-aarch64.cmake
@@ -0,0 +1,22 @@
+#
+# SPDX-FileCopyrightText: 2009 Johns Hopkins University (JHU), All Rights Reserved.
+# SPDX-FileCopyrightText: 2018-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
+# SPDX-License-Identifier: LicenseRef-CISST
+
+# --- begin cisst license - do not edit ---
+#
+# This software is provided "as is" under an open source license, with no warranty.
+# The complete license can be found in LICENSES/LicenseRef-CISST.txt.
+#
+# --- end cisst license ---
+
+set(QNX_VERSION 7.0.0)
+set(QNX_PROCESSOR aarch64)
+
+set(QNX_HOST_HINT "C:/qnx700/host/win32/x86")
+set(QNX_TARGET_HINT "C:/qnx700/target/qnx6")
+
+set(CMAKE_C_FLAGS "-Vgcc_ntoaarch64le" CACHE STRING "qcc c flags" FORCE)
+set(CMAKE_CXX_FLAGS "-Vgcc_ntoaarch64le -lang-c++" CACHE STRING "qcc cxx flags" FORCE)
+
+include("${CMAKE_CURRENT_LIST_DIR}/Toolchain-QNX700-common.cmake")
diff --git a/cmake/Toolchain-QNX700-armv7.cmake b/cmake/Toolchain-QNX700-armv7.cmake
new file mode 100644
index 00000000..37557f03
--- /dev/null
+++ b/cmake/Toolchain-QNX700-armv7.cmake
@@ -0,0 +1,22 @@
+#
+# SPDX-FileCopyrightText: 2009 Johns Hopkins University (JHU), All Rights Reserved.
+# SPDX-FileCopyrightText: 2018-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
+# SPDX-License-Identifier: LicenseRef-CISST
+
+# --- begin cisst license - do not edit ---
+#
+# This software is provided "as is" under an open source license, with no warranty.
+# The complete license can be found in LICENSES/LicenseRef-CISST.txt.
+#
+# --- end cisst license ---
+
+set(QNX_VERSION 7.0.0)
+set(QNX_PROCESSOR armv7)
+
+set(QNX_HOST_HINT "C:/qnx700/host/win32/x86")
+set(QNX_TARGET_HINT "C:/qnx700/target/qnx6")
+
+set(CMAKE_C_FLAGS "-Vgcc_ntoarmv7le" CACHE STRING "qcc c flags" FORCE)
+set(CMAKE_CXX_FLAGS "-Vgcc_ntoarmv7le -lang-c++" CACHE STRING "qcc cxx flags" FORCE)
+
+include("${CMAKE_CURRENT_LIST_DIR}/Toolchain-QNX700-common.cmake")
diff --git a/cmake/Toolchain-QNX700-common.cmake b/cmake/Toolchain-QNX700-common.cmake
new file mode 100644
index 00000000..a94f7655
--- /dev/null
+++ b/cmake/Toolchain-QNX700-common.cmake
@@ -0,0 +1,27 @@
+#
+# SPDX-FileCopyrightText: 2009 Johns Hopkins University (JHU), All Rights Reserved.
+# SPDX-FileCopyrightText: 2018-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
+# SPDX-License-Identifier: LicenseRef-CISST
+
+# --- begin cisst license - do not edit ---
+#
+# This software is provided "as is" under an open source license, with no warranty.
+# The complete license can be found in LICENSES/LicenseRef-CISST.txt.
+#
+# --- end cisst license ---
+
+include("${CMAKE_CURRENT_LIST_DIR}/Toolchain-QNX-common.cmake")
+
+# QNX 7.0.0 ships with a QCC 5.4.0 (based on the same GCC version)
+#
+# HACK: CMake does not support getting compile features from QCC
+# work-around by telling CMake the available compile features manually
+
+# Easy to figure out by forcing GCC onto CMake, e.g. via -DCMAKE_CXX_COMPILER=/opt/qnx700/host/linux/x86_64/usr/bin/arm-unknown-nto-qnx7.0.0eabi-gcc
+# Then read out ./CMakeFiles/*/CMakeCXXCompiler.cmake
+
+set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17")
+set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters")
+set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
+set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
+set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17")
diff --git a/cmake/Toolchain-QNX700-x86.cmake b/cmake/Toolchain-QNX700-x86.cmake
new file mode 100644
index 00000000..c674da95
--- /dev/null
+++ b/cmake/Toolchain-QNX700-x86.cmake
@@ -0,0 +1,22 @@
+#
+# SPDX-FileCopyrightText: 2009 Johns Hopkins University (JHU), All Rights Reserved.
+# SPDX-FileCopyrightText: 2018-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
+# SPDX-License-Identifier: LicenseRef-CISST
+
+# --- begin cisst license - do not edit ---
+#
+# This software is provided "as is" under an open source license, with no warranty.
+# The complete license can be found in LICENSES/LicenseRef-CISST.txt.
+#
+# --- end cisst license ---
+
+set(QNX_VERSION 7.0.0)
+set(QNX_PROCESSOR x86)
+
+set(QNX_HOST_HINT "C:/qnx700/host/win32/x86")
+set(QNX_TARGET_HINT "C:/qnx700/target/qnx6")
+
+set(CMAKE_C_FLAGS "-Vgcc_ntox86" CACHE STRING "qcc c flags" FORCE)
+set(CMAKE_CXX_FLAGS "-Vgcc_ntox86 -lang-c++" CACHE STRING "qcc cxx flags" FORCE)
+
+include("${CMAKE_CURRENT_LIST_DIR}/Toolchain-QNX700-common.cmake")
diff --git a/cmake/Toolchain-QNX700-x86_64.cmake b/cmake/Toolchain-QNX700-x86_64.cmake
new file mode 100644
index 00000000..3b0e7bc6
--- /dev/null
+++ b/cmake/Toolchain-QNX700-x86_64.cmake
@@ -0,0 +1,22 @@
+#
+# SPDX-FileCopyrightText: 2009 Johns Hopkins University (JHU), All Rights Reserved.
+# SPDX-FileCopyrightText: 2018-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
+# SPDX-License-Identifier: LicenseRef-CISST
+
+# --- begin cisst license - do not edit ---
+#
+# This software is provided "as is" under an open source license, with no warranty.
+# The complete license can be found in LICENSES/LicenseRef-CISST.txt.
+#
+# --- end cisst license ---
+
+set(QNX_VERSION 7.0.0)
+set(QNX_PROCESSOR x86_64)
+
+set(QNX_HOST_HINT "C:/qnx700/host/win32/x86")
+set(QNX_TARGET_HINT "C:/qnx700/target/qnx6")
+
+set(CMAKE_C_FLAGS "-Vgcc_ntox86_64" CACHE STRING "qcc c flags" FORCE)
+set(CMAKE_CXX_FLAGS "-Vgcc_ntox86_64 -lang-c++" CACHE STRING "qcc cxx flags" FORCE)
+
+include("${CMAKE_CURRENT_LIST_DIR}/Toolchain-QNX700-common.cmake")
diff --git a/cmake/Toolchain-RPI.cmake b/cmake/Toolchain-RPI.cmake
index 923fe58e..5c94d6a6 100644
--- a/cmake/Toolchain-RPI.cmake
+++ b/cmake/Toolchain-RPI.cmake
@@ -2,33 +2,10 @@
# Assumptions: toolchain is in path, $SYSROOT points to the sysroot
#
-# Copyright (c) 2013-2016 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
-# All rights reserved.
-#
+# SPDX-FileCopyrightText: 2013-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Volker Krause <volker.krause@kdab.com>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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.
+
+# SPDX-License-Identifier: BSD-3-Clause
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "armv6l")
@@ -41,5 +18,6 @@ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --sysroot=$ENV{SYSRO
set(CMAKE_FIND_ROOT_PATH "$ENV{SYSROOT}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/cmake/Toolchain-Yocto.cmake b/cmake/Toolchain-Yocto.cmake
new file mode 100644
index 00000000..bc09bd77
--- /dev/null
+++ b/cmake/Toolchain-Yocto.cmake
@@ -0,0 +1,30 @@
+# Basic cmake toolchain file for Qt for Yocto Environment
+# Assumptions: toolchain script is sourced
+#
+
+# SPDX-FileCopyrightText: 2013-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
+# Author: Christoph Sterz <christoph.sterz@kdab.com>
+
+# SPDX-License-Identifier: BSD-3-Clause
+
+set(CMAKE_SYSTEM_NAME "Linux")
+
+if(DEFINED ENV{ARCH})
+ #$ARCH is set through the yocto environment script, use this
+ set(CMAKE_SYSTEM_PROCESSOR "$ENV{ARCH}")
+elseif(DEFINED ENV{CC})
+ #No $ARCH found, trying to deduce processor from -march=<name> flag in CC
+ string(REGEX MATCH "-march=([^\ ]+)" DUMMY "$ENV{CC}")
+ set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_MATCH_1})
+else()
+ message(FATAL_ERROR "Could not find processor architecture (no ARCH or CC found in environment).")
+endif()
+
+set(OE_QMAKE_PATH_EXTERNAL_HOST_BINS "$ENV{OE_QMAKE_PATH_HOST_BINS}")
+set(CMAKE_FIND_ROOT_PATH "$ENV{SDKTARGETSYSROOT}")
+set(CMAKE_SYSROOT "$ENV{SDKTARGETSYSROOT}")
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/cmake/Toolchain-blackberry-armv7le.cmake b/cmake/Toolchain-blackberry-armv7le.cmake
index 9ee9c36c..60cc1ed9 100644
--- a/cmake/Toolchain-blackberry-armv7le.cmake
+++ b/cmake/Toolchain-blackberry-armv7le.cmake
@@ -1,32 +1,9 @@
# Basic cmake toolchain file for BlackBerry 10
-# Copyright (c) 2013-2016 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
-# All rights reserved.
-#
+# SPDX-FileCopyrightText: 2013-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Rafael Roquetto <rafael.roquetto@kdab.com>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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.
+
+# SPDX-License-Identifier: BSD-3-Clause
# the name of the target operating system
set(CMAKE_SYSTEM_NAME QNX)
@@ -51,5 +28,6 @@ set(CMAKE_RANLIB "$ENV{QNX_HOST}/usr/bin/ntoarmv7-ranlib${HOST_EXECUTABLE_SUFFIX
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/cmake/Toolchain-iMX6.cmake b/cmake/Toolchain-iMX6.cmake
index d5da1d20..f27146c5 100644
--- a/cmake/Toolchain-iMX6.cmake
+++ b/cmake/Toolchain-iMX6.cmake
@@ -2,37 +2,15 @@
# Assumptions: toolchain is in path, $SYSROOT points to the sysroot
#
-# Copyright (c) 2013-2016 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
-# All rights reserved.
-#
+# SPDX-FileCopyrightText: 2013-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Volker Krause <volker.krause@kdab.com>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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.
+
+# SPDX-License-Identifier: BSD-3-Clause
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "armv7-a")
set(CMAKE_C_COMPILER "arm-linux-gcc")
+set(CMAKE_CXX_COMPILER "arm-linux-g++")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=$ENV{SYSROOT} -march=armv7-a -mfpu=neon")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --sysroot=$ENV{SYSROOT} -march=armv7-a -mfpu=neon")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --sysroot=$ENV{SYSROOT}")
@@ -42,5 +20,6 @@ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --sysroot=$ENV{SYSRO
set(CMAKE_FIND_ROOT_PATH "$ENV{SYSROOT}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/cmake/Toolchain-iOS.cmake b/cmake/Toolchain-iOS.cmake
deleted file mode 100644
index 5bef083b..00000000
--- a/cmake/Toolchain-iOS.cmake
+++ /dev/null
@@ -1,130 +0,0 @@
-# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake
-# files which are included with CMake 2.8.4
-# It has been altered for iOS development
-
-# Options:
-#
-# IOS_PLATFORM = OS (default) or SIMULATOR
-# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
-# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
-# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
-#
-# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
-# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
-# If set manually, it will override the default location and force the user of a particular Developer Platform
-#
-# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
-# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
-# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
-# If set manually, this will force the use of a specific SDK version
-
-# Standard settings
-set (CMAKE_SYSTEM_NAME Darwin)
-set (CMAKE_SYSTEM_VERSION 1 )
-set (UNIX True)
-set (APPLE True)
-set (IOS True)
-
-# Force the compilers to gcc for iOS
-include (CMakeForceCompiler)
-CMAKE_FORCE_C_COMPILER (gcc gcc)
-CMAKE_FORCE_CXX_COMPILER (g++ g++)
-
-# Skip the platform compiler checks for cross compiling
-set (CMAKE_CXX_COMPILER_WORKS TRUE)
-set (CMAKE_C_COMPILER_WORKS TRUE)
-
-# All iOS/Darwin specific settings - some may be redundant
-set (CMAKE_SHARED_LIBRARY_PREFIX "lib")
-set (CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
-set (CMAKE_SHARED_MODULE_PREFIX "lib")
-set (CMAKE_SHARED_MODULE_SUFFIX ".so")
-set (CMAKE_MODULE_EXISTS 1)
-set (CMAKE_DL_LIBS "")
-
-set (CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
-set (CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
-set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
-set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
-
-# Hidden visibility is required for cxx on iOS
-set (CMAKE_C_FLAGS "")
-set (CMAKE_CXX_FLAGS "-headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden")
-
-set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
-set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
-
-set (CMAKE_PLATFORM_HAS_INSTALLNAME 1)
-set (CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
-set (CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
-set (CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
-set (CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
-set (CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
-
-# hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree
-# (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache
-# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun)
-# hardcode CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did before, Alex
-if (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
- find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool)
-endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
-
-# Setup iOS platform
-if (NOT DEFINED IOS_PLATFORM)
- set (IOS_PLATFORM "OS")
-endif (NOT DEFINED IOS_PLATFORM)
-set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
-
-# Check the platform selection and setup for developer root
-if (${IOS_PLATFORM} STREQUAL "OS")
- set (IOS_PLATFORM_LOCATION "iPhoneOS.platform")
-elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
- set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
-else (${IOS_PLATFORM} STREQUAL "OS")
- message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
-endif (${IOS_PLATFORM} STREQUAL "OS")
-
-# Setup iOS developer location
-if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
- set (CMAKE_IOS_DEVELOPER_ROOT "/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
-endif (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
-set (CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
-
-# Find and use the most recent iOS sdk
-if (NOT DEFINED CMAKE_IOS_SDK_ROOT)
- file (GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*")
- if (_CMAKE_IOS_SDKS)
- list (SORT _CMAKE_IOS_SDKS)
- list (REVERSE _CMAKE_IOS_SDKS)
- list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT)
- else (_CMAKE_IOS_SDKS)
- message (FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
- endif (_CMAKE_IOS_SDKS)
- message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}")
-endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
-set (CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
-
-# Set the sysroot default to the most recent SDK
-set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
-
-# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv6,armv7 and appears to be XCode's standard.
-# The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only
-set (CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_BIT)" CACHE string "Build architecture for iOS")
-
-# Set the find root to the iOS developer roots and to user defined paths
-set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE string "iOS find search path root")
-
-# default to searching for frameworks first
-set (CMAKE_FIND_FRAMEWORK FIRST)
-
-# set up the default search directories for frameworks
-set (CMAKE_SYSTEM_FRAMEWORK_PATH
- ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
- ${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
- ${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
-)
-
-# only search the iOS sdks, not the remainder of the host filesystem
-set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
-set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/cmake/Toolchain-jetson-tk1.cmake b/cmake/Toolchain-jetson-tk1.cmake
index bfd08505..14c984b9 100644
--- a/cmake/Toolchain-jetson-tk1.cmake
+++ b/cmake/Toolchain-jetson-tk1.cmake
@@ -2,33 +2,10 @@
# Assumptions: toolchain is in path, $SYSROOT points to the sysroot
#
-# Copyright (c) 2013-2018 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
-# All rights reserved.
-#
+# SPDX-FileCopyrightText: 2013-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Volker Krause <volker.krause@kdab.com>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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.
+
+# SPDX-License-Identifier: BSD-3-Clause
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "armv7-a")
diff --git a/cmake/modules/FindBDB.cmake b/cmake/modules/FindBDB.cmake
index 8c9616eb..312901c0 100644
--- a/cmake/modules/FindBDB.cmake
+++ b/cmake/modules/FindBDB.cmake
@@ -1,3 +1,7 @@
+#
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: BSD-3-Clause
+#
# Finds the Berkeley DB Library
#
# BDB_FOUND - True if Berkeley DB found.
diff --git a/cmake/modules/FindBerkeleyDB.cmake b/cmake/modules/FindBerkeleyDB.cmake
index 0d83b4ef..63ffe9dc 100644
--- a/cmake/modules/FindBerkeleyDB.cmake
+++ b/cmake/modules/FindBerkeleyDB.cmake
@@ -1,137 +1,123 @@
-# Author: sum01 <sum01@protonmail.com>
-# Git: https://github.com/sum01/FindBerkeleyDB
-#
-# This is free and unencumbered software released into the public domain.
-#
-# Anyone is free to copy, modify, publish, use, compile, sell, or distribute
-# this software, either in source code form or as a compiled binary, for any
-# purpose, commercial or non-commercial, and by any means.
-#
-# In jurisdictions that recognize copyright laws, the author or authors of this
-# software dedicate any and all copyright interest in the software to the public
-# domain. We make this dedication for the benefit of the public at large and to
-# the detriment of our heirs and successors. We intend this dedication to be an
-# overt act of relinquishment in perpetuity of all present and future rights to
-# this software under copyright law.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# For more information, please refer to <http://unlicense.org>
-#
+# SPDX-FileCopyrightText: sum01 <sum01@protonmail.com>
+# SPDX-License-Identifier: Unlicense
+
+# Git: https://github.com/sum01/FindBerkeleyDB
# NOTE: If Berkeley DB ever gets a Pkg-config ".pc" file, add pkg_check_modules() here
# Checks if environment paths are empty, set them if they aren't
-if(NOT "$ENV{BERKELEYDB_ROOT}" STREQUAL "")
- set(_BERKELEYDB_PATHS "$ENV{BERKELEYDB_ROOT}")
-elseif(NOT "$ENV{Berkeleydb_ROOT}" STREQUAL "")
- set(_BERKELEYDB_PATHS "$ENV{Berkeleydb_ROOT}")
-elseif(NOT "$ENV{BERKELEYDBROOT}" STREQUAL "")
- set(_BERKELEYDB_PATHS "$ENV{BERKELEYDBROOT}")
-else()
- # Set just in case, as it's used regardless if it's empty or not
- set(_BERKELEYDB_PATHS "")
+set(_BERKELEYDB_PATHS "")
+if(NOT _BERKELEYDB_PATHS AND DEFINED BERKELEYDB_ROOT)
+ if($ENV{BERKELEYDB_ROOT} AND NOT "$ENV{BERKELEYDB_ROOT}" STREQUAL "")
+ set(_BERKELEYDB_PATHS "$ENV{BERKELEYDB_ROOT}")
+ endif()
+endif()
+if(NOT _BERKELEYDB_PATHS AND DEFINED Berkeleydb_ROOT)
+ if($ENV{Berkeleydb_ROOT} AND NOT "$ENV{Berkeleydb_ROOT}" STREQUAL "")
+ set(_BERKELEYDB_PATHS "$ENV{Berkeleydb_ROOT}")
+ endif()
+endif()
+if(NOT _BERKELEYDB_PATHS AND DEFINED BERKELEYDBROOT)
+ if($ENV{BERKELEYDBROOT} AND NOT "$ENV{BERKELEYDBROOT}" STREQUAL "")
+ set(_BERKELEYDB_PATHS "$ENV{BERKELEYDBROOT}")
+ endif()
endif()
# Allow user to pass a path instead of guessing
if(BerkeleyDB_ROOT_DIR)
- set(_BERKELEYDB_PATHS "${BerkeleyDB_ROOT_DIR}")
+ set(_BERKELEYDB_PATHS "${BerkeleyDB_ROOT_DIR}")
elseif(CMAKE_SYSTEM_NAME MATCHES ".*[wW]indows.*")
- # MATCHES is used to work on any devies with windows in the name
- # Shameless copy-paste from FindOpenSSL.cmake v3.8
- file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
- list(APPEND _BERKELEYDB_PATHS "${_programfiles}")
-
- # There's actually production release and version numbers in the file path.
- # For example, if they're on v6.2.32: C:/Program Files/Oracle/Berkeley DB 12cR1 6.2.32/
- # But this still works to find it, so I'm guessing it can accept partial path matches.
-
- foreach(_TARGET_BERKELEYDB_PATH "Oracle/Berkeley DB" "Berkeley DB")
- list(APPEND _BERKELEYDB_PATHS
- "${_programfiles}/${_TARGET_BERKELEYDB_PATH}"
- "C:/Program Files (x86)/${_TARGET_BERKELEYDB_PATH}"
- "C:/Program Files/${_TARGET_BERKELEYDB_PATH}"
- "C:/${_TARGET_BERKELEYDB_PATH}"
- )
- endforeach()
+ # MATCHES is used to work on any devies with windows in the name
+ # Shameless copy-paste from FindOpenSSL.cmake v3.8
+ file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
+ list(APPEND _BERKELEYDB_PATHS "${_programfiles}")
+
+ # There's actually production release and version numbers in the file path.
+ # For example, if they're on v6.2.32: C:/Program Files/Oracle/Berkeley DB 12cR1 6.2.32/
+ # But this still works to find it, so I'm guessing it can accept partial path matches.
+
+ foreach(_target_berkeleydb_path "Oracle/Berkeley DB" "Berkeley DB")
+ list(APPEND _BERKELEYDB_PATHS
+ "${_programfiles}/${_target_berkeleydb_path}"
+ "C:/Program Files (x86)/${_target_berkeleydb_path}"
+ "C:/Program Files/${_target_berkeleydb_path}"
+ "C:/${_target_berkeleydb_path}"
+ )
+ endforeach()
else()
- # Paths for anything other than Windows
- # Cellar/berkeley-db is for macOS from homebrew installation
- list(APPEND _BERKELEYDB_PATHS
- "/usr"
- "/usr/local"
- "/usr/local/Cellar/berkeley-db"
- "/opt"
- "/opt/local"
- )
+ # Paths for anything other than Windows
+ # Cellar/berkeley-db is for macOS from homebrew installation
+ list(APPEND _BERKELEYDB_PATHS
+ "/usr"
+ "/usr/local"
+ "/usr/local/Cellar/berkeley-db"
+ "/opt"
+ "/opt/local"
+ )
endif()
# Find includes path
find_path(BerkeleyDB_INCLUDE_DIRS
- NAMES "db.h"
- HINTS ${_BERKELEYDB_PATHS}
- PATH_SUFFIXES "include" "includes"
+ NAMES "db.h"
+ HINTS ${_BERKELEYDB_PATHS}
+ PATH_SUFFIXES "include" "includes"
)
# Checks if the version file exists, save the version file to a var, and fail if there's no version file
if(BerkeleyDB_INCLUDE_DIRS)
- # Read the version file db.h into a variable
- file(READ "${BerkeleyDB_INCLUDE_DIRS}/db.h" _BERKELEYDB_DB_HEADER)
- # Parse the DB version into variables to be used in the lib names
- string(REGEX REPLACE ".*DB_VERSION_MAJOR ([0-9]+).*" "\\1" BerkeleyDB_VERSION_MAJOR "${_BERKELEYDB_DB_HEADER}")
- string(REGEX REPLACE ".*DB_VERSION_MINOR ([0-9]+).*" "\\1" BerkeleyDB_VERSION_MINOR "${_BERKELEYDB_DB_HEADER}")
- # Patch version example on non-crypto installs: x.x.xNC
- string(REGEX REPLACE ".*DB_VERSION_PATCH ([0-9]+(NC)?).*" "\\1" BerkeleyDB_VERSION_PATCH "${_BERKELEYDB_DB_HEADER}")
+ # Read the version file db.h into a variable
+ file(READ "${BerkeleyDB_INCLUDE_DIRS}/db.h" _BERKELEYDB_DB_HEADER)
+ # Parse the DB version into variables to be used in the lib names
+ string(REGEX REPLACE ".*DB_VERSION_MAJOR ([0-9]+).*" "\\1" BerkeleyDB_VERSION_MAJOR "${_BERKELEYDB_DB_HEADER}")
+ string(REGEX REPLACE ".*DB_VERSION_MINOR ([0-9]+).*" "\\1" BerkeleyDB_VERSION_MINOR "${_BERKELEYDB_DB_HEADER}")
+ # Patch version example on non-crypto installs: x.x.xNC
+ string(REGEX REPLACE ".*DB_VERSION_PATCH ([0-9]+(NC)?).*" "\\1" BerkeleyDB_VERSION_PATCH "${_BERKELEYDB_DB_HEADER}")
else()
- if(BerkeleyDB_FIND_REQUIRED)
- # If the find_package(BerkeleyDB REQUIRED) was used, fail since we couldn't find the header
- message(FATAL_ERROR "Failed to find Berkeley DB's header file \"db.h\"! Try setting \"BerkeleyDB_ROOT_DIR\" when initiating Cmake.")
- #elseif(NOT BerkeleyDB_FIND_QUIETLY)
- # message(WARNING "Failed to find Berkeley DB's header file \"db.h\"! Try setting \"BerkeleyDB_ROOT_DIR\" when initiating Cmake.")
- endif()
- # Set some garbage values to the versions since we didn't find a file to read
- set(BerkeleyDB_VERSION_MAJOR "0")
- set(BerkeleyDB_VERSION_MINOR "0")
- set(BerkeleyDB_VERSION_PATCH "0")
+ if(BerkeleyDB_FIND_REQUIRED)
+ # If the find_package(BerkeleyDB REQUIRED) was used, fail since we couldn't find the header
+ message(FATAL_ERROR
+ "Failed to find Berkeley DB's header file \"db.h\"! Try setting \"BerkeleyDB_ROOT_DIR\" when initiating Cmake.")
+ endif()
+ # Set some garbage values to the versions since we didn't find a file to read
+ set(BerkeleyDB_VERSION_MAJOR "0")
+ set(BerkeleyDB_VERSION_MINOR "0")
+ set(BerkeleyDB_VERSION_PATCH "0")
endif()
# The actual returned/output version variable (the others can be used if needed)
set(BerkeleyDB_VERSION "${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}.${BerkeleyDB_VERSION_PATCH}")
+set(BerkeleyDB_LIBRARIES "")
# Finds the target library for berkeley db, since they all follow the same naming conventions
-macro(findpackage_berkeleydb_get_lib _BERKELEYDB_OUTPUT_VARNAME _TARGET_BERKELEYDB_LIB)
- # Different systems sometimes have a version in the lib name...
- # and some have a dash or underscore before the versions.
- # CMake recommends to put unversioned names before versioned names
- find_library(${_BERKELEYDB_OUTPUT_VARNAME}
- NAMES
- "${_TARGET_BERKELEYDB_LIB}"
- "lib${_TARGET_BERKELEYDB_LIB}"
- "lib${_TARGET_BERKELEYDB_LIB}${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}"
- "lib${_TARGET_BERKELEYDB_LIB}-${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}"
- "lib${_TARGET_BERKELEYDB_LIB}_${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}"
- "lib${_TARGET_BERKELEYDB_LIB}${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}"
- "lib${_TARGET_BERKELEYDB_LIB}-${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}"
- "lib${_TARGET_BERKELEYDB_LIB}_${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}"
- "lib${_TARGET_BERKELEYDB_LIB}${BerkeleyDB_VERSION_MAJOR}"
- "lib${_TARGET_BERKELEYDB_LIB}-${BerkeleyDB_VERSION_MAJOR}"
- "lib${_TARGET_BERKELEYDB_LIB}_${BerkeleyDB_VERSION_MAJOR}"
- HINTS ${_BERKELEYDB_PATHS}
- PATH_SUFFIXES "lib" "lib64" "libs" "libs64"
- )
- # If the library was found, add it to our list of libraries
- if(${_BERKELEYDB_OUTPUT_VARNAME})
- # If found, append to our libraries variable
- # The ${{}} is because the first expands to target the real variable, the second expands the variable's contents...
- # and the real variable's contents is the path to the lib. Thus, it appends the path of the lib to BerkeleyDB_LIBRARIES.
- list(APPEND BerkeleyDB_LIBRARIES "${${_BERKELEYDB_OUTPUT_VARNAME}}")
- endif()
+macro(findpackage_berkeleydb_get_lib _berkeleydb_output_varname _target_berkeleydb_lib)
+ # Different systems sometimes have a version in the lib name...
+ # and some have a dash or underscore before the versions.
+ # CMake recommends to put unversioned names before versioned names
+ find_library(${_berkeleydb_output_varname}
+ NAMES
+ "${_target_berkeleydb_lib}"
+ "lib${_target_berkeleydb_lib}"
+ "lib${_target_berkeleydb_lib}${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}"
+ "lib${_target_berkeleydb_lib}-${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}"
+ "lib${_target_berkeleydb_lib}_${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}"
+ "lib${_target_berkeleydb_lib}${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}"
+ "lib${_target_berkeleydb_lib}-${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}"
+ "lib${_target_berkeleydb_lib}_${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}"
+ "lib${_target_berkeleydb_lib}${BerkeleyDB_VERSION_MAJOR}"
+ "lib${_target_berkeleydb_lib}-${BerkeleyDB_VERSION_MAJOR}"
+ "lib${_target_berkeleydb_lib}_${BerkeleyDB_VERSION_MAJOR}"
+ HINTS ${_BERKELEYDB_PATHS}
+ PATH_SUFFIXES "lib" "lib64" "libs" "libs64"
+ )
+ # If the library was found, add it to our list of libraries
+ if(${_berkeleydb_output_varname})
+ # If found, append to our libraries variable
+ # The ${{}} is because the first expands to target the real variable, the second expands
+ # the variable's contents... and the real variable's contents is the path to the lib. Thus,
+ # it appends the path of the lib to BerkeleyDB_LIBRARIES.
+ list(APPEND BerkeleyDB_LIBRARIES "${${_berkeleydb_output_varname}}")
+ endif()
endmacro()
# Find and set the paths of the specific library to the variable
@@ -146,37 +132,37 @@ findpackage_berkeleydb_get_lib(BerkeleyDB_Stl_LIBRARY "db_stl")
include(FindPackageHandleStandardArgs)
# Fails if required vars aren't found, or if the version doesn't meet specifications.
find_package_handle_standard_args(BerkeleyDB
- FOUND_VAR BerkeleyDB_FOUND
- REQUIRED_VARS
- BerkeleyDB_INCLUDE_DIRS
- BerkeleyDB_LIBRARY
- VERSION_VAR BerkeleyDB_VERSION
+ FOUND_VAR BerkeleyDB_FOUND
+ REQUIRED_VARS
+ BerkeleyDB_INCLUDE_DIRS
+ BerkeleyDB_LIBRARY
+ VERSION_VAR BerkeleyDB_VERSION
)
# Create an imported lib for easy linking by external projects
if(BerkeleyDB_FOUND AND BerkeleyDB_LIBRARIES AND NOT TARGET Oracle::BerkeleyDB)
- add_library(Oracle::BerkeleyDB UNKNOWN IMPORTED)
- set_target_properties(Oracle::BerkeleyDB PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${BerkeleyDB_INCLUDE_DIRS}"
- IMPORTED_LOCATION "${BerkeleyDB_LIBRARY}"
- INTERFACE_LINK_LIBRARIES "${BerkeleyDB_LIBRARIES}"
- )
+ add_library(Oracle::BerkeleyDB UNKNOWN IMPORTED)
+ set_target_properties(Oracle::BerkeleyDB PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${BerkeleyDB_INCLUDE_DIRS}"
+ IMPORTED_LOCATION "${BerkeleyDB_LIBRARY}"
+ INTERFACE_LINK_LIBRARIES "${BerkeleyDB_LIBRARIES}"
+ )
endif()
# Only show the includes path and libraries in the GUI if they click "advanced".
# Does nothing when using the CLI
mark_as_advanced(FORCE
- BerkeleyDB_INCLUDE_DIRS
- BerkeleyDB_LIBRARIES
- BerkeleyDB_LIBRARY
- BerkeleyDB_Cxx_LIBRARY
- BerkeleyDB_Sql_LIBRARY
- BerkeleyDB_Stl_LIBRARY
+ BerkeleyDB_INCLUDE_DIRS
+ BerkeleyDB_LIBRARIES
+ BerkeleyDB_LIBRARY
+ BerkeleyDB_Cxx_LIBRARY
+ BerkeleyDB_Sql_LIBRARY
+ BerkeleyDB_Stl_LIBRARY
)
include(FindPackageMessage)
# A message that tells the user what includes/libs were found, and obeys the QUIET command.
find_package_message(BerkeleyDB
- "Found BerkeleyDB libraries: ${BerkeleyDB_LIBRARIES}"
- "[${BerkeleyDB_LIBRARIES}[${BerkeleyDB_INCLUDE_DIRS}]]"
+ "Found BerkeleyDB libraries: ${BerkeleyDB_LIBRARIES}"
+ "[${BerkeleyDB_LIBRARIES}[${BerkeleyDB_INCLUDE_DIRS}]]"
)
diff --git a/cmake/modules/FindGLib.cmake b/cmake/modules/FindGLib.cmake
index 1092dc14..9dabe310 100644
--- a/cmake/modules/FindGLib.cmake
+++ b/cmake/modules/FindGLib.cmake
@@ -1,5 +1,8 @@
-# - try to find glib
#
+# SPDX-FileCopyrightText: Milan Crha <mcrha@redhat.com>
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# - try to find glib
# Once done this will define
#
# GLIB_FOUND - system has GLib 2.0
diff --git a/cmake/modules/FindGObjectIntrospection.cmake b/cmake/modules/FindGObjectIntrospection.cmake
index 02841f4f..2eb289a9 100644
--- a/cmake/modules/FindGObjectIntrospection.cmake
+++ b/cmake/modules/FindGObjectIntrospection.cmake
@@ -11,11 +11,11 @@
# GObjectIntrospection_CFLAGS
# GObjectIntrospection_LIBS
#
-# Copyright (C) 2010, Pino Toscano, <pino@kde.org>
+# SPDX-FileCopyrightText: 2010, Pino Toscano, <pino@kde.org>
+# SPDX-License-Identifier: BSD-3-Clause
#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+# Get gobject-introspection's specified pkg-config variable
macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname)
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} gobject-introspection-1.0
@@ -27,7 +27,7 @@ macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname)
else()
string(REGEX REPLACE "[\r\n]" " " _result "${_result}")
string(REGEX REPLACE " +$" "" _result "${_result}")
- separate_arguments(_result)
+ separate_arguments(_result UNIX_COMMAND ${_result})
set(${_outvar} ${_result} CACHE INTERNAL "")
endif()
endmacro(_GIR_GET_PKGCONFIG_VAR)
diff --git a/cmake/modules/FindLibXML.cmake b/cmake/modules/FindLibXML.cmake
index 3c418b67..891a8004 100644
--- a/cmake/modules/FindLibXML.cmake
+++ b/cmake/modules/FindLibXML.cmake
@@ -1,5 +1,8 @@
-# - try to find libxml
#
+# SPDX-FileCopyrightText: Milan Crha <mcrha@redhat.com>
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# - try to find libxml
# Once done this will define
#
# LIBXML_FOUND - system has libxml 2.0
diff --git a/cmake/modules/FindWcecompat.cmake b/cmake/modules/FindWcecompat.cmake
index 4af53aa5..c054dc4d 100644
--- a/cmake/modules/FindWcecompat.cmake
+++ b/cmake/modules/FindWcecompat.cmake
@@ -5,9 +5,11 @@
# WCECOMPAT_INCLUDE_DIR - Wcecompat include directory
# WCECOMPAT_LIBRARIES - Libraries needed to use Wcecompat
#
-# Copyright (c) 2010, Andreas Holzammer, <andy@kdab.com>
+# SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
+# Author: Andreas Holzammer, <andy@kdab.com>
+#
+# SPDX-License-Identifier: BSD-3-Clause
#
-# Redistribution and use is allowed according to the terms of the BSD license.
if(WCECOMPAT_INCLUDE_DIR AND WCECOMPAT_LIB_FOUND)
set(Wcecompat_FIND_QUIETLY TRUE)
diff --git a/cmake/modules/GObjectIntrospectionMacros.cmake b/cmake/modules/GObjectIntrospectionMacros.cmake
index 83aff931..3af08ee8 100644
--- a/cmake/modules/GObjectIntrospectionMacros.cmake
+++ b/cmake/modules/GObjectIntrospectionMacros.cmake
@@ -1,8 +1,7 @@
-# Copyright (C) 2010, Pino Toscano, <pino at kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+# SPDX-FileCopyrightText: 2010, Pino Toscano, <pino at kde.org>
+# SPDX-License-Identifier: BSD-3-Clause
+# Generate list from another list, but with each item prepended with a prefix
macro(_gir_list_prefix _outvar _listvar _prefix)
set(${_outvar})
foreach(_item IN LISTS ${_listvar})
@@ -10,13 +9,12 @@ macro(_gir_list_prefix _outvar _listvar _prefix)
endforeach()
endmacro(_gir_list_prefix)
+# cmake-lint: disable=R0915
macro(gir_add_introspections introspections_girs)
-
set(_gir_girs)
set(_gir_typelibs)
foreach(gir IN LISTS ${introspections_girs})
-
set(_gir_name "${gir}")
## Transform the gir filename to something which can reference through a variable
@@ -26,20 +24,44 @@ macro(gir_add_introspections introspections_girs)
# Namespace and Version is either fetched from the gir filename
# or the _NAMESPACE/_VERSION variable combo
- set(_gir_namespace "${${_gir_name}_NAMESPACE}")
+ set(_gir_namespace "")
+ if(DEFINED ${_gir_name}_NAMESPACE)
+ set(_gir_namespace "${${_gir_name}_NAMESPACE}")
+ endif()
if (_gir_namespace STREQUAL "")
string(REGEX REPLACE "([^-]+)-.*" "\\1" _gir_namespace "${gir}")
endif ()
- set(_gir_version "${${_gir_name}_VERSION}")
+
+ set(_gir_version "")
+ if(DEFINED ${_gir_name}_VERSION)
+ set(_gir_version "${${_gir_name}_VERSION}")
+ endif()
if (_gir_version STREQUAL "")
string(REGEX REPLACE ".*-([^-]+).gir" "\\1" _gir_version "${gir}")
endif ()
# _PROGRAM is an optional variable which needs its own --program argument
- set(_gir_program "${${_gir_name}_PROGRAM}")
+ set(_gir_program "")
+ if(DEFINED ${_gir_name}_PROGRAM)
+ set(_gir_program "${${_gir_name}_PROGRAM}")
+ endif()
if (NOT _gir_program STREQUAL "")
set(_gir_program "--program=${_gir_program}")
- endif ()
+ endif()
+
+ # _SCANNERFLAGS is optional
+ set(_gir_scannerflags "")
+ if(DEFINED ${_gir_name}_SCANNERFLAGS)
+ set(_gir_scannerflags "${${_gir_name}_SCANNERFLAGS}")
+ endif()
+
+ # _FILES
+ set(_gir_files "")
+ if(DEFINED ${_gir_name}_FILES)
+ set(_gir_files "${${_gir_name}_FILES}")
+ else()
+ message(ERROR "Unspecified or empty ${_gir_name}_FILES variable")
+ endif()
# Variables which provides a list of things
_gir_list_prefix(_gir_libraries ${_gir_name}_LIBS "--library=")
@@ -50,47 +72,54 @@ macro(gir_add_introspections introspections_girs)
set(_gir_libtool "--no-libtool")
add_custom_command(
- COMMAND ${CMAKE_COMMAND} -E env "CC='${CMAKE_C_COMPILER}'"
- ${GObjectIntrospection_SCANNER}
- ${GObjectIntrospection_SCANNER_ARGS}
- --namespace=${_gir_namespace}
- --nsversion=${_gir_version}
- ${_gir_libtool}
- ${_gir_program}
- ${_gir_libraries}
- ${_gir_packages}
- ${_gir_includes}
- ${${_gir_name}_SCANNERFLAGS}
- ${${_gir_name}_CFLAGS}
- ${${_gir_name}_FILES}
- --output ${CMAKE_CURRENT_BINARY_DIR}/${gir}
- --accept-unprefixed
- DEPENDS ${${_gir_name}_FILES}
- ${${_gir_name}_LIBS}
OUTPUT ${gir}
+ COMMAND ${GObjectIntrospection_SCANNER}
+ ${GObjectIntrospection_SCANNER_ARGS}
+ --namespace=${_gir_namespace}
+ --nsversion=${_gir_version}
+ ${_gir_libtool}
+ ${_gir_program}
+ ${_gir_libraries}
+ ${_gir_packages}
+ ${_gir_includes}
+ ${_gir_scannerflags}
+ ${${_gir_name}_CFLAGS}
+ ${_gir_files}
+ --output ${CMAKE_CURRENT_BINARY_DIR}/${gir}
+ --accept-unprefixed
+ DEPENDS ${_gir_files} ${${_gir_name}_LIBS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
+ COMMENT "Run the gobject introspection scanner"
)
list(APPEND _gir_girs ${CMAKE_CURRENT_BINARY_DIR}/${gir})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${gir} DESTINATION ${SHARE_INSTALL_DIR}/gir-1.0)
string(REPLACE ".gir" ".typelib" _typelib "${gir}")
add_custom_command(
+ OUTPUT ${_typelib}
COMMAND ${GObjectIntrospection_COMPILER}
- ${GObjectIntrospection_COMPILER_ARGS}
- --includedir=.
- ${CMAKE_CURRENT_BINARY_DIR}/${gir}
- -o ${CMAKE_CURRENT_BINARY_DIR}/${_typelib}
+ --includedir=.
+ ${CMAKE_CURRENT_BINARY_DIR}/${gir}
+ -o ${CMAKE_CURRENT_BINARY_DIR}/${_typelib}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${gir}
- OUTPUT ${_typelib}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Run the gobject introspection compiler"
)
list(APPEND _gir_typelibs ${CMAKE_CURRENT_BINARY_DIR}/${_typelib})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_typelib} DESTINATION ${LIB_INSTALL_DIR}/girepository-1.0)
endforeach()
- add_custom_target(gir-girs-${_gir_name} ALL DEPENDS ${_gir_girs})
- add_custom_target(gir-typelibs-${_gir_name} ALL DEPENDS ${_gir_typelibs})
+ add_custom_target(gir-girs-${_gir_name}
+ ALL
+ DEPENDS ${_gir_girs}
+ COMMENT "Target for the gobject introspection compiler"
+ )
+ add_custom_target(gir-typelibs-${_gir_name}
+ ALL
+ DEPENDS ${_gir_typelibs}
+ COMMENT "Target for the gobject introspection typelibs"
+ )
endmacro(gir_add_introspections)
diff --git a/cmake/modules/GtkDoc.cmake b/cmake/modules/GtkDoc.cmake
index 8a787841..c7d88546 100644
--- a/cmake/modules/GtkDoc.cmake
+++ b/cmake/modules/GtkDoc.cmake
@@ -1,5 +1,8 @@
# GtkDoc.cmake
#
+# SPDX-FileCopyrightText: Milan Crha <mcrha@redhat.com>
+# SPDX-License-Identifier: BSD-3-Clause
+#
# Macros to support developer documentation build from sources with gtk-doc.
#
# Note that every target and dependency should be defined before the macro is
@@ -30,13 +33,14 @@ if(NOT (GTKDOC_SCAN AND GTKDOC_MKDB AND GTKDOC_MKHTML AND GTKDOC_FIXXREF))
endif()
if(NOT TARGET gtkdocs)
- add_custom_target(gtkdocs ALL)
+ add_custom_target(gtkdocs ALL COMMENT "Target to run gtkdoc for all modules")
endif()
if(NOT TARGET gtkdoc-rebuild-sgmls)
- add_custom_target(gtkdoc-rebuild-sgmls)
+ add_custom_target(gtkdoc-rebuild-sgmls COMMENT "Target to rebuild sgml for all modules")
endif()
+# cmake-lint: disable=R0912,R0915
macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ignoreheadersvar)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/${_module}-docs.sgml.in
@@ -55,7 +59,10 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
if(APPLE)
if(NOT DEFINED ENV{XML_CATALOG_FILES})
- message(FATAL_ERROR "On OSX, please run \'export XML_CATALOG_FILES=/usr/local/etc/xml/catalog\' first; else the gtk entities cannot be located.")
+ message(FATAL_ERROR
+ "On OSX, please run \'export XML_CATALOG_FILES=/usr/local/etc/xml/catalog\' first; "
+ "else the gtk entities cannot be located."
+ )
endif()
endif()
@@ -69,7 +76,9 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
if(TARGET ${opt})
set(_target_type)
get_target_property(_target_type ${opt} TYPE)
- if((_target_type STREQUAL "STATIC_LIBRARY") OR (_target_type STREQUAL "SHARED_LIBRARY") OR (_target_type STREQUAL "MODULE_LIBRARY"))
+ if((_target_type STREQUAL "STATIC_LIBRARY") OR
+ (_target_type STREQUAL "SHARED_LIBRARY") OR
+ (_target_type STREQUAL "MODULE_LIBRARY"))
set(_compile_options)
set(_link_libraries)
@@ -107,7 +116,9 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
if(TARGET ${opt})
set(_target_type)
get_target_property(_target_type ${opt} TYPE)
- if((_target_type STREQUAL "STATIC_LIBRARY") OR (_target_type STREQUAL "SHARED_LIBRARY") OR (_target_type STREQUAL "MODULE_LIBRARY"))
+ if((_target_type STREQUAL "STATIC_LIBRARY") OR
+ (_target_type STREQUAL "SHARED_LIBRARY") OR
+ (_target_type STREQUAL "MODULE_LIBRARY"))
set(_output_name "")
get_target_property(_output_name ${opt} OUTPUT_NAME)
if(NOT _output_name)
@@ -136,7 +147,18 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
# Add it as the last, thus in-tree libs have precedence
set(_scangobj_ldflags "${_scangobj_ldflags} -L${LIB_INSTALL_DIR}")
- set(_scangobj_prefix ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH="${_scangobj_ld_lib_dirs}:${LIB_INSTALL_DIR}:$ENV{LD_LIBRARY_PATH}")
+ if(APPLE)
+ set(ld_lib_path "DYLD_LIBRARY_PATH=${_scangobj_ld_lib_dirs}:${LIB_INSTALL_DIR}")
+ if(DEFINED DYLD_LIBRARY_PATH)
+ set(ld_lib_path "${ld_lib_path}:$ENV{DYLD_LIBRARY_PATH}")
+ endif()
+ elseif(NOT WIN32 AND NOT WINCE) #ie. unix-like
+ set(ld_lib_path "LD_LIBRARY_PATH=${_scangobj_ld_lib_dirs}:${LIB_INSTALL_DIR}")
+ if(DEFINED LD_LIBRARY_PATH)
+ set(ld_lib_path "${ld_lib_path}:$ENV{LD_LIBRARY_PATH}")
+ endif()
+ endif()
+ set(_scangobj_prefix ${CMAKE_COMMAND} -E env "${ld_lib_path}")
# if(NOT (_scangobj_cflags STREQUAL ""))
# set(_scangobj_cflags --cflags "${_scangobj_cflags}")
@@ -170,7 +192,11 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/html"
- COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/html" ${GTKDOC_MKHTML} --path=.. ${_module} ../${_module}-docs.sgml
+ COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/html"
+ ${GTKDOC_MKHTML}
+ --path=..
+ ${_module}
+ ../${_module}-docs.sgml
COMMAND ${GTKDOC_FIXXREF}
--module=${_module}
@@ -186,6 +212,7 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
add_custom_target(gtkdoc-${_module}
DEPENDS html/index.html
+ COMMENT "Target for running gtkdoc for module"
)
if(${_depsvar})
@@ -210,12 +237,14 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
${GTKDOC_SCAN}
--module=${_module}
--deprecated-guards="${_deprecated_guards}"
- --ignore-headers="${_ignore_headers}"
+ --ignore-headers="${${_ignoreheadersvar}}"
--rebuild-sections
--rebuild-types
${_srcdirs}
- COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}" ${_scangobj_prefix} ${GTKDOC_SCANGOBJ}
+ COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}"
+ ${_scangobj_prefix}
+ ${GTKDOC_SCANGOBJ}
--module=${_module}
${_scangobj_cflags}
${_scangobj_ldflags}
@@ -229,9 +258,14 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign
--output-format=xml
${_srcdirs}
- COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/tmp/${_module}-docs.sgml ${CMAKE_CURRENT_SOURCE_DIR}/${_module}-docs.sgml.in
+ COMMAND ${CMAKE_COMMAND} -E rename
+ ${CMAKE_CURRENT_BINARY_DIR}/tmp/${_module}-docs.sgml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${_module}-docs.sgml.in
- COMMAND ${CMAKE_COMMAND} -E echo "File '${CMAKE_CURRENT_SOURCE_DIR}/${_module}-docs.sgml.in' overwritten, make sure you replace generated strings with proper content before committing."
+ COMMAND ${CMAKE_COMMAND} -E echo
+ "File '${CMAKE_CURRENT_SOURCE_DIR}/${_module}-docs.sgml.in' overwritten, "
+ "make sure to replace generated strings with proper content before committing."
+ COMMENT "Target to rebuild the sgml for the specified module"
)
add_dependencies(gtkdoc-rebuild-sgmls gtkdoc-rebuild-${_module}-sgml)
diff --git a/cmake/modules/LibIcalMacrosInternal.cmake b/cmake/modules/LibIcalMacrosInternal.cmake
new file mode 100644
index 00000000..acf020eb
--- /dev/null
+++ b/cmake/modules/LibIcalMacrosInternal.cmake
@@ -0,0 +1,49 @@
+# CMake support macros and functions for the libical project
+
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
+include(CheckCCompilerFlag)
+include(CheckCXXCompilerFlag)
+
+# Call option() and then add_feature_info()
+function(libical_option option description)
+ set(extra_option_arguments ${ARGN})
+ option(${option} "${description}" ${extra_option_arguments})
+ add_feature_info("Option ${option}" ${option} "${description}")
+endfunction()
+
+# Warn about deprecated cmake options then call libical_option
+function(libical_deprecated_option deprecated_option option description)
+ set(extra_option_arguments ${ARGN})
+ if(${deprecated_option})
+ message(WARNING "${deprecated_option} is deprecated. Use ${option} instead")
+ set(${option} ${deprecated_option} CACHE BOOL "${description}")
+ endif()
+ libical_option(${option} "${description}" ${extra_option_arguments})
+endfunction()
+
+# If condition is True, append the specified value to each ARGN
+function(libical_append_if condition value)
+ if(${condition})
+ foreach(variable ${ARGN})
+ set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
+ endforeach()
+ endif()
+endfunction()
+
+# Create a variable C_SUPPORTS_<flag> with a boolean denoting
+# if the C compiler supports that flag; if so, append the flag
+# to the global CMAKE_C_FLAGS variable.
+macro(libical_add_cflag flag name)
+ check_c_compiler_flag("${flag}" "C_SUPPORTS_${name}")
+ libical_append_if("C_SUPPORTS_${name}" "${flag}" CMAKE_C_FLAGS)
+endmacro()
+
+# Create a variable CXX_SUPPORTS_<flag> with a boolean denoting
+# if the C++ compiler supports that flag; if so, append the flag
+# to the global CMAKE_CXX_FLAGS variable.
+macro(libical_add_cxxflag flag name)
+ check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${name}")
+ libical_append_if("CXX_SUPPORTS_${name}" "${flag}" CMAKE_CXX_FLAGS)
+endmacro()
diff --git a/cmake/run_test.cmake b/cmake/run_test.cmake
index db6c5c4d..8e76dbb2 100644
--- a/cmake/run_test.cmake
+++ b/cmake/run_test.cmake
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
#-------------------------------------------------
# some argument checking:
# test_cmd is the command to run with all its arguments
@@ -16,7 +19,7 @@ if(NOT output_test)
endif()
# convert the space-separated string to a list
-separate_arguments(test_args)
+separate_arguments(test_args UNIX_COMMAND ${test_args})
execute_process(
COMMAND ${test_cmd} ${test_args}
@@ -40,5 +43,7 @@ execute_process(
)
if(test_not_successful)
- message(SEND_ERROR "Output does not match for ${output_blessed} and ${output_test}: ${err} : shell output: ${test_not_successful}!")
+ message(SEND_ERROR
+ "Output does not match for ${output_blessed} and ${output_test}: ${err} : shell output: ${test_not_successful}!"
+ )
endif()
diff --git a/config.h.cmake b/config.h.cmake
index 43767758..a4b52aad 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -1,5 +1,10 @@
/* config.h. Generated by cmake from config.h.cmake */
+/**
+SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
+
/* Define if you have the ICU library. */
#cmakedefine HAVE_LIBICU 1
@@ -233,6 +238,7 @@ typedef unsigned int wint_t;
#endif
#cmakedefine SIZEOF_TIME_T ${SIZEOF_TIME_T}
+#cmakedefine SIZEOF_ICALTIME_T ${SIZEOF_ICALTIME_T}
/* whether we have ICU DANGI calendar */
#cmakedefine HAVE_ICU_DANGI
@@ -520,7 +526,28 @@ typedef ssize_t IO_SSIZE_T;
/* FYI: The localtime() in Microsoft's C library is MT-safe */
#define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
#endif
-#include <time.h>
+
+/*
+ * Substitute functions for those from time.h but working with icaltime_t instead of time_t.
+ */
+#cmakedefine LIBICAL_ENABLE_64BIT_ICALTIME_T 1
+#if (defined(LIBICAL_ENABLE_64BIT_ICALTIME_T) && (SIZEOF_TIME_T != 8))
+#if defined(_MSC_VER)
+#define icaltime(timer) _time64(timer)
+#define icalctime(timer) _ctime64(timer)
+#define icalmktime(timeptr) _mktime64(timeptr)
+#define icalgmtime_r(tp,tmp) (_gmtime64(tp)?(*(tmp)=*_gmtime64(tp),(tmp)):0)
+#define icallocaltime_r(tp,tmp) (_localtime64(tp)?(*(tmp)=*_localtime64(tp),(tmp)):0)
+#else
+#error "This compiler is not supported together with the 'LIBICAL_ENABLE_64BIT_ICALTIME_T' option."
+#endif
+#else
+#define icaltime(timer) time(timer)
+#define icalctime(timer) ctime(timer)
+#define icalmktime(timeptr) mktime(timeptr)
+#define icalgmtime_r(timer, buf) gmtime_r(timer, buf)
+#define icallocaltime_r(timer, buf) localtime_r(timer, buf)
+#endif
/* define MAXPATHLEN */
#if defined(_WIN32)
@@ -543,8 +570,15 @@ typedef ssize_t IO_SSIZE_T;
/* Unused argument macro */
#if !defined(_unused)
#if defined(__LCLINT__) || defined(S_SPLINT_S)
-#define _unused(x) /*@unused@*/ x
+#define _unused(x) x
#else
#define _unused(x) (void)x
#endif
#endif
+
+#define icalassert(...) assert(__VA_ARGS__)
+#define icalerrprintf(...) fprintf(stderr, __VA_ARGS__)
+
+#define ICALMEMORY_DEFAULT_MALLOC malloc
+#define ICALMEMORY_DEFAULT_REALLOC realloc
+#define ICALMEMORY_DEFAULT_FREE free
diff --git a/design-data/CMakeLists.txt b/design-data/CMakeLists.txt
index 39000a42..b650e8dc 100644
--- a/design-data/CMakeLists.txt
+++ b/design-data/CMakeLists.txt
@@ -1,2 +1,4 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
########### install files ###############
diff --git a/design-data/components.txt b/design-data/components.txt
index 09108903..83156544 100644
--- a/design-data/components.txt
+++ b/design-data/components.txt
@@ -1,4 +1,5 @@
ANY
+PARTICIPANT
VAGENDA
VALARM
VAVAILABILITY
@@ -8,9 +9,11 @@ VCOMMAND
VEVENT
VFREEBUSY
VJOURNAL
-VQUERY
+VLOCATION
VPATCH
VPOLL
+VQUERY
+VRESOURCE
VSCHEDULE
VTIMEZONE
VTODO
diff --git a/design-data/parameters.csv b/design-data/parameters.csv
index 21696b8c..32962c00 100644
--- a/design-data/parameters.csv
+++ b/design-data/parameters.csv
@@ -15,19 +15,24 @@
"PARTSTAT","20","icalparameter_partstat","X=20600;NEEDS-ACTION;ACCEPTED;DECLINED;TENTATIVE;DELEGATED;COMPLETED;INPROCESS;FAILED;NONE=20699"
"RANGE","21","icalparameter_range","X=20700;THISANDPRIOR;THISANDFUTURE;NONE=20799"
"RELATED","22","icalparameter_related","X=20800;START;END;NONE=20899"
-"RELTYPE","23","icalparameter_reltype","X=20900;PARENT;CHILD;SIBLING;POLL;NONE=20999"
+"#RELTYPE:SNOOZE from RFC9073",,,
+"RELTYPE","23","icalparameter_reltype","X=20900;PARENT;CHILD;SIBLING;POLL;SNOOZE;NONE=20999"
"ROLE","24","icalparameter_role","X=21100;CHAIR;REQ-PARTICIPANT;OPT-PARTICIPANT;NON-PARTICIPANT;NONE=21199"
"RSVP","25","icalparameter_rsvp","X=21200;TRUE;FALSE;NONE=21299"
"SENT-BY","26","const char*",
"TZID","27","const char*",
"VALUE","28","icalparameter_value","X=21600;BINARY;BOOLEAN;DATE;DURATION;FLOAT;INTEGER;PERIOD;RECUR;TEXT;URI;ERROR;DATE-TIME;UTC-OFFSET;CAL-ADDRESS;NONE=21699"
"X","29","const char*",
+
+"#libical Internal Properties"
"X-LIC-ERRORTYPE","31","icalparameter_xlicerrortype","X=21800;COMPONENT-PARSE-ERROR;PROPERTY-PARSE-ERROR;PARAMETER-NAME-PARSE-ERROR;PARAMETER-VALUE-PARSE-ERROR;VALUE-PARSE-ERROR;INVALID-ITIP;UNKNOWN-VCAL-PROP-ERROR;MIME-PARSE-ERROR;VCAL-PROP-PARSE-ERROR;NONE=21899"
"X-LIC-COMPARETYPE","30","icalparameter_xliccomparetype","X=21700;EQUAL;NOTEQUAL;LESS;GREATER;LESSEQUAL;GREATEREQUAL;REGEX;ISNULL;ISNOTNULL;NONE=21799"
+
"#Parameters from Scheduling Extensions to CalDAV (RFC 6638)"
"SCHEDULE-AGENT","34","icalparameter_scheduleagent","X=21300;SERVER;CLIENT;NONE=21399"
"SCHEDULE-FORCE-SEND","35","icalparameter_scheduleforcesend","X=21400;REQUEST;REPLY;NONE=21499"
"SCHEDULE-STATUS","36","const char*",
+
"#CAP Parameters","Draft 8",
"#this parameter should really be called ACTION, but this conflicts with the ACTION property"
"ACTIONPARAM","1","icalparameter_action","X=20000;ASK;ABORT;NONE=20099"
@@ -38,30 +43,41 @@
"LOCALIZE","17","const char*",
"OPTIONS","19","const char*",
"NO","32",,
+
"#In practice any unknown parameter that is not an xparam is treated as an ianaparam"
"IANA","33","const char*",
"ANY","0",,
+
"#VPOLL Parameters","draft-york-vpoll","PUBLIC-COMMENT and RESPONSE are deprecated"
"PUBLIC-COMMENT","37","const char*",
"RESPONSE","38","int",
"REQUIRED","43","icalparameter_required","X=21000;TRUE;FALSE;NONE=21099"
"STAY-INFORMED","39","icalparameter_stayinformed","X=21500;TRUE;FALSE;NONE=21599"
+
"#CalDAV Managed Attachment Parameters","draft-ietf-calext-caldav-attachments"
"MANAGED-ID","40","const char*",
"SIZE","41","const char*",
"FILENAME","42","const char*",
+
"#Task Extension Parameters","draft-apthorp-ical-tasks"
-"REASON","43","const char*",
+"REASON","47","const char*",
"MODIFIED","44","const char*",
"SUBSTATE","45","icalparameter_substate",X=21900;OK;ERROR;SUSPENDED;NONE=21999",
+
"#Parameters from New Properties for iCalendar","RFC 7986 Section 6"
"DISPLAY","46","icalparameter_display",X=22000;BADGE;GRAPHIC;FULLSIZE;THUMBNAIL;NONE=22099",
-"EMAIL","47","const char*",
+"EMAIL","50","const char*",
"FEATURE","48","icalparameter_feature",X=22100;AUDIO;CHAT;FEED;MODERATOR;PHONE;SCREEN;VIDEO;NONE=22199",
"LABEL","49","const char*",
-"EMAIL","50","const char*",
+
"#VPATCH Extension Parameters","draft-daboo-icalendar-vpatch"
"PATCH-ACTION","51","icalparameter_patchaction",X=22200;CREATE;BYNAME;BYVALUE;BYPARAM;NONE=22299",
+
+"#Event Publishing Extensions Parameters","RFC 9073 Section 5"
+"ORDER","52","int",
+"SCHEMA","53","const char*",
+"DERIVED","54","icalparameter_derived","X=22300;TRUE;FALSE;NONE=22399"
+
"#NOTE for updaters. Preserve the icalparameter_kind Enum values to aid forward compatibility"
"# New Enum values for an existing icalparameter_kind should be inserted before the corresponding NONE value"
-"# New icalparamter_kind types should start their Enum value after the highest NONE value (currently 22299)"
+"# New icalparamter_kind types should start their Enum value after the highest NONE value (currently 22399)"
diff --git a/design-data/params-in-prop.txt b/design-data/params-in-prop.txt
index d455e231..633a3f63 100644
--- a/design-data/params-in-prop.txt
+++ b/design-data/params-in-prop.txt
@@ -77,3 +77,10 @@ PATCH-ORDER X
PATCH-TARGET X
PATCH-DELETE X
PATCH-PARAMETER ANY
+PROXIMITY X
+LOCATION-TYPE X
+PARTICIPANT-TYPE X
+RESOURCE-TYPE X
+CALENDAR-ADDRESS X
+STYLED-DESCRIPTION ALTREP DERIVED FMTTYPE LANGUAGE VALUE X
+STRUCTURED-DATA ENCODING FMTTYPE SCHEMA VALUE X
diff --git a/design-data/properties.csv b/design-data/properties.csv
index 7e36ded7..26867360 100644
--- a/design-data/properties.csv
+++ b/design-data/properties.csv
@@ -1,5 +1,6 @@
,,
"#Property Name","C icalproperty_kind Enum","libical Value type","iCalendar default value",Property Flags
+
"#iCalendar Properties","RFC 5545 Sections 3.7 and 3.8",
"CALSCALE","8","TEXT","TEXT"
"METHOD","48","METHOD","METHOD"
@@ -10,7 +11,7 @@
"CLASS","13","CLASS","CLASS"
"COMMENT","15","TEXT","TEXT"
"DESCRIPTION","29","TEXT","TEXT"
-"GEO","39","GEO","FLOAT",is_structured
+"GEO","39","GEO","TEXT",is_structured
"LOCATION","43","TEXT","TEXT"
"PERCENT-COMPLETE","54","INTEGER","INTEGER"
"PRIORITY","56","INTEGER","INTEGER"
@@ -48,8 +49,10 @@
"SEQUENCE","75","INTEGER","INTEGER"
"REQUEST-STATUS","70","REQUEST-STATUS","REQUEST-STATUS"
"X","90","X","X",is_multivalued
+
"#Deprecated RFC 2445 Properties","See RFC 5545 Section A.3",
"EXRULE","37","RECUR","RECUR"
+
"#CAP Properties","RFC 4324 Section 2.1.2",
,"FIXME","Should be BOOLEAN"
"ALLOW-CONFLICT","3","TEXT","TEXT"
@@ -77,7 +80,7 @@
"MAX-COMPONENT-SIZE","44","INTEGER","INTEGER"
"MINDATE","49","DATE-TIME","DATE-TIME"
"MULTIPART","50","TEXT","TEXT"
-"NAME","51","TEXT","TEXT"
+"NAME","115","TEXT","TEXT"
"OWNER","53","TEXT","TEXT"
"PERMISSION","55","TEXT","TEXT"
"QUERY","58","QUERY","QUERY"
@@ -90,6 +93,7 @@
"SCOPE","74","TEXT","TEXT"
"STORES-EXPANDED","77","TEXT","TEXT"
"TARGET","79","CAL-ADDRESS","CAL-ADDRESS"
+
"#Miscellaneous Properties","Origin Unknown",
"MAXRESULTS","46","INTEGER","INTEGER"
"MAXRESULTSSIZE","47","INTEGER","INTEGER"
@@ -97,6 +101,7 @@
"RELCALID","68","TEXT","TEXT"
"DATE-MAX","21","DATE-TIME","DATE-TIME"
"DATE-MIN","22","DATE-TIME","DATE-TIME"
+
"#libical Internal Properties",,
"X-LIC-ERROR","93","TEXT","TEXT"
"X-LIC-CLUSTERCOUNT","92","STRING","STRING"
@@ -109,10 +114,14 @@
"X-LIC-CLASS","91","X-LIC-CLASS","X-LIC-CLASS"
"ANY","0","NO","NO"
"NO","100","NO","NO"
-"#VALARM Extension Properties","draft-daboo-valarm-extensions Section 13.1",
+
+"#VALARM Extension Properties", "RFC 9073 Sections 6.1, 8.1",
"ACKNOWLEDGED","1","DATE-TIME","DATE-TIME"
+"PROXIMITY","126","PROXIMITY","PROXIMITY"
+
"#VAVAILABILITY Properties","RFC 7953 Section 3.2",
"BUSYTYPE","101","BUSYTYPE","BUSYTYPE"
+
"#VPOLL Properties","draft-york-vpoll",
"ACCEPT-RESPONSE","102","TEXT,"TEXT",is_multivalued
"POLL-COMPLETION","110","POLLCOMPLETION,"POLLCOMPLETION"
@@ -123,23 +132,36 @@
"REPLY-URL","111","URI,"URI"
"RESPONSE","112","INTEGER,"INTEGER"
"VOTER","107","CAL-ADDRESS,"CAL-ADDRESS"
+
"#TZdist Properties","RFC 7808 Section 7",
"TZID-ALIAS-OF","108","TEXT","TEXT"
"TZUNTIL","109","DATE-TIME","DATE-TIME"
+
"#Task Extension Properties","draft-apthorp-ical-tasks",
"ESTIMATED-DURATION","113","DURATION","DURATION"
"TASK-MODE","114","TASKMODE","TASKMODE"
+
"#New Properties for iCalendar","RFC 7986 Section 5",
-"NAME","115","TEXT","TEXT"
+#"NAME","115","TEXT","TEXT" (conflicts with NAME from rfc4324#section-2.1.2)
"REFRESH-INTERVAL","116","DURATION","NO"
"SOURCE","117","URI","NO"
"COLOR","118","TEXT","TEXT"
"IMAGE","119","ATTACH","NO",is_structured
"CONFERENCE","120","URI","NO"
+
"#VPATCH Extension Properties", "draft-daboo_icalendar-vpatch Section 4",
"PATCH-VERSION","121","TEXT","TEXT"
"PATCH-ORDER","122","INTEGER","INTEGER"
"PATCH-TARGET","123","TEXT","TEXT"
"PATCH-DELETE","124","TEXT","TEXT"
"PATCH-PARAMETER","125","TEXT","TEXT"
+
+"#Event Publication Extensions Properties","RFC 9073 Section 6",
+"LOCATION-TYPE","127","TEXT","TEXT",is_multivalued
+"PARTICIPANT-TYPE","128","PARTICIPANTTYPE","PARTICIPANTTYPE"
+"RESOURCE-TYPE","129","RESOURCETYPE","RESOURCETYPE"
+"CALENDAR-ADDRESS","130","CAL-ADDRESS","CAL-ADDRESS"
+"STYLED-DESCRIPTION","131","TEXT","NO"
+"STRUCTURED-DATA","132","ATTACH","NO",is_structured
+
"#NOTE for updaters. Preserve the icalproperty_kind Enum values to aid forward compatibility"
diff --git a/design-data/restrictions.csv b/design-data/restrictions.csv
index 036210b3..5d77c3f7 100644
--- a/design-data/restrictions.csv
+++ b/design-data/restrictions.csv
@@ -26,7 +26,7 @@ PUBLISH,VEVENT,RDATE,NONE,ZEROPLUS
PUBLISH,VEVENT,RELATEDTO,NONE,ZEROPLUS
PUBLISH,VEVENT,RESOURCES,NONE,ZEROORONE
PUBLISH,VEVENT,RRULE,NONE,ZEROPLUS
-PUBLISH,VEVENT,STATUS,NONE,ZEROORONE,may_be_tent_conf_cancel
+PUBLISH,VEVENT,STATUS,NONE,ZEROORONE,validate_status_value
PUBLISH,VEVENT,TRANSP,NONE,ZEROORONE
PUBLISH,VEVENT,URL,NONE,ZEROORONE
PUBLISH,VEVENT,X,NONE,ZEROPLUS
@@ -42,6 +42,14 @@ PUBLISH,VEVENT,NONE,VTODO,ZERO
PUBLISH,VEVENT,NONE,VTIMEZONE,ZEROPLUS,must_if_tz_ref
PUBLISH,VEVENT,NONE,X,ZEROPLUS
PUBLISH,VEVENT,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+PUBLISH,VEVENT,STYLEDDESCRIPTION,NONE,ZEROPLUS
+PUBLISH,VEVENT,STRUCTUREDDATA,NONE,ZEROPLUS
+PUBLISH,VEVENT,NONE,PARTICIPANT,ZEROPLUS
+PUBLISH,VEVENT,NONE,VLOCATION,ZEROPLUS
+PUBLISH,VEVENT,NONE,VRESOURCE,ZEROPLUS
+
REQUEST,VEVENT,NONE,NONE,ONEPLUS
REQUEST,VEVENT,ATTENDEE,NONE,ONEPLUS
REQUEST,VEVENT,DTSTAMP,NONE,ONE
@@ -71,7 +79,7 @@ REQUEST,VEVENT,RELATEDTO,NONE,ZEROPLUS
REQUEST,VEVENT,REQUESTSTATUS,NONE,ZEROPLUS
REQUEST,VEVENT,RESOURCES,NONE,ZEROORONE
REQUEST,VEVENT,RRULE,NONE,ZEROPLUS
-REQUEST,VEVENT,STATUS,NONE,ZEROORONE,may_be_tent_conf
+REQUEST,VEVENT,STATUS,NONE,ZEROORONE,validate_status_value
REQUEST,VEVENT,TRANSP,NONE,ZEROORONE
REQUEST,VEVENT,URL,NONE,ZEROORONE
REQUEST,VEVENT,X,NONE,ZEROPLUS
@@ -85,6 +93,14 @@ REQUEST,VEVENT,NONE,VFREEBUSY,ZERO
REQUEST,VEVENT,NONE,VJOURNAL,ZERO
REQUEST,VEVENT,NONE,VTODO,ZERO
REQUEST,VEVENT,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+REQUEST,VEVENT,STYLEDDESCRIPTION,NONE,ZEROPLUS
+REQUEST,VEVENT,STRUCTUREDDATA,NONE,ZEROPLUS
+REQUEST,VEVENT,NONE,PARTICIPANT,ZEROPLUS
+REQUEST,VEVENT,NONE,VLOCATION,ZEROPLUS
+REQUEST,VEVENT,NONE,VRESOURCE,ZEROPLUS
+
REPLY,VEVENT,NONE,NONE,ONEPLUS
REPLY,VEVENT,ATTENDEE,NONE,ONE
REPLY,VEVENT,DTSTAMP,NONE,ONE
@@ -128,6 +144,14 @@ REPLY,VEVENT,NONE,VFREEBUSY,ZERO
REPLY,VEVENT,NONE,VJOURNAL,ZERO
REPLY,VEVENT,NONE,VTODO,ZERO
REPLY,VEVENT,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+REPLY,VEVENT,STYLEDDESCRIPTION,NONE,ZEROPLUS
+REPLY,VEVENT,STRUCTUREDDATA,NONE,ZEROPLUS
+REPLY,VEVENT,NONE,PARTICIPANT,ZEROPLUS
+REPLY,VEVENT,NONE,VLOCATION,ZEROPLUS
+REPLY,VEVENT,NONE,VRESOURCE,ZEROPLUS
+
ADD,VEVENT,NONE,NONE,ONE
ADD,VEVENT,DTSTAMP,NONE,ONE
ADD,VEVENT,DTSTART,NONE,ONE
@@ -155,7 +179,7 @@ ADD,VEVENT,RDATE,NONE,ZEROPLUS
ADD,VEVENT,RELATEDTO,NONE,ZEROPLUS
ADD,VEVENT,RESOURCES,NONE,ZEROORONE
ADD,VEVENT,RRULE,NONE,ZEROPLUS
-ADD,VEVENT,STATUS,NONE,ZEROORONE,may_be_tent_conf
+ADD,VEVENT,STATUS,NONE,ZEROORONE,validate_status_value
ADD,VEVENT,TRANSP,NONE,ZEROORONE
ADD,VEVENT,URL,NONE,ZEROORONE
ADD,VEVENT,X,NONE,ZEROPLUS
@@ -171,6 +195,14 @@ ADD,VEVENT,NONE,VFREEBUSY,ZERO
ADD,VEVENT,NONE,VTODO,ZERO
ADD,VEVENT,NONE,VJOURNAL,ZERO
ADD,VEVENT,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+ADD,VEVENT,STYLEDDESCRIPTION,NONE,ZEROPLUS
+ADD,VEVENT,STRUCTUREDDATA,NONE,ZEROPLUS
+ADD,VEVENT,NONE,PARTICIPANT,ZEROPLUS
+ADD,VEVENT,NONE,VLOCATION,ZEROPLUS
+ADD,VEVENT,NONE,VRESOURCE,ZEROPLUS
+
CANCEL,VEVENT,NONE,NONE,ONEPLUS
CANCEL,VEVENT,ATTENDEE,NONE,ZEROPLUS
CANCEL,VEVENT,DTSTAMP,NONE,ONE
@@ -198,7 +230,7 @@ CANCEL,VEVENT,RECURRENCEID,NONE,ZEROORONE,must_be_recurring
CANCEL,VEVENT,RELATEDTO,NONE,ZEROPLUS
CANCEL,VEVENT,RESOURCES,NONE,ZEROORONE
CANCEL,VEVENT,RRULE,NONE,ZEROPLUS
-CANCEL,VEVENT,STATUS,NONE,ZEROORONE,must_be_canceled_no_attendee
+CANCEL,VEVENT,STATUS,NONE,ZEROORONE,validate_status_value
CANCEL,VEVENT,SUMMARY,NONE,ZEROORONE
CANCEL,VEVENT,TRANSP,NONE,ZEROORONE
CANCEL,VEVENT,URL,NONE,ZEROORONE
@@ -214,6 +246,14 @@ CANCEL,VEVENT,NONE,VJOURNAL,ZERO
CANCEL,VEVENT,NONE,VFREEBUSY,ZERO
CANCEL,VEVENT,NONE,VALARM,ZERO
CANCEL,VEVENT,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+CANCEL,VEVENT,STYLEDDESCRIPTION,NONE,ZEROPLUS
+CANCEL,VEVENT,STRUCTUREDDATA,NONE,ZEROPLUS
+CANCEL,VEVENT,NONE,PARTICIPANT,ZEROPLUS
+CANCEL,VEVENT,NONE,VLOCATION,ZEROPLUS
+CANCEL,VEVENT,NONE,VRESOURCE,ZEROPLUS
+
REFRESH,VEVENT,NONE,NONE,ONE
REFRESH,VEVENT,ATTENDEE,NONE,ONE
REFRESH,VEVENT,DTSTAMP,NONE,ONE
@@ -257,6 +297,14 @@ REFRESH,VEVENT,NONE,VFREEBUSY,ZERO
REFRESH,VEVENT,NONE,VTIMEZONE,ZERO,must_if_tz_ref
REFRESH,VEVENT,NONE,VALARM,ZERO
REFRESH,VEVENT,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+REFRESH,VEVENT,STYLEDDESCRIPTION,NONE,ZEROPLUS
+REFRESH,VEVENT,STRUCTUREDDATA,NONE,ZEROPLUS
+REFRESH,VEVENT,NONE,PARTICIPANT,ZEROPLUS
+REFRESH,VEVENT,NONE,VLOCATION,ZEROPLUS
+REFRESH,VEVENT,NONE,VRESOURCE,ZEROPLUS
+
COUNTER,VEVENT,NONE,NONE,ONE
COUNTER,VEVENT,DTSTAMP,NONE,ONE
COUNTER,VEVENT,DTSTART,NONE,ONE
@@ -286,7 +334,7 @@ COUNTER,VEVENT,RELATEDTO,NONE,ZEROPLUS
COUNTER,VEVENT,REQUESTSTATUS,NONE,ZEROPLUS
COUNTER,VEVENT,RESOURCES,NONE,ZEROORONE
COUNTER,VEVENT,RRULE,NONE,ZEROPLUS
-COUNTER,VEVENT,STATUS,NONE,ZEROORONE,may_be_tent_conf_cancel
+COUNTER,VEVENT,STATUS,NONE,ZEROORONE,validate_status_value
COUNTER,VEVENT,TRANSP,NONE,ZEROORONE
COUNTER,VEVENT,URL,NONE,ZEROORONE
COUNTER,VEVENT,X,NONE,ZEROPLUS
@@ -300,6 +348,14 @@ COUNTER,VEVENT,NONE,VTODO,ZERO
COUNTER,VEVENT,NONE,VJOURNAL,ZERO
COUNTER,VEVENT,NONE,VFREEBUSY,ZERO
COUNTER,VEVENT,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+COUNTER,VEVENT,STYLEDDESCRIPTION,NONE,ZEROPLUS
+COUNTER,VEVENT,STRUCTUREDDATA,NONE,ZEROPLUS
+COUNTER,VEVENT,NONE,PARTICIPANT,ZEROPLUS
+COUNTER,VEVENT,NONE,VLOCATION,ZEROPLUS
+COUNTER,VEVENT,NONE,VRESOURCE,ZEROPLUS
+
DECLINECOUNTER,VEVENT,NONE,NONE,ONE
DECLINECOUNTER,VEVENT,DTSTAMP,NONE,ONE
DECLINECOUNTER,VEVENT,ORGANIZER,NONE,ONE
@@ -343,6 +399,14 @@ DECLINECOUNTER,VEVENT,NONE,VFREEBUSY,ZERO
DECLINECOUNTER,VEVENT,NONE,VTIMEZONE,ZERO,must_if_tz_ref
DECLINECOUNTER,VEVENT,NONE,VALARM,ZERO
DECLINECOUNTER,VEVENT,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+DECLINECOUNTER,VEVENT,STYLEDDESCRIPTION,NONE,ZEROPLUS
+DECLINECOUNTER,VEVENT,STRUCTUREDDATA,NONE,ZEROPLUS
+DECLINECOUNTER,VEVENT,NONE,PARTICIPANT,ZEROPLUS
+DECLINECOUNTER,VEVENT,NONE,VLOCATION,ZEROPLUS
+DECLINECOUNTER,VEVENT,NONE,VRESOURCE,ZEROPLUS
+
PUBLISH,VFREEBUSY,NONE,NONE,ONEPLUS
PUBLISH,VFREEBUSY,DTSTAMP,NONE,ONE
PUBLISH,VFREEBUSY,DTSTART,NONE,ONE
@@ -363,6 +427,13 @@ PUBLISH,VFREEBUSY,NONE,VTODO,ZERO
PUBLISH,VFREEBUSY,NONE,VJOURNAL,ZERO
PUBLISH,VFREEBUSY,NONE,VTIMEZONE,ZERO,must_if_tz_ref
PUBLISH,VFREEBUSY,NONE,VALARM,ZERO
+
+# Event Publishing Extensions (RFC 9073)
+PUBLISH,VFREEBUSY,STYLEDDESCRIPTION,NONE,ZEROPLUS
+PUBLISH,VFREEBUSY,NONE,PARTICIPANT,ZEROPLUS
+PUBLISH,VFREEBUSY,NONE,VLOCATION,ZEROPLUS
+PUBLISH,VFREEBUSY,NONE,VRESOURCE,ZEROPLUS
+
REQUEST,VFREEBUSY,NONE,NONE,ONE
REQUEST,VFREEBUSY,ATTENDEE,NONE,ONEPLUS
REQUEST,VFREEBUSY,DTEND,NONE,ONE
@@ -383,6 +454,13 @@ REQUEST,VFREEBUSY,NONE,VEVENT,ZERO
REQUEST,VFREEBUSY,NONE,VTODO,ZERO
REQUEST,VFREEBUSY,NONE,VJOURNAL,ZERO
REQUEST,VFREEBUSY,NONE,VTIMEZONE,ZERO
+
+# Event Publishing Extensions (RFC 9073)
+REQUEST,VFREEBUSY,STYLEDDESCRIPTION,NONE,ZEROPLUS
+REQUEST,VFREEBUSY,NONE,PARTICIPANT,ZEROPLUS
+REQUEST,VFREEBUSY,NONE,VLOCATION,ZEROPLUS
+REQUEST,VFREEBUSY,NONE,VRESOURCE,ZEROPLUS
+
REPLY,VFREEBUSY,NONE,NONE,ONE
REPLY,VFREEBUSY,ATTENDEE,NONE,ONE
REPLY,VFREEBUSY,DTSTAMP,NONE,ONE
@@ -404,6 +482,13 @@ REPLY,VFREEBUSY,NONE,VEVENT,ZERO
REPLY,VFREEBUSY,NONE,VTODO,ZERO
REPLY,VFREEBUSY,NONE,VJOURNAL,ZERO
REPLY,VFREEBUSY,NONE,VTIMEZONE,ZERO
+
+# Event Publishing Extensions (RFC 9073)
+REPLY,VFREEBUSY,STYLEDDESCRIPTION,NONE,ZEROPLUS
+REPLY,VFREEBUSY,NONE,PARTICIPANT,ZEROPLUS
+REPLY,VFREEBUSY,NONE,VLOCATION,ZEROPLUS
+REPLY,VFREEBUSY,NONE,VRESOURCE,ZEROPLUS
+
PUBLISH,VTODO,NONE,NONE,ONEPLUS
PUBLISH,VTODO,DTSTAMP,NONE,ONE
PUBLISH,VTODO,DTSTART,NONE,ONE
@@ -447,6 +532,14 @@ PUBLISH,VTODO,NONE,VFREEBUSY,ZERO
PUBLISH,VTODO,NONE,VEVENT,ZERO
PUBLISH,VTODO,NONE,VJOURNAL,ZERO
PUBLISH,VTODO,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+PUBLISH,VTODO,STYLEDDESCRIPTION,NONE,ZEROPLUS
+PUBLISH,VTODO,STRUCTUREDDATA,NONE,ZEROPLUS
+PUBLISH,VTODO,NONE,PARTICIPANT,ZEROPLUS
+PUBLISH,VTODO,NONE,VLOCATION,ZEROPLUS
+PUBLISH,VTODO,NONE,VRESOURCE,ZEROPLUS
+
REQUEST,VTODO,NONE,NONE,ONEPLUS
REQUEST,VTODO,ATTENDEE,NONE,ONEPLUS
REQUEST,VTODO,DTSTAMP,NONE,ONE
@@ -476,7 +569,7 @@ REQUEST,VTODO,RECURRENCEID,NONE,ZEROORONE,must_be_recurring
REQUEST,VTODO,RELATEDTO,NONE,ZEROPLUS
REQUEST,VTODO,RESOURCES,NONE,ZEROORONE
REQUEST,VTODO,RRULE,NONE,ZEROPLUS
-REQUEST,VTODO,STATUS,NONE,ZEROORONE,may_be_comp_need_process
+REQUEST,VTODO,STATUS,NONE,ZEROORONE,validate_status_value
REQUEST,VTODO,URL,NONE,ZEROORONE
REQUEST,VTODO,X,NONE,ZEROPLUS
REQUEST,VTODO,REQUESTSTATUS,NONE,ZERO
@@ -490,6 +583,14 @@ REQUEST,VTODO,NONE,VEVENT,ZERO
REQUEST,VTODO,NONE,VFREEBUSY,ZERO
REQUEST,VTODO,NONE,VJOURNAL,ZERO
REQUEST,VTODO,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+REQUEST,VTODO,STYLEDDESCRIPTION,NONE,ZEROPLUS
+REQUEST,VTODO,STRUCTUREDDATA,NONE,ZEROPLUS
+REQUEST,VTODO,NONE,PARTICIPANT,ZEROPLUS
+REQUEST,VTODO,NONE,VLOCATION,ZEROPLUS
+REQUEST,VTODO,NONE,VRESOURCE,ZEROPLUS
+
REPLY,VTODO,NONE,NONE,ONEPLUS
REPLY,VTODO,ATTENDEE,NONE,ONEPLUS
REPLY,VTODO,DTSTAMP,NONE,ONE
@@ -532,6 +633,14 @@ REPLY,VTODO,NONE,VALARM,ZERO
REPLY,VTODO,NONE,VEVENT,ZERO
REPLY,VTODO,NONE,VFREEBUSY,ZERO
REPLY,VTODO,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+REPLY,VTODO,STYLEDDESCRIPTION,NONE,ZEROPLUS
+REPLY,VTODO,STRUCTUREDDATA,NONE,ZEROPLUS
+REPLY,VTODO,NONE,PARTICIPANT,ZEROPLUS
+REPLY,VTODO,NONE,VLOCATION,ZEROPLUS
+REPLY,VTODO,NONE,VRESOURCE,ZEROPLUS
+
ADD,VTODO,NONE,NONE,ONE
ADD,VTODO,DTSTAMP,NONE,ONE
ADD,VTODO,ORGANIZER,NONE,ONE
@@ -560,7 +669,7 @@ ADD,VTODO,RDATE,NONE,ZEROPLUS
ADD,VTODO,RELATEDTO,NONE,ZEROPLUS
ADD,VTODO,RESOURCES,NONE,ZEROORONE
ADD,VTODO,RRULE,NONE,ZEROPLUS
-ADD,VTODO,STATUS,NONE,ZEROORONE,may_be_comp_need_process
+ADD,VTODO,STATUS,NONE,ZEROORONE,validate_status_value
ADD,VTODO,URL,NONE,ZEROORONE
ADD,VTODO,X,NONE,ZEROPLUS
ADD,VTODO,RECURRENCEID,NONE,ZERO,must_be_recurring
@@ -575,6 +684,14 @@ ADD,VTODO,NONE,VEVENT,ZERO
ADD,VTODO,NONE,VJOURNAL,ZERO
ADD,VTODO,NONE,VFREEBUSY,ZERO
ADD,VTODO,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+ADD,VTODO,STYLEDDESCRIPTION,NONE,ZEROPLUS
+ADD,VTODO,STRUCTUREDDATA,NONE,ZEROPLUS
+ADD,VTODO,NONE,PARTICIPANT,ZEROPLUS
+ADD,VTODO,NONE,VLOCATION,ZEROPLUS
+ADD,VTODO,NONE,VRESOURCE,ZEROPLUS
+
CANCEL,VTODO,NONE,NONE,ONE
CANCEL,VTODO,ATTENDEE,NONE,ZEROPLUS
CANCEL,VTODO,UID,NONE,ONE
@@ -603,7 +720,7 @@ CANCEL,VTODO,RELATEDTO,NONE,ZEROPLUS
CANCEL,VTODO,RESOURCES,NONE,ZEROORONE
CANCEL,VTODO,RRULE,NONE,ZEROPLUS
CANCEL,VTODO,PRIORITY,NONE,ZEROORONE
-CANCEL,VTODO,STATUS,NONE,ZEROORONE,must_be_canceled_no_attendee
+CANCEL,VTODO,STATUS,NONE,ZEROORONE,validate_status_value
CANCEL,VTODO,URL,NONE,ZEROORONE
CANCEL,VTODO,X,NONE,ZEROPLUS
CANCEL,VTODO,REQUESTSTATUS,NONE,ZERO
@@ -616,6 +733,14 @@ CANCEL,VTODO,NONE,VALARM,ZERO
CANCEL,VTODO,NONE,VEVENT,ZERO
CANCEL,VTODO,NONE,VFREEBUSY,ZERO
CANCEL,VTODO,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+CANCEL,VTODO,STYLEDDESCRIPTION,NONE,ZEROPLUS
+CANCEL,VTODO,STRUCTUREDDATA,NONE,ZEROPLUS
+CANCEL,VTODO,NONE,PARTICIPANT,ZEROPLUS
+CANCEL,VTODO,NONE,VLOCATION,ZEROPLUS
+CANCEL,VTODO,NONE,VRESOURCE,ZEROPLUS
+
REFRESH,VTODO,NONE,NONE,ONE
REFRESH,VTODO,ATTENDEE,NONE,ONE
REFRESH,VTODO,DTSTAMP,NONE,ONE
@@ -657,6 +782,14 @@ REFRESH,VTODO,NONE,VEVENT,ZERO
REFRESH,VTODO,NONE,VFREEBUSY,ZERO
REFRESH,VTODO,NONE,VTIMEZONE,ZERO
REFRESH,VTODO,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+REFRESH,VTODO,STYLEDDESCRIPTION,NONE,ZEROPLUS
+REFRESH,VTODO,STRUCTUREDDATA,NONE,ZEROPLUS
+REFRESH,VTODO,NONE,PARTICIPANT,ZEROPLUS
+REFRESH,VTODO,NONE,VLOCATION,ZEROPLUS
+REFRESH,VTODO,NONE,VRESOURCE,ZEROPLUS
+
COUNTER,VTODO,NONE,NONE,ONE
COUNTER,VTODO,ATTENDEE,NONE,ONEPLUS
COUNTER,VTODO,DTSTAMP,NONE,ONE
@@ -687,7 +820,7 @@ COUNTER,VTODO,REQUESTSTATUS,NONE,ZEROPLUS
COUNTER,VTODO,RESOURCES,NONE,ZEROORONE
COUNTER,VTODO,RRULE,NONE,ZEROORONE
COUNTER,VTODO,SEQUENCE,NONE,ZEROORONE
-COUNTER,VTODO,STATUS,NONE,ZEROORONE,may_be_comp_need_process
+COUNTER,VTODO,STATUS,NONE,ZEROORONE,validate_status_value
COUNTER,VTODO,URL,NONE,ZEROORONE
COUNTER,VTODO,X,NONE,ZEROPLUS
COUNTER,VTODO,COLOR,NONE,ZEROORONE
@@ -699,6 +832,14 @@ COUNTER,VTODO,NONE,X,ZEROPLUS
COUNTER,VTODO,NONE,VEVENT,ZERO
COUNTER,VTODO,NONE,VFREEBUSY,ZERO
COUNTER,VTODO,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+COUNTER,VTODO,STYLEDDESCRIPTION,NONE,ZEROPLUS
+COUNTER,VTODO,STRUCTUREDDATA,NONE,ZEROPLUS
+COUNTER,VTODO,NONE,PARTICIPANT,ZEROPLUS
+COUNTER,VTODO,NONE,VLOCATION,ZEROPLUS
+COUNTER,VTODO,NONE,VRESOURCE,ZEROPLUS
+
DECLINECOUNTER,VTODO,NONE,NONE,ONE
DECLINECOUNTER,VTODO,ATTENDEE,NONE,ONEPLUS
DECLINECOUNTER,VTODO,DTSTAMP,NONE,ONE
@@ -740,6 +881,14 @@ DECLINECOUNTER,VTODO,NONE,VALARM,ZERO
DECLINECOUNTER,VTODO,NONE,VEVENT,ZERO
DECLINECOUNTER,VTODO,NONE,VFREEBUSY,ZERO
DECLINECOUNTER,VTODO,RELCALID,NONE,ZEROORONE
+
+# Event Publishing Extensions (RFC 9073)
+DECLINECOUNTER,VTODO,STYLEDDESCRIPTION,NONE,ZEROPLUS
+DECLINECOUNTER,VTODO,STRUCTUREDDATA,NONE,ZEROPLUS
+DECLINECOUNTER,VTODO,NONE,PARTICIPANT,ZEROPLUS
+DECLINECOUNTER,VTODO,NONE,VLOCATION,ZEROPLUS
+DECLINECOUNTER,VTODO,NONE,VRESOURCE,ZEROPLUS
+
PUBLISH,VJOURNAL,NONE,NONE,ONEPLUS
PUBLISH,VJOURNAL,DESCRIPTION,NONE,ONE
PUBLISH,VJOURNAL,DTSTAMP,NONE,ONE
@@ -760,7 +909,7 @@ PUBLISH,VJOURNAL,RECURRENCEID,NONE,ZEROORONE,must_be_recurring
PUBLISH,VJOURNAL,RELATEDTO,NONE,ZEROPLUS
PUBLISH,VJOURNAL,RRULE,NONE,ZEROPLUS
PUBLISH,VJOURNAL,SEQUENCE,NONE,ZEROORONE
-PUBLISH,VJOURNAL,STATUS,NONE,ZEROORONE,may_be_draft_final_canceled
+PUBLISH,VJOURNAL,STATUS,NONE,ZEROORONE,validate_status_value
PUBLISH,VJOURNAL,SUMMARY,NONE,ZEROORONE
PUBLISH,VJOURNAL,URL,NONE,ZEROORONE
PUBLISH,VJOURNAL,X,NONE,ZEROPLUS
@@ -773,6 +922,14 @@ PUBLISH,VJOURNAL,NONE,X,ZEROPLUS
PUBLISH,VJOURNAL,NONE,VEVENT,ZERO
PUBLISH,VJOURNAL,NONE,VFREEBUSY,ZERO
PUBLISH,VJOURNAL,NONE,VTODO,ZERO
+
+# Event Publishing Extensions (RFC 9073)
+PUBLISH,VJOURNAL,STYLEDDESCRIPTION,NONE,ZEROPLUS
+PUBLISH,VJOURNAL,STRUCTUREDDATA,NONE,ZEROPLUS
+PUBLISH,VJOURNAL,NONE,PARTICIPANT,ZEROPLUS
+PUBLISH,VJOURNAL,NONE,VLOCATION,ZEROPLUS
+PUBLISH,VJOURNAL,NONE,VRESOURCE,ZEROPLUS
+
ADD,VJOURNAL,NONE,NONE,ONE
ADD,VJOURNAL,DESCRIPTION,NONE,ONE
ADD,VJOURNAL,DTSTAMP,NONE,ONE
@@ -806,6 +963,14 @@ ADD,VJOURNAL,NONE,X,ZEROPLUS
ADD,VJOURNAL,NONE,VEVENT,ZERO
ADD,VJOURNAL,NONE,VFREEBUSY,ZERO
ADD,VJOURNAL,NONE,VTODO,ZERO
+
+# Event Publishing Extensions (RFC 9073)
+ADD,VJOURNAL,STYLEDDESCRIPTION,NONE,ZEROPLUS
+ADD,VJOURNAL,STRUCTUREDDATA,NONE,ZEROPLUS
+ADD,VJOURNAL,NONE,PARTICIPANT,ZEROPLUS
+ADD,VJOURNAL,NONE,VLOCATION,ZEROPLUS
+ADD,VJOURNAL,NONE,VRESOURCE,ZEROPLUS
+
CANCEL,VJOURNAL,NONE,NONE,ONEPLUS
CANCEL,VJOURNAL,DTSTAMP,NONE,ONE
CANCEL,VJOURNAL,ORGANIZER,NONE,ONE
@@ -827,7 +992,7 @@ CANCEL,VJOURNAL,RDATE,NONE,ZEROPLUS
CANCEL,VJOURNAL,RECURRENCEID,NONE,ZEROORONE,must_be_recurring
CANCEL,VJOURNAL,RELATEDTO,NONE,ZEROPLUS
CANCEL,VJOURNAL,RRULE,NONE,ZEROPLUS
-CANCEL,VJOURNAL,STATUS,NONE,ZEROORONE,must_be_cancel_if_present
+CANCEL,VJOURNAL,STATUS,NONE,ZEROORONE,validate_status_value
CANCEL,VJOURNAL,SUMMARY,NONE,ZEROORONE
CANCEL,VJOURNAL,URL,NONE,ZEROORONE
CANCEL,VJOURNAL,X,NONE,ZEROPLUS
@@ -840,46 +1005,62 @@ CANCEL,VJOURNAL,NONE,VALARM,ZERO
CANCEL,VJOURNAL,NONE,VEVENT,ZERO
CANCEL,VJOURNAL,NONE,VFREEBUSY,ZERO
CANCEL,VJOURNAL,NONE,VTODO,ZERO
+
+# Event Publishing Extensions (RFC 9073)
+CANCEL,VJOURNAL,STYLEDDESCRIPTION,NONE,ZEROPLUS
+CANCEL,VJOURNAL,STRUCTUREDDATA,NONE,ZEROPLUS
+CANCEL,VJOURNAL,NONE,PARTICIPANT,ZEROPLUS
+CANCEL,VJOURNAL,NONE,VLOCATION,ZEROPLUS
+CANCEL,VJOURNAL,NONE,VRESOURCE,ZEROPLUS
+
PUBLISH,VAGENDA,NONE,NONE,ONEPLUS
PUBLISH,VAGENDA,CALMASTER,NONE,ONE
PUBLISH,VAGENDA,OWNER,NONE,ZEROORONE
PUBLISH,VAGENDA,RELCALID,NONE,ZEROORONE
PUBLISH,VAGENDA,TZID,NONE,ONE
+
REQUEST,VAGENDA,NONE,NONE,ONEPLUS
REQUEST,VAGENDA,CALMASTER,NONE,ONE
REQUEST,VAGENDA,OWNER,NONE,ZEROORONE
REQUEST,VAGENDA,RELCALID,NONE,ZEROORONE
REQUEST,VAGENDA,TZID,NONE,ONE
+
REPLY,VAGENDA,NONE,NONE,ONEPLUS
REPLY,VAGENDA,CALMASTER,NONE,ONE
REPLY,VAGENDA,OWNER,NONE,ZEROORONE
REPLY,VAGENDA,RELCALID,NONE,ZEROORONE
REPLY,VAGENDA,TZID,NONE,ONE
+
ADD,VAGENDA,NONE,NONE,ONEPLUS
ADD,VAGENDA,CALMASTER,NONE,ONE
ADD,VAGENDA,OWNER,NONE,ZEROORONE
ADD,VAGENDA,RELCALID,NONE,ZEROORONE
ADD,VAGENDA,TZID,NONE,ONE
+
CANCEL,VAGENDA,NONE,NONE,ONEPLUS
CANCEL,VAGENDA,CALMASTER,NONE,ONE
CANCEL,VAGENDA,OWNER,NONE,ZEROORONE
CANCEL,VAGENDA,RELCALID,NONE,ZEROORONE
CANCEL,VAGENDA,TZID,NONE,ONE
+
REFRESH,VAGENDA,NONE,NONE,ONEPLUS
REFRESH,VAGENDA,CALMASTER,NONE,ONE
REFRESH,VAGENDA,OWNER,NONE,ZEROORONE
REFRESH,VAGENDA,RELCALID,NONE,ZEROORONE
REFRESH,VAGENDA,TZID,NONE,ONE
+
COUNTER,VAGENDA,NONE,NONE,ONEPLUS
COUNTER,VAGENDA,CALMASTER,NONE,ONE
COUNTER,VAGENDA,OWNER,NONE,ZEROORONE
COUNTER,VAGENDA,RELCALID,NONE,ZEROORONE
COUNTER,VAGENDA,TZID,NONE,ONE
+
DECLINECOUNTER,VAGENDA,NONE,NONE,ONEPLUS
DECLINECOUNTER,VAGENDA,CALMASTER,NONE,ONE
DECLINECOUNTER,VAGENDA,OWNER,NONE,ZEROORONE
DECLINECOUNTER,VAGENDA,RELCALID,NONE,ZEROORONE
DECLINECOUNTER,VAGENDA,TZID,NONE,ONE
+
NONE,VAGENDA,ALLOWCONFLICT,NONE,ONE
NONE,VAGENDA,CALMASTER,NONE,ONE
NONE,VAGENDA,OWNER,NONE,ZEROORONE
@@ -888,6 +1069,7 @@ NONE,VAGENDA,TZID,NONE,ONE
NONE,VAGENDA,DEFAULTCHARSET,NONE,ONE
NONE,VAGENDA,DEFAULTLOCALE,NONE,ONE
NONE,VAGENDA,DEFAULTTZID,NONE,ONE
+
NONE,VCALENDAR,ACTION,NONE,ZERO
NONE,VCALENDAR,ATTACH,NONE,ZERO
NONE,VCALENDAR,ATTENDEE,NONE,ZERO
@@ -942,6 +1124,7 @@ NONE,VCALENDAR,REFRESHINTERVAL,NONE,ZEROORONE
NONE,VCALENDAR,SOURCE,NONE,ZEROORONE
NONE,VCALENDAR,IMAGE,NONE,ZEROPLUS
NONE,VCALENDAR,NAME,NONE,ZEROPLUS
+
NONE,VEVENT,ACTION,NONE,ZERO
NONE,VEVENT,ATTACH,NONE,ZEROPLUS
NONE,VEVENT,ATTENDEE,NONE,ZEROPLUS
@@ -994,6 +1177,14 @@ NONE,VEVENT,RELCALID,NONE,ZEROORONE
NONE,VEVENT,COLOR,NONE,ZEROORONE
NONE,VEVENT,CONFERENCE,NONE,ZEROPLUS
NONE,VEVENT,IMAGE,NONE,ZEROPLUS
+
+# Event Publishing Extensions (RFC 9073)
+NONE,VEVENT,STYLEDDESCRIPTION,NONE,ZEROPLUS
+NONE,VEVENT,STRUCTUREDDATA,NONE,ZEROPLUS
+NONE,VEVENT,NONE,PARTICIPANT,ZEROPLUS
+NONE,VEVENT,NONE,VLOCATION,ZEROPLUS
+NONE,VEVENT,NONE,VRESOURCE,ZEROPLUS
+
NONE,VTODO,ACTION,NONE,ZERO
NONE,VTODO,ATTACH,NONE,ZEROPLUS
NONE,VTODO,ATTENDEE,NONE,ZEROPLUS
@@ -1046,6 +1237,14 @@ NONE,VTODO,RELCALID,NONE,ZEROORONE
NONE,VTODO,COLOR,NONE,ZEROORONE
NONE,VTODO,CONFERENCE,NONE,ZEROPLUS
NONE,VTODO,IMAGE,NONE,ZEROPLUS
+
+# Event Publishing Extensions (RFC 9073)
+NONE,VTODO,STYLEDDESCRIPTION,NONE,ZEROPLUS
+NONE,VTODO,STRUCTUREDDATA,NONE,ZEROPLUS
+NONE,VTODO,NONE,PARTICIPANT,ZEROPLUS
+NONE,VTODO,NONE,VLOCATION,ZEROPLUS
+NONE,VTODO,NONE,VRESOURCE,ZEROPLUS
+
NONE,VJOURNAL,ACTION,NONE,ZERO
NONE,VJOURNAL,ATTACH,NONE,ZEROPLUS
NONE,VJOURNAL,ATTENDEE,NONE,ZEROPLUS
@@ -1096,6 +1295,14 @@ NONE,VJOURNAL,VERSION,NONE,ZERO
NONE,VJOURNAL,X,NONE,ZEROPLUS
NONE,VJOURNAL,COLOR,NONE,ZEROORONE
NONE,VJOURNAL,IMAGE,NONE,ZEROPLUS
+
+# Event Publishing Extensions (RFC 9073)
+NONE,VJOURNAL,STYLEDDESCRIPTION,NONE,ZEROPLUS
+NONE,VJOURNAL,STRUCTUREDDATA,NONE,ZEROPLUS
+NONE,VJOURNAL,NONE,PARTICIPANT,ZEROPLUS
+NONE,VJOURNAL,NONE,VLOCATION,ZEROPLUS
+NONE,VJOURNAL,NONE,VRESOURCE,ZEROPLUS
+
NONE,VFREEBUSY,ACTION,NONE,ZERO
NONE,VFREEBUSY,ATTACH,NONE,ZERO
NONE,VFREEBUSY,ATTENDEE,NONE,ZEROPLUS
@@ -1144,6 +1351,13 @@ NONE,VFREEBUSY,UID,NONE,ONE
NONE,VFREEBUSY,URL,NONE,ZEROORONE
NONE,VFREEBUSY,VERSION,NONE,ZERO
NONE,VFREEBUSY,X,NONE,ZEROPLUS
+
+# Event Publishing Extensions (RFC 9073)
+NONE,VFREEBUSY,STYLEDDESCRIPTION,NONE,ZEROPLUS
+NONE,VFREEBUSY,NONE,PARTICIPANT,ZEROPLUS
+NONE,VFREEBUSY,NONE,VLOCATION,ZEROPLUS
+NONE,VFREEBUSY,NONE,VRESOURCE,ZEROPLUS
+
NONE,VTIMEZONE,ACTION,NONE,ZERO
NONE,VTIMEZONE,ATTACH,NONE,ZERO
NONE,VTIMEZONE,ATTENDEE,NONE,ZERO
@@ -1196,6 +1410,7 @@ NONE,VTIMEZONE,VERSION,NONE,ZERO
NONE,VTIMEZONE,X,NONE,ZEROPLUS
NONE,VTIMEZONE,NONE,XSTANDARD,ZEROPLUS
NONE,VTIMEZONE,NONE,XDAYLIGHT,ZEROPLUS
+
NONE,XSTANDARD,ACTION,NONE,ZERO
NONE,XSTANDARD,ATTACH,NONE,ZERO
NONE,XSTANDARD,ATTENDEE,NONE,ZERO
@@ -1244,6 +1459,7 @@ NONE,XSTANDARD,UID,NONE,ZERO
NONE,XSTANDARD,URL,NONE,ZERO
NONE,XSTANDARD,VERSION,NONE,ZERO
NONE,XSTANDARD,X,NONE,ZEROPLUS
+
NONE,XDAYLIGHT,ACTION,NONE,ZERO
NONE,XDAYLIGHT,ATTACH,NONE,ZERO
NONE,XDAYLIGHT,ATTENDEE,NONE,ZERO
@@ -1292,201 +1508,69 @@ NONE,XDAYLIGHT,UID,NONE,ZERO
NONE,XDAYLIGHT,URL,NONE,ZERO
NONE,XDAYLIGHT,VERSION,NONE,ZERO
NONE,XDAYLIGHT,X,NONE,ZEROPLUS
-NONE,XAUDIOALARM,ACTION,NONE,ONE
-NONE,XAUDIOALARM,ATTACH,NONE,ZEROORONE
-NONE,XAUDIOALARM,ATTENDEE,NONE,ZERO
-NONE,XAUDIOALARM,CALSCALE,NONE,ZERO
-NONE,XAUDIOALARM,CATEGORIES,NONE,ZERO
-NONE,XAUDIOALARM,CLASS,NONE,ZERO
-NONE,XAUDIOALARM,COMMENT,NONE,ZERO
-NONE,XAUDIOALARM,COMPLETED,NONE,ZERO
-NONE,XAUDIOALARM,CONTACT,NONE,ZERO
-NONE,XAUDIOALARM,CREATED,NONE,ZERO
-NONE,XAUDIOALARM,DESCRIPTION,NONE,ZERO
-NONE,XAUDIOALARM,DTEND,NONE,ZERO
-NONE,XAUDIOALARM,DTSTAMP,NONE,ZERO
-NONE,XAUDIOALARM,DTSTART,NONE,ZERO
-NONE,XAUDIOALARM,DUE,NONE,ZERO
-NONE,XAUDIOALARM,DURATION,NONE,ONEMUTUAL,must_have_repeat
-NONE,XAUDIOALARM,REPEAT,NONE,ONEMUTUAL,must_have_duration
-NONE,XAUDIOALARM,EXDATE,NONE,ZERO
-NONE,XAUDIOALARM,EXRULE,NONE,ZERO
-NONE,XAUDIOALARM,FREEBUSY,NONE,ZERO
-NONE,XAUDIOALARM,GEO,NONE,ZERO
-NONE,XAUDIOALARM,LASTMODIFIED,NONE,ZERO
-NONE,XAUDIOALARM,LOCATION,NONE,ZERO
-NONE,XAUDIOALARM,METHOD,NONE,ZERO
-NONE,XAUDIOALARM,ORGANIZER,NONE,ZERO
-NONE,XAUDIOALARM,PERCENTCOMPLETE,NONE,ZERO
-NONE,XAUDIOALARM,PRIORITY,NONE,ZERO
-NONE,XAUDIOALARM,PRODID,NONE,ZERO
-NONE,XAUDIOALARM,RDATE,NONE,ZERO
-NONE,XAUDIOALARM,RECURRENCEID,NONE,ZERO
-NONE,XAUDIOALARM,RELATEDTO,NONE,ZERO
-NONE,XAUDIOALARM,REQUESTSTATUS,NONE,ZERO
-NONE,XAUDIOALARM,RESOURCES,NONE,ZERO
-NONE,XAUDIOALARM,RRULE,NONE,ZERO
-NONE,XAUDIOALARM,SEQUENCE,NONE,ZERO
-NONE,XAUDIOALARM,STATUS,NONE,ZERO
-NONE,XAUDIOALARM,SUMMARY,NONE,ZERO
-NONE,XAUDIOALARM,TRANSP,NONE,ZERO
-NONE,XAUDIOALARM,TRIGGER,NONE,ONE
-NONE,XAUDIOALARM,TZID,NONE,ZERO
-NONE,XAUDIOALARM,TZNAME,NONE,ZERO
-NONE,XAUDIOALARM,TZOFFSETFROM,NONE,ZERO
-NONE,XAUDIOALARM,TZOFFSETTO,NONE,ZERO
-NONE,XAUDIOALARM,TZURL,NONE,ZERO
-NONE,XAUDIOALARM,UID,NONE,ZERO
-NONE,XAUDIOALARM,URL,NONE,ZERO
-NONE,XAUDIOALARM,VERSION,NONE,ZERO
-NONE,XAUDIOALARM,X,NONE,ZEROPLUS
-NONE,XDISPLAYALARM,ACTION,NONE,ONE
-NONE,XDISPLAYALARM,ATTACH,NONE,ZERO
-NONE,XDISPLAYALARM,ATTENDEE,NONE,ZERO
-NONE,XDISPLAYALARM,CALSCALE,NONE,ZERO
-NONE,XDISPLAYALARM,CATEGORIES,NONE,ZERO
-NONE,XDISPLAYALARM,CLASS,NONE,ZERO
-NONE,XDISPLAYALARM,COMMENT,NONE,ZERO
-NONE,XDISPLAYALARM,COMPLETED,NONE,ZERO
-NONE,XDISPLAYALARM,CONTACT,NONE,ZERO
-NONE,XDISPLAYALARM,CREATED,NONE,ZERO
-NONE,XDISPLAYALARM,DESCRIPTION,NONE,ONE
-NONE,XDISPLAYALARM,DTEND,NONE,ZERO
-NONE,XDISPLAYALARM,DTSTAMP,NONE,ZERO
-NONE,XDISPLAYALARM,DTSTART,NONE,ZERO
-NONE,XDISPLAYALARM,DUE,NONE,ZERO
-NONE,XDISPLAYALARM,DURATION,NONE,ONEMUTUAL,must_have_repeat
-NONE,XDISPLAYALARM,REPEAT,NONE,ONEMUTUAL,must_have_duration
-NONE,XDISPLAYALARM,EXDATE,NONE,ZERO
-NONE,XDISPLAYALARM,EXRULE,NONE,ZERO
-NONE,XDISPLAYALARM,FREEBUSY,NONE,ZERO
-NONE,XDISPLAYALARM,GEO,NONE,ZERO
-NONE,XDISPLAYALARM,LASTMODIFIED,NONE,ZERO
-NONE,XDISPLAYALARM,LOCATION,NONE,ZERO
-NONE,XDISPLAYALARM,METHOD,NONE,ZERO
-NONE,XDISPLAYALARM,ORGANIZER,NONE,ZERO
-NONE,XDISPLAYALARM,PERCENTCOMPLETE,NONE,ZERO
-NONE,XDISPLAYALARM,PRIORITY,NONE,ZERO
-NONE,XDISPLAYALARM,PRODID,NONE,ZERO
-NONE,XDISPLAYALARM,RDATE,NONE,ZERO
-NONE,XDISPLAYALARM,RECURRENCEID,NONE,ZERO
-NONE,XDISPLAYALARM,RELATEDTO,NONE,ZERO
-NONE,XDISPLAYALARM,REQUESTSTATUS,NONE,ZERO
-NONE,XDISPLAYALARM,RESOURCES,NONE,ZERO
-NONE,XDISPLAYALARM,RRULE,NONE,ZERO
-NONE,XDISPLAYALARM,SEQUENCE,NONE,ZERO
-NONE,XDISPLAYALARM,STATUS,NONE,ZERO
-NONE,XDISPLAYALARM,SUMMARY,NONE,ZERO
-NONE,XDISPLAYALARM,TRANSP,NONE,ZERO
-NONE,XDISPLAYALARM,TRIGGER,NONE,ONE
-NONE,XDISPLAYALARM,TZID,NONE,ZERO
-NONE,XDISPLAYALARM,TZNAME,NONE,ZERO
-NONE,XDISPLAYALARM,TZOFFSETFROM,NONE,ZERO
-NONE,XDISPLAYALARM,TZOFFSETTO,NONE,ZERO
-NONE,XDISPLAYALARM,TZURL,NONE,ZERO
-NONE,XDISPLAYALARM,UID,NONE,ZERO
-NONE,XDISPLAYALARM,URL,NONE,ZERO
-NONE,XDISPLAYALARM,VERSION,NONE,ZERO
-NONE,XDISPLAYALARM,X,NONE,ZEROPLUS
-NONE,XEMAILALARM,ACTION,NONE,ONE,must_be_email
-NONE,XEMAILALARM,ATTACH,NONE,ZEROPLUS
-NONE,XEMAILALARM,ATTENDEE,NONE,ONEPLUS
-NONE,XEMAILALARM,CALSCALE,NONE,ZERO
-NONE,XEMAILALARM,CATEGORIES,NONE,ZERO
-NONE,XEMAILALARM,CLASS,NONE,ZERO
-NONE,XEMAILALARM,COMMENT,NONE,ZERO
-NONE,XEMAILALARM,COMPLETED,NONE,ZERO
-NONE,XEMAILALARM,CONTACT,NONE,ZERO
-NONE,XEMAILALARM,CREATED,NONE,ZERO
-NONE,XEMAILALARM,DESCRIPTION,NONE,ONE
-NONE,XEMAILALARM,DTEND,NONE,ZERO
-NONE,XEMAILALARM,DTSTAMP,NONE,ZERO
-NONE,XEMAILALARM,DTSTART,NONE,ZERO
-NONE,XEMAILALARM,DUE,NONE,ZERO
-NONE,XEMAILALARM,DURATION,NONE,ONEMUTUAL,must_have_repeat
-NONE,XEMAILALARM,REPEAT,NONE,ONEMUTUAL,must_have_duration
-NONE,XEMAILALARM,EXDATE,NONE,ZERO
-NONE,XEMAILALARM,EXRULE,NONE,ZERO
-NONE,XEMAILALARM,FREEBUSY,NONE,ZERO
-NONE,XEMAILALARM,GEO,NONE,ZERO
-NONE,XEMAILALARM,LASTMODIFIED,NONE,ZERO
-NONE,XEMAILALARM,LOCATION,NONE,ZERO
-NONE,XEMAILALARM,METHOD,NONE,ZERO
-NONE,XEMAILALARM,ORGANIZER,NONE,ZERO
-NONE,XEMAILALARM,PERCENTCOMPLETE,NONE,ZERO
-NONE,XEMAILALARM,PRIORITY,NONE,ZERO
-NONE,XEMAILALARM,PRODID,NONE,ZERO
-NONE,XEMAILALARM,RDATE,NONE,ZERO
-NONE,XEMAILALARM,RECURRENCEID,NONE,ZERO
-NONE,XEMAILALARM,RELATEDTO,NONE,ZERO
-NONE,XEMAILALARM,REQUESTSTATUS,NONE,ZERO
-NONE,XEMAILALARM,RESOURCES,NONE,ZERO
-NONE,XEMAILALARM,RRULE,NONE,ZERO
-NONE,XEMAILALARM,SEQUENCE,NONE,ZERO
-NONE,XEMAILALARM,STATUS,NONE,ZERO
-NONE,XEMAILALARM,SUMMARY,NONE,ONE
-NONE,XEMAILALARM,TRANSP,NONE,ZERO
-NONE,XEMAILALARM,TRIGGER,NONE,ONE
-NONE,XEMAILALARM,TZID,NONE,ZERO
-NONE,XEMAILALARM,TZNAME,NONE,ZERO
-NONE,XEMAILALARM,TZOFFSETFROM,NONE,ZERO
-NONE,XEMAILALARM,TZOFFSETTO,NONE,ZERO
-NONE,XEMAILALARM,TZURL,NONE,ZERO
-NONE,XEMAILALARM,UID,NONE,ZERO
-NONE,XEMAILALARM,URL,NONE,ZERO
-NONE,XEMAILALARM,VERSION,NONE,ZERO
-NONE,XEMAILALARM,X,NONE,ZEROPLUS
-NONE,XPROCEDUREALARM,ACTION,NONE,ONE
-NONE,XPROCEDUREALARM,ATTACH,NONE,ZEROORONE
-NONE,XPROCEDUREALARM,ATTENDEE,NONE,ZERO
-NONE,XPROCEDUREALARM,CALSCALE,NONE,ZERO
-NONE,XPROCEDUREALARM,CATEGORIES,NONE,ZERO
-NONE,XPROCEDUREALARM,CLASS,NONE,ZERO
-NONE,XPROCEDUREALARM,COMMENT,NONE,ZERO
-NONE,XPROCEDUREALARM,COMPLETED,NONE,ZERO
-NONE,XPROCEDUREALARM,CONTACT,NONE,ZERO
-NONE,XPROCEDUREALARM,CREATED,NONE,ZERO
-NONE,XPROCEDUREALARM,DESCRIPTION,NONE,ZEROORONE
-NONE,XPROCEDUREALARM,DTEND,NONE,ZERO
-NONE,XPROCEDUREALARM,DTSTAMP,NONE,ZERO
-NONE,XPROCEDUREALARM,DTSTART,NONE,ZERO
-NONE,XPROCEDUREALARM,DUE,NONE,ZERO
-NONE,XPROCEDUREALARM,DURATION,NONE,ONEMUTUAL,must_have_repeat
-NONE,XPROCEDUREALARM,REPEAT,NONE,ONEMUTUAL,must_have_duration
-NONE,XPROCEDUREALARM,EXDATE,NONE,ZERO
-NONE,XPROCEDUREALARM,EXRULE,NONE,ZERO
-NONE,XPROCEDUREALARM,FREEBUSY,NONE,ZERO
-NONE,XPROCEDUREALARM,GEO,NONE,ZERO
-NONE,XPROCEDUREALARM,LASTMODIFIED,NONE,ZERO
-NONE,XPROCEDUREALARM,LOCATION,NONE,ZERO
-NONE,XPROCEDUREALARM,METHOD,NONE,ZERO
-NONE,XPROCEDUREALARM,ORGANIZER,NONE,ZERO
-NONE,XPROCEDUREALARM,PERCENTCOMPLETE,NONE,ZERO
-NONE,XPROCEDUREALARM,PRIORITY,NONE,ZERO
-NONE,XPROCEDUREALARM,PRODID,NONE,ZERO
-NONE,XPROCEDUREALARM,RDATE,NONE,ZERO
-NONE,XPROCEDUREALARM,RECURRENCEID,NONE,ZERO
-NONE,XPROCEDUREALARM,RELATEDTO,NONE,ZERO
-NONE,XPROCEDUREALARM,REQUESTSTATUS,NONE,ZERO
-NONE,XPROCEDUREALARM,RESOURCES,NONE,ZERO
-NONE,XPROCEDUREALARM,RRULE,NONE,ZERO
-NONE,XPROCEDUREALARM,SEQUENCE,NONE,ZERO
-NONE,XPROCEDUREALARM,STATUS,NONE,ZERO
-NONE,XPROCEDUREALARM,SUMMARY,NONE,ZERO
-NONE,XPROCEDUREALARM,TRANSP,NONE,ZERO
-NONE,XPROCEDUREALARM,TRIGGER,NONE,ONE
-NONE,XPROCEDUREALARM,TZID,NONE,ZERO
-NONE,XPROCEDUREALARM,TZNAME,NONE,ZERO
-NONE,XPROCEDUREALARM,TZOFFSETFROM,NONE,ZERO
-NONE,XPROCEDUREALARM,TZOFFSETTO,NONE,ZERO
-NONE,XPROCEDUREALARM,TZURL,NONE,ZERO
-NONE,XPROCEDUREALARM,UID,NONE,ZERO
-NONE,XPROCEDUREALARM,URL,NONE,ZERO
-NONE,XPROCEDUREALARM,VERSION,NONE,ZERO
-NONE,XPROCEDUREALARM,X,NONE,ZEROPLUS
+
+NONE,VALARM,ACTION,NONE,ONE
+NONE,VALARM,ATTACH,NONE,ZEROPLUS,validate_valarm_prop
+NONE,VALARM,ATTENDEE,NONE,ZEROPLUS,validate_valarm_prop
+NONE,VALARM,CALSCALE,NONE,ZERO
+NONE,VALARM,CATEGORIES,NONE,ZERO
+NONE,VALARM,CLASS,NONE,ZERO
+NONE,VALARM,COMMENT,NONE,ZERO
+NONE,VALARM,COMPLETED,NONE,ZERO
+NONE,VALARM,CONTACT,NONE,ZERO
+NONE,VALARM,CREATED,NONE,ZERO
+NONE,VALARM,DESCRIPTION,NONE,ZEROORONE,validate_valarm_prop
+NONE,VALARM,DTEND,NONE,ZERO
+NONE,VALARM,DTSTAMP,NONE,ZERO
+NONE,VALARM,DTSTART,NONE,ZERO
+NONE,VALARM,DUE,NONE,ZERO
+NONE,VALARM,DURATION,NONE,ONEMUTUAL,validate_valarm_prop
+NONE,VALARM,REPEAT,NONE,ONEMUTUAL,validate_valarm_prop
+NONE,VALARM,EXDATE,NONE,ZERO
+NONE,VALARM,EXRULE,NONE,ZERO
+NONE,VALARM,FREEBUSY,NONE,ZERO
+NONE,VALARM,GEO,NONE,ZERO
+NONE,VALARM,LASTMODIFIED,NONE,ZERO
+NONE,VALARM,LOCATION,NONE,ZERO
+NONE,VALARM,METHOD,NONE,ZERO
+NONE,VALARM,ORGANIZER,NONE,ZERO
+NONE,VALARM,PERCENTCOMPLETE,NONE,ZERO
+NONE,VALARM,PRIORITY,NONE,ZERO
+NONE,VALARM,PRODID,NONE,ZERO
+NONE,VALARM,RDATE,NONE,ZERO
+NONE,VALARM,RECURRENCEID,NONE,ZERO
+NONE,VALARM,RELATEDTO,NONE,ZERO
+NONE,VALARM,REQUESTSTATUS,NONE,ZERO
+NONE,VALARM,RESOURCES,NONE,ZERO
+NONE,VALARM,RRULE,NONE,ZERO
+NONE,VALARM,SEQUENCE,NONE,ZERO
+NONE,VALARM,STATUS,NONE,ZERO
+NONE,VALARM,SUMMARY,NONE,ZEROORONE,validate_valarm_prop
+NONE,VALARM,TRANSP,NONE,ZERO
+NONE,VALARM,TRIGGER,NONE,ONE
+NONE,VALARM,TZID,NONE,ZERO
+NONE,VALARM,TZNAME,NONE,ZERO
+NONE,VALARM,TZOFFSETFROM,NONE,ZERO
+NONE,VALARM,TZOFFSETTO,NONE,ZERO
+NONE,VALARM,TZURL,NONE,ZERO
+NONE,VALARM,UID,NONE,ZEROORONE
+NONE,VALARM,URL,NONE,ZERO
+NONE,VALARM,VERSION,NONE,ZERO
+NONE,VALARM,X,NONE,ZEROPLUS
+NONE,VALARM,NONE,VLOCATION,ZEROPLUS,validate_valarm_prop
+NONE,VALARM,NONE,VEVENT,ZERO
+NONE,VALARM,NONE,VTODO,ZERO
+NONE,VALARM,NONE,VJOURNAL,ZERO
+NONE,VALARM,NONE,VFREEBUSY,ZERO
+NONE,VALARM,NONE,VAVAILABILITY,ZERO
+NONE,VALARM,NONE,VPOLL,ZERO
+NONE,VALARM,NONE,VTIMEZONE,ZERO
+NONE,VALARM,NONE,VALARM,ZERO
+
NONE,VQUERY,QUERY,NONE,ZEROORONE
NONE,VQUERY,QUERYNAME,NONE,ONE
NONE,VQUERY,EXPAND,NONE,ONE
+
NONE,VAVAILABILITY,ACTION,NONE,ZERO
NONE,VAVAILABILITY,ATTACH,NONE,ZERO
NONE,VAVAILABILITY,ATTENDEE,NONE,ZERO
@@ -1537,6 +1621,7 @@ NONE,VAVAILABILITY,URL,NONE,ZEROORONE
NONE,VAVAILABILITY,VERSION,NONE,ZERO
NONE,VAVAILABILITY,X,NONE,ZEROPLUS
NONE,VAVAILABILITY,NONE,XAVAILABLE,ZEROPLUS
+
NONE,XAVAILABLE,ACTION,NONE,ZERO
NONE,XAVAILABLE,ATTACH,NONE,ZERO
NONE,XAVAILABLE,ATTENDEE,NONE,ZERO
@@ -1585,6 +1670,7 @@ NONE,XAVAILABLE,UID,NONE,ONE
NONE,XAVAILABLE,URL,NONE,ZERO
NONE,XAVAILABLE,VERSION,NONE,ZERO
NONE,XAVAILABLE,X,NONE,ZEROPLUS
+
PUBLISH,VPOLL,NONE,NONE,ONEPLUS
PUBLISH,VPOLL,DTSTAMP,NONE,ONE
PUBLISH,VPOLL,DTSTART,NONE,ZEROORONE
@@ -1624,6 +1710,7 @@ PUBLISH,VPOLL,NONE,VJOURNAL,ZEROPLUS
PUBLISH,VPOLL,NONE,VTODO,ZEROPLUS
PUBLISH,VPOLL,NONE,VTIMEZONE,ZEROPLUS,must_if_tz_ref
PUBLISH,VPOLL,NONE,X,ZEROPLUS
+
REQUEST,VPOLL,NONE,NONE,ONE
REQUEST,VPOLL,DTSTAMP,NONE,ONE
REQUEST,VPOLL,DTSTART,NONE,ZEROORONE
@@ -1666,6 +1753,7 @@ REQUEST,VPOLL,NONE,VFREEBUSY,ZERO
REQUEST,VPOLL,NONE,VAVAILABILITY,ZERO
REQUEST,VPOLL,NONE,VJOURNAL,ZEROPLUS
REQUEST,VPOLL,NONE,VTODO,ZEROPLUS
+
REPLY,VPOLL,NONE,NONE,ONEPLUS
REPLY,VPOLL,DTSTAMP,NONE,ONE
REPLY,VPOLL,ORGANIZER,NONE,ONE
@@ -1708,6 +1796,7 @@ REPLY,VPOLL,NONE,VFREEBUSY,ZERO
REPLY,VPOLL,NONE,VAVAILABILITY,ZERO
REPLY,VPOLL,NONE,VJOURNAL,ZERO
REPLY,VPOLL,NONE,VTODO,ZERO
+
CANCEL,VPOLL,NONE,NONE,ONEPLUS
CANCEL,VPOLL,UID,NONE,ONE
CANCEL,VPOLL,DTSTAMP,NONE,ONE
@@ -1735,7 +1824,7 @@ CANCEL,VPOLL,POLLPROPERTIES,NONE,ZERO
CANCEL,VPOLL,PRIORITY,NONE,ZEROORONE
CANCEL,VPOLL,RELATEDTO,NONE,ZEROPLUS
CANCEL,VPOLL,RESOURCES,NONE,ZEROPLUS
-CANCEL,VPOLL,STATUS,NONE,ZEROORONE,must_be_cancel_if_present
+CANCEL,VPOLL,STATUS,NONE,ZEROORONE,validate_status_value
CANCEL,VPOLL,SUMMARY,NONE,ONE
CANCEL,VPOLL,TRANSP,NONE,ZEROORONE
CANCEL,VPOLL,URL,NONE,ZEROORONE
@@ -1750,6 +1839,7 @@ CANCEL,VPOLL,NONE,VFREEBUSY,ZERO
CANCEL,VPOLL,NONE,VAVAILABILITY,ZERO
CANCEL,VPOLL,NONE,VJOURNAL,ZERO
CANCEL,VPOLL,NONE,VTODO,ZERO
+
REFRESH,VPOLL,NONE,NONE,ONE
REFRESH,VPOLL,DTSTAMP,NONE,ONE
REFRESH,VPOLL,ORGANIZER,NONE,ONE
@@ -1791,6 +1881,7 @@ REFRESH,VPOLL,NONE,VJOURNAL,ZERO
REFRESH,VPOLL,NONE,VEVENT,ZERO
REFRESH,VPOLL,NONE,VFREEBUSY,ZERO
REFRESH,VPOLL,NONE,VAVAILABILITY,ZERO
+
POLLSTATUS,VPOLL,NONE,NONE,ONEPLUS
POLLSTATUS,VPOLL,COMPLETED,NONE,ZEROORONE
POLLSTATUS,VPOLL,DTSTAMP,NONE,ONE
@@ -1830,6 +1921,7 @@ POLLSTATUS,VPOLL,NONE,VJOURNAL,ZEROPLUS
POLLSTATUS,VPOLL,NONE,VTODO,ZEROPLUS
POLLSTATUS,VPOLL,NONE,VTIMEZONE,ZEROPLUS,must_if_tz_ref
POLLSTATUS,VPOLL,NONE,X,ZEROPLUS
+
NONE,VPOLL,DTSTAMP,NONE,ONE
NONE,VPOLL,UID,NONE,ONE
NONE,VPOLL,ORGANIZER,NONE,ONE
@@ -1868,6 +1960,7 @@ NONE,VPOLL,NONE,VAVAILABILITY,ZEROPLUS
NONE,VPOLL,NONE,VJOURNAL,ZEROPLUS
NONE,VPOLL,NONE,VTODO,ZEROPLUS
NONE,VPOLL,NONE,VVOTER,ZEROPLUS
+
NONE,VVOTER,DTSTAMP,NONE,ONE
NONE,VVOTER,VOTER,NONE,ONE
NONE,VVOTER,CREATED,NONE,ZEROORONE
@@ -1894,11 +1987,12 @@ NONE,VVOTER,NONE,VJOURNAL,ZERO
NONE,VVOTER,NONE,VTODO,ZERO
NONE,VVOTER,NONE,XVOTE,ZEROPLUS
NONE,VVOTER,NONE,X,ZEROPLUS
+
NONE,XVOTE,POLLITEMID,NONE,ZEROORONE
NONE,XVOTE,RESPONSE,NONE,ZEROORONE
NONE,XVOTE,COMMENT,NONE,ZEROPLUS
NONE,XVOTE,X,NONE,ZEROPLUS
-NONE,XVOTE,NONE,VALARM,ZEROP
+NONE,XVOTE,NONE,VALARM,ZERO
NONE,XVOTE,NONE,VTIMEZONE,ZERO
NONE,XVOTE,NONE,VEVENT,ZERO
NONE,XVOTE,NONE,VFREEBUSY,ZERO
@@ -1907,6 +2001,7 @@ NONE,XVOTE,NONE,VJOURNAL,ZERO
NONE,XVOTE,NONE,VTODO,ZERO
NONE,XVOTE,NONE,VVOTER,ZERO
NONE,XVOTE,NONE,X,ZEROPLUS
+
NONE,VPATCH,DTSTAMP,NONE,ONE
NONE,VPATCH,UID,NONE,ONE
NONE,VPATCH,PATCHVERSION,NONE,ZEROORONE
@@ -1914,6 +2009,7 @@ NONE,VPATCH,PATCHORDER,NONE,ZEROORONE
NONE,VPATCH,X,NONE,ZEROPLUS
NONE,VPATCH,NONE,XPATCH,ONEPLUS
NONE,VPATCH,NONE,X,ZEROPLUS
+
NONE,XPATCH,PATCHTARGET,NONE,ONE
NONE,XPATCH,PATCHDELETE,NONE,ZEROPLUS
NONE,XPATCH,PATCHPARAMETER,NONE,ZEROPLUS
@@ -1921,3 +2017,47 @@ NONE,XPATCH,X,NONE,ZEROPLUS
NONE,XPATCH,NONE,VPATCH,ZERO
NONE,XPATCH,NONE,XPATCH,ZERO
NONE,XPATCH,NONE,X,ZEROPLUS
+
+NONE,PARTICIPANT,UID,NONE,ONE
+NONE,PARTICIPANT,PARTICIPANTTYPE,NONE,ONE
+NONE,PARTICIPANT,CALENDARADDRESS,NONE,ZEROORONE
+NONE,PARTICIPANT,CREATED,NONE,ZEROORONE
+NONE,PARTICIPANT,DESCRIPTION,NONE,ZEROORONE
+NONE,PARTICIPANT,DTSTAMP,NONE,ZEROORONE
+NONE,PARTICIPANT,GEO,NONE,ZEROORONE
+NONE,PARTICIPANT,LASTMODIFIED,NONE,ZEROORONE
+NONE,PARTICIPANT,PRIORITY,NONE,ZEROORONE
+NONE,PARTICIPANT,SEQUENCE,NONE,ZEROORONE
+NONE,PARTICIPANT,STATUS,NONE,ZEROORONE
+NONE,PARTICIPANT,SUMMARY,NONE,ZEROORONE
+NONE,PARTICIPANT,URL,NONE,ZEROORONE
+NONE,PARTICIPANT,ATTACH,NONE,ZEROPLUS
+NONE,PARTICIPANT,CATEGORIES,NONE,ZEROPLUS
+NONE,PARTICIPANT,COMMENT,NONE,ZEROPLUS
+NONE,PARTICIPANT,CONTACT,NONE,ZEROPLUS
+NONE,PARTICIPANT,LOCATION,NONE,ZEROPLUS
+NONE,PARTICIPANT,REQUESTSTATUS,NONE,ZEROPLUS
+NONE,PARTICIPANT,RELATEDTO,NONE,ZEROPLUS
+NONE,PARTICIPANT,RESOURCES,NONE,ZEROPLUS
+NONE,PARTICIPANT,STYLEDDESCRIPTION,NONE,ZEROPLUS
+NONE,PARTICIPANT,STRUCTUREDDATA,NONE,ZEROPLUS
+NONE,PARTICIPANT,X,NONE,ZEROPLUS
+NONE,PARTICIPANT,NONE,VLOCATION,ZEROPLUS
+NONE,PARTICIPANT,NONE,VRESOURCE,ZEROPLUS
+NONE,PARTICIPANT,NONE,X,ZEROPLUS
+
+NONE,VLOCATION,UID,NONE,ONE
+NONE,VLOCATION,DESCRIPTION,NONE,ZEROORONE
+NONE,VLOCATION,GEO,NONE,ZEROORONE
+NONE,VLOCATION,LOCATIONTYPE,NONE,ZEROORONE
+NONE,VLOCATION,NAME,NONE,ZEROORONE
+NONE,VLOCATION,STRUCTUREDDATA,NONE,ZEROPLUS
+NONE,VLOCATION,X,NONE,ZEROPLUS
+
+NONE,VRESOURCE,UID,NONE,ONE
+NONE,VRESOURCE,DESCRIPTION,NONE,ZEROORONE
+NONE,VRESOURCE,GEO,NONE,ZEROORONE
+NONE,VRESOURCE,NAME,NONE,ZEROORONE
+NONE,VRESOURCE,RESOURCETYPE,NONE,ZEROORONE
+NONE,VRESOURCE,STRUCTUREDDATA,NONE,ZEROPLUS
+NONE,VRESOURCE,X,NONE,ZEROPLUS
diff --git a/design-data/value-types.csv b/design-data/value-types.csv
index 3e628344..af0ac9e5 100644
--- a/design-data/value-types.csv
+++ b/design-data/value-types.csv
@@ -13,11 +13,13 @@
"URI","5018","(a)const char*","string","unitary",
"UTC-OFFSET","5029","(a)int","integer","unitary",
"QUERY","5001","(a)const char*","string","unitary",
+
"#Non-standard multi-valued types",,,,
"ATTACH","5003","(m)icalattach *","none","URI;BINARY",
"DATE-TIME-DATE","5036","(m)struct icaltimetype","Time","DATE-TIME;DATE",
"DATE-TIME-PERIOD","5015","(m)struct icaldatetimeperiodtype","none","DATE-TIME;DATE;PERIOD",
"TRIGGER","5024","(m)struct icaltriggertype","string","DURATION;DATE-TIME",
+
"#Non-standard property enumeration types",,,,
"#METHOD:POLLSTATUS from draft-york-vpoll",,,,
"METHOD","5030","(a)enum icalproperty_method","string","unitary","X=10500;PUBLISH;REQUEST;REPLY;ADD;CANCEL;REFRESH;COUNTER;DECLINECOUNTER;CREATE;READ;RESPONSE;MOVE;MODIFY;GENERATEUID;DELETE;POLLSTATUS;NONE=10599"
@@ -26,24 +28,37 @@
"STATUS","5005","(a)enum icalproperty_status","string","unitary","X=10900;TENTATIVE;CONFIRMED;COMPLETED;NEEDS-ACTION;CANCELLED;IN-PROCESS;DRAFT;FINAL;SUBMITTED;PENDING;FAILED;DELETED;NONE=10999"
"TRANSP","5006","(a)enum icalproperty_transp","string","unitary","X=11000;OPAQUE;OPAQUE-NOCONFLICT;TRANSPARENT;TRANSPARENT-NOCONFLICT;NONE=11099"
"CLASS","5019","(m)enum icalproperty_class","string","unitary","X=10300;PUBLIC;PRIVATE;CONFIDENTIAL;NONE=10399"
+
"#Other non-standard",,,,
"REQUEST-STATUS","5009","(a)struct icalreqstattype","string","unitary"
"GEO","5004","(m)struct icalgeotype","tuple","unitary",
"STRING","5007","(a)const char*","string","unitary",
"X","5022","(m)const char*","string","unitary",
+
"#CAP enumeration types",,,,
"CMD","5010","(a)enum icalproperty_cmd","string","unitary","X=10400;ABORT;CONTINUE;CREATE;DELETE;GENERATE-UID;GET-CAPABILITY;IDENTIFY;MODIFY;MOVE;REPLY;SEARCH;SET-LOCALE;NONE=10499"
"QUERY-LEVEL","5012","(a)enum icalproperty_querylevel","string","unitary","X=10800;CAL-QL-1;CAL-QL-NONE;NONE=10899"
"CAR-LEVEL","5016","(a)enum icalproperty_carlevel","string","unitary","X=10200;CAR-NONE;CAR-MIN;CAR-FULL-1;NONE=10299"
"ANY","5000",,,,
"NO","5031",,,,
+
"#VAVAILABILITY types","RFC 7953 Section 3.2",,,
"BUSYTYPE","5032","(a)enum icalproperty_busytype","string","unitary","X=10100;BUSY;BUSY-UNAVAILABLE;BUSY-TENTATIVE;NONE=10199"
+
"#VPOLL types","draft-york-vpoll",,,
"POLLMODE","5033","(a)enum icalproperty_pollmode","string","unitary","X=10700;BASIC;NONE=10799"
"POLLCOMPLETION","5034","(a)enum icalproperty_pollcompletion","string","unitary","X=10600;SERVER;SERVER-SUBMIT;SERVER-CHOICE;CLIENT;NONE=10699"
+
"#Task Extension types","draft-apthorp-ical-tasks",,,
"TASKMODE","5035","(a)enum icalproperty_taskmode","string","unitary","X=11200;AUTOMATIC-COMPLETION;AUTOMATIC-FAILURE;AUTOMATIC-STATUS;NONE=11299"
+
+"#VALARM Extension types","RFC 9074 Section 8.1",,,
+"PROXIMITY","5039","(a)enum icalproperty_proximity","string","unitary","X=11300;ARRIVE;DEPART;CONNECT;DISCONNECT;NONE=11399"
+
+"#Event Publication Extension types","RFC 9073 Section 6",,,
+"PARTICIPANTTYPE","5037","(a)enum icalproperty_participanttype","string","unitary","X=11400;ACTIVE;INACTIVE;SPONSOR;CONTACT;BOOKING-CONTACT;EMERGENCY-CONTACT;PUBLICITY-CONTACT;PLANNER-CONTACT;PERFORMER;SPEAKER;NONE=11499"
+"RESOURCETYPE","5038","(a)enum icalproperty_resourcetype","string","unitary","X=11500;ROOM;PROJECTOR;REMOTE-CONFERENCE-AUDIO;REMOTE-CONFERENCE-VIDEO;NONE=11599"
+
"#NOTE for updaters. Preserve the icalvalue_kind Enum values and property Enum values to aid forward compatibility"
"# New Enum values for an existing icalvalue_kind should be inserted before the corresponding NONE value"
-"# New icalvalue_kind types should start their Enum value after the highest NONE value (currently 11299)"
+"# New icalvalue_kind types should start their Enum value after the highest NONE value (currently 11599)"
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 5a33a4d3..880fe759 100644
--- a/doc/CMakeLists.txt
+++ b/doc/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(reference)
#
@@ -18,7 +21,7 @@ set_package_properties(Doxygen PROPERTIES
PURPOSE "Needed to build the API documentation."
)
if(DOXYGEN_FOUND)
- file(GLOB _dox_deps *.dox *.html)
+ file(GLOB _dox_deps *.dox *.html *.md ${CMAKE_SOURCE_DIR}/README.md)
file(GLOB _all_hdrs
${CMAKE_SOURCE_DIR}/src/libical/*.h
${CMAKE_SOURCE_DIR}/src/libical/*.c
@@ -47,14 +50,22 @@ if(DOXYGEN_FOUND)
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
)
+ set(DOXYGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/apidocs/html)
add_custom_command(
- OUTPUT ${CMAKE_BINARY_DIR}/apidocs/html/index.html
+ OUTPUT ${DOXYGEN_OUTPUT_DIR}/index.html
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+ #copy some files by-hand that are referred to by the markdown README
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/Install.txt ${DOXYGEN_OUTPUT_DIR}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXYGEN_OUTPUT_DIR}/src/libicalvcal
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${CMAKE_SOURCE_DIR}/src/libicalvcal/README.txt ${DOXYGEN_OUTPUT_DIR}/src/libicalvcal
DEPENDS ${_all_hdrs} ${_dox_deps} ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMENT "Run Doxygen"
)
add_custom_target(docs
DEPENDS ${CMAKE_BINARY_DIR}/apidocs/html/index.html
+ COMMENT "Target to build the documentation"
)
add_dependencies(docs ical icalss icalvcal)
if(WITH_CXX_BINDINGS)
diff --git a/doc/Doxyfile.cmake b/doc/Doxyfile.cmake
index 14a5bb3c..4b76e444 100644
--- a/doc/Doxyfile.cmake
+++ b/doc/Doxyfile.cmake
@@ -1,3 +1,6 @@
+#SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+#SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
# Doxyfile 1.8.20
# This file describes the settings to be used by the documentation system
@@ -845,32 +848,7 @@ WARN_LOGFILE = doxygen.log
# Note: If this tag is empty the current directory is searched.
INPUT = @DOXYGEN_INPUT@
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
-# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
-# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
-# possible encodings.
-# The default value is: UTF-8.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
-# *.h) to filter out the source-files in the directories.
-#
-# Note that for custom extensions or not directly supported extensions you also
-# need to set EXTENSION_MAPPING for the extension otherwise the files are not
-# read by doxygen.
-#
-# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
-# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
-# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
-# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
-# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen
-# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
-# *.vhdl, *.ucf, *.qsf and *.ice.
-
+USE_MDFILE_AS_MAINPAGE = README.md
FILE_PATTERNS = *.cpp \
*.c \
*.cc \
@@ -879,6 +857,7 @@ FILE_PATTERNS = *.cpp \
*.hh \
*.hxx \
*.hpp \
+ *.md \
*.dox
# The RECURSIVE tag can be used to specify whether or not subdirectories should
@@ -895,14 +874,7 @@ RECURSIVE = YES
# run.
EXCLUDE = @CMAKE_SOURCE_DIR@/src/java \
- @CMAKE_SOURCE_DIR@/src/php \
- @CMAKE_SOURCE_DIR@/src/python
-
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
-# directories that are symbolic links (a Unix file system feature) are excluded
-# from the input.
-# The default value is: NO.
-
+ @CMAKE_SOURCE_DIR@/src/php
EXCLUDE_SYMLINKS = NO
# If the value of the INPUT tag contains directories, you can use the
@@ -2163,29 +2135,13 @@ INCLUDE_PATH =
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that are
-# defined before the preprocessor is started (similar to the -D option of e.g.
-# gcc). The argument of the tag is a list of macros of the form: name or
-# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
-# is assumed. To prevent a macro definition from being undefined via #undef or
-# recursively expanded use the := operator instead of the = operator.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-PREDEFINED = "LIBICAL_ICAL_EXPORT=" \
- "LIBICAL_ICALSS_EXPORT=" \
- "LIBICAL_VCAL_EXPORT=" \
- "LIBICAL_ICAL_NO_EXPORT=" \
- "LIBICAL_ICALS_NO_EXPORT=" \
- "LIBICAL_VCAL_NO_EXPORT="
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
-# tag can be used to specify a list of macro names that should be expanded. The
-# macro definition that is found in the sources will be used. Use the PREDEFINED
-# tag if you want to use a different macro definition that overrules the
-# definition found in the source code.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
+PREDEFINED = LIBICAL_ICAL_EXPORT="" \
+ LIBICAL_ICALSS_EXPORT="" \
+ LIBICAL_VCAL_EXPORT="" \
+ LIBICAL_ICAL_NO_EXPORT="" \
+ LIBICAL_ICALS_NO_EXPORT="" \
+ LIBICAL_VCAL_NO_EXPORT="" \
+ LIBICAL_DEPRECATED=
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
diff --git a/doc/Mainpage.dox b/doc/Mainpage.dox
deleted file mode 100644
index 7e9cd259..00000000
--- a/doc/Mainpage.dox
+++ /dev/null
@@ -1,37 +0,0 @@
-/*!
-@mainpage Libical - an implementation of iCalendar protocols and data formats
-
-@section about About
-
-Libical is an Open Source implementation of the iCalendar protocols
-and protocol data units. The iCalendar specification describes how
-calendar clients can communicate with calendar servers so users can
-store their calendar data and arrange meetings with other users.
-
-Libical implements RFC5545, RFC5546, RFC7529;
-the CalDav scheduling extensions in RFC6638;
-iCalendar extensions in RFC7986;
-plus the iCalendar iMIP protocol in RFC6047.
-
-@section license License
-
-The code and datafiles in this distribution are licensed under the
-Mozilla Public License (MPL) v2.0. See https://www.mozilla.org/MPL
-for a copy of the license.
-
-Alternately, you may use libical under the terms of the GNU Library
-General Public License (LGPL) v2.1. See https://www.gnu.org/licenses/lgpl-2.1.txt
-for a copy of the license.
-
-This dual license ensures that the library can be incorporated into
-both proprietary code and GPL'd programs, and will benefit from improvements
-made by programmers in both realms. I will only accept changes into
-my version of the library if they are similarly dual-licensed.
-
-@section acknowledgements Acknowledgments
-
-Portions of this distribution are (C) Copyright 1996 Apple Computer,
-Inc., AT&T Corp., International Business Machines Corporation and
-Siemens Rolm Communications Inc. See src/libicalvcal/README.TXT for details.
-
-*/
diff --git a/doc/UsingLibical.md b/doc/UsingLibical.md
index 39e9901f..721523f7 100644
--- a/doc/UsingLibical.md
+++ b/doc/UsingLibical.md
@@ -11,24 +11,18 @@ and protocol data units. The iCalendar specification describes how
calendar clients can communicate with calendar servers so users can
store their calendar data and arrange meetings with other users.
-Libical implements [RFC5545][], [RFC5546][], [RFC7529][]; the
-iCalendar extensions in [RFC6638][]; and some of [RFC6047][].
+Libical implements multiple [RFC calendar standards](@ref rfcs).
This documentation assumes that you are familiar with the iCalendar
standards RFC5545 and RFC5546. These specifications are available
at the [IETF Tools][] website:
-[RFC5545]: https://tools.ietf.org/html/rfc5545
-[RFC5546]: https://tools.ietf.org/html/rfc5546
-[RFC7529]: https://tools.ietf.org/html/rfc7529
-[RFC6638]: https://tools.ietf.org/html/rfc6638
-[RFC6047]: https://tools.ietf.org/html/rfc6047
[IETF Tools]: https://tools.ietf.org/
### 1.1 The libical project
This code is under active development. If you would like to contribute
-to the project, visit <https://libical.github.io/libical/>
+to the project, visit <https://libical.github.io/libical/>.
### 1.2 License
@@ -40,8 +34,8 @@ See <https://www.gnu.org/licenses/lgpl-2.1.html> for a copy of the LGPL.
This dual license ensures that the library can be incorporated into
both proprietary code and GPL'd programs, and will benefit from improvements
-made by programmers in both realms. I will only accept changes into
-my version of the library if they are similarly dual-licensed.
+made by programmers in both realms. We (the libical developers) will only
+accept changes to this library if they are similarly dual-licensed.
### 1.3 Example Code
@@ -439,7 +433,7 @@ int main(int argc, char *argv[])
}
```
-The parser object parameterizes the routine used to get input lines
+The parser object parametrizes the routine used to get input lines
with `icalparser_set_gen_data()`and `icalparser_get_line()`. In this
example, the routine `read_stream()` will fetch the next line from a
stream, with the stream passed in as the `void*` parameter d. The parser
@@ -870,7 +864,7 @@ struct icaltimetype icaltime_from_string(
const char* str);
struct icaltimetype icaltime_from_timet_with_zone(
- time_t v,
+ icaltime_t v,
int is_date,
icaltimezone* zone);
```
@@ -881,7 +875,7 @@ struct icaltimetype icaltime_from_timet_with_zone(
struct icaltimetype tt = icaltime_from_string("19970101T103000");
```
-`icaltime_from_timet_with_zone()` takes a `time_t` value, representing seconds past
+`icaltime_from_timet_with_zone()` takes a `icaltime_t` value, representing seconds past
the POSIX epoch, a flag to indicate if the time is a date, and a time zone.
Dates have an identical structure to a time, but the time portion (hours,
minutes and seconds) is always 00:00:00. Dates act differently in
@@ -954,11 +948,11 @@ the hour, minute and second fields should be used in the conversion.
```c
struct icaltimetype icaltime_from_timet_with_zone(
- time_t v,
+ icaltime_t v,
int is_date,
icaltimezone* zone);
-time_t icaltime_as_timet(
+icaltime_t icaltime_as_timet(
struct icaltimetype);
```
@@ -1113,7 +1107,7 @@ open an existing file for reading and writing, or create a new file
if it does not exist. `icalfileset_new_open()` takes the same arguments
as the open() system routine and behaves in the same way.
-The icalset and icalfilset objects are somewhat interchangeable -- you
+The icalset and icalfileset objects are somewhat interchangeable -- you
can use an `icalfileset*` as an argument to any of the icalset routines.
The following examples will all use icalfileset routines; using the
@@ -1129,7 +1123,7 @@ icalerrorenum icalfileset_add_component(
icalcomponent* child);
```
-The fileset keeps an inmemory copy of the components, and this set
+The fileset keeps an in-memory copy of the components, and this set
must be written back to the file occasionally. There are two routines
to manage this:
@@ -1191,8 +1185,7 @@ DTSTART <= '20000106T120000Z'");
fs = icalfileset_new(path);
for (i = 0; i!= 10; i++){
- c = make_component(i); /* Make a new component where DTSTART
-has month of i */
+ c = make_component(i); /* Make a new component where DTSTART has month of i */
icalfileset_add_component(fs,c);
}
@@ -1217,7 +1210,8 @@ has month of i */
There are several other routines in the icalset interface, but they
not fully implemented yet.
-#### <a id="memory"></a>5.5 Memory Management
+<a id="memory"></a>
+#### 5.5 Memory Management
Libical relies heavily on dynamic allocation for both the core objects
and for the strings used to hold values. Some of this memory the library
@@ -1225,13 +1219,14 @@ caller owns and must free, and some of the memory is managed by the
library. Here is a summary of the memory rules.
1. If the function name has "new" in it (such as `icalcomponent_new()`,
- or `icalpropert_new_clone()`), the caller gets control
- of the memory.
+ or `icalproperty_new_from_string()`), the caller gets control
+ of the memory. The caller also gets control over an object that is
+ cloned via a function that ends with "_clone" (like `icalcomponent_clone()`)
-2. If you got the memory from a routine with new in it, you must
- call the corresponding `*_free()` routine to free the memory, for
- example use `icalcomponent_free()` to free objects created with
- `icalcomponent_new()`)
+2. If you got the memory from a routine with "clone" or "new" in it, you
+ must call the corresponding `*_free()` routine to free the memory,
+ for example use `icalcomponent_free()` to free objects created with
+ `icalcomponent_new()` or `icalcomponent_clone()`
3. If the function name has "add" in it, the caller is transferring
control of the memory to the routine, for example the function
@@ -1322,30 +1317,12 @@ RFC5545.
There are a few routines to manipulate error properties:
-The following data is supposed to be in a table. It looks OK in LyX,
-but does not format properly in output.
-
-+-------------------------------------+---------------------------------------------------------+
-| Routine | Purpose |
-+-------------------------------------+---------------------------------------------------------+
-| void icalrestriction_check() | Check a component against RFC5546 and insert |
-+-------------------------------------+---------------------------------------------------------+
-| | error properties to indicate non compliance |
-+-------------------------------------+---------------------------------------------------------+
-| int icalcomponent_count_errors() | Return the number of error properties |
-+-------------------------------------+---------------------------------------------------------+
-| | in a component |
-+-------------------------------------+---------------------------------------------------------+
-| void icalcomponent_strip_errors() | Remove all error properties in as |
-+-------------------------------------+---------------------------------------------------------+
-| | component |
-+-------------------------------------+---------------------------------------------------------+
-| void icalcomponent_convert_errors() | Convert some error properties into |
-+-------------------------------------+---------------------------------------------------------+
-| | REQUESTS-STATUS proprties to indicate the inability to |
-+-------------------------------------+---------------------------------------------------------+
-| | process the component as an iTIP request. |
-+-------------------------------------+---------------------------------------------------------+
+| Routine | Purpose |
+|:--------------------------------------|:-----------------------------------------------------|
+| `void icalrestriction_check()` | Check a component against RFC5546 and insert error properties to indicate non compliance |
+| `int icalcomponent_count_errors()` | Return the number of error properties in a component |
+| `void icalcomponent_strip_errors()` | Remove all error properties in a component |
+| `void icalcomponent_convert_errors()` | Convert some error properties into REQUESTS-STATUS properties to indicate the inability to process the component as an iTIP request |
The types of errors are listed in icalerror.h. They are:
diff --git a/doc/reference/CMakeLists.txt b/doc/reference/CMakeLists.txt
index 50a1997e..630ddf9b 100644
--- a/doc/reference/CMakeLists.txt
+++ b/doc/reference/CMakeLists.txt
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Milan Crha <mcrha@redhat.com>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
if(ICAL_GLIB)
add_subdirectory(libical-glib)
endif()
diff --git a/doc/reference/libical-glib/CMakeLists.txt b/doc/reference/libical-glib/CMakeLists.txt
index c4f8b594..df4be031 100644
--- a/doc/reference/libical-glib/CMakeLists.txt
+++ b/doc/reference/libical-glib/CMakeLists.txt
@@ -1,3 +1,5 @@
+# SPDX-FileCopyrightText: Milan Crha <mcrha@redhat.com>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
option(ENABLE_GTK_DOC "Use gtk-doc to build documentation" True)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 2ad6e639..c5a8441c 100644
--- a/examples/CMakeLists.txt
+++ b/examples/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
@@ -28,11 +31,13 @@ else()
icalss-static
icalvcal-static
)
- target_link_libraries(doesnothing ${CMAKE_THREAD_LIBS_INIT})
+ if(DEFINED CMAKE_THREAD_LIBS_INIT)
+ target_link_libraries(doesnothing ${CMAKE_THREAD_LIBS_INIT})
+ endif()
if(ICU_FOUND)
target_link_libraries(doesnothing ${ICU_LIBRARIES})
endif()
- if(BDB_FOUND)
+ if(BDB_FOUND)
target_link_libraries(doesnothing ${BDB_LIBRARY})
endif()
endif()
diff --git a/examples/access_components.c b/examples/access_components.c
index 726d5cce..597e5e7d 100644
--- a/examples/access_components.c
+++ b/examples/access_components.c
@@ -1,4 +1,8 @@
-/* Access_component.c */
+/* Access_component.c
+
+ SPDX-FileCopyrightText: <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
#include <libical/ical.h>
@@ -20,13 +24,10 @@ void do_something(icalcomponent *c);
constructors, resulting in a compact, neatly formatted way to create
components. This style is shown in create_new_component_with_va_args()
-
-
*/
icalcomponent* create_new_component(void)
{
-
/* variable definitions */
icalcomponent* calendar;
icalcomponent* event;
@@ -57,7 +58,6 @@ icalcomponent* create_new_component(void)
icalproperty_new_version("2.0")
);
-
/* Here is the short version of the memory rules:
If the routine name has "new" in it:
@@ -132,7 +132,6 @@ icalcomponent* create_new_component(void)
icalcomponent_add_property(event,property);
-
/* more properties */
icalcomponent_add_property(
@@ -169,7 +168,6 @@ icalcomponent* create_new_component(void)
icalcomponent_add_property(event,property);
-
property = icalproperty_new_dtend(atime);
icalproperty_add_parameter(
@@ -189,13 +187,11 @@ icalcomponent* create_new_component(void)
return calendar;
}
-
/* Now, create the same component as in the previous routine, but use
the constructor style. */
icalcomponent* create_new_component_with_va_args(void)
{
-
/* This is a similar set up to the last routine */
icalcomponent* calendar;
struct icaltimetype atime = icaltime_from_timet_with_zone(time(0), 0, icaltimezone_get_utc_timezone());
@@ -254,7 +250,6 @@ icalcomponent* create_new_component_with_va_args(void)
0
);
-
/* Note that properties with no parameters can use the regular
'new' constructor, while those with parameters use the 'vanew'
constructor. And, be sure that the last argument in the 'vanew'
@@ -263,7 +258,6 @@ icalcomponent* create_new_component_with_va_args(void)
return calendar;
}
-
void find_sub_components(icalcomponent* comp)
{
icalcomponent *c;
@@ -286,7 +280,6 @@ void find_sub_components(icalcomponent* comp)
do_something(c);
}
-
}
/* Ical components only have one internal iterator, so removing the
@@ -307,5 +300,4 @@ void remove_vevent_sub_components(icalcomponent* comp){
do_something(c);
}
-
}
diff --git a/examples/access_properties_and_parameters.c b/examples/access_properties_and_parameters.c
index 04df481a..7716edbc 100644
--- a/examples/access_properties_and_parameters.c
+++ b/examples/access_properties_and_parameters.c
@@ -1,4 +1,8 @@
-/* access_properties_and_parameters.c */
+/* access_properties_and_parameters.c
+
+ SPDX-FileCopyrightText: <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
#include <libical/ical.h>
#include <stdlib.h>
@@ -47,7 +51,6 @@ void get_required_attendees(icalcomponent* event)
printf("%s",attendee);
}
}
-
}
/* Here is a similar example. If an attendee has a PARTSTAT of
@@ -93,7 +96,6 @@ void update_attendees(icalcomponent* event)
icalparameter_new_partstat(ICAL_PARTSTAT_TENTATIVE)
);
}
-
}
}
@@ -134,7 +136,7 @@ void test_properties(void)
free(str);
/* Make a copy of the property. Caller owns the memory */
- clone = icalproperty_new_clone(prop);
+ clone = icalproperty_clone(prop);
/* Get a reference to the value within the clone property */
value = icalproperty_get_value(clone);
@@ -146,5 +148,4 @@ void test_properties(void)
/* Frees the original and the clone */
icalproperty_free(clone);
icalproperty_free(prop);
-
}
diff --git a/examples/changenames.pl b/examples/changenames.pl
deleted file mode 100644
index 4adf84b9..00000000
--- a/examples/changenames.pl
+++ /dev/null
@@ -1,4 +0,0 @@
-s/icalcluster/icalfileset/g;
-s/ICALCLUSTER/ICALFILESET/g;
-s/icalstore/icaldirset/g;
-s/ICALSTORE/ICALDIRSET/g;
diff --git a/examples/errors.c b/examples/errors.c
index 8952cb7c..0f2ae1d0 100644
--- a/examples/errors.c
+++ b/examples/errors.c
@@ -1,4 +1,8 @@
-/* errors.c */
+/* errors.c
+
+ SPDX-FileCopyrightText: <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
#include <libical/ical.h>
@@ -37,17 +41,13 @@ void component_errors(icalcomponent *comp)
p != 0;
p = icalcomponent_get_next_property(comp,ICAL_XLICERROR_PROPERTY))
{
-
printf("-- The error is %s:\n",icalproperty_get_xlicerror(p));
}
-
-
/* Check the component for iTIP compilance, and add more
X-LIC-ERROR properties if it is non-compilant. */
icalrestriction_check(comp);
-
/* Count the new errors. */
if(errors != icalcomponent_count_errors(comp)){
printf(" -- The component also has iTIP restriction errors \n");
@@ -59,7 +59,5 @@ void component_errors(icalcomponent *comp)
properties in the reply. This following routine makes this
conversion */
-
icalcomponent_convert_errors(comp);
-
}
diff --git a/examples/main.c b/examples/main.c
index 3f7c78e0..532407a6 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -1,4 +1,9 @@
-/* This is just to make the code in the example directory link properly. */
+/* This is just to make the code in the example directory link properly.
+
+ SPDX-FileCopyrightText: <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
+
#include <libical/ical.h>
int main(void)
@@ -6,7 +11,6 @@ int main(void)
return 1;
}
-
void do_something(icalcomponent* comp)
{
(void)comp;/*unused*/
diff --git a/examples/parse_text.c b/examples/parse_text.c
index 67a2345f..d97ef4c6 100644
--- a/examples/parse_text.c
+++ b/examples/parse_text.c
@@ -1,6 +1,9 @@
/* parse_text.c
- */
+ SPDX-FileCopyrightText: <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
+
#include <libical/ical.h>
#include <stdlib.h>
@@ -43,7 +46,6 @@ void parse_text(char* argv[])
completes a component, c will be non-zero */
c = icalparser_add_line(parser,line);
-
if (c != 0){
char *temp = icalcomponent_as_ical_string_r(c);
printf("%s", temp);
@@ -56,6 +58,5 @@ void parse_text(char* argv[])
} while ( line != 0);
-
icalparser_free(parser);
}
diff --git a/libical.pc.in b/libical.pc.in
index c07eb52a..8366cb2f 100644
--- a/libical.pc.in
+++ b/libical.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/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 39000a42..b650e8dc 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -1,2 +1,4 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
########### install files ###############
diff --git a/scripts/buildtests.sh b/scripts/buildtests.sh
index afbfda88..663f2f17 100755
--- a/scripts/buildtests.sh
+++ b/scripts/buildtests.sh
@@ -1,5 +1,8 @@
#!/bin/bash
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
#Exit if any undefined variable is used.
set -u
#Exit this script if it any subprocess exits non-zero.
@@ -28,17 +31,20 @@ HELP() {
echo
echo "Run build tests"
echo "Options:"
- echo " -m, --no-cmake-compat Don't require CMake version compatibility"
- echo " -k, --no-krazy Don't run any Krazy tests"
- echo " -c, --no-cppcheck Don't run any cppcheck tests"
- echo " -t, --no-tidy Don't run any clang-tidy tests"
- echo " -b, --no-scan Don't run any scan-build tests"
- echo " -s, --no-splint Don't run any splint tests"
- echo " -n, --no-ninja Don't run any build tests with ninja"
- echo " -l, --no-clang-build Don't run any clang-build tests"
- echo " -g, --no-gcc-build Don't run any gcc-build tests"
- echo " -a, --no-asan-build Don't run any ASAN-build tests"
- echo " -d, --no-tsan-build Don't run any TSAN-build tests"
+ echo " -m, --no-cmake-compat Don't require CMake version compatibility"
+ echo " -k, --no-krazy Don't run any Krazy tests"
+ echo " -c, --no-cppcheck Don't run any cppcheck tests"
+ echo " -t, --no-tidy Don't run any clang-tidy tests"
+ echo " -b, --no-scan Don't run any scan-build tests"
+ echo " -s, --no-splint Don't run any splint tests"
+ echo " -p, --no-codespell Don't run any codespell tests"
+ echo " -n, --no-ninja Don't run any build tests with ninja"
+ echo " -l, --no-clang-build Don't run any clang-build tests"
+ echo " -g, --no-gcc-build Don't run any gcc-build tests"
+ echo " -a, --no-asan-build Don't run any ASAN-build (sanitize-address) tests"
+ echo " -d, --no-tsan-build Don't run any TSAN-build (sanitize-threads) tests"
+ echo " -u, --no-ubsan-build Don't run any UBSAN-build (sanitize-undefined) tests"
+ echo " -x, --no-memc-build Don't run any MEMCONSIST-build (memory consistency) tests"
echo " -f, --no-fortify-build Don't run the FORTIFY-build tests (gcc12)"
echo
}
@@ -145,9 +151,9 @@ CONFIGURE() {
rm -rf *
if ( test `echo $2 | grep -ci Ninja` -gt 0 )
then
- cmake .. $2 || exit 1
+ cmake --warn-uninitialized -Werror=dev .. $2 || exit 1
else
- cmake -G "Unix Makefiles" .. $2 || exit 1
+ cmake -G "Unix Makefiles" --warn-uninitialized -Werror=dev .. $2 || exit 1
fi
}
@@ -262,8 +268,24 @@ CLANG_BUILD() {
echo "===== END CLANG BUILD: $1 ======"
}
+#function MEMCONSIST_BUILD:
+# runs a gcc memory consistency build test
+# $1 = the name of the test (which will have "-mem" appended to it)
+# $2 = CMake options
+MEMCONSIST_BUILD() {
+ name="$1-mem"
+ if ( test $runmemcbuild -ne 1 )
+ then
+ echo "===== MEMCONSIST BUILD TEST $1 DISABLED DUE TO COMMAND LINE OPTION ====="
+ return
+ fi
+ echo "===== START MEMCONSIST BUILD: $1 ======"
+ BUILD "$name" "-DLIBICAL_DEVMODE_MEMORY_CONSISTENCY=True $2"
+ echo "===== END MEMCONSIST BUILD: $1 ======"
+}
+
#function ASAN_BUILD:
-# runs an clang ASAN build test
+# runs a clang ASAN build test
# $1 = the name of the test (which will have "-asan" appended to it)
# $2 = CMake options
ASAN_BUILD() {
@@ -275,12 +297,12 @@ ASAN_BUILD() {
fi
echo "===== START ASAN BUILD: $1 ======"
SET_CLANG
- BUILD "$name" "-DADDRESS_SANITIZER=True $2"
+ BUILD "$name" "-DLIBICAL_DEVMODE_ADDRESS_SANITIZER=True $2"
echo "===== END ASAN BUILD: $1 ======"
}
#function TSAN_BUILD:
-# runs an clang TSAN build test
+# runs a clang TSAN build test
# $1 = the name of the test (which will have "-tsan" appended to it)
# $2 = CMake options
TSAN_BUILD() {
@@ -292,10 +314,27 @@ TSAN_BUILD() {
fi
echo "===== START TSAN BUILD: $1 ======"
SET_CLANG
- BUILD "$name" "-DTHREAD_SANITIZER=True $2"
+ BUILD "$name" "-DLIBICAL_DEVMODE_THREAD_SANITIZER=True $2"
echo "===== END TSAN BUILD: $1 ======"
}
+#function UBSAN_BUILD:
+# runs a clang UBSAN build test
+# $1 = the name of the test (which will have "-ubsan" appended to it)
+# $2 = CMake options
+UBSAN_BUILD() {
+ name="$1-ubsan"
+ if ( test $runubsanbuild -ne 1 )
+ then
+ echo "===== UBSAN BUILD TEST $1 DISABLED DUE TO COMMAND LINE OPTION ====="
+ return
+ fi
+ echo "===== START UBSAN BUILD: $1 ======"
+ SET_CLANG
+ BUILD "$name" "-DLIBICAL_DEVMODE_UNDEFINED_SANITIZER=True $2"
+ echo "===== END UBSAN BUILD: $1 ======"
+}
+
#function CPPCHECK
# runs a cppcheck test, which means: configure, compile, link and run cppcheck
# $1 = the name of the test (which will have "-cppcheck" appended to it)
@@ -331,6 +370,10 @@ CPPCHECK() {
-D PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP=0 \
-D MIN="" \
-D _unused="(void)" \
+ -D _deprecated="(void)" \
+ -D ICALMEMORY_DEFAULT_FREE="free" \
+ -D ICALMEMORY_DEFAULT_MALLOC="malloc" \
+ -D ICALMEMORY_DEFAULT_REALLOC="realloc" \
-D F_OK=0 \
-D R_OK=0 \
-U YYSTYPE \
@@ -347,7 +390,7 @@ CPPCHECK() {
grep -v Net-ICal | \
grep -v icalssyacc\.c | \
grep -v icalsslexer\.c | \
- grep -v vcc\.c | \
+ grep -v vcc\.c | grep -v vcc\.y | \
grep -v _cxx\. | tee cppcheck.out
CPPCHECK_WARNINGS cppcheck.out
rm -f cppcheck.out
@@ -390,6 +433,7 @@ SPLINT() {
splint $files \
-badflag \
+ -preproc \
-weak -warnposix \
-modobserver -initallelements -redef \
-linelen 1000 \
@@ -511,16 +555,39 @@ KRAZY() {
echo "===== END KRAZY ======"
}
+#function CODESPELL
+# runs a codespell test
+CODESPELL() {
+ if ( test $runcodespell -ne 1 )
+ then
+ echo "===== CODESPELL TEST DISABLED DUE TO COMMAND LINE OPTION ====="
+ return
+ fi
+ COMMAND_EXISTS "codespell"
+ echo "===== START CODESPELL ====="
+ cd $TOP
+ codespell --interactive=0 . 2>&1 | tee codespell.out
+ status=$?
+ if ( test $status -gt 0 )
+ then
+ echo "Codespell warnings encountered. Exiting..."
+ exit 1
+ fi
+ rm -f codespell.out
+ echo "===== END CODESPELL ======"
+}
+
##### END FUNCTIONS #####
-#TEMP=`getopt -o hmkctbsnlgadf --long help,no-cmake-compat,no-krazy,no-cppcheck,no-tidy,no-scan,no-splint,no-ninja,no-clang-build,no-gcc-build,no-asan-build,no-tsan-build,no-fortify-build -- "$@"`
-TEMP=`getopt hmkctbsnlgadf $*`
+#TEMP=`getopt -o hmkpctbsnlgaduf --long help,no-cmake-compat,no-krazy,no-codespell,no-cppcheck,no-tidy,no-scan,no-splint,no-ninja,no-clang-build,no-gcc-build,no-asan-build,no-tsan-build,no-ubsan-build,no-memc-build,no-fortify-build -- "$@"`
+TEMP=`getopt hmkpctbsnlgadux $*`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
cmakecompat=1
runkrazy=1
+runcodespell=1
runcppcheck=1
runtidy=1
runscan=1
@@ -529,23 +596,28 @@ runclangbuild=1
rungccbuild=1
runasanbuild=1
runtsanbuild=1
+runubsanbuild=1
+runmemcbuild=1
runfortifybuild=1
runsplint=1
-while true ; do
+while true; do
case "$1" in
-h|--help) HELP; exit 1;;
- -m|--no-cmake-compat) cmakecompat=0; shift;;
- -k|--no-krazy) runkrazy=0; shift;;
- -c|--no-cppcheck) runcppcheck=0; shift;;
- -t|--no-tidy) runtidy=0; shift;;
- -b|--no-scan) runscan=0; shift;;
- -s|--no-splint) runsplint=0; shift;;
- -n|--no-ninja) runninja=0; shift;;
- -l|--no-clang-build) runclangbuild=0; shift;;
- -g|--no-gcc-build) rungccbuild=0; shift;;
- -a|--no-asan-build) runasanbuild=0; shift;;
- -d|--no-tsan-build) runtsanbuild=0; shift;;
- -f|--no-fortify-build) runfortifybuild=0; shift;;
+ -m|--no-cmake-compat) cmakecompat=0; shift;;
+ -k|--no-krazy) runkrazy=0; shift;;
+ -p|--no-codespell) runcodespell=0; shift;;
+ -c|--no-cppcheck) runcppcheck=0; shift;;
+ -t|--no-tidy) runtidy=0; shift;;
+ -b|--no-scan) runscan=0; shift;;
+ -s|--no-splint) runsplint=0; shift;;
+ -n|--no-ninja) runninja=0; shift;;
+ -l|--no-clang-build) runclangbuild=0; shift;;
+ -g|--no-gcc-build) rungccbuild=0; shift;;
+ -a|--no-asan-build) runasanbuild=0; shift;;
+ -d|--no-tsan-build) runtsanbuild=0; shift;;
+ -u|--no-ubsan-build) runubsanbuild=0; shift;;
+ -x|--no-memc-build) runmemcbuild=0; shift;;
+ -f|--no-fortify-build) runfortifybuild=0; shift;;
--) shift; break;;
*) echo "Internal error!"; exit 1;;
esac
@@ -595,10 +667,12 @@ DEFCMAKEOPTS="-DCMAKE_BUILD_TYPE=Debug"
CMAKEOPTS="-DCMAKE_BUILD_TYPE=Debug -DGOBJECT_INTROSPECTION=False -DICAL_GLIB=False -DICAL_BUILD_DOCS=False"
UUCCMAKEOPTS="$CMAKEOPTS -DCMAKE_DISABLE_FIND_PACKAGE_ICU=True"
TZCMAKEOPTS="$CMAKEOPTS -DUSE_BUILTIN_TZDATA=True"
+LTOCMAKEOPTS="$CMAKEOPTS -DENABLE_LTO_BUILD=True"
GLIBOPTS="-DCMAKE_BUILD_TYPE=Debug -DGOBJECT_INTROSPECTION=True -DUSE_BUILTIN_TZDATA=OFF -DICAL_GLIB_VAPI=ON"
#Static code checkers
KRAZY
+CODESPELL
SPLINT test2 "$CMAKEOPTS"
SPLINT test2builtin "$TZCMAKEOPTS"
CPPCHECK test2 "$CMAKEOPTS"
@@ -612,7 +686,12 @@ CLANGTIDY test2builtin "$TZCMAKEOPTS"
GCC_BUILD testgcc1 "$DEFCMAKEOPTS"
GCC_BUILD testgcc2 "$CMAKEOPTS"
GCC_BUILD testgcc3 "$UUCCMAKEOPTS"
+if (test "`uname -s`" = "Linux")
+then
+ GCC_BUILD testgcc4lto "$LTOCMAKEOPTS"
+fi
GCC_BUILD testgcc4glib "$GLIBOPTS"
+GCC_BUILD testgccnocxx "$CMAKEOPTS -DWITH_CXX_BINDINGS=off"
if (test "`uname -s`" = "Linux")
then
echo "Temporarily disable cross-compile tests"
@@ -635,6 +714,7 @@ NINJA_GCC_BUILD testninjagcc9 "-DSHARED_ONLY=True -DICAL_GLIB=True -DGOBJECT_INT
CLANG_BUILD testclang1 "$DEFCMAKEOPTS"
CLANG_BUILD testclang2 "$CMAKEOPTS"
CLANG_BUILD testclang3 "$UUCCMAKEOPTS"
+#not supported with clang yet CLANG_BUILD testclang4lto "$LTOCMAKEOPTS"
CLANG_BUILD testclang4glib "$GLIBOPTS"
if (test "`uname -s`" = "Linux")
then
@@ -643,6 +723,14 @@ then
# CLANG_BUILD testclang2cross "-DCMAKE_TOOLCHAIN_FILE=$TOP/cmake/Toolchain-Linux-GCC-i686.cmake $CMAKEOPTS"
fi
+#Memory consistency check
+MEMCONSIST_BUILD test1memc ""
+MEMCONSIST_BUILD test2memc "$CMAKEOPTS"
+MEMCONSIST_BUILD test3memc "$TZCMAKEOPTS"
+MEMCONSIST_BUILD test4memc "$UUCCMAKEOPTS"
+#FIXME: the python test scripts for introspection need some love
+#MEMCONSIST_BUILD test5memc "$GLIBOPTS"
+
#Address sanitizer
ASAN_BUILD test1asan "$DEFCMAKEOPTS"
ASAN_BUILD test2asan "$CMAKEOPTS"
@@ -657,6 +745,13 @@ TSAN_BUILD test3tsan "$TZCMAKEOPTS"
TSAN_BUILD test4tsan "$UUCCMAKEOPTS"
TSAN_BUILD test5tsan "$GLIBOPTS"
+#Undefined sanitizer
+UBSAN_BUILD test1ubsan ""
+UBSAN_BUILD test2ubsan "$CMAKEOPTS"
+UBSAN_BUILD test3ubsan "$TZCMAKEOPTS"
+UBSAN_BUILD test4ubsan "$UUCCMAKEOPTS"
+UBSAN_BUILD test5ubsan "$GLIBOPTS"
+
#Fortify build
FORTIFY_BUILD test1fortify "$DEFCMAKEOPTS"
FORTIFY_BUILD test2tsan "$CMAKEOPTS"
diff --git a/scripts/mkderivedcomponents.pl b/scripts/mkderivedcomponents.pl
index fcd98f24..2d51f4d4 100755..100644
--- a/scripts/mkderivedcomponents.pl
+++ b/scripts/mkderivedcomponents.pl
@@ -1,17 +1,8 @@
#!/usr/bin/env 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:
-#
-# 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
################################################################################
use Getopt::Std;
@@ -69,19 +60,9 @@ if ($opt_c or $opt_h and !$opt_i) {
\044Id:\044
- (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.
-
+ SPDX-FileCopyrightText: 1999 Eric Busboom <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
======================================================================*/
/*
diff --git a/scripts/mkderivedparameters.pl b/scripts/mkderivedparameters.pl
index 05aea1c2..26091ca5 100755..100644
--- a/scripts/mkderivedparameters.pl
+++ b/scripts/mkderivedparameters.pl
@@ -1,17 +1,11 @@
#!/usr/bin/env 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/
################################################################################
require "readvaluesfile.pl";
diff --git a/scripts/mkderivedproperties.pl b/scripts/mkderivedproperties.pl
index b6355676..7e1d9065 100755..100644
--- a/scripts/mkderivedproperties.pl
+++ b/scripts/mkderivedproperties.pl
@@ -1,17 +1,11 @@
#!/usr/bin/env 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/
################################################################################
require "readvaluesfile.pl";
@@ -175,7 +169,7 @@ sub insert_code
if ($e eq "NONE") {
my ($tbd) = 1;
$saveidx++;
- for (; $saveidx < $idx ; $saveidx++, $tbd++) {
+ for (; $saveidx < $idx; $saveidx++, $tbd++) {
$lines{$saveidx} =
" {ICAL_${ucv}_PROPERTY,ICAL_${ucv}_NONE, \"\" }, /*$saveidx*/\n";
}
diff --git a/scripts/mkderivedvalues.pl b/scripts/mkderivedvalues.pl
index 76c67d9e..c2125df7 100755..100644
--- a/scripts/mkderivedvalues.pl
+++ b/scripts/mkderivedvalues.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 '.';
@@ -92,7 +86,7 @@ sub insert_code
}
$idx = $h{'NO'}->{"kindEnum"};
- print " ICAL_NO_VALUE=$idx\n} icalvalue_kind ;\n\n";
+ print " ICAL_NO_VALUE=$idx\n} icalvalue_kind;\n\n";
# Now create enumerations for property values
$lastidx = $idx = 10000;
@@ -226,7 +220,7 @@ $pointer_check_rv\
if ($union_data eq 'string') {
print
-" if (impl->data.v_${union_data} != 0) {\n free((void *)impl->data.v_${union_data});\n }\n";
+" if (impl->data.v_${union_data} != 0) {\n icalmemory_free_buffer((void *)impl->data.v_${union_data});\n }\n";
}
print "\
diff --git a/scripts/mkrestrictiontable.pl b/scripts/mkrestrictiontable.pl
index 21bc499a..541bb4b0 100755..100644
--- a/scripts/mkrestrictiontable.pl
+++ b/scripts/mkrestrictiontable.pl
@@ -1,17 +1,11 @@
#!/usr/bin/env 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 Getopt::Std;
@@ -47,8 +41,9 @@ if ($opt_i) {
sub insert_code
{
- # First build the property restriction table
- print "static const icalrestriction_property_record icalrestriction_property_records[] = {\n";
+ # First parse the restrictions file and make a hash of the restrictions
+ my @prop_restr = ();
+ my @comp_restr = ();
while (<F>) {
@@ -67,17 +62,36 @@ sub insert_code
}
$restr =~ s/\s+$//;
- if ($prop ne "NONE") {
- print(
-" \{ICAL_METHOD_${method}, ICAL_${targetcomp}_COMPONENT, ICAL_${prop}_PROPERTY, ICAL_RESTRICTION_${restr}, $sub},\n"
- );
+ if ($prop eq "NONE") {
+ $prop = "NO";
+ }
+ if ($subcomp eq "NONE") {
+ $subcomp = "NO";
}
+ my @value = ($restr, $sub);
+ $prop_restr{$method}{$targetcomp}{$prop}{$subcomp} = \@value;
}
+ # Build the restriction table
+ print "static const icalrestriction_record icalrestriction_records[] = {\n";
+
+ for $method ( sort keys %prop_restr ) {
+ for $targetcomp ( sort keys %{ $prop_restr{$method} } ) {
+ for $prop ( sort keys %{ $prop_restr{$method}{$targetcomp} } ) {
+ for $subcomp ( sort keys %{ $prop_restr{$method}{$targetcomp}{$prop} } ) {
+ my ($restr, $sub) = @{$prop_restr{$method}{$targetcomp}{$prop}{$subcomp}};
+ print(
+" \{ICAL_METHOD_${method}, ICAL_${targetcomp}_COMPONENT, ICAL_${prop}_PROPERTY, ICAL_${subcomp}_COMPONENT, ICAL_RESTRICTION_${restr}, $sub},\n"
+ );
+ }
+ }
+ }
+}
+
# Print the terminating line
print
- " {ICAL_METHOD_NONE, ICAL_NO_COMPONENT, ICAL_NO_PROPERTY, ICAL_RESTRICTION_NONE, NULL}\n";
+ " {ICAL_METHOD_NONE, ICAL_NO_COMPONENT, ICAL_NO_PROPERTY, ICAL_NO_COMPONENT, ICAL_RESTRICTION_NONE, NULL}\n";
print "};\n";
diff --git a/scripts/readvaluesfile.pl b/scripts/readvaluesfile.pl
index 460cf7e7..3e1cb8d7 100644
--- a/scripts/readvaluesfile.pl
+++ b/scripts/readvaluesfile.pl
@@ -1,16 +1,10 @@
################################################################################
-# (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/
################################################################################
sub read_values_file
@@ -18,10 +12,13 @@ sub read_values_file
my $path = shift;
my %h;
+ my @SEEN_ENUMS;
open(F, $path) || die "Can't open values file $path";
+ my $line = 0;
while (<F>) {
+ $line++;
chop;
@@ -34,8 +31,16 @@ sub read_values_file
@column = split(/,/, $_);
my $value_name = $column[0];
- my $enumConst = $column[1];
-
+ if (exists($h{$value_name})) {
+ die "Previously defined value=$value_name line $line in $path";
+ }
+ my $enumConst = $column[1];
+ if ($enumConst !~ /FIXME/) {
+ if (grep(/^$enumConst$/, @SEEN)) {
+ die "Reusing kindEnum=$enumConst line $line in $path";
+ }
+ push(@SEEN, $enumConst);
+ }
my $c_type_str = $column[2];
my $c_autogen = ($c_type_str =~ /\(a\)/);
@@ -79,11 +84,13 @@ sub read_properties_file
my $path = shift;
my %h;
+ my @SEEN;
open(F, $path) || die "Can't open properties file $path";
+ my $line = 0;
while (<F>) {
-
+ $line++;
chop;
s/#.*$//g;
@@ -95,8 +102,16 @@ sub read_properties_file
@column = split(/,/, $_);
my $property_name = $column[0];
-
- my $enumConst = $column[1];
+ if ($property_name && exists($h{$property_name})) {
+ die "Previously defined property=$property_name line $line in $path";
+ }
+ my $enumConst = $column[1];
+ if ($enumConst !~ /FIXME/) {
+ if (grep(/^$enumConst$/, @SEEN)) {
+ die "Reusing kindEnum=$enumConst line $line in $path";
+ }
+ push(@SEEN, $enumConst);
+ }
my $lic_value = $column[2];
my $default_value = $column[3];
my $flags = $column[4];
@@ -124,10 +139,13 @@ sub read_parameters_file
my $path = shift;
my %h;
+ my @SEEN;
open(F, $path) || die "Can't open parameters file $path";
+ my $line = 0;
while (<F>) {
+ $line++;
chop;
@@ -140,8 +158,16 @@ sub read_parameters_file
@column = split(/\,/, $_);
my $parameter_name = $column[0];
-
- my $enumConst = $column[1];
+ if (exists($h{$parameter_name})) {
+ die "Previously defined parameter=$parameter_name line $line in $path";
+ }
+ my $enumConst = $column[1];
+ if ($enumConst !~ /FIXME/) {
+ if (grep(/^$enumConst$/, @SEEN)) {
+ die "Reusing kindEnum=$enumConst line $line in $path";
+ }
+ push(@SEEN, $enumConst);
+ }
my $data_type = $column[2];
my $enum_string = $column[3];
diff --git a/scripts/set_compiler_env.bat b/scripts/set_compiler_env.bat
index 47d7c50f..215fb41d 100644
--- a/scripts/set_compiler_env.bat
+++ b/scripts/set_compiler_env.bat
@@ -1,5 +1,8 @@
@echo off
+rem SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+rem SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
:: Now we declare a scope
Setlocal EnableDelayedExpansion EnableExtensions
diff --git a/scripts/setup-travis.sh b/scripts/setup-travis.sh
index 315ee3b2..c6a93c78 100755
--- a/scripts/setup-travis.sh
+++ b/scripts/setup-travis.sh
@@ -1,5 +1,8 @@
#!/bin/bash
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
# things to do for travis-ci in the before_install section
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
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 2407fc25..0f8c59c0 100644
--- a/src/Net-ICal-Libical/netical_wrap.c
+++ b/src/Net-ICal-Libical/netical_wrap.c
@@ -483,7 +483,7 @@ XS(_wrap_icalparser_parse_string) {
icalcomponent * _result;
char * _arg0;
int argvi = 0;
- dXSARGS ;
+ dXSARGS;
cv = cv;
if ((items < 1) || (items > 1))
@@ -515,7 +515,7 @@ XS(_wrap_icalcomponent_new) {
XSRETURN(argvi);
}
-XS(_wrap_icalcomponent_new_clone) {
+XS(_wrap_icalcomponent_clone) {
icalcomponent * _result;
icalcomponent * _arg0;
@@ -524,12 +524,12 @@ XS(_wrap_icalcomponent_new_clone) {
cv = cv;
if ((items < 1) || (items > 1))
- croak("Usage: icalcomponent_new_clone(component);");
+ 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);
@@ -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);
diff --git a/src/Net-ICal-Libical/netical_wrap.doc b/src/Net-ICal-Libical/netical_wrap.doc
index f147d80e..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);
diff --git a/src/Net-ICal-Libical/test-data/2446.mime b/src/Net-ICal-Libical/test-data/2446.mime
index e1d8957d..3afb13aa 100644
--- a/src/Net-ICal-Libical/test-data/2446.mime
+++ b/src/Net-ICal-Libical/test-data/2446.mime
@@ -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
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/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 2f31b661..459a99d1 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 ffd3cd81..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;
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 cc9a3572..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;
diff --git a/src/java/ICalTimeType.java b/src/java/ICalTimeType.java
index 01bfeedc..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;
diff --git a/src/java/ICalTriggerType.java b/src/java/ICalTriggerType.java
index a35c54c9..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;
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 e4c4d22e..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;
diff --git a/src/java/VAlarm.java b/src/java/VAlarm.java
index 57cdc5a5..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;
diff --git a/src/java/VCalendar.java b/src/java/VCalendar.java
index 2a87408b..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;
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 4fd9cb71..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;
diff --git a/src/java/VFreeBusy.java b/src/java/VFreeBusy.java
index 6778b2f0..c8dbf144 100644
--- a/src/java/VFreeBusy.java
+++ b/src/java/VFreeBusy.java
@@ -1,3 +1,10 @@
+/*======================================================================
+ 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 {
diff --git a/src/java/VQuery.java b/src/java/VQuery.java
index 8c4f0727..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;
diff --git a/src/java/VToDo.java b/src/java/VToDo.java
index 44e6fac3..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;
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 0d4d036e..232d11d8 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 f178ec9d..cdd19f5d 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);
@@ -2269,6 +2238,7 @@ static gint generate_library(const gchar *apis_dir)
printf("The node cannot be parsed into a structure.\n");
xmlFreeDoc(doc);
res = 1;
+ structure_free(structure);
goto out;
}
@@ -2290,6 +2260,7 @@ static gint generate_library(const gchar *apis_dir)
structure->name);
xmlFreeDoc(doc);
res = 1;
+ structure_free(structure);
goto out;
}
}
@@ -2308,6 +2279,7 @@ static gint generate_library(const gchar *apis_dir)
printf("Please supply a default value for enum %s\n", enumeration->name);
xmlFreeDoc(doc);
res = 1;
+ structure_free(structure);
goto out;
}
}
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 d3fdd44c..0666591f 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 bffb5a17..b8bcf78e 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 67cf6fac..306ca68a 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()
@@ -336,7 +360,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")
@@ -399,11 +426,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 f3d600c2..5f7a9df4 100644
--- a/src/libical/caldate.c
+++ b/src/libical/caldate.c
@@ -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
+ ========================================================================*/
#include "astime.h" /* time structures */
@@ -173,3 +189,91 @@ double juldat( 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 3f9516da..ddcc14fc 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 e6081c2b..fedbea9a 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(void)
@@ -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);
+ free(strings); /* Not icalmemory_free_buffer(), allocated by backtrace_symbols() */
#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 db4fe4ea..7e10c220 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(void)
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(void)
/* 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 72578840..5015d561 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)
@@ -219,20 +202,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;
}
@@ -312,7 +303,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;
}
@@ -546,7 +537,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;
}
}
@@ -591,11 +582,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 {
@@ -605,6 +600,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)
@@ -644,8 +641,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 */
@@ -665,7 +662,7 @@ icalcomponent *icalparser_parse(icalparser *parser,
} else {
/* Badness */
- assert(0);
+ icalassert(0);
}
c = 0;
@@ -718,7 +715,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);
}
@@ -745,11 +742,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);
}
@@ -799,7 +800,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;
@@ -850,7 +851,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;
@@ -901,7 +902,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;
@@ -1012,7 +1013,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;
@@ -1054,7 +1055,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;
@@ -1082,7 +1083,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);
@@ -1141,7 +1142,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);
@@ -1163,7 +1164,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);
@@ -1202,7 +1203,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);
@@ -1226,7 +1227,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;
@@ -1250,7 +1251,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);
@@ -1344,6 +1345,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 b8b0f11b..13213195 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,33 +109,33 @@ 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 (tm->tm_year < 2)
- 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 > 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);
}
}
#else
/* We don't support years >= 10000, because the function has not been tested at this range. */
if (tm->tm_year >= 8100) {
- 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
@@ -152,7 +143,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. */
@@ -194,7 +185,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;
@@ -203,8 +194,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;
@@ -234,18 +225,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)) {
@@ -273,11 +264,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();
@@ -474,38 +465,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) {
@@ -516,19 +501,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 2de53c9f..cf9f2688 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);
@@ -202,7 +194,7 @@ LIBICAL_ICAL_EXPORT struct icaltimetype icaltime_from_day_of_year(const int doy,
* The return value is defined for dates ranging from 1902-01-01 (incl.) up to 10000-01-01 (excl.)
* if time_t has a size of 64 bit and up to 2038-01-18 (excl.) if it has a size of 32 bit.
*/
-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.
@@ -210,9 +202,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 01212ae3..e299edea 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) &&
icalvalue_isa(value) != ICAL_TEXT_VALUE)) {
icalmemory_append_char(&str, &str_p, &buf_sz, *p);
@@ -362,23 +359,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) {
@@ -390,8 +384,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.
*/
@@ -399,33 +392,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;
}
@@ -566,7 +562,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;
}
@@ -585,13 +581,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;
}
@@ -603,12 +600,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);
@@ -637,7 +634,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;
}
@@ -724,7 +721,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;
@@ -778,7 +775,7 @@ void icalvalue_free(icalvalue *v)
}
if (v->x_value != 0) {
- free(v->x_value);
+ icalmemory_free_buffer(v->x_value);
}
switch (v->kind) {
@@ -798,7 +795,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;
@@ -806,8 +803,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;
@@ -824,7 +821,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)
@@ -1075,7 +1072,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);
@@ -1084,7 +1081,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;
}
@@ -1102,16 +1099,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;
}
@@ -1393,8 +1390,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;
@@ -1500,12 +1497,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 726ff835..a3e9f644 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(void)
{
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 a65c30e4..15c4c0ad 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})
@@ -146,7 +151,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 ac3a2ab7..a9cc8b26 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 fdcf7ab5..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
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 f083c0cb..2c113738 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 42ca8c85..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
===============================
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 97632198..0025a663 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(void)
{
@@ -457,13 +563,12 @@ static VObject* popVObject(void)
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(void) {
}
#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(void) {
@@ -859,7 +960,6 @@ static void finiLex(void) {
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(void)
}
}
} /* 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(void) {
lexSkipLookahead();
c = lexLookahead();
++mime_lineNum;
- }
+ }
DBG_(("db: COLON\n"));
return COLON;
}
@@ -1155,7 +1255,6 @@ int yylex(void) {
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 03a4249c..db87725e 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(void)
}
}
-
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 ca3317ca..417f5639 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 39930fd8..7eab507e 100644
--- a/src/php/Makefile
+++ b/src/php/Makefile
@@ -1,3 +1,6 @@
+# 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
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 9aeaeb67..00000000
--- a/src/python/CMakeLists.txt
+++ /dev/null
@@ -1,23 +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 e7a99793..00000000
--- a/src/python/ChangeLog
+++ /dev/null
@@ -1,128 +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 46b0cd91..00000000
--- a/src/python/LibicalWrap_icaltime.i
+++ /dev/null
@@ -1,195 +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 3d563b85..00000000
--- a/src/python/python-binding.txt
+++ /dev/null
@@ -1,433 +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 c6c22012..9271bd33 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 0df024a2..74bea858 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/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 f3f97e25..83aba5e3 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(void)
{
- 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(void)
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 2fbe3ae6..b275bcd4 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 632c910e..d354cac2 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(void)
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(void)
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(void)
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 b1edc6df..43c9170a 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(void)
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 24997d8d..8c4c5d84 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(void)
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(void)
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(void)
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(void)
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(void)
}
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(void)
ok("final buffer size == 806", (bufsize == 806));
- free(f);
+ icalmemory_free_buffer(f);
bufsize = 4;
@@ -890,7 +885,7 @@ void test_memory(void)
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(void)
/* 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(void)
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(void)
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(void)
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(void)
{
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(void)
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(void)
{
- 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(void)
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(void)
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(void)
{
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(void)
icalcomponent *clone;
- clone = icalcomponent_new_clone(c);
+ clone = icalcomponent_clone(c);
(void)icalset_add_component(d, clone);
@@ -2178,12 +2265,12 @@ void test_overlaps(void)
{
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(void)
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(void)
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(void)
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(void)
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)
(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(void)
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(void)
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 =
@@ -4459,7 +4717,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));
@@ -4513,6 +4771,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 =
@@ -4808,7 +5099,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(
@@ -4993,7 +5283,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);
@@ -5064,6 +5354,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);
@@ -5106,6 +5407,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);
@@ -5113,6 +5415,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);
@@ -5179,6 +5483,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);
@@ -5186,12 +5491,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 88a29509..12107c18 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 6beff2f9..caed836d 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(void)
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(void)
* 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(void)
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(
diff --git a/test-data/CMakeLists.txt b/test-data/CMakeLists.txt
index 39000a42..b650e8dc 100644
--- a/test-data/CMakeLists.txt
+++ b/test-data/CMakeLists.txt
@@ -1,2 +1,4 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
########### install files ###############
diff --git a/test-data/zone.tab b/test-data/zone.tab
new file mode 100644
index 00000000..c21cbe1d
--- /dev/null
+++ b/test-data/zone.tab
@@ -0,0 +1,3 @@
+test zone.tab
+nothing to see here.
+must exist for testing purposes
diff --git a/uninstall.cmake.in b/uninstall.cmake.in
index 662668c7..13dc359e 100644
--- a/uninstall.cmake.in
+++ b/uninstall.cmake.in
@@ -1,3 +1,10 @@
+
+# SPDX-FileCopyrightText: Kitware, Inc. and Contributors
+# SPDX-License-Identifier: BSD-3-Clause
+
+# see:
+# https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
+
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif()