]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
eliminate another batch of compiler warnings (and a bug, although in code we aren...
authorKevin P. Fleming <kpfleming@digium.com>
Fri, 6 Jul 2007 16:30:32 +0000 (16:30 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Fri, 6 Jul 2007 16:30:32 +0000 (16:30 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@73726 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/minimime/Makefile
main/minimime/mimeparser.h
main/minimime/mimeparser.l
main/minimime/mimeparser.tab.c
main/minimime/mimeparser.tab.h
main/minimime/mimeparser.y
main/minimime/mimeparser.yy.c
main/minimime/mm_parse.c

index 28c4934d926ab41aad76e547bcbce5ea89086439..555d17a04725534296fea3319c17530b8a77f791 100644 (file)
@@ -42,6 +42,8 @@ MM_HDRS:=mm.h mm_util.h
 # may actually be important and spot out real bugs.
 ASTCFLAGS:=$(filter-out -Werror,$(ASTCFLAGS))
 
+ASTCFLAGS+=-std=c99
+
 all: $(LIBMMIME)
 
 $(LIBMMIME): $(MM_OBJS)
@@ -49,11 +51,11 @@ $(LIBMMIME): $(MM_OBJS)
        $(CMD_PREFIX) $(AR) cr $@ $^
        $(CMD_PREFIX) $(RANLIB) $@
 
-#mimeparser.yy.c: mimeparser.l
-#      flex -Pmimeparser_yy -omimeparser.yy.c mimeparser.l
+mimeparser.yy.c:
+       flex -Pmimeparser_yy -omimeparser.yy.c mimeparser.l
 
-#mimeparser.tab.c: mimeparser.y
-#      bison -d -pmimeparser_yy -omimeparser.tab.c mimeparser.y
+mimeparser.tab.c:
+       bison -d -pmimeparser_yy -omimeparser.tab.c mimeparser.y
 
 clean::
        rm -f $(LIBMMIME) *.o
index 3d8da816f7bc2a74a5d5f2cd31a6690d9e1a97f6..f6bfbaad70273c481e372a1a44722ad2d6bcfd9d 100644 (file)
@@ -33,7 +33,7 @@ struct lexer_state
 
        char *boundary_string;
        char *endboundary_string;
-       char *message_buffer;
+       const char *message_buffer;
 };
 
 
@@ -51,6 +51,10 @@ struct parser_state
        struct lexer_state lstate;
 };
 
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
 
 #include "mimeparser.tab.h"
 
@@ -62,6 +66,11 @@ int  dprintf2(struct parser_state *, const char *, ...);
 int    mimeparser_yyparse(struct parser_state *, void *);
 int    mimeparser_yylex(YYSTYPE *, void *);
 int    mimeparser_yyerror(struct parser_state *, void *, const char *);
-
+int    mimeparser_yylex_init(yyscan_t* scanner);
+int    mimeparser_yylex_destroy(yyscan_t yyscanner);
+void   reset_lexer_state(void *yyscanner, struct parser_state *pstate);
+int    PARSER_initialize(struct parser_state *pstate, yyscan_t scanner);
+void   PARSER_setbuffer(const char *string, yyscan_t scanner);
+void   PARSER_setfp(FILE *fp, yyscan_t scanner);
 
 #endif /* ! _MIMEPARSER_H_INCLUDED */
index d45295f131b8d82c16ec9605903e285f000db800..19d42cf3a14eee871b83984bfaa698c96d221fb0 100644 (file)
@@ -94,8 +94,9 @@ TSPECIAL_LITE [a-zA-Z0-9)(<>@,-._+'?\[\]]
 %%
 
 <INITIAL,headers>^[a-zA-Z]+[a-zA-Z0-9\-\_]* {
-       yylval_param->string=strdup(yytext); 
        struct lexer_state *lstate = yyget_extra(yyscanner);
+
+       yylval_param->string=strdup(yytext); 
        lstate->current_pos += yyleng;
        BC(header);
 
@@ -443,7 +444,7 @@ void reset_lexer_state(void *yyscanner, struct parser_state *pstate)
 }
 
 void
-PARSER_setbuffer(char *string, yyscan_t scanner)
+PARSER_setbuffer(const char *string, yyscan_t scanner)
 {
        struct lexer_state *lstate = yyget_extra(scanner);
        lstate->message_buffer = string;
@@ -451,15 +452,15 @@ PARSER_setbuffer(char *string, yyscan_t scanner)
 }
 
 void
-PARSER_setfp(FILE *fp, yyscan_t yyscanner)
+PARSER_setfp(FILE *fp, yyscan_t scanner)
 {
        /* looks like a bug in bison 2.2a -- the wrong code is generated for yyset_in !! */
-       struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+       struct yyguts_t * yyg = (struct yyguts_t*) scanner;
        yyg->yyin_r = fp;
        
        if (0) {
                /* This is just to make a compiler warning go away */
-               yyunput(0, NULL, yyscanner);
+               yyunput(0, NULL, scanner);
        }
 }
 
index 509fa4d2daa325b4a2eaffaa5737f67b69f8196a..ef9a4a3fda21224524f7dbd4db7a74fd018733f6 100644 (file)
@@ -184,8 +184,6 @@ int mimeparser_yywrap(void);
 void reset_environ(struct parser_state *pstate);
 int PARSER_initialize(struct parser_state *pstate, void *yyscanner);
 
-typedef void *yyscan_t;
-
 static char *PARSE_readmessagepart(size_t, size_t, size_t, size_t *,yyscan_t, struct parser_state *);
 FILE *mimeparser_yyget_in (yyscan_t yyscanner );
 
@@ -211,14 +209,14 @@ FILE *mimeparser_yyget_in (yyscan_t yyscanner );
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 69 "mimeparser.y"
+#line 67 "mimeparser.y"
 {
        int number;
        char *string;
        struct s_position position;
 }
-/* Line 193 of yacc.c.  */
-#line 222 "mimeparser.tab.c"
+/* Line 187 of yacc.c.  */
+#line 220 "mimeparser.tab.c"
        YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -231,7 +229,7 @@ typedef union YYSTYPE
 
 
 /* Line 216 of yacc.c.  */
-#line 235 "mimeparser.tab.c"
+#line 233 "mimeparser.tab.c"
 
 #ifdef short
 # undef short
@@ -281,7 +279,7 @@ typedef short int yytype_int16;
 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
 
 #ifndef YY_
-# if YYENABLE_NLS
+# if defined(YYENABLE_NLS)
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -534,12 +532,12 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   114,   114,   116,   121,   120,   133,   141,   143,   167,
-     171,   186,   190,   193,   197,   199,   203,   218,   220,   230,
-     232,   234,   236,   250,   257,   276,   284,   294,   300,   308,
-     331,   338,   345,   349,   351,   355,   364,   366,   368,   382,
-     384,   386,   400,   431,   445,   451,   466,   474,   481,   500,
-     519
+       0,   112,   112,   114,   119,   118,   131,   139,   141,   165,
+     169,   184,   188,   191,   195,   197,   201,   216,   218,   228,
+     230,   232,   234,   248,   255,   274,   282,   292,   298,   306,
+     329,   336,   343,   347,   349,   353,   362,   364,   366,   380,
+     382,   384,   398,   429,   443,   449,   464,   472,   479,   498,
+     517
 };
 #endif
 
@@ -759,7 +757,7 @@ while (YYID (0))
    we won't break user code: when these are the locations we know.  */
 
 #ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
+# if defined(YYLTYPE_IS_TRIVIAL)
 #  define YY_LOCATION_PRINT(File, Loc)                 \
      fprintf (File, "%d.%d-%d.%d",                     \
              (Loc).first_line, (Loc).first_column,     \
@@ -1513,31 +1511,31 @@ yyreduce:
   switch (yyn)
     {
         case 4:
-#line 121 "mimeparser.y"
+#line 119 "mimeparser.y"
     { 
                mm_context_attachpart(pstate->ctx, pstate->current_mimepart);
                pstate->current_mimepart = mm_mimepart_new();
                pstate->have_contenttype = 0;
-       }
+       ;}
     break;
 
   case 5:
-#line 127 "mimeparser.y"
+#line 125 "mimeparser.y"
     {
                dprintf2(pstate,"This was a multipart message\n");
-       }
+       ;}
     break;
 
   case 6:
-#line 134 "mimeparser.y"
+#line 132 "mimeparser.y"
     {
                dprintf2(pstate,"This was a single part message\n");
                mm_context_attachpart(pstate->ctx, pstate->current_mimepart);
-       }
+       ;}
     break;
 
   case 8:
