Ethereal-dev: [Ethereal-dev] "Match Selected" FT_STRING patch

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ed Warnicke <hagbard@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Dec 2000 00:49:38 -0500 (EST)
Here is a patch to enable the "Match Selected" functionality to 
work for fields of type FT_STRING.  I'd appreciate someone more familiar
with this part of the code ( gtk/main.c: match_selected_cb() )
would give it a once over and then check it in.

Ed
Index: gtk/main.c
===================================================================
RCS file: /cvsroot/ethereal/gtk/main.c,v
retrieving revision 1.167
diff -u -r1.167 main.c
--- main.c	2000/12/03 22:12:21	1.167
+++ main.c	2000/12/15 05:44:55
@@ -251,15 +251,20 @@
 				sizeof(struct timeval));
 			break;
 
-		case FT_STRING:
-			/* This g_strdup'ed memory is freed in proto_tree_free_node() */
-			fi->value.string = g_strdup(va_arg(ap, char*));
-			break;
-
 		case FT_TEXT_ONLY:
 			; /* nothing */
 			break;
 #endif
+
+		case FT_STRING:
+		        dfilter_len = abbrev_len + 
+			  strlen(finfo_selected->value.string) + 7;
+			buf = g_malloc0(dfilter_len);
+			snprintf(buf, dfilter_len, "%s == \"%s\"",
+				 hfinfo->abbrev,
+				 finfo_selected->value.string);
+			break;
+
 		default:
 		    c = cfile.pd + finfo_selected->start;
 		    buf = g_malloc0(32 + finfo_selected->length * 3);