Index: design-data/params-in-prop.txt =================================================================== --- design-data/params-in-prop.txt (revision 915) +++ design-data/params-in-prop.txt (working copy) @@ -1,6 +1,6 @@ ACTION VALUE X ATTACH FMTTYPE ENCODING VALUE X -ATTENDEE CN CUTYPE DELEGATED-FROM DELEGATED-TO DIR LANGUAGE MEMBER PARTSTAT ROLE RSVP SENT-BY X +ATTENDEE CN CUTYPE DELEGATED-FROM DELEGATED-TO DIR LANGUAGE MEMBER PARTSTAT ROLE RSVP SENT-BY RECEIVED-SEQUENCE RECEIVED-DTSTAMP X CALSCALE X CATEGORIES LANGUAGE X CLASS X Index: design-data/parameters.csv =================================================================== --- design-data/parameters.csv (revision 915) +++ design-data/parameters.csv (working copy) @@ -18,6 +18,8 @@ "ROLE","icalparameter_role","CHAIR;REQ-PARTICIPANT;OPT-PARTICIPANT;NON-PARTICIPANT" "RSVP","icalparameter_rsvp","TRUE;FALSE" "SENT-BY","const char*", +"RECEIVED-SEQUENCE","const char*", +"RECEIVED-DTSTAMP","const char*", "TZID","const char*", "VALUE","icalparameter_value","BINARY;BOOLEAN;DATE;DURATION;FLOAT;INTEGER;PERIOD;RECUR;TEXT;URI;ERROR;DATE-TIME;UTC-OFFSET;CAL-ADDRESS" "X","const char*", Index: src/libical/icalrestriction.c.in =================================================================== --- src/libical/icalrestriction.c.in (revision 915) +++ src/libical/icalrestriction.c.in (working copy) @@ -16,6 +16,9 @@ #include #include /* For snprintf */ +#ifdef WIN32 +#define snprintf _snprintf +#endif #define TMP_BUF_SIZE 1024 Index: src/libical/icalparser.c =================================================================== --- src/libical/icalparser.c (revision 915) +++ src/libical/icalparser.c (working copy) @@ -741,7 +741,11 @@ ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); } - c = icalcomponent_new(comp_kind); + if (comp_kind != ICAL_X_COMPONENT) { + c = icalcomponent_new(comp_kind); + } else { + c = icalcomponent_new_x(str); + } if (c == 0){ c = icalcomponent_new(ICAL_XLICINVALID_COMPONENT); @@ -1109,28 +1113,15 @@ } if (vcount == 0){ - char temp[200]; /* HACK */ - - icalproperty_kind prop_kind = icalproperty_isa(prop); icalcomponent *tail = pvl_data(pvl_tail(parser->components)); - snprintf(temp,sizeof(temp),"No value for %s property. Removing entire property", - icalproperty_kind_to_string(prop_kind)); - - insert_error(tail, str, temp, - ICAL_XLICERRORTYPE_VALUEPARSEERROR); - - /* Remove the troublesome property */ + /* Remove the empty property */ icalcomponent_remove_property(tail,prop); icalproperty_free(prop); - prop = 0; - tail = 0; - parser->state = ICALPARSER_ERROR; - return 0; - } else { - - break; + prop = NULL; } + + break; } } Index: src/libical/icalrecur.c =================================================================== --- src/libical/icalrecur.c (revision 915) +++ src/libical/icalrecur.c (working copy) @@ -148,7 +148,8 @@ #endif #ifdef WIN32 -#define strcasecmp stricmp +#define snprintf _snprintf +#define strcasecmp stricmp #endif #include "icalrecur.h" @@ -322,14 +323,10 @@ * function sorts the days taking into account the first day of week. */ static void -sort_bydayrules(struct icalrecur_parser *parser) +sort_bydayrules(short * array, int week_start) { - short *array; - int week_start, one, two, i, j; + int one, two, i, j; - array = parser->rt.by_day; - week_start = parser->rt.week_start; - for (i=0; irt.by_day, parser->rt.week_start); } @@ -448,14 +445,20 @@ if (strcasecmp(name,"FREQ") == 0){ parser.rt.freq = icalrecur_string_to_freq(value); } else if (strcasecmp(name,"COUNT") == 0){ - parser.rt.count = atoi(value); + int v = atoi(value); + if (v >= 0) { + parser.rt.count = v; + } } else if (strcasecmp(name,"UNTIL") == 0){ parser.rt.until = icaltime_from_string(value); } else if (strcasecmp(name,"INTERVAL") == 0){ - parser.rt.interval = (short)atoi(value); + int v = atoi(value); + if (v > 0 && v <= SHRT_MAX) { + parser.rt.interval = (short) v; + } } else if (strcasecmp(name,"WKST") == 0){ parser.rt.week_start = icalrecur_string_to_weekday(value); - sort_bydayrules(&parser); + sort_bydayrules(parser.rt.by_day, parser.rt.week_start); } else if (strcasecmp(name,"BYSECOND") == 0){ icalrecur_add_byrules(&parser,parser.rt.by_second, ICAL_BY_SECOND_SIZE,value); @@ -1553,6 +1556,7 @@ if ( day > days_in_month){ impl->last.day = 1; increment_month(impl); + impl->last.day--; /* Go back one day, so searches next month start at day 1 */ data_valid = 0; /* signal that impl->last is invalid */ } @@ -1675,6 +1679,10 @@ return 1; } + /* this call to 'sort_bydayrules' assures that the occurrences for + weekly recurrences will be generated in a strict linear order. */ + sort_bydayrules(BYDAYPTR, impl->rule.week_start); + /* If we get here, we need to step to tne next day */ for (;;) { @@ -2304,11 +2312,6 @@ } } - if(impl->last.year >= 2038 ){ - /* HACK */ - return icaltime_null_time(); - } - } while(!check_contracting_rules(impl) || icaltime_compare(impl->last,impl->dtstart) < 0 || valid == 0); Index: src/libical/icaltimezone.c =================================================================== --- src/libical/icaltimezone.c (revision 915) +++ src/libical/icaltimezone.c (working copy) @@ -40,7 +40,9 @@ #include "icalerror.h" #include "icalparser.h" #include "icaltimezone.h" +#ifndef NO_ZONES_TAB #include "icaltz-util.h" +#endif #include @@ -54,6 +56,9 @@ /* The gmtime() in Microsoft's C library is MT-safe */ #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) + +#define snprintf _snprintf +#define strcasecmp stricmp #endif /** This is the toplevel directory where the timezone data is installed in. */ @@ -149,10 +154,10 @@ /** An array of icaltimezones for the builtin timezones. */ -static icalarray *builtin_timezones = NULL; +static icalarray *s_builtin_timezones = NULL; -/** This is the special UTC timezone, which isn't in builtin_timezones. */ -static icaltimezone utc_timezone = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +/** This is the special UTC timezone, which isn't in s_builtin_timezones. */ +static icaltimezone utc_timezone = { (char *) "UTC", NULL, NULL, 0.0, 0.0, NULL, NULL, 0, NULL }; static char* zone_files_directory = NULL; @@ -191,8 +196,6 @@ int end_year); -static void icaltimezone_init_builtin_timezones(void); - static void icaltimezone_parse_zone_tab (void); #ifdef USE_BUILTIN_TZDATA @@ -1343,17 +1346,19 @@ icalarray* icaltimezone_get_builtin_timezones (void) { - if (!builtin_timezones) - icaltimezone_init_builtin_timezones (); - - return builtin_timezones; +#ifndef NO_ZONES_TAB + if (!s_builtin_timezones) { + icaltimezone_parse_zone_tab (); + } +#endif + return s_builtin_timezones; } /** Release builtin timezone memory */ void icaltimezone_free_builtin_timezones(void) { - icaltimezone_array_free(builtin_timezones); + icaltimezone_array_free(s_builtin_timezones); } @@ -1362,18 +1367,21 @@ icaltimezone_get_builtin_timezone (const char *location) { icaltimezone *zone; - int lower; + unsigned int lower; const char *zone_location; + icalarray * builtin_timezones; if (!location || !location[0]) return NULL; - if (!builtin_timezones) - icaltimezone_init_builtin_timezones (); - if (!strcmp (location, "UTC")) return &utc_timezone; + builtin_timezones = icaltimezone_get_builtin_timezones(); + if (!builtin_timezones) { + return NULL; + } + #if 0 /* Do a simple binary search. */ lower = middle = 0; @@ -1447,9 +1455,7 @@ { icaltimezone *zone=NULL; int count, i; - - if (!builtin_timezones) - icaltimezone_init_builtin_timezones (); + icalarray * builtin_timezones; if (offset==0) return &utc_timezone; @@ -1457,6 +1463,11 @@ if (!tzname) return NULL; + builtin_timezones = icaltimezone_get_builtin_timezones(); + if (!builtin_timezones) { + return NULL; + } + count = builtin_timezones->num_elements; for (i=0; inum_elements; i++) free ( ((icaltimezone*)icalarray_element_at(mybuiltin_timezones, i))->location); icalarray_free (mybuiltin_timezones); @@ -1750,6 +1747,7 @@ static void icaltimezone_load_builtin_timezone (icaltimezone *zone) { +#ifndef NO_ZONES_TAB icalcomponent *subcomp; /* If the location isn't set, it isn't a builtin timezone. */ @@ -1813,7 +1811,7 @@ icalcomponent_free(comp); } #endif - +#endif /* NO_ZONES_TAB */ } Index: src/libical/icalcomponent.c =================================================================== --- src/libical/icalcomponent.c (revision 915) +++ src/libical/icalcomponent.c (working copy) @@ -46,6 +46,10 @@ #include /* for fprintf */ #include /* for strdup */ #include /* for INT_MAX */ +#ifdef WIN32 +#define snprintf _snprintf +#define strncasecmp strnicmp +#endif struct icalcomponent_impl { Index: src/libical/icalenums.c =================================================================== --- src/libical/icalenums.c (revision 915) +++ src/libical/icalenums.c (working copy) @@ -35,6 +35,9 @@ #include /* For stderr */ #include /* For strncmp */ #include +#ifdef WIN32 +#define snprintf _snprintf +#endif #include "icalmemory.h" /*** @brief Allowed request status values Index: src/libical/icalproperty.c =================================================================== --- src/libical/icalproperty.c (revision 915) +++ src/libical/icalproperty.c (working copy) @@ -273,16 +273,6 @@ return line_start + chars_left; } - /* Now we jump to the last possible character of the line, and step back - trying to find a ';' ':' or ' '. If we find one, we return the character - after it. */ - pos = line_start + MAX_LINE_LEN - 2; - while (pos > line_start) { - if (*pos == ';' || *pos == ':' || *pos == ' ') { - return pos + 1; - } - pos--; - } /* Now try to split on a UTF-8 boundary defined as a 7-bit value or as a byte with the two high-most bits set: 11xxxxxx. See http://czyborra.com/utf/ */ Index: src/libical/icalduration.c =================================================================== --- src/libical/icalduration.c (revision 915) +++ src/libical/icalduration.c (working copy) @@ -35,6 +35,9 @@ #include #include #include +#ifdef WIN32 +#define snprintf _snprintf +#endif #include "icalerror.h" #include "icalmemory.h" Index: config.h.cmake =================================================================== --- config.h.cmake (revision 915) +++ config.h.cmake (working copy) @@ -158,3 +158,8 @@ #define strcasecmp stricmp #define snprintf _snprintf #endif + +/* Define to 1 if you DO NOT WANT to use any zones.tab, neither builtin nor + * system. Only UTC will be available then. + */ +#define NO_ZONES_TAB