-#line 144 "mimeparser.y"
+#line 142 "mimeparser.y"
     {
                /* If we did not find a Content-Type header for the current
                 * MIME part (or envelope), we create one and attach it.
@@ -1559,11 +1557,11 @@ yyreduce:
                        mm_mimepart_attachcontenttype(pstate->current_mimepart, ct);
                }       
                pstate->have_contenttype = 0;
-       }
+       ;}
     break;
 
   case 10:
-#line 172 "mimeparser.y"
+#line 170 "mimeparser.y"
     {
                char *preamble;
                size_t offset;
@@ -1577,17 +1575,17 @@ yyreduce:
                        pstate->ctx->preamble = preamble;
                        dprintf2(pstate,"PREAMBLE:\n%s\n", preamble);
                }
-       }
+       ;}
     break;
 
   case 12:
-#line 191 "mimeparser.y"
+#line 189 "mimeparser.y"
     {
-       }
+       ;}
     break;
 
   case 16:
-#line 204 "mimeparser.y"
+#line 202 "mimeparser.y"
     {
 
                if (mm_context_attachpart(pstate->ctx, pstate->current_mimepart) == -1) {
@@ -1598,11 +1596,11 @@ yyreduce:
                pstate->temppart = mm_mimepart_new();
                pstate->current_mimepart = pstate->temppart;
                pstate->mime_parts++;
-       }
+       ;}
     break;
 
   case 18:
-#line 221 "mimeparser.y"
+#line 219 "mimeparser.y"
     {
                pstate->have_contenttype = 1;
                if (mm_content_iscomposite(pstate->envelope->type)) {
@@ -1610,11 +1608,11 @@ yyreduce:
                } else {
                        pstate->ctx->messagetype = MM_MSGTYPE_FLAT;
                }       
-       }
+       ;}
     break;
 
   case 22:
-#line 237 "mimeparser.y"
+#line 235 "mimeparser.y"
     {
                if (pstate->parsemode != MM_PARSE_LOOSE) {
                        mm_errno = MM_ERROR_PARSE;
@@ -1624,20 +1622,20 @@ yyreduce:
                } else {
                        /* TODO: attach MM_WARNING_INVHDR */
                }
