gimp r24722 - in trunk: . plug-ins/imagemap



Author: kcozens
Date: Sun Jan 27 16:13:51 2008
New Revision: 24722
URL: http://svn.gnome.org/viewvc/gimp?rev=24722&view=rev

Log:
2008-01-27  Kevin Cozens  <kcozens cvs gnome org>

	* plug-ins/imagemap/imap_cern.l:
	* plug-ins/imagemap/imap_cern.y: 
	* plug-ins/imagemap/imap_csim.l:
	* plug-ins/imagemap/imap_csim.y:
	* plug-ins/imagemap/imap_ncsa.l:
	* plug-ins/imagemap/imap_ncsa.y: Dynamically allocate space to hold
	comments, links, strings, and co-ordinate lists. Fixes bug #511072.

	* plug-ins/imagemap/imap_cern_lex.c:
	* plug-ins/imagemap/imap_cern_parse.c:
	* plug-ins/imagemap/imap_cern_parse.h:
	* plug-ins/imagemap/imap_csim_lex.c:
	* plug-ins/imagemap/imap_csim_parse.c:
	* plug-ins/imagemap/imap_csim_parse.h:
	* plug-ins/imagemap/imap_ncsa_lex.c:
	* plug-ins/imagemap/imap_ncsa_parse.c:
	* plug-ins/imagemap/imap_ncsa_parse.h: Regenerated.


Modified:
   trunk/ChangeLog
   trunk/plug-ins/imagemap/imap_cern.l
   trunk/plug-ins/imagemap/imap_cern.y
   trunk/plug-ins/imagemap/imap_cern_lex.c
   trunk/plug-ins/imagemap/imap_cern_parse.c
   trunk/plug-ins/imagemap/imap_cern_parse.h
   trunk/plug-ins/imagemap/imap_csim.l
   trunk/plug-ins/imagemap/imap_csim.y
   trunk/plug-ins/imagemap/imap_csim_lex.c
   trunk/plug-ins/imagemap/imap_csim_parse.c
   trunk/plug-ins/imagemap/imap_csim_parse.h
   trunk/plug-ins/imagemap/imap_ncsa.l
   trunk/plug-ins/imagemap/imap_ncsa.y
   trunk/plug-ins/imagemap/imap_ncsa_lex.c
   trunk/plug-ins/imagemap/imap_ncsa_parse.c
   trunk/plug-ins/imagemap/imap_ncsa_parse.h

Modified: trunk/plug-ins/imagemap/imap_cern.l
==============================================================================
--- trunk/plug-ins/imagemap/imap_cern.l	(original)
+++ trunk/plug-ins/imagemap/imap_cern.l	Sun Jan 27 16:13:51 2008
@@ -61,7 +61,7 @@
 
 <comment>.*$	 		{
 				   BEGIN(INITIAL);
-   				   strcpy(cern_lval.id, yytext);
+   				   cern_lval.id = g_strndup (yytext, yyleng);
    				   return COMMENT;
 				}
 
@@ -74,7 +74,7 @@
 DEFAULT				return DEFAULT;
 
 [^ ,\t\n]+$			{
-   				   strcpy(cern_lval.id, yytext);
+   				   cern_lval.id = g_strndup (yytext, yyleng);
 				   return LINK;
 				}
 

Modified: trunk/plug-ins/imagemap/imap_cern.y
==============================================================================
--- trunk/plug-ins/imagemap/imap_cern.y	(original)
+++ trunk/plug-ins/imagemap/imap_cern.y	Sun Jan 27 16:13:51 2008
@@ -47,7 +47,7 @@
 %union {
    int val;
    double value;
-   char id[256];
+   char *id;
 }
 
 %token<val> RECTANGLE POLYGON CIRCLE DEFAULT
@@ -75,6 +75,7 @@
 		{
 		   MapInfo_t *info = get_map_info();
 		   g_strreplace(&info->default_url, $2);
+                   g_free ($2);
 		}
 		;
 
@@ -88,6 +89,7 @@
 		   current_object = create_rectangle(x, y, width, height);
 		   object_set_url(current_object, $12);
 		   add_shape(current_object);
+                   g_free ($12);
 		}
 		;
 
@@ -99,6 +101,7 @@
 		   current_object = create_circle(x, y, r);
 		   object_set_url(current_object, $8);
 		   add_shape(current_object);
+                   g_free ($8);
 		}
 		;
 
@@ -106,6 +109,7 @@
 		{
 		   object_set_url(current_object, $4);
 		   add_shape(current_object);
+                   g_free ($4);
 		}
 		;
 
@@ -131,6 +135,7 @@
 
 real_comment	: BEGIN_COMMENT COMMENT
 		{
+		  g_free ($2);
 		}
 		;
 
@@ -138,7 +143,7 @@
 		{
 		   MapInfo_t *info = get_map_info();
 		   g_strreplace(&info->author, $2);
-
+		   g_free ($2);
 		}
 		;
 
@@ -150,6 +155,7 @@
 		   description = g_strconcat(info->description, $2, "\n", 
 					     NULL);
 		   g_strreplace(&info->description, description);
+		   g_free ($2);
 		}
 		;
 

Modified: trunk/plug-ins/imagemap/imap_cern_lex.c
==============================================================================
--- trunk/plug-ins/imagemap/imap_cern_lex.c	(original)
+++ trunk/plug-ins/imagemap/imap_cern_lex.c	Sun Jan 27 16:13:51 2008
@@ -5,6 +5,25 @@
 
 /* A lexical scanner generated by flex */
 
