diff --git a/file.c b/file.c index ffe40991ff..9d178770cd 100644 --- a/file.c +++ b/file.c @@ -3865,8 +3865,13 @@ cf_get_user_packet_comment(capture_file *cf, const frame_data *fd) return NULL; } +/* + * Get the comment on a packet (record). + * If the comment has been edited, it returns the result of the edit, + * otherwise it returns the comment from the file. + */ char * -cf_get_comment(capture_file *cf, const frame_data *fd) +cf_get_packet_comment(capture_file *cf, const frame_data *fd) { char *comment; @@ -3904,10 +3909,13 @@ frame_cmp(gconstpointer a, gconstpointer b, gpointer user_data _U_) 0; } +/* + * Update(replace) the comment on a capture from a frame + */ gboolean cf_set_user_packet_comment(capture_file *cf, frame_data *fd, const gchar *new_comment) { - char *pkt_comment = cf_get_comment(cf, fd); + char *pkt_comment = cf_get_packet_comment(cf, fd); /* Check if the comment has changed */ if (!g_strcmp0(pkt_comment, new_comment)) { diff --git a/file.h b/file.h index 0615fc225c..2a087fc44b 100644 --- a/file.h +++ b/file.h @@ -693,7 +693,15 @@ const gchar* cf_read_section_comment(capture_file *cf); */ void cf_update_section_comment(capture_file *cf, gchar *comment); -char *cf_get_comment(capture_file *cf, const frame_data *fd); +/* + * Get the comment on a packet (record). + * If the comment has been edited, it returns the result of the edit, + * otherwise it returns the comment from the file. + * + * @param cf the capture file + * @param fd the frame_data structure for the frame + */ +char *cf_get_packet_comment(capture_file *cf, const frame_data *fd); /** * Update(replace) the comment on a capture from a frame diff --git a/ui/gtk/packet_list.c b/ui/gtk/packet_list.c index 5adfbb7702..fca31ca2fe 100644 --- a/ui/gtk/packet_list.c +++ b/ui/gtk/packet_list.c @@ -1557,7 +1557,7 @@ packet_list_get_packet_comment(void) fdata = packet_list_get_record(model, &iter); - return cf_get_comment(&cfile, fdata); + return cf_get_packet_comment(&cfile, fdata); } void @@ -1571,7 +1571,7 @@ packet_list_return_all_comments(GtkTextBuffer *buffer) char *pkt_comment; fdata = frame_data_sequence_find(cfile.frames, framenum); - pkt_comment = cf_get_comment(&cfile, fdata); + pkt_comment = cf_get_packet_comment(&cfile, fdata); if (pkt_comment) { buf_str = g_strdup_printf("Frame %u: %s \n\n",framenum, pkt_comment); gtk_text_buffer_insert_at_cursor (buffer, buf_str, -1); @@ -1697,7 +1697,7 @@ query_packet_list_tooltip_cb(GtkWidget *widget, gint x, gint y, gboolean keyboar } fdata = packet_list_get_record(model, &iter); - pkt_comment = cf_get_comment(&cfile, fdata); + pkt_comment = cf_get_packet_comment(&cfile, fdata); if (pkt_comment != NULL) { gtk_tooltip_set_markup(tooltip, pkt_comment); diff --git a/ui/qt/capture_file_properties_dialog.cpp b/ui/qt/capture_file_properties_dialog.cpp index a8e7284008..7d5ae82369 100644 --- a/ui/qt/capture_file_properties_dialog.cpp +++ b/ui/qt/capture_file_properties_dialog.cpp @@ -530,7 +530,7 @@ void CaptureFilePropertiesDialog::fillDetails() for (guint32 framenum = 1; framenum <= cap_file_.capFile()->count ; framenum++) { frame_data *fdata = frame_data_sequence_find(cap_file_.capFile()->frames, framenum); - char *pkt_comment = cf_get_comment(cap_file_.capFile(), fdata); + char *pkt_comment = cf_get_packet_comment(cap_file_.capFile(), fdata); if (pkt_comment) { QString frame_comment_html = tr("

Frame %1: ").arg(framenum); diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index f34044c716..e3e1e145a0 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -1091,7 +1091,7 @@ QString PacketList::packetComment() if (!fdata) return NULL; - pkt_comment = cf_get_comment(cap_file_, fdata); + pkt_comment = cf_get_packet_comment(cap_file_, fdata); return QString(pkt_comment); @@ -1134,7 +1134,7 @@ QString PacketList::allPacketComments() for (framenum = 1; framenum <= cap_file_->count ; framenum++) { fdata = frame_data_sequence_find(cap_file_->frames, framenum); - char *pkt_comment = cf_get_comment(cap_file_, fdata); + char *pkt_comment = cf_get_packet_comment(cap_file_, fdata); if (pkt_comment) { buf_str.append(QString(tr("Frame %1: %2\n\n")).arg(framenum).arg(pkt_comment));