-       }
+       ;}
     break;
 
   case 23:
-#line 251 "mimeparser.y"
+#line 249 "mimeparser.y"
     {
                struct mm_mimeheader *hdr;
                hdr = mm_mimeheader_generate((yyvsp[(1) - (4)].string), (yyvsp[(3) - (4)].string));
                mm_mimepart_attachheader(pstate->current_mimepart, hdr);
-       }
+       ;}
     break;
 
   case 24:
-#line 258 "mimeparser.y"
+#line 256 "mimeparser.y"
     {
                struct mm_mimeheader *hdr;
 
@@ -1652,47 +1650,47 @@ yyreduce:
                
                hdr = mm_mimeheader_generate((yyvsp[(1) - (3)].string), xstrdup(""));
                mm_mimepart_attachheader(pstate->current_mimepart, hdr);
-       }
+       ;}
     break;
 
   case 25:
-#line 277 "mimeparser.y"
+#line 275 "mimeparser.y"
     {
                mm_content_settype(pstate->ctype, "%s", (yyvsp[(3) - (4)].string));
                mm_mimepart_attachcontenttype(pstate->current_mimepart, pstate->ctype);
                dprintf2(pstate,"Content-Type -> %s\n", (yyvsp[(3) - (4)].string));
                pstate->ctype = mm_content_new();
-       }
+       ;}
     break;
 
   case 26:
-#line 285 "mimeparser.y"
+#line 283 "mimeparser.y"
     {
                mm_content_settype(pstate->ctype, "%s", (yyvsp[(3) - (5)].string));
                mm_mimepart_attachcontenttype(pstate->current_mimepart, pstate->ctype);
                dprintf2(pstate,"Content-Type (P) -> %s\n", (yyvsp[(3) - (5)].string));
                pstate->ctype = mm_content_new();
-       }
+       ;}
     break;
 
   case 27:
-#line 295 "mimeparser.y"
+#line 293 "mimeparser.y"
     {
                dprintf2(pstate,"Content-Disposition -> %s\n", (yyvsp[(3) - (4)].string));
                pstate->ctype->disposition_type = xstrdup((yyvsp[(3) - (4)].string));
-       }
+       ;}
     break;
 
   case 28:
-#line 301 "mimeparser.y"
+#line 299 "mimeparser.y"
     {
                dprintf2(pstate,"Content-Disposition (P) -> %s; params\n", (yyvsp[(3) - (5)].string));
                pstate->ctype->disposition_type = xstrdup((yyvsp[(3) - (5)].string));
-       }
+       ;}
     break;
 
   case 29:
-#line 309 "mimeparser.y"
+#line 307 "mimeparser.y"
     {
                /*
                 * According to RFC 2183, the content disposition value may
@@ -1711,34 +1709,34 @@ yyreduce:
                        /* TODO: attach MM_WARNING_INVHDR */
                }       
                (yyval.string) = (yyvsp[(1) - (1)].string);
-       }
+       ;}
     break;
 
   case 30:
-#line 332 "mimeparser.y"
+#line 330 "mimeparser.y"
     {
                dprintf2(pstate,"Content-Transfer-Encoding -> %s\n", (yyvsp[(3) - (4)].string));
-       }
+       ;}
     break;
 
   case 31:
-#line 339 "mimeparser.y"
+#line 337 "mimeparser.y"
     {
                dprintf2(pstate,"MIME-Version -> '%s'\n", (yyvsp[(3) - (4)].string));
-       }
+       ;}
     break;
 
   case 35:
-#line 356 "mimeparser.y"
+#line 354 "mimeparser.y"
     {
                char type[255];
                snprintf(type, sizeof(type), "%s/%s", (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].string));
                (yyval.string) = type;
-       }
+       ;}
     break;
 
   case 38:
-#line 369 "mimeparser.y"
+#line 367 "mimeparser.y"
     {
                if (pstate->parsemode != MM_PARSE_LOOSE) {
                        mm_errno = MM_ERROR_MIME;
@@ -1748,11 +1746,11 @@ yyreduce:
                } else {
                        /* TODO: attach MM_WARNING_INVHDR */
                }       
-       }
+       ;}
     break;
 
   case 41:
-#line 387 "mimeparser.y"
+#line 385 "mimeparser.y"
     {  
                if (pstate->parsemode != MM_PARSE_LOOSE) {
                        mm_errno = MM_ERROR_MIME;
@@ -1762,11 +1760,11 @@ yyreduce:
                } else {
                        /* TODO: attach MM_WARNING_INVHDR */
                }
-       }
+       ;}
     break;
 
   case 42:
-#line 401 "mimeparser.y"
+#line 399 "mimeparser.y"
     {
                struct mm_param *param;
                param = mm_param_new();
@@ -1793,11 +1791,11 @@ yyreduce:
                param->value = xstrdup((yyvsp[(3) - (3)].string));
 
                mm_content_attachtypeparam(pstate->ctype, param);
-       }
+       ;}
     break;
 
   case 43:
-#line 432 "mimeparser.y"
+#line 430 "mimeparser.y"
     {
                struct mm_param *param;
                param = mm_param_new();
@@ -1807,19 +1805,19 @@ yyreduce:
 
                mm_content_attachdispositionparam(pstate->ctype, param);
 
-       }
+       ;}
     break;
 
   case 44:
-#line 446 "mimeparser.y"
+#line 444 "mimeparser.y"
     {
                dprintf2(pstate,"contenttype_param_val: WORD=%s\n", (yyvsp[(1) - (1)].string));
                (yyval.string) = (yyvsp[(1) - (1)].string);
-       }
+       ;}
     break;
 
   case 45:
-#line 452 "mimeparser.y"
+#line 450 "mimeparser.y"
     {
                dprintf2(pstate,"contenttype_param_val: TSPECIAL\n");
                /* For broken MIME implementation */
@@ -1832,26 +1830,26 @@ yyreduce:
                        /* TODO: attach MM_WARNING_INVAL */
                }       
                (yyval.string) = (yyvsp[(1) - (1)].string);
-       }
+       ;}
     break;
 
   case 46:
-#line 467 "mimeparser.y"
+#line 465 "mimeparser.y"
     {
                dprintf2(pstate,"contenttype_param_val: \"TSPECIAL\"\n" );
                (yyval.string) = (yyvsp[(2) - (3)].string);
-       }
+       ;}
     break;
 
   case 47:
-#line 475 "mimeparser.y"
+#line 473 "mimeparser.y"
     {
                dprintf2(pstate,"End of headers at line %d\n", pstate->lstate.lineno);
-       }
+       ;}
     break;
 
   case 48:
-#line 482 "mimeparser.y"
+#line 480 "mimeparser.y"
     {
                if (pstate->lstate.boundary_string == NULL) {
                        mm_errno = MM_ERROR_PARSE;
@@ -1866,11 +1864,11 @@ yyreduce:
                        return(-1);
                }
                dprintf2(pstate,"New MIME part... (%s)\n", (yyvsp[(1) - (2)].string));
-       }
+       ;}
     break;
 
   case 49:
-#line 501 "mimeparser.y"
+#line 499 "mimeparser.y"
     {
                if (pstate->lstate.endboundary_string == NULL) {
                        mm_errno = MM_ERROR_PARSE;
@@ -1885,11 +1883,11 @@ yyreduce:
                        return(-1);
                }
                dprintf2(pstate,"End of MIME message\n");
-       }
+       ;}
     break;
 
   case 50:
-#line 520 "mimeparser.y"
+#line 518 "mimeparser.y"
     {
                char *body;
                size_t offset;
@@ -1906,12 +1904,12 @@ yyreduce:
                pstate->current_mimepart->body = body + offset;
                pstate->current_mimepart->opaque_length = (yyvsp[(1) - (1)].position).end - (yyvsp[(1) - (1)].position).start - 2 + offset;
                pstate->current_mimepart->length = pstate->current_mimepart->opaque_length - offset;
-       }
+       ;}
     break;
 
 
 /* Line 1267 of yacc.c.  */
-#line 1915 "mimeparser.tab.c"
+#line 1913 "mimeparser.tab.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2125,7 +2123,7 @@ yyreturn:
 }
 
 
-#line 539 "mimeparser.y"
+#line 537 "mimeparser.y"
 
 
 /*
index 6cf3f22a24855da70e455b2f742f718bac100da3..c19731fd2572a88564100b6813d14f65320745d7 100644 (file)
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 69 "mimeparser.y"
+#line 67 "mimeparser.y"
 {
        int number;
        char *string;
        struct s_position position;
 }
-/* Line 1529 of yacc.c.  */
+/* Line 1489 of yacc.c.  */
 #line 105 "mimeparser.tab.h"
        YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