+#define yy_create_buffer cern__create_buffer
+#define yy_delete_buffer cern__delete_buffer
+#define yy_flex_debug cern__flex_debug
+#define yy_init_buffer cern__init_buffer
+#define yy_flush_buffer cern__flush_buffer
+#define yy_load_buffer_state cern__load_buffer_state
+#define yy_switch_to_buffer cern__switch_to_buffer
+#define yyin cern_in
+#define yyleng cern_leng
+#define yylex cern_lex
+#define yylineno cern_lineno
+#define yyout cern_out
+#define yyrestart cern_restart
+#define yytext cern_text
+#define yywrap cern_wrap
+#define yyalloc cern_alloc
+#define yyrealloc cern_realloc
+#define yyfree cern_free
+
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
@@ -335,7 +354,7 @@
 
 /* Begin user sect3 */
 
-#define cern_wrap() 1
+#define cern_wrap(n) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
@@ -570,7 +589,7 @@
 #endif /* FLEX_SCANNER */
 
 
-#line 574 "<stdout>"
+#line 593 "<stdout>"
 
 #define INITIAL 0
 #define comment 1
@@ -727,7 +746,7 @@
 #line 45 "imap_cern.l"
 
 
-#line 731 "<stdout>"
+#line 750 "<stdout>"
 
 	if ( !(yy_init) )
 		{
@@ -845,7 +864,7 @@
 #line 62 "imap_cern.l"
 {
 				   BEGIN(INITIAL);
-   				   strcpy(cern_lval.id, cern_text);
+   				   cern_lval.id = g_strndup (cern_text, cern_leng);
    				   return COMMENT;
 				}
 	YY_BREAK
@@ -876,7 +895,7 @@
 YY_RULE_SETUP
 #line 76 "imap_cern.l"
 {
-   				   strcpy(cern_lval.id, cern_text);
+   				   cern_lval.id = g_strndup (cern_text, cern_leng);
 				   return LINK;
 				}
 	YY_BREAK
@@ -904,7 +923,7 @@
 #line 90 "imap_cern.l"
 ECHO;
 	YY_BREAK
-#line 908 "<stdout>"
+#line 927 "<stdout>"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(comment):
 	yyterminate();
@@ -1136,7 +1155,7 @@
 
 		/* Read in more data. */
 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-			(yy_n_chars), (size_t) num_to_read );
+			(yy_n_chars), num_to_read );
 
 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 		}
@@ -1637,7 +1656,7 @@
 
 /** Setup the input buffer state to scan a string. The next call to cern_lex() 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
  * 
  * @return the newly allocated buffer state object.
  * @note If you want to scan bytes that may contain NUL values, then use

Modified: trunk/plug-ins/imagemap/imap_cern_parse.c
==============================================================================
--- trunk/plug-ins/imagemap/imap_cern_parse.c	(original)
+++ trunk/plug-ins/imagemap/imap_cern_parse.c	Sun Jan 27 16:13:51 2008
@@ -173,7 +173,7 @@
 {
    int val;
    double value;
-   char id[256];
+   char *id;
 }
 /* Line 187 of yacc.c.  */
 #line 180 "y.tab.c"
@@ -481,8 +481,8 @@
 static const yytype_uint8 yyrline[] =
 {
        0,    60,    60,    63,    64,    67,    68,    69,    70,    71,
-      74,    82,    94,   105,   105,   112,   113,   118,   127,   128,
-     129,   132,   137,   145
+      74,    83,    96,   108,   108,   116,   117,   122,   131,   132,
+     133,   136,   142,   150
 };
 #endif
 
@@ -1414,11 +1414,12 @@
     {
 		   MapInfo_t *info = get_map_info();
 		   g_strreplace(&info->default_url, (yyvsp[(2) - (2)].id));
+                   g_free ((yyvsp[(2) - (2)].id));
 		}
     break;
 
   case 11:
-#line 83 "imap_cern.y"
+#line 84 "imap_cern.y"
     {
 		   gint x = (gint) (yyvsp[(3) - (12)].value);
 		   gint y = (gint) (yyvsp[(5) - (12)].value);
@@ -1427,11 +1428,12 @@
 		   current_object = create_rectangle(x, y, width, height);
 		   object_set_url(current_object, (yyvsp[(12) - (12)].id));
 		   add_shape(current_object);
+                   g_free ((yyvsp[(12) - (12)].id));
 		}
     break;
 
   case 12:
-#line 95 "imap_cern.y"
+#line 97 "imap_cern.y"
     {
 		   gint x = (gint) (yyvsp[(3) - (8)].value);
 		   gint y = (gint) (yyvsp[(5) - (8)].value);
@@ -1439,30 +1441,32 @@
 		   current_object = create_circle(x, y, r);
 		   object_set_url(current_object, (yyvsp[(8) - (8)].id));
 		   add_shape(current_object);
+                   g_free ((yyvsp[(8) - (8)].id));
 		}
     break;
 
   case 13:
-#line 105 "imap_cern.y"
+#line 108 "imap_cern.y"
     {current_object = create_polygon(NULL);}
     break;
 
   case 14:
-#line 106 "imap_cern.y"
+#line 109 "imap_cern.y"
     {
 		   object_set_url(current_object, (yyvsp[(4) - (4)].id));
 		   add_shape(current_object);
+                   g_free ((yyvsp[(4) - (4)].id));
 		}
     break;
 
   case 16:
-#line 114 "imap_cern.y"
+#line 118 "imap_cern.y"
     {
 		}
     break;
 
   case 17:
