diff options
Diffstat (limited to 'libical/src')
-rw-r--r-- | libical/src/libical/icalduration.c | 4 | ||||
-rw-r--r-- | libical/src/libical/icalduration.h | 2 | ||||
-rw-r--r-- | libical/src/libical/icalvalue.c | 9 |
3 files changed, 7 insertions, 8 deletions
diff --git a/libical/src/libical/icalduration.c b/libical/src/libical/icalduration.c index 18a74396f5..250cd6e3d6 100644 --- a/libical/src/libical/icalduration.c +++ b/libical/src/libical/icalduration.c @@ -250,7 +250,7 @@ char* icaldurationtype_as_ical_string(struct icaldurationtype d) } } else { - icalmemory_append_string(&buf, &buf_ptr, &buf_size, "PTS0"); + icalmemory_append_string(&buf, &buf_ptr, &buf_size, d.is_neg ? "-PT0S" : "PT0S"); } output_line = icalmemory_tmp_copy(buf); @@ -274,7 +274,7 @@ int icaldurationtype_as_int(struct icaldurationtype dur) * (dur.is_neg==1? -1 : 1) ) ; } -struct icaldurationtype icaldurationtype_null_duration() +struct icaldurationtype icaldurationtype_null_duration(void) { struct icaldurationtype d; diff --git a/libical/src/libical/icalduration.h b/libical/src/libical/icalduration.h index dd6e311f47..0450a081d3 100644 --- a/libical/src/libical/icalduration.h +++ b/libical/src/libical/icalduration.h @@ -45,7 +45,7 @@ struct icaldurationtype icaldurationtype_from_int(int t); struct icaldurationtype icaldurationtype_from_string(const char*); int icaldurationtype_as_int(struct icaldurationtype duration); char* icaldurationtype_as_ical_string(struct icaldurationtype d); -struct icaldurationtype icaldurationtype_null_duration(); +struct icaldurationtype icaldurationtype_null_duration(void); int icaldurationtype_is_null_duration(struct icaldurationtype d); struct icaltimetype icaltime_add(struct icaltimetype t, diff --git a/libical/src/libical/icalvalue.c b/libical/src/libical/icalvalue.c index 7414c7c173..b7852c3216 100644 --- a/libical/src/libical/icalvalue.c +++ b/libical/src/libical/icalvalue.c @@ -436,12 +436,11 @@ icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* str,icalpro case ICAL_DURATION_VALUE: { struct icaldurationtype dur = icaldurationtype_from_string(str); - - if(icaldurationtype_is_null_duration(dur)){ - value = 0; - } else { + + if (icalerrno == ICAL_MALFORMEDDATA_ERROR) + value = 0; + else value = icalvalue_new_duration(dur); - } break; } |