index 18f409f359dfdb5d4cd4395c00eaeb8ae31bc3fa..7c32a290ddee30eda8b55e67a1e70c5564a9b439 100644 (file)
@@ -53,8 +53,6 @@ int mimeparser_yywrap(void);
 void reset_environ(struct parser_state *pstate);
 int PARSER_initialize(struct parser_state *pstate, void *yyscanner);
 
-typedef void *yyscan_t;
-
 static char *PARSE_readmessagepart(size_t, size_t, size_t, size_t *,yyscan_t, struct parser_state *);
 FILE *mimeparser_yyget_in (yyscan_t yyscanner );
 
index 40d6bd9fa9c911bfa2fb868e9128a4dca795d481..4cf454c7c7911914d305bedff8d93f0952a7add9 100644 (file)
@@ -755,8 +755,12 @@ char *mimeparser_yyget_text (yyscan_t yyscanner );
 
 int mimeparser_yyget_lineno (yyscan_t yyscanner );
 
+int mimeparser_yyget_column  (yyscan_t yyscanner);
+
 void mimeparser_yyset_lineno (int line_number ,yyscan_t yyscanner );
 
+void mimeparser_yyset_column (int  column_no , yyscan_t yyscanner);
+
 YYSTYPE * mimeparser_yyget_lval (yyscan_t yyscanner );
 
 void mimeparser_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
@@ -1014,8 +1018,9 @@ case 1:
 YY_RULE_SETUP
 #line 96 "mimeparser.l"
 {
-       yylval_param->string=strdup(yytext); 
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
+
+       yylval_param->string=strdup(yytext); 
        lstate->current_pos += yyleng;
        BC(header);
 
@@ -1042,7 +1047,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 123 "mimeparser.l"
+#line 124 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        /* dprintf2("Unknown header char: %c\n", *yytext); */
@@ -1053,7 +1058,7 @@ YY_RULE_SETUP
 case 3:
 /* rule 3 can match eol */
 YY_RULE_SETUP
-#line 130 "mimeparser.l"
+#line 131 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->lineno++; 
@@ -1078,7 +1083,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 152 "mimeparser.l"
+#line 153 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        BC(headervalue); 
@@ -1089,7 +1094,7 @@ YY_RULE_SETUP
 case 5:
 /* rule 5 can match eol */
 YY_RULE_SETUP
-#line 159 "mimeparser.l"
+#line 160 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        BC(headers);
@@ -1101,7 +1106,7 @@ YY_RULE_SETUP
 case 6:
 /* rule 6 can match eol */
 YY_RULE_SETUP
-#line 167 "mimeparser.l"
+#line 168 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->current_pos += yyleng;
@@ -1110,7 +1115,7 @@ YY_RULE_SETUP
 case 7:
 /* rule 7 can match eol */
 YY_RULE_SETUP
-#line 172 "mimeparser.l"
+#line 173 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        if (lstate->header_state != STATE_MAIL && lstate->header_state != STATE_CENC) {
@@ -1131,7 +1136,7 @@ YY_RULE_SETUP
 case 8:
 /* rule 8 can match eol */
 YY_RULE_SETUP
-#line 189 "mimeparser.l"
+#line 190 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        /* marks the end of one header line */
@@ -1144,7 +1149,7 @@ YY_RULE_SETUP
 case 9:
 /* rule 9 can match eol */
 YY_RULE_SETUP
-#line 198 "mimeparser.l"
+#line 199 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->lineno += count_lines(yytext);
@@ -1154,7 +1159,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 205 "mimeparser.l"
+#line 206 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->current_pos += yyleng;
@@ -1163,7 +1168,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 211 "mimeparser.l"
+#line 212 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        BC(tspecialvalue);
@@ -1173,7 +1178,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 218 "mimeparser.l"
+#line 219 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        yylval_param->string=strdup(yytext);
@@ -1184,7 +1189,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 226 "mimeparser.l"
+#line 227 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->current_pos += yyleng;
@@ -1192,7 +1197,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 231 "mimeparser.l"
+#line 232 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->lineno += count_lines(yytext);
@@ -1203,7 +1208,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 239 "mimeparser.l"
+#line 240 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        BC(headervalue);
@@ -1213,7 +1218,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 246 "mimeparser.l"
+#line 247 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        /**
@@ -1251,7 +1256,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 281 "mimeparser.l"
+#line 282 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        /**
@@ -1297,7 +1302,7 @@ YY_RULE_SETUP
 case 18:
 /* rule 18 can match eol */
 YY_RULE_SETUP
-#line 323 "mimeparser.l"
+#line 324 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->current_pos += yyleng;
@@ -1306,7 +1311,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 329 "mimeparser.l"
+#line 330 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->current_pos += yyleng;
@@ -1315,14 +1320,14 @@ YY_RULE_SETUP
        YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 335 "mimeparser.l"
+#line 336 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->current_pos += yyleng;
 }
        YY_BREAK
 case YY_STATE_EOF(body):