-#line 119 "imap_cern.y"
+#line 123 "imap_cern.y"
     {
 		   Polygon_t *polygon = ObjectToPolygon(current_object);
 		   GdkPoint *point = new_point((gint) (yyvsp[(2) - (5)].value), (gint) (yyvsp[(4) - (5)].value));
@@ -1472,22 +1476,23 @@
     break;
 
   case 21:
-#line 133 "imap_cern.y"
+#line 137 "imap_cern.y"
     {
+		  g_free ((yyvsp[(2) - (2)].id));
 		}
     break;
 
   case 22:
-#line 138 "imap_cern.y"
+#line 143 "imap_cern.y"
     {
 		   MapInfo_t *info = get_map_info();
 		   g_strreplace(&info->author, (yyvsp[(2) - (2)].id));
-
+		   g_free ((yyvsp[(2) - (2)].id));
 		}
     break;
 
   case 23:
-#line 146 "imap_cern.y"
+#line 151 "imap_cern.y"
     {
 		   MapInfo_t *info = get_map_info();
 		   gchar *description;
@@ -1495,12 +1500,13 @@
 		   description = g_strconcat(info->description, (yyvsp[(2) - (2)].id), "\n", 
 					     NULL);
 		   g_strreplace(&info->description, description);
+		   g_free ((yyvsp[(2) - (2)].id));
 		}
     break;
 
 
 /* Line 1267 of yacc.c.  */
-#line 1504 "y.tab.c"
+#line 1510 "y.tab.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1714,7 +1720,7 @@
 }
 
 
-#line 157 "imap_cern.y"
+#line 163 "imap_cern.y"
 
 
 static void 

Modified: trunk/plug-ins/imagemap/imap_cern_parse.h
==============================================================================
--- trunk/plug-ins/imagemap/imap_cern_parse.h	(original)
+++ trunk/plug-ins/imagemap/imap_cern_parse.h	Sun Jan 27 16:13:51 2008
@@ -72,7 +72,7 @@
 {
    int val;
    double value;
-   char id[256];
+   char *id;
 }
 /* Line 1489 of yacc.c.  */
 #line 79 "y.tab.h"

Modified: trunk/plug-ins/imagemap/imap_csim.l
==============================================================================
--- trunk/plug-ins/imagemap/imap_csim.l	(original)
+++ trunk/plug-ins/imagemap/imap_csim.l	Sun Jan 27 16:13:51 2008
@@ -66,8 +66,7 @@
 			        }
 
 <comment>.*/--\> 		{
-   				   strcpy(csim_lval.id, yytext);
-				   csim_lval.id[yyleng - 1] = '\0';
+				   csim_lval.id = g_strndup (yytext, yyleng);
    				   return STRING;
 				}
 
@@ -113,7 +112,6 @@
 
 \"				{
 				   BEGIN(quoted_string);
-				   *csim_lval.id = 0;
 				}
 
 <quoted_string>\"		{
@@ -121,7 +119,9 @@
 				   return STRING;
 				}
 
-<quoted_string>[^\"]*		strcpy(csim_lval.id, yytext);
+<quoted_string>[^\"]*		{
+				  csim_lval.id = g_strndup (yytext, yyleng);
+				}
 
 -?{DIGIT}*"."?{DIGIT}*([Ee][-+]?{DIGIT}*)? {
                                    csim_lval.value = g_ascii_strtod (yytext, NULL);

Modified: trunk/plug-ins/imagemap/imap_csim.y
==============================================================================
--- trunk/plug-ins/imagemap/imap_csim.y	(original)
+++ trunk/plug-ins/imagemap/imap_csim.y	Sun Jan 27 16:13:51 2008
@@ -49,7 +49,7 @@
 %union {
   int val;
   double value;
-  char id[4096];		/* Large enough to hold all polygon points! */
+  char *id;
 }
 
 %token<val> IMG SRC WIDTH HEIGHT BORDER USEMAP
@@ -69,6 +69,7 @@
 image		: '<' IMG SRC '=' STRING image_tags xhtml_close
 		{
 		   g_strreplace(&_map_info->image_name, $5);
+		   g_free ($5);
 		}
 		;
 
@@ -79,8 +80,8 @@
 image_tag	: image_width
 		| image_height
 		| BORDER '=' integer_value {}
-		| USEMAP '=' STRING {}
-		| ALT '=' STRING {}
+		| USEMAP '=' STRING { g_free ($3); }
+		| ALT '=' STRING { g_free ($3); }
 		;
 
 image_width	: WIDTH '=' integer_value
@@ -102,12 +103,14 @@
 		| STRING
 		{
 		  $$ = (gint) g_ascii_strtod ($1, NULL);
+		  g_free ($1);
 		}
 		;
 
 start_map	: '<' START_MAP NAME '=' STRING '>'
 		{
 		   g_strreplace(&_map_info->title, $5);
+		   g_free ($5);
 		}
 		;
 
@@ -122,13 +125,14 @@
 
 real_comment	: BEGIN_COMMENT STRING END_COMMENT
 		{
+		  g_free ($2);
 		}
 		;
 
 author_line	: AUTHOR STRING END_COMMENT
 		{
 		   g_strreplace(&_map_info->author, $2);
-
+		   g_free ($2);
 		}
 		;
 
@@ -139,6 +143,7 @@
 		   description = g_strconcat(_map_info->description, $2, "\n",
 					     NULL);
 		   g_strreplace(&_map_info->description, description);
+		   g_free ($2);
 		}
 		;
 
@@ -187,6 +192,7 @@
 		   } else if (!g_ascii_strcasecmp($3, "DEFAULT")) {
 		      current_type = UNDEFINED;
 		   }
+		   g_free ($3);
 		}
 		;
 
@@ -245,6 +251,8 @@
 			 polygon_remove_last_point(polygon);
 		      polygon->points = points;
 		   }
