diff options
author | Russell Steinthal <rms39@columbia.edu> | 2000-03-29 10:03:51 +0800 |
---|---|---|
committer | Russell Steinthal <steintr@src.gnome.org> | 2000-03-29 10:03:51 +0800 |
commit | 7bbcabbc1e87f5188e3e44b37abc90cb7a7864fd (patch) | |
tree | 9d89287d776761ff57d50db5bb442aeaedf0de57 | |
parent | 68b4d99fcb3d2ddf45cf0c004d3a0bac341f9616 (diff) | |
download | gsoc2013-evolution-7bbcabbc1e87f5188e3e44b37abc90cb7a7864fd.tar gsoc2013-evolution-7bbcabbc1e87f5188e3e44b37abc90cb7a7864fd.tar.gz gsoc2013-evolution-7bbcabbc1e87f5188e3e44b37abc90cb7a7864fd.tar.bz2 gsoc2013-evolution-7bbcabbc1e87f5188e3e44b37abc90cb7a7864fd.tar.lz gsoc2013-evolution-7bbcabbc1e87f5188e3e44b37abc90cb7a7864fd.tar.xz gsoc2013-evolution-7bbcabbc1e87f5188e3e44b37abc90cb7a7864fd.tar.zst gsoc2013-evolution-7bbcabbc1e87f5188e3e44b37abc90cb7a7864fd.zip |
New function (borrowed from Korganizer's libversit code) to combine
2000-03-28 Russell Steinthal <rms39@columbia.edu>
* 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
-rw-r--r-- | libversit/vcc.y | 41 |
1 files changed, 39 insertions, 2 deletions
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) } } + |