-#line 340 "mimeparser.l"
+#line 341 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        if (lstate->boundary_string == NULL && lstate->body_start) {
@@ -1340,7 +1345,7 @@ case YY_STATE_EOF(body):
 case 21:
 /* rule 21 can match eol */
 YY_RULE_SETUP
-#line 354 "mimeparser.l"
+#line 355 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        /* dprintf2("Preamble CR/LF at line %d\n", lineno); */
@@ -1350,7 +1355,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 361 "mimeparser.l"
+#line 362 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        yylval_param->string = strdup(yytext);
@@ -1360,7 +1365,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 368 "mimeparser.l"
+#line 369 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        yylval_param->string = strdup(yytext);
@@ -1371,7 +1376,7 @@ YY_RULE_SETUP
 case 24:
 /* rule 24 can match eol */
 YY_RULE_SETUP
-#line 375 "mimeparser.l"
+#line 376 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        BC(headers);
@@ -1384,7 +1389,7 @@ YY_RULE_SETUP
 case 25:
 /* rule 25 can match eol */
 YY_RULE_SETUP
-#line 384 "mimeparser.l"
+#line 385 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        BC(postamble);
@@ -1394,7 +1399,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 391 "mimeparser.l"
+#line 392 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->current_pos += yyleng;
@@ -1402,7 +1407,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 397 "mimeparser.l"
+#line 398 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->current_pos += yyleng;
@@ -1411,7 +1416,7 @@ YY_RULE_SETUP
 case 28:
 /* rule 28 can match eol */
 YY_RULE_SETUP
-#line 402 "mimeparser.l"
+#line 403 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->lineno++;
@@ -1421,7 +1426,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 409 "mimeparser.l"
+#line 410 "mimeparser.l"
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
        lstate->current_pos += yyleng;
@@ -1430,10 +1435,10 @@ YY_RULE_SETUP
        YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 416 "mimeparser.l"
+#line 417 "mimeparser.l"
 ECHO;
        YY_BREAK
-#line 1437 "mimeparser.yy.c"
+#line 1438 "mimeparser.yy.c"
                        case YY_STATE_EOF(INITIAL):
                        case YY_STATE_EOF(headers):
                        case YY_STATE_EOF(header):
@@ -1646,7 +1651,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 
                /* Read in more data. */
                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-                       yyg->yy_n_chars, num_to_read );
+                       yyg->yy_n_chars, (size_t) num_to_read );
 
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
                }
@@ -2549,7 +2554,7 @@ void mimeparser_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 416 "mimeparser.l"
+#line 417 "mimeparser.l"
 
 
 
