-rw-r--r-- | library/backend/vcc.y | 22 | ||||
-rw-r--r-- | library/backend/vcc_yacc.cpp | 139 | ||||
-rw-r--r-- | library/backend/vobject.cpp | 273 | ||||
-rw-r--r-- | library/backend/vobject_p.h | 31 |
4 files changed, 251 insertions, 214 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 | |||
@@ -124,3 +124,3 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. | |||
124 | //#else | 124 | //#else |
125 | #include <qtopia/private/vobject_p.h> | 125 | #include "vobject_p.h" |
126 | //#endif | 126 | //#endif |
@@ -725,3 +725,3 @@ static char* lexGet1Value() { | |||
725 | lexClearToken(); | 725 | lexClearToken(); |
726 | while (c != EOF && c != ';') { | 726 | while (c != EOF && (c != ';' || !fieldedProp)) { |
727 | if (c == '\\' ) { | 727 | if (c == '\\' ) { |
@@ -730,7 +730,13 @@ static char* lexGet1Value() { | |||
730 | a = lexLookahead(); | 730 | a = lexLookahead(); |
731 | if ( a != ';' ) { | 731 | if ( a == ';' ) { |
732 | lexAppendc('\\'); | ||
733 | } else { | ||
734 | lexAppendc( ';' ); | 732 | lexAppendc( ';' ); |
735 | lexSkipLookahead(); | 733 | lexSkipLookahead(); |
734 | } else if ( a == '\n' ) { | ||
735 | lexAppendc( '\n' ); | ||
736 | lexSkipLookahead(); | ||
737 | } else if ( a == '\\' ) { | ||
738 | lexAppendc( '\\' ); | ||
739 | lexSkipLookahead(); | ||
740 | } else { | ||
741 | lexAppendc('\\'); | ||
736 | } | 742 | } |
@@ -963,2 +969,3 @@ static char* lexGetQuotedPrintable() | |||
963 | // should probably spit an error here | 969 | // should probably spit an error here |
970 | lexSkipLookahead(); | ||
964 | c = lexLookahead(); | 971 | c = lexLookahead(); |
@@ -980,2 +987,3 @@ static char* lexGetQuotedPrintable() | |||
980 | // should probably spit an error here | 987 | // should probably spit an error here |
988 | lexSkipLookahead(); | ||
981 | c = lexLookahead(); | 989 | c = lexLookahead(); |
@@ -1002,3 +1010,3 @@ static int yylex() { | |||
1002 | int c = lexGetc(); | 1010 | int c = lexGetc(); |
1003 | if (c == ';') { | 1011 | if (c == ';' && fieldedProp) { |
1004 | DBG_(("db: SEMICOLON\n")); | 1012 | DBG_(("db: SEMICOLON\n")); |
@@ -1056,2 +1064,3 @@ static int yylex() { | |||
1056 | /* ignoring linesep immediately after colon. */ | 1064 | /* ignoring linesep immediately after colon. */ |
1065 | /* I don't see this in the spec, and it breaks null values -- WA | ||
1057 | c = lexLookahead(); | 1066 | c = lexLookahead(); |
@@ -1062,2 +1071,3 @@ static int yylex() { | |||
1062 | } | 1071 | } |
1072 | */ | ||
1063 | DBG_(("db: COLON\n")); | 1073 | DBG_(("db: COLON\n")); |
diff --git a/library/backend/vcc_yacc.cpp b/library/backend/vcc_yacc.cpp index b2b0c14..5649522 100644 --- a/library/backend/vcc_yacc.cpp +++ b/library/backend/vcc_yacc.cpp | |||
@@ -160,3 +160,3 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. | |||
160 | /*#else */ | 160 | /*#else */ |
161 | #include <qtopia/private/vobject_p.h> | 161 | #include "vobject_p.h" |
162 | /*#endif */ | 162 | /*#endif */ |
@@ -745,3 +745,3 @@ static char* lexGet1Value() { | |||
745 | lexClearToken(); | 745 | lexClearToken(); |
746 | while (c != EOF && c != ';') { | 746 | while (c != EOF && (c != ';' || !fieldedProp)) { |
747 | if (c == '\\' ) { | 747 | if (c == '\\' ) { |
@@ -750,7 +750,13 @@ static char* lexGet1Value() { | |||
750 | a = lexLookahead(); | 750 | a = lexLookahead(); |
751 | if ( a != ';' ) { | 751 | if ( a == ';' ) { |
752 | lexAppendc('\\'); | ||
753 | } else { | ||
754 | lexAppendc( ';' ); | 752 | lexAppendc( ';' ); |
755 | lexSkipLookahead(); | 753 | lexSkipLookahead(); |
754 | } else if ( a == '\n' ) { | ||
755 | lexAppendc( '\n' ); | ||
756 | lexSkipLookahead(); | ||
757 | } else if ( a == '\\' ) { | ||
758 | lexAppendc( '\\' ); | ||
759 | lexSkipLookahead(); | ||
760 | } else { | ||
761 | lexAppendc('\\'); | ||
756 | } | 762 | } |
@@ -952,57 +958,68 @@ static int match_begin_end_name(int end) { | |||
952 | static char* lexGetQuotedPrintable() | 958 | static char* lexGetQuotedPrintable() |
953 | { | 959 | { |
954 | int cur; | 960 | int c; |
955 | 961 | lexSkipWhite(); | |
962 | c = lexLookahead(); | ||
956 | lexClearToken(); | 963 | lexClearToken(); |
957 | do { | ||
958 | cur = lexGetc(); | ||
959 | switch (cur) { | ||
960 | case '=': { | ||
961 | int c = 0; | ||
962 | int next[2]; | ||
963 | int i; | ||
964 | for (i = 0; i < 2; i++) { | ||
965 | next[i] = lexGetc(); | ||
966 | if (next[i] >= '0' && next[i] <= '9') | ||
967 | c = c * 16 + next[i] - '0'; | ||
968 | else if (next[i] >= 'A' && next[i] <= 'F') | ||
969 | c = c * 16 + next[i] - 'A' + 10; | ||
970 | else | ||
971 | break; | ||
972 | } | ||
973 | if (i == 0) { | ||
974 | /* single '=' follow by LINESEP is continuation sign? */ | ||
975 | if (next[0] == '\n') { | ||
976 | ++mime_lineNum; | ||
977 | } | ||
978 | else { | ||
979 | lexPushLookaheadc('='); | ||
980 | goto EndString; | ||
981 | } | ||
982 | } | ||
983 | else if (i == 1) { | ||
984 | lexPushLookaheadc(next[1]); | ||
985 | lexPushLookaheadc(next[0]); | ||
986 | lexAppendc('='); | ||
987 | } else { | ||
988 | lexAppendc(c); | ||
989 | } | ||
990 | break; | ||
991 | } /* '=' */ | ||
992 | case '\n': { | ||
993 | lexPushLookaheadc('\n'); | ||
994 | goto EndString; | ||
995 | } | ||
996 | case (int)EOF: | ||
997 | break; | ||
998 | default: | ||
999 | lexAppendc(cur); | ||
1000 | break; | ||
1001 | } /* switch */ | ||
1002 | } while (cur != (int)EOF); | ||
1003 | 964 | ||
1004 | EndString: | 965 | while (c != EOF && c != ';') { |
966 | if (c == '\n') { | ||
967 | // break, leave '\n' on remaining chars. | ||
968 | break; | ||
969 | } else if (c == '=') { | ||
970 | int cur = 0; | ||
971 | int next; | ||
972 | |||
973 | lexSkipLookahead(); // skip '=' | ||
974 | next = lexLookahead(); | ||
975 | |||
976 | if (next == '\n') { | ||
977 | // skip and only skip the \n | ||
978 | lexSkipLookahead(); | ||
979 | c = lexLookahead(); | ||
980 | ++mime_lineNum; // aid in error reporting | ||
981 | continue; | ||
982 | } else if (next >= '0' && next <= '9') { | ||
983 | cur = next - '0'; | ||
984 | } else if (next >= 'A' && next <= 'F') { | ||
985 | cur = next - 'A' + 10; | ||
986 | } else { | ||
987 | // we have been sent buggy stuff. doesn't matter | ||
988 | // what we do so long as we keep going. | ||
989 | // should probably spit an error here | ||
990 | lexSkipLookahead(); | ||
991 | c = lexLookahead(); | ||
992 | continue; | ||
993 | } | ||
994 | |||
995 | lexSkipLookahead(); // skip A-Z0-9 | ||
996 | next = lexLookahead(); | ||
997 | |||
998 | cur = cur * 16; | ||
999 | // this time really just expecting 0-9A-F | ||
1000 | if (next >= '0' && next <= '9') { | ||
1001 | cur += next - '0'; | ||
1002 | } else if (next >= 'A' && next <= 'F') { | ||
1003 | cur += next - 'A' + 10; | ||
1004 | } else { | ||
1005 | // we have been sent buggy stuff. doesn't matter | ||
1006 | // what we do so long as we keep going. | ||
1007 | // should probably spit an error here | ||
1008 | lexSkipLookahead(); | ||
1009 | c = lexLookahead(); | ||
1010 | continue; | ||
1011 | } | ||
1012 | |||
1013 | // got a valid escaped =. append it. | ||
1014 | lexSkipLookahead(); // skip second 0-9A-F | ||
1015 | lexAppendc(cur); | ||
1016 | } else { | ||
1017 | lexSkipLookahead(); // skip whatever we just read. | ||
1018 | lexAppendc(c); // and append it. | ||
1019 | } | ||
1020 | c = lexLookahead(); | ||
1021 | } | ||
1005 | lexAppendc(0); | 1022 | lexAppendc(0); |
1006 | return lexStr(); | 1023 | return c==EOF?0:lexStr(); |
1007 | } /* LexQuotedPrintable */ | 1024 | } |
1008 | 1025 | ||
@@ -1013,3 +1030,3 @@ static int yylex() { | |||
1013 | int c = lexGetc(); | 1030 | int c = lexGetc(); |
1014 | if (c == ';') { | 1031 | if (c == ';' && fieldedProp) { |
1015 | DBG_(("db: SEMICOLON\n")); | 1032 | DBG_(("db: SEMICOLON\n")); |
@@ -1067,2 +1084,3 @@ static int yylex() { | |||
1067 | /* ignoring linesep immediately after colon. */ | 1084 | /* ignoring linesep immediately after colon. */ |
1085 | /* I don't see this in the spec, and it breaks null values -- WA | ||
1068 | c = lexLookahead(); | 1086 | c = lexLookahead(); |
@@ -1073,2 +1091,3 @@ static int yylex() { | |||
1073 | } | 1091 | } |
1092 | */ | ||
1074 | DBG_(("db: COLON\n")); | 1093 | DBG_(("db: COLON\n")); |
@@ -1219,3 +1238,3 @@ void mime_error_(char *s) | |||
1219 | 1238 | ||
1220 | #line 1221 "y.tab.c" | 1239 | #line 1240 "y.tab.c" |
1221 | #define YYABORT goto yyabort | 1240 | #define YYABORT goto yyabort |
@@ -1519,3 +1538,3 @@ case 45: | |||
1519 | break; | 1538 | break; |
1520 | #line 1521 "y.tab.c" | 1539 | #line 1540 "y.tab.c" |
1521 | } | 1540 | } |
diff --git a/library/backend/vobject.cpp b/library/backend/vobject.cpp index 2c5b577..b6d17dc 100644 --- a/library/backend/vobject.cpp +++ b/library/backend/vobject.cpp | |||
@@ -1,36 +1,36 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | (C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International | 2 | (C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International |
3 | Business Machines Corporation and Siemens Rolm Communications Inc. | 3 | Business Machines Corporation and Siemens Rolm Communications Inc. |
4 | 4 | ||
5 | For purposes of this license notice, the term Licensors shall mean, | 5 | For purposes of this license notice, the term Licensors shall mean, |
6 | collectively, Apple Computer, Inc., AT&T Corp., International | 6 | collectively, Apple Computer, Inc., AT&T Corp., International |
7 | Business Machines Corporation and Siemens Rolm Communications Inc. | 7 | Business Machines Corporation and Siemens Rolm Communications Inc. |
8 | The term Licensor shall mean any of the Licensors. | 8 | The term Licensor shall mean any of the Licensors. |
9 | 9 | ||
10 | Subject to acceptance of the following conditions, permission is hereby | 10 | Subject to acceptance of the following conditions, permission is hereby |
11 | granted by Licensors without the need for written agreement and without | 11 | granted by Licensors without the need for written agreement and without |
12 | license or royalty fees, to use, copy, modify and distribute this | 12 | license or royalty fees, to use, copy, modify and distribute this |
13 | software for any purpose. | 13 | software for any purpose. |
14 | 14 | ||
15 | The above copyright notice and the following four paragraphs must be | 15 | The above copyright notice and the following four paragraphs must be |
16 | reproduced in all copies of this software and any software including | 16 | reproduced in all copies of this software and any software including |
17 | this software. | 17 | this software. |
18 | 18 | ||
19 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE | 19 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE |
20 | ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR | 20 | ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR |
21 | MODIFICATIONS. | 21 | MODIFICATIONS. |
22 | 22 | ||
23 | IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, | 23 | IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, |
24 | INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT | 24 | INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT |
25 | OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | 25 | OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
26 | DAMAGE. | 26 | DAMAGE. |
27 | 27 | ||
28 | EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, | 28 | EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, |
29 | INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE | 29 | INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE |
30 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 30 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
31 | PURPOSE. | 31 | PURPOSE. |
32 | 32 | ||
33 | The software is provided with RESTRICTED RIGHTS. Use, duplication, or | 33 | The software is provided with RESTRICTED RIGHTS. Use, duplication, or |
34 | disclosure by the government are subject to restrictions set forth in | 34 | disclosure by the government are subject to restrictions set forth in |
35 | DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. | 35 | DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. |
36 | 36 | ||
@@ -40,3 +40,3 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. | |||
40 | * src: vobject.c | 40 | * src: vobject.c |
41 | * doc: vobject and APIs to construct vobject, APIs pretty print | 41 | * doc: vobject and APIs to construct vobject, APIs pretty print |
42 | * vobject, and convert a vobject into its textual representation. | 42 | * vobject, and convert a vobject into its textual representation. |
@@ -48,4 +48,5 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. | |||
48 | 48 | ||
49 | #include <qtopia/private/vobject_p.h> | 49 | #include <qtopia/config.h> |
50 | #include <qtopia/private/qfiledirect_p.h> | 50 | #include "vobject_p.h" |
51 | #include "qfiledirect_p.h" | ||
51 | #include <string.h> | 52 | #include <string.h> |
@@ -64,2 +65,6 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. | |||
64 | 65 | ||
66 | static char vobj_cs[10]; | ||
67 | static enum { EightBit, QuotedPrintable, Base64 } vobj_enc=EightBit; | ||
68 | static const char *vobj_enc_s=0; | ||
69 | |||
65 | typedef union ValueItem { | 70 | typedef union ValueItem { |
@@ -88,3 +93,3 @@ struct StrItem { | |||
88 | 93 | ||
89 | const char** fieldedProp; | 94 | DLLEXPORT(const char**) fieldedProp; |
90 | 95 | ||
@@ -329,3 +334,3 @@ DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o) | |||
329 | { | 334 | { |
330 | i->start = o->prop; | 335 | i->start = o->prop; |
331 | i->next = 0; | 336 | i->next = 0; |
@@ -335,3 +340,3 @@ DLLEXPORT(void) initVObjectIterator(VObjectIterator *i, VObject *o) | |||
335 | { | 340 | { |
336 | i->start = o->next; | 341 | i->start = o->next; |
337 | i->next = 0; | 342 | i->next = 0; |
@@ -340,3 +345,3 @@ DLLEXPORT(void) initVObjectIterator(VObjectIterator *i, VObject *o) | |||
340 | DLLEXPORT(int) moreIteration(VObjectIterator *i) | 345 | DLLEXPORT(int) moreIteration(VObjectIterator *i) |
341 | { | 346 | { |
342 | return (i->start && (i->next==0 || i->next!=i->start)); | 347 | return (i->start && (i->next==0 || i->next!=i->start)); |
@@ -405,3 +410,3 @@ DLLEXPORT(VObject*) addGroup(VObject *o, const char *g) | |||
405 | } while (n != gs); | 410 | } while (n != gs); |
406 | deleteStr(gs); | 411 | deleteStr(gs); |
407 | return p; | 412 | return p; |
@@ -801,3 +806,3 @@ static struct PreDefProp* lookupPropInfo(const char* str) | |||
801 | int i; | 806 | int i; |
802 | 807 | ||
803 | for (i = 0; propNames[i].name; i++) | 808 | for (i = 0; propNames[i].name; i++) |
@@ -806,3 +811,3 @@ static struct PreDefProp* lookupPropInfo(const char* str) | |||
806 | } | 811 | } |
807 | 812 | ||
808 | return 0; | 813 | return 0; |
@@ -814,3 +819,3 @@ DLLEXPORT(const char*) lookupProp_(const char* str) | |||
814 | int i; | 819 | int i; |
815 | 820 | ||
816 | for (i = 0; propNames[i].name; i++) | 821 | for (i = 0; propNames[i].name; i++) |
@@ -828,3 +833,3 @@ DLLEXPORT(const char*) lookupProp(const char* str) | |||
828 | int i; | 833 | int i; |
829 | 834 | ||
830 | for (i = 0; propNames[i].name; i++) | 835 | for (i = 0; propNames[i].name; i++) |
@@ -955,2 +960,13 @@ static void appendsOFile(OFile *fp, const char *s) | |||
955 | 960 | ||
961 | static void appendsOFileEncCs(OFile *fp) | ||
962 | { | ||
963 | if ( vobj_enc_s ) { | ||
964 | appendsOFile(fp, ";" VCEncodingProp "="); | ||
965 | appendsOFile(fp, vobj_enc_s); | ||
966 | } | ||
967 | appendsOFile(fp, ";" VCCharSetProp "="); | ||
968 | appendsOFile(fp, vobj_cs); | ||
969 | } | ||
970 | |||
971 | |||
956 | static void initOFile(OFile *fp, FILE *ofp) | 972 | static void initOFile(OFile *fp, FILE *ofp) |
@@ -1007,3 +1023,3 @@ static int writeBase64(OFile *fp, unsigned char *s, long len) | |||
1007 | 1023 | ||
1008 | static const char *replaceChar(unsigned char c) | 1024 | static const char *qpReplaceChar(unsigned char c) |
1009 | { | 1025 | { |
@@ -1012,18 +1028,8 @@ static const char *replaceChar(unsigned char c) | |||
1012 | } else if ( | 1028 | } else if ( |
1013 | (c >= 'A' && c <= 'Z') | 1029 | // RFC 1521 |
1014 | || | 1030 | (c >= 32 && c <= 60) // Note: " " not allowed at EOL |
1015 | (c >= 'a' && c <= 'z') | ||
1016 | || | ||
1017 | (c >= '0' && c <= '9') | ||
1018 | || | ||
1019 | (c >= '\'' && c <= ')') | ||
1020 | || | ||
1021 | (c >= '+' && c <= '-') | ||
1022 | || | ||
1023 | (c == '/') | ||
1024 | || | ||
1025 | (c == '?') | ||
1026 | || | 1031 | || |
1027 | (c == ' ')) | 1032 | (c >= 62 && c <= 126) |
1028 | { | 1033 | ) |
1034 | { | ||
1029 | return 0; | 1035 | return 0; |
@@ -1031,13 +1037,2 @@ static const char *replaceChar(unsigned char c) | |||
1031 | 1037 | ||
1032 | #warning "Bug-Workaround must be fixed !" | ||
1033 | // IF THIS FUNCTION RETURNES TRUE, THE DATA IS EXPORTED | ||
1034 | // AS QUOTED PRINTABLE. | ||
1035 | // BUT THE PARSER IS UNABLE TO IMPORT THIS, THEREFORE | ||
1036 | // I DECIDED TO DISABLE IT UNTIL TROLLTECH FIXES THIS BUG | ||
1037 | // SEE ALSO includesUnprintable(VObject *o) | ||
1038 | // (se) | ||
1039 | |||
1040 | return 0; | ||
1041 | |||
1042 | #if 0 | ||
1043 | static char trans[4]; | 1038 | static char trans[4]; |
@@ -1059,9 +1054,8 @@ static const char *replaceChar(unsigned char c) | |||
1059 | return trans; | 1054 | return trans; |
1060 | #endif | ||
1061 | } | 1055 | } |
1062 | 1056 | ||
1063 | static void writeQPString(OFile *fp, const char *s) | 1057 | static void writeEncString(OFile *fp, const char *s, bool nosemi) |
1064 | { | 1058 | { |
1065 | /* | 1059 | /* |
1066 | only A-Z, 0-9 and | 1060 | only A-Z, 0-9 and |
1067 | "'" (ASCII code 39) | 1061 | "'" (ASCII code 39) |
@@ -1074,3 +1068,3 @@ static void writeQPString(OFile *fp, const char *s) | |||
1074 | "?" (ASCII code 63) | 1068 | "?" (ASCII code 63) |
1075 | 1069 | ||
1076 | should remain un-encoded. | 1070 | should remain un-encoded. |
@@ -1081,9 +1075,31 @@ static void writeQPString(OFile *fp, const char *s) | |||
1081 | const char *p = s; | 1075 | const char *p = s; |
1082 | while (*p) { | 1076 | switch ( vobj_enc ) { |
1083 | const char *rep = replaceChar(*p); | 1077 | case EightBit: |
1084 | if (rep) | 1078 | while (*p) { |
1085 | appendsOFile(fp, rep); | 1079 | if ( *p == '\n' || nosemi && ( *p == '\\' || *p == ';' ) ) |
1086 | else | 1080 | appendcOFile(fp, '\\'); |
1087 | appendcOFile(fp, *p); | 1081 | appendcOFile(fp, *p); |
1088 | p++; | 1082 | p++; |
1083 | } | ||
1084 | break; | ||
1085 | case QuotedPrintable: | ||
1086 | while (*p) { | ||
1087 | const char *rep = qpReplaceChar(*p); | ||
1088 | if (rep) | ||
1089 | appendsOFile(fp, rep); | ||
1090 | else if ( *p == ';' && nosemi ) | ||
1091 | appendsOFile(fp, "=3B"); | ||
1092 | else if ( *p == ' ' ) { | ||
1093 | if ( !p[1] || p[1] == '\n' ) // RFC 1521 | ||
1094 | appendsOFile(fp, "=20"); | ||
1095 | else | ||
1096 | appendcOFile(fp, *p); | ||
1097 | } else | ||
1098 | appendcOFile(fp, *p); | ||
1099 | p++; | ||
1100 | } | ||
1101 | break; | ||
1102 | case Base64: | ||
1103 | writeBase64(fp, (unsigned char*)p, strlen(p)); | ||
1104 | break; | ||
1089 | } | 1105 | } |
@@ -1093,12 +1109,2 @@ static bool includesUnprintable(VObject *o) | |||
1093 | { | 1109 | { |
1094 | |||
1095 | #if 0 | ||
1096 | |||
1097 | // IF THIS FUNCTION RETURNES TRUE, THE DATA IS EXPORTED | ||
1098 | // AS QUOTED PRINTABLE. | ||
1099 | // BUT THE PARSER IS UNABLE TO IMPORT THIS, THEREFORE | ||
1100 | // I DECIDED TO DISABLE IT UNTIL TROLLTECH FIXES THIS BUG | ||
1101 | // SEE ALSO *replaceChar(unsigned char c) | ||
1102 | // (se) | ||
1103 | |||
1104 | if (o) { | 1110 | if (o) { |
@@ -1108,3 +1114,4 @@ static bool includesUnprintable(VObject *o) | |||
1108 | while (*p) { | 1114 | while (*p) { |
1109 | if (replaceChar(*p)) | 1115 | if (*p==' ' && (!p[1] || p[1]=='\n') // RFC 1521: spaces at ends need quoting |
1116 | || qpReplaceChar(*p) ) | ||
1110 | return TRUE; | 1117 | return TRUE; |
@@ -1115,12 +1122,8 @@ static bool includesUnprintable(VObject *o) | |||
1115 | } | 1122 | } |
1116 | |||
1117 | #endif | ||
1118 | #warning "Bug-Workaround must be fixed !" | ||
1119 | |||
1120 | return FALSE; | 1123 | return FALSE; |
1121 | } | 1124 | } |
1122 | 1125 | ||
1123 | static void writeVObject_(OFile *fp, VObject *o); | 1126 | static void writeVObject_(OFile *fp, VObject *o); |
1124 | 1127 | ||
1125 | static void writeValue(OFile *fp, VObject *o, unsigned long size) | 1128 | static void writeValue(OFile *fp, VObject *o, unsigned long size, bool nosemi) |
1126 | { | 1129 | { |
@@ -1129,3 +1132,3 @@ static void writeValue(OFile *fp, VObject *o, unsigned long size) | |||
1129 | case VCVT_STRINGZ: { | 1132 | case VCVT_STRINGZ: { |
1130 | writeQPString(fp, STRINGZ_VALUE_OF(o)); | 1133 | writeEncString(fp, STRINGZ_VALUE_OF(o), nosemi); |
1131 | break; | 1134 | break; |
@@ -1162,15 +1165,13 @@ static void writeAttrValue(OFile *fp, VObject *o) | |||
1162 | if (pi && ((pi->flags & PD_INTERNAL) != 0)) return; | 1165 | if (pi && ((pi->flags & PD_INTERNAL) != 0)) return; |
1163 | if ( includesUnprintable(o) ) { | 1166 | if ( includesUnprintable(o) ) |
1164 | appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); | 1167 | appendsOFileEncCs(fp); |
1165 | appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); | ||
1166 | } | ||
1167 | appendcOFile(fp,';'); | 1168 | appendcOFile(fp,';'); |
1168 | appendsOFile(fp,NAME_OF(o)); | 1169 | appendsOFile(fp,NAME_OF(o)); |
1169 | } | 1170 | } else { |
1170 | else | ||
1171 | appendcOFile(fp,';'); | 1171 | appendcOFile(fp,';'); |
1172 | } | ||
1172 | if (VALUE_TYPE(o)) { | 1173 | if (VALUE_TYPE(o)) { |
1173 | appendcOFile(fp,'='); | 1174 | appendcOFile(fp,'='); |
1174 | writeValue(fp,o,0); | 1175 | writeValue(fp,o,0,TRUE); |
1175 | } | 1176 | } |
1176 | } | 1177 | } |
@@ -1237,6 +1238,4 @@ static void writeProp(OFile *fp, VObject *o) | |||
1237 | fields = fields_; | 1238 | fields = fields_; |
1238 | if (!printable) { | 1239 | if (!printable) |
1239 | appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); | 1240 | appendsOFileEncCs(fp); |
1240 | appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); | ||
1241 | } | ||
1242 | appendcOFile(fp,':'); | 1241 | appendcOFile(fp,':'); |
@@ -1250,3 +1249,3 @@ static void writeProp(OFile *fp, VObject *o) | |||
1250 | for (i=0;i<n;i++) { | 1249 | for (i=0;i<n;i++) { |
1251 | writeValue(fp,isAPropertyOf(o,*fields),0); | 1250 | writeValue(fp,isAPropertyOf(o,*fields),0,TRUE); |
1252 | fields++; | 1251 | fields++; |
@@ -1257,8 +1256,6 @@ static void writeProp(OFile *fp, VObject *o) | |||
1257 | 1256 | ||
1258 | 1257 | ||
1259 | if (VALUE_TYPE(o)) { | 1258 | if (VALUE_TYPE(o)) { |
1260 | if ( includesUnprintable(o) ) { | 1259 | if ( includesUnprintable(o) ) |
1261 | appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); | 1260 | appendsOFileEncCs(fp); |
1262 | appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); | ||
1263 | } | ||
1264 | unsigned long size = 0; | 1261 | unsigned long size = 0; |
@@ -1267,3 +1264,3 @@ static void writeProp(OFile *fp, VObject *o) | |||
1267 | appendcOFile(fp,':'); | 1264 | appendcOFile(fp,':'); |
1268 | writeValue(fp,o,size); | 1265 | writeValue(fp,o,size,FALSE); |
1269 | } | 1266 | } |
@@ -1297,4 +1294,31 @@ static void writeVObject_(OFile *fp, VObject *o) | |||
1297 | 1294 | ||
1295 | static void initVObjectEncoding() | ||
1296 | { | ||
1297 | Config pimConfig( "Beam" ); | ||
1298 | pimConfig.setGroup("Send"); | ||
1299 | Config devcfg(pimConfig.readEntry("DeviceConfig"),Config::File); | ||
1300 | QString enc = "QP"; | ||
1301 | QString cs = "UTF-8"; | ||
1302 | if ( devcfg.isValid() ) { | ||
1303 | devcfg.setGroup("Send"); | ||
1304 | enc = devcfg.readEntry("Encoding","QP"); | ||
1305 | cs = devcfg.readEntry("CharSet","UTF-8"); | ||
1306 | } | ||
1307 | strncpy(vobj_cs,cs.latin1(),10); | ||
1308 | if ( enc == "QP" ) { | ||
1309 | vobj_enc = QuotedPrintable; | ||
1310 | vobj_enc_s = VCQuotedPrintableProp; | ||
1311 | } else if ( enc == "B64" ) { | ||
1312 | vobj_enc = Base64; | ||
1313 | vobj_enc_s = VCBase64Prop; | ||
1314 | } else { | ||
1315 | vobj_enc = EightBit; | ||
1316 | vobj_enc_s = 0; | ||
1317 | } | ||
1318 | } | ||
1319 | |||
1298 | void writeVObject(FILE *fp, VObject *o) | 1320 | void writeVObject(FILE *fp, VObject *o) |
1299 | { | 1321 | { |
1322 | initVObjectEncoding(); | ||
1323 | |||
1300 | OFile ofp; | 1324 | OFile ofp; |
@@ -1331,7 +1355,2 @@ DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list) | |||
1331 | 1355 | ||
1332 | #ifndef __SHARP_COMP_ | ||
1333 | |||
1334 | // This function is not available in the Sharp ROM for SL 5500 ! | ||
1335 | // Therefore I have to move it into the header file.. (se) | ||
1336 | |||
1337 | DLLEXPORT(const char *) vObjectTypeInfo(VObject *o) | 1356 | DLLEXPORT(const char *) vObjectTypeInfo(VObject *o) |
@@ -1343,3 +1362,3 @@ DLLEXPORT(const char *) vObjectTypeInfo(VObject *o) | |||
1343 | } | 1362 | } |
1344 | #endif | 1363 | |
1345 | 1364 | ||
diff --git a/library/backend/vobject_p.h b/library/backend/vobject_p.h index bab22bb..f969898 100644 --- a/library/backend/vobject_p.h +++ b/library/backend/vobject_p.h | |||
@@ -101,7 +101,11 @@ For example: | |||
101 | #undef DLLEXPORT | 101 | #undef DLLEXPORT |
102 | //#include <qtopia/qpeglobal.h> | ||
102 | #include <qglobal.h> | 103 | #include <qglobal.h> |
103 | #if defined(Q_WS_WIN) | 104 | |
105 | #if defined(QTOPIA_MAKEDLL) | ||
104 | #define DLLEXPORT(t) __declspec(dllexport) t | 106 | #define DLLEXPORT(t) __declspec(dllexport) t |
107 | #elif defined(QTOPIA_DLL) | ||
108 | #define DLLEXPORT(t) __declspec(dllimport) t | ||
105 | #else | 109 | #else |
106 | #define DLLEXPORT(t) t | 110 | #define DLLEXPORT(t) t |
107 | #endif | 111 | #endif |
@@ -353,3 +357,3 @@ extern DLLEXPORT(int) vObjectValueType(VObject *o); | |||
353 | 357 | ||
354 | extern const char** fieldedProp; | 358 | extern DLLEXPORT(const char**) fieldedProp; |
355 | 359 | ||
@@ -370,3 +374,3 @@ the DLL LIB you will get a link error. | |||
370 | */ | 374 | */ |
371 | extern void writeVObject(FILE *fp, VObject *o); | 375 | extern DLLEXPORT(void) writeVObject(FILE *fp, VObject *o); |
372 | 376 | ||
@@ -395,24 +399,9 @@ will get a link error. | |||
395 | #if INCLUDEMFC | 399 | #if INCLUDEMFC |
396 | extern VObject* Parse_MIME_FromFile(CFile *file); | 400 | extern DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file); |
397 | #else | 401 | #else |
398 | extern VObject* Parse_MIME_FromFile(FILE *file); | 402 | extern DLLEXPORT(VObject*) Parse_MIME_FromFile(FILE *file); |
399 | #endif | 403 | #endif |
400 | 404 | ||
401 | #define __SHARP_COMP_ | ||
402 | |||
403 | #ifndef __SHARP_COMP_ | ||
404 | extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o); | 405 | extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o); |
405 | 406 | ||
406 | #else | ||
407 | // This function is not available in the Sharp ROM for SL 5500 ! | ||
408 | // Therefore I have to move it into the header file.. (se) | ||
409 | |||
410 | inline const char* vObjectTypeInfo(VObject *o) | ||
411 | { | ||
412 | const char *type = vObjectName( o ); | ||
413 | if ( strcmp( type, "TYPE" ) == 0 ) | ||
414 | type = vObjectStringZValue( o ); | ||
415 | return type; | ||
416 | } | ||
417 | #endif | ||
418 | 407 | ||