summaryrefslogtreecommitdiff
path: root/library/backend/vcc_yacc.cpp
Side-by-side diff
Diffstat (limited to 'library/backend/vcc_yacc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/vcc_yacc.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/library/backend/vcc_yacc.cpp b/library/backend/vcc_yacc.cpp
index 5f53aef..4006bc2 100644
--- a/library/backend/vcc_yacc.cpp
+++ b/library/backend/vcc_yacc.cpp
@@ -458,13 +458,13 @@ static void enterProps(const char *s)
curProp = addGroup(curObj,s);
deleteStr(s);
}
static void enterAttr(const char *s1, const char *s2)
{
- const char *p1, *p2;
+ const char *p1, *p2=0;
p1 = lookupProp_(s1);
if (s2) {
VObject *a;
p2 = lookupProp_(s2);
a = addProp(curProp,p1);
setVObjectStringZValue(a,p2);
@@ -830,25 +830,26 @@ static void finiLex() {
/*-----------------------------------*/
/* This parses and converts the base64 format for binary encoding into
* a decoded buffer (allocated with new). See RFC 1521.
*/
-static char * lexGetDataFromBase64()
+static int lexGetDataFromBase64()
{
unsigned long bytesLen = 0, bytesMax = 0;
int quadIx = 0, pad = 0;
unsigned long trip = 0;
unsigned char b;
int c;
unsigned char *bytes = NULL;
unsigned char *oldBytes = NULL;
DBG_(("db: lexGetDataFromBase64\n"));
while (1) {
c = lexGetc();
+ lexSkipWhite();
if (c == '\n') {
++mime_lineNum;
if (lexLookahead() == '\n') {
/* a '\n' character by itself means end of data */
break;
}
@@ -865,30 +866,31 @@ static char * lexGetDataFromBase64()
b = 62;
else if (c == '/')
b = 63;
else if (c == '=') {
b = 0;
pad++;
- } else if ((c == ' ') || (c == '\t')) {
- continue;
} else { /* error condition */
if (bytes) free(bytes);
else if (oldBytes) free(oldBytes);
// error recovery: skip until 2 adjacent newlines.
DBG_(("db: invalid character 0x%x '%c'\n", c,c));
if (c != EOF) {
c = lexGetc();
while (c != EOF) {
- if (c == '\n' && lexLookahead() == '\n') {
- ++mime_lineNum;
- break;
+ if (c == '\n') {
+ lexSkipWhite();
+ if(lexLookahead() == '\n') {
+ ++mime_lineNum;
+ break;
+ }
}
c = lexGetc();
}
}
- return NULL;
+ return c != EOF;
}
trip = (trip << 6) | b;
if (++quadIx == 4) {
unsigned char outBytes[3];
int numOut;
int i;
@@ -928,13 +930,13 @@ static char * lexGetDataFromBase64()
free(bytes);
}
else if (oldBytes) {
setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen);
free(oldBytes);
}
- return 0;
+ return bytesLen;
}
static int match_begin_end_name(int end) {
int token;
lexSkipWhite();
if (lexLookahead() != ':') return ID;
@@ -959,13 +961,13 @@ static char* lexGetQuotedPrintable()
{
int c;
lexSkipWhite();
c = lexLookahead();
lexClearToken();
- while (c != EOF && c != ';') {
+ while (c != EOF && (c != ';' || !fieldedProp)) {
if (c == '\n') {
// break, leave '\n' on remaining chars.
break;
} else if (c == '=') {
int cur = 0;
int next;
@@ -1049,17 +1051,14 @@ static int yylex() {
}
else {
char *p = 0;
lexPushLookaheadc(c);
if (lexWithinMode(L_BASE64)) {
/* get each char and convert to bin on the fly... */
- p = lexGetDataFromBase64();
-#if 0
- yylval.str = p;
- return STRING;
-#endif
+ yylval.str = NULL;
+ return lexGetDataFromBase64() ? STRING : 0;
}
else if (lexWithinMode(L_QUOTED_PRINTABLE)) {
p = lexGetQuotedPrintable();
}
else {
#ifdef _SUPPORT_LINE_FOLDING
@@ -1235,13 +1234,13 @@ void mime_error_(char *s)
{
if (mimeErrorHandler) {
mimeErrorHandler(s);
}
}
-#line 1240 "y.tab.c"
+#line 1241 "y.tab.c"
#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
int
#if defined(__STDC__)
@@ -1535,13 +1534,13 @@ case 45:
#line 376 "backend/vcc.y"
{
lexPopMode(0);
popVObject();
}
break;
-#line 1540 "y.tab.c"
+#line 1541 "y.tab.c"
}
yyssp -= yym;
yystate = *yyssp;
yyvsp -= yym;
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)