summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2003-08-29 18:02:09 (UTC)
committer zecke <zecke>2003-08-29 18:02:09 (UTC)
commit885c645ee48ae53467e244521c011c73bc106afb (patch) (side-by-side diff)
tree9024be25b2503788d3aa77b7a86b89e543cdd865 /library
parented6da2303a8fabec50991365914f0e4d20a21ea6 (diff)
downloadopie-885c645ee48ae53467e244521c011c73bc106afb.zip
opie-885c645ee48ae53467e244521c011c73bc106afb.tar.gz
opie-885c645ee48ae53467e244521c011c73bc106afb.tar.bz2
Fixes for base64 decoding and encoding of vCard
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/vcc.y29
-rw-r--r--library/backend/vcc_yacc.cpp33
-rw-r--r--library/backend/vobject.cpp5
-rw-r--r--library/backend/vobject_p.h4
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
@@ -442,5 +442,5 @@ static void enterProps(const char *s)
static void enterAttr(const char *s1, const char *s2)
{
- const char *p1, *p2;
+ const char *p1, *p2=0;
p1 = lookupProp_(s1);
if (s2) {
@@ -814,5 +814,5 @@ static void finiLex() {
* a decoded buffer (allocated with new). See RFC 1521.
*/
-static char * lexGetDataFromBase64()
+static int lexGetDataFromBase64()
{
unsigned long bytesLen = 0, bytesMax = 0;
@@ -827,4 +827,5 @@ static char * lexGetDataFromBase64()
while (1) {
c = lexGetc();
+ lexSkipWhite();
if (c == '\n') {
++mime_lineNum;
@@ -849,6 +850,4 @@ static char * lexGetDataFromBase64()
b = 0;
pad++;
- } else if ((c == ' ') || (c == '\t')) {
- continue;
} else { /* error condition */
if (bytes) free(bytes);
@@ -859,12 +858,15 @@ static char * lexGetDataFromBase64()
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;
@@ -912,5 +914,5 @@ static char * lexGetDataFromBase64()
free(oldBytes);
}
- return 0;
+ return bytesLen;
}
@@ -943,5 +945,5 @@ static char* lexGetQuotedPrintable()
lexClearToken();
- while (c != EOF && c != ';') {
+ while (c != EOF && (c != ';' || !fieldedProp)) {
if (c == '\n') {
// break, leave '\n' on remaining chars.
@@ -1033,9 +1035,6 @@ static int yylex() {
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)) {
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
@@ -462,5 +462,5 @@ static void enterProps(const char *s)
static void enterAttr(const char *s1, const char *s2)
{
- const char *p1, *p2;
+ const char *p1, *p2=0;
p1 = lookupProp_(s1);
if (s2) {
@@ -834,5 +834,5 @@ static void finiLex() {
* a decoded buffer (allocated with new). See RFC 1521.
*/
-static char * lexGetDataFromBase64()
+static int lexGetDataFromBase64()
{
unsigned long bytesLen = 0, bytesMax = 0;
@@ -847,4 +847,5 @@ static char * lexGetDataFromBase64()
while (1) {
c = lexGetc();
+ lexSkipWhite();
if (c == '\n') {
++mime_lineNum;
@@ -869,6 +870,4 @@ static char * lexGetDataFromBase64()
b = 0;
pad++;
- } else if ((c == ' ') || (c == '\t')) {
- continue;
} else { /* error condition */
if (bytes) free(bytes);
@@ -879,12 +878,15 @@ static char * lexGetDataFromBase64()
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;
@@ -932,5 +934,5 @@ static char * lexGetDataFromBase64()
free(oldBytes);
}
- return 0;
+ return bytesLen;
}
@@ -963,5 +965,5 @@ static char* lexGetQuotedPrintable()
lexClearToken();
- while (c != EOF && c != ';') {
+ while (c != EOF && (c != ';' || !fieldedProp)) {
if (c == '\n') {
// break, leave '\n' on remaining chars.
@@ -1053,9 +1055,6 @@ static int yylex() {
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)) {
@@ -1239,5 +1238,5 @@ void mime_error_(char *s)
}
-#line 1240 "y.tab.c"
+#line 1241 "y.tab.c"
#define YYABORT goto yyabort
#define YYREJECT goto yyabort
@@ -1539,5 +1538,5 @@ case 45:
}
break;
-#line 1540 "y.tab.c"
+#line 1541 "y.tab.c"
}
yyssp -= yym;
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
@@ -43,7 +43,5 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
*/
-#ifndef MWERKS
-#include <malloc.h>
-#endif
+#include <stdlib.h>
#include <qtopia/config.h>
@@ -758,5 +756,4 @@ static struct PreDefProp propNames[] = {
{ VCPublicKeyProp, 0, 0, 0 },
{ VCQPProp, VCQuotedPrintableProp, 0, 0 },
- { VCQPProp, VCBase64Prop, 0, 0 },
{ VCQuickTimeProp, 0, 0, 0 },
{ VCQuotedPrintableProp, 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
@@ -100,7 +100,5 @@ For example:
#undef DLLEXPORT
- //#include <qtopia/qpeglobal.h>
-#include <qglobal.h>
-
+#include <qtopia/global.h>
#if defined(QTOPIA_MAKEDLL)
#define DLLEXPORT(t) __declspec(dllexport) t