+
+		   g_free ($3);
 		}
 		;
 
@@ -255,6 +263,7 @@
 		   } else {
 		      object_set_url(current_object, $3);
 		   }
+		   g_free ($3);
 		}
 		;
 
@@ -266,42 +275,49 @@
 optional_value	: /* Empty */
 		| '=' STRING
 		{
+		   g_free ($2);
 		}
 		;
 
 alt_tag		: ALT '=' STRING
 		{
 		   object_set_comment(current_object, $3);
+		   g_free ($3);
 		}
 		;
 
 target_tag	: TARGET '=' STRING
 		{
 		   object_set_target(current_object, $3);
+		   g_free ($3);
 		}
 		;
 
 onmouseover_tag	: ONMOUSEOVER '=' STRING
 		{
 		   object_set_mouse_over(current_object, $3);
+		   g_free ($3);
 		}
 		;
 
 onmouseout_tag	: ONMOUSEOUT '=' STRING
 		{
 		   object_set_mouse_out(current_object, $3);
+		   g_free ($3);
 		}
 		;
 
 onfocus_tag	: ONFOCUS '=' STRING
 		{
 		   object_set_focus(current_object, $3);
+		   g_free ($3);
 		}
 		;
 
 onblur_tag	: ONBLUR '=' STRING
 		{
 		   object_set_blur(current_object, $3);
+		   g_free ($3);
 		}
 		;
 

Modified: trunk/plug-ins/imagemap/imap_csim_lex.c
==============================================================================
--- trunk/plug-ins/imagemap/imap_csim_lex.c	(original)
+++ trunk/plug-ins/imagemap/imap_csim_lex.c	Sun Jan 27 16:13:51 2008
@@ -5,6 +5,25 @@
 
 /* A lexical scanner generated by flex */
 
+#define yy_create_buffer csim__create_buffer
+#define yy_delete_buffer csim__delete_buffer
+#define yy_flex_debug csim__flex_debug
+#define yy_init_buffer csim__init_buffer
+#define yy_flush_buffer csim__flush_buffer
+#define yy_load_buffer_state csim__load_buffer_state
+#define yy_switch_to_buffer csim__switch_to_buffer
+#define yyin csim_in
+#define yyleng csim_leng
+#define yylex csim_lex
+#define yylineno csim_lineno
+#define yyout csim_out
+#define yyrestart csim_restart
+#define yytext csim_text
+#define yywrap csim_wrap
+#define yyalloc csim_alloc
+#define yyrealloc csim_realloc
+#define yyfree csim_free
+
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
@@ -335,7 +354,7 @@
 
 /* Begin user sect3 */
 
-#define csim_wrap() 1
+#define csim_wrap(n) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
@@ -589,7 +608,7 @@
 
 
 
-#line 593 "<stdout>"
+#line 612 "<stdout>"
 
 #define INITIAL 0
 #define quoted_string 1
@@ -747,7 +766,7 @@
 #line 46 "imap_csim.l"
 
 
-#line 751 "<stdout>"
+#line 770 "<stdout>"
 
 	if ( !(yy_init) )
 		{
@@ -869,122 +888,120 @@
 YY_RULE_SETUP
 #line 68 "imap_csim.l"
 {
-   				   strcpy(csim_lval.id, csim_text);
-				   csim_lval.id[csim_leng - 1] = '\0';
+				   csim_lval.id = g_strndup (csim_text, csim_leng);
    				   return STRING;
 				}
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 74 "imap_csim.l"
+#line 73 "imap_csim.l"
 return IMG;
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 76 "imap_csim.l"
+#line 75 "imap_csim.l"
 return SRC;
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 78 "imap_csim.l"
+#line 77 "imap_csim.l"
 return WIDTH;
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 80 "imap_csim.l"
+#line 79 "imap_csim.l"
 return HEIGHT;
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 82 "imap_csim.l"
+#line 81 "imap_csim.l"
 return BORDER;
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 84 "imap_csim.l"
+#line 83 "imap_csim.l"
 return USEMAP;
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 86 "imap_csim.l"
+#line 85 "imap_csim.l"
 return START_MAP;
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 88 "imap_csim.l"
+#line 87 "imap_csim.l"
 return END_MAP;
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 90 "imap_csim.l"
+#line 89 "imap_csim.l"
 return NAME;
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 92 "imap_csim.l"
+#line 91 "imap_csim.l"
 return AREA;
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 94 "imap_csim.l"
+#line 93 "imap_csim.l"
 return SHAPE;
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 96 "imap_csim.l"
+#line 95 "imap_csim.l"
 return COORDS;
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 98 "imap_csim.l"
+#line 97 "imap_csim.l"
 return TARGET;
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 100 "imap_csim.l"
+#line 99 "imap_csim.l"
 return ONMOUSEOVER;
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 102 "imap_csim.l"
+#line 101 "imap_csim.l"
 return ONMOUSEOUT;
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 104 "imap_csim.l"
+#line 103 "imap_csim.l"
 return ONFOCUS;
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 106 "imap_csim.l"
+#line 105 "imap_csim.l"
 return ONBLUR;
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 108 "imap_csim.l"
+#line 107 "imap_csim.l"
 return ALT;
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 110 "imap_csim.l"
+#line 109 "imap_csim.l"
 return HREF;
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 112 "imap_csim.l"
+#line 111 "imap_csim.l"
 return NOHREF;
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 114 "imap_csim.l"
+#line 113 "imap_csim.l"
 {
 				   BEGIN(quoted_string);
-				   *csim_lval.id = 0;
 				}
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 119 "imap_csim.l"
+#line 117 "imap_csim.l"
 {
 				   BEGIN(INITIAL);
 				   return STRING;
@@ -993,8 +1010,10 @@
 case 28:
 /* rule 28 can match eol */
 YY_RULE_SETUP
-#line 124 "imap_csim.l"
-strcpy(csim_lval.id, csim_text);
+#line 122 "imap_csim.l"
+{
+				  csim_lval.id = g_strndup (csim_text, csim_leng);
+				}
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
@@ -1020,7 +1039,7 @@
 #line 135 "imap_csim.l"
 ECHO;
 	YY_BREAK
-#line 1024 "<stdout>"
+#line 1043 "<stdout>"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(quoted_string):
 case YY_STATE_EOF(comment):
@@ -1253,7 +1272,7 @@
 
 		/* Read in more data. */
 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-			(yy_n_chars), (size_t) num_to_read );
+			(yy_n_chars), num_to_read );
 
 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 		}
