-rw-r--r-- | library/backend/vcc.y | 29 | ||||
-rw-r--r-- | library/backend/vcc_yacc.cpp | 33 | ||||
-rw-r--r-- | library/backend/vobject.cpp | 5 | ||||
-rw-r--r-- | library/backend/vobject_p.h | 4 |
4 files changed, 32 insertions, 39 deletions
diff --git a/library/backend/vcc.y b/library/backend/vcc.y index 4c79368..bec2955 100644 --- a/library/backend/vcc.y +++ b/library/backend/vcc.y @@ -438,13 +438,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);
@@ -810,25 +810,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;
}
@@ -845,30 +846,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;
@@ -908,13 +910,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;
@@ -939,13 +941,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;
@@ -1029,17 +1031,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
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) diff --git a/library/backend/vobject.cpp b/library/backend/vobject.cpp index 4c8de70..9263c3a 100644 --- a/library/backend/vobject.cpp +++ b/library/backend/vobject.cpp @@ -39,15 +39,13 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. /* * src: vobject.c * doc: vobject and APIs to construct vobject, APIs pretty print * vobject, and convert a vobject into its textual representation. */ -#ifndef MWERKS -#include <malloc.h> -#endif +#include <stdlib.h> #include <qtopia/config.h> #include "vobject_p.h" #include "qfiledirect_p.h" #include <string.h> #include <stdio.h> @@ -754,13 +752,12 @@ static struct PreDefProp propNames[] = { { VCProdIdProp, 0, 0, 0 }, { VCProdigyProp, 0, 0, 0 }, { VCPronunciationProp, 0, 0, 0 }, { VCPSProp, 0, 0, 0 }, { VCPublicKeyProp, 0, 0, 0 }, { VCQPProp, VCQuotedPrintableProp, 0, 0 }, - { VCQPProp, VCBase64Prop, 0, 0 }, { VCQuickTimeProp, 0, 0, 0 }, { VCQuotedPrintableProp, 0, 0, 0 }, { VCRDateProp, 0, 0, 0 }, { VCRegionProp, 0, 0, 0 }, { VCRelatedToProp, 0, 0, 0 }, { VCRepeatCountProp, 0, 0, 0 }, diff --git a/library/backend/vobject_p.h b/library/backend/vobject_p.h index f969898..3c9d0d3 100644 --- a/library/backend/vobject_p.h +++ b/library/backend/vobject_p.h @@ -96,15 +96,13 @@ For example: */ #define vCardMimeType "text/x-vCard" #define vCalendarMimeType "text/x-vCalendar" #undef DLLEXPORT - //#include <qtopia/qpeglobal.h> -#include <qglobal.h> - +#include <qtopia/global.h> #if defined(QTOPIA_MAKEDLL) #define DLLEXPORT(t) __declspec(dllexport) t #elif defined(QTOPIA_DLL) #define DLLEXPORT(t) __declspec(dllimport) t #else #define DLLEXPORT(t) t |