summaryrefslogtreecommitdiff
path: root/library/backend/vcc.y
authoreilers <eilers>2003-03-27 16:17:48 (UTC)
committer eilers <eilers>2003-03-27 16:17:48 (UTC)
commit390a5a0c332c8c6fb380c1ed4cd6adae3e544a08 (patch) (side-by-side diff)
tree7ad6266be3d78d25ae061a0be067f82f8d666246 /library/backend/vcc.y
parentff43585778968407bb08473e45ddd1d942f8d8c8 (diff)
downloadopie-390a5a0c332c8c6fb380c1ed4cd6adae3e544a08.zip
opie-390a5a0c332c8c6fb380c1ed4cd6adae3e544a08.tar.gz
opie-390a5a0c332c8c6fb380c1ed4cd6adae3e544a08.tar.bz2
using releases from qtopia-free-1.6.0-snapshot-20030324 which fixes the
following bugs #776 and #490: Now, we could successfully parse vcards from palm 4 + 5 and quoted-printable encoded lines .. !
Diffstat (limited to 'library/backend/vcc.y') (more/less context) (show whitespace changes)
-rw-r--r--library/backend/vcc.y22
1 files changed, 16 insertions, 6 deletions
diff --git a/library/backend/vcc.y b/library/backend/vcc.y
index 6781312..94a8fea 100644
--- a/library/backend/vcc.y
+++ b/library/backend/vcc.y
@@ -113,25 +113,25 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
#include <string.h>
#ifndef __MWERKS__
#include <stdlib.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
//#ifdef PALMTOPCENTER
//#include <qpe/vobject_p.h>
//#else
-#include <qtopia/private/vobject_p.h>
+#include "vobject_p.h"
//#endif
/**** Types, Constants ****/
#define YYDEBUG 0 /* 1 to compile in some debugging code */
#define MAXTOKEN 256 /* maximum token (line) length */
#define YYSTACKSIZE 100 // ~unref ?
#define MAXLEVEL 10 /* max # of nested objects parseable */
/* (includes outermost) */
/**** Global Variables ****/
@@ -714,34 +714,40 @@ static void handleMoreRFC822LineBreak(int c) {
}
else {
lexPushLookaheadc(';');
}
}
}
static char* lexGet1Value() {
int c;
lexSkipWhite();
c = lexLookahead();
lexClearToken();
- while (c != EOF && c != ';') {
+ while (c != EOF && (c != ';' || !fieldedProp)) {
if (c == '\\' ) {
int a;
lexSkipLookahead();
a = lexLookahead();
- if ( a != ';' ) {
- lexAppendc('\\');
- } else {
+ if ( a == ';' ) {
lexAppendc( ';' );
lexSkipLookahead();
+ } else if ( a == '\n' ) {
+ lexAppendc( '\n' );
+ lexSkipLookahead();
+ } else if ( a == '\\' ) {
+ lexAppendc( '\\' );
+ lexSkipLookahead();
+ } else {
+ lexAppendc('\\');
}
} else if (c == '\n') {
int a;
lexSkipLookahead();
a = lexLookahead();
if (a == ' ' || a == '\t') {
lexAppendc(' ');
lexSkipLookahead();
}
else {
lexPushLookaheadc('\n');
break;
@@ -952,64 +958,66 @@ static char* lexGetQuotedPrintable()
lexSkipLookahead();
c = lexLookahead();
++mime_lineNum; // aid in error reporting
continue;
} else if (next >= '0' && next <= '9') {
cur = next - '0';
} else if (next >= 'A' && next <= 'F') {
cur = next - 'A' + 10;
} else {
// we have been sent buggy stuff. doesn't matter
// what we do so long as we keep going.
// should probably spit an error here
+ lexSkipLookahead();
c = lexLookahead();
continue;
}
lexSkipLookahead(); // skip A-Z0-9
next = lexLookahead();
cur = cur * 16;
// this time really just expecting 0-9A-F
if (next >= '0' && next <= '9') {
cur += next - '0';
} else if (next >= 'A' && next <= 'F') {
cur += next - 'A' + 10;
} else {
// we have been sent buggy stuff. doesn't matter
// what we do so long as we keep going.
// should probably spit an error here
+ lexSkipLookahead();
c = lexLookahead();
continue;
}
// got a valid escaped =. append it.
lexSkipLookahead(); // skip second 0-9A-F
lexAppendc(cur);
} else {
lexSkipLookahead(); // skip whatever we just read.
lexAppendc(c); // and append it.
}
c = lexLookahead();
}
lexAppendc(0);
return c==EOF?0:lexStr();
}
static int yylex() {
int lexmode = LEXMODE();
if (lexmode == L_VALUES) {
int c = lexGetc();
- if (c == ';') {
+ if (c == ';' && fieldedProp) {
DBG_(("db: SEMICOLON\n"));
lexPushLookaheadc(c);
handleMoreRFC822LineBreak(c);
lexSkipLookahead();
return SEMICOLON;
}
else if (strchr("\n",c)) {
++mime_lineNum;
/* consume all line separator(s) adjacent to each other */
c = lexLookahead();
while (strchr("\n",c)) {
lexSkipLookahead();
@@ -1045,30 +1053,32 @@ static int yylex() {
}
else return 0;
}
}
else {
/* normal mode */
while (1) {
int c = lexGetc();
switch(c) {
case ':': {
/* consume all line separator(s) adjacent to each other */
/* ignoring linesep immediately after colon. */
+ /* I don't see this in the spec, and it breaks null values -- WA
c = lexLookahead();
while (strchr("\n",c)) {
lexSkipLookahead();
c = lexLookahead();
++mime_lineNum;
}
+ */
DBG_(("db: COLON\n"));
return COLON;
}
case ';':
DBG_(("db: SEMICOLON\n"));
return SEMICOLON;
case '=':
DBG_(("db: EQ\n"));
return EQ;
/* ignore whitespace in this mode */
case '\t':
case ' ': continue;