@@ -2581,7 +2586,7 @@ void reset_lexer_state(void *yyscanner, struct parser_state *pstate)
 }
 
 void
-PARSER_setbuffer(char *string, yyscan_t scanner)
+PARSER_setbuffer(const char *string, yyscan_t scanner)
 {
        struct lexer_state *lstate = mimeparser_yyget_extra(scanner);
        lstate->message_buffer = string;
@@ -2589,15 +2594,15 @@ PARSER_setbuffer(char *string, yyscan_t scanner)
 }
 
 void
-PARSER_setfp(FILE *fp, yyscan_t yyscanner)
+PARSER_setfp(FILE *fp, yyscan_t scanner)
 {
        /* looks like a bug in bison 2.2a -- the wrong code is generated for mimeparser_yyset_in !! */
-       struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+       struct yyguts_t * yyg = (struct yyguts_t*) scanner;
        yyg->yyin_r = fp;
        
        if (0) {
                /* This is just to make a compiler warning go away */
-               yyunput(0, NULL, yyscanner);
+               yyunput(0, NULL, scanner);
        }
 }
 
index 5080f5bc1f4e63b7d5f36ba0b899d9ddddbd625e..4223d99e0db893571d9bb44739aa61c4b9518408 100644 (file)
 #include "mimeparser.h"
 #include "mimeparser.tab.h"
 
-int yyparse (struct parser_state *pstate, void *yyscanner);
-void PARSER_initialize(struct parser_state *, void *);
-void PARSER_setbuffer(const char *);
-void PARSER_setfp(FILE *,void *yyscanner);
-
 /** @file mm_parse.c
  *
  * Functions to parse MIME messages
@@ -86,9 +81,6 @@ mm_parse_mem(MM_CTX *ctx, const char *text, int parsemode, int flags)
        void *yyscanner;
        int res;
        struct parser_state pstate;
-       typedef void *yyscan_t;
-       int mimeparser_yylex_init (yyscan_t* scanner);
-       int mimeparser_yylex_destroy (yyscan_t yyscanner );
        
        pstate.ctx = ctx;
        pstate.parsemode = parsemode;
@@ -96,8 +88,8 @@ mm_parse_mem(MM_CTX *ctx, const char *text, int parsemode, int flags)
        mimeparser_yylex_init(&yyscanner);
        PARSER_initialize(&pstate, yyscanner);
        
-       PARSER_setbuffer(text);
-       PARSER_setfp(NULL,yyscanner);
+       PARSER_setbuffer(text, yyscanner);
+       PARSER_setfp(NULL, yyscanner);
        
        res =  mimeparser_yyparse(&pstate,yyscanner);
        mimeparser_yylex_destroy(yyscanner);
@@ -127,7 +119,6 @@ mm_parse_mem(MM_CTX *ctx, const char *text, int parsemode, int flags)
  * The context needs to be initialized before using mm_context_new() and may
  * be freed using mm_context_free().
  */
-typedef void *yyscan_t;
 int
 mm_parse_file(MM_CTX *ctx, const char *filename, int parsemode, int flags)
 {
@@ -135,8 +126,6 @@ mm_parse_file(MM_CTX *ctx, const char *filename, int parsemode, int flags)
        int res;
        void *yyscanner;
        struct parser_state pstate;
-       int mimeparser_yylex_init (yyscan_t* scanner);
-       int mimeparser_yylex_destroy (yyscan_t yyscanner );
 
        mimeparser_yylex_init(&yyscanner);
 
@@ -163,8 +152,6 @@ mm_parse_fileptr(MM_CTX *ctx, FILE *f, int parsemode, int flags)
        int res;
        void *yyscanner;
        struct parser_state pstate;
-       int mimeparser_yylex_init (yyscan_t* scanner);
-       int mimeparser_yylex_destroy (yyscan_t yyscanner );
 
        mimeparser_yylex_init(&yyscanner);