[asterisk-commits] murf: branch group/mime r61304 - /team/group/mime/main/minimime/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Apr 10 15:05:31 MST 2007


Author: murf
Date: Tue Apr 10 17:05:30 2007
New Revision: 61304

URL: http://svn.digium.com/view/asterisk?view=rev&rev=61304
Log:
at 262k buffer size, it crashes. at 362k, it doesn't. So I set it to 562k.Why does postscript drive it so mad...

Modified:
    team/group/mime/main/minimime/mimeparser.l
    team/group/mime/main/minimime/mimeparser.tab.c
    team/group/mime/main/minimime/mimeparser.yy.c
    team/group/mime/main/minimime/mytest.c

Modified: team/group/mime/main/minimime/mimeparser.l
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mimeparser.l?view=diff&rev=61304&r1=61303&r2=61304
==============================================================================
--- team/group/mime/main/minimime/mimeparser.l (original)
+++ team/group/mime/main/minimime/mimeparser.l Tue Apr 10 17:05:30 2007
@@ -56,7 +56,7 @@
 
 #define PREALLOC_BUFFER	100000
 #undef YY_BUF_SIZE
-#define YY_BUF_SIZE 65536
+#define YY_BUF_SIZE 562072
 
 enum header_states
 {
@@ -72,6 +72,7 @@
 %}
 
 %option reentrant
+%option 8bit
 %option yylineno
 %option bison-bridge
 

Modified: team/group/mime/main/minimime/mimeparser.tab.c
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mimeparser.tab.c?view=diff&rev=61304&r1=61303&r2=61304
==============================================================================
--- team/group/mime/main/minimime/mimeparser.tab.c (original)
+++ team/group/mime/main/minimime/mimeparser.tab.c Tue Apr 10 17:05:30 2007
@@ -1518,14 +1518,14 @@
 		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"
     {
 		dprintf2(pstate,"This was a multipart message\n");
-	}
+	;}
     break;
 
   case 6:
@@ -1533,7 +1533,7 @@
     {
 		dprintf2(pstate,"This was a single part message\n");
 		mm_context_attachpart(pstate->ctx, pstate->current_mimepart);
-	}
+	;}
     break;
 
   case 8:
@@ -1559,7 +1559,7 @@
 			mm_mimepart_attachcontenttype(pstate->current_mimepart, ct);
 		}	
 		pstate->have_contenttype = 0;
-	}
+	;}
     break;
 
   case 10:
@@ -1577,13 +1577,13 @@
 			pstate->ctx->preamble = preamble;
 			dprintf2(pstate,"PREAMBLE:\n%s\n", preamble);
 		}
-	}
+	;}
     break;
 
   case 12:
 #line 191 "mimeparser.y"
     {
-	}
+	;}
     break;
 
   case 16:
@@ -1598,7 +1598,7 @@
 		pstate->temppart = mm_mimepart_new();
 		pstate->current_mimepart = pstate->temppart;
 		pstate->mime_parts++;
-	}
+	;}
     break;
 
   case 18:
@@ -1610,7 +1610,7 @@
 		} else {
 			pstate->ctx->messagetype = MM_MSGTYPE_FLAT;
 		}	
-	}
+	;}
     break;
 
   case 22:
@@ -1624,7 +1624,7 @@
 		} else {
 			/* TODO: attach MM_WARNING_INVHDR */
 		}
-	}
+	;}
     break;
 
   case 23:
@@ -1633,7 +1633,7 @@
 		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:
@@ -1652,7 +1652,7 @@
 		
 		hdr = mm_mimeheader_generate((yyvsp[(1) - (3)].string), xstrdup(""));
 		mm_mimepart_attachheader(pstate->current_mimepart, hdr);
-	}
+	;}
     break;
 
   case 25:
@@ -1662,7 +1662,7 @@
 		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:
@@ -1672,7 +1672,7 @@
 		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:
@@ -1680,7 +1680,7 @@
     {
 		dprintf2(pstate,"Content-Disposition -> %s\n", (yyvsp[(3) - (4)].string));
 		pstate->ctype->disposition_type = xstrdup((yyvsp[(3) - (4)].string));
-	}
+	;}
     break;
 
   case 28:
@@ -1688,7 +1688,7 @@
     {
 		dprintf2(pstate,"Content-Disposition (P) -> %s; params\n", (yyvsp[(3) - (5)].string));
 		pstate->ctype->disposition_type = xstrdup((yyvsp[(3) - (5)].string));
-	}
+	;}
     break;
 
   case 29:
@@ -1711,21 +1711,21 @@
 			/* TODO: attach MM_WARNING_INVHDR */
 		}	
 		(yyval.string) = (yyvsp[(1) - (1)].string);
-	}
+	;}
     break;
 
   case 30:
 #line 332 "mimeparser.y"
     {
 		dprintf2(pstate,"Content-Transfer-Encoding -> %s\n", (yyvsp[(3) - (4)].string));
-	}
+	;}
     break;
 
   case 31:
 #line 339 "mimeparser.y"
     {
 		dprintf2(pstate,"MIME-Version -> '%s'\n", (yyvsp[(3) - (4)].string));
-	}
+	;}
     break;
 
   case 35:
@@ -1734,7 +1734,7 @@
 		char type[255];
 		snprintf(type, sizeof(type), "%s/%s", (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].string));
 		(yyval.string) = type;
-	}
+	;}
     break;
 
   case 38:
@@ -1748,7 +1748,7 @@
 		} else {
 			/* TODO: attach MM_WARNING_INVHDR */
 		}	
-	}
+	;}
     break;
 
   case 41:
@@ -1762,7 +1762,7 @@
 		} else {
 			/* TODO: attach MM_WARNING_INVHDR */
 		}
-	}
+	;}
     break;
 
   case 42:
@@ -1793,7 +1793,7 @@
 		param->value = xstrdup((yyvsp[(3) - (3)].string));
 
 		mm_content_attachtypeparam(pstate->ctype, param);
-	}
+	;}
     break;
 
   case 43:
@@ -1807,7 +1807,7 @@
 
 		mm_content_attachdispositionparam(pstate->ctype, param);
 
-	}
+	;}
     break;
 
   case 44:
@@ -1815,7 +1815,7 @@
     {
 		dprintf2(pstate,"contenttype_param_val: WORD=%s\n", (yyvsp[(1) - (1)].string));
 		(yyval.string) = (yyvsp[(1) - (1)].string);
-	}
+	;}
     break;
 
   case 45:
@@ -1832,7 +1832,7 @@
 			/* TODO: attach MM_WARNING_INVAL */
 		}	
 		(yyval.string) = (yyvsp[(1) - (1)].string);
-	}
+	;}
     break;
 
   case 46:
@@ -1840,14 +1840,14 @@
     {
 		dprintf2(pstate,"contenttype_param_val: \"TSPECIAL\"\n" );
 		(yyval.string) = (yyvsp[(2) - (3)].string);
-	}
+	;}
     break;
 
   case 47:
 #line 475 "mimeparser.y"
     {
 		dprintf2(pstate,"End of headers at line %d\n", pstate->lstate.lineno);
-	}
+	;}
     break;
 
   case 48:
@@ -1866,7 +1866,7 @@
 			return(-1);
 		}
 		dprintf2(pstate,"New MIME part... (%s)\n", (yyvsp[(1) - (2)].string));
-	}
+	;}
     break;
 
   case 49:
@@ -1885,7 +1885,7 @@
 			return(-1);
 		}
 		dprintf2(pstate,"End of MIME message\n");
-	}
+	;}
     break;
 
   case 50:
@@ -1906,7 +1906,7 @@
 		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;
 
 

Modified: team/group/mime/main/minimime/mimeparser.yy.c
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mimeparser.yy.c?view=diff&rev=61304&r1=61303&r2=61304
==============================================================================
--- team/group/mime/main/minimime/mimeparser.yy.c (original)
+++ team/group/mime/main/minimime/mimeparser.yy.c Tue Apr 10 17:05:30 2007
@@ -9,7 +9,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 31
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -31,15 +31,7 @@
 
 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
