diff options
-rw-r--r-- | src/libical/icalcomponent.c | 3 | ||||
-rw-r--r-- | src/libical/icalerror.h | 1 | ||||
-rw-r--r-- | src/libical/icalmime.c | 29 | ||||
-rw-r--r-- | src/libical/icalproperty.c | 3 | ||||
-rw-r--r-- | src/libical/icalrecur.c | 255 | ||||
-rw-r--r-- | src/libical/icalrecur.h | 2 | ||||
-rw-r--r-- | src/libical/icaltime.c | 2 | ||||
-rw-r--r-- | src/libicalss/icalbdbset.c | 249 | ||||
-rw-r--r-- | src/libicalss/icalcalendar.c | 2 | ||||
-rw-r--r-- | src/libicalss/icalcluster.c | 2 | ||||
-rw-r--r-- | src/libicalss/icaldirset.c | 8 | ||||
-rw-r--r-- | src/libicalss/icalgauge.c | 16 | ||||
-rw-r--r-- | src/libicalss/icalmessage.c | 14 | ||||
-rw-r--r-- | src/libicalvcal/icalvcal.c | 40 | ||||
-rw-r--r-- | src/libicalvcal/vobject.c | 8 | ||||
-rw-r--r-- | src/libicalvcal/vobject.h | 1 |
16 files changed, 306 insertions, 329 deletions
diff --git a/src/libical/icalcomponent.c b/src/libical/icalcomponent.c index 7d1d0522..8b64f4dc 100644 --- a/src/libical/icalcomponent.c +++ b/src/libical/icalcomponent.c @@ -53,7 +53,7 @@ struct icalcomponent_impl void icalproperty_set_parent(icalproperty* property, icalcomponent* component); icalcomponent* icalproperty_get_parent(icalproperty* property); -void icalcomponent_add_children(icalcomponent *impl,va_list args); +static void icalcomponent_add_children(icalcomponent *impl,va_list args); static icalcomponent* icalcomponent_new_impl (icalcomponent_kind kind); static void icalcomponent_merge_vtimezone (icalcomponent *comp, @@ -76,7 +76,6 @@ static int icalcomponent_compare_timezone_fn (const void *elem1, static struct icaltimetype icalcomponent_get_datetime(icalcomponent *comp, icalproperty *prop); - void icalcomponent_add_children(icalcomponent *impl, va_list args) { void* vp; diff --git a/src/libical/icalerror.h b/src/libical/icalerror.h index bb5ffaeb..c9d34982 100644 --- a/src/libical/icalerror.h +++ b/src/libical/icalerror.h @@ -90,6 +90,7 @@ LIBICAL_ICAL_EXPORT const char *icalerror_perror(void); LIBICAL_ICAL_EXPORT void ical_bt(void); LIBICAL_ICAL_EXPORT void icalerror_set_error_state(icalerrorenum error, icalerrorstate); LIBICAL_ICAL_EXPORT icalerrorstate icalerror_get_error_state(icalerrorenum error); +LIBICAL_ICAL_EXPORT icalerrorenum icalerror_error_from_string(const char* str); #ifndef ICAL_SETERROR_ISFUNC #define icalerror_set_errno(x) \ diff --git a/src/libical/icalmime.c b/src/libical/icalmime.c index d7c02700..0e504485 100644 --- a/src/libical/icalmime.c +++ b/src/libical/icalmime.c @@ -43,7 +43,7 @@ struct text_part size_t buf_size; }; -void* icalmime_text_new_part(void) +static void* icalmime_text_new_part(void) { #define BUF_SIZE 2048 @@ -61,9 +61,10 @@ void* icalmime_text_new_part(void) return impl; } -void icalmime_text_add_line(void *part, - struct sspm_header *header, - const char* line, size_t size) + +static void icalmime_text_add_line(void *part, + struct sspm_header *header, + const char* line, size_t size) { struct text_part* impl = (struct text_part*) part; _unused(header); @@ -74,7 +75,7 @@ void icalmime_text_add_line(void *part, } -void* icalmime_textcalendar_end_part(void* part) +static void* icalmime_textcalendar_end_part(void* part) { struct text_part* impl = (struct text_part*) part; @@ -87,7 +88,7 @@ void* icalmime_textcalendar_end_part(void* part) } -void* icalmime_text_end_part_r(void* part) +static void* icalmime_text_end_part_r(void* part) { char *buf; struct text_part* impl = ( struct text_part*) part; @@ -107,7 +108,7 @@ void* icalmime_text_end_part(void* part) } -void icalmime_text_free_part(void *part) +static void icalmime_text_free_part(void *part) { _unused(part); } @@ -115,12 +116,13 @@ void icalmime_text_free_part(void *part) /* Ignore Attachments for now */ -void* icalmime_attachment_new_part(void) +static void* icalmime_attachment_new_part(void) { return 0; } -void icalmime_attachment_add_line(void *part, struct sspm_header *header, - const char* line, size_t size) + +static void icalmime_attachment_add_line(void *part, struct sspm_header *header, + const char* line, size_t size) { _unused(part); _unused(header); @@ -128,20 +130,17 @@ void icalmime_attachment_add_line(void *part, struct sspm_header *header, _unused(size); } -void* icalmime_attachment_end_part(void* part) +static void* icalmime_attachment_end_part(void* part) { _unused(part); return 0; } -void icalmime_attachment_free_part(void *part) +static void icalmime_attachment_free_part(void *part) { _unused(part); } - - - static const struct sspm_action_map icalmime_local_action_map[] = { {SSPM_TEXT_MAJOR_TYPE,SSPM_CALENDAR_MINOR_TYPE,icalmime_text_new_part,icalmime_text_add_line,icalmime_textcalendar_end_part,icalmime_text_free_part}, diff --git a/src/libical/icalproperty.c b/src/libical/icalproperty.c index f91bd217..ea5e3852 100644 --- a/src/libical/icalproperty.c +++ b/src/libical/icalproperty.c @@ -1009,9 +1009,6 @@ char* icalproperty_get_property_name_r(const icalproperty* prop) return buf; } - - - void icalproperty_set_parent(icalproperty* property, icalcomponent* component) { diff --git a/src/libical/icalrecur.c b/src/libical/icalrecur.c index 88eac24c..1f4eed00 100644 --- a/src/libical/icalrecur.c +++ b/src/libical/icalrecur.c @@ -173,20 +173,125 @@ #define LEAP_MONTH 0x1000 -const char* icalrecur_freq_to_string(icalrecurrencetype_frequency kind); -icalrecurrencetype_frequency icalrecur_string_to_freq(const char* str); +int icalrecurrencetype_rscale_is_supported(void) +{ + return RSCALE_IS_SUPPORTED; +} -const char* icalrecur_weekday_to_string(icalrecurrencetype_weekday kind); -icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str); +/****************** Enumeration Routines ******************/ -const char* icalrecur_skip_to_string(icalrecurrencetype_skip kind); -icalrecurrencetype_skip icalrecur_string_to_skip(const char* str); +static struct +{ + icalrecurrencetype_frequency kind; + const char* str; +} freq_map[] = { + {ICAL_SECONDLY_RECURRENCE,"SECONDLY"}, + {ICAL_MINUTELY_RECURRENCE,"MINUTELY"}, + {ICAL_HOURLY_RECURRENCE,"HOURLY"}, + {ICAL_DAILY_RECURRENCE,"DAILY"}, + {ICAL_WEEKLY_RECURRENCE,"WEEKLY"}, + {ICAL_MONTHLY_RECURRENCE,"MONTHLY"}, + {ICAL_YEARLY_RECURRENCE,"YEARLY"}, + {ICAL_NO_RECURRENCE,0} +}; -int icalrecurrencetype_rscale_is_supported(void) +static icalrecurrencetype_frequency icalrecur_string_to_freq(const char* str) { - return RSCALE_IS_SUPPORTED; + int i; + + for (i=0; freq_map[i].kind != ICAL_NO_RECURRENCE ; i++) { + if ( strcasecmp(str,freq_map[i].str) == 0){ + return freq_map[i].kind; + } + } + return ICAL_NO_RECURRENCE; +} + +static const char* icalrecur_freq_to_string(icalrecurrencetype_frequency kind) +{ + int i; + + for (i=0; freq_map[i].kind != ICAL_NO_RECURRENCE ; i++) { + if ( freq_map[i].kind == kind ) { + return freq_map[i].str; + } + } + return 0; +} + +static struct +{ + icalrecurrencetype_skip kind; + const char* str; +} skip_map[] = { + {ICAL_SKIP_BACKWARD,"BACKWARD"}, + {ICAL_SKIP_FORWARD,"FORWARD"}, + {ICAL_SKIP_OMIT,"OMIT"} +}; + +static icalrecurrencetype_skip icalrecur_string_to_skip(const char* str) +{ + int i; + + for (i=0; skip_map[i].kind != ICAL_SKIP_OMIT ; i++) { + if ( strcasecmp(str,skip_map[i].str) == 0){ + return skip_map[i].kind; + } + } + return ICAL_SKIP_OMIT; +} + +static const char* icalrecur_skip_to_string(icalrecurrencetype_skip kind) +{ + int i; + + for (i=0; skip_map[i].kind != ICAL_SKIP_OMIT ; i++) { + if ( skip_map[i].kind == kind ) { + return skip_map[i].str; + } + } + return 0; } +static struct { + icalrecurrencetype_weekday wd; + const char * str; +} wd_map[] = { + {ICAL_SUNDAY_WEEKDAY,"SU"}, + {ICAL_MONDAY_WEEKDAY,"MO"}, + {ICAL_TUESDAY_WEEKDAY,"TU"}, + {ICAL_WEDNESDAY_WEEKDAY,"WE"}, + {ICAL_THURSDAY_WEEKDAY,"TH"}, + {ICAL_FRIDAY_WEEKDAY,"FR"}, + {ICAL_SATURDAY_WEEKDAY,"SA"}, + {ICAL_NO_WEEKDAY,0} +}; + +static const char* icalrecur_weekday_to_string(icalrecurrencetype_weekday kind) +{ + int i; + + for (i=0; wd_map[i].wd != ICAL_NO_WEEKDAY; i++) { + if ( wd_map[i].wd == kind) { + return wd_map[i].str; + } + } + + return 0; +} + +static icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str) +{ + int i; + + for (i=0; wd_map[i].wd != ICAL_NO_WEEKDAY; i++) { + if ( strcasecmp(str,wd_map[i].str) == 0){ + return wd_map[i].wd; + } + } + + return ICAL_NO_WEEKDAY; +} /*********************** Rule parsing routines ************************/ @@ -199,7 +304,7 @@ struct icalrecur_parser { struct icalrecurrencetype rt; }; -const char* icalrecur_first_clause(struct icalrecur_parser *parser) +static const char* icalrecur_first_clause(struct icalrecur_parser *parser) { char *idx; parser->this_clause = parser->copy; @@ -219,7 +324,7 @@ const char* icalrecur_first_clause(struct icalrecur_parser *parser) } -const char* icalrecur_next_clause(struct icalrecur_parser *parser) +static const char* icalrecur_next_clause(struct icalrecur_parser *parser) { char* idx; @@ -244,8 +349,8 @@ const char* icalrecur_next_clause(struct icalrecur_parser *parser) } -void icalrecur_clause_name_and_value(struct icalrecur_parser *parser, - char** name, char** value) +static void icalrecur_clause_name_and_value(struct icalrecur_parser *parser, + char** name, char** value) { char *idx; @@ -264,8 +369,8 @@ void icalrecur_clause_name_and_value(struct icalrecur_parser *parser, *value = idx; } -void icalrecur_add_byrules(struct icalrecur_parser *parser, short *array, - int size, char* vals) +static void icalrecur_add_byrules(struct icalrecur_parser *parser, short *array, + int size, char* vals) { char *t, *n; int i=0; @@ -339,7 +444,7 @@ sort_bydayrules(struct icalrecur_parser *parser) } } -void icalrecur_add_bydayrules(struct icalrecur_parser *parser, const char* vals) +static void icalrecur_add_bydayrules(struct icalrecur_parser *parser, const char* vals) { char *t, *n; @@ -698,7 +803,7 @@ enum expand_table { }; /** - * The split map indicates, for a particular interval, wether a BY_* + * The split map indicates, for a particular interval, whether a BY_* * rule part expands the number of instances in the occcurrence set or * contracts it. 1=> contract, 2=>expand, and 3 means the pairing is * not allowed. @@ -2368,7 +2473,7 @@ static int next_yearday(icalrecur_iterator* impl) } */ -int check_set_position(icalrecur_iterator* impl, int set_pos) +static int check_set_position(icalrecur_iterator* impl, int set_pos) { int i; int found = 0; @@ -2488,7 +2593,7 @@ static int next_month(icalrecur_iterator* impl) if(is_day_in_byday(impl,last)){ /* If there is no BYSETPOS rule, calculate only by BYDAY - If there is BYSETPOS rule, take into account the occurence + If there is BYSETPOS rule, take into account the occurrence matches with BYDAY */ if(!has_by_data(impl,BY_SET_POS) || check_set_position(impl, ++set_pos_counter) || check_set_position(impl, set_pos_counter-set_pos_total-1)) { @@ -3267,120 +3372,6 @@ int icalrecurrencetype_month_month(short month) return (month & ~LEAP_MONTH); } - -/****************** Enumeration Routines ******************/ - -static struct {icalrecurrencetype_weekday wd; const char * str; } -wd_map[] = { - {ICAL_SUNDAY_WEEKDAY,"SU"}, - {ICAL_MONDAY_WEEKDAY,"MO"}, - {ICAL_TUESDAY_WEEKDAY,"TU"}, - {ICAL_WEDNESDAY_WEEKDAY,"WE"}, - {ICAL_THURSDAY_WEEKDAY,"TH"}, - {ICAL_FRIDAY_WEEKDAY,"FR"}, - {ICAL_SATURDAY_WEEKDAY,"SA"}, - {ICAL_NO_WEEKDAY,0} -}; - -const char* icalrecur_weekday_to_string(icalrecurrencetype_weekday kind) -{ - int i; - - for (i=0; wd_map[i].wd != ICAL_NO_WEEKDAY; i++) { - if ( wd_map[i].wd == kind) { - return wd_map[i].str; - } - } - - return 0; -} - -icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str) -{ - int i; - - for (i=0; wd_map[i].wd != ICAL_NO_WEEKDAY; i++) { - if ( strcasecmp(str,wd_map[i].str) == 0){ - return wd_map[i].wd; - } - } - - return ICAL_NO_WEEKDAY; -} - - - -static struct { - icalrecurrencetype_frequency kind; - const char* str; -} freq_map[] = { - {ICAL_SECONDLY_RECURRENCE,"SECONDLY"}, - {ICAL_MINUTELY_RECURRENCE,"MINUTELY"}, - {ICAL_HOURLY_RECURRENCE,"HOURLY"}, - {ICAL_DAILY_RECURRENCE,"DAILY"}, - {ICAL_WEEKLY_RECURRENCE,"WEEKLY"}, - {ICAL_MONTHLY_RECURRENCE,"MONTHLY"}, - {ICAL_YEARLY_RECURRENCE,"YEARLY"}, - {ICAL_NO_RECURRENCE,0} -}; - -const char* icalrecur_freq_to_string(icalrecurrencetype_frequency kind) -{ - int i; - - for (i=0; freq_map[i].kind != ICAL_NO_RECURRENCE ; i++) { - if ( freq_map[i].kind == kind ) { - return freq_map[i].str; - } - } - return 0; -} - -icalrecurrencetype_frequency icalrecur_string_to_freq(const char* str) -{ - int i; - - for (i=0; freq_map[i].kind != ICAL_NO_RECURRENCE ; i++) { - if ( strcasecmp(str,freq_map[i].str) == 0){ - return freq_map[i].kind; - } - } - return ICAL_NO_RECURRENCE; -} - -static struct { - icalrecurrencetype_skip kind; - const char* str; -} skip_map[] = { - {ICAL_SKIP_BACKWARD,"BACKWARD"}, - {ICAL_SKIP_FORWARD,"FORWARD"}, - {ICAL_SKIP_OMIT,"OMIT"} -}; - -const char* icalrecur_skip_to_string(icalrecurrencetype_skip kind) -{ - int i; - - for (i=0; skip_map[i].kind != ICAL_SKIP_OMIT ; i++) { - if ( skip_map[i].kind == kind ) { - return skip_map[i].str; - } - } - return 0; -} - -icalrecurrencetype_skip icalrecur_string_to_skip(const char* str) -{ - int i; - - for (i=0; skip_map[i].kind != ICAL_SKIP_OMIT ; i++) { - if ( strcasecmp(str,skip_map[i].str) == 0){ - return skip_map[i].kind; - } - } - return ICAL_SKIP_OMIT; -} - /** Fill an array with the 'count' number of occurrences generated by * the rrule. Note that the times are returned in UTC, but the times * are calculated in local time. YOu will have to convert the results diff --git a/src/libical/icalrecur.h b/src/libical/icalrecur.h index 630989d0..ea83fcb6 100644 --- a/src/libical/icalrecur.h +++ b/src/libical/icalrecur.h @@ -192,8 +192,6 @@ LIBICAL_ICAL_EXPORT enum icalrecurrencetype_weekday icalrecurrencetype_day_day_o /** 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */ LIBICAL_ICAL_EXPORT int icalrecurrencetype_day_position(short day); -LIBICAL_ICAL_EXPORT icalrecurrencetype_weekday icalrecur_string_to_weekday(const char *str); - /** * The 'month' element of the by_month array is encoded to allow * representation of the "L" leap suffix (RFC 7529). diff --git a/src/libical/icaltime.c b/src/libical/icaltime.c index a15b451a..d92dc9fd 100644 --- a/src/libical/icaltime.c +++ b/src/libical/icaltime.c @@ -331,7 +331,7 @@ static char* set_tz(const char* tzid) return old_tz_copy; /* This will be zero if the TZ env var was not set */ } -void unset_tz(char *tzstr) +static void unset_tz(char *tzstr) { /* restore the original environment */ diff --git a/src/libicalss/icalbdbset.c b/src/libicalss/icalbdbset.c index f00bdc4f..978ee97f 100644 --- a/src/libicalss/icalbdbset.c +++ b/src/libicalss/icalbdbset.c @@ -32,7 +32,6 @@ #define MAX_RETRY 5 /* these are just stub functions */ -icalerrorenum icalbdbset_read_database(icalbdbset *bset, char *(*pfunc)(const DBT *dbt)); icalerrorenum icalbdbset_create_cluster(const char *path); int icalbdbset_cget(DBC *dbcp, DBT *key, DBT *data, u_int32_t access_method); @@ -150,6 +149,124 @@ DB_ENV *icalbdbset_get_env(void) * assume data is a string. */ +/* This populates a cluster with the entire contents of a database */ +static icalerrorenum icalbdbset_read_database(icalbdbset *bset, char *(*pfunc)(const DBT *dbt)) +{ + DB *dbp; + DBC *dbcp; + DBT key, data; + char *str; + int ret = EINVAL; + char keystore[256]; + char datastore[1024]; + char *more_mem = NULL; + DB_TXN *tid; + _unused(pfunc); + + memset(&key, 0, sizeof(DBT)); + memset(&data, 0, sizeof(DBT)); + + if (bset->sdbp) { + dbp = bset->sdbp; + } else { + dbp = bset->dbp; + } + + if (!dbp) { + return ICAL_FILE_ERROR; + } + + bset->cluster = icalcomponent_new(ICAL_XROOT_COMPONENT); + + if ((ret = ICAL_DB_ENV->txn_begin(ICAL_DB_ENV, NULL, &tid, 0)) != 0) { + /*char *foo = db_strerror(ret);*/ + abort(); + } + + /* acquire a cursor for the database */ + if ((ret = dbp->cursor(dbp, tid, &dbcp, 0)) != 0) { + dbp->err(dbp, ret, "primary index"); + goto err1; + } + + key.flags = DB_DBT_USERMEM; + key.data = keystore; + key.ulen = (u_int32_t)sizeof(keystore); + + data.flags = DB_DBT_USERMEM; + data.data = datastore; + data.ulen = (u_int32_t)sizeof(datastore); + + /* fetch the key/data pair */ + while (1) { + ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT); + if (ret == DB_NOTFOUND) { + break; + } else if (ret == ENOMEM) { + if (more_mem) { + free(more_mem); + } + more_mem = malloc(data.ulen + 1024); + data.data = more_mem; + data.ulen = data.ulen + 1024; + } else if (ret == DB_LOCK_DEADLOCK) { + /*char *foo = db_strerror(ret);*/ + abort(); /* should retry in case of DB_LOCK_DEADLOCK */ + } else if (ret) { + /*char *foo = db_strerror(ret);*/ + /* some other weird-ass error */ + dbp->err(dbp, ret, "cursor"); + abort(); + } else { + icalcomponent *cl; + + /* this prevents an array read bounds error */ + if ((str = (char *)calloc(data.size + 1, sizeof(char))) == NULL) { + goto err2; + } + memcpy(str, (char *)data.data, data.size); + + cl = icalparser_parse_string(str); + + icalcomponent_add_component(bset->cluster, cl); + free(str); + } + } + if (ret != DB_NOTFOUND) { + goto err2; + } + + if (more_mem) { + free(more_mem); + more_mem = NULL; + } + + if ((ret = dbcp->c_close(dbcp)) != 0) { + /*char *foo = db_strerror(ret);*/ + abort(); /* should retry in case of DB_LOCK_DEADLOCK */ + } + + if ((ret = tid->commit(tid, 0)) != 0) { + /*char *foo = db_strerror(ret);*/ + abort(); + } + + return ICAL_NO_ERROR; + +err2: + if (more_mem) { + free(more_mem); + } + dbcp->c_close(dbcp); + abort(); /* should retry in case of DB_LOCK_DEADLOCK */ + return ICAL_INTERNAL_ERROR; + +err1: + dbp->err(dbp, ret, "cursor index"); + abort(); + return ICAL_FILE_ERROR; +} + icalset *icalbdbset_init(icalset *set, const char *dsn, void *options_in) { icalbdbset *bset = (icalbdbset *)set; @@ -330,124 +447,6 @@ char *icalbdbset_parse_data(DBT *dbt, char *(*pfunc)(const DBT *dbt)) return ret; } -/* This populates a cluster with the entire contents of a database */ -icalerrorenum icalbdbset_read_database(icalbdbset *bset, char *(*pfunc)(const DBT *dbt)) -{ - DB *dbp; - DBC *dbcp; - DBT key, data; - char *str; - int ret = EINVAL; - char keystore[256]; - char datastore[1024]; - char *more_mem = NULL; - DB_TXN *tid; - _unused(pfunc); - - memset(&key, 0, sizeof(DBT)); - memset(&data, 0, sizeof(DBT)); - - if (bset->sdbp) { - dbp = bset->sdbp; - } else { - dbp = bset->dbp; - } - - if (!dbp) { - return ICAL_FILE_ERROR; - } - - bset->cluster = icalcomponent_new(ICAL_XROOT_COMPONENT); - - if ((ret = ICAL_DB_ENV->txn_begin(ICAL_DB_ENV, NULL, &tid, 0)) != 0) { - /*char *foo = db_strerror(ret);*/ - abort(); - } - - /* acquire a cursor for the database */ - if ((ret = dbp->cursor(dbp, tid, &dbcp, 0)) != 0) { - dbp->err(dbp, ret, "primary index"); - goto err1; - } - - key.flags = DB_DBT_USERMEM; - key.data = keystore; - key.ulen = (u_int32_t)sizeof(keystore); - - data.flags = DB_DBT_USERMEM; - data.data = datastore; - data.ulen = (u_int32_t)sizeof(datastore); - - /* fetch the key/data pair */ - while (1) { - ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT); - if (ret == DB_NOTFOUND) { - break; - } else if (ret == ENOMEM) { - if (more_mem) { - free(more_mem); - } - more_mem = malloc(data.ulen + 1024); - data.data = more_mem; - data.ulen = data.ulen + 1024; - } else if (ret == DB_LOCK_DEADLOCK) { - /*char *foo = db_strerror(ret);*/ - abort(); /* should retry in case of DB_LOCK_DEADLOCK */ - } else if (ret) { - /*char *foo = db_strerror(ret);*/ - /* some other weird-ass error */ - dbp->err(dbp, ret, "cursor"); - abort(); - } else { - icalcomponent *cl; - - /* this prevents an array read bounds error */ - if ((str = (char *)calloc(data.size + 1, sizeof(char))) == NULL) { - goto err2; - } - memcpy(str, (char *)data.data, data.size); - - cl = icalparser_parse_string(str); - - icalcomponent_add_component(bset->cluster, cl); - free(str); - } - } - if (ret != DB_NOTFOUND) { - goto err2; - } - - if (more_mem) { - free(more_mem); - more_mem = NULL; - } - - if ((ret = dbcp->c_close(dbcp)) != 0) { - /*char *foo = db_strerror(ret);*/ - abort(); /* should retry in case of DB_LOCK_DEADLOCK */ - } - - if ((ret = tid->commit(tid, 0)) != 0) { - /*char *foo = db_strerror(ret);*/ - abort(); - } - - return ICAL_NO_ERROR; - -err2: - if (more_mem) { - free(more_mem); - } - dbcp->c_close(dbcp); - abort(); /* should retry in case of DB_LOCK_DEADLOCK */ - return ICAL_INTERNAL_ERROR; - -err1: - dbp->err(dbp, ret, "cursor index"); - abort(); - return ICAL_FILE_ERROR; -} - /* XXX add more to this */ void icalbdbset_free(icalset *set) { @@ -1056,7 +1055,7 @@ struct icalbdbset_id { int sequence; }; -void icalbdbset_id_free(struct icalbdbset_id *id) +static void icalbdbset_id_free(struct icalbdbset_id *id) { if (id->recurrence_id != 0) { free(id->recurrence_id); @@ -1293,7 +1292,7 @@ icalbdbset_begin_component(icalset *set, icalcomponent_kind kind, itr.last_component = NULL; icalrecur_iterator_free(itr.ritr); itr.ritr = NULL; - /* no matched occurence */ + /* no matched occurrence */ goto getNextComp; } else { itr.last_component = comp; @@ -1404,8 +1403,8 @@ icalcomponent *icalbdbset_form_a_matched_recurrence_component(icalsetiter *itr) itr->last_component = NULL; icalrecur_iterator_free(itr->ritr); itr->ritr = NULL; - /* no more pending matched occurence, - * all the pending matched occurences have been returned */ + /* no more pending matched occurrence, + * all the pending matched occurrences have been returned */ return NULL; } else { itr->last_component = comp; @@ -1453,7 +1452,7 @@ icalcomponent *icalbdbsetiter_to_next(icalset *set, icalsetiter *i) do { - /* no pending occurence, read the next component */ + /* no pending occurrence, read the next component */ if (i->last_component == NULL) { comp = icalcompiter_next(&(i->iter)); } else { @@ -1515,7 +1514,7 @@ icalcomponent *icalbdbsetiter_to_next(icalset *set, icalsetiter *i) i->last_component = NULL; icalrecur_iterator_free(i->ritr); i->ritr = NULL; - /* no more occurence, should go to get next component */ + /* no more occurrence, should go to get next component */ continue; } else { i->last_component = comp; diff --git a/src/libicalss/icalcalendar.c b/src/libicalss/icalcalendar.c index 06dfa0c7..a695b87c 100644 --- a/src/libicalss/icalcalendar.c +++ b/src/libicalss/icalcalendar.c @@ -57,7 +57,7 @@ struct icalcalendar_impl* icalcalendar_new_impl(void) } -icalerrorenum icalcalendar_create(struct icalcalendar_impl* impl) +static icalerrorenum icalcalendar_create(struct icalcalendar_impl* impl) { char path[MAXPATHLEN]; struct stat sbuf; diff --git a/src/libicalss/icalcluster.c b/src/libicalss/icalcluster.c index 599837f2..c75708b9 100644 --- a/src/libicalss/icalcluster.c +++ b/src/libicalss/icalcluster.c @@ -36,7 +36,7 @@ #include <stdlib.h> -icalcluster * icalcluster_new_impl(void) { +static icalcluster * icalcluster_new_impl(void) { struct icalcluster_impl* impl; diff --git a/src/libicalss/icaldirset.c b/src/libicalss/icaldirset.c index 4f622818..4e748d44 100644 --- a/src/libicalss/icaldirset.c +++ b/src/libicalss/icaldirset.c @@ -98,18 +98,18 @@ icalerrorenum icaldirset_commit(icalset *set) return ICAL_NO_ERROR; } -void icaldirset_lock(const char *dir) +static void icaldirset_lock(const char *dir) { _unused(dir); } -void icaldirset_unlock(const char *dir) +static void icaldirset_unlock(const char *dir) { _unused(dir); } /* Load the contents of the store directory into the store's internal directory list*/ -icalerrorenum icaldirset_read_directory(icaldirset *dset) +static icalerrorenum icaldirset_read_directory(icaldirset *dset) { char *str; #if defined(HAVE_DIRENT_H) @@ -320,7 +320,7 @@ int icaldirset_next_uid_number(icaldirset *dset) } } -icalerrorenum icaldirset_next_cluster(icaldirset *dset) +static icalerrorenum icaldirset_next_cluster(icaldirset *dset) { char path[MAXPATHLEN]; diff --git a/src/libicalss/icalgauge.c b/src/libicalss/icalgauge.c index 6a57e5ca..f9039b1b 100644 --- a/src/libicalss/icalgauge.c +++ b/src/libicalss/icalgauge.c @@ -1,29 +1,23 @@ -/* -*- Mode: C -*- */ /*====================================================================== FILE: icalgauge.c CREATOR: eric 23 December 1999 - - $Id: icalgauge.c,v 1.15 2008-01-02 20:07:40 dothebart Exp $ - $Locker: $ - - (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + (C) COPYRIGHT 2000, Eric Busboom <eric@softwarestudio.org> + http://www.softwarestudio.org This program is free software; you can redistribute it and/or modify it under the terms of either: The LGPL as published by the Free Software Foundation, version - 2.1, available at: http://www.fsf.org/copyleft/lesser.html + 2.1, available at: http://www.gnu.org/licenses/lgpl-2.1.html - Or: + 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 eric. The Initial Developer of the Original Code is Eric Busboom - - ======================================================================*/ #ifdef HAVE_CONFIG_H @@ -161,7 +155,7 @@ icalcomponent* icalgauge_make_gauge(icalcomponent* query); */ -int icalgauge_compare_recurse(icalcomponent* comp, icalcomponent* gauge) +/*non-static,recursive*/ int icalgauge_compare_recurse(icalcomponent* comp, icalcomponent* gauge) { int pass = 1,localpass = 0; icalproperty *p; diff --git a/src/libicalss/icalmessage.c b/src/libicalss/icalmessage.c index 906cfed8..dea565c2 100644 --- a/src/libicalss/icalmessage.c +++ b/src/libicalss/icalmessage.c @@ -28,7 +28,7 @@ #include <ctype.h> #include <stdlib.h> -icalcomponent* icalmessage_get_inner(icalcomponent* comp) +static icalcomponent* icalmessage_get_inner(icalcomponent* comp) { if (icalcomponent_isa(comp) == ICAL_VCALENDAR_COMPONENT){ return icalcomponent_get_first_real_component(comp); @@ -55,7 +55,7 @@ static char* lowercase(const char* str) return n; } -icalproperty* icalmessage_find_attendee(icalcomponent* comp, const char* user) +static icalproperty* icalmessage_find_attendee(icalcomponent* comp, const char* user) { icalcomponent *inner = icalmessage_get_inner(comp); icalproperty *p,*attendee = 0; @@ -86,8 +86,8 @@ icalproperty* icalmessage_find_attendee(icalcomponent* comp, const char* user) } -void icalmessage_copy_properties(icalcomponent* to, icalcomponent* from, - icalproperty_kind kind) +static void icalmessage_copy_properties(icalcomponent* to, icalcomponent* from, + icalproperty_kind kind) { icalcomponent *to_inner = icalmessage_get_inner(to); icalcomponent *from_inner = icalmessage_get_inner(from); @@ -110,9 +110,9 @@ void icalmessage_copy_properties(icalcomponent* to, icalcomponent* from, ); } -icalcomponent *icalmessage_new_reply_base(icalcomponent* c, - const char* user, - const char* msg) +static icalcomponent *icalmessage_new_reply_base(icalcomponent* c, + const char* user, + const char* msg) { icalproperty *attendee; char tmp[45]; diff --git a/src/libicalvcal/icalvcal.c b/src/libicalvcal/icalvcal.c index 320cbb1d..c4e8664d 100644 --- a/src/libicalvcal/icalvcal.c +++ b/src/libicalvcal/icalvcal.c @@ -21,7 +21,7 @@ its work.s his routine steps through through all of the properties and components of a VObject. For each name of a property or a component, icalvcal_traverse_objects looks up the name in - conversion_table[]. This table indicates wether the name is of a + conversion_table[]. This table indicates whether the name is of a component or a property, lists a routine to handle conversion, and has extra data for the conversion. @@ -73,8 +73,8 @@ struct conversion_table_struct { int icaltype; }; -void* dc_prop(int icaltype, VObject *object, icalcomponent *comp, - icalvcal_defaults *defaults); +static void* dc_prop(int icaltype, VObject *object, icalcomponent *comp, + icalvcal_defaults *defaults); @@ -97,7 +97,7 @@ static icalproperty* create_parse_error_property (const char *message, } -char* get_string_value (VObject *object, int *free_string) +static char* get_string_value (VObject *object, int *free_string) { switch (vObjectValueType(object)) { case VCVT_USTRINGZ: @@ -219,8 +219,8 @@ icalcomponent* icalvcal_convert (VObject *object) * timezone_comp() may not really be necessary, I think it would be * easier to use them. */ -void* comp(int icaltype, VObject *o, icalcomponent *comp, - icalvcal_defaults *defaults) +static void* comp(int icaltype, VObject *o, icalcomponent *comp, + icalvcal_defaults *defaults) { icalcomponent_kind kind = (icalcomponent_kind)icaltype; icalcomponent* c = icalcomponent_new(kind); @@ -562,8 +562,8 @@ static int get_alarm_properties (icalcomponent *comp, VObject *object, } -void* alarm_comp(int icaltype, VObject *o, icalcomponent *comp, - icalvcal_defaults *defaults) +static void* alarm_comp(int icaltype, VObject *o, icalcomponent *comp, + icalvcal_defaults *defaults) { /* icalcomponent_kind kind = (icalcomponent_kind)icaltype; */ int is_valid_alarm; @@ -586,8 +586,8 @@ void* alarm_comp(int icaltype, VObject *o, icalcomponent *comp, #define parameter 0 #define rsvp_parameter 0 -void* transp_prop(int icaltype, VObject *object, icalcomponent *comp, - icalvcal_defaults *defaults) +static void* transp_prop(int icaltype, VObject *object, icalcomponent *comp, + icalvcal_defaults *defaults) { icalproperty *prop = NULL; char *s; @@ -612,8 +612,8 @@ void* transp_prop(int icaltype, VObject *object, icalcomponent *comp, return (void*)prop; } -void* sequence_prop(int icaltype, VObject *object, icalcomponent *comp, - icalvcal_defaults *defaults) +static void* sequence_prop(int icaltype, VObject *object, icalcomponent *comp, + icalvcal_defaults *defaults) { icalproperty *prop = NULL; char *s; @@ -641,8 +641,8 @@ void* sequence_prop(int icaltype, VObject *object, icalcomponent *comp, /* This handles properties which have multiple values, which are separated by ';' in vCalendar but ',' in iCalendar. So we just switch those. */ -void* multivalued_prop(int icaltype, VObject *object, icalcomponent *comp, - icalvcal_defaults *defaults) +static void* multivalued_prop(int icaltype, VObject *object, icalcomponent *comp, + icalvcal_defaults *defaults) { icalproperty_kind kind = (icalproperty_kind)icaltype; icalproperty *prop = NULL; @@ -680,8 +680,8 @@ void* multivalued_prop(int icaltype, VObject *object, icalcomponent *comp, } -void* status_prop(int icaltype, VObject *object, icalcomponent *comp, - icalvcal_defaults *defaults) +static void* status_prop(int icaltype, VObject *object, icalcomponent *comp, + icalvcal_defaults *defaults) { icalproperty *prop = NULL; char *s; @@ -732,8 +732,8 @@ void* status_prop(int icaltype, VObject *object, icalcomponent *comp, } -void* utc_datetime_prop(int icaltype, VObject *object, icalcomponent *comp, - icalvcal_defaults *defaults) +static void* utc_datetime_prop(int icaltype, VObject *object, icalcomponent *comp, + icalvcal_defaults *defaults) { icalproperty_kind kind = (icalproperty_kind)icaltype; icalproperty *prop; @@ -1190,8 +1190,8 @@ static char* rrule_parse_yearly_days (char *s, recurrences, time modifiers in DAILY rules and maybe other stuff. */ -void* rule_prop(int icaltype, VObject *object, icalcomponent *comp, - icalvcal_defaults *defaults) +static void* rule_prop(int icaltype, VObject *object, icalcomponent *comp, + icalvcal_defaults *defaults) { icalproperty *prop = NULL; char *s, *p, *error_message = NULL; diff --git a/src/libicalvcal/vobject.c b/src/libicalvcal/vobject.c index 07e8d737..ba9ea189 100644 --- a/src/libicalvcal/vobject.c +++ b/src/libicalvcal/vobject.c @@ -96,7 +96,7 @@ const char** fieldedProp; deleteStrItem ----------------------------------------------------------------------*/ -VObject* newVObject_(const char *id) +static VObject* newVObject_(const char *id) { VObject *p = (VObject*)malloc(sizeof(VObject)); p->next = 0; @@ -298,7 +298,7 @@ VObject* addProp(VObject *o, const char *id) return addVObjectProp(o,newVObject(id)); } -VObject* addProp_(VObject *o, const char *id) +static VObject* addProp_(VObject *o, const char *id) { return addVObjectProp(o,newVObject_(id)); } @@ -733,8 +733,8 @@ static const char *AAlarmFields[] = { 0 }; -/* ExDate -- has unamed fields */ -/* RDate -- has unamed fields */ +/* ExDate -- has unnamed fields */ +/* RDate -- has unnamed fields */ static const char *DAlarmFields[] = { VCRunTimeProp, diff --git a/src/libicalvcal/vobject.h b/src/libicalvcal/vobject.h index 34a23136..533394d6 100644 --- a/src/libicalvcal/vobject.h +++ b/src/libicalvcal/vobject.h @@ -284,7 +284,6 @@ extern "C" LIBICAL_VCAL_EXPORT VObject *addVObjectProp(VObject * o, VObject * p); LIBICAL_VCAL_EXPORT VObject *addProp(VObject * o, const char *id); - LIBICAL_VCAL_EXPORT VObject *addProp_(VObject * o, const char *id); LIBICAL_VCAL_EXPORT VObject *addPropValue(VObject * o, const char *p, const char *v); LIBICAL_VCAL_EXPORT VObject *addPropSizedValue_(VObject * o, const char *p, const char *v, unsigned int size); |