From 7bbcabbc1e87f5188e3e44b37abc90cb7a7864fd Mon Sep 17 00:00:00 2001 From: Russell Steinthal Date: Wed, 29 Mar 2000 02:03:51 +0000 Subject: New function (borrowed from Korganizer's libversit code) to combine 2000-03-28 Russell Steinthal * libversit/vcc.y (appendValue): New function (borrowed from Korganizer's libversit code) to combine semicolon-separated multiple-value properties into one long semicolon-delimited string (which can then be parsed by the application code). This works around a bug in libversit by which multiple values would overwrite each other. NOTE: This change seems to work, but could use as much testing as possible before GNOME 1.2 (and gnome-pim 1.2) is released.... Hopefully, this fixes the multiple CATEGORIES bug I've been complaining about for the last few weeks. svn path=/trunk/; revision=2237 --- libversit/vcc.y | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'libversit') diff --git a/libversit/vcc.y b/libversit/vcc.y index fa314efeb5..26912a14dd 100644 --- a/libversit/vcc.y +++ b/libversit/vcc.y @@ -169,6 +169,7 @@ static void enterProps(const char *s); static void enterAttr(const char *s1, const char *s2); static void enterValues(const char *value); static void mime_error_(char *s); + static void appendValue(const char *value); %} @@ -290,9 +291,9 @@ attr: name name: ID ; -values: value SEMICOLON { enterValues($1); } values +values: value SEMICOLON { appendValue($1); } values | value - { enterValues($1); } + { appendValue($1); } ; value: STRING @@ -405,6 +406,41 @@ static VObject* popVObject() return oldObj; } +static void appendValue(const char *value) +{ + char *p1, *p2; + wchar_t *p3; + int i; + + if (fieldedProp && *fieldedProp) { + if (value) { + addPropValue(curProp, *fieldedProp, value); + } + /* else this field is empty, advance to next field */ + fieldedProp++; + } else { + if (value) { + if (vObjectUStringZValue(curProp)) { + p1 = fakeCString(vObjectUStringZValue(curProp)); + p2 = malloc(sizeof(char *) * (strlen(p1)+strlen(value)+1)); + strcpy(p2, p1); + deleteStr(p1); + + i = strlen(p2); + p2[i] = ';'; + p2[i+1] = '\0'; + p2 = strcat(p2, value); + p3 = (wchar_t *) vObjectUStringZValue(curProp); + free(p3); + setVObjectUStringZValue_(curProp,fakeUnicode(p2,0)); + deleteStr(p2); + } else { + setVObjectUStringZValue_(curProp,fakeUnicode(value,0)); + } + } + } + deleteStr(value); +} static void enterValues(const char *value) { @@ -1216,3 +1252,4 @@ static void mime_error_(char *s) } } + -- cgit