-#if __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types. 
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
 #include <inttypes.h>
 typedef int8_t flex_int8_t;
 typedef uint8_t flex_uint8_t;
@@ -161,10 +153,6 @@
 #ifndef YY_BUF_SIZE
 #define YY_BUF_SIZE 16384
 #endif
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
 
 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
 #define YY_TYPEDEF_YY_BUFFER_STATE
@@ -630,7 +618,7 @@
 
 #define PREALLOC_BUFFER	100000
 #undef YY_BUF_SIZE
-#define YY_BUF_SIZE 65536
+#define YY_BUF_SIZE 562072
 
 enum header_states
 {
@@ -654,7 +642,7 @@
 
 
 
-#line 658 "mimeparser.yy.c"
+#line 646 "mimeparser.yy.c"
 
 #define INITIAL 0
 #define headers 1
@@ -669,13 +657,11 @@
 #define endboundary 10
 #define endoffile 11
 
-#ifndef YY_NO_UNISTD_H
 /* Special case for "unistd.h", since it is non-ANSI. We include it way
  * down here because we want the user's section 1 to have been scanned first.
  * The user has a chance to override it with an option.
  */
 #include <unistd.h>
-#endif
 
 #ifndef YY_EXTRA_TYPE
 #define YY_EXTRA_TYPE void *
@@ -721,8 +707,6 @@
     YYSTYPE * yylval_r;
 
     }; /* end struct yyguts_t */
-
-static int yy_init_globals (yyscan_t yyscanner );
 
     /* This must go here because YYSTYPE and YYLTYPE are included
      * from bison output in section 1.*/
@@ -868,11 +852,9 @@
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int mimeparser_yylex \
-               (YYSTYPE * yylval_param ,yyscan_t yyscanner);
-
-#define YY_DECL int mimeparser_yylex \
-               (YYSTYPE * yylval_param , yyscan_t yyscanner)
+extern int mimeparser_yylex (YYSTYPE * yylval_param ,yyscan_t yyscanner);
+
+#define YY_DECL int mimeparser_yylex (YYSTYPE * yylval_param , yyscan_t yyscanner)
 #endif /* !YY_DECL */
 
 /* Code executed at the beginning of each rule, after yytext and yyleng
@@ -902,24 +884,23 @@
 	register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 94 "mimeparser.l"
-
-
-#line 909 "mimeparser.yy.c"
+#line 95 "mimeparser.l"
+
+
+#line 891 "mimeparser.yy.c"
 
     yylval = yylval_param;
 
-	if ( !yyg->yy_init )
+	if ( yyg->yy_init )
 		{
-		yyg->yy_init = 1;
+		yyg->yy_init = 0;
 
 #ifdef YY_USER_INIT
 		YY_USER_INIT;
 #endif
 
-        /* Create the reject buffer large enough to save one state per allowed character. */
         if ( ! yyg->yy_state_buf )
-            yyg->yy_state_buf = (yy_state_type *)mimeparser_yyalloc(YY_STATE_BUF_SIZE  ,yyscanner);
+            yyg->yy_state_buf = (yy_state_type *)mimeparser_yyalloc(YY_BUF_SIZE + 2  ,yyscanner);
 
 		if ( ! yyg->yy_start )
 			yyg->yy_start = 1;	/* first start state */
