diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-07-16 20:37:32 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-07-17 03:38:57 +0000 |
commit | c8f45f5be221983745eaa05f10ecdd35f006c2bd (patch) | |
tree | 19c67d69ef6fbb729454ee6a7dbf73d9929c8617 | |
parent | 065d0e7793400e7beb21d6b9c28d2a4245ea0a72 (diff) | |
download | wireshark-c8f45f5be221983745eaa05f10ecdd35f006c2bd.tar.gz wireshark-c8f45f5be221983745eaa05f10ecdd35f006c2bd.tar.bz2 wireshark-c8f45f5be221983745eaa05f10ecdd35f006c2bd.zip |
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>
(cherry picked from commit cdc01b89bf07a5df072d6d0410c4920f857feab7)
Reviewed-on: https://code.wireshark.org/review/22660
-rw-r--r-- | file.c | 12 | ||||
-rw-r--r-- | file.h | 6 | ||||
-rw-r--r-- | ui/gtk/edit_packet_comment_dlg.c | 4 | ||||
-rw-r--r-- | ui/gtk/main_statusbar.c | 2 | ||||
-rw-r--r-- | ui/gtk/summary_dlg.c | 2 | ||||
-rw-r--r-- | ui/qt/capture_file_properties_dialog.cpp | 6 |
6 files changed, 18 insertions, 14 deletions
@@ -3803,11 +3803,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; @@ -3823,8 +3822,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; @@ -3942,7 +3944,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; @@ -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(); } |