@@ -1754,7 +1773,7 @@
 
 /** Setup the input buffer state to scan a string. The next call to csim_lex() 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
  * 
  * @return the newly allocated buffer state object.
  * @note If you want to scan bytes that may contain NUL values, then use

Modified: trunk/plug-ins/imagemap/imap_csim_parse.c
==============================================================================
--- trunk/plug-ins/imagemap/imap_csim_parse.c	(original)
+++ trunk/plug-ins/imagemap/imap_csim_parse.c	Sun Jan 27 16:13:51 2008
@@ -207,7 +207,7 @@
 {
   int val;
   double value;
-  char id[4096];		/* Large enough to hold all polygon points! */
+  char *id;
 }
 /* Line 187 of yacc.c.  */
 #line 214 "y.tab.c"
@@ -528,12 +528,12 @@
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,    66,    66,    69,    75,    76,    79,    80,    81,    82,
-      83,    86,    92,    98,   102,   108,   114,   115,   118,   119,
-     120,   123,   128,   135,   145,   146,   149,   156,   157,   160,
-     161,   164,   165,   166,   167,   168,   169,   170,   171,   172,
-     173,   176,   193,   251,   261,   266,   267,   272,   278,   284,
-     290,   296,   302,   308
+       0,    66,    66,    69,    76,    77,    80,    81,    82,    83,
+      84,    87,    93,    99,   103,   110,   117,   118,   121,   122,
+     123,   126,   132,   139,   150,   151,   154,   161,   162,   165,
+     166,   169,   170,   171,   172,   173,   174,   175,   176,   177,
+     178,   181,   199,   259,   270,   275,   276,   282,   289,   296,
+     303,   310,   317,   324
 };
 #endif
 
@@ -1508,86 +1508,91 @@
 #line 70 "imap_csim.y"
     {
 		   g_strreplace(&_map_info->image_name, (yyvsp[(5) - (7)].id));
+		   g_free ((yyvsp[(5) - (7)].id));
 		}
     break;
 
   case 8:
-#line 81 "imap_csim.y"
+#line 82 "imap_csim.y"
     {}
     break;
 
   case 9:
-#line 82 "imap_csim.y"
-    {}
+#line 83 "imap_csim.y"
+    { g_free ((yyvsp[(3) - (3)].id)); }
     break;
 
   case 10:
-#line 83 "imap_csim.y"
-    {}
+#line 84 "imap_csim.y"
+    { g_free ((yyvsp[(3) - (3)].id)); }
     break;
 
   case 11:
-#line 87 "imap_csim.y"
+#line 88 "imap_csim.y"
     {
 		   _map_info->old_image_width = (yyvsp[(3) - (3)].val);
 		}
     break;
 
   case 12:
-#line 93 "imap_csim.y"
+#line 94 "imap_csim.y"
     {
 		   _map_info->old_image_height = (yyvsp[(3) - (3)].val);
 		}
     break;
 
   case 13:
-#line 99 "imap_csim.y"
+#line 100 "imap_csim.y"
     {
 		  (yyval.val) = (gint) (yyvsp[(1) - (1)].value);
 		}
     break;
 
   case 14:
-#line 103 "imap_csim.y"
+#line 104 "imap_csim.y"
     {
 		  (yyval.val) = (gint) g_ascii_strtod ((yyvsp[(1) - (1)].id), NULL);
+		  g_free ((yyvsp[(1) - (1)].id));
 		}
     break;
 
   case 15:
-#line 109 "imap_csim.y"
+#line 111 "imap_csim.y"
     {
 		   g_strreplace(&_map_info->title, (yyvsp[(5) - (6)].id));
+		   g_free ((yyvsp[(5) - (6)].id));
 		}
     break;
 
   case 21:
-#line 124 "imap_csim.y"
+#line 127 "imap_csim.y"
     {
+		  g_free ((yyvsp[(2) - (3)].id));
 		}
     break;
 
   case 22:
-#line 129 "imap_csim.y"
+#line 133 "imap_csim.y"
     {
 		   g_strreplace(&_map_info->author, (yyvsp[(2) - (3)].id));
-
+		   g_free ((yyvsp[(2) - (3)].id));
 		}
     break;
 
   case 23:
-#line 136 "imap_csim.y"
+#line 140 "imap_csim.y"
     {
 		   gchar *description;
 
 		   description = g_strconcat(_map_info->description, (yyvsp[(2) - (3)].id), "\n",
 					     NULL);
 		   g_strreplace(&_map_info->description, description);
+		   g_free ((yyvsp[(2) - (3)].id));
 		}
     break;
 
   case 26:
