summaryrefslogtreecommitdiff
path: root/library/backend/vcc.y
Unidiff
Diffstat (limited to 'library/backend/vcc.y') (more/less context) (show whitespace changes)
-rw-r--r--library/backend/vcc.y53
1 files changed, 41 insertions, 12 deletions
diff --git a/library/backend/vcc.y b/library/backend/vcc.y
index eca7c32..00e8fed 100644
--- a/library/backend/vcc.y
+++ b/library/backend/vcc.y
@@ -52,2 +52,4 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
52/* debugging utilities */ 52/* debugging utilities */
53#define __DEBUG 1
54
53#if __DEBUG 55#if __DEBUG
@@ -137,2 +139,3 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
137/**** Global Variables ****/ 139/**** Global Variables ****/
140int q_DontDecodeBase64Photo = 0;
138int mime_lineNum, mime_numErrors; /* yyerror() can use these */ 141int mime_lineNum, mime_numErrors; /* yyerror() can use these */
@@ -160,2 +163,3 @@ enum LexMode {
160 L_NORMAL, 163 L_NORMAL,
164 L_PARAMWORD,
161 L_VCARD, 165 L_VCARD,
@@ -291,6 +295,10 @@ attr: name
291 } 295 }
292 | name EQ name 296 | name EQ
293 { 297 {
294 enterAttr($1,$3); 298 lexPushMode(L_PARAMWORD);
295 299 }
300 name
301 {
302 lexPopMode(0);
303 enterAttr($1,$4);
296 } 304 }
@@ -453,6 +461,11 @@ static void enterAttr(const char *s1, const char *s2)
453 addProp(curProp,p1); 461 addProp(curProp,p1);
454 if (qstricmp(p1,VCBase64Prop) == 0 || (s2 && qstricmp(p2,VCBase64Prop)==0)) 462 /* Lookup strings so we can quickly use pointer comparison */
463 static const char* base64 = lookupProp_(VCBase64Prop);
464 static const char* qp = lookupProp_(VCQuotedPrintableProp);
465 static const char* photo = lookupProp_(VCPhotoProp);
466 static const char* encoding = lookupProp_(VCEncodingProp);
467 if ((!q_DontDecodeBase64Photo || vObjectName(curProp) != photo)
468 && (p1 == base64 || p1 == encoding && p2 == base64))
455 lexPushMode(L_BASE64); 469 lexPushMode(L_BASE64);
456 else if (qstricmp(p1,VCQuotedPrintableProp) == 0 470 else if (p1 == qp || p1 == encoding && p2 == qp)
457 || (s2 && qstricmp(p2,VCQuotedPrintableProp)==0))
458 lexPushMode(L_QUOTED_PRINTABLE); 471 lexPushMode(L_QUOTED_PRINTABLE);
@@ -643,2 +656,16 @@ static char* lexGetWord() {
643 656
657static char* lexGetParamWord()
658{
659 int c;
660 lexClearToken();
661 c = lexLookahead();
662 while (c >= ' ' && c < 127 && !strchr("[]:=,.;",c)) {
663 lexAppendc(c);
664 lexSkipLookahead();
665 c = lexLookahead();
666 }
667 lexAppendc(0);
668 return lexStr();
669}
670
644static void lexPushLookaheadc(int c) { 671static void lexPushLookaheadc(int c) {
@@ -1012,2 +1039,3 @@ static int yylex() {
1012 int c = lexGetc(); 1039 int c = lexGetc();
1040 int c2;
1013 if (c == ';' && fieldedProp) { 1041 if (c == ';' && fieldedProp) {
@@ -1019,9 +1047,8 @@ static int yylex() {
1019 } 1047 }
1020 else if (strchr("\n",c)) { 1048 else if (strchr("\n",c) && (c2 = lexLookahead()) != ' ' && c2 != '\t') {
1021 ++mime_lineNum; 1049 ++mime_lineNum;
1022 /* consume all line separator(s) adjacent to each other */ 1050 /* consume all line separator(s) adjacent to each other */
1023 c = lexLookahead(); 1051 while (strchr("\n",c2)) {
1024 while (strchr("\n",c)) {
1025 lexSkipLookahead(); 1052 lexSkipLookahead();
1026 c = lexLookahead(); 1053 c2 = lexLookahead();
1027 ++mime_lineNum; 1054 ++mime_lineNum;
@@ -1056,4 +1083,6 @@ static int yylex() {
1056 } 1083 }
1057 } 1084 } else if (lexmode == L_PARAMWORD) {
1058 else { 1085 yylval.str = lexGetParamWord();
1086 return ID;
1087 } else {
1059 /* normal mode */ 1088 /* normal mode */