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) (unidiff)
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
@@ -432,25 +432,25 @@ static void enterValues(const char *value)
432 } 432 }
433 deleteStr(value); 433 deleteStr(value);
434 } 434 }
435 435
436static void enterProps(const char *s) 436static void enterProps(const char *s)
437 { 437 {
438 curProp = addGroup(curObj,s); 438 curProp = addGroup(curObj,s);
439 deleteStr(s); 439 deleteStr(s);
440 } 440 }
441 441
442static void enterAttr(const char *s1, const char *s2) 442static void enterAttr(const char *s1, const char *s2)
443 { 443 {
444 const char *p1, *p2; 444 const char *p1, *p2=0;
445 p1 = lookupProp_(s1); 445 p1 = lookupProp_(s1);
446 if (s2) { 446 if (s2) {
447 VObject *a; 447 VObject *a;
448 p2 = lookupProp_(s2); 448 p2 = lookupProp_(s2);
449 a = addProp(curProp,p1); 449 a = addProp(curProp,p1);
450 setVObjectStringZValue(a,p2); 450 setVObjectStringZValue(a,p2);
451 } 451 }
452 else 452 else
453 addProp(curProp,p1); 453 addProp(curProp,p1);
454 if (qstricmp(p1,VCBase64Prop) == 0 || (s2 && qstricmp(p2,VCBase64Prop)==0)) 454 if (qstricmp(p1,VCBase64Prop) == 0 || (s2 && qstricmp(p2,VCBase64Prop)==0))
455 lexPushMode(L_BASE64); 455 lexPushMode(L_BASE64);
456 else if (qstricmp(p1,VCQuotedPrintableProp) == 0 456 else if (qstricmp(p1,VCQuotedPrintableProp) == 0
@@ -804,77 +804,79 @@ void initLex(const char *inputstring, unsigned long inputlen, FILE *inputfile)
804 804
805 } 805 }
806 806
807static void finiLex() { 807static void finiLex() {
808 free(lexBuf.strs); 808 free(lexBuf.strs);
809 } 809 }
810 810
811 811
812/*-----------------------------------*/ 812/*-----------------------------------*/
813/* This parses and converts the base64 format for binary encoding into 813/* This parses and converts the base64 format for binary encoding into
814 * a decoded buffer (allocated with new). See RFC 1521. 814 * a decoded buffer (allocated with new). See RFC 1521.
815 */ 815 */
816static char * lexGetDataFromBase64() 816static int lexGetDataFromBase64()
817 { 817 {
818 unsigned long bytesLen = 0, bytesMax = 0; 818 unsigned long bytesLen = 0, bytesMax = 0;
819 int quadIx = 0, pad = 0; 819 int quadIx = 0, pad = 0;
820 unsigned long trip = 0; 820 unsigned long trip = 0;
821 unsigned char b; 821 unsigned char b;
822 int c; 822 int c;
823 unsigned char *bytes = NULL; 823 unsigned char *bytes = NULL;
824 unsigned char *oldBytes = NULL; 824 unsigned char *oldBytes = NULL;
825 825
826 DBG_(("db: lexGetDataFromBase64\n")); 826 DBG_(("db: lexGetDataFromBase64\n"));
827 while (1) { 827 while (1) {
828 c = lexGetc(); 828 c = lexGetc();
829 lexSkipWhite();
829 if (c == '\n') { 830 if (c == '\n') {
830 ++mime_lineNum; 831 ++mime_lineNum;
831 if (lexLookahead() == '\n') { 832 if (lexLookahead() == '\n') {
832 /* a '\n' character by itself means end of data */ 833 /* a '\n' character by itself means end of data */
833 break; 834 break;
834 } 835 }
835 else continue; /* ignore '\n' */ 836 else continue; /* ignore '\n' */
836 } 837 }
837 else { 838 else {
838 if ((c >= 'A') && (c <= 'Z')) 839 if ((c >= 'A') && (c <= 'Z'))
839 b = (unsigned char)(c - 'A'); 840 b = (unsigned char)(c - 'A');
840 else if ((c >= 'a') && (c <= 'z')) 841 else if ((c >= 'a') && (c <= 'z'))
841 b = (unsigned char)(c - 'a') + 26; 842 b = (unsigned char)(c - 'a') + 26;
842 else if ((c >= '0') && (c <= '9')) 843 else if ((c >= '0') && (c <= '9'))
843 b = (unsigned char)(c - '0') + 52; 844 b = (unsigned char)(c - '0') + 52;
844 else if (c == '+') 845 else if (c == '+')
845 b = 62; 846 b = 62;
846 else if (c == '/') 847 else if (c == '/')
847 b = 63; 848 b = 63;
848 else if (c == '=') { 849 else if (c == '=') {
849 b = 0; 850 b = 0;
850 pad++; 851 pad++;
851 } else if ((c == ' ') || (c == '\t')) {
852 continue;
853 } else { /* error condition */ 852 } else { /* error condition */
854 if (bytes) free(bytes); 853 if (bytes) free(bytes);
855 else if (oldBytes) free(oldBytes); 854 else if (oldBytes) free(oldBytes);
856 // error recovery: skip until 2 adjacent newlines. 855 // error recovery: skip until 2 adjacent newlines.
857 DBG_(("db: invalid character 0x%x '%c'\n", c,c)); 856 DBG_(("db: invalid character 0x%x '%c'\n", c,c));
858 if (c != EOF) { 857 if (c != EOF) {
859 c = lexGetc(); 858 c = lexGetc();
860 while (c != EOF) { 859 while (c != EOF) {
861 if (c == '\n' && lexLookahead() == '\n') { 860 if (c == '\n') {
862 ++mime_lineNum; 861 lexSkipWhite();
863 break; 862 if(lexLookahead() == '\n') {
863 ++mime_lineNum;
864 break;
865 }
864 } 866 }
865 c = lexGetc(); 867 c = lexGetc();
866 } 868 }
867 } 869 }
868 return NULL; 870 return c != EOF;
869 } 871 }
870 trip = (trip << 6) | b; 872 trip = (trip << 6) | b;
871 if (++quadIx == 4) { 873 if (++quadIx == 4) {
872 unsigned char outBytes[3]; 874 unsigned char outBytes[3];
873 int numOut; 875 int numOut;
874 int i; 876 int i;
875 for (i = 0; i < 3; i++) { 877 for (i = 0; i < 3; i++) {
876 outBytes[2-i] = (unsigned char)(trip & 0xFF); 878 outBytes[2-i] = (unsigned char)(trip & 0xFF);
877 trip >>= 8; 879 trip >>= 8;
878 } 880 }
879 numOut = 3 - pad; 881 numOut = 3 - pad;
880 if (bytesLen + numOut > bytesMax) { 882 if (bytesLen + numOut > bytesMax) {
@@ -902,25 +904,25 @@ static char * lexGetDataFromBase64()
902 } /* while */ 904 } /* while */
903 DBG_(("db: bytesLen = %d\n", bytesLen)); 905 DBG_(("db: bytesLen = %d\n", bytesLen));
904 /* kludge: all this won't be necessary if we have tree form 906 /* kludge: all this won't be necessary if we have tree form
905 representation */ 907 representation */
906 if (bytes) { 908 if (bytes) {
907 setValueWithSize(curProp,bytes,(unsigned int)bytesLen); 909 setValueWithSize(curProp,bytes,(unsigned int)bytesLen);
908 free(bytes); 910 free(bytes);
909 } 911 }
910 else if (oldBytes) { 912 else if (oldBytes) {
911 setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen); 913 setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen);
912 free(oldBytes); 914 free(oldBytes);
913 } 915 }
914 return 0; 916 return bytesLen;
915 } 917 }
916 918
917static int match_begin_end_name(int end) { 919static int match_begin_end_name(int end) {
918 int token; 920 int token;
919 lexSkipWhite(); 921 lexSkipWhite();
920 if (lexLookahead() != ':') return ID; 922 if (lexLookahead() != ':') return ID;
921 lexSkipLookahead(); 923 lexSkipLookahead();
922 lexSkipWhite(); 924 lexSkipWhite();
923 token = match_begin_name(end); 925 token = match_begin_name(end);
924 if (token == ID) { 926 if (token == ID) {
925 lexPushLookaheadc(':'); 927 lexPushLookaheadc(':');
926 DBG_(("db: ID '%s'\n", yylval.str)); 928 DBG_(("db: ID '%s'\n", yylval.str));
@@ -933,25 +935,25 @@ static int match_begin_end_name(int end) {
933 return token; 935 return token;
934 } 936 }
935 return 0; 937 return 0;
936 } 938 }
937 939
938static char* lexGetQuotedPrintable() 940static char* lexGetQuotedPrintable()
939{ 941{
940 int c; 942 int c;
941 lexSkipWhite(); 943 lexSkipWhite();
942 c = lexLookahead(); 944 c = lexLookahead();
943 lexClearToken(); 945 lexClearToken();
944 946
945 while (c != EOF && c != ';') { 947 while (c != EOF && (c != ';' || !fieldedProp)) {
946 if (c == '\n') { 948 if (c == '\n') {
947 // break, leave '\n' on remaining chars. 949 // break, leave '\n' on remaining chars.
948 break; 950 break;
949 } else if (c == '=') { 951 } else if (c == '=') {
950 int cur = 0; 952 int cur = 0;
951 int next; 953 int next;
952 954
953 lexSkipLookahead(); // skip '=' 955 lexSkipLookahead(); // skip '='
954 next = lexLookahead(); 956 next = lexLookahead();
955 957
956 if (next == '\n') { 958 if (next == '\n') {
957 // skip and only skip the \n 959 // skip and only skip the \n
@@ -1023,29 +1025,26 @@ static int yylex() {
1023 lexSkipLookahead(); 1025 lexSkipLookahead();
1024 c = lexLookahead(); 1026 c = lexLookahead();
1025 ++mime_lineNum; 1027 ++mime_lineNum;
1026 } 1028 }
1027 DBG_(("db: LINESEP\n")); 1029 DBG_(("db: LINESEP\n"));
1028 return LINESEP; 1030 return LINESEP;
1029 } 1031 }
1030 else { 1032 else {
1031 char *p = 0; 1033 char *p = 0;
1032 lexPushLookaheadc(c); 1034 lexPushLookaheadc(c);
1033 if (lexWithinMode(L_BASE64)) { 1035 if (lexWithinMode(L_BASE64)) {
1034 /* get each char and convert to bin on the fly... */ 1036 /* get each char and convert to bin on the fly... */
1035 p = lexGetDataFromBase64(); 1037 yylval.str = NULL;
1036 #if 0 1038 return lexGetDataFromBase64() ? STRING : 0;
1037 yylval.str = p;
1038 return STRING;
1039 #endif
1040 } 1039 }
1041 else if (lexWithinMode(L_QUOTED_PRINTABLE)) { 1040 else if (lexWithinMode(L_QUOTED_PRINTABLE)) {
1042 p = lexGetQuotedPrintable(); 1041 p = lexGetQuotedPrintable();
1043 } 1042 }
1044 else { 1043 else {
1045#ifdef _SUPPORT_LINE_FOLDING 1044#ifdef _SUPPORT_LINE_FOLDING
1046 p = lexGet1Value(); 1045 p = lexGet1Value();
1047#else 1046#else
1048 p = lexGetStrUntil(";\n"); 1047 p = lexGetStrUntil(";\n");
1049#endif 1048#endif
1050 } 1049 }
1051 if (p) { 1050 if (p) {
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
@@ -452,25 +452,25 @@ static void enterValues(const char *value)
452 } 452 }
453 deleteStr(value); 453 deleteStr(value);
454 } 454 }
455 455
456static void enterProps(const char *s) 456static void enterProps(const char *s)
457 { 457 {
458 curProp = addGroup(curObj,s); 458 curProp = addGroup(curObj,s);
459 deleteStr(s); 459 deleteStr(s);
460 } 460 }
461 461
462static void enterAttr(const char *s1, const char *s2) 462static void enterAttr(const char *s1, const char *s2)
463 { 463 {
464 const char *p1, *p2; 464 const char *p1, *p2=0;
465 p1 = lookupProp_(s1); 465 p1 = lookupProp_(s1);
466 if (s2) { 466 if (s2) {
467 VObject *a; 467 VObject *a;
468 p2 = lookupProp_(s2); 468 p2 = lookupProp_(s2);
469 a = addProp(curProp,p1); 469 a = addProp(curProp,p1);
470 setVObjectStringZValue(a,p2); 470 setVObjectStringZValue(a,p2);
471 } 471 }
472 else 472 else
473 addProp(curProp,p1); 473 addProp(curProp,p1);
474 if (qstricmp(p1,VCBase64Prop) == 0 || (s2 && qstricmp(p2,VCBase64Prop)==0)) 474 if (qstricmp(p1,VCBase64Prop) == 0 || (s2 && qstricmp(p2,VCBase64Prop)==0))
475 lexPushMode(L_BASE64); 475 lexPushMode(L_BASE64);
476 else if (qstricmp(p1,VCQuotedPrintableProp) == 0 476 else if (qstricmp(p1,VCQuotedPrintableProp) == 0
@@ -824,77 +824,79 @@ void initLex(const char *inputstring, unsigned long inputlen, FILE *inputfile)
824 824
825 } 825 }
826 826
827static void finiLex() { 827static void finiLex() {
828 free(lexBuf.strs); 828 free(lexBuf.strs);
829 } 829 }
830 830
831 831
832/*-----------------------------------*/ 832/*-----------------------------------*/
833/* This parses and converts the base64 format for binary encoding into 833/* This parses and converts the base64 format for binary encoding into
834 * a decoded buffer (allocated with new). See RFC 1521. 834 * a decoded buffer (allocated with new). See RFC 1521.
835 */ 835 */
836static char * lexGetDataFromBase64() 836static int lexGetDataFromBase64()
837 { 837 {
838 unsigned long bytesLen = 0, bytesMax = 0; 838 unsigned long bytesLen = 0, bytesMax = 0;
839 int quadIx = 0, pad = 0; 839 int quadIx = 0, pad = 0;
840 unsigned long trip = 0; 840 unsigned long trip = 0;
841 unsigned char b; 841 unsigned char b;
842 int c; 842 int c;
843 unsigned char *bytes = NULL; 843 unsigned char *bytes = NULL;
844 unsigned char *oldBytes = NULL; 844 unsigned char *oldBytes = NULL;
845 845
846 DBG_(("db: lexGetDataFromBase64\n")); 846 DBG_(("db: lexGetDataFromBase64\n"));
847 while (1) { 847 while (1) {
848 c = lexGetc(); 848 c = lexGetc();
849 lexSkipWhite();
849 if (c == '\n') { 850 if (c == '\n') {
850 ++mime_lineNum; 851 ++mime_lineNum;
851 if (lexLookahead() == '\n') { 852 if (lexLookahead() == '\n') {
852 /* a '\n' character by itself means end of data */ 853 /* a '\n' character by itself means end of data */
853 break; 854 break;
854 } 855 }
855 else continue; /* ignore '\n' */ 856 else continue; /* ignore '\n' */
856 } 857 }
857 else { 858 else {
858 if ((c >= 'A') && (c <= 'Z')) 859 if ((c >= 'A') && (c <= 'Z'))
859 b = (unsigned char)(c - 'A'); 860 b = (unsigned char)(c - 'A');
860 else if ((c >= 'a') && (c <= 'z')) 861 else if ((c >= 'a') && (c <= 'z'))
861 b = (unsigned char)(c - 'a') + 26; 862 b = (unsigned char)(c - 'a') + 26;
862 else if ((c >= '0') && (c <= '9')) 863 else if ((c >= '0') && (c <= '9'))
863 b = (unsigned char)(c - '0') + 52; 864 b = (unsigned char)(c - '0') + 52;
864 else if (c == '+') 865 else if (c == '+')
865 b = 62; 866 b = 62;
866 else if (c == '/') 867 else if (c == '/')
867 b = 63; 868 b = 63;
868 else if (c == '=') { 869 else if (c == '=') {
869 b = 0; 870 b = 0;
870 pad++; 871 pad++;
871 } else if ((c == ' ') || (c == '\t')) {
872 continue;
873 } else { /* error condition */ 872 } else { /* error condition */
874 if (bytes) free(bytes); 873 if (bytes) free(bytes);
875 else if (oldBytes) free(oldBytes); 874 else if (oldBytes) free(oldBytes);
876 // error recovery: skip until 2 adjacent newlines. 875 // error recovery: skip until 2 adjacent newlines.
877 DBG_(("db: invalid character 0x%x '%c'\n", c,c)); 876 DBG_(("db: invalid character 0x%x '%c'\n", c,c));
878 if (c != EOF) { 877 if (c != EOF) {
879 c = lexGetc(); 878 c = lexGetc();
880 while (c != EOF) { 879 while (c != EOF) {
881 if (c == '\n' && lexLookahead() == '\n') { 880 if (c == '\n') {
882 ++mime_lineNum; 881 lexSkipWhite();
883 break; 882 if(lexLookahead() == '\n') {
883 ++mime_lineNum;
884 break;
885 }
884 } 886 }
885 c = lexGetc(); 887 c = lexGetc();
886 } 888 }
887 } 889 }
888 return NULL; 890 return c != EOF;
889 } 891 }
890 trip = (trip << 6) | b; 892 trip = (trip << 6) | b;
891 if (++quadIx == 4) { 893 if (++quadIx == 4) {
892 unsigned char outBytes[3]; 894 unsigned char outBytes[3];
893 int numOut; 895 int numOut;
894 int i; 896 int i;
895 for (i = 0; i < 3; i++) { 897 for (i = 0; i < 3; i++) {
896 outBytes[2-i] = (unsigned char)(trip & 0xFF); 898 outBytes[2-i] = (unsigned char)(trip & 0xFF);
897 trip >>= 8; 899 trip >>= 8;
898 } 900 }
899 numOut = 3 - pad; 901 numOut = 3 - pad;
900 if (bytesLen + numOut > bytesMax) { 902 if (bytesLen + numOut > bytesMax) {
@@ -922,25 +924,25 @@ static char * lexGetDataFromBase64()
922 } /* while */ 924 } /* while */
923 DBG_(("db: bytesLen = %d\n", bytesLen)); 925 DBG_(("db: bytesLen = %d\n", bytesLen));
924 /* kludge: all this won't be necessary if we have tree form 926 /* kludge: all this won't be necessary if we have tree form
925 representation */ 927 representation */
926 if (bytes) { 928 if (bytes) {
927 setValueWithSize(curProp,bytes,(unsigned int)bytesLen); 929 setValueWithSize(curProp,bytes,(unsigned int)bytesLen);
928 free(bytes); 930 free(bytes);
929 } 931 }
930 else if (oldBytes) { 932 else if (oldBytes) {
931 setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen); 933 setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen);
932 free(oldBytes); 934 free(oldBytes);
933 } 935 }
934 return 0; 936 return bytesLen;
935 } 937 }
936 938
937static int match_begin_end_name(int end) { 939static int match_begin_end_name(int end) {
938 int token; 940 int token;
939 lexSkipWhite(); 941 lexSkipWhite();
940 if (lexLookahead() != ':') return ID; 942 if (lexLookahead() != ':') return ID;
941 lexSkipLookahead(); 943 lexSkipLookahead();
942 lexSkipWhite(); 944 lexSkipWhite();
943 token = match_begin_name(end); 945 token = match_begin_name(end);
944 if (token == ID) { 946 if (token == ID) {
945 lexPushLookaheadc(':'); 947 lexPushLookaheadc(':');
946 DBG_(("db: ID '%s'\n", yylval.str)); 948 DBG_(("db: ID '%s'\n", yylval.str));
@@ -953,25 +955,25 @@ static int match_begin_end_name(int end) {
953 return token; 955 return token;
954 } 956 }
955 return 0; 957 return 0;
956 } 958 }
957 959
958static char* lexGetQuotedPrintable() 960static char* lexGetQuotedPrintable()
959{ 961{
960 int c; 962 int c;
961 lexSkipWhite(); 963 lexSkipWhite();
962 c = lexLookahead(); 964 c = lexLookahead();
963 lexClearToken(); 965 lexClearToken();
964 966
965 while (c != EOF && c != ';') { 967 while (c != EOF && (c != ';' || !fieldedProp)) {
966 if (c == '\n') { 968 if (c == '\n') {
967 // break, leave '\n' on remaining chars. 969 // break, leave '\n' on remaining chars.
968 break; 970 break;
969 } else if (c == '=') { 971 } else if (c == '=') {
970 int cur = 0; 972 int cur = 0;
971 int next; 973 int next;
972 974
973 lexSkipLookahead(); // skip '=' 975 lexSkipLookahead(); // skip '='
974 next = lexLookahead(); 976 next = lexLookahead();
975 977
976 if (next == '\n') { 978 if (next == '\n') {
977 // skip and only skip the \n 979 // skip and only skip the \n
@@ -1043,29 +1045,26 @@ static int yylex() {
1043 lexSkipLookahead(); 1045 lexSkipLookahead();
1044 c = lexLookahead(); 1046 c = lexLookahead();
1045 ++mime_lineNum; 1047 ++mime_lineNum;
1046 } 1048 }
1047 DBG_(("db: LINESEP\n")); 1049 DBG_(("db: LINESEP\n"));
1048 return LINESEP; 1050 return LINESEP;
1049 } 1051 }
1050 else { 1052 else {
1051 char *p = 0; 1053 char *p = 0;
1052 lexPushLookaheadc(c); 1054 lexPushLookaheadc(c);
1053 if (lexWithinMode(L_BASE64)) { 1055 if (lexWithinMode(L_BASE64)) {
1054 /* get each char and convert to bin on the fly... */ 1056 /* get each char and convert to bin on the fly... */
1055 p = lexGetDataFromBase64(); 1057 yylval.str = NULL;
1056#if 0 1058 return lexGetDataFromBase64() ? STRING : 0;
1057 yylval.str = p;
1058 return STRING;
1059 #endif
1060 } 1059 }
1061 else if (lexWithinMode(L_QUOTED_PRINTABLE)) { 1060 else if (lexWithinMode(L_QUOTED_PRINTABLE)) {
1062 p = lexGetQuotedPrintable(); 1061 p = lexGetQuotedPrintable();
1063 } 1062 }
1064 else { 1063 else {
1065#ifdef _SUPPORT_LINE_FOLDING 1064#ifdef _SUPPORT_LINE_FOLDING
1066 p = lexGet1Value(); 1065 p = lexGet1Value();
1067#else 1066#else
1068 p = lexGetStrUntil(";\n"); 1067 p = lexGetStrUntil(";\n");
1069#endif 1068#endif
1070 } 1069 }
1071 if (p) { 1070 if (p) {
@@ -1229,25 +1228,25 @@ void mime_error(char *s)
1229 sprintf(msg,"%s at line %d", s, mime_lineNum); 1228 sprintf(msg,"%s at line %d", s, mime_lineNum);
1230 mimeErrorHandler(msg); 1229 mimeErrorHandler(msg);
1231 } 1230 }
1232 } 1231 }
1233 1232
1234void mime_error_(char *s) 1233void mime_error_(char *s)
1235 { 1234 {
1236 if (mimeErrorHandler) { 1235 if (mimeErrorHandler) {
1237 mimeErrorHandler(s); 1236 mimeErrorHandler(s);
1238 } 1237 }
1239 } 1238 }
1240 1239
1241#line 1240 "y.tab.c" 1240#line 1241 "y.tab.c"
1242#define YYABORT goto yyabort 1241#define YYABORT goto yyabort
1243#define YYREJECT goto yyabort 1242#define YYREJECT goto yyabort
1244#define YYACCEPT goto yyaccept 1243#define YYACCEPT goto yyaccept
1245#define YYERROR goto yyerrlab 1244#define YYERROR goto yyerrlab
1246int 1245int
1247#if defined(__STDC__) 1246#if defined(__STDC__)
1248yyparse(void) 1247yyparse(void)
1249#else 1248#else
1250yyparse() 1249yyparse()
1251#endif 1250#endif
1252{ 1251{
1253 register int yym, yyn, yystate; 1252 register int yym, yyn, yystate;
@@ -1529,25 +1528,25 @@ case 44:
1529{ 1528{
1530 lexPushMode(L_VTODO); 1529 lexPushMode(L_VTODO);
1531 if (!pushVObject(VCTodoProp)) YYERROR; 1530 if (!pushVObject(VCTodoProp)) YYERROR;
1532 } 1531 }
1533break; 1532break;
1534case 45: 1533case 45:
1535#line 376 "backend/vcc.y" 1534#line 376 "backend/vcc.y"
1536{ 1535{
1537 lexPopMode(0); 1536 lexPopMode(0);
1538 popVObject(); 1537 popVObject();
1539 } 1538 }
1540break; 1539break;
1541#line 1540 "y.tab.c" 1540#line 1541 "y.tab.c"
1542 } 1541 }
1543 yyssp -= yym; 1542 yyssp -= yym;
1544 yystate = *yyssp; 1543 yystate = *yyssp;
1545 yyvsp -= yym; 1544 yyvsp -= yym;
1546 yym = yylhs[yyn]; 1545 yym = yylhs[yyn];
1547 if (yystate == 0 && yym == 0) 1546 if (yystate == 0 && yym == 0)
1548 { 1547 {
1549#if YYDEBUG 1548#if YYDEBUG
1550 if (yydebug) 1549 if (yydebug)
1551 printf("%sdebug: after reduction, shifting from state 0 to\ 1550 printf("%sdebug: after reduction, shifting from state 0 to\
1552 state %d\n", YYPREFIX, YYFINAL); 1551 state %d\n", YYPREFIX, YYFINAL);
1553#endif 1552#endif
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
@@ -33,27 +33,25 @@ PURPOSE.
33The software is provided with RESTRICTED RIGHTS. Use, duplication, or 33The software is provided with RESTRICTED RIGHTS. Use, duplication, or
34disclosure by the government are subject to restrictions set forth in 34disclosure by the government are subject to restrictions set forth in
35DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. 35DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
36 36
37***************************************************************************/ 37***************************************************************************/
38 38
39/* 39/*
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.
43 */ 43 */
44 44
45 #ifndef MWERKS 45#include <stdlib.h>
46#include <malloc.h>
47#endif
48 46
49#include <qtopia/config.h> 47#include <qtopia/config.h>
50#include "vobject_p.h" 48#include "vobject_p.h"
51#include "qfiledirect_p.h" 49#include "qfiledirect_p.h"
52#include <string.h> 50#include <string.h>
53#include <stdio.h> 51#include <stdio.h>
54#include <fcntl.h> 52#include <fcntl.h>
55//#include <io.h> 53//#include <io.h>
56 54
57 55
58 #define NAME_OF(o) o->id 56 #define NAME_OF(o) o->id
59 #define VALUE_TYPE(o) o->valType 57 #define VALUE_TYPE(o) o->valType
@@ -748,25 +746,24 @@ static struct PreDefProp propNames[] = {
748 { VCPostalCodeProp, 0, 0, 0 }, 746 { VCPostalCodeProp, 0, 0, 0 },
749 { VCPostalProp, 0, 0, 0 }, 747 { VCPostalProp, 0, 0, 0 },
750 { VCPowerShareProp, 0, 0, 0 }, 748 { VCPowerShareProp, 0, 0, 0 },
751 { VCPreferredProp, 0, 0, 0 }, 749 { VCPreferredProp, 0, 0, 0 },
752 { VCPriorityProp, 0, 0, 0 }, 750 { VCPriorityProp, 0, 0, 0 },
753 { VCProcedureNameProp, 0, 0, 0 }, 751 { VCProcedureNameProp, 0, 0, 0 },
754 { VCProdIdProp, 0, 0, 0 }, 752 { VCProdIdProp, 0, 0, 0 },
755 { VCProdigyProp, 0, 0, 0 }, 753 { VCProdigyProp, 0, 0, 0 },
756 { VCPronunciationProp, 0, 0, 0 }, 754 { VCPronunciationProp, 0, 0, 0 },
757 { VCPSProp, 0, 0, 0 }, 755 { VCPSProp, 0, 0, 0 },
758 { VCPublicKeyProp, 0, 0, 0 }, 756 { VCPublicKeyProp, 0, 0, 0 },
759 { VCQPProp, VCQuotedPrintableProp, 0, 0 }, 757 { VCQPProp, VCQuotedPrintableProp, 0, 0 },
760 { VCQPProp, VCBase64Prop, 0, 0 },
761 { VCQuickTimeProp, 0, 0, 0 }, 758 { VCQuickTimeProp, 0, 0, 0 },
762 { VCQuotedPrintableProp, 0, 0, 0 }, 759 { VCQuotedPrintableProp, 0, 0, 0 },
763 { VCRDateProp, 0, 0, 0 }, 760 { VCRDateProp, 0, 0, 0 },
764 { VCRegionProp, 0, 0, 0 }, 761 { VCRegionProp, 0, 0, 0 },
765 { VCRelatedToProp, 0, 0, 0 }, 762 { VCRelatedToProp, 0, 0, 0 },
766 { VCRepeatCountProp, 0, 0, 0 }, 763 { VCRepeatCountProp, 0, 0, 0 },
767 { VCResourcesProp, 0, 0, 0 }, 764 { VCResourcesProp, 0, 0, 0 },
768 { VCRNumProp, 0, 0, 0 }, 765 { VCRNumProp, 0, 0, 0 },
769 { VCRoleProp, 0, 0, 0 }, 766 { VCRoleProp, 0, 0, 0 },
770 { VCRRuleProp, 0, 0, 0 }, 767 { VCRRuleProp, 0, 0, 0 },
771 { VCRSVPProp, 0, 0, 0 }, 768 { VCRSVPProp, 0, 0, 0 },
772 { VCRunTimeProp, 0, 0, 0 }, 769 { VCRunTimeProp, 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
@@ -90,27 +90,25 @@ are globally unique IDs which can be used to generate clipboard format
90ID's as per the requirements of a specific platform. For example, in 90ID's as per the requirements of a specific platform. For example, in
91Windows they are used as the parameter in a call to RegisterClipboardFormat. 91Windows they are used as the parameter in a call to RegisterClipboardFormat.
92For example: 92For example:
93 93
94 CLIPFORMAT foo = RegisterClipboardFormat(vCardClipboardFormat); 94 CLIPFORMAT foo = RegisterClipboardFormat(vCardClipboardFormat);
95 95
96*/ 96*/
97 97
98 #define vCardMimeType "text/x-vCard" 98 #define vCardMimeType "text/x-vCard"
99 #define vCalendarMimeType"text/x-vCalendar" 99 #define vCalendarMimeType"text/x-vCalendar"
100 100
101#undef DLLEXPORT 101#undef DLLEXPORT
102 //#include <qtopia/qpeglobal.h> 102#include <qtopia/global.h>
103#include <qglobal.h>
104
105#if defined(QTOPIA_MAKEDLL) 103#if defined(QTOPIA_MAKEDLL)
106#define DLLEXPORT(t) __declspec(dllexport) t 104#define DLLEXPORT(t) __declspec(dllexport) t
107#elif defined(QTOPIA_DLL) 105#elif defined(QTOPIA_DLL)
108#define DLLEXPORT(t) __declspec(dllimport) t 106#define DLLEXPORT(t) __declspec(dllimport) t
109#else 107#else
110#define DLLEXPORT(t) t 108#define DLLEXPORT(t) t
111#endif 109#endif
112 110
113#ifndef FALSE 111#ifndef FALSE
114 #define FALSE0 112 #define FALSE0
115#endif 113#endif
116#ifndef TRUE 114#ifndef TRUE