diff options
Diffstat (limited to 'libical/src/libical')
26 files changed, 1597 insertions, 758 deletions
diff --git a/libical/src/libical/Makefile.am b/libical/src/libical/Makefile.am index d9af51bccd..35a08effc7 100644 --- a/libical/src/libical/Makefile.am +++ b/libical/src/libical/Makefile.am @@ -30,9 +30,16 @@ libical_a_SOURCES = \ icaltypes.h \ icalvalue.c \ icalvalue.h \ - icalvcal.h \ + icalrecur.c \ + icalrecur.h \ + icaltime.h \ + icaltime.c \ pvl.c \ - pvl.h + pvl.h \ + sspm.c \ + sspm.h \ + icalmime.c \ + icalmime.h include_HEADERS=\ ical.h \ @@ -46,9 +53,12 @@ include_HEADERS=\ icalrestriction.h \ icaltypes.h \ icalvalue.h \ - icalvcal.h \ + icalrecur.h \ icalversion.h \ - pvl.h + icaltime.h \ + pvl.h \ + sspm.h \ + icalmime.h # diff --git a/libical/src/libical/ical.h b/libical/src/libical/ical.h index d0f33cd1a1..05e7ca82bc 100644 --- a/libical/src/libical/ical.h +++ b/libical/src/libical/ical.h @@ -4,20 +4,19 @@ CREATOR: eric 20 March 1999 - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (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/ + The original code is ical.h ======================================================================*/ @@ -36,6 +35,14 @@ #include "icalmemory.h" #include "icalerror.h" #include "icalrestriction.h" +#include "icaltime.h" +#include "icalrecur.h" + +#ifdef DMALLOC +#include "dmalloc.h" +#endif + + #endif /* !ICAL_H */ diff --git a/libical/src/libical/icalcomponent.c b/libical/src/libical/icalcomponent.c index bd2b13189c..52c2088140 100644 --- a/libical/src/libical/icalcomponent.c +++ b/libical/src/libical/icalcomponent.c @@ -1,25 +1,22 @@ -/* -*- Mode: C -*- */ /*====================================================================== FILE: icalcomponent.c CREATOR: eric 28 April 1999 $Id$ + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - (C) COPYRIGHT 1999 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 contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + The 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 author is Eric Busboom The original code is icalcomponent.c ======================================================================*/ @@ -154,6 +151,7 @@ icalcomponent* icalcomponent_new_clone(icalcomponent* component) struct icalcomponent_impl *new; icalproperty *p; icalcomponent *c; + pvl_elem itr; icalerror_check_arg_rv( (component!=0), "component"); @@ -164,20 +162,22 @@ icalcomponent* icalcomponent_new_clone(icalcomponent* component) } - for(p = icalcomponent_get_first_property(old,ICAL_ANY_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(old,ICAL_ANY_PROPERTY)){ - - icalcomponent_add_property(new,icalproperty_new_clone(p)); - } + for( itr = pvl_head(old->properties); + itr != 0; + itr = pvl_next(itr)) + { + p = (icalproperty*)pvl_data(itr); + icalcomponent_add_property(new,icalproperty_new_clone(p)); + } - for(c = icalcomponent_get_first_component(old,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(old,ICAL_ANY_COMPONENT)){ - - icalcomponent_add_component(new,icalcomponent_new_clone(c)); - } + for( itr = pvl_head(old->components); + itr != 0; + itr = pvl_next(itr)) + { + c = (icalcomponent*)pvl_data(itr); + icalcomponent_add_component(new,icalcomponent_new_clone(c)); + } return new; @@ -242,6 +242,8 @@ icalcomponent_as_ical_string (icalcomponent* component) char* tmp_buf; size_t buf_size = 1024; char* buf_ptr = 0; + pvl_elem itr; + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; #ifdef ICAL_UNIX_NEWLINE char newline[] = "\n"; @@ -270,22 +272,28 @@ icalcomponent_as_ical_string (icalcomponent* component) icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); - for(p = icalcomponent_get_first_property(component,ICAL_ANY_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(component,ICAL_ANY_PROPERTY)){ - tmp_buf = icalproperty_as_ical_string(p); - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf); - } + for( itr = pvl_head(impl->properties); + itr != 0; + itr = pvl_next(itr)) + { + p = (icalproperty*)pvl_data(itr); + + icalerror_assert((p!=0),"Got a null property"); + tmp_buf = icalproperty_as_ical_string(p); + + icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf); + } - for(c = icalcomponent_get_first_component(component,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(component,ICAL_ANY_COMPONENT)){ + for( itr = pvl_head(impl->components); + itr != 0; + itr = pvl_next(itr)) + { + c = (icalcomponent*)pvl_data(itr); tmp_buf = icalcomponent_as_ical_string(c); - + icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf); } @@ -423,17 +431,23 @@ icalcomponent_remove_property (icalcomponent* component, icalproperty* property) } int -icalcomponent_count_properties (icalcomponent* component, icalproperty_kind kind) +icalcomponent_count_properties (icalcomponent* component, + icalproperty_kind kind) { int count=0; - icalproperty *p; + pvl_elem itr; + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; + icalerror_check_arg_rz( (component!=0), "component"); - for(p = icalcomponent_get_first_property(component,kind); - p != 0; - p = icalcomponent_get_next_property(component,kind)){ - - count++; + for( itr = pvl_head(impl->properties); + itr != 0; + itr = pvl_next(itr)) + { + if(kind == icalproperty_isa((icalproperty*)pvl_data(itr)) || + kind == ICAL_ANY_PROPERTY){ + count++; + } } @@ -545,30 +559,42 @@ icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child) if( pvl_data(itr) == (void*)child ){ if (impl->component_iterator == itr){ - /* impl->component_iterator = pvl_next(itr);*/ + /* Don't let the current iterator become invalid */ + + /* HACK. The semantics for this are troubling. */ + impl->component_iterator = + pvl_next(impl->component_iterator); + } pvl_remove( impl->components, itr); cimpl->parent = 0; + break; } } } int -icalcomponent_count_components (icalcomponent* component, icalcomponent_kind kind) +icalcomponent_count_components (icalcomponent* component, + icalcomponent_kind kind) { int count=0; - icalcomponent *c; + pvl_elem itr; + struct icalcomponent_impl *impl = + (struct iccalcomponent_impl*)component; + icalerror_check_arg_rz( (component!=0), "component"); - for(c = icalcomponent_get_first_component(component,kind); - c != 0; - c = icalcomponent_get_next_component(component,kind)){ - - count++; + for( itr = pvl_head(impl->components); + itr != 0; + itr = pvl_next(itr)) + { + if(kind == icalcomponent_isa((icalcomponent*)pvl_data(itr)) || + kind == ICAL_ANY_COMPONENT){ + count++; + } } - return count; } @@ -646,10 +672,14 @@ int icalcomponent_count_errors(icalcomponent* component) int errors = 0; icalproperty *p; icalcomponent *c; + pvl_elem itr; + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; - for(p = icalcomponent_get_first_property(component,ICAL_ANY_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(component,ICAL_ANY_PROPERTY)){ + for( itr = pvl_head(impl->properties); + itr != 0; + itr = pvl_next(itr)) + { + p = (icalproperty*)pvl_data(itr); if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY) { @@ -657,9 +687,12 @@ int icalcomponent_count_errors(icalcomponent* component) } } - for(c = icalcomponent_get_first_component(component,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(component,ICAL_ANY_COMPONENT)){ + + for( itr = pvl_head(impl->components); + itr != 0; + itr = pvl_next(itr)) + { + c = (icalcomponent*)pvl_data(itr); errors += icalcomponent_count_errors(c); @@ -671,30 +704,34 @@ int icalcomponent_count_errors(icalcomponent* component) void icalcomponent_strip_errors(icalcomponent* component) { - icalproperty *p, *next_p; + icalproperty *p; icalcomponent *c; + pvl_elem itr, next_itr; + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; - for(p = icalcomponent_get_first_property(component,ICAL_ANY_PROPERTY); - p != 0; - p = next_p){ - - next_p = icalcomponent_get_next_property(component,ICAL_ANY_PROPERTY); + for( itr = pvl_head(impl->properties); + itr != 0; + itr = next_itr) + { + p = (icalproperty*)pvl_data(itr); + next_itr = pvl_next(itr); if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY) { icalcomponent_remove_property(component,p); } } - - for(c = icalcomponent_get_first_component(component,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(component,ICAL_ANY_COMPONENT)){ - + + for( itr = pvl_head(impl->components); + itr != 0; + itr = pvl_next(itr)) + { + c = (icalcomponent*)pvl_data(itr); icalcomponent_strip_errors(c); } } - +/* Hack. This will change the state of the iterators */ void icalcomponent_convert_errors(icalcomponent* component) { icalproperty *p, *next_p; @@ -709,7 +746,6 @@ void icalcomponent_convert_errors(icalcomponent* component) if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY) { struct icalreqstattype rst; - char tmp[MAX_TMP]; icalparameter *param = icalproperty_get_first_parameter (p,ICAL_XLICERRORTYPE_PARAMETER); @@ -779,4 +815,111 @@ void icalcomponent_set_parent(icalcomponent* component, icalcomponent* parent) c->parent = parent; } +icalcompiter icalcompiter_null = {ICAL_NO_COMPONENT,0}; + +icalcompiter +icalcomponent_begin_component(icalcomponent* component,icalcomponent_kind kind) +{ + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; + icalcompiter itr; + pvl_elem i; + + itr.kind = kind; + + icalerror_check_arg_rz( (component!=0),"component"); + + for( i = pvl_head(impl->components); i != 0; i = pvl_next(itr.iter)) { + + icalcomponent *c = (icalcomponent*) pvl_data(i); + + if (icalcomponent_isa(c) == kind || kind == ICAL_ANY_COMPONENT) { + + itr.iter = i; + + return itr; + } + } + + return icalcompiter_null;; +} + +icalcompiter +icalcomponent_end_component(icalcomponent* component,icalcomponent_kind kind) +{ + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; + icalcompiter itr; + pvl_elem i; + + itr.kind = kind; + + icalerror_check_arg_rz( (component!=0),"component"); + + for( i = pvl_tail(impl->components); i != 0; i = pvl_prior(i)) { + + icalcomponent *c = (icalcomponent*) pvl_data(i); + + if (icalcomponent_isa(c) == kind || kind == ICAL_ANY_COMPONENT) { + + itr.iter = pvl_next(i); + + return itr; + } + } + + return icalcompiter_null;; +} + + +icalcomponent* icalcompiter_next(icalcompiter* i) +{ + if (i->iter == 0){ + return 0; + } + + for( i->iter = pvl_next(i->iter); + i->iter != 0; + i->iter = pvl_next(i->iter)) { + + icalcomponent *c = (icalcomponent*) pvl_data(i->iter); + + if (icalcomponent_isa(c) == i->kind + || i->kind == ICAL_ANY_COMPONENT) { + + return icalcompiter_deref(i);; + } + } + + return 0; + +} + +icalcomponent* icalcompiter_prior(icalcompiter* i) +{ + if (i->iter == 0){ + return 0; + } + + for( i->iter = pvl_prior(i->iter); + i->iter != 0; + i->iter = pvl_prior(i->iter)) { + + icalcomponent *c = (icalcomponent*) pvl_data(i->iter); + + if (icalcomponent_isa(c) == i->kind + || i->kind == ICAL_ANY_COMPONENT) { + + return icalcompiter_deref(i);; + } + } + return 0; + +} +icalcomponent* icalcompiter_deref(icalcompiter* i) +{ + if(i->iter ==0){ + return 0; + } + + return pvl_data(i->iter); +} diff --git a/libical/src/libical/icalcomponent.h b/libical/src/libical/icalcomponent.h index 8d9f22ca76..b0d1e33630 100644 --- a/libical/src/libical/icalcomponent.h +++ b/libical/src/libical/icalcomponent.h @@ -4,20 +4,19 @@ CREATOR: eric 20 March 1999 - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (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/ + The original code is icalcomponent.h ======================================================================*/ @@ -28,9 +27,19 @@ #include "icalproperty.h" #include "icalvalue.h" #include "icalenums.h" /* defines icalcomponent_kind */ +#include "pvl.h" typedef void icalcomponent; +/* This is exposed so that callers will not have to allocate and + deallocate iterators. Pretend that you can't see it. */ +typedef struct icalcompiter +{ + icalcomponent_kind kind; + pvl_elem iter; + +} icalcompiter; + icalcomponent* icalcomponent_new(icalcomponent_kind kind); icalcomponent* icalcomponent_new_clone(icalcomponent* component); icalcomponent* icalcomponent_new_from_string(char* str); @@ -86,6 +95,20 @@ void icalcomponent_remove_component(icalcomponent* parent, int icalcomponent_count_components(icalcomponent* component, icalcomponent_kind kind); +/* Iteration Routines. There are two forms of iterators, internal and +external. The internal ones came first, and are almost completely +sufficient, but they fail badly when you want to construct a loop that +removes components from the container. + +The internal iterators are deprecated. */ + +/* Using external iterators */ +icalcompiter icalcomponent_begin_component(icalcomponent* component, + icalcomponent_kind kind); + +icalcompiter icalcomponent_end_component(icalcomponent* component, + icalcomponent_kind kind); + /* Iterate through components */ icalcomponent* icalcomponent_get_current_component (icalcomponent* component); @@ -94,6 +117,8 @@ icalcomponent* icalcomponent_get_first_component(icalcomponent* component, icalcomponent* icalcomponent_get_next_component(icalcomponent* component, icalcomponent_kind kind); + + /* Return a null-terminated array of icalproperties*/ icalproperty** icalcomponent_get_component(icalcomponent* component, icalproperty_kind kind); @@ -113,6 +138,14 @@ icalcomponent* icalcomponent_get_parent(icalcomponent* component); void icalcomponent_set_parent(icalcomponent* component, icalcomponent* parent); + + +/* External component iterator */ +icalcomponent* icalcompiter_next(icalcompiter* i); +icalcomponent* icalcompiter_prior(icalcompiter* i); +icalcomponent* icalcompiter_deref(icalcompiter* i); + + #endif /* !ICALCOMPONENT_H */ diff --git a/libical/src/libical/icalenums.c b/libical/src/libical/icalenums.c index 7f0aae6a0e..50d23c8d41 100644 --- a/libical/src/libical/icalenums.c +++ b/libical/src/libical/icalenums.c @@ -5,21 +5,19 @@ $Id$ + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - (C) COPYRIGHT 1999 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 contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + The 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 author is Eric Busboom The original code is icalenum.c ======================================================================*/ @@ -33,7 +31,7 @@ struct icalproperty_kind_map { icalproperty_kind kind; - char name[20]; + char *name; }; static struct icalproperty_kind_map property_map[] = @@ -98,6 +96,10 @@ static struct icalproperty_kind_map property_map[] = /* libical private properties */ { ICAL_XLICERROR_PROPERTY,"X-LIC-ERROR"}, + { ICAL_XLICMIMECONTENTTYPE_PROPERTY,"X-LIC-MIME-CONTENT-TYPE"}, + { ICAL_XLICMIMEENCODING_PROPERTY,"X-LIC-MIME-ENCODING"}, + { ICAL_XLICMIMEOPTINFO_PROPERTY,"X-LIC-MIME-OPT-INFO"}, + { ICAL_XLICMIMECHARSET_PROPERTY,"X-LIC-MIME-CHARSET"}, { ICAL_XLICCLUSTERCOUNT_PROPERTY,"X-LIC-CLUSTERCOUNT"}, /* End of the list */ @@ -287,6 +289,7 @@ static struct icalcomponent_kind_map component_map[] = /* libical private components */ { ICAL_XLICINVALID_COMPONENT, "X-LIC-UNKNOWN" }, + { ICAL_XLICMIMEPART_COMPONENT, "X-LIC-MIME-PART" }, { ICAL_ANY_COMPONENT, "ANY" }, { ICAL_XROOT_COMPONENT, "XROOT" }, diff --git a/libical/src/libical/icalenums.h b/libical/src/libical/icalenums.h index ff7cee486e..ba3137803e 100644 --- a/libical/src/libical/icalenums.h +++ b/libical/src/libical/icalenums.h @@ -1,23 +1,23 @@ + /* -*- Mode: C -*-*/ /*====================================================================== FILE: icalenums.h - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + 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 author is Eric Busboom The original code is icalenums.h Contributions from: @@ -57,7 +57,10 @@ typedef enum icalcomponent_kind { ICAL_VQUERY_COMPONENT, ICAL_VCAR_COMPONENT, ICAL_VCOMMAND_COMPONENT, - ICAL_XLICINVALID_COMPONENT + ICAL_XLICINVALID_COMPONENT, + ICAL_XLICMIMEPART_COMPONENT /* a non-stardard component that mirrors + structure of MIME data */ + } icalcomponent_kind; /*********************************************************************** @@ -126,6 +129,12 @@ typedef enum icalproperty_kind { /* libical private properties */ ICAL_XLICERROR_PROPERTY, ICAL_XLICCLUSTERCOUNT_PROPERTY, + ICAL_XLICMIMECONTENTTYPE_PROPERTY, + ICAL_XLICMIMEENCODING_PROPERTY, + ICAL_XLICMIMECID_PROPERTY, + ICAL_XLICMIMEFILENAME_PROPERTY, + ICAL_XLICMIMECHARSET_PROPERTY, + ICAL_XLICMIMEOPTINFO_PROPERTY, ICAL_NO_PROPERTY /* This must be the last enum, for iteration */ @@ -323,7 +332,9 @@ typedef enum icalparameter_xlicerrortype { ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR, ICAL_XLICERRORTYPE_PROPERTYPARSEERROR, ICAL_XLICERRORTYPE_VALUEPARSEERROR, - ICAL_XLICERRORTYPE_INVALIDITIP + ICAL_XLICERRORTYPE_UNKVCALPROP, + ICAL_XLICERRORTYPE_INVALIDITIP, + ICAL_XLICERRORTYPE_MIMEPARSEERROR, } icalparameter_xlicerrortype; typedef enum icalparameter_xliccomparetype { @@ -359,17 +370,20 @@ typedef enum icalparameter_value { * Recurrances **********************************************************************/ - typedef enum icalrecurrencetype_frequency { - ICAL_NO_RECURRENCE, - ICAL_SECONDLY_RECURRENCE, - ICAL_MINUTELY_RECURRENCE, - ICAL_HOURLY_RECURRENCE, - ICAL_DAILY_RECURRENCE, - ICAL_WEEKLY_RECURRENCE, - ICAL_MONTHLY_RECURRENCE, - ICAL_YEARLY_RECURRENCE + /* These enums are used to index an array, so don't change the + order or the integers */ + + ICAL_SECONDLY_RECURRENCE=0, + ICAL_MINUTELY_RECURRENCE=1, + ICAL_HOURLY_RECURRENCE=2, + ICAL_DAILY_RECURRENCE=3, + ICAL_WEEKLY_RECURRENCE=4, + ICAL_MONTHLY_RECURRENCE=5, + ICAL_YEARLY_RECURRENCE=6, + ICAL_NO_RECURRENCE=7 + } icalrecurrencetype_frequency; typedef enum icalrecurrencetype_weekday diff --git a/libical/src/libical/icalerror.c b/libical/src/libical/icalerror.c index fb9e152b16..c7641da504 100644 --- a/libical/src/libical/icalerror.c +++ b/libical/src/libical/icalerror.c @@ -4,23 +4,23 @@ CREATOR: eric 16 May 1999 $Id$ + $Locker$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + (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 contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ - The original author is Eric Busboom The original code is icalerror.c ======================================================================*/ diff --git a/libical/src/libical/icalerror.h b/libical/src/libical/icalerror.h index 124699c21b..fbf6076dd6 100644 --- a/libical/src/libical/icalerror.h +++ b/libical/src/libical/icalerror.h @@ -6,20 +6,19 @@ $Id$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (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/ + The original code is icalerror.h ======================================================================*/ @@ -122,6 +121,7 @@ typedef enum icalerrorenum { ICAL_USAGE_ERROR, ICAL_NO_ERROR, ICAL_MULTIPLEINCLUSION_ERROR, + ICAL_TIMEDOUT_ERROR, ICAL_UNKNOWN_ERROR /* Used for problems in input to icalerror_strerror()*/ } icalerrorenum; diff --git a/libical/src/libical/icalmemory.c b/libical/src/libical/icalmemory.c index 35544b14ee..e13c2c42ca 100644 --- a/libical/src/libical/icalmemory.c +++ b/libical/src/libical/icalmemory.c @@ -4,6 +4,7 @@ CREATOR: eric 30 June 1999 $Id$ + $Locker$ The contents of this file are subject to the Mozilla Public License @@ -16,12 +17,34 @@ the License for the specific language governing rights and limitations under the License. + + 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 icalmemory.h - The Initial Developer of the Original Code is Eric Busboom - (C) COPYRIGHT 1999 The Software Studio. - 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 Initial Developer of the Original Code is Eric Busboom + + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ /* libical often passes strings back to the caller. To make these @@ -41,6 +64,9 @@ #include "config.h" #endif +#ifdef DMALLOC +#include "dmalloc.h" +#endif #include "icalmemory.h" #include "icalerror.h" @@ -52,18 +78,16 @@ #define BUFFER_RING_SIZE 25 #define MIN_BUFFER_SIZE 200 -void* buffer_ring[BUFFER_RING_SIZE+1]; -int buffer_pos = 0; +/* HACK. Not threadsafe */ +void* buffer_ring[BUFFER_RING_SIZE]; +int buffer_pos = -1; int initialized = 0; -/* Create a new temporary buffer on the ring. Libical owns these and wil deallocate them. */ -void* -icalmemory_tmp_buffer (size_t size) +/* Add an existing buffer to the buffer ring */ +void icalmemory_add_tmp_buffer(void* buf) { - void *rtrn; /* I don't think I need this -- I think static arrays are initialized to 0 as a standard part of C, but I am not sure. */ - if (initialized == 0){ int i; for(i=0; i<BUFFER_RING_SIZE; i++){ @@ -71,30 +95,45 @@ icalmemory_tmp_buffer (size_t size) } initialized = 1; } - - /* Ideally, this routine would re-use an existing buffer if it is - larger than the requested buffer. Maybe later.... */ - if (size < MIN_BUFFER_SIZE){ - size = MIN_BUFFER_SIZE; + /* Wrap around the ring */ + if(++buffer_pos == BUFFER_RING_SIZE){ + buffer_pos = 0; } - + + /* Free buffers as their slots are overwritten */ if ( buffer_ring[buffer_pos] != 0){ - /*sprintf(buffer_ring[buffer_pos], "***DEALLOCATED MEMORY***: %d",buffer_pos);*/ free( buffer_ring[buffer_pos]); buffer_ring[buffer_pos] = 0; } + /* Assign the buffer to a slot */ + buffer_ring[buffer_pos] = buf; +} - rtrn = buffer_ring[buffer_pos] = (void*)malloc(size); +/* Create a new temporary buffer on the ring. Libical owns these and + wil deallocate them. */ +void* +icalmemory_tmp_buffer (size_t size) +{ + char *buf; - memset(rtrn,0,size); + if (size < MIN_BUFFER_SIZE){ + size = MIN_BUFFER_SIZE; + } + + buf = (void*)malloc(size); - if(++buffer_pos > BUFFER_RING_SIZE){ - buffer_pos = 0; + if( buf == 0){ + icalerror_set_errno(ICAL_NEWFAILED_ERROR); + return 0; } - return rtrn; + memset(buf,0,size); + + icalmemory_add_tmp_buffer(buf); + + return buf; } void icalmemory_free_ring() @@ -112,6 +151,8 @@ void icalmemory_free_ring() } + + /* Like strdup, but the buffer is on the ring. */ char* icalmemory_tmp_copy(char* str) @@ -124,6 +165,10 @@ icalmemory_tmp_copy(char* str) } +char* icalmemory_strdup(const char *s) +{ + return strdup(s); +} void icalmemory_free_tmp_buffer (void* buf) @@ -137,13 +182,18 @@ icalmemory_free_tmp_buffer (void* buf) } -/* These buffer routines create memory the old fashioned way -- so the caller will have to delocate the new memory */ +/* These buffer routines create memory the old fashioned way -- so the + caller will have to delocate the new memory */ void* icalmemory_new_buffer(size_t size) { - /* HACK. need to handle out of memory case */ void *b = malloc(size); + if( b == 0){ + icalerror_set_errno(ICAL_NEWFAILED_ERROR); + return 0; + } + memset(b,0,size); return b; @@ -151,9 +201,14 @@ void* icalmemory_new_buffer(size_t size) void* icalmemory_resize_buffer(void* buf, size_t size) { - /* HACK. need to handle out of memory case */ + void *b = realloc(buf, size); - return realloc(buf, size); + if( b == 0){ + icalerror_set_errno(ICAL_NEWFAILED_ERROR); + return 0; + } + + return b; } void icalmemory_free_buffer(void* buf) @@ -240,5 +295,5 @@ icalmemory_append_char(char** buf, char** pos, size_t* buf_size, **pos = ch; *pos += 1; - + **pos = 0; } diff --git a/libical/src/libical/icalmemory.h b/libical/src/libical/icalmemory.h index 26d22b7316..6c974cdc95 100644 --- a/libical/src/libical/icalmemory.h +++ b/libical/src/libical/icalmemory.h @@ -17,12 +17,34 @@ the License for the specific language governing rights and limitations under the License. + + 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 icalmemory.h - The Initial Developer of the Original Code is Eric Busboom - (C) COPYRIGHT 1999 The Software Studio. - 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 Initial Developer of the Original Code is Eric Busboom + + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ #ifndef ICALMEMORY_H @@ -30,7 +52,8 @@ #include <sys/types.h> /* for size_t */ -/* Tmp buffers are managed by ical. References can be returned to the caller, although the caller will not own the memory. */ +/* Tmp buffers are managed by ical. References can be returned to the + caller, although the caller will not own the memory. */ void* icalmemory_tmp_buffer(size_t size); char* icalmemory_tmp_copy(char* str); @@ -70,6 +93,9 @@ void icalmemory_append_string(char** buf, char** pos, size_t* buf_size, void icalmemory_append_char(char** buf, char** pos, size_t* buf_size, char ch); +/* A wrapper around strdup */ +char* icalmemory_strdup(const char *s); + #endif /* !ICALMEMORY_H */ diff --git a/libical/src/libical/icalparameter.c b/libical/src/libical/icalparameter.c index cf37eb07b2..c77c223f1c 100644 --- a/libical/src/libical/icalparameter.c +++ b/libical/src/libical/icalparameter.c @@ -4,23 +4,23 @@ CREATOR: eric 09 May 1999 $Id$ + $Locker$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + (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 contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ - The original author is Eric Busboom The original code is icalderivedparameters.{c,h} Contributions from: @@ -114,7 +114,7 @@ icalparameter_new_clone(icalparameter* param) memcpy(new,old,sizeof(struct icalparameter_impl)); if (old->string != 0){ - new->string = strdup(old->string); + new->string = icalmemory_strdup(old->string); if (new->string == 0){ icalparameter_free(new); return 0; @@ -122,7 +122,7 @@ icalparameter_new_clone(icalparameter* param) } if (old->x_name != 0){ - new->x_name = strdup(old->x_name); + new->x_name = icalmemory_strdup(old->x_name); if (new->x_name == 0){ icalparameter_free(new); return 0; @@ -132,6 +132,116 @@ icalparameter_new_clone(icalparameter* param) return new; } +#if 0 + +struct param_string_map { + icalparameter_kind kind; + int val; /* Actually, union of several types of enums */ + char* str; +} param_string_map[] = +{ + {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_INDIVIDUAL,"INDIVIDUAL"}, + {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_GROUP,"GROUP"}, + {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_RESOURCE,"RESOURCE"}, + {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_ROOM,"ROOM"}, + {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_UNKNOWN,"UNKNOWN"}, + {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_FREE,"FREE"}, + {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSY,"BUSY"}, + {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSYUNAVAILABLE,"BUSYUNAVAILABLE"}, + {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSYTENTATIVE,"BUSYTENTATIVE"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_NEEDSACTION,"NEEDSACTION"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_ACCEPTED,"ACCEPTED"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DECLINED,"DECLINED"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_TENTATIVE,"TENTATIVE"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DELEGATED,"DELEGATED"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_COMPLETED,"COMPLETED"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_INPROCESS,"INPROCESS"}, + {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDPRIOR,"THISANDPRIOR"}, + {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDFUTURE,"THISANDFUTURE"}, + {ICAL_RELATED_PARAMETER,ICAL_RELATED_START,"START"}, + {ICAL_RELATED_PARAMETER,ICAL_RELATED_END,"END"}, + {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_PARENT,"PARENT"}, + {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_CHILD,"CHILD"}, + {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_SIBLING,"SIBLING"}, + {ICAL_ROLE_PARAMETER,ICAL_ROLE_CHAIR,"CHAIR"}, + {ICAL_RSVP_PARAMETER,ICAL_RSVP_PARAMETER,"TRUE"}, + {ICAL_RSVP_PARAMETER,ICAL_RSVP_PARAMETER,"FALSE"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_BINARY,"BINARY"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_BOOLEAN,"BOOLEAN"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_DATE,"DATE"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_DURATION,"DURATION"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_FLOAT,"FLOAT"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_INTEGER,"INTEGER"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_PERIOD,"PERIOD"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_RECUR,"RECUR"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_TEXT,"TEXT"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_TIME,"TIME"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_URI,"URI"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_XNAME,"ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_COMPONENTPARSEERROR,"COMPONENT_PARSE_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PROPERTYPARSEERROR,"PROPERTY_PARSE_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR,"PARAMETER_NAME_PARSE_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR,"PARAMETER_VALUE_PARSE_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_VALUEPARSEERROR,"VALUE_PARSE_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_INVALIDITIP,"INVALID_ITIP"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_UNKVCALPROP,"UNKNOWN_VCAL_PROP_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_MIMEPARSEERROR,"MIME_PARSE_ERROR"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_EQUAL,"EQUAL"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_NOTEQUAL,"NOTEQUAL"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESS,"LESS"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATER,"GREATER"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESSEQUAL,"LESSEQUAL"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATEREQUAL,"GREATEREQUAL"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_REGEX,"REGEX"}, + {ICAL_NO_PARAMETER,0,""}, + +}; + + +icalparameter* icalparameter_new_from_string(icalparameter_kind kind, char* val) +{ + int i =0; + icalparameter* param=0; + + icalerror_check_arg_rz((val!=0),"val"); + + switch(kind){ + case ICAL_SENTBY_PARAMETER: + case ICAL_TZID_PARAMETER: + case ICAL_X_PARAMETER: + case ICAL_FMTTYPE_PARAMETER: + case ICAL_LANGUAGE_PARAMETER: + case ICAL_MEMBER_PARAMETER: + case ICAL_DELEGATEDFROM_PARAMETER: + case ICAL_DELEGATEDTO_PARAMETER: + case ICAL_DIR_PARAMETER: + case ICAL_ALTREP_PARAMETER: + case ICAL_CN_PARAMETER: + { + if (impl->string == 0){ return no_parameter;} + strcpy(tend,impl->string);break; + break; + } + + case ICAL_NO_PARAMETER: + case ICAL_ANY_PARAMETER: + { + } + + default: { + /* All other types are enumerated */ + for(i = 0; param_string_map[i].kind != ICAL_NO_PARAMETER){ + if(kind == param_string_map[i].kind && + strcmp(val,param_string_map[i].str) == 0){ + + + } + } + } +} + +#endif + icalparameter* icalparameter_new_from_string(icalparameter_kind kind, char* val) { @@ -427,6 +537,12 @@ icalparameter* icalparameter_new_from_string(icalparameter_kind kind, char* val) else if(strcmp(val,"INVALID_ITIP") == 0){ param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP); } + else if(strcmp(val,"MIME_PARSE_ERROR") == 0){ + param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_MIMEPARSEERROR); + } + else if(strcmp(val,"UNKNOWN_VCAL_PROP_ERROR") == 0){ + param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_UNKVCALPROP); + } break; } @@ -839,6 +955,14 @@ icalparameter_as_ical_string (icalparameter* parameter) { strcpy(tend,"INVALID_ITIP");break; } + case ICAL_XLICERRORTYPE_UNKVCALPROP: + { + strcpy(tend,"UNKNOWN_VCAL_PROP_ERROR");break; + } + case ICAL_XLICERRORTYPE_MIMEPARSEERROR: + { + strcpy(tend,"MIME_PARSE_ERROR");break; + } } break; } @@ -969,7 +1093,7 @@ icalparameter_set_xname (icalparameter* param, char* v) free(impl->x_name); } - impl->x_name = strdup(v); + impl->x_name = icalmemory_strdup(v); if (impl->x_name == 0){ errno = ENOMEM; @@ -998,7 +1122,7 @@ icalparameter_set_xvalue (icalparameter* param, char* v) free(impl->string); } - impl->string = strdup(v); + impl->string = icalmemory_strdup(v); if (impl->string == 0){ errno = ENOMEM; @@ -1071,7 +1195,7 @@ void icalparameter_set_altrep(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* CN */ @@ -1107,7 +1231,7 @@ void icalparameter_set_cn(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* CUTYPE */ @@ -1184,7 +1308,7 @@ void icalparameter_set_delegatedfrom(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* DELEGATED-TO */ @@ -1220,7 +1344,7 @@ void icalparameter_set_delegatedto(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* DIR */ @@ -1256,7 +1380,7 @@ void icalparameter_set_dir(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* ENCODING */ @@ -1374,7 +1498,7 @@ void icalparameter_set_fmttype(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* LANGUAGE */ @@ -1410,7 +1534,7 @@ void icalparameter_set_language(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* MEMBER */ @@ -1446,7 +1570,7 @@ void icalparameter_set_member(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* PARTSTAT */ @@ -1719,7 +1843,7 @@ void icalparameter_set_sentby(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* TZID */ @@ -1755,7 +1879,7 @@ void icalparameter_set_tzid(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* VALUE */ @@ -1832,7 +1956,7 @@ void icalparameter_set_x(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* X-LIC-ERRORTYPE */ diff --git a/libical/src/libical/icalparameter.h b/libical/src/libical/icalparameter.h index 174cae6f3f..ad97f34e58 100644 --- a/libical/src/libical/icalparameter.h +++ b/libical/src/libical/icalparameter.h @@ -9,20 +9,19 @@ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (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/ + The original code is icalparam.h ======================================================================*/ diff --git a/libical/src/libical/icalparser.c b/libical/src/libical/icalparser.c index 3be754036a..b4563e23c9 100644 --- a/libical/src/libical/icalparser.c +++ b/libical/src/libical/icalparser.c @@ -4,6 +4,7 @@ CREATOR: eric 04 August 1999 $Id$ + $Locker$ The contents of this file are subject to the Mozilla Public License @@ -16,11 +17,21 @@ the License for the specific language governing rights and limitations under the License. - The Initial Developer of the Original Code is Eric Busboom - (C) COPYRIGHT 1999 The Software Studio. - 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 Initial Developer of the Original Code is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ #ifdef HAVE_CONFIG_H @@ -91,6 +102,7 @@ icalparser* icalparser_new() return (icalparser*)impl; } + void icalparser_free(icalparser* parser) { struct icalparser_impl* impl = (struct icalparser_impl*)parser; @@ -105,6 +117,8 @@ void icalparser_free(icalparser* parser) } pvl_free(impl->components); + + free(impl); } void icalparser_set_gen_data(icalparser* parser, void* data) @@ -115,7 +129,7 @@ void icalparser_set_gen_data(icalparser* parser, void* data) } -icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind, +icalvalue* icalvalue_new_From_string_with_error(icalvalue_kind kind, char* str, icalproperty **error); @@ -313,7 +327,6 @@ char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind) ) { /* The COMMA was followed by 'FREQ', is it a real seperator*/ /* Fall through */ - printf("%s\n",next); } else if (next != 0){ /* Not real, get the next COMMA */ p = next+1; @@ -404,7 +417,8 @@ char* icalparser_get_line(icalparser *parser, /* If the last position in the temp buffer is occupied, mark the buffer as full. The means we will do another read later, because the line is not finished */ - if (impl->temp[impl->tmp_buf_size-1] == 0){ + if (impl->temp[impl->tmp_buf_size-1] == 0 && + impl->temp[impl->tmp_buf_size-2] != '\n'){ impl->buffer_full = 1; } else { impl->buffer_full = 0; @@ -515,7 +529,6 @@ icalcomponent* icalparser_parse(icalparser *parser, do{ line = icalparser_get_line(parser, line_gen_func); - if ((c = icalparser_add_line(parser,line)) != 0){ if (root_component == 0){ /* Just one component */ @@ -538,6 +551,9 @@ icalcomponent* icalparser_parse(icalparser *parser, icalparser_claim(parser); } } + if(line != 0){ + free(line); + } } while ( line != 0); return root_component; @@ -568,7 +584,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, /* Begin by getting the property name at the start of the line. The property name may end up being "BEGIN" or "END" in which case it - is not really a property, but the market for the start or end of + is not really a property, but the marker for the start or end of a component */ end = 0; @@ -591,8 +607,6 @@ icalcomponent* icalparser_add_line(icalparser* parser, /********************************************************************** * Handle begin and end of components **********************************************************************/ - - /* If the property name is BEGIN or END, we are actually starting or ending a new component */ diff --git a/libical/src/libical/icalparser.h b/libical/src/libical/icalparser.h index 25c07eca9f..161127379f 100644 --- a/libical/src/libical/icalparser.h +++ b/libical/src/libical/icalparser.h @@ -6,20 +6,19 @@ $Id$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (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/ + The original code is icalparser.h ======================================================================*/ @@ -32,6 +31,16 @@ #include <stdio.h> /* For FILE* */ typedef void* icalparser; + + +/*********************************************************************** + * Line-oriented parsing. + * + * Create a new parser via icalparse_new_parser, then add ines one at + * a time with icalparse_add_line(). icalparser_add_line() will return + * non-zero when it has finished with a component. + ***********************************************************************/ + typedef enum icalparser_state { ICALPARSER_ERROR, ICALPARSER_SUCCESS, @@ -40,6 +49,13 @@ typedef enum icalparser_state { ICALPARSER_IN_PROGRESS } icalparser_state; +icalparser* icalparser_new(); +icalcomponent* icalparser_add_line(icalparser* parser, char* str ); +icalcomponent* icalparser_claim(icalparser* parser); +icalcomponent* icalparser_clean(icalparser* parser); +icalparser_state icalparser_get_state(icalparser* parser); +void icalparser_free(icalparser* parser); + /*********************************************************************** * Message oriented parsing. icalparser_parse takes a string that @@ -51,25 +67,13 @@ typedef enum icalparser_state { icalcomponent* icalparser_parse(icalparser *parser, char* (*line_gen_func)(char *s, size_t size, void *d)); -/* A simple, and incorrect interface - can only return one component*/ -icalcomponent* icalparser_parse_string(char* str); +/* Set the data that icalparser_parse will give to the line_gen_func + as the parameter 'd'*/ +void icalparser_set_gen_data(icalparser* parser, void* data); -/*********************************************************************** - * Line-oriented parsing. - * - * Create a new parser via icalparse_new_parser, then add ines one at - * a time with icalparse_add_line(). icalparser_add_line() will return - * non-zero when it has finished with a component. - ***********************************************************************/ +icalcomponent* icalparser_parse_string(char* str); -icalparser* icalparser_new(); -void icalparser_set_gen_data(icalparser* parser, void* data); -icalcomponent* icalparser_add_line(icalparser* parser, char* str ); -icalcomponent* icalparser_claim(icalparser* parser); -icalcomponent* icalparser_clean(icalparser* parser); -icalparser_state icalparser_get_state(icalparser* parser); -void icalparser_free(icalparser* parser); /*********************************************************************** * Parser support functions @@ -81,14 +85,6 @@ icalvalue* icalparser_parse_value(icalvalue_kind kind, char* str, icalcomponent /* Given a line generator function, return a single iCal content line.*/ char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d)); - -/* a line_gen_function that returns lines from a string. To use it, - set string_line_generator_str to point to the input string, and set - string_line_generator_pos to 0. These globals make the routine not - thead-safe. */ - -extern char* string_line_generator_str; -extern char* string_line_generator_pos; char* string_line_generator(char *out, size_t buf_size, void *d); #endif /* !ICALPARSE_H */ diff --git a/libical/src/libical/icalproperty.c b/libical/src/libical/icalproperty.c index c3fe7c9073..1040215108 100644 --- a/libical/src/libical/icalproperty.c +++ b/libical/src/libical/icalproperty.c @@ -7,20 +7,19 @@ $Id$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + 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 author is Eric Busboom The original code is icalproperty.c ======================================================================*/ @@ -29,7 +28,7 @@ #include "config.h" #endif -#include <string.h> /* For strdup, rindex */ +#include <string.h> /* For icalmemory_strdup, rindex */ #include <assert.h> #include <stdlib.h> #include <errno.h> @@ -80,7 +79,7 @@ void icalproperty_add_parameters(struct icalproperty_impl *impl,va_list args) icalproperty_add_parameter((icalproperty*)impl, (icalparameter*)vp); } else { - abort(); + assert(0); } } @@ -138,7 +137,7 @@ icalproperty_new_clone(icalproperty* prop) if (old->x_name != 0) { - new->x_name = strdup(old->x_name); + new->x_name = icalmemory_strdup(old->x_name); if (new->x_name == 0) { icalproperty_free(new); @@ -269,6 +268,7 @@ icalproperty_as_ical_string (icalproperty* prop) icalerror_check_arg_rz( (prop!=0),"prop"); + /* Append property name */ if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){ @@ -315,8 +315,9 @@ icalproperty_as_ical_string (icalproperty* prop) value = icalproperty_get_value(prop); if (value != 0){ - icalmemory_append_string(&buf, &buf_ptr, &buf_size, - icalvalue_as_ical_string(icalproperty_get_value(prop))); + char *str = icalvalue_as_ical_string(value); + icalerror_assert((str !=0),"Could not get string representation of a value"); + icalmemory_append_string(&buf, &buf_ptr, &buf_size, str); } else { icalmemory_append_string(&buf, &buf_ptr, &buf_size,"ERROR: No Value"); @@ -479,7 +480,7 @@ void icalproperty_set_x_name(icalproperty* prop, char* name) free(impl->x_name); } - impl->x_name = strdup(name); + impl->x_name = icalmemory_strdup(name); if(impl->x_name == 0){ icalerror_set_errno(ICAL_ALLOCATION_ERROR); @@ -569,6 +570,59 @@ icalproperty_method icalproperty_get_method(icalproperty* prop) return icalvalue_get_method(value); } +/* X-LIC-MIMECID */ + +icalproperty* icalproperty_new_xlicmimecid(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecid((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimecid(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecid((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimecid(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimecid(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + /* LAST-MODIFIED */ icalproperty* icalproperty_new_lastmodified(struct icaltimetype v) @@ -1193,6 +1247,112 @@ char* icalproperty_get_contact(icalproperty* prop) return icalvalue_get_text(value); } +/* X-LIC-MIMECONTENTTYPE */ + +icalproperty* icalproperty_new_xlicmimecontenttype(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecontenttype((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimecontenttype(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecontenttype((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimecontenttype(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimecontenttype(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + +/* X-LIC-MIMEOPTINFO */ + +icalproperty* icalproperty_new_xlicmimeoptinfo(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimeoptinfo((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimeoptinfo(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimeoptinfo((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + /* RELATED-TO */ icalproperty* icalproperty_new_relatedto(char* v) @@ -1352,6 +1512,59 @@ char* icalproperty_get_comment(icalproperty* prop) return icalvalue_get_text(value); } +/* X-LIC-ERROR */ + +icalproperty* icalproperty_new_xlicerror(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicerror((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicerror(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicerror((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicerror(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_text(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicerror(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_text(value); +} + /* TRIGGER */ icalproperty* icalproperty_new_trigger(union icaltriggertype v) @@ -1402,27 +1615,27 @@ union icaltriggertype icalproperty_get_trigger(icalproperty* prop) return icalvalue_get_trigger(value); } -/* X-LIC-ERROR */ +/* CLASS */ -icalproperty* icalproperty_new_xlicerror(char* v) +icalproperty* icalproperty_new_class(char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); - icalproperty_set_xlicerror((icalproperty*)impl,v); + icalproperty_set_class((icalproperty*)impl,v); return (icalproperty*)impl; } -icalproperty* icalproperty_vanew_xlicerror(char* v, ...) +icalproperty* icalproperty_vanew_class(char* v, ...) { va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); - icalproperty_set_xlicerror((icalproperty*)impl,v); + icalproperty_set_class((icalproperty*)impl,v); va_start(args,v); icalproperty_add_parameters(impl, args); @@ -1431,7 +1644,7 @@ icalproperty* icalproperty_vanew_xlicerror(char* v, ...) return (icalproperty*)impl; } -void icalproperty_set_xlicerror(icalproperty* prop, char* v) +void icalproperty_set_class(icalproperty* prop, char* v) { icalvalue *value; @@ -1445,7 +1658,7 @@ void icalproperty_set_xlicerror(icalproperty* prop, char* v) } -char* icalproperty_get_xlicerror(icalproperty* prop) +char* icalproperty_get_class(icalproperty* prop) { icalvalue *value; icalerror_check_arg( (prop!=0),"prop"); @@ -1455,27 +1668,27 @@ char* icalproperty_get_xlicerror(icalproperty* prop) return icalvalue_get_text(value); } -/* CLASS */ +/* X */ -icalproperty* icalproperty_new_class(char* v) +icalproperty* icalproperty_new_x(char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); - icalproperty_set_class((icalproperty*)impl,v); + icalproperty_set_x((icalproperty*)impl,v); return (icalproperty*)impl; } -icalproperty* icalproperty_vanew_class(char* v, ...) +icalproperty* icalproperty_vanew_x(char* v, ...) { va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); - icalproperty_set_class((icalproperty*)impl,v); + icalproperty_set_x((icalproperty*)impl,v); va_start(args,v); icalproperty_add_parameters(impl, args); @@ -1484,7 +1697,7 @@ icalproperty* icalproperty_vanew_class(char* v, ...) return (icalproperty*)impl; } -void icalproperty_set_class(icalproperty* prop, char* v) +void icalproperty_set_x(icalproperty* prop, char* v) { icalvalue *value; @@ -1498,7 +1711,7 @@ void icalproperty_set_class(icalproperty* prop, char* v) } -char* icalproperty_get_class(icalproperty* prop) +char* icalproperty_get_x(icalproperty* prop) { icalvalue *value; icalerror_check_arg( (prop!=0),"prop"); @@ -1611,6 +1824,59 @@ char* icalproperty_get_transp(icalproperty* prop) return icalvalue_get_text(value); } +/* X-LIC-MIMEENCODING */ + +icalproperty* icalproperty_new_xlicmimeencoding(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimeencoding((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimeencoding(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimeencoding((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimeencoding(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimeencoding(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + /* SEQUENCE */ icalproperty* icalproperty_new_sequence(int v) @@ -2432,6 +2698,59 @@ struct icalperiodtype icalproperty_get_rdate(icalproperty* prop) return icalvalue_get_datetimeperiod(value); } +/* X-LIC-MIMEFILENAME */ + +icalproperty* icalproperty_new_xlicmimefilename(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimefilename((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimefilename(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimefilename((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimefilename(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimefilename(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + /* URL */ icalproperty* icalproperty_new_url(char* v) @@ -2485,25 +2804,25 @@ char* icalproperty_get_url(icalproperty* prop) return icalvalue_get_uri(value); } -/* ATTACH */ +/* X-LIC-CLUSTERCOUNT */ -icalproperty* icalproperty_new_attach(struct icalattachtype v) +icalproperty* icalproperty_new_xlicclustercount(int v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); - icalproperty_set_attach((icalproperty*)impl,v); + icalproperty_set_xlicclustercount((icalproperty*)impl,v); return (icalproperty*)impl; } -icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...) +icalproperty* icalproperty_vanew_xlicclustercount(int v, ...) { va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); - icalproperty_set_attach((icalproperty*)impl,v); + icalproperty_set_xlicclustercount((icalproperty*)impl,v); va_start(args,v); icalproperty_add_parameters(impl, args); @@ -2512,48 +2831,48 @@ icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...) return (icalproperty*)impl; } -void icalproperty_set_attach(icalproperty* prop, struct icalattachtype v) +void icalproperty_set_xlicclustercount(icalproperty* prop, int v) { icalvalue *value; icalerror_check_arg_rv( (prop!=0),"prop"); - value = icalvalue_new_attach(v); + value = icalvalue_new_integer(v); icalproperty_set_value(prop,value); } -struct icalattachtype icalproperty_get_attach(icalproperty* prop) +int icalproperty_get_xlicclustercount(icalproperty* prop) { icalvalue *value; icalerror_check_arg( (prop!=0),"prop"); value = icalproperty_get_value(prop); - return icalvalue_get_attach(value); + return icalvalue_get_integer(value); } -/* X-LIC-CLUSTERCOUNT */ +/* ATTACH */ -icalproperty* icalproperty_new_xlicclustercount(int v) +icalproperty* icalproperty_new_attach(struct icalattachtype v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); - icalproperty_set_xlicclustercount((icalproperty*)impl,v); + icalproperty_set_attach((icalproperty*)impl,v); return (icalproperty*)impl; } -icalproperty* icalproperty_vanew_xlicclustercount(int v, ...) +icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...) { va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); - icalproperty_set_xlicclustercount((icalproperty*)impl,v); + icalproperty_set_attach((icalproperty*)impl,v); va_start(args,v); icalproperty_add_parameters(impl, args); @@ -2562,27 +2881,27 @@ icalproperty* icalproperty_vanew_xlicclustercount(int v, ...) return (icalproperty*)impl; } -void icalproperty_set_xlicclustercount(icalproperty* prop, int v) +void icalproperty_set_attach(icalproperty* prop, struct icalattachtype v) { icalvalue *value; icalerror_check_arg_rv( (prop!=0),"prop"); - value = icalvalue_new_integer(v); + value = icalvalue_new_attach(v); icalproperty_set_value(prop,value); } -int icalproperty_get_xlicclustercount(icalproperty* prop) +struct icalattachtype icalproperty_get_attach(icalproperty* prop) { icalvalue *value; icalerror_check_arg( (prop!=0),"prop"); value = icalproperty_get_value(prop); - return icalvalue_get_integer(value); + return icalvalue_get_attach(value); } /* EXRULE */ @@ -2891,6 +3210,59 @@ struct icalgeotype icalproperty_get_geo(icalproperty* prop) return icalvalue_get_geo(value); } +/* X-LIC-MIMECHARSET */ + +icalproperty* icalproperty_new_xlicmimecharset(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecharset((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimecharset(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecharset((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimecharset(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimecharset(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + /* COMPLETED */ icalproperty* icalproperty_new_completed(struct icaltimetype v) diff --git a/libical/src/libical/icalproperty.h b/libical/src/libical/icalproperty.h index 2cd28fe179..278c4d533f 100644 --- a/libical/src/libical/icalproperty.h +++ b/libical/src/libical/icalproperty.h @@ -5,20 +5,7 @@ $Id$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ @@ -63,7 +50,6 @@ icalvalue* icalproperty_get_value(icalproperty* prop); void icalproperty_set_x_name(icalproperty* prop, char* name); char* icalproperty_get_x_name(icalproperty* prop); - /* Everything below this line is machine generated. Do not edit. */ /* METHOD */ @@ -72,6 +58,12 @@ icalproperty* icalproperty_vanew_method(icalproperty_method v, ...); void icalproperty_set_method(icalproperty* prop, icalproperty_method v); icalproperty_method icalproperty_get_method(icalproperty* prop); +/* X-LIC-MIMECID */ +icalproperty* icalproperty_new_xlicmimecid(char* v); +icalproperty* icalproperty_vanew_xlicmimecid(char* v, ...); +void icalproperty_set_xlicmimecid(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimecid(icalproperty* prop); + /* LAST-MODIFIED */ icalproperty* icalproperty_new_lastmodified(struct icaltimetype v); icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...); @@ -144,6 +136,18 @@ icalproperty* icalproperty_vanew_contact(char* v, ...); void icalproperty_set_contact(icalproperty* prop, char* v); char* icalproperty_get_contact(icalproperty* prop); +/* X-LIC-MIMECONTENTTYPE */ +icalproperty* icalproperty_new_xlicmimecontenttype(char* v); +icalproperty* icalproperty_vanew_xlicmimecontenttype(char* v, ...); +void icalproperty_set_xlicmimecontenttype(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimecontenttype(icalproperty* prop); + +/* X-LIC-MIMEOPTINFO */ +icalproperty* icalproperty_new_xlicmimeoptinfo(char* v); +icalproperty* icalproperty_vanew_xlicmimeoptinfo(char* v, ...); +void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop); + /* RELATED-TO */ icalproperty* icalproperty_new_relatedto(char* v); icalproperty* icalproperty_vanew_relatedto(char* v, ...); @@ -162,24 +166,30 @@ icalproperty* icalproperty_vanew_comment(char* v, ...); void icalproperty_set_comment(icalproperty* prop, char* v); char* icalproperty_get_comment(icalproperty* prop); -/* TRIGGER */ -icalproperty* icalproperty_new_trigger(union icaltriggertype v); -icalproperty* icalproperty_vanew_trigger(union icaltriggertype v, ...); -void icalproperty_set_trigger(icalproperty* prop, union icaltriggertype v); -union icaltriggertype icalproperty_get_trigger(icalproperty* prop); - /* X-LIC-ERROR */ icalproperty* icalproperty_new_xlicerror(char* v); icalproperty* icalproperty_vanew_xlicerror(char* v, ...); void icalproperty_set_xlicerror(icalproperty* prop, char* v); char* icalproperty_get_xlicerror(icalproperty* prop); +/* TRIGGER */ +icalproperty* icalproperty_new_trigger(union icaltriggertype v); +icalproperty* icalproperty_vanew_trigger(union icaltriggertype v, ...); +void icalproperty_set_trigger(icalproperty* prop, union icaltriggertype v); +union icaltriggertype icalproperty_get_trigger(icalproperty* prop); + /* CLASS */ icalproperty* icalproperty_new_class(char* v); icalproperty* icalproperty_vanew_class(char* v, ...); void icalproperty_set_class(icalproperty* prop, char* v); char* icalproperty_get_class(icalproperty* prop); +/* X */ +icalproperty* icalproperty_new_x(char* v); +icalproperty* icalproperty_vanew_x(char* v, ...); +void icalproperty_set_x(icalproperty* prop, char* v); +char* icalproperty_get_x(icalproperty* prop); + /* TZOFFSETTO */ icalproperty* icalproperty_new_tzoffsetto(int v); icalproperty* icalproperty_vanew_tzoffsetto(int v, ...); @@ -192,6 +202,12 @@ icalproperty* icalproperty_vanew_transp(char* v, ...); void icalproperty_set_transp(icalproperty* prop, char* v); char* icalproperty_get_transp(icalproperty* prop); +/* X-LIC-MIMEENCODING */ +icalproperty* icalproperty_new_xlicmimeencoding(char* v); +icalproperty* icalproperty_vanew_xlicmimeencoding(char* v, ...); +void icalproperty_set_xlicmimeencoding(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimeencoding(icalproperty* prop); + /* SEQUENCE */ icalproperty* icalproperty_new_sequence(int v); icalproperty* icalproperty_vanew_sequence(int v, ...); @@ -288,24 +304,30 @@ icalproperty* icalproperty_vanew_rdate(struct icalperiodtype v, ...); void icalproperty_set_rdate(icalproperty* prop, struct icalperiodtype v); struct icalperiodtype icalproperty_get_rdate(icalproperty* prop); +/* X-LIC-MIMEFILENAME */ +icalproperty* icalproperty_new_xlicmimefilename(char* v); +icalproperty* icalproperty_vanew_xlicmimefilename(char* v, ...); +void icalproperty_set_xlicmimefilename(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimefilename(icalproperty* prop); + /* URL */ icalproperty* icalproperty_new_url(char* v); icalproperty* icalproperty_vanew_url(char* v, ...); void icalproperty_set_url(icalproperty* prop, char* v); char* icalproperty_get_url(icalproperty* prop); -/* ATTACH */ -icalproperty* icalproperty_new_attach(struct icalattachtype v); -icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...); -void icalproperty_set_attach(icalproperty* prop, struct icalattachtype v); -struct icalattachtype icalproperty_get_attach(icalproperty* prop); - /* X-LIC-CLUSTERCOUNT */ icalproperty* icalproperty_new_xlicclustercount(int v); icalproperty* icalproperty_vanew_xlicclustercount(int v, ...); void icalproperty_set_xlicclustercount(icalproperty* prop, int v); int icalproperty_get_xlicclustercount(icalproperty* prop); +/* ATTACH */ +icalproperty* icalproperty_new_attach(struct icalattachtype v); +icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...); +void icalproperty_set_attach(icalproperty* prop, struct icalattachtype v); +struct icalattachtype icalproperty_get_attach(icalproperty* prop); + /* EXRULE */ icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v); icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...); @@ -342,6 +364,12 @@ icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...); void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v); struct icalgeotype icalproperty_get_geo(icalproperty* prop); +/* X-LIC-MIMECHARSET */ +icalproperty* icalproperty_new_xlicmimecharset(char* v); +icalproperty* icalproperty_vanew_xlicmimecharset(char* v, ...); +void icalproperty_set_xlicmimecharset(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimecharset(icalproperty* prop); + /* COMPLETED */ icalproperty* icalproperty_new_completed(struct icaltimetype v); icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...); diff --git a/libical/src/libical/icalrestriction.c b/libical/src/libical/icalrestriction.c index 8371e87545..be0e292d28 100644 --- a/libical/src/libical/icalrestriction.c +++ b/libical/src/libical/icalrestriction.c @@ -2,20 +2,7 @@ /* ====================================================================== File: icalrestriction.c - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ #ifdef HAVE_CONFIG_H @@ -1466,7 +1453,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE} + {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE,0} }; icalrestriction_component_record icalrestriction_component_records[] = { {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0}, @@ -1596,5 +1583,5 @@ icalrestriction_component_record icalrestriction_component_records[] = { {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0}, {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0}, {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE} + {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE,0} }; diff --git a/libical/src/libical/icalrestriction.h b/libical/src/libical/icalrestriction.h index ca4beeea7b..12421d0f32 100644 --- a/libical/src/libical/icalrestriction.h +++ b/libical/src/libical/icalrestriction.h @@ -6,20 +6,19 @@ $Id$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (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/ + The original code is icalrestriction.h Contributions from: diff --git a/libical/src/libical/icaltypes.c b/libical/src/libical/icaltypes.c index b60333887e..c7017eb2af 100644 --- a/libical/src/libical/icaltypes.c +++ b/libical/src/libical/icaltypes.c @@ -7,20 +7,19 @@ $Locker$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + 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 author is Eric Busboom The original code is icaltypes.c ======================================================================*/ @@ -31,9 +30,9 @@ #include "icaltypes.h" #include "icalerror.h" #include "icalmemory.h" -#include <stdlib.h> /* for malloc */ +#include <stdlib.h> /* for malloc and abs() */ #include <errno.h> /* for errno */ -#include <string.h> /* for strdup */ +#include <string.h> /* for icalmemory_strdup */ #include <assert.h> #include <limits.h> /* for SHRT_MAX */ @@ -106,9 +105,9 @@ void icalattachtype_set_url(struct icalattachtype* v, char* url) free (v->url); } - v->url = strdup(url); + v->url = icalmemory_strdup(url); - /* HACK This routine should do something if strdup returns NULL */ + /* HACK This routine should do something if icalmemory_strdup returns NULL */ } @@ -159,28 +158,6 @@ icalperiodtype_duration (struct icalperiodtype period); time_t icalperiodtype_end (struct icalperiodtype period); -struct icaltimetype -icaltimetype_from_timet(time_t v, int date) -{ - struct icaltimetype tt; - struct tm t; - time_t tm = time(&v); - -/* HACK Does not properly consider timezone */ - t = *(gmtime(&tm)); - - tt.second = t.tm_sec; - tt.minute = t.tm_min; - tt.hour = t.tm_hour; - tt.day = t.tm_mday; - tt.month = t.tm_mon + 1; - tt.year = t.tm_year+ 1900; - - tt.is_utc = 1; - tt.is_date = date; - - return tt; -} /* From Russel Steinthal */ time_t icaldurationtype_as_timet(struct icaldurationtype dur) @@ -210,7 +187,7 @@ struct icaldurationtype icaldurationtype_from_timet(time_t t) return dur; } - + void icalrecurrencetype_clear(struct icalrecurrencetype *recur) { memset(recur,ICAL_RECURRENCE_ARRAY_MAX_BYTE, @@ -218,16 +195,34 @@ void icalrecurrencetype_clear(struct icalrecurrencetype *recur) recur->week_start = ICAL_NO_WEEKDAY; recur->freq = ICAL_NO_RECURRENCE; - recur->interval = 0; - recur->until.year = 0; + recur->interval = 1; + memset(&(recur->until),0,sizeof(struct icaltimetype)); recur->count = 0; } +/* The 'day' element of icalrecurrencetype_weekday is encoded to allow +reporesentation of both the day of the week ( Monday, Tueday), but +also the Nth day of the week ( First tuesday of the month, last +thursday of the year) These routines decode the day values. + +The day's position in the period ( Nth-ness) and the numerical value +of the day are encoded together as: pos*7 + dow + */ + +enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day) +{ + return abs(day)%8; +} + +short icalrecurrencetype_day_position(short day) +{ + return (day-icalrecurrencetype_day_day_of_week(day))/8; +} + struct icalreqstattype icalreqstattype_from_string(char* str) { char *p1,*p2; - size_t len; struct icalreqstattype stat; int major, minor; @@ -235,7 +230,6 @@ struct icalreqstattype icalreqstattype_from_string(char* str) stat.code = ICAL_UNKNOWN_STATUS; stat.debug = 0; - stat.desc = 0; /* Get the status numbers */ @@ -278,7 +272,6 @@ struct icalreqstattype icalreqstattype_from_string(char* str) char* icalreqstattype_as_string(struct icalreqstattype stat) { - char format[20]; char *temp; temp = (char*)icalmemory_tmp_buffer(TEMP_MAX); diff --git a/libical/src/libical/icaltypes.h b/libical/src/libical/icaltypes.h index 77a67fae80..1130ab2457 100644 --- a/libical/src/libical/icaltypes.h +++ b/libical/src/libical/icaltypes.h @@ -4,20 +4,19 @@ CREATOR: eric 20 March 1999 - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (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/ + The original code is icaltypes.h ======================================================================*/ @@ -27,6 +26,7 @@ #include <time.h> #include "icalenums.h" /* for recurrence enums */ +#include "icaltime.h" /* This type type should probably be an opaque type... */ struct icalattachtype @@ -67,21 +67,6 @@ struct icalgeotype float lon; }; -struct icaltimetype -{ - int year; - int month; - int day; - int hour; - int minute; - int second; - - int is_utc; /* 1-> time is in UTC timezone */ - - int is_date; /* 1 -> interpret this as date. */ -}; - -struct icaltimetype icaltimetype_from_timet(time_t v, int is_date); /* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of @@ -112,7 +97,7 @@ struct icalrecurrencetype short by_second[61]; short by_minute[61]; short by_hour[25]; - short by_day[8]; + short by_day[8]; /* Encoded value, see below */ short by_month_day[32]; short by_year_day[367]; short by_week_no[54]; @@ -123,6 +108,17 @@ struct icalrecurrencetype void icalrecurrencetype_clear(struct icalrecurrencetype *r); +/* The 'day' element of icalrecurrencetype_weekday is encoded to allow +reporesentation of both the day of the week ( Monday, Tueday), but +also the Nth day of the week ( First tuesday of the month, last +thursday of the year) These routines decode the day values */ + +/* 1 == Monday, etc. */ +enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day); + +/* 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */ +short icalrecurrencetype_day_position(short day); + struct icaldurationtype { unsigned int days; @@ -171,7 +167,7 @@ operating on a the value of a request_status property. */ struct icalreqstattype { - icalrequeststatus code; + icalrequeststatus code; char* desc; char* debug; }; diff --git a/libical/src/libical/icalvalue.c b/libical/src/libical/icalvalue.c index 79eb8d827a..db0e58efe8 100644 --- a/libical/src/libical/icalvalue.c +++ b/libical/src/libical/icalvalue.c @@ -5,21 +5,19 @@ $Id$ + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - (C) COPYRIGHT 1999 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 contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + The 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 author is Eric Busboom The original code is icalvalue.c Contributions from: @@ -49,7 +47,7 @@ #include <limits.h> /* for SHRT_MAX */ #if _MAC_OS_ -#include "strdup.h" +#include "icalmemory_strdup.h" #endif #define TMP_BUF_SIZE 1024 @@ -88,8 +86,10 @@ struct icalvalue_impl { /*struct icaltimetype v_datetime;*/ /*struct icaltimetype v_datetimedate;*/ - /* struct icalrecurrencetype was once a value in this - union, but it contributes 2000 bytes to every*/ + /* struct icalrecurrencetype was once included + directly ( not referenced ) in this union, but it + contributes 2000 bytes to every value, so now it is + a reference*/ struct icalrecurrencetype *v_recur; union icaltriggertype v_trigger; @@ -159,7 +159,7 @@ icalvalue* icalvalue_new_clone(icalvalue* value){ case ICAL_URI_VALUE: { if (old->data.v_string != 0) { - new->data.v_string=strdup(old->data.v_string); + new->data.v_string=icalmemory_strdup(old->data.v_string); if ( new->data.v_string == 0 ) { return 0; @@ -195,7 +195,7 @@ icalvalue* icalvalue_new_clone(icalvalue* value){ return new; } -char* strdup_and_dequote(char* str) +char* icalmemory_strdup_and_dequote(char* str) { char* p; char* out = (char*)malloc(sizeof(char) * strlen(str) +1); @@ -343,7 +343,7 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,char* str,ic case ICAL_TEXT_VALUE: { - char* dequoted_str = strdup_and_dequote(str); + char* dequoted_str = icalmemory_strdup_and_dequote(str); value = icalvalue_new_text(dequoted_str); free(dequoted_str); break; @@ -663,8 +663,11 @@ char* icalvalue_recur_as_ical_string(icalvalue* value) for(i=0; i< limit && array[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){ if (j == 3) { /* BYDAY */ - icalmemory_append_string(&str,&str_p,&buf_sz, - icalenum_weekday_to_string(array[i])); + short dow = icalrecurrencetype_day_day_of_week(array[i]); + char *daystr = icalenum_weekday_to_string(dow); + + /* HACK, does not correctly handle the integer value */ + icalmemory_append_string(&str,&str_p,&buf_sz,daystr); } else { sprintf(temp,"%d",array[i]); icalmemory_append_string(&str,&str_p,&buf_sz, temp); @@ -1369,6 +1372,7 @@ icalvalue_set_attach(icalvalue* value, struct icalattachtype v) icalerror_check_value_type(value, ICAL_ATTACH_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_attach = v; } @@ -1405,6 +1409,8 @@ icalvalue_set_binary(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_BINARY_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ @@ -1444,6 +1450,7 @@ icalvalue_set_boolean(icalvalue* value, int v) icalerror_check_value_type(value, ICAL_BOOLEAN_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_int = v; } @@ -1480,6 +1487,8 @@ icalvalue_set_caladdress(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ @@ -1519,6 +1528,7 @@ icalvalue_set_date(icalvalue* value, struct icaltimetype v) icalerror_check_value_type(value, ICAL_DATE_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_time = v; } @@ -1553,6 +1563,7 @@ icalvalue_set_datetime(icalvalue* value, struct icaltimetype v) icalerror_check_value_type(value, ICAL_DATETIME_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_time = v; } @@ -1587,6 +1598,7 @@ icalvalue_set_datetimedate(icalvalue* value, struct icaltimetype v) icalerror_check_value_type(value, ICAL_DATETIMEDATE_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_time = v; } @@ -1621,6 +1633,7 @@ icalvalue_set_datetimeperiod(icalvalue* value, struct icalperiodtype v) icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_period = v; } @@ -1655,6 +1668,7 @@ icalvalue_set_duration(icalvalue* value, struct icaldurationtype v) icalerror_check_value_type(value, ICAL_DURATION_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_duration = v; } @@ -1689,6 +1703,7 @@ icalvalue_set_float(icalvalue* value, float v) icalerror_check_value_type(value, ICAL_FLOAT_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_float = v; } @@ -1723,6 +1738,7 @@ icalvalue_set_geo(icalvalue* value, struct icalgeotype v) icalerror_check_value_type(value, ICAL_GEO_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_geo = v; } @@ -1757,6 +1773,7 @@ icalvalue_set_integer(icalvalue* value, int v) icalerror_check_value_type(value, ICAL_INTEGER_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_int = v; } @@ -1791,6 +1808,7 @@ icalvalue_set_method(icalvalue* value, icalproperty_method v) icalerror_check_value_type(value, ICAL_METHOD_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_method = v; } @@ -1825,6 +1843,7 @@ icalvalue_set_period(icalvalue* value, struct icalperiodtype v) icalerror_check_value_type(value, ICAL_PERIOD_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_period = v; } @@ -1837,7 +1856,6 @@ icalvalue_get_period(icalvalue* value) return ((struct icalvalue_impl*)value)->data.v_period; } - icalvalue* icalvalue_new_string (char* v) { @@ -1861,6 +1879,8 @@ icalvalue_set_string(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_STRING_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ @@ -1878,6 +1898,7 @@ icalvalue_get_string(icalvalue* value) return ((struct icalvalue_impl*)value)->data.v_string; } + icalvalue* icalvalue_new_text (char* v) { @@ -1901,6 +1922,8 @@ icalvalue_set_text(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_TEXT_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ @@ -1940,6 +1963,7 @@ icalvalue_set_time(icalvalue* value, struct icaltimetype v) icalerror_check_value_type(value, ICAL_TIME_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_time = v; } @@ -1974,6 +1998,7 @@ icalvalue_set_trigger(icalvalue* value, union icaltriggertype v) icalerror_check_value_type(value, ICAL_TRIGGER_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_trigger = v; } @@ -2010,6 +2035,8 @@ icalvalue_set_uri(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_URI_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ @@ -2049,6 +2076,7 @@ icalvalue_set_utcoffset(icalvalue* value, int v) icalerror_check_value_type(value, ICAL_UTCOFFSET_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_int = v; } @@ -2085,6 +2113,8 @@ icalvalue_set_query(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_QUERY_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ diff --git a/libical/src/libical/icalvalue.h b/libical/src/libical/icalvalue.h index ec7457d6aa..18c15abaf4 100644 --- a/libical/src/libical/icalvalue.h +++ b/libical/src/libical/icalvalue.h @@ -9,20 +9,19 @@ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (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/ + The original code is icalvalue.h ======================================================================*/ diff --git a/libical/src/libical/icalyacc.c b/libical/src/libical/icalyacc.c index 46de31370d..04999747db 100644 --- a/libical/src/libical/icalyacc.c +++ b/libical/src/libical/icalyacc.c @@ -145,20 +145,19 @@ $Id$ $Locker$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (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/ + The original code is icalitip.y @@ -189,6 +188,7 @@ struct icaldurationtype duration; struct icalrecurrencetype recur; short skiplist[367]; short skippos; +int dow_pos; void copy_list(short* array, size_t size); void clear_recur(); @@ -207,7 +207,7 @@ void ical_yy_error(char *s); /* Don't know why I need this.... */ VALUEs, that is, ) correctly. */ -#line 75 "icalyacc.y" +#line 76 "icalyacc.y" typedef union { float v_float; int v_int; @@ -274,7 +274,7 @@ typedef union { -#define YYFINAL 135 +#define YYFINAL 137 #define YYFLAG -32768 #define YYNTBASE 141 @@ -329,10 +329,10 @@ static const short yyprhs[] = { 0, 42, 45, 48, 51, 54, 57, 61, 64, 68, 71, 74, 75, 77, 79, 83, 87, 91, 101, 108, 112, 116, 120, 124, 128, 132, 136, 138, 140, 142, 144, - 146, 148, 150, 152, 155, 159, 161, 165, 169, 173, - 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, - 217, 221, 225, 229, 233, 237, 241, 245, 246, 250, - 253, 255, 257, 261 + 146, 148, 150, 152, 155, 159, 164, 166, 170, 174, + 178, 182, 186, 190, 194, 198, 202, 206, 210, 214, + 218, 222, 226, 230, 234, 238, 242, 246, 250, 251, + 255, 258, 260, 262, 266 }; static const short yyrhs[] = { 142, @@ -351,33 +351,33 @@ static const short yyrhs[] = { 142, 8, 26, 0, 16, 8, 30, 0, 16, 8, 28, 0, 16, 8, 32, 0, 39, 0, 37, 0, 40, 0, 41, 0, 42, 0, 43, 0, 38, 0, 159, - 0, 3, 159, 0, 160, 11, 159, 0, 3, 0, - 161, 11, 3, 0, 33, 8, 3, 0, 36, 8, - 39, 0, 36, 8, 37, 0, 36, 8, 40, 0, - 36, 8, 41, 0, 36, 8, 42, 0, 36, 8, - 43, 0, 36, 8, 38, 0, 22, 8, 161, 0, - 19, 8, 161, 0, 18, 8, 161, 0, 17, 8, - 160, 0, 20, 8, 161, 0, 21, 8, 161, 0, - 25, 8, 161, 0, 24, 8, 161, 0, 23, 8, - 161, 0, 35, 8, 147, 0, 35, 8, 144, 0, - 34, 8, 3, 0, 0, 163, 12, 162, 0, 158, - 163, 0, 137, 0, 138, 0, 165, 4, 4, 0, - 165, 4, 4, 4, 0 + 0, 3, 159, 0, 160, 11, 159, 0, 160, 11, + 3, 159, 0, 3, 0, 161, 11, 3, 0, 33, + 8, 3, 0, 36, 8, 39, 0, 36, 8, 37, + 0, 36, 8, 40, 0, 36, 8, 41, 0, 36, + 8, 42, 0, 36, 8, 43, 0, 36, 8, 38, + 0, 22, 8, 161, 0, 19, 8, 161, 0, 18, + 8, 161, 0, 17, 8, 160, 0, 20, 8, 161, + 0, 21, 8, 161, 0, 25, 8, 161, 0, 24, + 8, 161, 0, 23, 8, 161, 0, 35, 8, 147, + 0, 35, 8, 144, 0, 34, 8, 3, 0, 0, + 163, 12, 162, 0, 158, 163, 0, 137, 0, 138, + 0, 165, 4, 4, 0, 165, 4, 4, 4, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 158, 160, 161, 162, 163, 164, 165, 166, 167, 173, - 175, 178, 181, 196, 198, 201, 203, 205, 221, 222, - 224, 229, 232, 235, 239, 243, 248, 252, 257, 262, - 267, 270, 273, 277, 282, 287, 296, 317, 349, 351, - 352, 353, 354, 355, 356, 360, 362, 363, 364, 365, - 366, 367, 371, 373, 374, 377, 379, 382, 384, 385, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 403, 406, 410, 412, 414, - 422, 423, 425, 431 + 159, 161, 162, 163, 164, 165, 166, 167, 168, 174, + 176, 179, 182, 197, 199, 202, 204, 206, 222, 223, + 225, 230, 233, 236, 240, 244, 249, 253, 258, 263, + 268, 271, 274, 278, 283, 288, 297, 318, 350, 352, + 353, 354, 355, 356, 357, 361, 364, 366, 368, 370, + 372, 374, 379, 381, 382, 383, 386, 388, 391, 393, + 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 412, 415, 419, 421, + 423, 431, 432, 434, 440 }; #endif @@ -415,10 +415,10 @@ static const short yyr1[] = { 0, 149, 150, 150, 150, 151, 151, 152, 152, 153, 154, 155, 155, 155, 156, 156, 156, 157, 157, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, - 159, 159, 160, 160, 160, 161, 161, 162, 162, 162, + 159, 159, 160, 160, 160, 160, 161, 161, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 163, 163, 164, - 165, 165, 166, 166 + 162, 162, 162, 162, 162, 162, 162, 162, 163, 163, + 164, 165, 165, 166, 166 }; static const short yyr2[] = { 0, @@ -427,55 +427,55 @@ static const short yyr2[] = { 0, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 0, 1, 1, 3, 3, 3, 9, 6, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 3, 1, 3, 3, 3, 3, + 1, 1, 1, 2, 3, 4, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 0, 3, 2, - 1, 1, 3, 4 + 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, + 2, 1, 1, 3, 4 }; static const short yydefact[] = { 0, 9, 13, 11, 12, 0, 10, 32, 33, 1, 2, - 3, 4, 0, 5, 6, 78, 7, 0, 8, 0, - 0, 0, 80, 0, 14, 42, 40, 44, 39, 43, - 41, 45, 0, 0, 34, 36, 35, 19, 0, 83, + 3, 4, 0, 5, 6, 79, 7, 0, 8, 0, + 0, 0, 81, 0, 14, 42, 40, 44, 39, 43, + 41, 45, 0, 0, 34, 36, 35, 19, 0, 84, 15, 18, 21, 30, 0, 22, 23, 24, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 79, 84, 31, 25, 27, 29, 0, 0, + 0, 0, 80, 85, 31, 25, 27, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 33, 38, 0, 26, 0, 28, 0, - 47, 52, 46, 48, 49, 50, 51, 53, 69, 56, - 68, 67, 70, 71, 66, 74, 73, 72, 58, 77, - 13, 76, 75, 60, 65, 59, 61, 62, 63, 64, - 0, 54, 0, 0, 0, 16, 55, 57, 14, 17, - 37, 18, 0, 0, 0 + 47, 52, 46, 48, 49, 50, 51, 53, 70, 57, + 69, 68, 71, 72, 67, 75, 74, 73, 59, 78, + 13, 77, 76, 61, 66, 60, 62, 63, 64, 65, + 0, 54, 0, 0, 0, 16, 0, 55, 58, 14, + 17, 37, 56, 18, 0, 0, 0 }; -static const short yydefgoto[] = { 133, - 9, 10, 11, 42, 131, 12, 35, 36, 37, 46, +static const short yydefgoto[] = { 135, + 9, 10, 11, 42, 132, 12, 35, 36, 37, 46, 47, 48, 38, 13, 14, 15, 16, 98, 99, 101, 63, 23, 17, 18, 19 }; static const short yypact[] = { -1, --32768, -123,-32768,-32768, 1,-32768, 3, 6,-32768,-32768, --32768,-32768, -127,-32768,-32768,-32768,-32768, 64,-32768, 66, - -10, -2, 58, 67, -58,-32768,-32768,-32768,-32768,-32768, --32768,-32768, -128, 70,-32768,-32768,-32768, -55, 28, 71, --32768, -64,-32768,-32768, -68,-32768,-32768,-32768,-32768, 69, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83,-32768,-32768, 2, 89, 90,-32768, 0, 91, - 91, 91, 91, 91, 91, 91, 91, 92, 93, 94, - -14, -51,-32768,-32768,-32768, -36,-32768, -56,-32768, -7, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 88,-32768, - 95, 95, 95, 95, 95, 95, 95, 95,-32768,-32768, - -29,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 98,-32768, -7, 99, 100, -26,-32768,-32768, -58,-32768, --32768,-32768, 105, 107,-32768 +-32768, -123,-32768,-32768, 1,-32768, 3, 8,-32768,-32768, +-32768,-32768, -122,-32768,-32768,-32768,-32768, 12,-32768, 33, + -7, -2, 40, 49, -119,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, -128, 51,-32768,-32768,-32768, -46, 39, 80, +-32768, -55,-32768,-32768, -100,-32768,-32768,-32768,-32768, 78, + 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91,-32768,-32768, 2, 97, 98,-32768, 0, 99, + 99, 99, 99, 99, 99, 99, 99, 100, 101, 102, + -11, -41,-32768,-32768,-32768, -28,-32768, -27,-32768, 28, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 96,-32768, + 103, 103, 103, 103, 103, 103, 103, 103,-32768,-32768, + -20,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 107,-32768, 7, 108, 109, -17, 28,-32768,-32768, -119, +-32768,-32768,-32768,-32768, 115, 116,-32768 }; static const short yypgoto[] = {-32768, --32768,-32768, 29, -21,-32768, 30,-32768,-32768, 84,-32768, - 45, 46,-32768,-32768, 47,-32768,-32768, -79,-32768, -17, +-32768,-32768, 37, -12,-32768, 41,-32768,-32768, 93,-32768, + 53, 55,-32768,-32768, 58,-32768,-32768, -72,-32768, 5, -32768,-32768,-32768,-32768,-32768 }; @@ -484,37 +484,37 @@ static const short yypgoto[] = {-32768, static const short yytable[] = { 1, - 33, 2, 90, 43, 82, 20, -81, 44, 21, -82, - 122, 22, 3, 4, 5, 26, 27, 28, 29, 30, - 31, 32, 114, 115, 116, 117, 118, 119, 120, 91, - 92, 93, 94, 95, 96, 97, 91, 92, 93, 94, - 95, 96, 97, 127, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 102, 103, 104, 105, 106, 107, 108, - 59, 60, 61, 62, 66, 67, 68, 24, 25, 39, - 40, 41, 45, 34, 64, 65, 69, 121, 68, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 86, 88, 100, 109, 110, 111, 67, 123, 125, - 126, 128, 129, 130, 134, 124, 135, 132, 112, 113, - 87, 85, 89, 0, 0, 0, 0, 0, 0, 0, - 0, 49, 0, 0, 0, 0, 34, 0, 0, 6, - 0, 0, 0, 0, 0, 7, 8, -31, 83, 84 + 33, 2, 90, 43, 82, 20, -82, 44, 21, 127, + 41, -83, 3, 4, 5, 24, 22, 122, 26, 27, + 28, 29, 30, 31, 32, 114, 115, 116, 117, 118, + 119, 120, 66, 67, 68, 25, 91, 92, 93, 94, + 95, 96, 97, 91, 92, 93, 94, 95, 96, 97, + 128, 39, 40, 45, 133, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 91, 92, 93, 94, 95, 96, + 97, 59, 60, 61, 62, 102, 103, 104, 105, 106, + 107, 108, 34, 64, 65, 69, 70, 121, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, + 88, 100, 109, 110, 111, 67, 123, 68, 125, 126, + 129, 130, 131, 124, 136, 137, 112, 134, 87, 0, + 113, 89, 85, 0, 0, 0, 34, 0, 0, 6, + 49, 0, 0, 0, 0, 7, 8, -31, 83, 84 }; static const short yycheck[] = { 1, - 3, 3, 3, 132, 3, 129, 4, 136, 8, 4, - 90, 139, 14, 15, 16, 26, 27, 28, 29, 30, - 31, 32, 37, 38, 39, 40, 41, 42, 43, 37, - 38, 39, 40, 41, 42, 43, 37, 38, 39, 40, - 41, 42, 43, 123, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 71, 72, 73, 74, 75, 76, 77, - 33, 34, 35, 36, 133, 134, 135, 4, 3, 12, - 4, 130, 3, 129, 4, 140, 8, 129, 135, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 3, 3, 3, 3, 3, 3, 134, 11, 129, - 3, 3, 3, 130, 0, 11, 0, 129, 80, 80, - 66, 65, 67, -1, -1, -1, -1, -1, -1, -1, - -1, 38, -1, -1, -1, -1, 129, -1, -1, 131, - -1, -1, -1, -1, -1, 137, 138, 139, 137, 138 + 3, 3, 3, 132, 3, 129, 4, 136, 8, 3, + 130, 4, 14, 15, 16, 4, 139, 90, 26, 27, + 28, 29, 30, 31, 32, 37, 38, 39, 40, 41, + 42, 43, 133, 134, 135, 3, 37, 38, 39, 40, + 41, 42, 43, 37, 38, 39, 40, 41, 42, 43, + 123, 12, 4, 3, 127, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 37, 38, 39, 40, 41, 42, + 43, 33, 34, 35, 36, 71, 72, 73, 74, 75, + 76, 77, 129, 4, 140, 8, 8, 129, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, + 3, 3, 3, 3, 3, 134, 11, 135, 129, 3, + 3, 3, 130, 11, 0, 0, 80, 130, 66, -1, + 80, 67, 65, -1, -1, -1, 129, -1, -1, 131, + 38, -1, -1, -1, -1, 137, 138, 139, 137, 138 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/lib/bison.simple" @@ -1060,7 +1060,7 @@ yyreduce: switch (yyn) { case 9: -#line 167 "icalyacc.y" +#line 168 "icalyacc.y" { icalparser_yy_value = 0; icalparser_clear_flex_input(); @@ -1068,15 +1068,15 @@ case 9: ; break;} case 11: -#line 177 "icalyacc.y" +#line 178 "icalyacc.y" { icalparser_yy_value = icalvalue_new_boolean(1); ; break;} case 12: -#line 179 "icalyacc.y" +#line 180 "icalyacc.y" { icalparser_yy_value = icalvalue_new_boolean(0); ; break;} case 13: -#line 182 "icalyacc.y" +#line 183 "icalyacc.y" { struct icaltimetype stm; @@ -1092,23 +1092,23 @@ case 13: ; break;} case 14: -#line 197 "icalyacc.y" +#line 198 "icalyacc.y" {utc = 0;; break;} case 15: -#line 198 "icalyacc.y" +#line 199 "icalyacc.y" {utc = 1;; break;} case 16: -#line 202 "icalyacc.y" +#line 203 "icalyacc.y" {utc_b = 0;; break;} case 17: -#line 203 "icalyacc.y" +#line 204 "icalyacc.y" {utc_b = 1;; break;} case 18: -#line 207 "icalyacc.y" +#line 208 "icalyacc.y" { struct icaltimetype stm; stm = fill_datetime(yyvsp[-3].v_string, yyvsp[-1].v_string); @@ -1120,100 +1120,100 @@ case 18: ; break;} case 21: -#line 225 "icalyacc.y" +#line 226 "icalyacc.y" { duration.weeks = atoi(yyvsp[-1].v_string); ; break;} case 22: -#line 230 "icalyacc.y" +#line 231 "icalyacc.y" { ; break;} case 23: -#line 233 "icalyacc.y" +#line 234 "icalyacc.y" { ; break;} case 24: -#line 236 "icalyacc.y" +#line 237 "icalyacc.y" { ; break;} case 25: -#line 240 "icalyacc.y" +#line 241 "icalyacc.y" { duration.hours = atoi(yyvsp[-1].v_string); ; break;} case 26: -#line 244 "icalyacc.y" +#line 245 "icalyacc.y" { duration.hours = atoi(yyvsp[-2].v_string); ; break;} case 27: -#line 249 "icalyacc.y" +#line 250 "icalyacc.y" { duration.minutes = atoi(yyvsp[-1].v_string); ; break;} case 28: -#line 253 "icalyacc.y" +#line 254 "icalyacc.y" { duration.minutes = atoi(yyvsp[-2].v_string); ; break;} case 29: -#line 258 "icalyacc.y" +#line 259 "icalyacc.y" { duration.seconds = atoi(yyvsp[-1].v_string); ; break;} case 30: -#line 263 "icalyacc.y" +#line 264 "icalyacc.y" { duration.days = atoi(yyvsp[-1].v_string); ; break;} case 31: -#line 268 "icalyacc.y" +#line 269 "icalyacc.y" { ; break;} case 32: -#line 271 "icalyacc.y" +#line 272 "icalyacc.y" { ; break;} case 33: -#line 274 "icalyacc.y" +#line 275 "icalyacc.y" { ; break;} case 34: -#line 278 "icalyacc.y" +#line 279 "icalyacc.y" { icalparser_yy_value = icalvalue_new_duration(duration); memset(&duration,0, sizeof(duration)); ; break;} case 35: -#line 283 "icalyacc.y" +#line 284 "icalyacc.y" { icalparser_yy_value = icalvalue_new_duration(duration); memset(&duration,0, sizeof(duration)); ; break;} case 36: -#line 288 "icalyacc.y" +#line 289 "icalyacc.y" { icalparser_yy_value = icalvalue_new_duration(duration); memset(&duration,0, sizeof(duration)); ; break;} case 37: -#line 297 "icalyacc.y" +#line 298 "icalyacc.y" { struct icalperiodtype p; @@ -1236,7 +1236,7 @@ case 37: ; break;} case 38: -#line 318 "icalyacc.y" +#line 319 "icalyacc.y" { struct icalperiodtype p; @@ -1265,175 +1265,194 @@ case 38: ; break;} case 39: -#line 350 "icalyacc.y" +#line 351 "icalyacc.y" {clear_recur();recur.freq = ICAL_SECONDLY_RECURRENCE;; break;} case 40: -#line 351 "icalyacc.y" +#line 352 "icalyacc.y" {clear_recur();recur.freq = ICAL_MINUTELY_RECURRENCE;; break;} case 41: -#line 352 "icalyacc.y" +#line 353 "icalyacc.y" {clear_recur();recur.freq = ICAL_HOURLY_RECURRENCE;; break;} case 42: -#line 353 "icalyacc.y" +#line 354 "icalyacc.y" {clear_recur();recur.freq = ICAL_DAILY_RECURRENCE;; break;} case 43: -#line 354 "icalyacc.y" +#line 355 "icalyacc.y" {clear_recur();recur.freq = ICAL_WEEKLY_RECURRENCE;; break;} case 44: -#line 355 "icalyacc.y" +#line 356 "icalyacc.y" {clear_recur();recur.freq = ICAL_MONTHLY_RECURRENCE;; break;} case 45: -#line 356 "icalyacc.y" +#line 357 "icalyacc.y" {clear_recur();recur.freq = ICAL_YEARLY_RECURRENCE;; break;} case 46: -#line 361 "icalyacc.y" -{ skiplist[skippos]=ICAL_SUNDAY_WEEKDAY; if( skippos<8) skippos++;; +#line 362 "icalyacc.y" +{ skiplist[skippos]=ICAL_SUNDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 47: -#line 362 "icalyacc.y" -{ skiplist[skippos]=ICAL_MONDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 364 "icalyacc.y" +{ skiplist[skippos]=ICAL_MONDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 48: -#line 363 "icalyacc.y" -{ skiplist[skippos]=ICAL_TUESDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 366 "icalyacc.y" +{ skiplist[skippos]=ICAL_TUESDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 49: -#line 364 "icalyacc.y" -{ skiplist[skippos]=ICAL_WEDNESDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 368 "icalyacc.y" +{ skiplist[skippos]=ICAL_WEDNESDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 50: -#line 365 "icalyacc.y" -{ skiplist[skippos]=ICAL_THURSDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 370 "icalyacc.y" +{ skiplist[skippos]=ICAL_THURSDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 51: -#line 366 "icalyacc.y" -{ skiplist[skippos]=ICAL_FRIDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 372 "icalyacc.y" +{ skiplist[skippos]=ICAL_FRIDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 52: -#line 367 "icalyacc.y" -{ skiplist[skippos]=ICAL_SATURDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 374 "icalyacc.y" +{ skiplist[skippos]=ICAL_SATURDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; + break;} +case 53: +#line 380 "icalyacc.y" +{dow_pos = 0; break;} case 54: -#line 373 "icalyacc.y" -{ ; +#line 381 "icalyacc.y" +{ dow_pos = atoi(yyvsp[-1].v_string); + break;} +case 55: +#line 382 "icalyacc.y" +{dow_pos = 0; break;} case 56: -#line 378 "icalyacc.y" -{ skiplist[skippos] = atoi(yyvsp[0].v_string); skippos++;; +#line 383 "icalyacc.y" +{ dow_pos = atoi(yyvsp[-1].v_string); break;} case 57: -#line 379 "icalyacc.y" -{ skiplist[skippos] = atoi(yyvsp[0].v_string); if (skippos<367) skippos++;; +#line 387 "icalyacc.y" +{ skiplist[skippos] = atoi(yyvsp[0].v_string); skippos++;; break;} case 58: -#line 383 "icalyacc.y" -{recur.interval = atoi(yyvsp[0].v_string);; +#line 388 "icalyacc.y" +{ skiplist[skippos] = atoi(yyvsp[0].v_string); if (skippos<367) skippos++;; break;} case 59: -#line 384 "icalyacc.y" -{recur.week_start = ICAL_SUNDAY_WEEKDAY;; +#line 392 "icalyacc.y" +{recur.interval = atoi(yyvsp[0].v_string);; break;} case 60: -#line 385 "icalyacc.y" -{recur.week_start = ICAL_MONDAY_WEEKDAY;; +#line 393 "icalyacc.y" +{recur.week_start = ICAL_SUNDAY_WEEKDAY;; break;} case 61: -#line 386 "icalyacc.y" -{recur.week_start = ICAL_TUESDAY_WEEKDAY;; +#line 394 "icalyacc.y" +{recur.week_start = ICAL_MONDAY_WEEKDAY;; break;} case 62: -#line 387 "icalyacc.y" -{recur.week_start = ICAL_WEDNESDAY_WEEKDAY;; +#line 395 "icalyacc.y" +{recur.week_start = ICAL_TUESDAY_WEEKDAY;; break;} case 63: -#line 388 "icalyacc.y" -{recur.week_start = ICAL_THURSDAY_WEEKDAY;; +#line 396 "icalyacc.y" +{recur.week_start = ICAL_WEDNESDAY_WEEKDAY;; break;} case 64: -#line 389 "icalyacc.y" -{recur.week_start = ICAL_FRIDAY_WEEKDAY;; +#line 397 "icalyacc.y" +{recur.week_start = ICAL_THURSDAY_WEEKDAY;; break;} case 65: -#line 390 "icalyacc.y" -{recur.week_start = ICAL_SATURDAY_WEEKDAY;; +#line 398 "icalyacc.y" +{recur.week_start = ICAL_FRIDAY_WEEKDAY;; break;} case 66: -#line 391 "icalyacc.y" -{copy_list(recur.by_second,60);; +#line 399 "icalyacc.y" +{recur.week_start = ICAL_SATURDAY_WEEKDAY;; break;} case 67: -#line 392 "icalyacc.y" -{copy_list(recur.by_minute,60);; +#line 400 "icalyacc.y" +{copy_list(recur.by_second,60);; break;} case 68: -#line 393 "icalyacc.y" -{copy_list(recur.by_hour,24);; +#line 401 "icalyacc.y" +{copy_list(recur.by_minute,60);; break;} case 69: -#line 394 "icalyacc.y" -{copy_list(recur.by_day,7);; +#line 402 "icalyacc.y" +{copy_list(recur.by_hour,24);; break;} case 70: -#line 395 "icalyacc.y" -{copy_list(recur.by_month,12);; +#line 403 "icalyacc.y" +{copy_list(recur.by_day,7);; break;} case 71: -#line 396 "icalyacc.y" -{copy_list(recur.by_month_day,31);; +#line 404 "icalyacc.y" +{copy_list(recur.by_month,12);; break;} case 72: -#line 397 "icalyacc.y" -{copy_list(recur.by_year_day,366);; +#line 405 "icalyacc.y" +{copy_list(recur.by_month_day,31);; break;} case 73: -#line 398 "icalyacc.y" -{copy_list(recur.by_week_no,53);; +#line 406 "icalyacc.y" +{copy_list(recur.by_year_day,366);; break;} case 74: -#line 399 "icalyacc.y" -{copy_list(recur.by_set_pos,366);; +#line 407 "icalyacc.y" +{copy_list(recur.by_week_no,53);; break;} case 75: -#line 401 "icalyacc.y" +#line 408 "icalyacc.y" +{copy_list(recur.by_set_pos,366);; + break;} +case 76: +#line 410 "icalyacc.y" { recur.until = icalvalue_get_datetime(icalparser_yy_value); icalvalue_free(icalparser_yy_value); icalparser_yy_value=0;; break;} -case 76: -#line 404 "icalyacc.y" +case 77: +#line 413 "icalyacc.y" { recur.until = icalvalue_get_date(icalparser_yy_value); icalvalue_free(icalparser_yy_value); icalparser_yy_value=0;; break;} -case 77: -#line 407 "icalyacc.y" +case 78: +#line 416 "icalyacc.y" { recur.count = atoi(yyvsp[0].v_string); ; break;} -case 80: -#line 416 "icalyacc.y" +case 81: +#line 425 "icalyacc.y" { icalparser_yy_value = icalvalue_new_recur(recur); ; break;} -case 81: -#line 422 "icalyacc.y" +case 82: +#line 431 "icalyacc.y" { utcsign = 1; ; break;} -case 82: -#line 423 "icalyacc.y" +case 83: +#line 432 "icalyacc.y" { utcsign = -1; ; break;} -case 83: -#line 427 "icalyacc.y" +case 84: +#line 436 "icalyacc.y" { icalparser_yy_value = icalvalue_new_utcoffset( utcsign * (yyvsp[-1].v_int*3600) + (yyvsp[0].v_int*60) ); ; break;} -case 84: -#line 432 "icalyacc.y" +case 85: +#line 441 "icalyacc.y" { icalparser_yy_value = icalvalue_new_utcoffset(utcsign * (yyvsp[-2].v_int*3600) + (yyvsp[-1].v_int*60) +(yyvsp[0].v_int)); ; @@ -1660,7 +1679,7 @@ yyerrhandle: } return 1; } -#line 438 "icalyacc.y" +#line 447 "icalyacc.y" diff --git a/libical/src/libical/icalyacc.y b/libical/src/libical/icalyacc.y index 1fe2a737e9..0917daf371 100644 --- a/libical/src/libical/icalyacc.y +++ b/libical/src/libical/icalyacc.y @@ -6,7 +6,7 @@ DESCRIPTION: - $Id: icalyacc.y,v 1.4 2000/06/06 22:48:09 alves Exp $ + $Id: icalyacc.y,v 1.5 2000/08/24 20:12:04 jpr Exp $ $Locker: $ (C) COPYRIGHT 1999 Eric Busboom @@ -53,6 +53,7 @@ struct icaldurationtype duration; struct icalrecurrencetype recur; short skiplist[367]; short skippos; +int dow_pos; void copy_list(short* array, size_t size); void clear_recur(); @@ -358,20 +359,28 @@ recur_start: weekday: - SU { skiplist[skippos]=ICAL_SUNDAY_WEEKDAY; if( skippos<8) skippos++;} - | MO { skiplist[skippos]=ICAL_MONDAY_WEEKDAY;if( skippos<8) skippos++;} - | TU { skiplist[skippos]=ICAL_TUESDAY_WEEKDAY;if( skippos<8) skippos++;} - | WE { skiplist[skippos]=ICAL_WEDNESDAY_WEEKDAY;if( skippos<8) skippos++;} - | TH { skiplist[skippos]=ICAL_THURSDAY_WEEKDAY;if( skippos<8) skippos++;} - | FR { skiplist[skippos]=ICAL_FRIDAY_WEEKDAY;if( skippos<8) skippos++;} - | SA { skiplist[skippos]=ICAL_SATURDAY_WEEKDAY;if( skippos<8) skippos++;} + SU { skiplist[skippos]=ICAL_SUNDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | MO { skiplist[skippos]=ICAL_MONDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | TU { skiplist[skippos]=ICAL_TUESDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | WE { skiplist[skippos]=ICAL_WEDNESDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | TH { skiplist[skippos]=ICAL_THURSDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | FR { skiplist[skippos]=ICAL_FRIDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | SA { skiplist[skippos]=ICAL_SATURDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} ; weekday_list: - weekday - | DIGITS weekday { } /* HACK Incorectly handles int in BYDAY */ - | weekday_list COMMA weekday + weekday {dow_pos = 0}; + | DIGITS weekday { dow_pos = atoi($1)} + | weekday_list COMMA weekday {dow_pos = 0}; + | weekday_list COMMA DIGITS weekday { dow_pos = atoi($3)} recur_list: diff --git a/libical/src/libical/pvl.c b/libical/src/libical/pvl.c index d5225a541e..94eaeac874 100644 --- a/libical/src/libical/pvl.c +++ b/libical/src/libical/pvl.c @@ -3,18 +3,7 @@ CREATOR: eric November, 1995 - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ #ifdef HAVE_CONFIG_H @@ -505,6 +494,10 @@ pvl_remove(pvl_list l,pvl_elem e) data = E->d; + E->prior = 0; + E->next = 0; + E->d = 0; + free(E); return data; diff --git a/libical/src/libical/pvl.h b/libical/src/libical/pvl.h index 8113f7495a..40ca516e9f 100644 --- a/libical/src/libical/pvl.h +++ b/libical/src/libical/pvl.h @@ -3,27 +3,9 @@ CREATOR: eric November, 1995 - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ -/* - struct pvl_elem_t - - This type is private. Always use pvl_elem instead - - */ #ifndef __PVL_H__ #define __PVL_H__ @@ -31,6 +13,14 @@ typedef void* pvl_list; typedef void* pvl_elem; +/* + struct pvl_elem_t + + This type is private. Always use pvl_elem instead. The struct would + not even appear in this header except to make code in the USE_MACROS + blocks work + + */ typedef struct pvl_elem_t { int MAGIC; /* Magic Identifier */ |