aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-07-16 20:37:32 -0700
committerGuy Harris <guy@alum.mit.edu>2017-07-17 03:38:45 +0000
commitcdc01b89bf07a5df072d6d0410c4920f857feab7 (patch)
tree2a2b255c851a2cfa48a1f10b22599a191af15b45
parentf3181f706b39955a4f4bc26f1d6d75166a67c235 (diff)
Rename section comment get/set routines.
Rename cf_read_shb_comment() to cf_read_section_comment(); an SHB is a record type in a particular capture file format (pcapng), and not all files that have per-file or per-file-section comments have something called a Section Header Block. Rename cf_update_capture_comment() to cf_update_section_comment(); pcapng, at least, supports multiple sections, although we don't curently support that. This also gives them matching names. Change-Id: Idd8cb0f0fd9125b9626411274aebfb1ec0097665 Reviewed-on: https://code.wireshark.org/review/22659 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--file.c12
-rw-r--r--file.h6
-rw-r--r--ui/gtk/edit_packet_comment_dlg.c4
-rw-r--r--ui/gtk/main_statusbar.c2
-rw-r--r--ui/gtk/summary_dlg.c2
-rw-r--r--ui/qt/capture_file_properties_dialog.cpp6
6 files changed, 18 insertions, 14 deletions
diff --git a/file.c b/file.c
index 628bdef674..ffe40991ff 100644
--- a/file.c
+++ b/file.c
@@ -3804,11 +3804,10 @@ cf_unignore_frame(capture_file *cf, frame_data *frame)
}
/*
- * Read the comment in SHB block
+ * Read the section comment.
*/
-
const gchar *
-cf_read_shb_comment(capture_file *cf)
+cf_read_section_comment(capture_file *cf)
{
wtap_block_t shb_inf;
char *shb_comment;
@@ -3824,8 +3823,11 @@ cf_read_shb_comment(capture_file *cf)
return shb_comment;
}
+/*
+ * Modify the section comment.
+ */
void
-cf_update_capture_comment(capture_file *cf, gchar *comment)
+cf_update_section_comment(capture_file *cf, gchar *comment)
{
wtap_block_t shb_inf;
gchar *shb_comment;
@@ -3943,7 +3945,7 @@ cf_comment_types(capture_file *cf)
{
guint32 comment_types = 0;
- if (cf_read_shb_comment(cf) != NULL)
+ if (cf_read_section_comment(cf) != NULL)
comment_types |= WTAP_COMMENT_PER_SECTION;
if (cf->packet_comment_count != 0)
comment_types |= WTAP_COMMENT_PER_PACKET;
diff --git a/file.h b/file.h
index 20e9282b30..0615fc225c 100644
--- a/file.h
+++ b/file.h
@@ -678,18 +678,20 @@ cf_merge_files_to_tempfile(gpointer pd_window, char **out_filenamep,
/**
* Get the comment on a capture from the SHB data block
+ * XXX - should support multiple sections.
*
* @param cf the capture file
*/
-const gchar* cf_read_shb_comment(capture_file *cf);
+const gchar* cf_read_section_comment(capture_file *cf);
/**
* Update(replace) the comment on a capture from the SHB data block
+ * XXX - should support multiple sections.
*
* @param cf the capture file
* @param comment the string replacing the old comment
*/
-void cf_update_capture_comment(capture_file *cf, gchar *comment);
+void cf_update_section_comment(capture_file *cf, gchar *comment);
char *cf_get_comment(capture_file *cf, const frame_data *fd);
diff --git a/ui/gtk/edit_packet_comment_dlg.c b/ui/gtk/edit_packet_comment_dlg.c
index fb315e3513..95caa6cc83 100644
--- a/ui/gtk/edit_packet_comment_dlg.c
+++ b/ui/gtk/edit_packet_comment_dlg.c
@@ -80,7 +80,7 @@ capture_comment_text_buff_ok_cb(GtkWidget *w _U_, GtkWidget *view)
new_capture_comment = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE /* whether to include invisible text */);
/*g_warning("The new comment is '%s'",new_capture_comment);*/
- cf_update_capture_comment(&cfile, new_capture_comment);
+ cf_update_section_comment(&cfile, new_capture_comment);
/* Update the main window as appropriate */
main_update_for_unsaved_changes(&cfile);
@@ -209,7 +209,7 @@ edit_capture_comment_dlg_launch (GtkAction *action _U_, gpointer data _U_)
gtk_box_pack_start(GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
/* Get the comment */
- comment_str = cf_read_shb_comment(&cfile);
+ comment_str = cf_read_section_comment(&cfile);
if(comment_str != NULL){
gtk_text_buffer_set_text (buffer, comment_str, -1);
}
diff --git a/ui/gtk/main_statusbar.c b/ui/gtk/main_statusbar.c
index 53a36c7a16..4974a25e83 100644
--- a/ui/gtk/main_statusbar.c
+++ b/ui/gtk/main_statusbar.c
@@ -721,7 +721,7 @@ status_capture_comment_update(void)
status_capture_comment_hide(FALSE);
- comment_str = cf_read_shb_comment(&cfile);
+ comment_str = cf_read_section_comment(&cfile);
/* *comment_str==0x0 -> comment exists, but it's empty */
if(comment_str!=NULL && *comment_str!=0x0){
diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c
index e219f6648f..0dbe3a1e93 100644
--- a/ui/gtk/summary_dlg.c
+++ b/ui/gtk/summary_dlg.c
@@ -141,7 +141,7 @@ summary_ok_cb(GtkWidget *w _U_, GtkWidget *view)
new_comment = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE /* whether to include invisible text */);
- cf_update_capture_comment(&cfile, new_comment);
+ cf_update_section_comment(&cfile, new_comment);
/* Update the main window */
main_update_for_unsaved_changes(&cfile);
diff --git a/ui/qt/capture_file_properties_dialog.cpp b/ui/qt/capture_file_properties_dialog.cpp
index 1f18bdf6a1..a8e7284008 100644
--- a/ui/qt/capture_file_properties_dialog.cpp
+++ b/ui/qt/capture_file_properties_dialog.cpp
@@ -107,7 +107,7 @@ void CaptureFilePropertiesDialog::updateWidgets()
ui->commentsTextEdit->setEnabled(enable);
fillDetails();
- ui->commentsTextEdit->setText(cf_read_shb_comment(cap_file_.capFile()));
+ ui->commentsTextEdit->setText(cf_read_section_comment(cap_file_.capFile()));
WiresharkDialog::updateWidgets();
}
@@ -512,7 +512,7 @@ void CaptureFilePropertiesDialog::fillDetails()
cursor.insertHtml(summary);
cursor.insertBlock(); // Work around rendering oddity.
- QString file_comments = cf_read_shb_comment(cap_file_.capFile());
+ QString file_comments = cf_read_section_comment(cap_file_.capFile());
if (!file_comments.isEmpty()) {
QString file_comments_html;
@@ -577,7 +577,7 @@ void CaptureFilePropertiesDialog::on_buttonBox_accepted()
if (wtap_dump_can_write(cap_file_.capFile()->linktypes, WTAP_COMMENT_PER_SECTION))
{
gchar *str = qstring_strdup(ui->commentsTextEdit->toPlainText());
- cf_update_capture_comment(cap_file_.capFile(), str);
+ cf_update_section_comment(cap_file_.capFile(), str);
emit captureCommentChanged();
fillDetails();
}