summaryrefslogtreecommitdiff
path: root/library/backend/vobject.cpp
Unidiff
Diffstat (limited to 'library/backend/vobject.cpp') (more/less context) (show whitespace changes)
-rw-r--r--library/backend/vobject.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/library/backend/vobject.cpp b/library/backend/vobject.cpp
index 9263c3a..592d116 100644
--- a/library/backend/vobject.cpp
+++ b/library/backend/vobject.cpp
@@ -1100,21 +1100,22 @@ static void writeEncString(OFile *fp, const char *s, bool nosemi)
1100 case Base64: 1100 case Base64:
1101 writeBase64(fp, (unsigned char*)p, strlen(p)); 1101 writeBase64(fp, (unsigned char*)p, strlen(p));
1102 break; 1102 break;
1103 } 1103 }
1104} 1104}
1105 1105
1106static bool includesUnprintable(VObject *o) 1106static bool includesUnprintable(VObject *o, bool nosemi)
1107{ 1107{
1108 if (o) { 1108 if (o) {
1109 if (VALUE_TYPE(o) == VCVT_STRINGZ) { 1109 if (VALUE_TYPE(o) == VCVT_STRINGZ) {
1110 const char *p = STRINGZ_VALUE_OF(o); 1110 const char *p = STRINGZ_VALUE_OF(o);
1111 if (p) { 1111 if (p) {
1112 while (*p) { 1112 while (*p) {
1113 if (*p==' ' && (!p[1] || p[1]=='\n') // RFC 1521: spaces at ends need quoting 1113 if (*p==' ' && (!p[1] || p[1]=='\n') // RFC 1521: spaces at ends need quoting
1114 || qpReplaceChar(*p) ) 1114 || qpReplaceChar(*p)
1115 || *p==';' && nosemi )
1115 return TRUE; 1116 return TRUE;
1116 p++; 1117 p++;
1117 } 1118 }
1118 } 1119 }
1119 } 1120 }
1120 } 1121 }
@@ -1158,13 +1159,13 @@ static void writeValue(OFile *fp, VObject *o, unsigned long size, bool nosemi)
1158static void writeAttrValue(OFile *fp, VObject *o) 1159static void writeAttrValue(OFile *fp, VObject *o)
1159{ 1160{
1160 if (NAME_OF(o)) { 1161 if (NAME_OF(o)) {
1161 struct PreDefProp *pi; 1162 struct PreDefProp *pi;
1162 pi = lookupPropInfo(NAME_OF(o)); 1163 pi = lookupPropInfo(NAME_OF(o));
1163 if (pi && ((pi->flags & PD_INTERNAL) != 0)) return; 1164 if (pi && ((pi->flags & PD_INTERNAL) != 0)) return;
1164 if ( includesUnprintable(o) ) 1165 if ( includesUnprintable(o,TRUE) )
1165 appendsOFileEncCs(fp); 1166 appendsOFileEncCs(fp);
1166 appendcOFile(fp,';'); 1167 appendcOFile(fp,';');
1167 appendsOFile(fp,NAME_OF(o)); 1168 appendsOFile(fp,NAME_OF(o));
1168 } else { 1169 } else {
1169 appendcOFile(fp,';'); 1170 appendcOFile(fp,';');
1170 } 1171 }
@@ -1226,13 +1227,13 @@ static void writeProp(OFile *fp, VObject *o)
1226 int i = 0, n = 0; 1227 int i = 0, n = 0;
1227 const char** fields = fields_; 1228 const char** fields = fields_;
1228 /* output prop as fields */ 1229 /* output prop as fields */
1229 bool printable = TRUE; 1230 bool printable = TRUE;
1230 while (*fields && printable) { 1231 while (*fields && printable) {
1231 VObject *t = isAPropertyOf(o,*fields); 1232 VObject *t = isAPropertyOf(o,*fields);
1232 if (includesUnprintable(t)) 1233 if (includesUnprintable(t,TRUE))
1233 printable = FALSE; 1234 printable = FALSE;
1234 fields++; 1235 fields++;
1235 } 1236 }
1236 fields = fields_; 1237 fields = fields_;
1237 if (!printable) 1238 if (!printable)
1238 appendsOFileEncCs(fp); 1239 appendsOFileEncCs(fp);
@@ -1251,13 +1252,13 @@ static void writeProp(OFile *fp, VObject *o)
1251 } 1252 }
1252 } 1253 }
1253 } 1254 }
1254 1255
1255 1256
1256 if (VALUE_TYPE(o)) { 1257 if (VALUE_TYPE(o)) {
1257 if ( includesUnprintable(o) ) 1258 if ( includesUnprintable(o,FALSE) )
1258 appendsOFileEncCs(fp); 1259 appendsOFileEncCs(fp);
1259 unsigned long size = 0; 1260 unsigned long size = 0;
1260 VObject *p = isAPropertyOf(o,VCDataSizeProp); 1261 VObject *p = isAPropertyOf(o,VCDataSizeProp);
1261 if (p) size = LONG_VALUE_OF(p); 1262 if (p) size = LONG_VALUE_OF(p);
1262 appendcOFile(fp,':'); 1263 appendcOFile(fp,':');
1263 writeValue(fp,o,size,FALSE); 1264 writeValue(fp,o,size,FALSE);