Rename cf_get_comment() to reflect what comment it gets.

Change-Id: Id3b0430a1d462b29833259462536ed4cb0424f77
Reviewed-on: https://code.wireshark.org/review/22662
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2017-07-16 20:49:01 -07:00
parent cdc01b89bf
commit 4dd48721ee
5 changed files with 25 additions and 9 deletions

12
file.c
View File

@ -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)) {

10
file.h
View File

@ -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

View File

@ -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);

View File

@ -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("<p>Frame %1: ").arg(framenum);

View File

@ -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));