Diffstat (limited to 'library/backend/vcc_yacc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | library/backend/vcc_yacc.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
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) | |||
458 | curProp = addGroup(curObj,s); | 458 | curProp = addGroup(curObj,s); |
459 | deleteStr(s); | 459 | deleteStr(s); |
460 | } | 460 | } |
461 | 461 | ||
462 | static void enterAttr(const char *s1, const char *s2) | 462 | static 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); |
@@ -830,25 +830,26 @@ static void finiLex() { | |||
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 | */ |
836 | static char * lexGetDataFromBase64() | 836 | static 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 | } |
@@ -865,30 +866,31 @@ static char * lexGetDataFromBase64() | |||
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; |
@@ -928,13 +930,13 @@ static char * lexGetDataFromBase64() | |||
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 | ||
937 | static int match_begin_end_name(int end) { | 939 | static 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; |
@@ -959,13 +961,13 @@ static 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; |
@@ -1049,17 +1051,14 @@ static int yylex() { | |||
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 |
@@ -1235,13 +1234,13 @@ void 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 |
1246 | int | 1245 | int |
1247 | #if defined(__STDC__) | 1246 | #if defined(__STDC__) |
@@ -1535,13 +1534,13 @@ case 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 | } |
1540 | break; | 1539 | break; |
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) |