-#line 150 "imap_csim.y"
+#line 155 "imap_csim.y"
     {
 		   if (current_type != UNDEFINED)
 		      add_shape(current_object);
@@ -1595,7 +1600,7 @@
     break;
 
   case 41:
-#line 177 "imap_csim.y"
+#line 182 "imap_csim.y"
     {
 		   if (!g_ascii_strcasecmp((yyvsp[(3) - (3)].id), "RECT")) {
 		      current_object = create_rectangle(0, 0, 0, 0);
@@ -1609,11 +1614,12 @@
 		   } else if (!g_ascii_strcasecmp((yyvsp[(3) - (3)].id), "DEFAULT")) {
 		      current_type = UNDEFINED;
 		   }
+		   g_free ((yyvsp[(3) - (3)].id));
 		}
     break;
 
   case 42:
-#line 194 "imap_csim.y"
+#line 200 "imap_csim.y"
     {
 		   char *p;
 		   if (current_type == RECTANGLE) {
@@ -1668,77 +1674,87 @@
 			 polygon_remove_last_point(polygon);
 		      polygon->points = points;
 		   }
+
+		   g_free ((yyvsp[(3) - (3)].id));
 		}
     break;
 
   case 43:
-#line 252 "imap_csim.y"
+#line 260 "imap_csim.y"
     {
 		   if (current_type == UNDEFINED) {
 		      g_strreplace(&_map_info->default_url, (yyvsp[(3) - (3)].id));
 		   } else {
 		      object_set_url(current_object, (yyvsp[(3) - (3)].id));
 		   }
+		   g_free ((yyvsp[(3) - (3)].id));
 		}
     break;
 
   case 44:
-#line 262 "imap_csim.y"
+#line 271 "imap_csim.y"
     {
 		}
     break;
 
   case 46:
-#line 268 "imap_csim.y"
+#line 277 "imap_csim.y"
     {
+		   g_free ((yyvsp[(2) - (2)].id));
 		}
     break;
 
   case 47:
-#line 273 "imap_csim.y"
+#line 283 "imap_csim.y"
     {
 		   object_set_comment(current_object, (yyvsp[(3) - (3)].id));
+		   g_free ((yyvsp[(3) - (3)].id));
 		}
     break;
 
   case 48:
-#line 279 "imap_csim.y"
+#line 290 "imap_csim.y"
     {
 		   object_set_target(current_object, (yyvsp[(3) - (3)].id));
+		   g_free ((yyvsp[(3) - (3)].id));
 		}
     break;
 
   case 49:
-#line 285 "imap_csim.y"
+#line 297 "imap_csim.y"
     {
 		   object_set_mouse_over(current_object, (yyvsp[(3) - (3)].id));
+		   g_free ((yyvsp[(3) - (3)].id));
 		}
     break;
 
   case 50:
-#line 291 "imap_csim.y"
+#line 304 "imap_csim.y"
     {
 		   object_set_mouse_out(current_object, (yyvsp[(3) - (3)].id));
+		   g_free ((yyvsp[(3) - (3)].id));
 		}
     break;
 
   case 51:
-#line 297 "imap_csim.y"
+#line 311 "imap_csim.y"
     {
 		   object_set_focus(current_object, (yyvsp[(3) - (3)].id));
+		   g_free ((yyvsp[(3) - (3)].id));
 		}
     break;
 
   case 52:
-#line 303 "imap_csim.y"
+#line 318 "imap_csim.y"
     {
 		   object_set_blur(current_object, (yyvsp[(3) - (3)].id));
+		   g_free ((yyvsp[(3) - (3)].id));
 		}
     break;
 
 
 /* Line 1267 of yacc.c.  */
-#line 1742 "y.tab.c"
+#line 1758 "y.tab.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1952,7 +1968,7 @@
 }
 
 
-#line 311 "imap_csim.y"
+#line 327 "imap_csim.y"
 
 
 static void

Modified: trunk/plug-ins/imagemap/imap_csim_parse.h
==============================================================================
--- trunk/plug-ins/imagemap/imap_csim_parse.h	(original)
+++ trunk/plug-ins/imagemap/imap_csim_parse.h	Sun Jan 27 16:13:51 2008
@@ -104,7 +104,7 @@
 {
   int val;
   double value;
-  char id[4096];		/* Large enough to hold all polygon points! */
+  char *id;
 }
 /* Line 1489 of yacc.c.  */
 #line 111 "y.tab.h"

Modified: trunk/plug-ins/imagemap/imap_ncsa.l
==============================================================================
--- trunk/plug-ins/imagemap/imap_ncsa.l	(original)
+++ trunk/plug-ins/imagemap/imap_ncsa.l	Sun Jan 27 16:13:51 2008
@@ -67,7 +67,7 @@
 
 <comment>.*	 		{
 				   BEGIN(INITIAL);
-   				   strcpy(ncsa_lval.id, yytext);
+   				   ncsa_lval.id = g_strndup (yytext, yyleng);
    				   return COMMENT;
 				}
 
@@ -93,8 +93,7 @@
 
 <imap_link>[^ ,\t\n]+		{
    				   BEGIN(INITIAL);
-   				   strcpy(ncsa_lval.id, yytext);
-				   ncsa_lval.id[yyleng - 1] = '\0';
+   				   ncsa_lval.id = g_strndup (yytext, yyleng);
 				   return LINK;
 				}
 

Modified: trunk/plug-ins/imagemap/imap_ncsa.y
==============================================================================
--- trunk/plug-ins/imagemap/imap_ncsa.y	(original)
+++ trunk/plug-ins/imagemap/imap_ncsa.y	Sun Jan 27 16:13:51 2008
@@ -46,7 +46,7 @@
 %union {
    int val;
    double value;
-   char id[256];
+   char *id;
 }
 
 %token<val> RECTANGLE POLYGON CIRCLE DEFAULT
