diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2013-05-04 21:39:27 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2013-05-04 21:39:27 +0000 |
commit | fec6336699f34758d3e6cb41b2edf902fedb9035 (patch) | |
tree | 8256c1dbf3ca7c9e58a3dbecf07cf826fb2e0ce2 /src/libical | |
parent | 7dbffd7e2b0067e834801617c5c486e3177f6709 (diff) | |
download | libical-fec6336699f34758d3e6cb41b2edf902fedb9035.tar.gz |
libical-1.0HEADlibical-1.0master
Diffstat (limited to 'src/libical')
50 files changed, 2439 insertions, 1418 deletions
diff --git a/src/libical/CMakeLists.txt b/src/libical/CMakeLists.txt index 9ff663d..6774352 100644 --- a/src/libical/CMakeLists.txt +++ b/src/libical/CMakeLists.txt @@ -2,17 +2,24 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/icalversion.h.cmake ${CMAKE_CURRENT_B include_directories( ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/src ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/libical ${CMAKE_BINARY_DIR}/src/libical ) -set(PACKAGE_DATA_DIR "\\\"${CMAKE_INSTALL_PREFIX}/share/libical\\\"") -add_definitions(-DPACKAGE_DATA_DIR=${PACKAGE_DATA_DIR}) +if(WIN32) + if(MSVC) + add_definitions(-DBUILD_LIBICALDLL) + endif(MSVC) +endif(WIN32) +configure_file(icalerror.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/icalerror.h) +set(PACKAGE_DATA_DIR "\\\"${CMAKE_INSTALL_PREFIX}/share/libical\\\"") +add_definitions(-DPACKAGE_DATA_DIR="${PACKAGE_DATA_DIR}") -set(ICALSCRIPTS ${CMAKE_SOURCE_DIR}/scripts/ ) +set(ICALSCRIPTS ${CMAKE_SOURCE_DIR}/scripts/) set(PROPERTYDEPS ${ICALSCRIPTS}/mkderivedproperties.pl @@ -22,9 +29,8 @@ set(PROPERTYDEPS ${CMAKE_SOURCE_DIR}/src/libical/icalderivedproperty.c.in ) - add_custom_command( - OUTPUT + OUTPUT ${CMAKE_BINARY_DIR}/src/libical/icalderivedproperty.h COMMAND ${PERL_EXECUTABLE} -I ${ICALSCRIPTS} ${ICALSCRIPTS}/mkderivedproperties.pl @@ -55,9 +61,9 @@ set(PARAMETERDEPS ) add_custom_command( - OUTPUT + OUTPUT ${CMAKE_BINARY_DIR}/src/libical/icalderivedparameter.h - COMMAND + COMMAND ${PERL_EXECUTABLE} -I ${ICALSCRIPTS} ${ICALSCRIPTS}/mkderivedparameters.pl -i ${CMAKE_SOURCE_DIR}/src/libical/icalderivedparameter.h.in -h ${CMAKE_SOURCE_DIR}/design-data/parameters.csv > @@ -69,9 +75,9 @@ add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/src/libical/icalderivedparameter.c COMMAND - ${PERL_EXECUTABLE} -I ${ICALSCRIPTS} ${ICALSCRIPTS}/mkderivedparameters.pl + ${PERL_EXECUTABLE} -I ${ICALSCRIPTS} ${ICALSCRIPTS}/mkderivedparameters.pl -i ${CMAKE_SOURCE_DIR}/src/libical/icalderivedparameter.c.in - -c ${CMAKE_SOURCE_DIR}/design-data/parameters.csv > + -c ${CMAKE_SOURCE_DIR}/design-data/parameters.csv > ${CMAKE_BINARY_DIR}/src/libical/icalderivedparameter.c DEPENDS ${PARAMETERDEPS} ${CMAKE_BINARY_DIR}/src/libical/icalderivedparameter.h ) @@ -105,7 +111,7 @@ add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/src/libical/icalderivedvalue.h COMMAND - ${PERL_EXECUTABLE} -I${ICALSCRIPTS} ${ICALSCRIPTS}/mkderivedvalues.pl + ${PERL_EXECUTABLE} -I${ICALSCRIPTS} ${ICALSCRIPTS}/mkderivedvalues.pl -i ${CMAKE_SOURCE_DIR}/src/libical/icalderivedvalue.h.in -h ${CMAKE_SOURCE_DIR}/design-data/value-types.csv > ${CMAKE_BINARY_DIR}/src/libical/icalderivedvalue.h @@ -113,9 +119,9 @@ add_custom_command( ) add_custom_command( - OUTPUT + OUTPUT ${CMAKE_BINARY_DIR}/src/libical/icalderivedvalue.c - COMMAND + COMMAND ${PERL_EXECUTABLE} -I${ICALSCRIPTS} ${ICALSCRIPTS}/mkderivedvalues.pl -i ${CMAKE_SOURCE_DIR}/src/libical/icalderivedvalue.c.in -c ${CMAKE_SOURCE_DIR}/design-data/value-types.csv > @@ -150,91 +156,137 @@ add_custom_target(ical-header DEPENDS ${CMAKE_BINARY_DIR}/src/libical/ical.h ) +macro(_list_prefix _outvar _listvar _prefix) + set(${_outvar}) + foreach(_item IN LISTS ${_listvar}) + list(APPEND ${_outvar} ${_prefix}${_item}) + endforeach() +endmacro(_list_prefix) + +# GObject Introspection +if(HAVE_INTROSPECTION) + include(GObjectIntrospectionMacros) + set(INTROSPECTION_GIRS) + #set(INTROSPECTION_SCANNER_ARGS "--add-include-path=${CMAKE_CURRENT_SOURCE_DIR}") + #set(INTROSPECTION_COMPILER_ARGS "--includedir=${CMAKE_CURRENT_SOURCE_DIR}") + + set(libical_0_48_gir "libical") + set(libical_0_48_gir_VERSION "0.48") + set(INTROSPECTION_SCANNER_ARGS ${CMAKE_BINARY_DIR}/src/libical/ical.h) + set(libical_0_48_gir_LIBRARY "ical") + set(libical_0_48_gir_INCLUDES GObject-2.0) + get_directory_property(_tmp_includes ical_LIB_SRCS) + _list_prefix(_includes _tmp_includes "-L") + set(libical_0_48_gir_CFLAGS ${_includes}) + set(libical_0_48_gir_LIBS ical) + + list(APPEND INTROSPECTION_GIRS libical-0.48.gir) + + gir_add_introspections(INTROSPECTION_GIRS) +endif() + ########### next target ############### set(BUILT_COMBINEDHEADERS - ${CMAKE_BINARY_DIR}/src/libical/icalderivedparameter.h - ${CMAKE_BINARY_DIR}/src/libical/icalderivedproperty.h - ${CMAKE_BINARY_DIR}/src/libical/icalderivedvalue.h + ${CMAKE_BINARY_DIR}/src/libical/icalderivedparameter.h + ${CMAKE_BINARY_DIR}/src/libical/icalderivedproperty.h + ${CMAKE_BINARY_DIR}/src/libical/icalderivedvalue.h ) set(BUILT_SOURCES - ${BUILT_COMBINEDHEADERS} - icalderivedparameter.c - icalderivedproperty.c - icalrestriction.c - icalderivedvalue.c + ${BUILT_COMBINEDHEADERS} + icalderivedparameter.c + icalderivedproperty.c + icalrestriction.c + icalderivedvalue.c ) -SET(ical_LIB_SRCS - ${BUILT_SOURCES} - icalarray.c - icalarray.h - icalattach.h - icalattachimpl.h - icalattach.c - icalcomponent.c - icalcomponent.h - icalenums.c - icalenums.h - icalerror.c - icalerror.h - icalmemory.c - icalmemory.h - icalmime.c - icalmime.h - icalparameter.c - icalparameter.h - icalparameterimpl.h - icalparser.c - icalparser.h - icalproperty.c - icalproperty.h - icalrecur.c - icalrecur.h - icalrestriction.h - icaltime.c - icaltime.h - icaltz-util.c - icaltz-util.h - icaltimezone.c - icaltimezone.h - icalduration.h - icalduration.c - icalperiod.h - icalperiod.c - icaltypes.c - icaltypes.h - icalvalue.c - icalvalue.h - icalvalueimpl.h - pvl.c - pvl.h - sspm.c - sspm.h - icallangbind.h - icallangbind.c - caldate.c - astime.h +set(ical_LIB_SRCS + ${BUILT_SOURCES} + icalarray.c + icalarray.h + icalattach.h + icalattachimpl.h + icalattach.c + icalcomponent.c + icalcomponent.h + icalenums.c + icalenums.h + icalerror.c + icalmemory.c + icalmemory.h + icalmime.c + icalmime.h + icalparameter.c + icalparameter.h + icalparameterimpl.h + icalparser.c + icalparser.h + icalproperty.c + icalproperty.h + icalrecur.c + icalrecur.h + icalrestriction.h + icaltime.c + icaltime.h + icaltz-util.c + icaltz-util.h + icaltimezone.c + icaltimezone.h + icalduration.h + icalduration.c + icalperiod.h + icalperiod.c + icaltypes.c + icaltypes.h + icalvalue.c + icalvalue.h + icalvalueimpl.h + pvl.c + pvl.h + sspm.c + sspm.h + icallangbind.h + icallangbind.c + caldate.c + astime.h ) -if(NOT WIN32) - list(APPEND ical_LIB_SRCS vsnprintf.c) -else(NOT WIN32) +if(WIN32) if(MSVC) list(APPEND ical_LIB_SRCS ../ical.def) endif(MSVC) -endif(NOT WIN32) +endif(WIN32) + +add_library(ical ${LIBRARY_TYPE} ${ical_LIB_SRCS}) +add_library(ical-static STATIC ${ical_LIB_SRCS}) -add_library(ical SHARED ${ical_LIB_SRCS}) add_dependencies(ical ical-header) target_link_libraries(ical ${CMAKE_THREAD_LIBS_INIT}) -set_target_properties(ical PROPERTIES VERSION ${LIBICAL_LIB_VERSION_STRING} SOVERSION ${LIBICAL_LIB_MAJOR_VERSION}) -install(TARGETS ical ${INSTALL_TARGETS_DEFAULT_ARGS}) +if(WINCE) + target_link_libraries(ical ${WCECOMPAT_LIBRARIES}) +endif(WINCE) + +if(MSVC) + set_target_properties(ical PROPERTIES OUTPUT_NAME "libical") + set_target_properties(ical-static PROPERTIES OUTPUT_NAME "libical-static") +else(MSVC) + set_target_properties(ical-static PROPERTIES OUTPUT_NAME "ical") +endif(MSVC) +set_target_properties(ical PROPERTIES + VERSION ${LIBICAL_LIB_VERSION_STRING} + SOVERSION ${LIBICAL_LIB_MAJOR_VERSION} +) +set_target_properties(ical PROPERTIES CLEAN_DIRECT_OUTPUT 1) +set_target_properties(ical-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) + +install(TARGETS ical ical-static ${INSTALL_TARGETS_DEFAULT_ARGS}) ########### install files ############### +install(FILES ${CMAKE_SOURCE_DIR}/src/ical.h DESTINATION ${INCLUDE_INSTALL_DIR}) + install(FILES ${CMAKE_BINARY_DIR}/src/libical/ical.h icalarray.h @@ -245,7 +297,7 @@ install(FILES ${CMAKE_BINARY_DIR}/src/libical/icalderivedvalue.h icalduration.h icalenums.h - icalerror.h + ${CMAKE_BINARY_DIR}/src/libical/icalerror.h icallangbind.h icalmemory.h icalmime.h @@ -262,329 +314,6 @@ install(FILES icalvalue.h pvl.h sspm.h - #$(cxx_headers) - DESTINATION - ${INCLUDE_INSTALL_DIR}/libical) - - -#original Makefile.am contents follow: - -##====================================================================== -## FILE: Makefile.am -## CREATOR: eric -## -## $Id: Makefile.am,v 1.40 2008-01-02 20:07:30 dothebart Exp $ -## -## -## (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org -## -## 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: http://www.fsf.org/copyleft/lesser.html -## -## Or: -## -## The Mozilla Public License Version 1.0. You may obtain a copy of -## the License at http://www.mozilla.org/MPL/ -## -## -## -##====================================================================== -# -# -#DESIGNDATA = $(top_srcdir)/design-data -#ICALSCRIPTS = $(top_srcdir)/scripts -# -#if WITH_CXX_BINDINGS -#cxx_lib=libical_cxx.la -#cxx_headers=vcomponent.h icalparameter_cxx.h icalproperty_cxx.h icalvalue_cxx.h icptrholder.h -#else -#cxx_lib= -#cxx_headers= -#endif -# -#lib_LTLIBRARIES = libical.la $(cxx_lib) -#noinst_LTLIBRARIES = libical-static.la -#libical_static_la_SOURCES = $(libical_la_SOURCES) -#libical_static_la_LDFLAGS = --all-static -# -#AM_CPPFLAGS = -DPACKAGE_DATA_DIR=\""$(datadir)/$(PACKAGE)"\" -# -## CFLAGS = -g -# -#INCLUDES = \ -# -I$(top_builddir) \ -# -I$(top_srcdir)/src \ -# -I$(top_builddir)/src \ -# -I$(top_srcdir)/src/libical \ -# -I$(top_builddir)/src/libical \ -# -I$(srcdir) -# -#libical_la_LDFLAGS = -version-info 42:0:42 -# -#libical_la_LIBADD = $(PTHREAD_LIBS) -# -#libical_la_SOURCES = \ -# $(BUILT_SOURCES) \ -# icalarray.c \ -# icalarray.h \ -# icalattach.h \ -# icalattachimpl.h \ -# icalattach.c \ -# icalcomponent.c \ -# icalcomponent.h \ -# icalenums.c \ -# icalenums.h \ -# icalerror.c \ -# icalerror.h \ -# icalmemory.c \ -# icalmemory.h \ -# icalmime.c \ -# icalmime.h \ -# icalparameter.c \ -# icalparameter.h \ -# icalparameterimpl.h \ -# icalparser.c \ -# icalparser.h \ -# icalproperty.c \ -# icalproperty.h \ -# icalrecur.c \ -# icalrecur.h \ -# icalrestriction.h \ -# icaltime.c \ -# icaltime.h \ -# icaltz-util.c \ -# icaltz-util.h \ -# icaltimezone.c \ -# icaltimezone.h \ -# icalduration.h \ -# icalduration.c \ -# icalperiod.h \ -# icalperiod.c \ -# icaltypes.c \ -# icaltypes.h \ -# icalvalue.c \ -# icalvalue.h \ -# icalvalueimpl.h \ -# pvl.c \ -# pvl.h \ -# sspm.c \ -# sspm.h \ -# vsnprintf.c \ -# icallangbind.h \ -# icallangbind.c \ -# caldate.c \ -# astime.h -# -#if WITH_CXX_BINDINGS -#libical_cxx_la_SOURCES = \ -# $(libical_la_SOURCES) \ -# vcomponent.h \ -# vcomponent.cpp \ -# icalproperty_cxx.h \ -# icalproperty_cxx.cpp \ -# icalparameter_cxx.h \ -# icalparameter_cxx.cpp \ -# icalvalue_cxx.h \ -# icalvalue_cxx.cpp \ -# icptrholder.h -#endif -# -#libical_includedir = $(includedir)/libical -# -#libical_include_HEADERS = \ -# ical.h \ -# icalarray.h \ -# icalattach.h \ -# icalcomponent.h \ -# icalderivedparameter.h \ -# icalderivedproperty.h \ -# icalderivedvalue.h \ -# icalduration.h \ -# icalenums.h \ -# icalerror.h \ -# icallangbind.h \ -# icalmemory.h \ -# icalmime.h \ -# icalparameter.h \ -# icalparser.h \ -# icalperiod.h \ -# icalproperty.h \ -# icalrecur.h \ -# icalrestriction.h \ -# icaltime.h \ -# icaltz-util.h \ -# icaltimezone.h \ -# icaltypes.h \ -# icalvalue.h \ -# pvl.h \ -# sspm.h \ -# $(cxx_headers) -# -## ORDERING OF HEADERS IS SIGNIFICANT. Don't change this ordering. It -## is required to make the combined header ical.h properly -#COMBINEDHEADERS = \ -# $(top_builddir)/src/libical/icalversion.h \ -# $(top_srcdir)/src/libical/icaltime.h \ -# $(top_srcdir)/src/libical/icalduration.h \ -# $(top_srcdir)/src/libical/icalperiod.h \ -# $(top_srcdir)/src/libical/icalenums.h \ -# $(top_srcdir)/src/libical/icaltypes.h \ -# $(top_srcdir)/src/libical/icalrecur.h \ -# $(top_srcdir)/src/libical/icalattach.h \ -# icalderivedvalue.h \ -# icalderivedparameter.h \ -# $(top_srcdir)/src/libical/icalvalue.h \ -# $(top_srcdir)/src/libical/icalparameter.h \ -# icalderivedproperty.h \ -# $(top_srcdir)/src/libical/icalproperty.h \ -# $(top_srcdir)/src/libical/pvl.h \ -# $(top_srcdir)/src/libical/icalarray.h \ -# $(top_srcdir)/src/libical/icalcomponent.h \ -# $(top_srcdir)/src/libical/icaltimezone.h \ -# $(top_srcdir)/src/libical/icalparser.h \ -# $(top_srcdir)/src/libical/icalmemory.h \ -# $(top_srcdir)/src/libical/icalerror.h \ -# $(top_srcdir)/src/libical/icalrestriction.h \ -# $(top_srcdir)/src/libical/sspm.h \ -# $(top_srcdir)/src/libical/icalmime.h \ -# $(top_srcdir)/src/libical/icallangbind.h -# -## exporting the configure stuff is probably no good idea. -## others use standard defines not in our namespace too. -## $(top_builddir)/config.h -# -#BUILT_COMBINEDHEADERS = \ -# icalderivedparameter.h \ -# icalderivedproperty.h \ -# icalderivedvalue.h -# -#BUILT_SOURCES = \ -# $(BUILT_COMBINEDHEADERS)\ -# icalderivedparameter.c \ -# icalderivedproperty.c \ -# icalrestriction.c \ -# icalderivedvalue.c -# -#ical.h: $(COMBINEDHEADERS) -# echo '#ifndef LIBICAL_ICAL_H' > ical.h -# echo '#define LIBICAL_ICAL_H' >> ical.h -# echo '#ifdef __cplusplus' >> ical.h -# echo 'extern "C" {' >> ical.h -# echo '#endif' >> ical.h -# echo '/*' >> ical.h -# echo ' $$''Id''$$' >> ical.h -# echo '*/' >> ical.h -# cat $(COMBINEDHEADERS) \ -# | egrep -v "#include.*\"ical" \ -# | egrep -v "#include.*\"config" \ -# | egrep -v "#include.*\"pvl\.h\"" \ -# | egrep -v '\$$(Id|Locker): .+\$$'>> ical.h -# echo '#ifdef __cplusplus' >> ical.h -# echo '}' >> ical.h -# echo '#endif' >> ical.h -# echo '#endif' >> ical.h -# -# -## parameters -# -#PARAMETERDEPS = \ -# $(ICALSCRIPTS)/mkderivedparameters.pl \ -# $(DESIGNDATA)/parameters.csv \ -# icalderivedparameter.c.in \ -# icalderivedparameter.h.in -# -#icalderivedparameter.h: $(PARAMETERDEPS) -# $(PERL) -I $(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedparameters.pl -i $(srcdir)/icalderivedparameter.h.in -h $(DESIGNDATA)/parameters.csv > icalderivedparameter.h -# -#icalderivedparameter.c: $(PARAMETERDEPS) $(BUILT_COMBINEDHEADERS) -# $(PERL) -I $(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedparameters.pl -i $(srcdir)/icalderivedparameter.c.in -c $(DESIGNDATA)/parameters.csv > icalderivedparameter.c -# -## properties -# -#PROPERTYDEPS = \ -# $(ICALSCRIPTS)/mkderivedproperties.pl \ -# $(DESIGNDATA)/properties.csv \ -# $(DESIGNDATA)/value-types.csv \ -# icalderivedproperty.c.in \ -# icalderivedproperty.h.in -# -# -#icalderivedproperty.h: $(PROPERTYDEPS) -# $(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedproperties.pl \ -# -i $(srcdir)/icalderivedproperty.h.in -h $(DESIGNDATA)/properties.csv\ -# ${DESIGNDATA}/value-types.csv > icalderivedproperty.h -# -#icalderivedproperty.c: $(PROPERTYDEPS) $(BUILT_COMBINEDHEADERS) -# $(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedproperties.pl \ -# -i $(srcdir)/icalderivedproperty.c.in -c $(DESIGNDATA)/properties.csv \ -# ${DESIGNDATA}/value-types.csv > icalderivedproperty.c -# -## restrictions -# -#RESTRICTIONDEPS = \ -# $(ICALSCRIPTS)/mkrestrictiontable.pl \ -# $(DESIGNDATA)/restrictions.csv \ -# icalrestriction.c.in -# -#icalrestriction.c: $(RESTRICTIONDEPS) -# $(PERL) $(ICALSCRIPTS)/mkrestrictiontable.pl -i $(srcdir)/icalrestriction.c.in \ -# $(DESIGNDATA)/restrictions.csv > icalrestriction.c -# -## values -# -#VALUEDEPS = \ -# $(ICALSCRIPTS)/mkderivedvalues.pl \ -# $(DESIGNDATA)/value-types.csv \ -# icalderivedvalue.c.in \ -# icalderivedvalue.h.in -# -#icalderivedvalue.h: $(VALUEDEPS) -# $(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedvalues.pl \ -# -i $(srcdir)/icalderivedvalue.h.in -h $(DESIGNDATA)/value-types.csv > icalderivedvalue.h -# -#icalderivedvalue.c: $(VALUEDEPS) $(BUILT_COMBINEDHEADERS) -# $(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedvalues.pl \ -# -i $(srcdir)/icalderivedvalue.c.in -c $(DESIGNDATA)/value-types.csv > icalderivedvalue.c -# -## c++ needs ical.h auto-generated. -#icalparameter_cxx.lo: ical.h -#icalproperty_cxx.lo: ical.h -#icalvalue_cxx.lo: ical.h -#vcomponent.lo: ical.h -# -# -## housekeeping -#CONFIG_CLEAN_FILES = y.output -# -#CLEANFILES = $(BUILT_SOURCES) $(BUILT_COMBINEDHEADERS) -# -#dist-hook: -# cd $(distdir); rm -f $(BUILT_SOURCES) -# cd $(distdir); rm -f ical.h icalversion.h -# -#EXTRA_DIST = \ -# icalderivedparameter.c.in \ -# icalderivedparameter.h.in \ -# icalderivedproperty.c.in \ -# icalderivedproperty.h.in \ -# icalrestriction.c.in \ -# icalderivedvalue.c.in \ -# icalderivedvalue.h.in \ -# icalversion.h.in -# -#$(srcdir)/icalcomponent.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#icalderivedparameter.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#icalderivedproperty.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#icalderivedvalue.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#$(srcdir)/icalduration.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#$(srcdir)/icallangbind.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#$(srcdir)/icalmime.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#$(srcdir)/icalparameter.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#$(srcdir)/icalparser.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#$(srcdir)/icalproperty.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#icalrestriction.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#$(srcdir)/icaltime.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h -#$(srcdir)/icalvalue.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h + DESTINATION + ${INCLUDE_INSTALL_DIR}/libical +) diff --git a/src/libical/Makefile.am b/src/libical/Makefile.am index 8846a46..8696986 100644 --- a/src/libical/Makefile.am +++ b/src/libical/Makefile.am @@ -51,7 +51,11 @@ INCLUDES = \ -I$(top_builddir)/src/libical \ -I$(srcdir) -libical_la_LDFLAGS = -version-info 43:0:43 +libical_la_LDFLAGS = -version-info 48:0:48 + +if OS_WIN32 +libical_la_LDFLAGS += -no-undefined +endif libical_la_LIBADD = $(PTHREAD_LIBS) @@ -101,7 +105,7 @@ libical_la_SOURCES = \ pvl.h \ sspm.c \ sspm.h \ - vsnprintf.c \ + libicals_w32_vsnprintf_replacement.c \ icallangbind.h \ icallangbind.c \ caldate.c \ @@ -175,7 +179,7 @@ COMBINEDHEADERS = \ $(top_srcdir)/src/libical/icaltimezone.h \ $(top_srcdir)/src/libical/icalparser.h \ $(top_srcdir)/src/libical/icalmemory.h \ - $(top_srcdir)/src/libical/icalerror.h \ + icalerror.h \ $(top_srcdir)/src/libical/icalrestriction.h \ $(top_srcdir)/src/libical/sspm.h \ $(top_srcdir)/src/libical/icalmime.h \ diff --git a/src/libical/Makefile.in b/src/libical/Makefile.in index 71ddbea..0f85682 100644 --- a/src/libical/Makefile.in +++ b/src/libical/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -39,17 +39,29 @@ #====================================================================== -SOURCES = $(libical_static_la_SOURCES) $(libical_la_SOURCES) $(libical_cxx_la_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -64,25 +76,48 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ +@OS_WIN32_TRUE@am__append_1 = -no-undefined subdir = src/libical DIST_COMMON = $(am__libical_include_HEADERS_DIST) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/icalversion.h.in + $(srcdir)/icalerror.h.in $(srcdir)/icalversion.h.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(libdir)" \ "$(DESTDIR)$(libical_includedir)" -libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) libical_static_la_LIBADD = am__objects_1 = @@ -93,9 +128,13 @@ am__objects_3 = $(am__objects_2) icalarray.lo icalattach.lo \ icalmime.lo icalparameter.lo icalparser.lo icalproperty.lo \ icalrecur.lo icaltime.lo icaltz-util.lo icaltimezone.lo \ icalduration.lo icalperiod.lo icaltypes.lo icalvalue.lo pvl.lo \ - sspm.lo vsnprintf.lo icallangbind.lo caldate.lo + sspm.lo libicals_w32_vsnprintf_replacement.lo icallangbind.lo \ + caldate.lo am_libical_static_la_OBJECTS = $(am__objects_3) libical_static_la_OBJECTS = $(am_libical_static_la_OBJECTS) +libical_static_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libical_static_la_LDFLAGS) $(LDFLAGS) -o $@ am__DEPENDENCIES_1 = libical_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libical_la_OBJECTS = $(am__objects_2) icalarray.lo icalattach.lo \ @@ -103,8 +142,12 @@ am_libical_la_OBJECTS = $(am__objects_2) icalarray.lo icalattach.lo \ icalmime.lo icalparameter.lo icalparser.lo icalproperty.lo \ icalrecur.lo icaltime.lo icaltz-util.lo icaltimezone.lo \ icalduration.lo icalperiod.lo icaltypes.lo icalvalue.lo pvl.lo \ - sspm.lo vsnprintf.lo icallangbind.lo caldate.lo + sspm.lo libicals_w32_vsnprintf_replacement.lo icallangbind.lo \ + caldate.lo libical_la_OBJECTS = $(am_libical_la_OBJECTS) +libical_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libical_la_LDFLAGS) $(LDFLAGS) -o $@ libical_cxx_la_LIBADD = am__libical_cxx_la_SOURCES_DIST = icalderivedparameter.h \ icalderivedproperty.h icalderivedvalue.h \ @@ -119,39 +162,47 @@ am__libical_cxx_la_SOURCES_DIST = icalderivedparameter.h \ icaltz-util.h icaltimezone.c icaltimezone.h icalduration.h \ icalduration.c icalperiod.h icalperiod.c icaltypes.c \ icaltypes.h icalvalue.c icalvalue.h icalvalueimpl.h pvl.c \ - pvl.h sspm.c sspm.h vsnprintf.c icallangbind.h icallangbind.c \ - caldate.c astime.h vcomponent.h vcomponent.cpp \ - icalproperty_cxx.h icalproperty_cxx.cpp icalparameter_cxx.h \ - icalparameter_cxx.cpp icalvalue_cxx.h icalvalue_cxx.cpp \ - icptrholder.h + pvl.h sspm.c sspm.h libicals_w32_vsnprintf_replacement.c \ + icallangbind.h icallangbind.c caldate.c astime.h vcomponent.h \ + vcomponent.cpp icalproperty_cxx.h icalproperty_cxx.cpp \ + icalparameter_cxx.h icalparameter_cxx.cpp icalvalue_cxx.h \ + icalvalue_cxx.cpp icptrholder.h @WITH_CXX_BINDINGS_TRUE@am_libical_cxx_la_OBJECTS = $(am__objects_3) \ @WITH_CXX_BINDINGS_TRUE@ vcomponent.lo icalproperty_cxx.lo \ @WITH_CXX_BINDINGS_TRUE@ icalparameter_cxx.lo icalvalue_cxx.lo libical_cxx_la_OBJECTS = $(am_libical_cxx_la_OBJECTS) @WITH_CXX_BINDINGS_TRUE@am_libical_cxx_la_rpath = -rpath $(libdir) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles +am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ SOURCES = $(libical_static_la_SOURCES) $(libical_la_SOURCES) \ $(libical_cxx_la_SOURCES) DIST_SOURCES = $(libical_static_la_SOURCES) $(libical_la_SOURCES) \ $(am__libical_cxx_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__libical_include_HEADERS_DIST = ical.h icalarray.h icalattach.h \ icalcomponent.h icalderivedparameter.h icalderivedproperty.h \ icalderivedvalue.h icalduration.h icalenums.h icalerror.h \ @@ -161,14 +212,11 @@ am__libical_include_HEADERS_DIST = ical.h icalarray.h icalattach.h \ icaltypes.h icalvalue.h pvl.h sspm.h vcomponent.h \ icalparameter_cxx.h icalproperty_cxx.h icalvalue_cxx.h \ icptrholder.h -libical_includeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(libical_include_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -192,18 +240,17 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DEV_FALSE = @DEV_FALSE@ -DEV_TRUE = @DEV_TRUE@ -ECHO = @ECHO@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@ -HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -213,6 +260,7 @@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JAVA_PLATFORM = @JAVA_PLATFORM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ @@ -220,53 +268,52 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OS_WIN32_FALSE = @OS_WIN32_FALSE@ -OS_WIN32_TRUE = @OS_WIN32_TRUE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ PY_CFLAGS = @PY_CFLAGS@ -PY_EXTRA_LIBS = @PY_EXTRA_LIBS@ -PY_LIBS = @PY_LIBS@ -PY_LIB_LOC = @PY_LIB_LOC@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -WITH_BDB4_FALSE = @WITH_BDB4_FALSE@ -WITH_BDB4_TRUE = @WITH_BDB4_TRUE@ -WITH_CXX_BINDINGS_FALSE = @WITH_CXX_BINDINGS_FALSE@ -WITH_CXX_BINDINGS_TRUE = @WITH_CXX_BINDINGS_TRUE@ -WITH_JAVA_FALSE = @WITH_JAVA_FALSE@ -WITH_JAVA_TRUE = @WITH_JAVA_TRUE@ -WITH_PYTHON_FALSE = @WITH_PYTHON_FALSE@ -WITH_PYTHON_TRUE = @WITH_PYTHON_TRUE@ YACC = @YACC@ +YFLAGS = @YFLAGS@ ZONE_INFO = @ZONE_INFO@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -278,33 +325,49 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ -python_val = @python_val@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +swig_val = @swig_val@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ DESIGNDATA = $(top_srcdir)/design-data ICALSCRIPTS = $(top_srcdir)/scripts @WITH_CXX_BINDINGS_FALSE@cxx_lib = @@ -326,7 +389,7 @@ INCLUDES = \ -I$(top_builddir)/src/libical \ -I$(srcdir) -libical_la_LDFLAGS = -version-info 43:0:43 +libical_la_LDFLAGS = -version-info 48:0:48 $(am__append_1) libical_la_LIBADD = $(PTHREAD_LIBS) libical_la_SOURCES = \ $(BUILT_SOURCES) \ @@ -374,7 +437,7 @@ libical_la_SOURCES = \ pvl.h \ sspm.c \ sspm.h \ - vsnprintf.c \ + libicals_w32_vsnprintf_replacement.c \ icallangbind.h \ icallangbind.c \ caldate.c \ @@ -446,7 +509,7 @@ COMBINEDHEADERS = \ $(top_srcdir)/src/libical/icaltimezone.h \ $(top_srcdir)/src/libical/icalparser.h \ $(top_srcdir)/src/libical/icalmemory.h \ - $(top_srcdir)/src/libical/icalerror.h \ + icalerror.h \ $(top_srcdir)/src/libical/icalrestriction.h \ $(top_srcdir)/src/libical/sspm.h \ $(top_srcdir)/src/libical/icalmime.h \ @@ -523,14 +586,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libical/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/libical/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libical/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/libical/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -548,50 +611,62 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): icalversion.h: $(top_builddir)/config.status $(srcdir)/icalversion.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +icalerror.h: $(top_builddir)/config.status $(srcdir)/icalerror.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + list2="$$list2 $$p"; \ else :; fi; \ - done + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libical-static.la: $(libical_static_la_OBJECTS) $(libical_static_la_DEPENDENCIES) - $(LINK) $(libical_static_la_LDFLAGS) $(libical_static_la_OBJECTS) $(libical_static_la_LIBADD) $(LIBS) -libical.la: $(libical_la_OBJECTS) $(libical_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libical_la_LDFLAGS) $(libical_la_OBJECTS) $(libical_la_LIBADD) $(LIBS) -libical_cxx.la: $(libical_cxx_la_OBJECTS) $(libical_cxx_la_DEPENDENCIES) - $(CXXLINK) $(am_libical_cxx_la_rpath) $(libical_cxx_la_LDFLAGS) $(libical_cxx_la_OBJECTS) $(libical_cxx_la_LIBADD) $(LIBS) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libical-static.la: $(libical_static_la_OBJECTS) $(libical_static_la_DEPENDENCIES) $(EXTRA_libical_static_la_DEPENDENCIES) + $(libical_static_la_LINK) $(libical_static_la_OBJECTS) $(libical_static_la_LIBADD) $(LIBS) +libical.la: $(libical_la_OBJECTS) $(libical_la_DEPENDENCIES) $(EXTRA_libical_la_DEPENDENCIES) + $(libical_la_LINK) -rpath $(libdir) $(libical_la_OBJECTS) $(libical_la_LIBADD) $(LIBS) +libical_cxx.la: $(libical_cxx_la_OBJECTS) $(libical_cxx_la_DEPENDENCIES) $(EXTRA_libical_cxx_la_DEPENDENCIES) + $(CXXLINK) $(am_libical_cxx_la_rpath) $(libical_cxx_la_OBJECTS) $(libical_cxx_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -626,49 +701,49 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icaltz-util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icalvalue.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icalvalue_cxx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicals_w32_vsnprintf_replacement.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sspm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcomponent.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsnprintf.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< .cpp.o: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: -@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< @@ -678,100 +753,121 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: install-libical_includeHEADERS: $(libical_include_HEADERS) @$(NORMAL_INSTALL) - test -z "$(libical_includedir)" || $(mkdir_p) "$(DESTDIR)$(libical_includedir)" - @list='$(libical_include_HEADERS)'; for p in $$list; do \ + @list='$(libical_include_HEADERS)'; test -n "$(libical_includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libical_includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libical_includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(libical_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libical_includedir)/$$f'"; \ - $(libical_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libical_includedir)/$$f"; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libical_includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(libical_includedir)" || exit $$?; \ done uninstall-libical_includeHEADERS: @$(NORMAL_UNINSTALL) - @list='$(libical_include_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(libical_includedir)/$$f'"; \ - rm -f "$(DESTDIR)$(libical_includedir)/$$f"; \ - done + @list='$(libical_include_HEADERS)'; test -n "$(libical_includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libical_includedir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ + set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @@ -784,7 +880,7 @@ check: $(BUILT_SOURCES) all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libical_includedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am @@ -797,10 +893,15 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -808,6 +909,7 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -822,7 +924,7 @@ distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am @@ -830,18 +932,38 @@ dvi-am: html: html-am +html-am: + info: info-am info-am: install-data-am: install-libical_includeHEADERS +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: install-libLTLIBRARIES +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am @@ -862,22 +984,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ +uninstall-am: uninstall-libLTLIBRARIES \ uninstall-libical_includeHEADERS +.MAKE: all check install install-am install-strip + .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \ - ctags dist-hook distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-libLTLIBRARIES \ - install-libical_includeHEADERS install-man install-strip \ + cscopelist ctags dist-hook distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-libical_includeHEADERS install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-libical_includeHEADERS + tags uninstall uninstall-am uninstall-libLTLIBRARIES \ + uninstall-libical_includeHEADERS ical.h: $(COMBINEDHEADERS) @@ -950,6 +1076,7 @@ $(srcdir)/icalproperty.c: icalderivedvalue.h icalderivedproperty.h icalderivedpa icalrestriction.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h $(srcdir)/icaltime.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h $(srcdir)/icalvalue.c: icalderivedvalue.h icalderivedproperty.h icalderivedparameter.h + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/src/libical/autogenex/ical.h b/src/libical/autogenex/ical.h index 572133d..1b6e6da 100644 --- a/src/libical/autogenex/ical.h +++ b/src/libical/autogenex/ical.h @@ -3272,7 +3272,7 @@ if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \ void icalerror_set_errno(icalerrorenum x); #endif -#ifdef ICAL_ERRORS_ARE_FATAL +#if ICAL_ERRORS_ARE_FATAL == 1 #undef NDEBUG #endif @@ -3282,7 +3282,7 @@ void icalerror_set_errno(icalerrorenum x); #define icalerror_check_component_type(value,type); /* Assert with a message */ -#ifdef ICAL_ERRORS_ARE_FATAL +#if ICAL_ERRORS_ARE_FATAL == 1 #ifdef __GNUC__ #define icalerror_assert(test,message) if(!(test)){fprintf(stderr,"%s(), %s:%d: %s\n",__FUNCTION__,__FILE__,__LINE__,message);icalerror_stop_here(); abort();} diff --git a/src/libical/autogenex/icalderivedproperty.c b/src/libical/autogenex/icalderivedproperty.c index 59aa30a..03e38a8 100644 --- a/src/libical/autogenex/icalderivedproperty.c +++ b/src/libical/autogenex/icalderivedproperty.c @@ -252,7 +252,8 @@ enum icalproperty_action icalproperty_get_action(const icalproperty* prop){ } icalproperty* icalproperty_vanew_allowconflict(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ALLOWCONFLICT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ALLOWCONFLICT_PROPERTY); icalproperty_set_allowconflict((icalproperty*)impl,v); va_start(args,v); @@ -263,7 +264,8 @@ icalproperty* icalproperty_vanew_allowconflict(const char* v, ...){ /* ALLOW-CONFLICT */ icalproperty* icalproperty_new_allowconflict(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ALLOWCONFLICT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ALLOWCONFLICT_PROPERTY); icalproperty_set_allowconflict((icalproperty*)impl,v); return (icalproperty*)impl; @@ -281,7 +283,8 @@ const char* icalproperty_get_allowconflict(const icalproperty* prop){ } icalproperty* icalproperty_vanew_attach(icalattach * v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); icalproperty_set_attach((icalproperty*)impl,v); va_start(args,v); @@ -292,7 +295,8 @@ icalproperty* icalproperty_vanew_attach(icalattach * v, ...){ /* ATTACH */ icalproperty* icalproperty_new_attach(icalattach * v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); icalproperty_set_attach((icalproperty*)impl,v); return (icalproperty*)impl; @@ -310,7 +314,8 @@ icalattach * icalproperty_get_attach(const icalproperty* prop){ } icalproperty* icalproperty_vanew_attendee(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTENDEE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTENDEE_PROPERTY); icalproperty_set_attendee((icalproperty*)impl,v); va_start(args,v); @@ -321,7 +326,8 @@ icalproperty* icalproperty_vanew_attendee(const char* v, ...){ /* ATTENDEE */ icalproperty* icalproperty_new_attendee(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTENDEE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTENDEE_PROPERTY); icalproperty_set_attendee((icalproperty*)impl,v); return (icalproperty*)impl; @@ -339,7 +345,8 @@ const char* icalproperty_get_attendee(const icalproperty* prop){ } icalproperty* icalproperty_vanew_calid(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALID_PROPERTY); icalproperty_set_calid((icalproperty*)impl,v); va_start(args,v); @@ -350,7 +357,8 @@ icalproperty* icalproperty_vanew_calid(const char* v, ...){ /* CALID */ icalproperty* icalproperty_new_calid(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALID_PROPERTY); icalproperty_set_calid((icalproperty*)impl,v); return (icalproperty*)impl; @@ -368,7 +376,8 @@ const char* icalproperty_get_calid(const icalproperty* prop){ } icalproperty* icalproperty_vanew_calmaster(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALMASTER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALMASTER_PROPERTY); icalproperty_set_calmaster((icalproperty*)impl,v); va_start(args,v); @@ -379,7 +388,8 @@ icalproperty* icalproperty_vanew_calmaster(const char* v, ...){ /* CALMASTER */ icalproperty* icalproperty_new_calmaster(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALMASTER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALMASTER_PROPERTY); icalproperty_set_calmaster((icalproperty*)impl,v); return (icalproperty*)impl; @@ -397,7 +407,8 @@ const char* icalproperty_get_calmaster(const icalproperty* prop){ } icalproperty* icalproperty_vanew_calscale(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); icalproperty_set_calscale((icalproperty*)impl,v); va_start(args,v); @@ -408,7 +419,8 @@ icalproperty* icalproperty_vanew_calscale(const char* v, ...){ /* CALSCALE */ icalproperty* icalproperty_new_calscale(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); icalproperty_set_calscale((icalproperty*)impl,v); return (icalproperty*)impl; @@ -426,7 +438,8 @@ const char* icalproperty_get_calscale(const icalproperty* prop){ } icalproperty* icalproperty_vanew_carid(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CARID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CARID_PROPERTY); icalproperty_set_carid((icalproperty*)impl,v); va_start(args,v); @@ -437,7 +450,8 @@ icalproperty* icalproperty_vanew_carid(const char* v, ...){ /* CARID */ icalproperty* icalproperty_new_carid(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CARID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CARID_PROPERTY); icalproperty_set_carid((icalproperty*)impl,v); return (icalproperty*)impl; @@ -455,7 +469,8 @@ const char* icalproperty_get_carid(const icalproperty* prop){ } icalproperty* icalproperty_vanew_categories(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CATEGORIES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CATEGORIES_PROPERTY); icalproperty_set_categories((icalproperty*)impl,v); va_start(args,v); @@ -466,7 +481,8 @@ icalproperty* icalproperty_vanew_categories(const char* v, ...){ /* CATEGORIES */ icalproperty* icalproperty_new_categories(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CATEGORIES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CATEGORIES_PROPERTY); icalproperty_set_categories((icalproperty*)impl,v); return (icalproperty*)impl; @@ -510,7 +526,8 @@ enum icalproperty_class icalproperty_get_class(const icalproperty* prop){ } icalproperty* icalproperty_vanew_comment(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMMENT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMMENT_PROPERTY); icalproperty_set_comment((icalproperty*)impl,v); va_start(args,v); @@ -521,7 +538,8 @@ icalproperty* icalproperty_vanew_comment(const char* v, ...){ /* COMMENT */ icalproperty* icalproperty_new_comment(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMMENT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMMENT_PROPERTY); icalproperty_set_comment((icalproperty*)impl,v); return (icalproperty*)impl; @@ -565,7 +583,8 @@ struct icaltimetype icalproperty_get_completed(const icalproperty* prop){ } icalproperty* icalproperty_vanew_contact(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CONTACT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CONTACT_PROPERTY); icalproperty_set_contact((icalproperty*)impl,v); va_start(args,v); @@ -576,7 +595,8 @@ icalproperty* icalproperty_vanew_contact(const char* v, ...){ /* CONTACT */ icalproperty* icalproperty_new_contact(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CONTACT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CONTACT_PROPERTY); icalproperty_set_contact((icalproperty*)impl,v); return (icalproperty*)impl; @@ -620,7 +640,8 @@ struct icaltimetype icalproperty_get_created(const icalproperty* prop){ } icalproperty* icalproperty_vanew_decreed(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DECREED_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DECREED_PROPERTY); icalproperty_set_decreed((icalproperty*)impl,v); va_start(args,v); @@ -631,7 +652,8 @@ icalproperty* icalproperty_vanew_decreed(const char* v, ...){ /* DECREED */ icalproperty* icalproperty_new_decreed(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DECREED_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DECREED_PROPERTY); icalproperty_set_decreed((icalproperty*)impl,v); return (icalproperty*)impl; @@ -649,7 +671,8 @@ const char* icalproperty_get_decreed(const icalproperty* prop){ } icalproperty* icalproperty_vanew_defaultcharset(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTCHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTCHARSET_PROPERTY); icalproperty_set_defaultcharset((icalproperty*)impl,v); va_start(args,v); @@ -660,7 +683,8 @@ icalproperty* icalproperty_vanew_defaultcharset(const char* v, ...){ /* DEFAULT-CHARSET */ icalproperty* icalproperty_new_defaultcharset(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTCHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTCHARSET_PROPERTY); icalproperty_set_defaultcharset((icalproperty*)impl,v); return (icalproperty*)impl; @@ -678,7 +702,8 @@ const char* icalproperty_get_defaultcharset(const icalproperty* prop){ } icalproperty* icalproperty_vanew_defaultlocale(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTLOCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTLOCALE_PROPERTY); icalproperty_set_defaultlocale((icalproperty*)impl,v); va_start(args,v); @@ -689,7 +714,8 @@ icalproperty* icalproperty_vanew_defaultlocale(const char* v, ...){ /* DEFAULT-LOCALE */ icalproperty* icalproperty_new_defaultlocale(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTLOCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTLOCALE_PROPERTY); icalproperty_set_defaultlocale((icalproperty*)impl,v); return (icalproperty*)impl; @@ -707,7 +733,8 @@ const char* icalproperty_get_defaultlocale(const icalproperty* prop){ } icalproperty* icalproperty_vanew_defaulttzid(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTTZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTTZID_PROPERTY); icalproperty_set_defaulttzid((icalproperty*)impl,v); va_start(args,v); @@ -718,7 +745,8 @@ icalproperty* icalproperty_vanew_defaulttzid(const char* v, ...){ /* DEFAULT-TZID */ icalproperty* icalproperty_new_defaulttzid(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTTZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTTZID_PROPERTY); icalproperty_set_defaulttzid((icalproperty*)impl,v); return (icalproperty*)impl; @@ -736,7 +764,8 @@ const char* icalproperty_get_defaulttzid(const icalproperty* prop){ } icalproperty* icalproperty_vanew_description(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); icalproperty_set_description((icalproperty*)impl,v); va_start(args,v); @@ -747,7 +776,8 @@ icalproperty* icalproperty_vanew_description(const char* v, ...){ /* DESCRIPTION */ icalproperty* icalproperty_new_description(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); icalproperty_set_description((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1071,7 +1101,8 @@ struct icaltimetype icalproperty_get_lastmodified(const icalproperty* prop){ } icalproperty* icalproperty_vanew_location(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LOCATION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LOCATION_PROPERTY); icalproperty_set_location((icalproperty*)impl,v); va_start(args,v); @@ -1082,7 +1113,8 @@ icalproperty* icalproperty_vanew_location(const char* v, ...){ /* LOCATION */ icalproperty* icalproperty_new_location(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LOCATION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LOCATION_PROPERTY); icalproperty_set_location((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1178,7 +1210,8 @@ enum icalproperty_method icalproperty_get_method(const icalproperty* prop){ } icalproperty* icalproperty_vanew_organizer(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ORGANIZER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ORGANIZER_PROPERTY); icalproperty_set_organizer((icalproperty*)impl,v); va_start(args,v); @@ -1189,7 +1222,8 @@ icalproperty* icalproperty_vanew_organizer(const char* v, ...){ /* ORGANIZER */ icalproperty* icalproperty_new_organizer(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ORGANIZER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ORGANIZER_PROPERTY); icalproperty_set_organizer((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1207,7 +1241,8 @@ const char* icalproperty_get_organizer(const icalproperty* prop){ } icalproperty* icalproperty_vanew_owner(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_OWNER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_OWNER_PROPERTY); icalproperty_set_owner((icalproperty*)impl,v); va_start(args,v); @@ -1218,7 +1253,8 @@ icalproperty* icalproperty_vanew_owner(const char* v, ...){ /* OWNER */ icalproperty* icalproperty_new_owner(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_OWNER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_OWNER_PROPERTY); icalproperty_set_owner((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1288,7 +1324,8 @@ int icalproperty_get_priority(const icalproperty* prop){ } icalproperty* icalproperty_vanew_prodid(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRODID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRODID_PROPERTY); icalproperty_set_prodid((icalproperty*)impl,v); va_start(args,v); @@ -1299,7 +1336,8 @@ icalproperty* icalproperty_vanew_prodid(const char* v, ...){ /* PRODID */ icalproperty* icalproperty_new_prodid(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRODID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRODID_PROPERTY); icalproperty_set_prodid((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1317,7 +1355,8 @@ const char* icalproperty_get_prodid(const icalproperty* prop){ } icalproperty* icalproperty_vanew_query(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERY_PROPERTY); icalproperty_set_query((icalproperty*)impl,v); va_start(args,v); @@ -1328,7 +1367,8 @@ icalproperty* icalproperty_vanew_query(const char* v, ...){ /* QUERY */ icalproperty* icalproperty_new_query(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERY_PROPERTY); icalproperty_set_query((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1346,7 +1386,8 @@ const char* icalproperty_get_query(const icalproperty* prop){ } icalproperty* icalproperty_vanew_queryname(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERYNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERYNAME_PROPERTY); icalproperty_set_queryname((icalproperty*)impl,v); va_start(args,v); @@ -1357,7 +1398,8 @@ icalproperty* icalproperty_vanew_queryname(const char* v, ...){ /* QUERYNAME */ icalproperty* icalproperty_new_queryname(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERYNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERYNAME_PROPERTY); icalproperty_set_queryname((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1432,7 +1474,8 @@ struct icaltimetype icalproperty_get_recurrenceid(const icalproperty* prop){ } icalproperty* icalproperty_vanew_relatedto(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELATEDTO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELATEDTO_PROPERTY); icalproperty_set_relatedto((icalproperty*)impl,v); va_start(args,v); @@ -1443,7 +1486,8 @@ icalproperty* icalproperty_vanew_relatedto(const char* v, ...){ /* RELATED-TO */ icalproperty* icalproperty_new_relatedto(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELATEDTO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELATEDTO_PROPERTY); icalproperty_set_relatedto((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1461,7 +1505,8 @@ const char* icalproperty_get_relatedto(const icalproperty* prop){ } icalproperty* icalproperty_vanew_relcalid(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELCALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELCALID_PROPERTY); icalproperty_set_relcalid((icalproperty*)impl,v); va_start(args,v); @@ -1472,7 +1517,8 @@ icalproperty* icalproperty_vanew_relcalid(const char* v, ...){ /* RELCALID */ icalproperty* icalproperty_new_relcalid(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELCALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELCALID_PROPERTY); icalproperty_set_relcalid((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1542,7 +1588,8 @@ struct icalreqstattype icalproperty_get_requeststatus(const icalproperty* prop){ } icalproperty* icalproperty_vanew_resources(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RESOURCES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RESOURCES_PROPERTY); icalproperty_set_resources((icalproperty*)impl,v); va_start(args,v); @@ -1553,7 +1600,8 @@ icalproperty* icalproperty_vanew_resources(const char* v, ...){ /* RESOURCES */ icalproperty* icalproperty_new_resources(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RESOURCES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RESOURCES_PROPERTY); icalproperty_set_resources((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1597,7 +1645,8 @@ struct icalrecurrencetype icalproperty_get_rrule(const icalproperty* prop){ } icalproperty* icalproperty_vanew_scope(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SCOPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SCOPE_PROPERTY); icalproperty_set_scope((icalproperty*)impl,v); va_start(args,v); @@ -1608,7 +1657,8 @@ icalproperty* icalproperty_vanew_scope(const char* v, ...){ /* SCOPE */ icalproperty* icalproperty_new_scope(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SCOPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SCOPE_PROPERTY); icalproperty_set_scope((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1678,7 +1728,8 @@ enum icalproperty_status icalproperty_get_status(const icalproperty* prop){ } icalproperty* icalproperty_vanew_summary(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SUMMARY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SUMMARY_PROPERTY); icalproperty_set_summary((icalproperty*)impl,v); va_start(args,v); @@ -1689,7 +1740,8 @@ icalproperty* icalproperty_vanew_summary(const char* v, ...){ /* SUMMARY */ icalproperty* icalproperty_new_summary(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SUMMARY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SUMMARY_PROPERTY); icalproperty_set_summary((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1707,7 +1759,8 @@ const char* icalproperty_get_summary(const icalproperty* prop){ } icalproperty* icalproperty_vanew_target(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TARGET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TARGET_PROPERTY); icalproperty_set_target((icalproperty*)impl,v); va_start(args,v); @@ -1718,7 +1771,8 @@ icalproperty* icalproperty_vanew_target(const char* v, ...){ /* TARGET */ icalproperty* icalproperty_new_target(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TARGET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TARGET_PROPERTY); icalproperty_set_target((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1788,7 +1842,8 @@ struct icaltriggertype icalproperty_get_trigger(const icalproperty* prop){ } icalproperty* icalproperty_vanew_tzid(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZID_PROPERTY); icalproperty_set_tzid((icalproperty*)impl,v); va_start(args,v); @@ -1799,7 +1854,8 @@ icalproperty* icalproperty_vanew_tzid(const char* v, ...){ /* TZID */ icalproperty* icalproperty_new_tzid(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZID_PROPERTY); icalproperty_set_tzid((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1817,7 +1873,8 @@ const char* icalproperty_get_tzid(const icalproperty* prop){ } icalproperty* icalproperty_vanew_tzname(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZNAME_PROPERTY); icalproperty_set_tzname((icalproperty*)impl,v); va_start(args,v); @@ -1828,7 +1885,8 @@ icalproperty* icalproperty_vanew_tzname(const char* v, ...){ /* TZNAME */ icalproperty* icalproperty_new_tzname(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZNAME_PROPERTY); icalproperty_set_tzname((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1898,7 +1956,8 @@ int icalproperty_get_tzoffsetto(const icalproperty* prop){ } icalproperty* icalproperty_vanew_tzurl(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZURL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZURL_PROPERTY); icalproperty_set_tzurl((icalproperty*)impl,v); va_start(args,v); @@ -1909,7 +1968,8 @@ icalproperty* icalproperty_vanew_tzurl(const char* v, ...){ /* TZURL */ icalproperty* icalproperty_new_tzurl(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZURL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZURL_PROPERTY); icalproperty_set_tzurl((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1927,7 +1987,8 @@ const char* icalproperty_get_tzurl(const icalproperty* prop){ } icalproperty* icalproperty_vanew_uid(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_UID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_UID_PROPERTY); icalproperty_set_uid((icalproperty*)impl,v); va_start(args,v); @@ -1938,7 +1999,8 @@ icalproperty* icalproperty_vanew_uid(const char* v, ...){ /* UID */ icalproperty* icalproperty_new_uid(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_UID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_UID_PROPERTY); icalproperty_set_uid((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1956,7 +2018,8 @@ const char* icalproperty_get_uid(const icalproperty* prop){ } icalproperty* icalproperty_vanew_url(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_URL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_URL_PROPERTY); icalproperty_set_url((icalproperty*)impl,v); va_start(args,v); @@ -1967,7 +2030,8 @@ icalproperty* icalproperty_vanew_url(const char* v, ...){ /* URL */ icalproperty* icalproperty_new_url(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_URL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_URL_PROPERTY); icalproperty_set_url((icalproperty*)impl,v); return (icalproperty*)impl; @@ -1985,7 +2049,8 @@ const char* icalproperty_get_url(const icalproperty* prop){ } icalproperty* icalproperty_vanew_version(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_VERSION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_VERSION_PROPERTY); icalproperty_set_version((icalproperty*)impl,v); va_start(args,v); @@ -1996,7 +2061,8 @@ icalproperty* icalproperty_vanew_version(const char* v, ...){ /* VERSION */ icalproperty* icalproperty_new_version(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_VERSION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_VERSION_PROPERTY); icalproperty_set_version((icalproperty*)impl,v); return (icalproperty*)impl; @@ -2014,7 +2080,8 @@ const char* icalproperty_get_version(const icalproperty* prop){ } icalproperty* icalproperty_vanew_x(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalproperty_set_x((icalproperty*)impl,v); va_start(args,v); @@ -2025,7 +2092,8 @@ icalproperty* icalproperty_vanew_x(const char* v, ...){ /* X */ icalproperty* icalproperty_new_x(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalproperty_set_x((icalproperty*)impl,v); return (icalproperty*)impl; @@ -2069,7 +2137,8 @@ enum icalproperty_xlicclass icalproperty_get_xlicclass(const icalproperty* prop) } icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); icalproperty_set_xlicclustercount((icalproperty*)impl,v); va_start(args,v); @@ -2080,7 +2149,8 @@ icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...){ /* X-LIC-CLUSTERCOUNT */ icalproperty* icalproperty_new_xlicclustercount(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); icalproperty_set_xlicclustercount((icalproperty*)impl,v); return (icalproperty*)impl; @@ -2098,7 +2168,8 @@ const char* icalproperty_get_xlicclustercount(const icalproperty* prop){ } icalproperty* icalproperty_vanew_xlicerror(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); icalproperty_set_xlicerror((icalproperty*)impl,v); va_start(args,v); @@ -2109,7 +2180,8 @@ icalproperty* icalproperty_vanew_xlicerror(const char* v, ...){ /* X-LIC-ERROR */ icalproperty* icalproperty_new_xlicerror(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); icalproperty_set_xlicerror((icalproperty*)impl,v); return (icalproperty*)impl; @@ -2127,7 +2199,8 @@ const char* icalproperty_get_xlicerror(const icalproperty* prop){ } icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); icalproperty_set_xlicmimecharset((icalproperty*)impl,v); va_start(args,v); @@ -2138,7 +2211,8 @@ icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...){ /* X-LIC-MIMECHARSET */ icalproperty* icalproperty_new_xlicmimecharset(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); icalproperty_set_xlicmimecharset((icalproperty*)impl,v); return (icalproperty*)impl; @@ -2156,7 +2230,8 @@ const char* icalproperty_get_xlicmimecharset(const icalproperty* prop){ } icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); icalproperty_set_xlicmimecid((icalproperty*)impl,v); va_start(args,v); @@ -2167,7 +2242,8 @@ icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...){ /* X-LIC-MIMECID */ icalproperty* icalproperty_new_xlicmimecid(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); icalproperty_set_xlicmimecid((icalproperty*)impl,v); return (icalproperty*)impl; @@ -2185,7 +2261,8 @@ const char* icalproperty_get_xlicmimecid(const icalproperty* prop){ } icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); icalproperty_set_xlicmimecontenttype((icalproperty*)impl,v); va_start(args,v); @@ -2196,7 +2273,8 @@ icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...){ /* X-LIC-MIMECONTENTTYPE */ icalproperty* icalproperty_new_xlicmimecontenttype(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); icalproperty_set_xlicmimecontenttype((icalproperty*)impl,v); return (icalproperty*)impl; @@ -2214,7 +2292,8 @@ const char* icalproperty_get_xlicmimecontenttype(const icalproperty* prop){ } icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); icalproperty_set_xlicmimeencoding((icalproperty*)impl,v); va_start(args,v); @@ -2225,7 +2304,8 @@ icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...){ /* X-LIC-MIMEENCODING */ icalproperty* icalproperty_new_xlicmimeencoding(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); icalproperty_set_xlicmimeencoding((icalproperty*)impl,v); return (icalproperty*)impl; @@ -2243,7 +2323,8 @@ const char* icalproperty_get_xlicmimeencoding(const icalproperty* prop){ } icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); icalproperty_set_xlicmimefilename((icalproperty*)impl,v); va_start(args,v); @@ -2254,7 +2335,8 @@ icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...){ /* X-LIC-MIMEFILENAME */ icalproperty* icalproperty_new_xlicmimefilename(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); icalproperty_set_xlicmimefilename((icalproperty*)impl,v); return (icalproperty*)impl; @@ -2272,7 +2354,8 @@ const char* icalproperty_get_xlicmimefilename(const icalproperty* prop){ } icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...){ va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); icalproperty_set_xlicmimeoptinfo((icalproperty*)impl,v); va_start(args,v); @@ -2283,7 +2366,8 @@ icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...){ /* X-LIC-MIMEOPTINFO */ icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); + icalerror_check_arg_rz( (v!=0),"v"); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); icalproperty_set_xlicmimeoptinfo((icalproperty*)impl,v); return (icalproperty*)impl; diff --git a/src/libical/autogenex/icalderivedproperty.h b/src/libical/autogenex/icalderivedproperty.h index 4c7fc6f..f77d5b3 100644 --- a/src/libical/autogenex/icalderivedproperty.h +++ b/src/libical/autogenex/icalderivedproperty.h @@ -6,6 +6,18 @@ $Id: icalderivedproperty.h,v 1.5 2002-09-01 19:12:31 gray-john Exp $ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + 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: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + ======================================================================*/ diff --git a/src/libical/autogenex/icalderivedvalue.c b/src/libical/autogenex/icalderivedvalue.c index 006bd37..0fb68bd 100644 --- a/src/libical/autogenex/icalderivedvalue.c +++ b/src/libical/autogenex/icalderivedvalue.c @@ -197,8 +197,8 @@ enum icalproperty_method icalvalue_get_method(const icalvalue* value) { icalvalue* icalvalue_new_caladdress (const char* v){ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CALADDRESS_VALUE); icalerror_check_arg_rz( (v!=0),"v"); + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CALADDRESS_VALUE); icalvalue_set_caladdress((icalvalue*)impl,v); return (icalvalue*)impl; @@ -286,8 +286,8 @@ enum icalproperty_status icalvalue_get_status(const icalvalue* value) { icalvalue* icalvalue_new_binary (const char* v){ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BINARY_VALUE); icalerror_check_arg_rz( (v!=0),"v"); + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BINARY_VALUE); icalvalue_set_binary((icalvalue*)impl,v); return (icalvalue*)impl; @@ -321,8 +321,8 @@ const char* icalvalue_get_binary(const icalvalue* value) { icalvalue* icalvalue_new_text (const char* v){ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TEXT_VALUE); icalerror_check_arg_rz( (v!=0),"v"); + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TEXT_VALUE); icalvalue_set_text((icalvalue*)impl,v); return (icalvalue*)impl; @@ -410,8 +410,8 @@ int icalvalue_get_integer(const icalvalue* value) { icalvalue* icalvalue_new_uri (const char* v){ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_URI_VALUE); icalerror_check_arg_rz( (v!=0),"v"); + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_URI_VALUE); icalvalue_set_uri((icalvalue*)impl,v); return (icalvalue*)impl; @@ -499,8 +499,8 @@ float icalvalue_get_float(const icalvalue* value) { icalvalue* icalvalue_new_query (const char* v){ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_QUERY_VALUE); icalerror_check_arg_rz( (v!=0),"v"); + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_QUERY_VALUE); icalvalue_set_query((icalvalue*)impl,v); return (icalvalue*)impl; @@ -534,8 +534,8 @@ const char* icalvalue_get_query(const icalvalue* value) { icalvalue* icalvalue_new_string (const char* v){ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STRING_VALUE); icalerror_check_arg_rz( (v!=0),"v"); + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STRING_VALUE); icalvalue_set_string((icalvalue*)impl,v); return (icalvalue*)impl; @@ -768,8 +768,8 @@ icalvalue_kind icalvalue_string_to_kind(const char* str) } icalvalue* icalvalue_new_x (const char* v){ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE); icalerror_check_arg_rz( (v!=0),"v"); + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE); icalvalue_set_x((icalvalue*)impl,v); return (icalvalue*)impl; diff --git a/src/libical/autogenex/icalrestriction.c b/src/libical/autogenex/icalrestriction.c index 3d2bd15..2e9a0d1 100644 --- a/src/libical/autogenex/icalrestriction.c +++ b/src/libical/autogenex/icalrestriction.c @@ -1,7 +1,18 @@ /* -*- Mode: C -*- */ /* ====================================================================== File: icalrestriction.c - + + 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: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ /*#line 7 "icalrestriction.c.in"*/ @@ -20,8 +31,10 @@ #define TMP_BUF_SIZE 1024 #ifdef WIN32 -#define snprintf _snprintf -#define strcasecmp stricmp +#define snprintf _snprintf +#endif +#ifdef _MSC_VER +#define strcasecmp stricmp #endif diff --git a/src/libical/caldate.c b/src/libical/caldate.c index f5554f6..1ce9178 100644 --- a/src/libical/caldate.c +++ b/src/libical/caldate.c @@ -72,13 +72,13 @@ struct ut_instant * date; ka = (long) jd; if ( jd >= 2299161L ) { - ialp = ( (double) jd - 1867216.25 ) / ( 36524.25 ); + ialp = (long) (((double) jd) - 1867216.25 ) / 36524.25; ka = jd + 1L + ialp - ( ialp >> 2 ); } kb = ka + 1524L; - kc = ( (double) kb - 122.1 ) / 365.25; - kd = (double) kc * 365.25; - ke = (double) ( kb - kd ) / 30.6001; + kc = (long) ((double) kb - 122.1 ) / 365.25; + kd = (long) (double) kc * 365.25; + ke = (long) (double) ( kb - kd ) / 30.6001; date->day = kb - kd - ((long) ( (double) ke * 30.6001 )); if ( ke > 13L ) date->month = ke - 13L; @@ -93,9 +93,9 @@ struct ut_instant * date; else date->year = kc - 4715L; date->i_hour = date->d_hour = frac * 24.0; /* hour */ - date->i_minute = date->d_minute = + date->i_minute = date->d_minute = (long) ( date->d_hour - (double) date->i_hour ) * 60.0; /* minute */ - date->i_second = date->d_second = + date->i_second = date->d_second = (long) ( date->d_minute - (double) date->i_minute ) * 60.0;/* second */ date->weekday = (jd + 1L) % 7L; /* day of week */ if ( date->year == ((date->year >> 2) << 2) ) diff --git a/src/libical/ical_file.cmake b/src/libical/ical_file.cmake index 134b079..21da350 100644 --- a/src/libical/ical_file.cmake +++ b/src/libical/ical_file.cmake @@ -21,7 +21,7 @@ set(COMBINEDHEADERSICAL ${TOPS}/src/libical/icaltimezone.h ${TOPS}/src/libical/icalparser.h ${TOPS}/src/libical/icalmemory.h - ${TOPS}/src/libical/icalerror.h + ${TOPB}/src/libical/icalerror.h ${TOPS}/src/libical/icalrestriction.h ${TOPS}/src/libical/sspm.h ${TOPS}/src/libical/icalmime.h diff --git a/src/libical/icalarray.c b/src/libical/icalarray.c index d36a816..f382a2a 100644 --- a/src/libical/icalarray.c +++ b/src/libical/icalarray.c @@ -38,7 +38,6 @@ #include "icalarray.h" #include "icalerror.h" - static void icalarray_expand (icalarray *array, int space_needed); @@ -61,20 +60,65 @@ icalarray_new (int element_size, array->increment_size = increment_size; array->num_elements = 0; array->space_allocated = 0; - array->data = NULL; + array->chunks = NULL; + + return array; +} + +static void * +icalarray_alloc_chunk(icalarray *array) +{ + void *chunk = malloc(array->element_size * array->increment_size); + if (!chunk) + icalerror_set_errno(ICAL_NEWFAILED_ERROR); + return chunk; +} + +icalarray *icalarray_copy (icalarray *originalarray) +{ + icalarray *array = icalarray_new(originalarray->element_size, originalarray->increment_size); + int chunks = originalarray->space_allocated / originalarray->increment_size; + int chunk; + + if (!array) + return NULL; + + array->num_elements = originalarray->num_elements; + array->space_allocated = originalarray->space_allocated; + + array->chunks = malloc(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); + } + + } else { + icalerror_set_errno(ICAL_ALLOCATION_ERROR); + } return array; } + /** @brief Destructor */ void icalarray_free (icalarray *array) { - if (array->data) - free (array->data); + if (array->chunks) { + int chunks = array->space_allocated / array->increment_size; + int chunk; + for (chunk = 0; chunk < chunks; chunk++) + free(array->chunks[chunk]); + free (array->chunks); + array->chunks = 0; + } free (array); + array = 0; } @@ -82,12 +126,12 @@ void icalarray_append (icalarray *array, const void *element) { + int pos; if (array->num_elements >= array->space_allocated) icalarray_expand (array, 1); - memcpy ((char *)(array->data) + ( array->num_elements * array->element_size ), element, - array->element_size); - array->num_elements++; + pos = array->num_elements++; + memcpy (icalarray_element_at(array, pos), element, array->element_size); } @@ -95,10 +139,12 @@ void* icalarray_element_at (icalarray *array, int position) { + int chunk = position / array->increment_size; + int offset = position % array->increment_size; + assert (position >= 0); assert ((unsigned int)position < array->num_elements); - - return (char *)(array->data) + (position * array->element_size); + return (char *)(array->chunks[chunk]) + (offset * array->element_size); } @@ -112,12 +158,12 @@ icalarray_remove_element_at (icalarray *array, assert (position >= 0); assert ((unsigned int)position < array->num_elements); - dest = (char *)array->data + (position * array->element_size); - elements_to_move = array->num_elements - position - 1; - - if (elements_to_move > 0) - memmove (dest, (char *)dest + array->element_size, - elements_to_move * array->element_size); + while (position < array->num_elements - 1) { + memmove(icalarray_element_at(array, position), + icalarray_element_at(array, position + 1), + array->element_size); + position++; + } array->num_elements--; } @@ -128,7 +174,26 @@ icalarray_sort (icalarray *array, int (*compare) (const void *, const void *)) { - qsort (array->data, array->num_elements, array->element_size, compare); + if (array->num_elements == 0) { + return; + } + + if (array->num_elements <= array->increment_size) { + qsort(array->chunks[0], array->num_elements, array->element_size, compare); + } else { + int pos; + void *tmp = malloc (array->num_elements * array->element_size); + 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); + + qsort (tmp, array->num_elements, array->element_size, compare); + + 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); + } } @@ -136,28 +201,27 @@ static void icalarray_expand (icalarray *array, int space_needed) { - int new_space_allocated; - void *new_data; - - new_space_allocated = array->space_allocated + array->increment_size; - - if ((unsigned int)space_needed > array->increment_size) - new_space_allocated += space_needed; - - /* - new_data = realloc (array->data, - new_space_allocated * array->element_size); - */ - new_data = malloc(new_space_allocated * array->element_size); - - if (new_data) { - memcpy(new_data,array->data,array->element_size*array->space_allocated); - free(array->data); - array->data = new_data; - array->space_allocated = new_space_allocated; - } else { + int num_chunks = array->space_allocated / array->increment_size; + int num_new_chunks; + int c; + void **new_chunks; + + num_new_chunks = (space_needed + array->increment_size - 1) / array->increment_size; + if (!num_new_chunks) + num_new_chunks = 1; + + new_chunks = malloc ((num_chunks + num_new_chunks) * sizeof (void *)); + + if (new_chunks) { + memcpy(new_chunks, array->chunks, num_chunks * sizeof (void *)); + for (c = 0; c < num_new_chunks; c++) + new_chunks[c + num_chunks] = icalarray_alloc_chunk(array); + if (array->chunks) + free (array->chunks); + array->chunks = new_chunks; + array->space_allocated = array->space_allocated + num_new_chunks * array->increment_size; + } else icalerror_set_errno(ICAL_ALLOCATION_ERROR); - } } diff --git a/src/libical/icalarray.h b/src/libical/icalarray.h index ab92a9e..93620de 100644 --- a/src/libical/icalarray.h +++ b/src/libical/icalarray.h @@ -39,13 +39,14 @@ struct _icalarray { unsigned int increment_size; unsigned int num_elements; unsigned int space_allocated; - void *data; + void **chunks; }; icalarray *icalarray_new (int element_size, int increment_size); +icalarray *icalarray_copy (icalarray *array); void icalarray_free (icalarray *array); void icalarray_append (icalarray *array, diff --git a/src/libical/icalattach.c b/src/libical/icalattach.c index 14bdd46..6c6ff07 100644 --- a/src/libical/icalattach.c +++ b/src/libical/icalattach.c @@ -63,7 +63,7 @@ icalattach_new_from_url (const char *url) } icalattach * -icalattach_new_from_data (unsigned char *data, icalattach_free_fn_t free_fn, +icalattach_new_from_data (const char *data, icalattach_free_fn_t free_fn, void *free_fn_data) { icalattach *attach; diff --git a/src/libical/icalattach.h b/src/libical/icalattach.h index 4189d4b..5a82ab8 100644 --- a/src/libical/icalattach.h +++ b/src/libical/icalattach.h @@ -30,7 +30,7 @@ typedef struct icalattach_impl icalattach; typedef void (* icalattach_free_fn_t) (unsigned char *data, void *user_data); icalattach *icalattach_new_from_url (const char *url); -icalattach *icalattach_new_from_data (unsigned char *data, +icalattach *icalattach_new_from_data (const char *data, icalattach_free_fn_t free_fn, void *free_fn_data); void icalattach_ref (icalattach *attach); diff --git a/src/libical/icalattachimpl.h b/src/libical/icalattachimpl.h index 86d0f6e..952b849 100644 --- a/src/libical/icalattachimpl.h +++ b/src/libical/icalattachimpl.h @@ -46,7 +46,7 @@ struct icalattach_impl { /* Inline data */ struct { - unsigned char *data; + char *data; icalattach_free_fn_t free_fn; void *free_fn_data; } data; diff --git a/src/libical/icalcomponent.c b/src/libical/icalcomponent.c index 4b01c7e..ed08546 100644 --- a/src/libical/icalcomponent.c +++ b/src/libical/icalcomponent.c @@ -47,6 +47,11 @@ #include <string.h> /* for strdup */ #include <limits.h> /* for INT_MAX */ +#ifdef _MSC_VER +#define snprintf _snprintf +#define strncasecmp strnicmp +#endif + struct icalcomponent_impl { char id[5]; @@ -81,7 +86,7 @@ static void icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp, icalproperty *tzid_prop, const char *tzid, icalarray *tzids_to_rename); -static unsigned int icalcomponent_get_tzid_prefix_len (const char *tzid); +static size_t icalcomponent_get_tzid_prefix_len (const char *tzid); static void icalcomponent_rename_tzids(icalcomponent* comp, icalarray* rename_table); static void icalcomponent_rename_tzids_callback(icalparameter *param, @@ -90,6 +95,8 @@ static int icalcomponent_compare_vtimezones (icalcomponent *vtimezone1, icalcomponent *vtimezone2); static int icalcomponent_compare_timezone_fn (const void *elem1, const void *elem2); +static struct icaltimetype +icalcomponent_get_datetime(icalcomponent *comp, icalproperty *prop); void icalcomponent_add_children(icalcomponent *impl, va_list args) @@ -245,24 +252,22 @@ icalcomponent_free (icalcomponent* c) if(c != 0 ){ - if ( c->properties != 0 ) - { - while( (prop=pvl_pop(c->properties)) != 0){ - assert(prop != 0); - icalproperty_set_parent(prop,0); - icalproperty_free(prop); - } - pvl_free(c->properties); - } + if ( c->properties != 0 ) + { + while( (prop=pvl_pop(c->properties)) != 0){ + icalproperty_set_parent(prop,0); + icalproperty_free(prop); + } + pvl_free(c->properties); + } - while( (comp=pvl_data(pvl_head(c->components))) != 0){ - assert(comp!=0); - icalcomponent_remove_component(c,comp); - icalcomponent_free(comp); - } + while( (comp=pvl_data(pvl_head(c->components))) != 0){ + icalcomponent_remove_component(c,comp); + icalcomponent_free(comp); + } - pvl_free(c->components); + pvl_free(c->components); if (c->x_name != 0) { free(c->x_name); @@ -312,9 +317,6 @@ icalcomponent_as_ical_string_r (icalcomponent* impl) const char* kind_string; - buf = icalmemory_new_buffer(buf_size); - buf_ptr = buf; - icalerror_check_arg_rz( (impl!=0), "component"); icalerror_check_arg_rz( (kind!=ICAL_NO_COMPONENT), "component kind is ICAL_NO_COMPONENT"); @@ -326,6 +328,9 @@ icalcomponent_as_ical_string_r (icalcomponent* impl) icalerror_check_arg_rz( (kind_string!=0),"Unknown kind of component"); + buf = icalmemory_new_buffer(buf_size); + buf_ptr = buf; + icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:"); icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string); icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); @@ -390,7 +395,6 @@ icalcomponent_isa (const icalcomponent* component) { return component->kind; } - return ICAL_NO_COMPONENT; } @@ -432,8 +436,13 @@ icalcomponent_remove_property (icalcomponent* component, icalproperty* property) icalerror_check_arg_rv( (component!=0), "component"); icalerror_check_arg_rv( (property!=0), "property"); +#ifdef ICAL_REMOVE_NONMEMBER_COMPONENT_IS_ERROR icalerror_assert( (icalproperty_get_parent(property)),"The property is not a member of a component"); - +#else + if(icalproperty_get_parent(property) == 0){ + return; + } +#endif for( itr = pvl_head(component->properties); itr != 0; @@ -481,7 +490,7 @@ icalproperty* icalcomponent_get_current_property (icalcomponent* component) { icalerror_check_arg_rz( (component!=0),"component"); - if ((component->property_iterator==0)){ + if (component->property_iterator==0){ return 0; } @@ -847,23 +856,27 @@ int icalproperty_recurrence_is_excluded(icalcomponent *comp, struct icaltimetype *dtstart, struct icaltimetype *recurtime) { icalproperty *exdate, *exrule; - pvl_elem property_iterator = comp->property_iterator; + pvl_elem property_iterator; if (comp == NULL || dtstart == NULL || recurtime == NULL || icaltime_is_null_time(*recurtime)) /* BAD DATA */ - return 1; + return 1; + + property_iterator = comp->property_iterator; /** first test against the exdate values **/ for (exdate = icalcomponent_get_first_property(comp,ICAL_EXDATE_PROPERTY); exdate != NULL; exdate = icalcomponent_get_next_property(comp,ICAL_EXDATE_PROPERTY)) { - struct icaltimetype exdatetime = icalproperty_get_exdate(exdate); + struct icaltimetype exdatetime = icalcomponent_get_datetime(comp, exdate); - if (icaltime_compare(*recurtime, exdatetime) == 0) { + if ((icaltime_is_date(exdatetime) + && icaltime_compare_date_only(*recurtime, exdatetime) == 0) || + (icaltime_compare(*recurtime, exdatetime) == 0)) { /** MATCHED **/ comp->property_iterator = property_iterator; @@ -880,7 +893,7 @@ int icalproperty_recurrence_is_excluded(icalcomponent *comp, icalrecur_iterator *exrule_itr = icalrecur_iterator_new(recur, *dtstart); struct icaltimetype exrule_time; - while (1) { + while (exrule_itr) { int result; exrule_time = icalrecur_iterator_next(exrule_itr); @@ -988,7 +1001,7 @@ void icalcomponent_foreach_recurrence(icalcomponent* comp, struct icaltimetype dtstart, dtend; icaltime_span recurspan, basespan, limit_span; time_t limit_start, limit_end; - int dtduration; + time_t dtduration; icalproperty *rrule, *rdate; struct icaldurationtype dur; pvl_elem property_iterator; /* for saving the iterator */ @@ -1042,16 +1055,22 @@ void icalcomponent_foreach_recurrence(icalcomponent* comp, struct icalrecurrencetype recur = icalproperty_get_rrule(rrule); icalrecur_iterator *rrule_itr = icalrecur_iterator_new(recur, dtstart); - struct icaltimetype rrule_time = icalrecur_iterator_next(rrule_itr); + struct icaltimetype rrule_time; + if(rrule_itr) + rrule_time = icalrecur_iterator_next(rrule_itr); /** note that icalrecur_iterator_next always returns dtstart the first time.. **/ - while (1) { + while (rrule_itr) { rrule_time = icalrecur_iterator_next(rrule_itr); if (icaltime_is_null_time(rrule_time)) break; + /* if we have iterated past end time, then no need to check any further */ + if (icaltime_compare(rrule_time, end) > 0) + break; + dur = icaltime_subtract(rrule_time, dtstart); recurspan.start = basespan.start + icaldurationtype_as_int(dur); @@ -1097,6 +1116,7 @@ void icalcomponent_foreach_recurrence(icalcomponent* comp, if (!icalproperty_recurrence_is_excluded(comp, &dtstart, &rdate_period.time)) { /** call callback action **/ + if (icaltime_span_overlaps(&recurspan, &limit_span)) (*callback) (comp, &recurspan, callback_data); } comp->property_iterator = property_iterator; @@ -1166,6 +1186,8 @@ void icalcomponent_strip_errors(icalcomponent* component) if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY) { icalcomponent_remove_property(component,p); + icalproperty_free(p); + p = NULL; } } @@ -1233,6 +1255,8 @@ void icalcomponent_convert_errors(icalcomponent* component) icalproperty_new_requeststatus(rst)); icalcomponent_remove_property(component,p); + icalproperty_free(p); + p = NULL; } } } @@ -1611,17 +1635,20 @@ struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp) struct icaltimetype ret = icaltime_null_time(); if ( end_prop != 0) { - ret = icalcomponent_get_datetime(comp, end_prop); - } else if ( dur_prop != 0) { - - struct icaltimetype start = - icalcomponent_get_dtstart(inner); - struct icaldurationtype duration = - icalproperty_get_duration(dur_prop); + ret = icalcomponent_get_datetime(comp, end_prop); + } else if ( dur_prop != 0) { - struct icaltimetype end = icaltime_add(start,duration); + struct icaltimetype start = icalcomponent_get_dtstart(inner); + struct icaldurationtype duration; + + //extra check to prevent empty durations from crashing + if (icalproperty_get_value(dur_prop)) { + duration = icalproperty_get_duration(dur_prop); + } else { + duration = icaldurationtype_null_duration(); + } - ret = end; + ret = icaltime_add(start,duration); } return ret; @@ -2027,51 +2054,51 @@ enum icalproperty_status icalcomponent_get_status(icalcomponent* comp){ return icalproperty_get_status(prop); } -icalcomponent* icalcomponent_new_vcalendar() +icalcomponent* icalcomponent_new_vcalendar(void) { return icalcomponent_new(ICAL_VCALENDAR_COMPONENT); } -icalcomponent* icalcomponent_new_vevent() +icalcomponent* icalcomponent_new_vevent(void) { return icalcomponent_new(ICAL_VEVENT_COMPONENT); } -icalcomponent* icalcomponent_new_vtodo() +icalcomponent* icalcomponent_new_vtodo(void) { return icalcomponent_new(ICAL_VTODO_COMPONENT); } -icalcomponent* icalcomponent_new_vjournal() +icalcomponent* icalcomponent_new_vjournal(void) { return icalcomponent_new(ICAL_VJOURNAL_COMPONENT); } -icalcomponent* icalcomponent_new_valarm() +icalcomponent* icalcomponent_new_valarm(void) { return icalcomponent_new(ICAL_VALARM_COMPONENT); } -icalcomponent* icalcomponent_new_vfreebusy() +icalcomponent* icalcomponent_new_vfreebusy(void) { return icalcomponent_new(ICAL_VFREEBUSY_COMPONENT); } -icalcomponent* icalcomponent_new_vtimezone() +icalcomponent* icalcomponent_new_vtimezone(void) { return icalcomponent_new(ICAL_VTIMEZONE_COMPONENT); } -icalcomponent* icalcomponent_new_xstandard() +icalcomponent* icalcomponent_new_xstandard(void) { return icalcomponent_new(ICAL_XSTANDARD_COMPONENT); } -icalcomponent* icalcomponent_new_xdaylight() +icalcomponent* icalcomponent_new_xdaylight(void) { return icalcomponent_new(ICAL_XDAYLIGHT_COMPONENT); } -icalcomponent* icalcomponent_new_vagenda() +icalcomponent* icalcomponent_new_vagenda(void) { return icalcomponent_new(ICAL_VAGENDA_COMPONENT); } -icalcomponent* icalcomponent_new_vquery() +icalcomponent* icalcomponent_new_vquery(void) { return icalcomponent_new(ICAL_VQUERY_COMPONENT); } -icalcomponent* icalcomponent_new_vreply() +icalcomponent* icalcomponent_new_vreply(void) { return icalcomponent_new(ICAL_VREPLY_COMPONENT); } @@ -2122,9 +2149,8 @@ void icalcomponent_merge_component(icalcomponent* comp, for (i = 0; i < tzids_to_rename->num_elements; i++) { free (icalarray_element_at (tzids_to_rename, i)); } - icalarray_free (tzids_to_rename); } - + icalarray_free (tzids_to_rename); /* Now move all the components from comp_to_merge to comp, excluding VTIMEZONE components. */ subcomp = icalcomponent_get_first_component (comp_to_merge, @@ -2209,7 +2235,7 @@ icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp, icalarray *tzids_to_rename) { int i, suffix, max_suffix = 0, num_elements; - unsigned int tzid_len; + size_t tzid_len; char *tzid_copy, *new_tzid, suffix_buf[32]; (void)tzid_prop; /* hack to stop unused variable warning */ @@ -2228,7 +2254,7 @@ icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp, icaltimezone *zone; const char *existing_tzid; const char *existing_tzid_copy; - unsigned int existing_tzid_len; + size_t existing_tzid_len; zone = icalarray_element_at (comp->timezones, i); existing_tzid = icaltimezone_get_tzid (zone); @@ -2245,11 +2271,17 @@ icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp, /* The VTIMEZONEs match, so we can use the existing VTIMEZONE. But we have to rename TZIDs to this TZID. */ tzid_copy = strdup (tzid); + if(!tzid_copy) { + icalerror_set_errno(ICAL_NEWFAILED_ERROR); + return; + } existing_tzid_copy = strdup (existing_tzid); - if (!tzid_copy || !existing_tzid_copy) { + if (!existing_tzid_copy) { icalerror_set_errno(ICAL_NEWFAILED_ERROR); + free(tzid_copy); } else { icalarray_append (tzids_to_rename, tzid_copy); + free(tzid_copy); icalarray_append (tzids_to_rename, existing_tzid_copy); } return; @@ -2268,10 +2300,16 @@ 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); + 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); - if (!new_tzid || !tzid_copy) { + if (!new_tzid) { icalerror_set_errno(ICAL_NEWFAILED_ERROR); + free(tzid_copy); return; } @@ -2279,13 +2317,15 @@ 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); } /* Returns the length of the TZID, without any trailing digits. */ -static unsigned int icalcomponent_get_tzid_prefix_len (const char *tzid) +static size_t icalcomponent_get_tzid_prefix_len (const char *tzid) { - int len; + size_t len; const char *p; len = strlen (tzid); @@ -2400,13 +2440,15 @@ icaltimezone* icalcomponent_get_timezone(icalcomponent* comp, const char *tzid) middle = (lower + upper) >> 1; zone = icalarray_element_at (comp->timezones, middle); zone_tzid = icaltimezone_get_tzid (zone); - cmp = strcmp (tzid, zone_tzid); - if (cmp == 0) - return zone; - else if (cmp < 0) - upper = middle; - else - lower = middle + 1; + if (zone_tzid != NULL) { + cmp = strcmp (tzid, zone_tzid); + if (cmp == 0) + return zone; + else if (cmp < 0) + upper = middle; + else + lower = middle + 1; + } } return NULL; @@ -2569,9 +2611,7 @@ struct icaltimetype icalcomponent_get_due(icalcomponent* comp) icalproperty *dur_prop = icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY); - if( due_prop == 0 && dur_prop == 0){ - return icaltime_null_time(); - } else if ( due_prop != 0) { + if ( due_prop != 0) { return icalproperty_get_due(due_prop); } else if ( dur_prop != 0) { @@ -2584,13 +2624,8 @@ struct icaltimetype icalcomponent_get_due(icalcomponent* comp) return due; - } else { - /* Error, both duration and due have been specified */ - icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); - return icaltime_null_time(); - } - + return icaltime_null_time(); } /** @brief Set the due date of a VTODO task. @@ -2632,8 +2667,5 @@ void icalcomponent_set_due(icalcomponent* comp, struct icaltimetype v) icalproperty_set_duration(dur_prop,dur); - } else { - /* Error, both duration and due have been specified */ - icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); } } diff --git a/src/libical/icalcomponent.h b/src/libical/icalcomponent.h index d963249..338dac1 100644 --- a/src/libical/icalcomponent.h +++ b/src/libical/icalcomponent.h @@ -270,16 +270,16 @@ void icalcomponent_foreach_recurrence(icalcomponent* comp, /*************** Type Specific routines ***************/ -icalcomponent* icalcomponent_new_vcalendar(); -icalcomponent* icalcomponent_new_vevent(); -icalcomponent* icalcomponent_new_vtodo(); -icalcomponent* icalcomponent_new_vjournal(); -icalcomponent* icalcomponent_new_valarm(); -icalcomponent* icalcomponent_new_vfreebusy(); -icalcomponent* icalcomponent_new_vtimezone(); -icalcomponent* icalcomponent_new_xstandard(); -icalcomponent* icalcomponent_new_xdaylight(); -icalcomponent* icalcomponent_new_vagenda(); -icalcomponent* icalcomponent_new_vquery(); +icalcomponent* icalcomponent_new_vcalendar(void); +icalcomponent* icalcomponent_new_vevent(void); +icalcomponent* icalcomponent_new_vtodo(void); +icalcomponent* icalcomponent_new_vjournal(void); +icalcomponent* icalcomponent_new_valarm(void); +icalcomponent* icalcomponent_new_vfreebusy(void); +icalcomponent* icalcomponent_new_vtimezone(void); +icalcomponent* icalcomponent_new_xstandard(void); +icalcomponent* icalcomponent_new_xdaylight(void); +icalcomponent* icalcomponent_new_vagenda(void); +icalcomponent* icalcomponent_new_vquery(void); #endif /* !ICALCOMPONENT_H */ diff --git a/src/libical/icalderivedparameter.c.in b/src/libical/icalderivedparameter.c.in index 918efa1..2a66539 100644 --- a/src/libical/icalderivedparameter.c.in +++ b/src/libical/icalderivedparameter.c.in @@ -38,13 +38,14 @@ #include "icalproperty.h" #include "icalerror.h" #include "icalmemory.h" +#include "icaltypes.h" #include <stdlib.h> /* for malloc() */ #include <errno.h> #include <string.h> /* for memset() */ -#ifdef WIN32 -#define strcasecmp stricmp +#ifdef _MSC_VER +#define strcasecmp stricmp #endif icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value); @@ -98,21 +99,25 @@ icalparameter_kind icalparameter_string_to_kind(const char* string) int i; if (string ==0 ) { - return ICAL_NO_PARAMETER; + return ICAL_NO_PARAMETER; } for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) { - if (strcasecmp(parameter_map[i].name, string) == 0) { - return parameter_map[i].kind; - } + if (strcasecmp(parameter_map[i].name, string) == 0) { + return parameter_map[i].kind; + } } if(strncmp(string,"X-",2)==0){ - return ICAL_X_PARAMETER; + return ICAL_X_PARAMETER; } - return ICAL_NO_PARAMETER; + if (ical_get_unknown_token_handling_setting() == ICAL_TREAT_AS_ERROR) { + return ICAL_NO_PARAMETER; + } else { + return ICAL_IANA_PARAMETER; + } } diff --git a/src/libical/icalderivedproperty.c.in b/src/libical/icalderivedproperty.c.in index b4f29f1..f74c6f0 100644 --- a/src/libical/icalderivedproperty.c.in +++ b/src/libical/icalderivedproperty.c.in @@ -43,9 +43,9 @@ #include <errno.h> #include <stdio.h> /* for printf */ #include <stdarg.h> /* for va_list, va_start, etc. */ - -#ifdef WIN32 -#define strcasecmp stricmp + +#ifdef _MSC_VER +#define strcasecmp stricmp #endif struct icalproperty_impl* @@ -192,7 +192,8 @@ int icalproperty_kind_and_string_to_enum(const int kind, const char* str) return 0; for (; i != ICALPROPERTY_LAST_ENUM; i++) { - if ( strcasecmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) { + if(enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == pkind && + strcasecmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) { return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum; } } diff --git a/src/libical/icalderivedproperty.h.in b/src/libical/icalderivedproperty.h.in index 99f1b70..44f6f31 100644 --- a/src/libical/icalderivedproperty.h.in +++ b/src/libical/icalderivedproperty.h.in @@ -4,7 +4,18 @@ CREATOR: eric 09 May 1999 $Id: icalderivedproperty.h.in,v 1.7 2007-04-30 13:57:48 artcancro Exp $ - + + 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: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ diff --git a/src/libical/icalderivedvalue.c.in b/src/libical/icalderivedvalue.c.in index 3074432..c0515ad 100644 --- a/src/libical/icalderivedvalue.c.in +++ b/src/libical/icalderivedvalue.c.in @@ -47,8 +47,8 @@ #include <stdlib.h> /* for atoi and atof */ #include <limits.h> /* for SHRT_MAX */ -#ifdef WIN32 -#define strcasecmp stricmp +#ifdef _MSC_VER +#define strcasecmp stricmp #endif struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind); @@ -102,9 +102,11 @@ icalvalue_kind icalvalue_string_to_kind(const char* str) } icalvalue* icalvalue_new_x (const char* v){ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE); + struct icalvalue_impl* impl; icalerror_check_arg_rz( (v!=0),"v"); + impl = icalvalue_new_impl(ICAL_X_VALUE); + icalvalue_set_x((icalvalue*)impl,v); return (icalvalue*)impl; } @@ -123,7 +125,7 @@ void icalvalue_set_x(icalvalue* impl, const char* v) { } const char* icalvalue_get_x(const icalvalue* value) { - icalerror_check_arg( (value!=0),"value"); + icalerror_check_arg_rz( (value!=0),"value"); icalerror_check_value_type(value, ICAL_X_VALUE); return value->x_value; } @@ -164,7 +166,10 @@ icalvalue_set_recur(icalvalue* impl, struct icalrecurrencetype v) struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value) { - icalerror_check_arg( (value!=0),"value"); + struct icalrecurrencetype rt; + icalrecurrencetype_clear(&rt); + + icalerror_check_arg_rx( (value!=0),"value", rt); icalerror_check_value_type(value, ICAL_RECUR_VALUE); return *(value->data.v_recur); @@ -202,24 +207,64 @@ icalvalue_get_trigger(const icalvalue* impl) { struct icaltriggertype tr; - icalerror_check_arg( (impl!=0),"value"); - icalerror_check_arg( (impl!=0),"value"); + tr.duration = icaldurationtype_from_int(0); + tr.time = icaltime_null_time(); - if(impl->kind == ICAL_DATETIME_VALUE){ - tr.duration = icaldurationtype_from_int(0); - tr.time = impl->data.v_time; - } else if(impl->kind == ICAL_DURATION_VALUE){ + icalerror_check_arg_rx( (impl!=0),"value", tr); + + if(impl) { + if(impl->kind == ICAL_DATETIME_VALUE){ + tr.duration = icaldurationtype_from_int(0); + tr.time = impl->data.v_time; + } else if(impl->kind == ICAL_DURATION_VALUE){ tr.time = icaltime_null_time(); tr.duration = impl->data.v_duration; - } else { + } else { tr.duration = icaldurationtype_from_int(0); tr.time = icaltime_null_time(); icalerror_set_errno(ICAL_BADARG_ERROR); + } + } else { + tr.duration = icaldurationtype_from_int(0); + tr.time = icaltime_null_time(); + icalerror_set_errno(ICAL_BADARG_ERROR); } - + return tr; } +icalvalue* +icalvalue_new_datetime (struct icaltimetype v){ + + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIME_VALUE); + icalvalue_set_datetime((icalvalue*)impl,v); + return (icalvalue*)impl; +} + +void +icalvalue_set_datetime(icalvalue* value, struct icaltimetype v) { + struct icalvalue_impl* impl; + icalerror_check_arg_rv( (value!=0),"value"); + + icalerror_check_value_type(value, ICAL_DATETIME_VALUE); + impl = (struct icalvalue_impl*)value; + + + impl->data.v_time = v; + + icalvalue_reset_kind(impl); +} + +struct icaltimetype +icalvalue_get_datetime (const icalvalue* value) { + struct icaltimetype dt; + dt = icaltime_null_time(); + + icalerror_check_arg_rx((value!=0),"value", dt); + icalerror_check_value_type (value, ICAL_DATETIME_VALUE); + return ((struct icalvalue_impl*)value)->data.v_time; +} + /* DATE-TIME-PERIOD is a special case, and is not auto generated */ icalvalue* @@ -262,25 +307,98 @@ struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* impl) { struct icaldatetimeperiodtype dtp; - - icalerror_check_arg( (impl!=0),"value"); + + dtp.period = icalperiodtype_null_period(); + dtp.time = icaltime_null_time(); + + icalerror_check_arg_rx( (impl!=0),"value", dtp); icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE); - - if( impl->kind == ICAL_DATETIME_VALUE || impl->kind == ICAL_DATE_VALUE ){ + + if(impl) { + if( impl->kind == ICAL_DATETIME_VALUE || impl->kind == ICAL_DATE_VALUE ){ dtp.period = icalperiodtype_null_period(); dtp.time = impl->data.v_time; - } else if(impl->kind == ICAL_PERIOD_VALUE) { + } else if(impl->kind == ICAL_PERIOD_VALUE) { dtp.period = impl->data.v_period; dtp.time = icaltime_null_time(); - } else { + } else { dtp.period = icalperiodtype_null_period(); dtp.time = icaltime_null_time(); icalerror_set_errno(ICAL_BADARG_ERROR); + } + } else { + dtp.period = icalperiodtype_null_period(); + dtp.time = icaltime_null_time(); + icalerror_set_errno(ICAL_BADARG_ERROR); } return dtp; } +icalvalue* +icalvalue_new_class (enum icalproperty_class v){ + + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CLASS_VALUE); + icalvalue_set_class((icalvalue*)impl,v); + return (icalvalue*)impl; +} + +void +icalvalue_set_class(icalvalue* value, enum icalproperty_class v) { + struct icalvalue_impl* impl; + icalerror_check_arg_rv( (value!=0),"value"); + + icalerror_check_value_type(value, ICAL_CLASS_VALUE); + impl = (struct icalvalue_impl*)value; + + impl->data.v_enum = v; + + icalvalue_reset_kind(impl); +} + +enum icalproperty_class +icalvalue_get_class (const icalvalue* value) { + + icalproperty_class pr; + pr = ICAL_CLASS_NONE; + + icalerror_check_arg_rx ((value!=NULL),"value", pr); + icalerror_check_arg ((value!=0),"value"); + icalerror_check_value_type (value, ICAL_CLASS_VALUE); + return ((struct icalvalue_impl*)value)->data.v_enum; +} + +icalvalue* +icalvalue_new_geo (struct icalgeotype v){ + + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_GEO_VALUE); + icalvalue_set_geo((icalvalue*)impl,v); + return (icalvalue*)impl; +} + +void +icalvalue_set_geo(icalvalue* value, struct icalgeotype v) { + struct icalvalue_impl* impl; + icalerror_check_arg_rv( (value!=0),"value"); + + icalerror_check_value_type(value, ICAL_GEO_VALUE); + impl = (struct icalvalue_impl*)value; + + impl->data.v_geo = v; + + icalvalue_reset_kind(impl); +} + +struct icalgeotype +icalvalue_get_geo (const icalvalue* value) { + struct icalgeotype gt; + gt.lat = 255.0; + gt.lon = 255.0; + + icalerror_check_arg_rx((value!=0),"value", gt); + icalerror_check_value_type (value, ICAL_GEO_VALUE); + return ((struct icalvalue_impl*)value)->data.v_geo; +} icalvalue * diff --git a/src/libical/icalderivedvalue.h.in b/src/libical/icalderivedvalue.h.in index 35c542e..5c6e2b5 100644 --- a/src/libical/icalderivedvalue.h.in +++ b/src/libical/icalderivedvalue.h.in @@ -38,8 +38,6 @@ typedef struct icalvalue_impl icalvalue; - - void icalvalue_set_x(icalvalue* value, const char* v); icalvalue* icalvalue_new_x(const char* v); const char* icalvalue_get_x(const icalvalue* value); @@ -52,10 +50,19 @@ icalvalue* icalvalue_new_trigger (struct icaltriggertype v); void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); struct icaltriggertype icalvalue_get_trigger(const icalvalue* value); +icalvalue* icalvalue_new_datetime(struct icaltimetype v); +struct icaltimetype icalvalue_get_datetime(const icalvalue* value); +void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v); + icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v); struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value); +/* GEO */ +icalvalue* icalvalue_new_geo(struct icalgeotype v); +struct icalgeotype icalvalue_get_geo(const icalvalue* value); +void icalvalue_set_geo(icalvalue* value, struct icalgeotype v); + icalvalue *icalvalue_new_attach (icalattach *attach); void icalvalue_set_attach (icalvalue *value, icalattach *attach); icalattach *icalvalue_get_attach (const icalvalue *value); @@ -63,3 +70,8 @@ icalattach *icalvalue_get_attach (const icalvalue *value); void icalvalue_reset_kind(icalvalue* value); <insert_code_here> + + +icalvalue* icalvalue_new_class(enum icalproperty_class v); +enum icalproperty_class icalvalue_get_class(const icalvalue* value); +void icalvalue_set_class(icalvalue* value, enum icalproperty_class v); diff --git a/src/libical/icalduration.c b/src/libical/icalduration.c index 8f20858..df11d18 100644 --- a/src/libical/icalduration.c +++ b/src/libical/icalduration.c @@ -40,8 +40,9 @@ #include "icalmemory.h" #include "icalvalue.h" - - +#if defined(_MSC_VER) +#define snprintf _snprintf +#endif /* From Seth Alves, <alves@hungry.com> */ struct icaldurationtype icaldurationtype_from_int(int t) @@ -79,10 +80,9 @@ struct icaldurationtype icaldurationtype_from_string(const char* str) int begin_flag = 0; int time_flag = 0; int date_flag = 0; - int week_flag = 0; int digits=-1; int scan_size = -1; - int size = strlen(str); + size_t size = strlen(str); char p; struct icaldurationtype d; @@ -137,19 +137,19 @@ struct icaldurationtype icaldurationtype_from_string(const char* str) } case 'H': { - if (time_flag == 0||week_flag == 1||d.hours !=0||digits ==-1) + if (time_flag == 0||d.hours !=0||digits ==-1) goto error; d.hours = digits; digits = -1; break; } case 'M': { - if (time_flag == 0||week_flag==1||d.minutes != 0||digits ==-1) + if (time_flag == 0||d.minutes != 0||digits ==-1) goto error; d.minutes = digits; digits = -1; break; } case 'S': { - if (time_flag == 0||week_flag==1||d.seconds!=0||digits ==-1) + if (time_flag == 0||d.seconds!=0||digits ==-1) goto error; d.seconds = digits; digits = -1; break; @@ -157,12 +157,11 @@ struct icaldurationtype icaldurationtype_from_string(const char* str) case 'W': { if (time_flag==1||date_flag==1||d.weeks!=0||digits ==-1) goto error; - week_flag = 1; d.weeks = digits; digits = -1; break; } case 'D': { - if (time_flag==1||week_flag==1||d.days!=0||digits ==-1) + if (time_flag==1||d.days!=0||digits ==-1) goto error; date_flag = 1; d.days = digits; digits = -1; diff --git a/src/libical/icalenums.c b/src/libical/icalenums.c index b27480e..80720b6 100644 --- a/src/libical/icalenums.c +++ b/src/libical/icalenums.c @@ -37,6 +37,10 @@ #include <assert.h> #include "icalmemory.h" +#if defined(_MSC_VER) +#define snprintf _snprintf +#endif + /*** @brief Allowed request status values */ static const struct { diff --git a/src/libical/icalerror.c b/src/libical/icalerror.c index 4cff753..f269718 100644 --- a/src/libical/icalerror.c +++ b/src/libical/icalerror.c @@ -189,7 +189,7 @@ icalerrorstate icalerror_supress(const char* error){ return es; } -const char* icalerror_perror() +const char* icalerror_perror(void) { return icalerror_strerror(icalerrno); } diff --git a/src/libical/icalerror.h b/src/libical/icalerror.h.cmake index 3d660c3..88021f5 100644 --- a/src/libical/icalerror.h +++ b/src/libical/icalerror.h.cmake @@ -64,12 +64,26 @@ typedef enum icalerrorenum { icalerrorenum * icalerrno_return(void); #define icalerrno (*(icalerrno_return())) +#cmakedefine LIBICAL_STATIC 1 + /** If true, libicl aborts after a call to icalerror_set_error * * @warning NOT THREAD SAFE -- recommended that you do not change * this in a multithreaded program. */ -extern int icalerror_errors_are_fatal; +#ifdef _MSC_VER + #if defined(LIBICAL_STATIC) + #define LIBICAL_EXPORT extern + #elif defined(BUILD_LIBICALDLL) + #define LIBICAL_EXPORT __declspec(dllexport) + #else + #define LIBICAL_EXPORT __declspec(dllimport) + #endif +#else + #define LIBICAL_EXPORT extern +#endif + +LIBICAL_EXPORT int icalerror_errors_are_fatal; /* Warning messages */ @@ -92,7 +106,7 @@ typedef enum icalerrorstate { } icalerrorstate ; const char* icalerror_strerror(icalerrorenum e); -const char* icalerror_perror(); +const char* icalerror_perror(void); void ical_bt(void); void icalerror_set_error_state( icalerrorenum error, icalerrorstate); icalerrorstate icalerror_get_error_state( icalerrorenum error); @@ -111,7 +125,11 @@ if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \ void icalerror_set_errno(icalerrorenum x); #endif -#ifdef ICAL_ERRORS_ARE_FATAL +#if !defined(ICAL_ERRORS_ARE_FATAL) +#define ICAL_ERRORS_ARE_FATAL 0 +#endif + +#if ICAL_ERRORS_ARE_FATAL == 1 #undef NDEBUG #endif @@ -121,7 +139,7 @@ void icalerror_set_errno(icalerrorenum x); #define icalerror_check_component_type(value,type); /* Assert with a message */ -#ifdef ICAL_ERRORS_ARE_FATAL +#if ICAL_ERRORS_ARE_FATAL == 1 #ifdef __GNUC__ #define icalerror_assert(test,message) if(!(test)){fprintf(stderr,"%s(), %s:%d: %s\n",__FUNCTION__,__FILE__,__LINE__,message);icalerror_stop_here(); abort();} diff --git a/src/libical/icalerror.h.in b/src/libical/icalerror.h.in new file mode 100644 index 0000000..3eeb6c3 --- /dev/null +++ b/src/libical/icalerror.h.in @@ -0,0 +1,181 @@ +/* -*- Mode: C -*- */ +/*====================================================================== + FILE: icalerror.h + CREATOR: eric 09 May 1999 + + $Id: icalerror.h,v 1.17 2008-01-15 23:17:40 dothebart Exp $ + + + (C) COPYRIGHT 2000, Eric Busboom <eric@softwarestudio.org> + http://www.softwarestudio.org + + 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: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + + The original code is icalerror.h + +======================================================================*/ + + +#ifndef ICALERROR_H +#define ICALERROR_H + +#include <assert.h> +#include <stdio.h> /* For icalerror_warn() */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define ICAL_SETERROR_ISFUNC + + +/** This routine is called before any error is triggered. It is called + by icalerror_set_errno, so it does not appear in all of the macros + below */ +void icalerror_stop_here(void); + +void icalerror_crash_here(void); + +typedef enum icalerrorenum { + ICAL_NO_ERROR, /* icalerrno may not be initialized - put it first so and pray that the compiler initialize things to zero */ + ICAL_BADARG_ERROR, + ICAL_NEWFAILED_ERROR, + ICAL_ALLOCATION_ERROR, + ICAL_MALFORMEDDATA_ERROR, + ICAL_PARSE_ERROR, + ICAL_INTERNAL_ERROR, /* Like assert --internal consist. prob */ + ICAL_FILE_ERROR, + ICAL_USAGE_ERROR, + ICAL_UNIMPLEMENTED_ERROR, + ICAL_UNKNOWN_ERROR /* Used for problems in input to icalerror_strerror()*/ + +} icalerrorenum; + +icalerrorenum * icalerrno_return(void); +#define icalerrno (*(icalerrno_return())) + +/*#cmakedefine LIBICAL_STATIC 1*/ + +/** If true, libicl aborts after a call to icalerror_set_error + * + * @warning NOT THREAD SAFE -- recommended that you do not change + * this in a multithreaded program. + */ +#ifdef _MSC_VER + #if defined(LIBICAL_STATIC) + #define LIBICAL_EXPORT extern + #elif defined(BUILD_LIBICALDLL) + #define LIBICAL_EXPORT __declspec(dllexport) + #else + #define LIBICAL_EXPORT __declspec(dllimport) + #endif +#else + #define LIBICAL_EXPORT extern +#endif + +LIBICAL_EXPORT int icalerror_errors_are_fatal; + +/* Warning messages */ + +#ifdef __GNUC__ca +#define icalerror_warn(message) {fprintf(stderr,"%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);} +#endif /* __GNU_C__ */ + + +void icalerror_clear_errno(void); +void _icalerror_set_errno(icalerrorenum); + +/* Make an individual error fatal or non-fatal. */ +typedef enum icalerrorstate { + ICAL_ERROR_FATAL, /* Not fata */ + 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 ; + +const char* icalerror_strerror(icalerrorenum e); +const char* icalerror_perror(void); +void ical_bt(void); +void icalerror_set_error_state( icalerrorenum error, icalerrorstate); +icalerrorstate icalerror_get_error_state( icalerrorenum error); + +#ifndef ICAL_SETERROR_ISFUNC +#define icalerror_set_errno(x) \ +icalerrno = x; \ +if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \ + (icalerror_get_error_state(x)==ICAL_ERROR_DEFAULT && \ + icalerror_errors_are_fatal == 1 )){ \ + icalerror_warn(icalerror_strerror(x)); \ + ical_bt(); \ + assert(0); \ +} } +#else +void icalerror_set_errno(icalerrorenum x); +#endif + +#if !defined(ICAL_ERRORS_ARE_FATAL) +#define ICAL_ERRORS_ARE_FATAL 0 +#endif + +#if ICAL_ERRORS_ARE_FATAL == 1 +#undef NDEBUG +#endif + +#define icalerror_check_value_type(value,type); +#define icalerror_check_property_type(value,type); +#define icalerror_check_parameter_type(value,type); +#define icalerror_check_component_type(value,type); + +/* Assert with a message */ +#if ICAL_ERRORS_ARE_FATAL == 1 + +#ifdef __GNUC__ +#define icalerror_assert(test,message) if(!(test)){fprintf(stderr,"%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);icalerror_stop_here(); abort();} +#endif /*__GNUC__*/ + +#else /* ICAL_ERRORS_ARE_FATAL */ +#define icalerror_assert(test,message) +#endif /* ICAL_ERRORS_ARE_FATAL */ + +/* Check & abort if check fails */ +#define icalerror_check_arg(test,arg) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); } + +/* Check & return void if check fails*/ +#define icalerror_check_arg_rv(test,arg) if(!(test)) {icalerror_set_errno(ICAL_BADARG_ERROR); return; } + +/* Check & return 0 if check fails*/ +#define icalerror_check_arg_rz(test,arg) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); return 0;} + +/* Check & return an error if check fails*/ +#define icalerror_check_arg_re(test,arg,error) if(!(test)) { icalerror_stop_here(); assert(0); return error;} + +/* Check & return something*/ +#define icalerror_check_arg_rx(test,arg,x) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); return x;} + + + +/* String interfaces to set an error to NONFATAL and restore it to its + original value */ + +icalerrorstate icalerror_supress(const char* error); +void icalerror_restore(const char* error, icalerrorstate es); + + +#endif /* !ICALERROR_H */ + + + diff --git a/src/libical/icallangbind.c b/src/libical/icallangbind.c index 904be27..8218872 100644 --- a/src/libical/icallangbind.c +++ b/src/libical/icallangbind.c @@ -30,9 +30,9 @@ #include <stdlib.h> #include <string.h> -#ifdef WIN32 -#define snprintf _snprintf -#define strcasecmp stricmp +#if defined(_MSC_VER) +#define snprintf _snprintf +#define strcasecmp stricmp #endif int* icallangbind_new_array(int size){ @@ -160,8 +160,8 @@ char* icallangbind_property_eval_string_r(icalproperty* prop, char* sep) { char tmp[25]; size_t buf_size = 1024; - char* buf = icalmemory_new_buffer(buf_size); - char* buf_ptr = buf; + char* buf; + char* buf_ptr; icalparameter *param; icalvalue* value; @@ -169,6 +169,9 @@ char* icallangbind_property_eval_string_r(icalproperty* prop, char* sep) if( prop == 0){ return 0; } + + buf = icalmemory_new_buffer(buf_size); + buf_ptr = buf; APPENDS("{ "); @@ -314,9 +317,7 @@ char* icallangbind_quote_as_ical_r(const char* str) /* assume every char could be quoted */ char* buf = icalmemory_new_buffer(buf_size); - int result; - - result = icalvalue_encode_ical_string(str, buf, buf_size); + (void)icalvalue_encode_ical_string(str, buf, (int)buf_size); return buf; } diff --git a/src/libical/icalmime.c b/src/libical/icalmime.c index 41487a5..c902a59 100644 --- a/src/libical/icalmime.c +++ b/src/libical/icalmime.c @@ -38,9 +38,9 @@ #include "dmalloc.h" #endif -#ifdef WIN32 -#define snprintf _snprintf -#define strcasecmp stricmp +#if defined(_MSC_VER) +#define snprintf _snprintf +#define strcasecmp stricmp #endif /* These *_part routines are called by the MIME parser via the @@ -53,7 +53,7 @@ struct text_part size_t buf_size; }; -void* icalmime_text_new_part() +void* icalmime_text_new_part(void) { #define BUF_SIZE 2048 @@ -125,7 +125,7 @@ void icalmime_text_free_part(void *part) /* Ignore Attachments for now */ -void* icalmime_attachment_new_part() +void* icalmime_attachment_new_part(void) { return 0; } @@ -190,7 +190,7 @@ icalcomponent* icalmime_parse(char* (*get_string)(char *s, size_t size, return 0; } - memset(parts,0,sizeof(parts)); + memset(parts,0,sizeof(NUM_PARTS*sizeof(struct sspm_part))); sspm_parse_mime(parts, NUM_PARTS, /* Max parts */ @@ -341,14 +341,11 @@ line between the header and the previous boundary\?"; parent = last; icalcomponent_add_component(parent,comp); - last_level = parts[i].level; - } else if (parts[i].level < last_level){ - parent = icalcomponent_get_parent(parent); + if (parent) + parent = icalcomponent_get_parent(parent); icalcomponent_add_component(parent,comp); - - last_level = parts[i].level; } else { assert(0); } @@ -379,7 +376,7 @@ int icalmime_test(char* (*get_string)(char *s, size_t size, void *d), return 0; } - memset(parts,0,sizeof(parts)); + memset(parts,0,sizeof(NUM_PARTS*sizeof(struct sspm_part))); sspm_parse_mime(parts, NUM_PARTS, /* Max parts */ @@ -399,6 +396,7 @@ int icalmime_test(char* (*get_string)(char *s, size_t size, void *d), sspm_write_mime(parts,NUM_PARTS,&out,"To: bob@bob.org"); printf("%s\n",out); + free(out); return 0; diff --git a/src/libical/icalparameter.c b/src/libical/icalparameter.c index 571f2ae..aa7520a 100644 --- a/src/libical/icalparameter.c +++ b/src/libical/icalparameter.c @@ -27,7 +27,6 @@ Graham Davison <g.m.davison@computer.org> ======================================================================*/ -/*#line 29 "icalparameter.c.in"*/ #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -43,6 +42,11 @@ #include <errno.h> #include <string.h> /* for memset() */ +#if defined(_MSC_VER) +#define snprintf _snprintf +#define strcasecmp stricmp +#endif + /* In icalderivedparameter */ icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const char* val); @@ -104,7 +108,7 @@ icalparameter_free (icalparameter* param) free ((void*)param->x_name); } - memset(param,0,sizeof(param)); + memset(param,0,sizeof(icalparameter)); param->parent = 0; param->id[0] = 'X'; @@ -167,6 +171,7 @@ icalparameter* icalparameter_new_from_string(const char *str) if(eq == 0){ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); + free(cpy); return 0; } @@ -178,6 +183,7 @@ icalparameter* icalparameter_new_from_string(const char *str) if(kind == ICAL_NO_PARAMETER){ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); + free(cpy); return 0; } @@ -185,6 +191,8 @@ icalparameter* icalparameter_new_from_string(const char *str) if(kind == ICAL_X_PARAMETER){ icalparameter_set_xname(param,cpy); + } else if(kind == ICAL_IANA_PARAMETER) { + icalparameter_set_iana_name(param, cpy); } free(cpy); @@ -220,7 +228,6 @@ icalparameter_as_ical_string_r(icalparameter* param) size_t buf_size = 1024; char* buf; char* buf_ptr; - char *out_buf; const char *kind_string; icalerror_check_arg_rz( (param!=0), "parameter"); @@ -233,10 +240,11 @@ icalparameter_as_ical_string_r(icalparameter* param) buf_ptr = buf; if(param->kind == ICAL_X_PARAMETER) { - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, - icalparameter_get_xname(param)); - + icalmemory_append_string(&buf, &buf_ptr, &buf_size, + icalparameter_get_xname(param)); + } else if (param->kind == ICAL_IANA_PARAMETER) { + icalmemory_append_string(&buf, &buf_ptr, &buf_size, + icalparameter_get_iana_name(param)); } else { kind_string = icalparameter_kind_to_string(param->kind); @@ -246,6 +254,7 @@ icalparameter_as_ical_string_r(icalparameter* param) kind_string == 0) { icalerror_set_errno(ICAL_BADARG_ERROR); + free(buf); return 0; } @@ -274,6 +283,7 @@ 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); return 0; } @@ -365,6 +375,26 @@ icalparameter_get_xvalue (icalparameter* param) return param->string; } +void icalparameter_set_iana_value (icalparameter* param, const char* v) +{ + icalparameter_set_xvalue(param, v); +} + +const char* icalparameter_get_iana_value(icalparameter* param) +{ + return icalparameter_get_xvalue(param); +} + +void icalparameter_set_iana_name (icalparameter* param, const char* v) +{ + icalparameter_set_xname(param, v); +} + +const char* icalparameter_get_iana_name (icalparameter* param) +{ + return icalparameter_get_xname(param); +} + void icalparameter_set_parent(icalparameter* param, icalproperty* property) { @@ -380,6 +410,36 @@ icalproperty* icalparameter_get_parent(icalparameter* param) return param->parent; } +/* returns 1 if parameters have same name in ICAL, otherwise 0 */ +int icalparameter_has_same_name(icalparameter* param1, icalparameter* param2) +{ + icalparameter_kind kind1; + icalparameter_kind kind2; + const char *name1; + const char *name2; + + icalerror_check_arg_rz( (param1!=0),"param1"); + icalerror_check_arg_rz( (param2!=0),"param2"); + + kind1 = icalparameter_isa(param1); + kind2 = icalparameter_isa(param2); + + if (kind1 != kind2) + return 0; + + if (kind1 == ICAL_X_PARAMETER) { + name1 = icalparameter_get_xname(param1); + name2 = icalparameter_get_xname(param2); + if (strcasecmp(name1, name2) != 0) + return 0; + } else if (kind1 == ICAL_IANA_PARAMETER) { + name1 = icalparameter_get_iana_name(param1); + name2 = icalparameter_get_iana_name(param2); + if (strcasecmp(name1, name2) != 0) + return 0; + } + return 1; +} /* Everything below this line is machine generated. Do not edit. */ /* ALTREP */ diff --git a/src/libical/icalparameter.h b/src/libical/icalparameter.h index 0219869..cc15953 100644 --- a/src/libical/icalparameter.h +++ b/src/libical/icalparameter.h @@ -55,12 +55,21 @@ icalparameter_kind icalparameter_isa(icalparameter* parameter); int icalparameter_isa_parameter(void* param); -/* Access the name of an X parameer */ +/* Access the name of an X parameter */ void icalparameter_set_xname (icalparameter* param, const char* v); const char* icalparameter_get_xname(icalparameter* param); void icalparameter_set_xvalue (icalparameter* param, const char* v); const char* icalparameter_get_xvalue(icalparameter* param); +/* Access the name of an IANA parameter */ +void icalparameter_set_iana_name (icalparameter* param, const char* v); +const char* icalparameter_get_iana_name(icalparameter* param); +void icalparameter_set_iana_value (icalparameter* param, const char* v); +const char* icalparameter_get_iana_value(icalparameter* param); + +/* returns 1 if parameters have same name in ICAL, otherwise 0 */ +int icalparameter_has_same_name(icalparameter* param1, icalparameter* param2); + /* Convert enumerations */ const char* icalparameter_kind_to_string(icalparameter_kind kind); diff --git a/src/libical/icalparser.c b/src/libical/icalparser.c index 1c62dd0..43ea903 100644 --- a/src/libical/icalparser.c +++ b/src/libical/icalparser.c @@ -68,16 +68,16 @@ # endif #endif -#ifdef WIN32 -#define snprintf _snprintf -#define strcasecmp stricmp +#if defined(_MSC_VER) +#define snprintf _snprintf +#define strcasecmp stricmp #endif static char* parser_get_next_char(char c, char *str, int qm); static char* parser_get_next_parameter(char* line,char** end); static char* parser_get_next_value(char* line, char **end, icalvalue_kind kind); static char* parser_get_prop_name(char* line, char** end); -static char* parser_get_param_name(char* line, char **end, char **buf_value); +static char* parser_get_param_name(char* line, char **end); #define TMP_BUF_SIZE 80 @@ -115,14 +115,14 @@ void strstriplt(char *buf) return; } len = strlen(buf); - while ((buf[0] != 0) && (isspace(buf[len - 1]))) { + while ((buf[0] != 0) && (isspace((unsigned char)buf[len - 1]))) { buf[--len] = 0; } if (buf[0] == 0) { return; } a = 0; - while ((buf[0]!=0) && (isspace(buf[a]))) { + while ((buf[0]!=0) && (isspace((unsigned char)buf[a]))) { a++; } if (a > 0) { @@ -192,18 +192,18 @@ char* parser_get_next_char(char c, char *str, int qm) for(p=str; *p!=0; p++){ if (qm == 1) { - if ( quote_mode == 0 && *p=='"' && *(p-1) != '\\' ){ + if ( quote_mode == 0 && *p=='"' && p>str && *(p-1) != '\\' ){ quote_mode =1; continue; } - if ( quote_mode == 1 && *p=='"' && *(p-1) != '\\' ){ + if ( quote_mode == 1 && *p=='"' && p>str && *(p-1) != '\\' ){ quote_mode =0; continue; } } - if (quote_mode == 0 && *p== c && *(p-1) != '\\' ){ + if (quote_mode == 0 && *p== c && p>str && *(p-1) != '\\' ){ return p; } @@ -261,14 +261,13 @@ char* parser_get_prop_name(char* line, char** end) } static -char* parser_get_param_name(char* line, char **end, char **buf) +char* parser_get_param_name(char* line, char **end) { char* next; char *str; next = parser_get_next_char('=',line,1); - *buf = 0; if (next == 0) { return 0; } @@ -279,10 +278,13 @@ char* parser_get_param_name(char* line, char **end, char **buf) *end = *end+1; next = parser_get_next_char('"',*end,0); if (next == 0) { + free(str); return 0; } - *buf = *end = make_segment(*end,next); + *end = make_segment(*end,next); + } else { + *end = make_segment(*end, *end + strlen(*end)); } return str; @@ -336,13 +338,19 @@ static char* parser_get_next_value(char* line, char **end, icalvalue_kind kind) { - char* next; + char* next = 0; char *p; char *str; size_t length = strlen(line); + int quoted = 0; + + if( line[0] == '\"' && line[length - 1] == '\"' ) { + /* This line is quoted, don't split into multiple values */ + quoted = 1; + } p = line; - while(1){ + while(!quoted){ next = parser_get_next_char(',',p,1); @@ -877,90 +885,141 @@ icalcomponent* icalparser_add_line(icalparser* parser, if (str != 0){ char* name = 0; char* pvalue = 0; - char *buf_value = NULL; icalparameter *param = 0; icalparameter_kind kind; icalcomponent *tail = pvl_data(pvl_tail(parser->components)); - name = parser_get_param_name(str,&pvalue,&buf_value); + name = parser_get_param_name(str,&pvalue); if (name == 0){ - /* 'tail' defined above */ - insert_error(tail, str, "Cant parse parameter name", - ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR); - tail = 0; - break; + /* 'tail' defined above */ + insert_error(tail, str, "Cant parse parameter name", + ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR); + tail = 0; + break; } kind = icalparameter_string_to_kind(name); if(kind == ICAL_X_PARAMETER){ param = icalparameter_new(ICAL_X_PARAMETER); - - if(param != 0){ - icalparameter_set_xname(param,name); - icalparameter_set_xvalue(param,pvalue); - } - icalmemory_free_buffer(buf_value); - buf_value = NULL; - - } else if (kind != ICAL_NO_PARAMETER){ - param = icalparameter_new_from_value_string(kind,pvalue); - - icalmemory_free_buffer(buf_value); - buf_value = NULL; - - } else { - /* Error. Failed to parse the parameter*/ - /* 'tail' defined above */ - - /* Change for mozilla */ - /* have the option of being flexible towards unsupported parameters */ - #ifndef ICAL_ERRORS_ARE_FATAL + if(param != 0){ + icalparameter_set_xname(param,name); + icalparameter_set_xvalue(param,pvalue); + } + } else if (kind == ICAL_IANA_PARAMETER){ + ical_unknown_token_handling tokHandlingSetting = + ical_get_unknown_token_handling_setting(); + if (tokHandlingSetting == ICAL_DISCARD_TOKEN) continue; - #endif - - insert_error(tail, str, "Cant parse parameter name", - ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR); - tail = 0; - parser->state = ICALPARSER_ERROR; - /* if (pvalue) { - free(pvalue); - pvalue = 0; - } */ - if (name) { - free(name); - name = 0; - } - return 0; + param = icalparameter_new(ICAL_IANA_PARAMETER); + + if(param != 0){ + icalparameter_set_xname(param,name); + icalparameter_set_xvalue(param,pvalue); + } + } else if (kind == ICAL_TZID_PARAMETER){ + /* + Special case handling for TZID to workaround invalid incoming data. + For example, Google Calendar will send back stuff like this: + DTSTART;TZID=GMT+05:30:20120904T020000 + + In this case we read to the last colon rather than the first colon. + This way the TZID will become GMT+05:30 rather than trying to parse + the date-time as 30:20120904T020000. + */ + char *lastColon = 0; + char *nextColon = end; + + /* Find the last colon in the line */ + do { + nextColon = parser_get_next_char(':', nextColon, 1); + + if (nextColon) { + lastColon = nextColon; + } + } while (nextColon); + + /* + Rebuild str so that it includes everything up to the last colon. + So given the above example, str will go from + "TZID=GMT+05" to "TZID=GMT+05:30" + */ + if (lastColon && *(lastColon + 1) != 0) { + char *strStart = line + sizeof(str); + + end = lastColon + 1; + + icalmemory_free_buffer(str); + str = make_segment(strStart, end - 1); + } + + icalmemory_free_buffer(name); + icalmemory_free_buffer(pvalue); + + /* Reparse the parameter name and value with the new segment */ + name = parser_get_param_name(str,&pvalue); + param = icalparameter_new_from_value_string(kind,pvalue); + } else if (kind != ICAL_NO_PARAMETER){ + param = icalparameter_new_from_value_string(kind,pvalue); + } else { + /* Error. Failed to parse the parameter*/ + /* 'tail' defined above */ + + /* Change for mozilla */ + /* have the option of being flexible towards unsupported parameters */ +#if ICAL_ERRORS_ARE_FATAL == 1 + insert_error(tail, str, "Cant parse parameter name", + ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR); + tail = 0; + parser->state = ICALPARSER_ERROR; + if (pvalue) { + free(pvalue); + pvalue = 0; + } + if (name) { + free(name); + name = 0; + } + icalmemory_free_buffer(str); + str = NULL; + return 0; +#else + if (name) { + free(name); + name = 0; + } + icalmemory_free_buffer(str); + str = NULL; + continue; +#endif } - /* if (pvalue) { - free(pvalue); - pvalue = 0; - } */ + if (pvalue) { + free(pvalue); + pvalue = 0; + } + if (name) { - free(name); - name = 0; + free(name); + name = 0; } if (param == 0){ - /* 'tail' defined above */ - insert_error(tail,str,"Cant parse parameter value", - ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR); + /* 'tail' defined above */ + insert_error(tail,str,"Cant parse parameter value", + ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR); - tail = 0; - parser->state = ICALPARSER_ERROR; + tail = 0; + parser->state = ICALPARSER_ERROR; - icalmemory_free_buffer(buf_value); - buf_value = NULL; - icalmemory_free_buffer(name); - name = NULL; - icalmemory_free_buffer(str); - str = NULL; + icalmemory_free_buffer(name); + name = NULL; + icalmemory_free_buffer(str); + str = NULL; - continue; + continue; } /* If it is a VALUE parameter, set the kind of value*/ @@ -981,7 +1040,6 @@ icalcomponent* icalparser_add_line(icalparser* parser, tail, str, "Got a VALUE parameter with an unknown type", ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR); - icalparameter_free(param); value_kind = icalproperty_kind_to_value_kind( @@ -1067,7 +1125,14 @@ icalcomponent* icalparser_add_line(icalparser* parser, prop = clone; tail = 0; } - + + /* If this is a URI value for an ATTACH property, then change + the value to an ATTACH kind as well. + Now we can support ATTACH;TYPE=URI:http://my.fav.url + */ + if(value_kind == ICAL_URI_VALUE && prop_kind == ICAL_ATTACH_PROPERTY){ + value_kind = ICAL_ATTACH_VALUE; + } value = icalvalue_new_from_string(value_kind, str); /* Don't add properties without value */ @@ -1103,11 +1168,15 @@ icalcomponent* icalparser_add_line(icalparser* parser, str = NULL; } else { - if (str != NULL) { - icalmemory_free_buffer(str); - str = NULL; - } - +#if ICAL_ALLOW_EMPTY_PROPERTIES + /* Don't replace empty properties with an error. + Set an empty length string (not null) as the value instead */ + if (vcount == 0) { + icalproperty_set_value(prop, icalvalue_new_text("")); + } + + break; +#else if (vcount == 0){ char temp[200]; /* HACK */ @@ -1131,6 +1200,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, break; } +#endif } } diff --git a/src/libical/icalperiod.c b/src/libical/icalperiod.c index 160229a..52be357 100644 --- a/src/libical/icalperiod.c +++ b/src/libical/icalperiod.c @@ -48,7 +48,7 @@ struct icalperiodtype icalperiodtype_from_string (const char* str) struct icalperiodtype p, null_p; char *s = icalmemory_strdup(str); - char *start, *end = s; + char *start, *end; icalerrorstate es; /* Errors are normally generated in the following code, so save @@ -130,7 +130,7 @@ char* icalperiodtype_as_ical_string_r(struct icalperiodtype p) start = icaltime_as_ical_string_r(p.start); icalmemory_append_string(&buf, &buf_ptr, &buf_size, start); - icalmemory_free_buffer(start); + icalmemory_free_buffer((void*)start); if(!icaltime_is_null_time(p.end)){ end = icaltime_as_ical_string_r(p.end); @@ -141,7 +141,7 @@ char* icalperiodtype_as_ical_string_r(struct icalperiodtype p) icalmemory_append_char(&buf, &buf_ptr, &buf_size, '/'); icalmemory_append_string(&buf, &buf_ptr, &buf_size, end); - icalmemory_free_buffer(end); + icalmemory_free_buffer((void*)end); return buf; } diff --git a/src/libical/icalproperty.c b/src/libical/icalproperty.c index 3514772..df71fac 100644 --- a/src/libical/icalproperty.c +++ b/src/libical/icalproperty.c @@ -45,9 +45,9 @@ #include <stdio.h> /* for printf */ #include <stdarg.h> /* for va_list, va_start, etc. */ -#ifdef WIN32 -#define snprintf _snprintf -#define strcasecmp stricmp +#if defined(_MSC_VER) +#define snprintf _snprintf +#define strcasecmp stricmp #endif /* Private routines for icalproperty */ @@ -174,14 +174,17 @@ icalproperty* icalproperty_new_from_string(const char* str) { size_t buf_size = 1024; - char* buf = icalmemory_new_buffer(buf_size); - char* buf_ptr = buf; + char* buf; + char* buf_ptr; icalproperty *prop; icalcomponent *comp; int errors = 0; icalerror_check_arg_rz( (str!=0),"str"); + buf = icalmemory_new_buffer(buf_size); + buf_ptr = buf; + /* Is this a HACK or a crafty reuse of code? */ icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:VCALENDAR\r\n"); @@ -193,6 +196,7 @@ icalproperty* icalproperty_new_from_string(const char* str) if(comp == 0){ icalerror_set_errno(ICAL_PARSE_ERROR); + free(buf); return 0; } @@ -263,7 +267,7 @@ icalproperty_free (icalproperty* p) /*#define MAX_LINE_LEN 120*/ static char* -get_next_line_start (char *line_start, int chars_left) +get_next_line_start (char *line_start, size_t chars_left) { char *pos; @@ -316,9 +320,9 @@ get_next_line_start (char *line_start, int chars_left) static char* fold_property_line (char *text) { - size_t buf_size; - char *buf, *buf_ptr, *line_start, *next_line_start, *out_buf; - int len, chars_left, first_line; + size_t buf_size, len, chars_left; + char *buf, *buf_ptr, *line_start, *next_line_start; + int first_line; char ch; /* Start with a buffer twice the size of our property line, so we almost @@ -432,8 +436,8 @@ icalproperty_as_ical_string_r(icalproperty* prop) const char* property_name = 0; size_t buf_size = 1024; - char* buf = icalmemory_new_buffer(buf_size); - char* buf_ptr = buf; + char* buf; + char* buf_ptr; icalvalue* value; char *out_buf; const char* kind_string = 0; @@ -442,6 +446,8 @@ icalproperty_as_ical_string_r(icalproperty* prop) icalerror_check_arg_rz( (prop!=0),"prop"); + buf = icalmemory_new_buffer(buf_size); + buf_ptr = buf; /* Append property name */ @@ -499,12 +505,17 @@ icalproperty_as_ical_string_r(icalproperty* prop) if (value != 0){ char *str = icalvalue_as_ical_string_r(value); - icalerror_assert((str !=0),"Could not get string representation of a value"); - icalmemory_append_string(&buf, &buf_ptr, &buf_size, str); + if (str != 0) + icalmemory_append_string(&buf, &buf_ptr, &buf_size, str); +#if ICAL_ALLOW_EMPTY_PROPERTIES == 0 + else + icalmemory_append_string(&buf, &buf_ptr, &buf_size,"ERROR: No Value"); +#endif free(str); } else { +#if ICAL_ALLOW_EMPTY_PROPERTIES == 0 icalmemory_append_string(&buf, &buf_ptr, &buf_size,"ERROR: No Value"); - +#endif } icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); @@ -563,11 +574,15 @@ icalproperty_set_parameter (icalproperty* prop,icalparameter* parameter) icalerror_check_arg_rv( (parameter!=0),"parameter"); kind = icalparameter_isa(parameter); - if (kind != ICAL_X_PARAMETER) - icalproperty_remove_parameter_by_kind(prop,kind); - else + if (kind == ICAL_X_PARAMETER) { icalproperty_remove_parameter_by_name(prop, icalparameter_get_xname(parameter)); + } else if (kind == ICAL_IANA_PARAMETER) { + icalproperty_remove_parameter_by_name(prop, + icalparameter_get_iana_name(parameter)); + } + else + icalproperty_remove_parameter_by_kind(prop,kind); icalproperty_add_parameter(prop,parameter); } @@ -597,8 +612,10 @@ void icalproperty_set_parameter_from_string(icalproperty* prop, return; } - if(kind == ICAL_X_PARAMETER){ - icalparameter_set_xname(param, name); + if (kind == ICAL_X_PARAMETER) { + icalparameter_set_xname(param, name); + } else if (kind == ICAL_IANA_PARAMETER) { + icalparameter_set_iana_name(param, name); } icalproperty_set_parameter(prop,param); @@ -638,13 +655,19 @@ char* icalproperty_get_parameter_as_string_r(icalproperty* prop, for(param = icalproperty_get_first_parameter(prop,kind); param != 0; param = icalproperty_get_next_parameter(prop,kind)) { - if (kind != ICAL_X_PARAMETER) { - break; - } - if (strcmp(icalparameter_get_xname(param),name)==0) { + if (kind == ICAL_X_PARAMETER) { + if (strcmp(icalparameter_get_xname(param),name)==0) { + break; + } + } else if (kind == ICAL_IANA_PARAMETER) { + if (strcmp(icalparameter_get_iana_name(param),name)==0) { + break; + } + } else { break; - } + } + } if (param == 0){ @@ -757,6 +780,8 @@ icalproperty_remove_parameter_by_name(icalproperty* prop, const char *name) if (icalparameter_isa(param) == ICAL_X_PARAMETER) kind_string = icalparameter_get_xname(param); + else if (icalparameter_isa(param) == ICAL_IANA_PARAMETER) + kind_string = icalparameter_get_iana_name(param); else kind_string = icalparameter_kind_to_string(icalparameter_isa(param)); @@ -765,6 +790,7 @@ icalproperty_remove_parameter_by_name(icalproperty* prop, const char *name) if (0 == strcmp(kind_string, name)) { pvl_remove (prop->parameters, p); + icalparameter_free(param); break; } } @@ -784,28 +810,18 @@ void icalproperty_remove_parameter_by_ref(icalproperty* prop, icalparameter* parameter) { pvl_elem p; - icalparameter_kind kind; - const char *name; icalerror_check_arg_rv((prop!=0),"prop"); icalerror_check_arg_rv((parameter!=0),"parameter"); - kind = icalparameter_isa(parameter); - name = icalparameter_get_xname(parameter); + for (p=pvl_head(prop->parameters);p != 0; p = pvl_next(p)) { + icalparameter* p_param = (icalparameter *)pvl_data (p); - /* - * FIXME If it's an X- parameter, also compare the names. It would be nice - * to have a better abstraction like icalparameter_equals() - */ - for(p=pvl_head(prop->parameters);p != 0; p = pvl_next(p)){ - icalparameter* p_param = (icalparameter *)pvl_data (p); - if (icalparameter_isa(p_param) == kind && - (kind != ICAL_X_PARAMETER || - !strcmp(icalparameter_get_xname(p_param), name))) { + if (icalparameter_has_same_name(parameter, p_param)) { pvl_remove (prop->parameters, p); icalparameter_free(p_param); break; - } + } } } @@ -920,6 +936,7 @@ void icalproperty_set_value_from_string(icalproperty* prop,const char* str, return; } + icalerror_clear_errno(); nval = icalvalue_new_from_string(kind, str); if(nval == 0){ @@ -999,10 +1016,13 @@ char* icalproperty_get_property_name_r(const icalproperty* prop) const char* property_name = 0; size_t buf_size = 256; - char* buf = icalmemory_new_buffer(buf_size); - char* buf_ptr = buf; + char* buf; + char* buf_ptr; icalerror_check_arg_rz( (prop!=0),"prop"); + + buf = icalmemory_new_buffer(buf_size); + buf_ptr = buf; if (prop->kind == ICAL_X_PROPERTY && prop->x_name != 0){ property_name = prop->x_name; @@ -1012,6 +1032,7 @@ char* icalproperty_get_property_name_r(const icalproperty* prop) if (property_name == 0 ) { icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); + icalmemory_free_buffer(buf); return 0; } else { diff --git a/src/libical/icalrecur.c b/src/libical/icalrecur.c index 850e46d..c0e5eca 100644 --- a/src/libical/icalrecur.c +++ b/src/libical/icalrecur.c @@ -139,16 +139,23 @@ #include <stdint.h> #endif +#include <stdio.h> +#include <stdarg.h> + +#if defined(_MSC_VER) +#define snprintf _snprintf +#endif + #include <limits.h> #ifndef HAVE_INTPTR_T -#if defined (WIN32) || defined (XP_BEOS) +#if (defined (WIN32) && !defined (__MINGW32__)) || defined (XP_BEOS) typedef long intptr_t; #endif #endif -#ifdef WIN32 -#define strcasecmp stricmp +#ifdef _MSC_VER +#define strcasecmp stricmp #endif #include "icalrecur.h" @@ -156,7 +163,7 @@ typedef long intptr_t; #include "icalerror.h" #include "icalmemory.h" -#include <stdlib.h> /* for malloc */ +#include <stdlib.h> /* for malloc, strtol */ #include <errno.h> /* for errno */ #include <string.h> /* for strdup and strchr*/ #include <assert.h> @@ -354,7 +361,7 @@ void icalrecur_add_bydayrules(struct icalrecur_parser *parser, const char* vals) char *t, *n; int i=0; int sign = 1; - int weekno = 0; + char weekno = 0; /* note: Novell/Groupwise sends BYDAY=255SU, so we fit in a signed char to get -1 SU for last sunday. */ icalrecurrencetype_weekday wd; short *array = parser->rt.by_day; char* end; @@ -389,7 +396,7 @@ void icalrecur_add_bydayrules(struct icalrecur_parser *parser, const char* vals) } /* Get Optional weekno */ - weekno = strtol(t,&t,10); + weekno = (char)strtol(t,&t,10); /* Outlook/Exchange generate "BYDAY=MO, FR" and "BYDAY=2 TH". * Cope with that. @@ -441,7 +448,7 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str) if(name == 0){ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); icalrecurrencetype_clear(&parser.rt); - free(parser.copy); + free(parser.copy); return parser.rt; } @@ -453,6 +460,11 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str) parser.rt.until = icaltime_from_string(value); } else if (strcasecmp(name,"INTERVAL") == 0){ parser.rt.interval = (short)atoi(value); + /* don't allow an interval to be less than 1 + (RFC specifies an interval must be a positive integer) */ + if (parser.rt.interval < 1){ + parser.rt.interval = 1; + } } else if (strcasecmp(name,"WKST") == 0){ parser.rt.week_start = icalrecur_string_to_weekday(value); sort_bydayrules(&parser); @@ -485,7 +497,7 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str) } else { icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); icalrecurrencetype_clear(&parser.rt); - free(parser.copy); + free(parser.copy); return parser.rt; } @@ -810,6 +822,8 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, icalrecur_iterator* impl; icalrecurrencetype_frequency freq; + icalerror_clear_errno(); + if ( ( impl = (icalrecur_iterator*) malloc(sizeof(icalrecur_iterator))) == 0) { icalerror_set_errno(ICAL_NEWFAILED_ERROR); @@ -875,26 +889,18 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, icalrecur_two_byrule(impl,BY_YEAR_DAY,BY_DAY) ){ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); - + free(impl); return 0; } - /* BYWEEKNO and BYMONTH rule parts may not both appear.*/ - - if(icalrecur_two_byrule(impl,BY_WEEK_NO,BY_MONTH)){ - icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); - - icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); - return 0; - } + /* BYWEEKNO and BYMONTHDAY rule parts may not both appear.*/ if(icalrecur_two_byrule(impl,BY_WEEK_NO,BY_MONTH_DAY)){ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); - - icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); - return 0; + free(impl); + return 0; } @@ -904,7 +910,8 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, if(freq == ICAL_MONTHLY_RECURRENCE && icalrecur_one_byrule(impl,BY_WEEK_NO)){ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); - return 0; + free(impl); + return 0; } @@ -914,13 +921,15 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, if(freq == ICAL_WEEKLY_RECURRENCE && icalrecur_one_byrule(impl,BY_MONTH_DAY )) { icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); - return 0; + free(impl); + return 0; } /* BYYEARDAY may only appear in YEARLY rules */ if(freq != ICAL_YEARLY_RECURRENCE && icalrecur_one_byrule(impl,BY_YEAR_DAY )) { icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); + free(impl); return 0; } @@ -990,9 +999,16 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, if(impl->rule.freq == ICAL_YEARLY_RECURRENCE){ struct icaltimetype next; + icalerror_clear_errno(); - for (;;) { + /* Fail after hitting the year 20000 if no expanded days match */ + while (impl->last.year < 20000) { expand_year_days(impl, impl->last.year); + if( icalerrno != ICAL_NO_ERROR) { + icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); + free(impl); + return 0; + } if (impl->days[0] != ICAL_RECURRENCE_ARRAY_MAX) break; /* break when no days are expanded */ increment_year(impl,impl->rule.interval); @@ -1054,7 +1070,8 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, if(impl->last.day > days_in_month || impl->last.day == 0){ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); - return 0; + free(impl); + return 0; } } else if (has_by_data(impl,BY_MONTH_DAY)) { @@ -1158,7 +1175,7 @@ static void increment_hour(icalrecur_iterator* impl, int inc) days = impl->last.hour / 24; impl->last.hour = impl->last.hour % 24; - if (impl->days != 0){ + if (days != 0){ increment_monthday(impl,days); } } @@ -1494,6 +1511,20 @@ static int is_day_in_byday(icalrecur_iterator* impl,struct icaltimetype tt){ return 0; } +int check_set_position(icalrecur_iterator* impl, int set_pos) +{ + int i; + int found = 0; + for (i = 0; impl->rule.by_set_pos[i] != ICAL_RECURRENCE_ARRAY_MAX && + i != ICAL_BY_SETPOS_SIZE; i++){ + if (impl->rule.by_set_pos[i] == set_pos) { + found = 1; + break; + } + } + return found; +} + static int next_month(icalrecur_iterator* impl) { int data_valid = 1; @@ -1575,15 +1606,44 @@ static int next_month(icalrecur_iterator* impl) int day; int days_in_month = icaltime_days_in_month(impl->last.month, impl->last.year); - assert( BYDAYPTR[0]!=ICAL_RECURRENCE_ARRAY_MAX); + int set_pos_counter = 0; + int set_pos_total = 0; + int found = 0; + + assert( BYDAYPTR[0]!=ICAL_RECURRENCE_ARRAY_MAX); + + /* Count the past positions for the BYSETPOS calculation */ + if(has_by_data(impl,BY_SET_POS)){ + int last_day = impl->last.day; + for(day = 1; day <= days_in_month; day++){ + impl->last.day = day; + + if(is_day_in_byday(impl,impl->last)){ + set_pos_total++; + if(day <= last_day) + set_pos_counter++; + } + } + impl->last.day = last_day; + } + for(day = impl->last.day+1; day <= days_in_month; day++){ impl->last.day = day; + if(is_day_in_byday(impl,impl->last)){ - data_valid = 1; - break; - } + /* If there is no BYSETPOS rule, calculate only by BYDAY + If there is BYSETPOS rule, take into account the occurence + matches with BYDAY */ + if(!has_by_data(impl,BY_SET_POS) || check_set_position(impl, ++set_pos_counter) + || check_set_position(impl, set_pos_counter-set_pos_total-1)) { + found = 1; + break; + } + } } + + data_valid = found; if ( day > days_in_month){ impl->last.day = 1; @@ -1594,7 +1654,9 @@ static int next_month(icalrecur_iterator* impl) invalid */ if(is_day_in_byday(impl,impl->last)){ - data_valid = 1; + /* If there is no BYSETPOS rule or BYSETPOS=1, new data is valid */ + if(!has_by_data(impl,BY_SET_POS) || check_set_position(impl,1)) + data_valid = 1; } else { data_valid = 0; /* signal that impl->last is invalid */ } @@ -1647,12 +1709,15 @@ static int next_month(icalrecur_iterator* impl) } else { int days_in_month; + assert( BYMDPTR[0]!=ICAL_RECURRENCE_ARRAY_MAX); + impl->last.day = BYMDPTR[0]; + increment_month(impl); days_in_month = icaltime_days_in_month(impl->last.month, impl->last.year); if (impl->last.day > days_in_month){ - data_valid = 0; /* signal that impl->last is invalid */ + impl->last.day = days_in_month; } } @@ -1850,7 +1915,7 @@ static pvl_list expand_by_day(icalrecur_iterator* impl, int year) static int expand_year_days(icalrecur_iterator* impl, int year) { - int j,k; + int i,j,k; int days_index=0; struct icaltimetype t; int flags; @@ -1872,6 +1937,46 @@ static int expand_year_days(icalrecur_iterator* impl, int year) (HBD(BY_YEAR_DAY) ? 1<<BY_YEAR_DAY : 0); + /* BY_WEEK_NO together with BY_MONTH - may conflict, in this case BY_MONTH wins */ + if( (flags & 1<<BY_MONTH) && (flags & 1<<BY_WEEK_NO) ){ + int valid_weeks[ICAL_BY_WEEKNO_SIZE]; + int valid = 1; + memset(valid_weeks, 0, sizeof(valid_weeks)); + t.year = year; + t.is_date = 1; + + /* calculate valid week numbers */ + for(j=0; impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){ + int month = impl->by_ptrs[BY_MONTH][j]; + int first_week, last_week; + t.month = month; + t.day = 1; + first_week = icaltime_week_number(t); + t.day = icaltime_days_in_month(month,year); + last_week = icaltime_week_number(t); + for(j=first_week; j<last_week; j++) { + valid_weeks[j] = 1; + } + } + + /* check valid weeks */ + for(i = 0; BYWEEKPTR[i] != ICAL_RECURRENCE_ARRAY_MAX && valid; i++){ + int weekno = BYWEEKPTR[i]; + if(weekno < ICAL_BY_WEEKNO_SIZE) + valid &= valid_weeks[i]; /* check if the week number is valid */ + else + valid = 0; /* invalid week number */ + } + + /* let us make the decision which rule to keep */ + if(valid) { /* BYWEEKNO wins */ + flags -= 1<<BY_MONTH; + } + else { /* BYMONTH vins */ + flags -= 1<<BY_WEEK_NO; + } + } + switch(flags) { case 0: { @@ -2011,7 +2116,24 @@ static int expand_year_days(icalrecur_iterator* impl, int year) t.day = days_in_month; last_dow = icaltime_day_of_week(t); - for(k=0;impl->by_ptrs[BY_DAY][k]!=ICAL_RECURRENCE_ARRAY_MAX;k++){ + if(has_by_data(impl,BY_SET_POS)) { + /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; BYMONTH = 12; BYSETPOS=1*/ + int day; + int set_pos_counter = 0; + int set_pos_total = 0; + int by_month_day[ICAL_BY_MONTHDAY_SIZE]; + for(day = 1; day <= days_in_month; day++){ + t.day = day; + if(is_day_in_byday(impl,t)) + by_month_day[set_pos_total++] = day; + } + for(set_pos_counter = 0; set_pos_counter < set_pos_total; set_pos_counter++){ + if(check_set_position(impl, set_pos_counter+1) || + check_set_position(impl, set_pos_counter-set_pos_total)) + impl->days[days_index++] = doy_offset + by_month_day[set_pos_counter]; + } + } + else for(k=0;impl->by_ptrs[BY_DAY][k]!=ICAL_RECURRENCE_ARRAY_MAX;k++){ short day_coded = impl->by_ptrs[BY_DAY][k]; enum icalrecurrencetype_weekday dow = icalrecurrencetype_day_day_of_week(day_coded); @@ -2252,8 +2374,8 @@ static int check_contracting_rules(icalrecur_iterator* impl) struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *impl) { int valid = 1; - - if( (impl->rule.count!=0 &&impl->occurrence_no >= impl->rule.count) || + + if( !impl || (impl->rule.count!=0 &&impl->occurrence_no >= impl->rule.count) || (!icaltime_is_null_time(impl->rule.until) && icaltime_compare(impl->last,impl->rule.until) > 0)) { return icaltime_null_time(); @@ -2470,21 +2592,21 @@ int icalrecur_expand_recurrence(char* rule, time_t start, icstart = icaltime_from_timet_with_zone(start,0,0); recur = icalrecurrencetype_from_string(rule); + ritr = icalrecur_iterator_new(recur,icstart); + if(ritr) { + for(next = icalrecur_iterator_next(ritr); + !icaltime_is_null_time(next) && i < count; + next = icalrecur_iterator_next(ritr)){ - for(ritr = icalrecur_iterator_new(recur,icstart), - next = icalrecur_iterator_next(ritr); - !icaltime_is_null_time(next) && i < count; - next = icalrecur_iterator_next(ritr)){ - - tt = icaltime_as_timet(next); + tt = icaltime_as_timet(next); - if (tt >= start ){ - array[i++] = tt; - } - + if (tt >= start ){ + array[i++] = tt; + } + } + icalrecur_iterator_free(ritr); } - icalrecur_iterator_free(ritr); return 1; } diff --git a/src/libical/icalrestriction.c.in b/src/libical/icalrestriction.c.in index 87fa252..d8c03cc 100644 --- a/src/libical/icalrestriction.c.in +++ b/src/libical/icalrestriction.c.in @@ -1,7 +1,18 @@ /* -*- Mode: C -*- */ /* ====================================================================== File: icalrestriction.c - + + 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: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ /*#line 7 "icalrestriction.c.in"*/ @@ -15,7 +26,11 @@ #include "icalerror.h" #include <assert.h> -#include <stdio.h> /* For snprintf */ +#include <stdio.h> + +#if defined(_MSC_VER) +#define snprintf _snprintf +#endif #define TMP_BUF_SIZE 1024 @@ -281,7 +296,7 @@ const char* icalrestriction_no_dtend( (void)rec; (void)prop; - if( !icalcomponent_get_first_property(comp,ICAL_DTEND_PROPERTY)){ + 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"; diff --git a/src/libical/icaltime.c b/src/libical/icaltime.c index c1c4f35..b984256 100644 --- a/src/libical/icaltime.c +++ b/src/libical/icaltime.c @@ -47,9 +47,11 @@ #ifdef WIN32 #include <windows.h> +#endif -#define snprintf _snprintf -#define strcasecmp stricmp +#if defined(_MSC_VER) +#define snprintf _snprintf +#define strcasecmp stricmp #endif #ifdef WIN32 @@ -329,6 +331,7 @@ char* set_tz(const char* tzid) if(new_tz == 0){ icalerror_set_errno(ICAL_NEWFAILED_ERROR); + free(old_tz_copy); return 0; } @@ -363,8 +366,12 @@ void unset_tz(char *tzstr) #ifdef HAVE_UNSETENV unsetenv("TZ"); #else +#ifdef _MSC_VER + putenv("TZ="); // The equals is required to remove with MS Visual C++ +#else putenv("TZ"); #endif +#endif } /* Free any previous TZ environment string we have used in a synchronized manner */ @@ -426,15 +433,11 @@ to prevent any crashes */ /* Set TZ to UTC and use mktime to convert to a time_t. */ old_tz = set_tz ("UTC"); -#ifdef WIN32 tzset (); -#endif t = mktime (&stm); unset_tz (old_tz); -#ifdef WIN32 tzset (); -#endif #ifdef HAVE_PTHREAD pthread_mutex_unlock (&tzid_mutex); @@ -507,7 +510,7 @@ struct icaltimetype icaltime_normalize(const struct icaltimetype tt) struct icaltimetype icaltime_from_string(const char* str) { struct icaltimetype tt = icaltime_null_time(); - int size; + size_t size; icalerror_check_arg_re(str!=0,"str",icaltime_null_time()); diff --git a/src/libical/icaltimezone.c b/src/libical/icaltimezone.c index dd0e511..aa9c1d9 100644 --- a/src/libical/icaltimezone.c +++ b/src/libical/icaltimezone.c @@ -40,12 +40,20 @@ #include "icalerror.h" #include "icalparser.h" #include "icaltimezone.h" +#include "icaltimezoneimpl.h" #include "icaltz-util.h" #include <sys/stat.h> +#ifdef HAVE_PTHREAD +#include <pthread.h> +static pthread_mutex_t builtin_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif + #ifdef WIN32 +#ifndef _WIN32_WCE #include <mbstring.h> +#endif #include <windows.h> /* Undef the similar macro from pthread.h, it doesn't check if * gmtime() returns NULL. @@ -54,6 +62,16 @@ /* The gmtime() in Microsoft's C library is MT-safe */ #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) + +// MSVC lacks the POSIX macro S_ISDIR, however it's a trivial one: +#ifndef S_ISDIR +#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) +#endif +#endif + +#if defined(_MSC_VER) +#define snprintf _snprintf +#define strcasecmp stricmp #endif /** This is the toplevel directory where the timezone data is installed in. */ @@ -76,54 +94,6 @@ const char *ical_tzid_prefix = "/freeassociation.sourceforge.net/"; somewhere around 2037. */ #define ICALTIMEZONE_MAX_YEAR 2035 -struct _icaltimezone { - char *tzid; - /**< The unique ID of this timezone, - e.g. "/citadel.org/Olson_20010601_1/Africa/Banjul". - This should only be used to identify a VTIMEZONE. It is not - meant to be displayed to the user in any form. */ - - char *location; - /**< The location for the timezone, e.g. "Africa/Accra" for the - Olson database. We look for this in the "LOCATION" or - "X-LIC-LOCATION" properties of the VTIMEZONE component. It - isn't a standard property yet. This will be NULL if no location - is found in the VTIMEZONE. */ - - char *tznames; - /**< This will be set to a combination of the TZNAME properties - from the last STANDARD and DAYLIGHT components in the - VTIMEZONE, e.g. "EST/EDT". If they both use the same TZNAME, - or only one type of component is found, then only one TZNAME - will appear, e.g. "AZOT". If no TZNAME is found this will be - NULL. */ - - double latitude; - double longitude; - /**< The coordinates of the city, in degrees. */ - - icalcomponent *component; - /**< The toplevel VTIMEZONE component loaded from the .ics file for this - timezone. If we need to regenerate the changes data we need this. */ - - icaltimezone *builtin_timezone; - /**< If this is not NULL it points to the builtin icaltimezone - that the above TZID refers to. This icaltimezone should be used - instead when accessing the timezone changes data, so that the - expanded timezone changes data is shared between calendar - components. */ - - int end_year; - /**< This is the last year for which we have expanded the data to. - If we need to calculate a date past this we need to expand the - timezone component data from scratch. */ - - icalarray *changes; - /**< A dynamically-allocated array of time zone changes, sorted by the - time of the change in local time. So we can do fast binary-searches - to convert from local time to UTC. */ -}; - typedef struct _icaltimezonechange icaltimezonechange; struct _icaltimezonechange { @@ -234,10 +204,18 @@ icaltimezone_copy (icaltimezone *originalzone) } memcpy (zone, originalzone, sizeof (icaltimezone)); + if (zone->tzid != NULL) + zone->tzid = strdup (zone->tzid); if (zone->location != NULL) zone->location = strdup (zone->location); if (zone->tznames != NULL) zone->tznames = strdup (zone->tznames); + if (zone->changes != NULL) + zone->changes = icalarray_copy(zone->changes); + + /* Let the caller set the component because then they will + know to be careful not to free this reference twice. */ + zone->component = NULL; return zone; } @@ -298,7 +276,7 @@ icaltimezone_get_vtimezone_properties (icaltimezone *zone, icalcomponent *component) { icalproperty *prop; - const char *tzid, *tzname; + const char *tzid; prop = icalcomponent_get_first_property (component, ICAL_TZID_PROPERTY); if (!prop) @@ -309,17 +287,16 @@ icaltimezone_get_vtimezone_properties (icaltimezone *zone, if (!tzid) return 0; - prop = icalcomponent_get_first_property (component, ICAL_TZNAME_PROPERTY); - if (prop) { - tzname = icalproperty_get_tzname (prop); - zone->tznames = strdup(tzname); - } else - zone->tznames = NULL; - + if (zone->tzid) free(zone->tzid); zone->tzid = strdup (tzid); + + if (zone->component) icalcomponent_free(zone->component); zone->component = component; - if ( zone->location != 0 ) free ( zone->location ); + + if (zone->location) free(zone->location); zone->location = icaltimezone_get_location_from_vtimezone (component); + + if (zone->tznames) free(zone->tznames); zone->tznames = icaltimezone_get_tznames_from_vtimezone (component); return 1; @@ -449,7 +426,7 @@ icaltimezone_get_tznames_from_vtimezone (icalcomponent *component) /* If both standard and daylight TZNAMEs were found, if they are the same we return just one, else we format them like "EST/EDT". */ if (standard_tzname && daylight_tzname) { - unsigned int standard_len, daylight_len; + size_t standard_len, daylight_len; char *tznames; if (!strcmp (standard_tzname, daylight_tzname)) @@ -482,8 +459,7 @@ icaltimezone_ensure_coverage (icaltimezone *zone, int changes_end_year; - if (!zone->component) - icaltimezone_load_builtin_timezone (zone); + icaltimezone_load_builtin_timezone (zone); if (icaltimezone_minimum_expansion_year == -1) { struct icaltimetype today = icaltime_today(); @@ -552,7 +528,7 @@ icaltimezone_expand_vtimezone (icalcomponent *comp, icalrecur_iterator* rrule_iterator; struct icaldatetimeperiodtype rdate; int found_dtstart = 0, found_tzoffsetto = 0, found_tzoffsetfrom = 0; - int has_recurrence = 0; + int has_rdate = 0, has_rrule = 0; /* First we check if it is a STANDARD or DAYLIGHT component, and just return if it isn't. */ @@ -584,8 +560,10 @@ icaltimezone_expand_vtimezone (icalcomponent *comp, found_tzoffsetfrom = 1; break; case ICAL_RDATE_PROPERTY: + has_rdate = 1; + break; case ICAL_RRULE_PROPERTY: - has_recurrence = 1; + has_rrule = 1; break; default: /* Just ignore any other properties. */ @@ -595,6 +573,14 @@ icaltimezone_expand_vtimezone (icalcomponent *comp, prop = icalcomponent_get_next_property (comp, ICAL_ANY_PROPERTY); } + /* Microsoft Outlook for Mac (and possibly other versions) will create + timezones without a tzoffsetfrom property if it's a timezone that + doesn't change for DST. */ + if (found_tzoffsetto && !found_tzoffsetfrom) { + change.prev_utc_offset = change.utc_offset; + found_tzoffsetfrom = 1; + } + /* If we didn't find a DTSTART, TZOFFSETTO and TZOFFSETFROM we have to ignore the component. FIXME: Add an error property? */ if (!found_dtstart || !found_tzoffsetto || !found_tzoffsetfrom) @@ -606,9 +592,9 @@ icaltimezone_expand_vtimezone (icalcomponent *comp, dtstart.hour, dtstart.minute, dtstart.second); #endif - /* If the STANDARD/DAYLIGHT component has no recurrence data, we just add + /* If the STANDARD/DAYLIGHT component has no recurrence rule, we add a single change for the DTSTART. */ - if (!has_recurrence) { + if (!has_rrule) { change.year = dtstart.year; change.month = dtstart.month; change.day = dtstart.day; @@ -627,12 +613,11 @@ icaltimezone_expand_vtimezone (icalcomponent *comp, /* Add the change to the array. */ icalarray_append (changes, &change); - return; } /* The component has recurrence data, so we expand that now. */ prop = icalcomponent_get_first_property (comp, ICAL_ANY_PROPERTY); - while (prop) { + while (prop && (has_rdate || has_rrule)) { #if 0 printf ("Expanding property...\n"); #endif @@ -688,9 +673,32 @@ icaltimezone_expand_vtimezone (icalcomponent *comp, rrule.until.is_utc = 0; } + /* Add the dtstart to changes, otherwise some oddly-defined VTIMEZONE + components can cause the first year to get skipped. */ + change.year = dtstart.year; + change.month = dtstart.month; + change.day = dtstart.day; + change.hour = dtstart.hour; + change.minute = dtstart.minute; + change.second = dtstart.second; + +#if 0 + printf (" Appending RRULE element (Y/M/D): %i/%02i/%02i %i:%02i:%02i\n", + change.year, change.month, change.day, + change.hour, change.minute, change.second); +#endif + + icaltimezone_adjust_change (&change, 0, 0, 0, + -change.prev_utc_offset); + + icalarray_append (changes, &change); + rrule_iterator = icalrecur_iterator_new (rrule, dtstart); - for (;;) { + for (;rrule_iterator;) { occ = icalrecur_iterator_next (rrule_iterator); + /* Skip dtstart since we just added it */ + if (icaltime_compare(dtstart, occ) == 0) + continue; if (occ.year > end_year || icaltime_is_null_time (occ)) break; @@ -899,9 +907,12 @@ icaltimezone_get_utc_offset (icaltimezone *zone, change_num += step; /* If we go past the start of the changes array, then we have no data - for this time so we return a UTC offset of 0. */ - if (change_num < 0) - return 0; + for this time so we return the prev UTC offset. */ + if (change_num < 0) { + if (is_daylight) + *is_daylight = ! tmp_change.is_daylight; + return tmp_change.prev_utc_offset; + } if ((unsigned int)change_num >= zone->changes->num_elements) break; @@ -1169,8 +1180,7 @@ icaltimezone_get_tzid (icaltimezone *zone) if (!zone) return NULL; - if (!zone->tzid) - icaltimezone_load_builtin_timezone (zone); + icaltimezone_load_builtin_timezone (zone); return zone->tzid; } @@ -1196,8 +1206,7 @@ icaltimezone_get_tznames (icaltimezone *zone) if (!zone) return NULL; - if (!zone->component) - icaltimezone_load_builtin_timezone (zone); + icaltimezone_load_builtin_timezone (zone); return zone->tznames; } @@ -1239,8 +1248,7 @@ icaltimezone_get_component (icaltimezone *zone) if (!zone) return NULL; - if (!zone->component) - icaltimezone_load_builtin_timezone (zone); + icaltimezone_load_builtin_timezone (zone); return zone->component; } @@ -1354,6 +1362,7 @@ void icaltimezone_free_builtin_timezones(void) { icaltimezone_array_free(builtin_timezones); + builtin_timezones = 0; } @@ -1361,8 +1370,9 @@ icaltimezone_free_builtin_timezones(void) icaltimezone* icaltimezone_get_builtin_timezone (const char *location) { + icalcomponent *comp; icaltimezone *zone; - int lower; + unsigned int lower; const char *zone_location; if (!location || !location[0]) @@ -1371,7 +1381,7 @@ icaltimezone_get_builtin_timezone (const char *location) if (!builtin_timezones) icaltimezone_init_builtin_timezones (); - if (!strcmp (location, "UTC")) + if (strcmp (location, "UTC") == 0 || strcmp (location, "GMT") == 0) return &utc_timezone; #if 0 @@ -1402,6 +1412,20 @@ icaltimezone_get_builtin_timezone (const char *location) return zone; } + /* Check whether file exists, but is not mentioned in zone.tab. + It means it's a deprecated timezone, but still available. */ + comp = icaltzutil_fetch_timezone (location); + if (comp) { + icaltimezone tz; + icaltimezone_init (&tz); + if (icaltimezone_set_component (&tz, comp)) { + icalarray_append (builtin_timezones, &tz); + return icalarray_element_at (builtin_timezones, builtin_timezones->num_elements - 1); + } else { + icalcomponent_free (comp); + } + } + return NULL; } @@ -1462,8 +1486,7 @@ icaltimezone_get_builtin_timezone_from_offset (int offset, const char *tzname) for (i=0; i<count; i++) { int z_offset; zone = icalarray_element_at (builtin_timezones, i); - if (!zone->component) - icaltimezone_load_builtin_timezone (zone); + icaltimezone_load_builtin_timezone (zone); z_offset = get_offset(zone); @@ -1485,12 +1508,15 @@ icaltimezone_get_builtin_timezone_from_tzid (const char *tzid) if (!tzid || !tzid[0]) return NULL; + if (strcmp (tzid, "UTC") == 0 || strcmp (tzid, "GMT") == 0) { + return icaltimezone_get_builtin_timezone(tzid); + } + /* Check that the TZID starts with our unique prefix. */ if (strncmp (tzid, ical_tzid_prefix, strlen(ical_tzid_prefix))) return NULL; /* Get the location, which is after the 3rd '/' character. */ - p = tzid; for (p = tzid; *p; p++) { if (*p == '/') { num_slashes++; @@ -1541,7 +1567,14 @@ icaltimezone_init_builtin_timezones (void) /* Initialize the special UTC timezone. */ utc_timezone.tzid = (char *)"UTC"; - icaltimezone_parse_zone_tab (); +#ifdef HAVE_PTHREAD + pthread_mutex_lock(&builtin_mutex); +#endif + if (!builtin_timezones) + icaltimezone_parse_zone_tab (); +#ifdef HAVE_PTHREAD + pthread_mutex_unlock(&builtin_mutex); +#endif } static int @@ -1570,7 +1603,7 @@ parse_coord (char *coord, } static int fetch_lat_long_from_string (const char *str, int *latitude_degrees, int *latitude_minutes, int *latitude_seconds, - int *longitude_degrees, int *longitude_minutes, int *longitude_seconds, char *location) + int *longitude_degrees, int *longitude_minutes, int *longitude_seconds, char *location) { size_t len; char *sptr, *lat, *lon, *loc, *temp; @@ -1614,10 +1647,17 @@ fetch_lat_long_from_string (const char *str, int *latitude_degrees, int *latitu while (*lon != '+' && *lon != '-') lon++; - if (parse_coord (lat, lon - lat, latitude_degrees, latitude_minutes, latitude_seconds) == 1 || - parse_coord (lon, strlen (lon), longitude_degrees, longitude_minutes, longitude_seconds) - == 1) - return 1; + if (parse_coord (lat, (int)(lon - lat), + latitude_degrees, + latitude_minutes, + latitude_seconds) == 1 || + parse_coord (lon, (int)strlen(lon), + longitude_degrees, + longitude_minutes, + longitude_seconds) == 1) { + free(lat); + return 1; + } free (lat); @@ -1638,7 +1678,7 @@ icaltimezone_parse_zone_tab (void) FILE *fp; char buf[1024]; /* Used to store each line of zones.tab as it is read. */ char location[1024]; /* Stores the city name when parsing buf. */ - unsigned int filename_len; + size_t filename_len; int latitude_degrees = 0, latitude_minutes = 0, latitude_seconds = 0; int longitude_degrees = 0, longitude_minutes = 0, longitude_seconds = 0; icaltimezone zone; @@ -1735,7 +1775,7 @@ icaltimezone_parse_zone_tab (void) void icaltimezone_release_zone_tab (void) { - int i; + unsigned int i; icalarray *mybuiltin_timezones = builtin_timezones; if (builtin_timezones == NULL) @@ -1756,6 +1796,17 @@ icaltimezone_load_builtin_timezone (icaltimezone *zone) if (!zone->location || !zone->location[0]) return; +#ifdef HAVE_PTHREAD + pthread_mutex_lock(&builtin_mutex); + if (zone->component) + goto out; +#else +#ifdef USE_BUILTIN_TZDATA + if (zone->component) + return; +#endif +#endif + #ifdef USE_BUILTIN_TZDATA { char *filename; @@ -1769,7 +1820,7 @@ icaltimezone_load_builtin_timezone (icaltimezone *zone) filename = (char*) malloc (filename_len); if (!filename) { icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return; + goto out; } snprintf (filename, filename_len, "%s/%s.ics", get_zone_directory(), @@ -1779,7 +1830,7 @@ icaltimezone_load_builtin_timezone (icaltimezone *zone) free (filename); if (!fp) { icalerror_set_errno(ICAL_FILE_ERROR); - return; + goto out; } @@ -1803,7 +1854,7 @@ icaltimezone_load_builtin_timezone (icaltimezone *zone) if (!subcomp) { icalerror_set_errno(ICAL_PARSE_ERROR); - return; + goto out; } icaltimezone_get_vtimezone_properties (zone, subcomp); @@ -1812,8 +1863,13 @@ icaltimezone_load_builtin_timezone (icaltimezone *zone) icalcomponent_remove_component(comp,subcomp); icalcomponent_free(comp); } -#endif +#endif + out: +#ifdef HAVE_PTHREAD + pthread_mutex_unlock(&builtin_mutex); +#endif + return; } @@ -1867,7 +1923,6 @@ icaltimezone_dump_changes (icaltimezone *zone, printf ("Num changes: %i\n", zone->changes->num_elements); #endif - change_num = 0; for (change_num = 0; (unsigned int)change_num < zone->changes->num_elements; change_num++) { zone_change = icalarray_element_at (zone->changes, change_num); @@ -1929,10 +1984,18 @@ static const char* get_zone_directory(void) return zone_files_directory == NULL ? ZONEINFO_DIRECTORY : zone_files_directory; #else wchar_t wbuffer[1000]; +#ifndef _WIN32_WCE char buffer[1000], zoneinfodir[1000], dirname[1000]; +#else + wchar_t zoneinfodir[1000], dirname[1000]; +#endif int used_default; static char *cache = NULL; +#ifndef _WIN32_WCE char *dirslash, *zislash; +#else + wchar_t *dirslash, *zislash; +#endif struct stat st; if (zone_files_directory) @@ -1945,6 +2008,8 @@ static const char* get_zone_directory(void) if (!GetModuleFileNameW (NULL, wbuffer, sizeof (wbuffer) / sizeof (wbuffer[0]))) return ZONEINFO_DIRECTORY; +/*wince supports only unicode*/ +#ifndef _WIN32_WCE /* Convert to system codepage */ if (!WideCharToMultiByte (CP_ACP, 0, wbuffer, -1, buffer, sizeof (buffer), NULL, &used_default) || @@ -1957,6 +2022,7 @@ static const char* get_zone_directory(void) used_default) return ZONEINFO_DIRECTORY; } +#endif /* Look for the zoneinfo directory somewhere in the path where * the app is installed. If the path to the app is * @@ -1992,10 +2058,38 @@ static const char* get_zone_directory(void) */ /* Strip away basename of app .exe first */ +#ifndef _WIN32_WCE dirslash = _mbsrchr (buffer, '\\'); +#else + dirslash = wcsrchr (wbuffer, L'\\'); +#endif if (dirslash) +#ifndef _WIN32_WCE *dirslash = '\0'; +#else + *dirslash = L'\0'; +#endif +#ifdef _WIN32_WCE + while ((dirslash = wcsrchr (wbuffer, '\\'))) { + /* Strip one more directory from app .exe location */ + *dirslash = L'\0'; + + MultiByteToWideChar(CP_ACP,0,ZONEINFO_DIRECTORY,-1,zoneinfodir,1000); + + while ((zislash = wcschr (zoneinfodir, L'/'))) { + *zislash = L'.'; + wcscpy (dirname, wbuffer); + wcscat (dirname, "/"); + wcscat (dirname, zislash + 1); + if (stat (dirname, &st) == 0 && + S_ISDIR (st.st_mode)) { + cache = wce_wctomb (dirname); + return cache; + } + } + } +#else while ((dirslash = _mbsrchr (buffer, '\\'))) { /* Strip one more directory from app .exe location */ *dirslash = '\0'; @@ -2013,12 +2107,15 @@ static const char* get_zone_directory(void) } } } +#endif return ZONEINFO_DIRECTORY; #endif } void set_zone_directory(char *path) { + if (zone_files_directory) + free_zone_directory(); zone_files_directory = malloc(strlen(path)+1); if ( zone_files_directory != NULL ) { @@ -2031,6 +2128,7 @@ void free_zone_directory(void) if ( zone_files_directory != NULL ) { free(zone_files_directory); + zone_files_directory = NULL; } } diff --git a/src/libical/icaltimezoneimpl.h b/src/libical/icaltimezoneimpl.h new file mode 100644 index 0000000..354d5bb --- /dev/null +++ b/src/libical/icaltimezoneimpl.h @@ -0,0 +1,88 @@ +/* -*- Mode: C -*- + ====================================================================== + FILE: icaltimezoneimpl.h + CREATOR: glenn 07 March 2010 + + $Id: icalparameterimpl.h,v 1.4 2008-01-15 23:17:40 dothebart Exp $ + $Locker: $ + + + (C) COPYRIGHT 2000, Eric Busboom <eric@softwarestudio.org> + http://www.softwarestudio.org + + 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: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + + Contributions from: + + ======================================================================*/ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifndef ICALTIMEZONE_IMPL +#define ICALTIMEZONE_IMPL + +#include "icaltimezone.h" +#include "icalcomponent.h" +#include "icalarray.h" + +struct _icaltimezone { + char *tzid; + /**< The unique ID of this timezone, + e.g. "/citadel.org/Olson_20010601_1/Africa/Banjul". + This should only be used to identify a VTIMEZONE. It is not + meant to be displayed to the user in any form. */ + + char *location; + /**< The location for the timezone, e.g. "Africa/Accra" for the + Olson database. We look for this in the "LOCATION" or + "X-LIC-LOCATION" properties of the VTIMEZONE component. It + isn't a standard property yet. This will be NULL if no location + is found in the VTIMEZONE. */ + + char *tznames; + /**< This will be set to a combination of the TZNAME properties + from the last STANDARD and DAYLIGHT components in the + VTIMEZONE, e.g. "EST/EDT". If they both use the same TZNAME, + or only one type of component is found, then only one TZNAME + will appear, e.g. "AZOT". If no TZNAME is found this will be + NULL. */ + + double latitude; + double longitude; + /**< The coordinates of the city, in degrees. */ + + icalcomponent *component; + /**< The toplevel VTIMEZONE component loaded from the .ics file for this + timezone. If we need to regenerate the changes data we need this. */ + + icaltimezone *builtin_timezone; + /**< If this is not NULL it points to the builtin icaltimezone + that the above TZID refers to. This icaltimezone should be used + instead when accessing the timezone changes data, so that the + expanded timezone changes data is shared between calendar + components. */ + + int end_year; + /**< This is the last year for which we have expanded the data to. + If we need to calculate a date past this we need to expand the + timezone component data from scratch. */ + + icalarray *changes; + /**< A dynamically-allocated array of time zone changes, sorted by the + time of the change in local time. So we can do fast binary-searches + to convert from local time to UTC. */ +}; + + + +#endif /*ICALTIMEZONE_IMPL*/ diff --git a/src/libical/icaltypes.c b/src/libical/icaltypes.c index 2debac4..8ce5d1d 100644 --- a/src/libical/icaltypes.c +++ b/src/libical/icaltypes.c @@ -36,13 +36,19 @@ #include <string.h> /* for icalmemory_strdup */ #include <assert.h> -#ifdef WIN32 -#define snprintf _snprintf -#define strcasecmp stricmp +#if defined(_MSC_VER) +#define snprintf _snprintf +#define strcasecmp stricmp #endif #define TEMP_MAX 1024 +#ifdef HAVE_PTHREAD + #include <pthread.h> + static pthread_mutex_t unk_token_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif + +static ical_unknown_token_handling unknownTokenHandling = ICAL_TREAT_AS_ERROR; int icaltriggertype_is_null_trigger(struct icaltriggertype tr) { @@ -77,16 +83,13 @@ struct icaltriggertype icaltriggertype_from_string(const char* str) { - struct icaltriggertype tr, null_tr; + struct icaltriggertype tr; icalerrorstate es = ICAL_ERROR_DEFAULT; icalerrorenum e; tr.time= icaltime_null_time(); tr.duration = icaldurationtype_from_int(0); - null_tr = tr; - - /* Suppress errors so a failure in icaltime_from_string() does not cause an abort */ es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR); if(str == 0) goto error; @@ -178,9 +181,9 @@ char* icalreqstattype_as_string_r(struct icalreqstattype stat) { char *temp; - temp = (char*)icalmemory_new_buffer(TEMP_MAX); - icalerror_check_arg_rz((stat.code != ICAL_UNKNOWN_STATUS),"Status"); + + temp = (char*)icalmemory_new_buffer(TEMP_MAX); if (stat.desc == 0){ stat.desc = icalenum_reqstat_desc(stat.code); @@ -199,3 +202,35 @@ char* icalreqstattype_as_string_r(struct icalreqstattype stat) return temp; } + +ical_unknown_token_handling ical_get_unknown_token_handling_setting(void) +{ + ical_unknown_token_handling myHandling; + +#ifdef HAVE_PTHREAD + pthread_mutex_lock (&unk_token_mutex); +#endif + + myHandling = unknownTokenHandling; + +#ifdef HAVE_PTHREAD + pthread_mutex_unlock (&unk_token_mutex); +#endif + + return myHandling; +} + +void ical_set_unknown_token_handling_setting(ical_unknown_token_handling newSetting) +{ + +#ifdef HAVE_PTHREAD + pthread_mutex_lock (&unk_token_mutex); +#endif + + unknownTokenHandling = newSetting; + +#ifdef HAVE_PTHREAD + pthread_mutex_unlock (&unk_token_mutex); +#endif + +} diff --git a/src/libical/icaltypes.h b/src/libical/icaltypes.h index 2f0e6f6..b1629c2 100644 --- a/src/libical/icaltypes.h +++ b/src/libical/icaltypes.h @@ -34,8 +34,8 @@ struct icalgeotype { - float lat; - float lon; + double lat; + double lon; }; @@ -67,7 +67,7 @@ don't use it after the original string has been freed. BTW, you would get that original string from *icalproperty_get_requeststatus() or icalvalue_get_text(), when -operating on a the value of a request_status property. */ +operating on the value of a request_status property. */ struct icalreqstattype { @@ -105,5 +105,18 @@ struct icaltimezonetype { void icaltimezonetype_free(struct icaltimezonetype tzt); +/* ical_unknown_token_handling : + * How should the ICAL library handle components, properties and parameters with + * unknown names? + * FIXME: Currently only affects parameters. Extend to components and properties. + */ +typedef enum ical_unknown_token_handling { + ICAL_ASSUME_IANA_TOKEN = 1, + ICAL_DISCARD_TOKEN = 2, + ICAL_TREAT_AS_ERROR = 3 +} ical_unknown_token_handling; + +ical_unknown_token_handling ical_get_unknown_token_handling_setting(void); +void ical_set_unknown_token_handling_setting(ical_unknown_token_handling newSetting); #endif /* !ICALTYPES_H */ diff --git a/src/libical/icaltz-util.c b/src/libical/icaltz-util.c index d999457..adf7598 100644 --- a/src/libical/icaltz-util.c +++ b/src/libical/icaltz-util.c @@ -25,12 +25,20 @@ #endif #include <string.h> +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif + #if defined(sun) && defined(__SVR4) +#include <sys/types.h> #include <sys/byteorder.h> #else # ifdef HAVE_BYTESWAP_H # include <byteswap.h> # endif +# ifdef HAVE_ENDIAN_H +# include <endian.h> +# else # ifdef HAVE_SYS_ENDIAN_H # include <sys/endian.h> # ifdef bswap32 @@ -39,12 +47,10 @@ # define bswap_32 swap32 # endif # endif -# ifdef HAVE_ENDIAN_H -# include <endian.h> -# endif +# endif #endif -#ifdef WIN32 +#ifdef _MSC_VER #if !defined(HAVE_BYTESWAP_H) && !defined(HAVE_SYS_ENDIAN_H) && !defined(HAVE_ENDIAN_H) #define bswap_16(x) (((x) << 8) & 0xff00) | (((x) >> 8 ) & 0xff) #define bswap_32(x) (((x) << 24) & 0xff000000) \ @@ -63,6 +69,12 @@ #include <io.h> #endif +#if defined(__APPLE__) +#define bswap_16(x) (((x) << 8) & 0xff00) | (((x) >> 8 ) & 0xff) +#define bswap_32 __builtin_bswap32 +#define bswap_64 __builtin_bswap64 +#endif + #ifndef PATH_MAX #define PATH_MAX 512 #endif @@ -176,42 +188,8 @@ zname_from_stridx (char *str, long int idx) return ret; } -static void -find_transidx (time_t *transitions, ttinfo *types, int *trans_idx, long int num_trans, int *stdidx, int *dstidx) -{ - time_t now = time (NULL); - int i, found = 0, idx; - - for (i = 0; i < num_trans; i++) { - if (now < transitions [i]) { - found = 1; - break; - } - } - - /* If the transition time is not found, it means the timezone does not have the dst changes */ - if (!found) { - *stdidx = i -1; - return; - } - - idx = trans_idx [i]; - types [idx].isdst ? (*dstidx = i) : (*stdidx = i); - - if (i < num_trans - 1) - i++; - else - return; - - idx = trans_idx [i]; - types [idx].isdst ? (*dstidx = i) : (*stdidx = i); - - return; -} - - static void -set_zone_directory (void) +set_zonedir (void) { char file_path[PATH_MAX]; const char *fname = ZONES_TAB_SYSTEM_FILENAME; @@ -231,7 +209,7 @@ const char * icaltzutil_get_zone_directory (void) { if (!zdir) - set_zone_directory (); + set_zonedir (); return zdir; } @@ -257,24 +235,28 @@ icaltzutil_fetch_timezone (const char *location) int ret = 0; FILE *f; tzinfo type_cnts; - unsigned int num_trans, num_types, num_chars, num_leaps, num_isstd, num_isgmt; + unsigned int i, num_trans, num_types, num_chars, num_leaps, num_isstd, num_isgmt; time_t *transitions = NULL; - time_t trans; - int *trans_idx = NULL, dstidx = -1, stdidx = -1, pos, sign, zidx, zp_idx, i; + time_t trans, start, end; + int *trans_idx = NULL, pos, sign, zidx, zp_idx, idx, prev_idx; ttinfo *types = NULL; char *znames = NULL, *full_path, *tzid, *r_trans, *temp; leap *leaps = NULL; - icalcomponent *tz_comp = NULL, *dst_comp = NULL, *std_comp = NULL; + icalcomponent *tz_comp = NULL, *comp = NULL; icalproperty *icalprop; icaltimetype dtstart, icaltime; struct icalrecurrencetype ical_recur; + const char *basedir; - if (!zdir) - set_zone_directory (); - - full_path = (char *) malloc (strlen (zdir) + strlen (location) + 2); - sprintf (full_path,"%s/%s",zdir, location); - + basedir = icaltzutil_get_zone_directory(); + if (!basedir) { + icalerror_set_errno (ICAL_FILE_ERROR); + return NULL; + } + + full_path = (char *) malloc (strlen (basedir) + strlen (location) + 2); + sprintf (full_path,"%s/%s",basedir, location); + if ((f = fopen (full_path, "rb")) == 0) { icalerror_set_errno (ICAL_FILE_ERROR); free (full_path); @@ -319,7 +301,10 @@ icaltzutil_fetch_timezone (const char *location) EFREAD(a, 4, 1, f); c = fgetc (f); types [i].isdst = c; - c = fgetc (f); + if((c = fgetc (f)) < 0) { + c = 0; + break; + } types [i].abbr = c; types [i].gmtoff = decode (a); } @@ -361,11 +346,6 @@ icaltzutil_fetch_timezone (const char *location) for (i = 0; i < num_types; i++) types [i].zname = zname_from_stridx (znames, types [i].abbr); - if (num_trans != 0) - find_transidx (transitions, types, trans_idx, num_trans, &stdidx, &dstidx); - else - stdidx = 0; - tz_comp = icalcomponent_new (ICAL_VTIMEZONE_COMPONENT); /* Add tzid property */ @@ -378,83 +358,54 @@ icaltzutil_fetch_timezone (const char *location) icalprop = icalproperty_new_x (location); icalproperty_set_x_name (icalprop, "X-LIC-LOCATION"); icalcomponent_add_property (tz_comp, icalprop); - - if (stdidx != -1) { - if (num_trans != 0) - zidx = trans_idx [stdidx]; - else - zidx = 0; - - std_comp = icalcomponent_new (ICAL_XSTANDARD_COMPONENT); - icalprop = icalproperty_new_tzname (types [zidx].zname); - icalcomponent_add_property (std_comp, icalprop); - - trans = transitions [stdidx] + types [zidx].gmtoff; - icaltime = icaltime_from_timet (trans, 0); - dtstart = icaltime; - dtstart.year = 1970; - dtstart.minute = dtstart.second = 0; - icalprop = icalproperty_new_dtstart (dtstart); - icalcomponent_add_property (std_comp, icalprop); - - /* If DST changes are present use RRULE */ - if (dstidx != -1) { - zp_idx = trans_idx [stdidx-1]; - icalrecurrencetype_clear (&ical_recur); - ical_recur.freq = ICAL_YEARLY_RECURRENCE; - ical_recur.by_month [0] = icaltime.month; - pos = calculate_pos (icaltime); - pos < 0 ? (sign = -1): (sign = 1); - ical_recur.by_day [0] = sign * ((abs (pos) * 8) + icaltime_day_of_week (icaltime)); - icalprop = icalproperty_new_rrule (ical_recur); - icalcomponent_add_property (std_comp, icalprop); - - icalprop = icalproperty_new_tzoffsetfrom (types [zp_idx].gmtoff); - icalcomponent_add_property (std_comp, icalprop); - } else { - icalprop = icalproperty_new_tzoffsetfrom (types [zidx].gmtoff); - icalcomponent_add_property (std_comp, icalprop); - } - icalprop = icalproperty_new_tzoffsetto (types [zidx].gmtoff); - icalcomponent_add_property (std_comp, icalprop); - - icalcomponent_add_component (tz_comp, std_comp); - } else - icalerror_set_errno (ICAL_MALFORMEDDATA_ERROR); - - if (dstidx != -1) { - zidx = trans_idx [dstidx]; - zp_idx = trans_idx [dstidx-1]; - dst_comp = icalcomponent_new (ICAL_XDAYLIGHT_COMPONENT); - icalprop = icalproperty_new_tzname (types [zidx].zname); - icalcomponent_add_property (dst_comp, icalprop); - - trans = transitions [dstidx] + types [zidx].gmtoff; - icaltime = icaltime_from_timet (trans, 0); - dtstart = icaltime; - dtstart.year = 1970; - dtstart.minute = dtstart.second = 0; + prev_idx = 0; + if (num_trans == 0) { + prev_idx = idx = 0; + + } else { + idx = trans_idx[0]; + } + start = 0; + for (i = 1; i < num_trans; i++, start = end) { + prev_idx = idx; + idx = trans_idx [i]; + end = transitions [i] + types [prev_idx].gmtoff; + /* don't bother starting until the epoch */ + if (0 > end) + continue; + + if (types [prev_idx].isdst) + comp = icalcomponent_new (ICAL_XDAYLIGHT_COMPONENT); + else + comp = icalcomponent_new (ICAL_XSTANDARD_COMPONENT); + icalprop = icalproperty_new_tzname (types [prev_idx].zname); + icalcomponent_add_property (comp, icalprop); + dtstart = icaltime_from_timet(start, 0); icalprop = icalproperty_new_dtstart (dtstart); - icalcomponent_add_property (dst_comp, icalprop); - - icalrecurrencetype_clear (&ical_recur); - ical_recur.freq = ICAL_YEARLY_RECURRENCE; - ical_recur.by_month [0] = icaltime.month; - pos = calculate_pos (icaltime); - pos < 0 ? (sign = -1): (sign = 1); - ical_recur.by_day [0] = sign * ((abs (pos) * 8) + icaltime_day_of_week (icaltime)); - icalprop = icalproperty_new_rrule (ical_recur); - icalcomponent_add_property (dst_comp, icalprop); - - icalprop = icalproperty_new_tzoffsetfrom (types [zp_idx].gmtoff); - icalcomponent_add_property (dst_comp, icalprop); - - icalprop = icalproperty_new_tzoffsetto (types [zidx].gmtoff); - icalcomponent_add_property (dst_comp, icalprop); - - icalcomponent_add_component (tz_comp, dst_comp); + icalcomponent_add_property (comp, icalprop); + icalprop = icalproperty_new_tzoffsetfrom (types [idx].gmtoff); + icalcomponent_add_property (comp, icalprop); + icalprop = icalproperty_new_tzoffsetto (types [prev_idx].gmtoff); + icalcomponent_add_property (comp, icalprop); + icalcomponent_add_component (tz_comp, comp); } + /* finally, add a last zone with no end date */ + if (types [idx].isdst) + comp = icalcomponent_new (ICAL_XDAYLIGHT_COMPONENT); + else + comp = icalcomponent_new (ICAL_XSTANDARD_COMPONENT); + icalprop = icalproperty_new_tzname (types [idx].zname); + icalcomponent_add_property (comp, icalprop); + dtstart = icaltime_from_timet(start, 0); + icalprop = icalproperty_new_dtstart (dtstart); + icalcomponent_add_property (comp, icalprop); + icalprop = icalproperty_new_tzoffsetfrom (types [prev_idx].gmtoff); + icalcomponent_add_property (comp, icalprop); + icalprop = icalproperty_new_tzoffsetto (types [idx].gmtoff); + icalcomponent_add_property (comp, icalprop); + icalcomponent_add_component (tz_comp, comp); + error: if (f) diff --git a/src/libical/icalvalue.c b/src/libical/icalvalue.c index bad30e2..63a0121 100644 --- a/src/libical/icalvalue.c +++ b/src/libical/icalvalue.c @@ -50,9 +50,9 @@ #include <locale.h> #include <ctype.h> /* for isspace and isdigit */ -#ifdef WIN32 -#define snprintf _snprintf -#define strcasecmp stricmp +#if defined(_MSC_VER) +#define snprintf _snprintf +#define strcasecmp stricmp #endif #if _MAC_OS_ @@ -136,18 +136,37 @@ icalvalue* icalvalue_new_clone(const icalvalue* old) { new->data.v_string=icalmemory_strdup(old->data.v_string); if ( new->data.v_string == 0 ) { + icalvalue_free(new); return 0; } } break; } + case ICAL_ACTION_VALUE: + { + new->data = old->data; + + if (old->data.v_enum == ICAL_ACTION_X) { + //preserve the custom action string + if (old->x_value != 0) { + new->x_value = icalmemory_strdup(old->x_value); + + if (new->x_value == 0) { + icalvalue_free(new); + return 0; + } + } + } + break; + } case ICAL_RECUR_VALUE: { if(old->data.v_recur != 0){ new->data.v_recur = malloc(sizeof(struct icalrecurrencetype)); if(new->data.v_recur == 0){ + icalvalue_free(new); return 0; } @@ -163,6 +182,7 @@ icalvalue* icalvalue_new_clone(const icalvalue* old) { new->x_value=icalmemory_strdup(old->x_value); if (new->x_value == 0) { + icalvalue_free(new); return 0; } } @@ -187,6 +207,7 @@ static char* icalmemory_strdup_and_dequote(const char* str) const char* p; char* out = (char*)malloc(sizeof(char) * strlen(str) +1); char* pout; + int wroteNull = 0; if (out == 0){ return 0; @@ -194,7 +215,11 @@ static char* icalmemory_strdup_and_dequote(const char* str) pout = out; - for (p = str; *p!=0; p++){ + /* Stop the loop when encountering a terminator in the source string + or if a null has been written to the destination. This prevents + reading past the end of the source string if the last character + is a backslash. */ + for (p = str; !wroteNull && *p!=0; p++){ if( *p == '\\') { @@ -202,6 +227,7 @@ static char* icalmemory_strdup_and_dequote(const char* str) switch(*p){ case 0: { + wroteNull = 1; //stops iteration so p isn't incremented past the end of str *pout = '\0'; break; @@ -263,6 +289,84 @@ static char* icalmemory_strdup_and_dequote(const char* str) } /* + * Returns a quoted copy of a string + * @todo This is not RFC2445 compliant. + * The RFC only allows: + * TSAFE-CHAR = %x20-21 / %x23-2B / %x2D-39 / %x3C-5B / %x5D-7E / NON-US-ASCII + * As such, \t\r\b\f are not allowed, not even escaped + */ +static char* icalmemory_strdup_and_quote(const icalvalue* value, + const char* unquoted_str) +{ + char *str; + char *str_p; + const char *p; + size_t buf_sz; + + buf_sz = strlen(unquoted_str)+1; + + str_p = str = (char*)icalmemory_new_buffer(buf_sz); + + if (str_p == 0){ + return 0; + } + + for(p=unquoted_str; *p!=0; p++){ + + switch(*p){ + case '\n': { + icalmemory_append_string(&str,&str_p,&buf_sz,"\\n"); + break; + } + + case '\t': { + icalmemory_append_string(&str,&str_p,&buf_sz,"\\t"); + break; + } + case '\r': { + icalmemory_append_string(&str,&str_p,&buf_sz,"\\r"); + break; + } + case '\b': { + icalmemory_append_string(&str,&str_p,&buf_sz,"\\b"); + break; + } + case '\f': { + icalmemory_append_string(&str,&str_p,&buf_sz,"\\f"); + break; + } + + case ';': + case ',': + /* unescaped COMMA is allowed in CATEGORIES property as its + considered a list delimiter here, see: + http://tools.ietf.org/html/rfc2445#section-4.3.11 */ + if (icalproperty_isa(value->parent) == ICAL_CATEGORIES_PROPERTY) { + icalmemory_append_char(&str,&str_p,&buf_sz,*p); + break; + } + case '"': + case '\\': { + icalmemory_append_char(&str,&str_p,&buf_sz,'\\'); + icalmemory_append_char(&str,&str_p,&buf_sz,*p); + break; + } + + default: { + icalmemory_append_char(&str,&str_p,&buf_sz,*p); + } + } + } + + /* Assume the last character is not a '\0' and add one. We could + check *str_p != 0, but that would be an uninitialized memory + read. */ + + icalmemory_append_char(&str,&str_p,&buf_sz,'\0'); + return str; +} + +/* * FIXME * * This is a bad API, as it forces callers to specify their own X type. @@ -297,14 +401,16 @@ icalvalue* icalvalue_new_enum(icalvalue_kind kind, int x_type, const char* str) * If you want a code that that does the same job with a decimal separator * dependant on the current locale, then use strtof() from libc. */ -int simple_str_to_float(const char* from, - float *result, - char** to) +int simple_str_to_double(const char* from, + double *result, + char** to) { #define TMP_NUM_SIZE 100 char *start=NULL, *end=NULL, *cur=(char*)from ; char tmp_buf[TMP_NUM_SIZE+1] ; /*hack*/ +#ifndef _WIN32_WCE struct lconv *loc_data = localeconv () ; +#endif int i=0 ; /*sanity checks*/ @@ -335,12 +441,13 @@ int simple_str_to_float(const char* from, return 1 ; } memset(tmp_buf, 0, TMP_NUM_SIZE+1) ; - i=0 ; + /* * copy the float number string into tmp_buf, and take * care to have the (optional) decimal separator be the one * of the current locale. */ +#ifndef _WIN32_WCE for (i=0 ; i < end - from ;++i) { if (start[i] == '.' && loc_data @@ -353,6 +460,9 @@ int simple_str_to_float(const char* from, tmp_buf[i] = start[i] ; } } +#else + GetNumberFormat(LOCALE_SYSTEM_DEFAULT,0,start, NULL, tmp_buf,TMP_NUM_SIZE); +#endif if (to) *to = end ; *result = atof(tmp_buf) ; @@ -388,7 +498,7 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* case ICAL_BINARY_VALUE: { icalattach *attach; - attach = icalattach_new_from_data ((unsigned char*)str, 0, 0); + attach = icalattach_new_from_data (str, 0, 0); if ( !attach ) break; value = icalvalue_new_attach (attach); @@ -495,7 +605,7 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* char *cur=NULL ; struct icalgeotype geo = {0.0, 0.0}; - if (simple_str_to_float (str, &geo.lat, &cur)) { + if (simple_str_to_double (str, &geo.lat, &cur)) { goto geo_parsing_error ; } @@ -518,7 +628,7 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* ++cur ; } - if (simple_str_to_float (cur, &geo.lon, &cur)) { + if (simple_str_to_double (cur, &geo.lon, &cur)) { goto geo_parsing_error ; } value = icalvalue_new_geo (geo) ; @@ -706,6 +816,7 @@ icalvalue_free (icalvalue* v) case ICAL_TEXT_VALUE: case ICAL_CALADDRESS_VALUE: case ICAL_URI_VALUE: + case ICAL_STRING_VALUE: case ICAL_QUERY_VALUE: { if (v->data.v_string != 0) { @@ -766,9 +877,10 @@ static char* icalvalue_binary_as_ical_string_r(const icalvalue* value) { static char* icalvalue_int_as_ical_string_r(const icalvalue* value) { int data; - char* str = (char*)icalmemory_new_buffer(MAX_INT_DIGITS); + char* str; icalerror_check_arg_rz( (value!=0),"value"); + str = (char*)icalmemory_new_buffer(MAX_INT_DIGITS); data = icalvalue_get_integer(value); @@ -782,10 +894,11 @@ static char* icalvalue_utcoffset_as_ical_string_r(const icalvalue* value) { int data,h,m,s; char sign; - char* str = (char*)icalmemory_new_buffer(9); + char* str; icalerror_check_arg_rz( (value!=0),"value"); + str = (char*)icalmemory_new_buffer(9); data = icalvalue_get_utcoffset(value); if (abs(data) == data){ @@ -827,81 +940,8 @@ static char* icalvalue_recur_as_ical_string_r(const icalvalue* value) return icalrecurrencetype_as_string_r(recur); } - /* @todo This is not RFC2445 compliant. - * The RFC only allows: - * TSAFE-CHAR = %x20-21 / %x23-2B / %x2D-39 / %x3C-5B / %x5D-7E / NON-US-ASCII - * As such, \t\r\b\f are not allowed, not even escaped - */ - static char* icalvalue_text_as_ical_string_r(const icalvalue* value) { - char *str; - char *str_p; - const char *p; - size_t buf_sz; - - buf_sz = strlen(value->data.v_string)+1; - - str_p = str = (char*)icalmemory_new_buffer(buf_sz); - - if (str_p == 0){ - return 0; - } - - for(p=value->data.v_string; *p!=0; p++){ - - switch(*p){ - case '\n': { - icalmemory_append_string(&str,&str_p,&buf_sz,"\\n"); - break; - } - - case '\t': { - icalmemory_append_string(&str,&str_p,&buf_sz,"\\t"); - break; - } - case '\r': { - icalmemory_append_string(&str,&str_p,&buf_sz,"\\r"); - break; - } - case '\b': { - icalmemory_append_string(&str,&str_p,&buf_sz,"\\b"); - break; - } - case '\f': { - icalmemory_append_string(&str,&str_p,&buf_sz,"\\f"); - break; - } - - case ';': - case ',': - case '"': - case '\\':{ - icalmemory_append_char(&str,&str_p,&buf_sz,'\\'); - icalmemory_append_char(&str,&str_p,&buf_sz,*p); - break; - } - - default: { - icalmemory_append_char(&str,&str_p,&buf_sz,*p); - } - } - } - - /* Assume the last character is not a '\0' and add one. We could - check *str_p != 0, but that would be an uninitialized memory - read. */ - - - icalmemory_append_char(&str,&str_p,&buf_sz,'\0'); - return str; -} - - -static char* icalvalue_text_as_ical_string(const icalvalue* value) { - char *buf; - buf = icalvalue_text_as_ical_string_r(value); - icalmemory_add_tmp_buffer(buf); - return buf; + return icalmemory_strdup_and_quote(value, value->data.v_string); } @@ -1035,13 +1075,24 @@ static char* icalvalue_float_as_ical_string_r(const icalvalue* value) { float data; char* str; + char* old_locale; icalerror_check_arg_rz( (value!=0),"value"); data = icalvalue_get_float(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)); + setlocale (LC_NUMERIC,"C"); + str = (char*)icalmemory_new_buffer(40); snprintf(str,40,"%f",data); + /* restore saved locale */ + setlocale (LC_NUMERIC,old_locale); + free (old_locale); + return str; } @@ -1050,14 +1101,25 @@ static char* icalvalue_geo_as_ical_string_r(const icalvalue* value) { struct icalgeotype data; char* str; + char* old_locale; icalerror_check_arg_rz( (value!=0),"value"); data = icalvalue_get_geo(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)); + setlocale (LC_NUMERIC,"C"); + str = (char*)icalmemory_new_buffer(80); snprintf(str,80,"%f;%f",data.lat,data.lon); + /* restore saved locale */ + setlocale (LC_NUMERIC,old_locale); + free (old_locale); + return str; } @@ -1186,7 +1248,7 @@ icalvalue_as_ical_string_r(const icalvalue* value) case ICAL_X_VALUE: if (value->x_value != 0) - return icalmemory_strdup(value->x_value); + return icalmemory_strdup_and_quote(value,value->x_value); /* FALLTHRU */ diff --git a/src/libical/icalvalue.h b/src/libical/icalvalue.h index f35261e..4105762 100644 --- a/src/libical/icalvalue.h +++ b/src/libical/icalvalue.h @@ -63,18 +63,19 @@ icalparameter_xliccomparetype icalvalue_compare(const icalvalue* a, const icalva /* Special, non autogenerated value accessors */ -icalvalue* icalvalue_new_recur (struct icalrecurrencetype v); -void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v); -struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value); - -icalvalue* icalvalue_new_trigger (struct icaltriggertype v); -void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); -struct icaltriggertype icalvalue_get_trigger(const icalvalue* value); - -icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); -void icalvalue_set_datetimeperiod(icalvalue* value, - struct icaldatetimeperiodtype v); -struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value); +/* Defined in icalderivedvalue.h */ +/* icalvalue* icalvalue_new_recur (struct icalrecurrencetype v); */ +/* void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v); */ +/* struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value); */ + +/* icalvalue* icalvalue_new_trigger (struct icaltriggertype v); */ +/* void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); */ +/* struct icaltriggertype icalvalue_get_trigger(const icalvalue* value); */ + +/* icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); */ +/* void icalvalue_set_datetimeperiod(icalvalue* value, */ +/* struct icaldatetimeperiodtype v); */ +/* struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value); */ /* Convert enumerations */ diff --git a/src/libical/vsnprintf.c b/src/libical/libicals_w32_vsnprintf_replacement.c index cb416bc..8cb9817 100644 --- a/src/libical/vsnprintf.c +++ b/src/libical/libicals_w32_vsnprintf_replacement.c @@ -1,8 +1,8 @@ -#ifndef WIN32 +#ifdef WIN32 #include "config.h" -#endif #ifndef HAVE_SNPRINTF #error DO NOT USE libical version of vsnprintf. +#endif /* * Revision 12: http://theos.com/~deraadt/snprintf.c * diff --git a/src/libical/pvl.c b/src/libical/pvl.c index d663eaa..23c69a8 100644 --- a/src/libical/pvl.c +++ b/src/libical/pvl.c @@ -5,6 +5,18 @@ (C) COPYRIGHT 2000, Eric Busboom <eric@softwarestudio.org> http://www.softwarestudio.org + + 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: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + ======================================================================*/ #ifdef HAVE_CONFIG_H diff --git a/src/libical/pvl.h b/src/libical/pvl.h index c009846..77c0531 100644 --- a/src/libical/pvl.h +++ b/src/libical/pvl.h @@ -5,6 +5,18 @@ (C) COPYRIGHT 2000, Eric Busboom <eric@softwarestudio.org> http://www.softwarestudio.org + + 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: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + ======================================================================*/ diff --git a/src/libical/sspm.c b/src/libical/sspm.c index 19ba011..b2b1dc2 100644 --- a/src/libical/sspm.c +++ b/src/libical/sspm.c @@ -46,9 +46,9 @@ #include "dmalloc.h" #endif -#ifdef WIN32 -#define snprintf _snprintf -#define strcasecmp stricmp +#if defined(_MSC_VER) +#define snprintf _snprintf +#define strcasecmp stricmp #endif #define TMP_BUF_SIZE 1024 @@ -181,7 +181,8 @@ char* sspm_get_parameter(const char* line, const char* parameter) if(s != 0){ strncpy(name,p,(size_t)s-(size_t)p); } else { - strcpy(name,p); + strncpy(name,p,sizeof(name)-1); + name[sizeof(name)-1]='\0'; } /* Strip off trailing quote, if it exists */ @@ -252,7 +253,7 @@ static const char *mime_headers[] = { }; -void* sspm_default_new_part() +void* sspm_default_new_part(void) { return 0; } @@ -472,6 +473,7 @@ enum sspm_minor_type sspm_find_minor_content_type(char* type) char *p = strchr(ltype,'/'); if (p==0){ + free(ltype); return SSPM_UNKNOWN_MINOR_TYPE; } @@ -1594,7 +1596,7 @@ int sspm_write_mime(struct sspm_part *parts,size_t num_parts, { struct sspm_buffer buf; int part_num =0; - int slen; + size_t slen; (void)num_parts; buf.buffer = malloc(4096); diff --git a/src/libical/sspm.h b/src/libical/sspm.h index 3dac371..fad0bb6 100644 --- a/src/libical/sspm.h +++ b/src/libical/sspm.h @@ -111,7 +111,7 @@ struct sspm_part { struct sspm_action_map { enum sspm_major_type major; enum sspm_minor_type minor; - void* (*new_part)(); + void* (*new_part)(void); void (*add_line)(void *part, struct sspm_header *header, const char* line, size_t size); void* (*end_part)(void* part); diff --git a/src/libical/vsnprintf.h b/src/libical/vsnprintf.h new file mode 100644 index 0000000..104a53a --- /dev/null +++ b/src/libical/vsnprintf.h @@ -0,0 +1,33 @@ +#ifdef WIN32 + +#ifndef roundup +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) +#endif + +#include <stdlib.h> +#include <stdarg.h> + +int +#if __STDC__ +vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#else +vsnprintf(str, n, fmt, ap); + char *str; + size_t n; + char *fmt; + char *ap; +#endif + + +int +#if __STDC__ +snprintf(char *str, size_t n, char const *fmt, ...); +#else +snprintf(str, n, fmt, va_alist); + char *str; + size_t n; + char *fmt; + va_dcl +#endif + +#endif |