diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-06-16 00:20:00 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-06-16 00:20:00 +0000 |
commit | 8c9edf12800bc6d68894dc457e7ebaf994429da8 (patch) | |
tree | ec6efefbd4e7f8227a7b96661f721ff4ba2986c3 /ui/gtk/packet_list_store.c | |
parent | 3846abe34d6861c6ee0bba61fcd5baa4d213885c (diff) | |
download | wireshark-8c9edf12800bc6d68894dc457e7ebaf994429da8.tar.gz |
Have the seek-read routines take a Buffer rather than a guint8 pointer
as the "where to put the packet data" argument.
This lets more of the libwiretap code be common between the read and
seek-read code paths, and also allows for more flexibility in the "fill
in the data" path - we can expand the buffer as needed in both cases.
svn path=/trunk/; revision=49949
Diffstat (limited to 'ui/gtk/packet_list_store.c')
-rw-r--r-- | ui/gtk/packet_list_store.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ui/gtk/packet_list_store.c b/ui/gtk/packet_list_store.c index 800965ee17..10249971c4 100644 --- a/ui/gtk/packet_list_store.c +++ b/ui/gtk/packet_list_store.c @@ -1140,7 +1140,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord * gint col; gboolean create_proto_tree; struct wtap_pkthdr phdr; /* Packet header */ - guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */ + Buffer buf; /* Packet data */ g_return_if_fail(packet_list); g_return_if_fail(PACKETLIST_IS_LIST(packet_list)); @@ -1160,7 +1160,8 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord * else cinfo = NULL; - if (!cf_read_frame_r(&cfile, fdata, &phdr, pd)) { + buffer_init(&buf, 1500); + if (!cf_read_frame_r(&cfile, fdata, &phdr, &buf)) { /* * Error reading the frame. * @@ -1182,6 +1183,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord * fdata->color_filter = NULL; record->colorized = TRUE; } + buffer_free(&buf); return; /* error reading the frame */ } @@ -1201,7 +1203,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord * * XXX - need to catch an OutOfMemoryError exception and * attempt to recover from it. */ - epan_dissect_run(&edt, &phdr, pd, fdata, cinfo); + epan_dissect_run(&edt, &phdr, buffer_start_ptr(&buf), fdata, cinfo); if (dissect_color) fdata->color_filter = color_filters_colorize_packet(&edt); @@ -1220,6 +1222,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord * record->colorized = TRUE; epan_dissect_cleanup(&edt); + buffer_free(&buf); } void |