@@ -71,6 +71,7 @@
 
 real_comment	: BEGIN_COMMENT COMMENT
 		{
+		   g_free ($2);
 		}
 		;
 
@@ -78,6 +79,7 @@
 		{
 		   MapInfo_t *info = get_map_info();
 		   g_strreplace(&info->author, $2);
+		   g_free ($2);
 		}
 		;
 
@@ -85,6 +87,7 @@
 		{
 		   MapInfo_t *info = get_map_info();
 		   g_strreplace(&info->title, $2);
+		   g_free ($2);
 		}
 		;
 
@@ -96,6 +99,7 @@
 		   description = g_strconcat(info->description, $2, "\n", 
 					     NULL);
 		   g_strreplace(&info->description, description);
+		   g_free ($2);
 		}
 		;
 
@@ -114,6 +118,7 @@
 		{
 		   MapInfo_t *info = get_map_info();		      
 		   g_strreplace(&info->default_url, $2);
+		   g_free ($2);
 		}
 		;
 
@@ -127,6 +132,7 @@
 		   current_object = create_rectangle(x, y, width, height);
 		   object_set_url(current_object, $2);
 		   add_shape(current_object);
+		   g_free ($2);
 		}
 		;
 
@@ -138,6 +144,7 @@
 		   current_object = create_circle(x, y, r);
 		   object_set_url(current_object, $2);
 		   add_shape(current_object);
+		   g_free ($2);
 		}
 		;
 
@@ -145,6 +152,7 @@
 		{
 		   object_set_url(current_object, $2);
 		   add_shape(current_object);
+		   g_free ($2);
 		}
 		;
 

Modified: trunk/plug-ins/imagemap/imap_ncsa_lex.c
==============================================================================
--- trunk/plug-ins/imagemap/imap_ncsa_lex.c	(original)
+++ trunk/plug-ins/imagemap/imap_ncsa_lex.c	Sun Jan 27 16:13:51 2008
@@ -5,6 +5,25 @@
 
 /* A lexical scanner generated by flex */
 
+#define yy_create_buffer ncsa__create_buffer
+#define yy_delete_buffer ncsa__delete_buffer
+#define yy_flex_debug ncsa__flex_debug
+#define yy_init_buffer ncsa__init_buffer
+#define yy_flush_buffer ncsa__flush_buffer
+#define yy_load_buffer_state ncsa__load_buffer_state
+#define yy_switch_to_buffer ncsa__switch_to_buffer
+#define yyin ncsa_in
+#define yyleng ncsa_leng
+#define yylex ncsa_lex
+#define yylineno ncsa_lineno
+#define yyout ncsa_out
+#define yyrestart ncsa_restart
+#define yytext ncsa_text
+#define yywrap ncsa_wrap
+#define yyalloc ncsa_alloc
+#define yyrealloc ncsa_realloc
+#define yyfree ncsa_free
+
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
@@ -335,7 +354,7 @@
 
 /* Begin user sect3 */
 
-#define ncsa_wrap() 1
+#define ncsa_wrap(n) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
@@ -541,7 +560,7 @@
 
 
 
-#line 545 "<stdout>"
+#line 564 "<stdout>"
 
 #define INITIAL 0
 #define imap_link 1
@@ -699,7 +718,7 @@
 #line 46 "imap_ncsa.l"
 
 
-#line 703 "<stdout>"
+#line 722 "<stdout>"
 
 	if ( !(yy_init) )
 		{
@@ -819,7 +838,7 @@
 #line 68 "imap_ncsa.l"
 {
 				   BEGIN(INITIAL);
-   				   strcpy(ncsa_lval.id, ncsa_text);
+   				   ncsa_lval.id = g_strndup (ncsa_text, ncsa_leng);
    				   return COMMENT;
 				}
 	YY_BREAK
@@ -860,14 +879,13 @@
 #line 94 "imap_ncsa.l"
 {
    				   BEGIN(INITIAL);
-   				   strcpy(ncsa_lval.id, ncsa_text);
-				   ncsa_lval.id[ncsa_leng - 1] = '\0';
+   				   ncsa_lval.id = g_strndup (ncsa_text, ncsa_leng);
 				   return LINK;
 				}
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 101 "imap_ncsa.l"
+#line 100 "imap_ncsa.l"
 {
                                    ncsa_lval.value = g_ascii_strtod (ncsa_text, NULL);
 				   return FLOAT;
@@ -876,20 +894,20 @@
 case 12:
 /* rule 12 can match eol */
 YY_RULE_SETUP
-#line 106 "imap_ncsa.l"
+#line 105 "imap_ncsa.l"
 ; /* Eat white space */
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 108 "imap_ncsa.l"
+#line 107 "imap_ncsa.l"
 return *ncsa_text;
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 110 "imap_ncsa.l"
+#line 109 "imap_ncsa.l"
 ECHO;
 	YY_BREAK
-#line 893 "<stdout>"
+#line 911 "<stdout>"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(imap_link):
 case YY_STATE_EOF(comment):
@@ -1122,7 +1140,7 @@
 
 		/* Read in more data. */
 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-			(yy_n_chars), (size_t) num_to_read );
+			(yy_n_chars), num_to_read );
 
 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 		}