@@ -1012,7 +993,7 @@
 	{ /* beginning of action switch */
 case 1:
 YY_RULE_SETUP
-#line 96 "mimeparser.l"
+#line 97 "mimeparser.l"
 {
 	yylval_param->string=strdup(yytext); 
 	struct lexer_state *lstate = mimeparser_yyget_extra(yyscanner);
@@ -1042,7 +1023,7 @@
 	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 +1034,7 @@
 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 +1059,7 @@
 	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 +1070,7 @@
 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 +1082,7 @@
 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 +1091,7 @@
 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 +1112,7 @@
 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 +1125,7 @@
 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 +1135,7 @@
 	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 +1144,7 @@
 	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 +1154,7 @@
 	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 +1165,7 @@
 	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 +1173,7 @@
 	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 +1184,7 @@
 	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 +1194,7 @@
 	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 +1232,7 @@
 	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 +1278,7 @@
 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 +1287,7 @@
 	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 +1296,14 @@
 	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 +1321,7 @@
 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 +1331,7 @@
 	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 +1341,7 @@
 	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 +1352,7 @@
 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 +1365,7 @@
 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 +1375,7 @@
 	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 +1383,7 @@
 	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 +1392,7 @@
 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 +1402,7 @@
 	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 +1411,10 @@
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 416 "mimeparser.l"
+#line 417 "mimeparser.l"
 ECHO;
 	YY_BREAK
-#line 1437 "mimeparser.yy.c"
+#line 1418 "mimeparser.yy.c"
 			case YY_STATE_EOF(INITIAL):
 			case YY_STATE_EOF(headers):
 			case YY_STATE_EOF(header):
@@ -1630,7 +1611,7 @@
 
 	else
 		{
-			int num_to_read =
+			size_t num_to_read =
 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
 		while ( num_to_read <= 0 )
@@ -1717,7 +1698,7 @@
     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
 {
 	register int yy_is_jam;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
 	register YY_CHAR yy_c = 1;
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
@@ -2168,16 +2149,16 @@
 
 /** Setup the input buffer state to scan a string. The next call to mimeparser_yylex() will
  * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
+ * @param str a NUL-terminated string to scan
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  * @note If you want to scan bytes that may contain NUL values, then use
  *       mimeparser_yy_scan_bytes() instead.
  */
-YY_BUFFER_STATE mimeparser_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
+YY_BUFFER_STATE mimeparser_yy_scan_string (yyconst char * str , yyscan_t yyscanner)
 {
     
-	return mimeparser_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
+	return mimeparser_yy_scan_bytes(str,strlen(str) ,yyscanner);
 }
 
 /** Setup the input buffer state to scan the given bytes. The next call to mimeparser_yylex() will
@@ -2187,7 +2168,7 @@
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE mimeparser_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
+YY_BUFFER_STATE mimeparser_yy_scan_bytes  (yyconst char * bytes, int  len , yyscan_t yyscanner)
 {
 	YY_BUFFER_STATE b;
 	char *buf;
@@ -2195,15 +2176,15 @@
 	int i;
     
 	/* Get memory for full buffer, including space for trailing EOB's. */
-	n = _yybytes_len + 2;
+	n = len + 2;
 	buf = (char *) mimeparser_yyalloc(n ,yyscanner );
 	if ( ! buf )
 		YY_FATAL_ERROR( "out of dynamic memory in mimeparser_yy_scan_bytes()" );
 
-	for ( i = 0; i < _yybytes_len; ++i )
-		buf[i] = yybytes[i];
-
-	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+	for ( i = 0; i < len; ++i )
+		buf[i] = bytes[i];
+
+	buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
 
 	b = mimeparser_yy_scan_buffer(buf,n ,yyscanner);
 	if ( ! b )
@@ -2402,51 +2383,21 @@
     yylval = yylval_param;
 }
 
-/* User-visible API */
-
-/* mimeparser_yylex_init is special because it creates the scanner itself, so it is
- * the ONLY reentrant function that doesn't take the scanner as the last argument.
- * That's why we explicitly handle the declaration, instead of using our macros.
- */
-
-int mimeparser_yylex_init(yyscan_t* ptr_yy_globals)
-
-{
-    if (ptr_yy_globals == NULL){
-        errno = EINVAL;
-        return 1;
-    }
-
-    *ptr_yy_globals = (yyscan_t) mimeparser_yyalloc ( sizeof( struct yyguts_t ), NULL );
-
-    if (*ptr_yy_globals == NULL){
-        errno = ENOMEM;
-        return 1;
-    }
-
-    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
-    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
-    return yy_init_globals ( *ptr_yy_globals );
-}
-
 static int yy_init_globals (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     /* Initialization is the same as for the non-reentrant scanner.
-     * This function is called from mimeparser_yylex_destroy(), so don't allocate here.
-     */
+       This function is called once per scanner lifetime. */
 
     yyg->yy_buffer_stack = 0;
     yyg->yy_buffer_stack_top = 0;
     yyg->yy_buffer_stack_max = 0;
     yyg->yy_c_buf_p = (char *) 0;
-    yyg->yy_init = 0;
+    yyg->yy_init = 1;
     yyg->yy_start = 0;
-
     yyg->yy_start_stack_ptr = 0;
     yyg->yy_start_stack_depth = 0;
-    yyg->yy_start_stack =  NULL;
+    yyg->yy_start_stack = (int *) 0;
 
     yyg->yy_state_buf = 0;
     yyg->yy_state_ptr = 0;
@@ -2468,6 +2419,33 @@
     return 0;
 }
 
+/* User-visible API */
+
+/* mimeparser_yylex_init is special because it creates the scanner itself, so it is
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
+ * That's why we explicitly handle the declaration, instead of using our macros.
+ */
+
+int mimeparser_yylex_init(yyscan_t* ptr_yy_globals)
+
+{
+    if (ptr_yy_globals == NULL){
+        errno = EINVAL;
+        return 1;
+    }
+
+    *ptr_yy_globals = (yyscan_t) mimeparser_yyalloc ( sizeof( struct yyguts_t ), NULL );
+
+    if (*ptr_yy_globals == NULL){
+        errno = ENOMEM;
+        return 1;
+    }
+
+    memset(*ptr_yy_globals,0,sizeof(struct yyguts_t));
+
+    return yy_init_globals ( *ptr_yy_globals );
+}
+
 /* mimeparser_yylex_destroy is for both reentrant and non-reentrant scanners. */
 int mimeparser_yylex_destroy  (yyscan_t yyscanner)
 {
@@ -2489,15 +2467,9 @@
         yyg->yy_start_stack = NULL;
 
     mimeparser_yyfree ( yyg->yy_state_buf , yyscanner);
-    yyg->yy_state_buf  = NULL;
-
-    /* Reset the globals. This is important in a non-reentrant scanner so the next time
-     * mimeparser_yylex() is called, initialization will occur. */
-    yy_init_globals( yyscanner);
 
     /* Destroy the main struct (reentrant only). */
     mimeparser_yyfree ( yyscanner , yyscanner );
-    yyscanner = NULL;
     return 0;
 }
 
@@ -2509,6 +2481,7 @@
 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
 {
 	register int i;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	for ( i = 0; i < n; ++i )
 		s1[i] = s2[i];
 }
@@ -2518,6 +2491,7 @@
 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
 {
 	register int n;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 	for ( n = 0; s[n]; ++n )
 		;
 
@@ -2549,7 +2523,19 @@
 
 #define YYTABLES_NAME "yytables"
 
-#line 416 "mimeparser.l"
+#undef YY_NEW_FILE
+#undef YY_FLUSH_BUFFER
+#undef yy_set_bol
+#undef yy_new_buffer
+#undef yy_set_interactive
+#undef yytext_ptr
+#undef YY_DO_BEFORE_ACTION
+
+#ifdef YY_DECL_IS_OURS
+#undef YY_DECL_IS_OURS
+#undef YY_DECL
+#endif
+#line 417 "mimeparser.l"
 
 
 

Modified: team/group/mime/main/minimime/mytest.c
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mytest.c?view=diff&rev=61304&r1=61303&r2=61304
==============================================================================
--- team/group/mime/main/minimime/mytest.c (original)
+++ team/group/mime/main/minimime/mytest.c Tue Apr 10 17:05:30 2007
@@ -35,7 +35,7 @@
 		}
 	
 		res = mm_context_countparts(ctx);
-		if (res != 3) {
+		if (res != 2) {
 			printf("This file should have 3 parts, but parser says %d\n\n", res);
 			res = -1;
 			mm_context_free(ctx);
@@ -43,7 +43,7 @@
 		}
 	
 		/* Part 2 is the file */
-		if (!(part = mm_context_getpart(ctx, 2))) {
+		if (!(part = mm_context_getpart(ctx, 1))) {
 			printf("Failed to get a reference to part 2 of the MIME data\n\n");
 			res = -1;
 			mm_context_free(ctx);



More information about the asterisk-commits mailing list