@@ -1623,7 +1641,7 @@
 
 /** Setup the input buffer state to scan a string. The next call to ncsa_lex() 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
  * 
  * @return the newly allocated buffer state object.
  * @note If you want to scan bytes that may contain NUL values, then use
@@ -1877,7 +1895,7 @@
 
 #define YYTABLES_NAME "yytables"
 
-#line 110 "imap_ncsa.l"
+#line 109 "imap_ncsa.l"
 
 
 

Modified: trunk/plug-ins/imagemap/imap_ncsa_parse.c
==============================================================================
--- trunk/plug-ins/imagemap/imap_ncsa_parse.c	(original)
+++ trunk/plug-ins/imagemap/imap_ncsa_parse.c	Sun Jan 27 16:13:51 2008
@@ -174,7 +174,7 @@
 {
    int val;
    double value;
-   char id[256];
+   char *id;
 }
 /* Line 187 of yacc.c.  */
 #line 181 "y.tab.c"
@@ -482,8 +482,8 @@
 static const yytype_uint8 yyrline[] =
 {
        0,    59,    59,    62,    63,    66,    67,    68,    69,    72,
-      77,    84,    91,   102,   103,   106,   107,   108,   109,   110,
-     113,   121,   133,   144,   144,   151,   152,   157
+      78,    86,    94,   106,   107,   110,   111,   112,   113,   114,
+     117,   126,   139,   151,   151,   159,   160,   165
 };
 #endif
 
@@ -1411,27 +1411,30 @@
         case 9:
 #line 73 "imap_ncsa.y"
     {
+		   g_free ((yyvsp[(2) - (2)].id));
 		}
     break;
 
   case 10:
-#line 78 "imap_ncsa.y"
+#line 79 "imap_ncsa.y"
     {
 		   MapInfo_t *info = get_map_info();
 		   g_strreplace(&info->author, (yyvsp[(2) - (2)].id));
+		   g_free ((yyvsp[(2) - (2)].id));
 		}
     break;
 
   case 11:
-#line 85 "imap_ncsa.y"
+#line 87 "imap_ncsa.y"
     {
 		   MapInfo_t *info = get_map_info();
 		   g_strreplace(&info->title, (yyvsp[(2) - (2)].id));
+		   g_free ((yyvsp[(2) - (2)].id));
 		}
     break;
 
   case 12:
-#line 92 "imap_ncsa.y"
+#line 95 "imap_ncsa.y"
     {
 		   MapInfo_t *info = get_map_info();
 		   gchar *description;
@@ -1439,19 +1442,21 @@
 		   description = g_strconcat(info->description, (yyvsp[(2) - (2)].id), "\n", 
 					     NULL);
 		   g_strreplace(&info->description, description);
+		   g_free ((yyvsp[(2) - (2)].id));
 		}
     break;
 
   case 20:
-#line 114 "imap_ncsa.y"
+#line 118 "imap_ncsa.y"
     {
 		   MapInfo_t *info = get_map_info();		      
 		   g_strreplace(&info->default_url, (yyvsp[(2) - (2)].id));
+		   g_free ((yyvsp[(2) - (2)].id));
 		}
     break;
 
   case 21:
-#line 122 "imap_ncsa.y"
+#line 127 "imap_ncsa.y"
     {
 		   gint x = (gint) (yyvsp[(3) - (8)].value);
 		   gint y = (gint) (yyvsp[(5) - (8)].value);
@@ -1460,11 +1465,12 @@
 		   current_object = create_rectangle(x, y, width, height);
 		   object_set_url(current_object, (yyvsp[(2) - (8)].id));
 		   add_shape(current_object);
+		   g_free ((yyvsp[(2) - (8)].id));
 		}
     break;
 
   case 22:
-#line 134 "imap_ncsa.y"
+#line 140 "imap_ncsa.y"
     {
 		   gint x = (gint) (yyvsp[(3) - (8)].value);
 		   gint y = (gint) (yyvsp[(5) - (8)].value);
@@ -1472,30 +1478,32 @@
 		   current_object = create_circle(x, y, r);
 		   object_set_url(current_object, (yyvsp[(2) - (8)].id));
 		   add_shape(current_object);
+		   g_free ((yyvsp[(2) - (8)].id));
 		}
     break;
 
   case 23:
-#line 144 "imap_ncsa.y"
+#line 151 "imap_ncsa.y"
     {current_object = create_polygon(NULL);}
     break;
 
   case 24:
-#line 145 "imap_ncsa.y"
+#line 152 "imap_ncsa.y"
     {
 		   object_set_url(current_object, (yyvsp[(2) - (4)].id));
 		   add_shape(current_object);
+		   g_free ((yyvsp[(2) - (4)].id));
 		}
     break;
 
   case 26:
-#line 153 "imap_ncsa.y"
+#line 161 "imap_ncsa.y"
     {
 		}
     break;
 
   case 27:
-#line 158 "imap_ncsa.y"
+#line 166 "imap_ncsa.y"
     {
 		   Polygon_t *polygon = ObjectToPolygon(current_object);
 		   GdkPoint *point = new_point((gint) (yyvsp[(1) - (3)].value), (gint) (yyvsp[(3) - (3)].value));
@@ -1506,7 +1514,7 @@
 
 
 /* Line 1267 of yacc.c.  */
-#line 1510 "y.tab.c"
+#line 1518 "y.tab.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1720,7 +1728,7 @@
 }
 
 
-#line 166 "imap_ncsa.y"
+#line 174 "imap_ncsa.y"
 
 
 static void 

Modified: trunk/plug-ins/imagemap/imap_ncsa_parse.h
==============================================================================
--- trunk/plug-ins/imagemap/imap_ncsa_parse.h	(original)
+++ trunk/plug-ins/imagemap/imap_ncsa_parse.h	Sun Jan 27 16:13:51 2008
@@ -74,7 +74,7 @@
 {
    int val;
    double value;
-   char id[256];
+   char *id;
 }
 /* Line 1489 of yacc.c.  */
 #line 81 "y.tab.h"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]