aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capinfos.c19
-rw-r--r--cfile.c6
-rw-r--r--editcap.c3
-rw-r--r--epan/wslua/wslua.h4
-rw-r--r--file.c8
-rw-r--r--tshark.c3
-rw-r--r--ui/gtk/summary_dlg.c16
-rw-r--r--ui/qt/capture_file_properties_dialog.cpp6
-rw-r--r--wiretap/merge.c2
9 files changed, 28 insertions, 39 deletions
diff --git a/capinfos.c b/capinfos.c
index f4ea0bb63a..4b8debab94 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -993,34 +993,29 @@ print_stats_table(const gchar *filename, capture_info *cf_info)
char *opt_comment;
for (i = 0; wtap_block_get_nth_string_option_value(cf_info->shb, OPT_COMMENT, i, &opt_comment) == WTAP_OPTTYPE_SUCCESS; i++) {
- if (opt_comment != NULL) {
- putsep();
- putquote();
- printf("%s", opt_comment);
- putquote();
- }
+ putsep();
+ putquote();
+ printf("%s", opt_comment);
+ putquote();
}
}
if (cap_file_more_info) {
char *str;
- if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS &&
- str != NULL) {
+ if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS) {
putsep();
putquote();
printf("%s", str);
putquote();
}
- if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS &&
- str != NULL) {
+ if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS) {
putsep();
putquote();
printf("%s", str);
putquote();
}
- if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS &&
- str != NULL) {
+ if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS) {
putsep();
putquote();
printf("%s", str);
diff --git a/cfile.c b/cfile.c
index 382995e696..ef0f31a8d8 100644
--- a/cfile.c
+++ b/cfile.c
@@ -46,11 +46,9 @@ cap_file_get_interface_name(void *data, guint32 interface_id)
g_free(idb_info);
if (wtapng_if_descr) {
- if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_NAME, &interface_name) == WTAP_OPTTYPE_SUCCESS &&
- interface_name)
+ if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_NAME, &interface_name) == WTAP_OPTTYPE_SUCCESS)
return interface_name;
- if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS &&
- interface_name)
+ if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS)
return interface_name;
}
return "unknown";
diff --git a/editcap.c b/editcap.c
index 52d74f637e..c2fa9c9671 100644
--- a/editcap.c
+++ b/editcap.c
@@ -1379,8 +1379,7 @@ main(int argc, char *argv[])
g_assert(filename);
/* If we don't have an application name add Editcap */
- if (wtap_block_get_string_option_value(g_array_index(shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, &shb_user_appl) != WTAP_OPTTYPE_SUCCESS ||
- shb_user_appl == NULL) {
+ if (wtap_block_get_string_option_value(g_array_index(shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, &shb_user_appl) != WTAP_OPTTYPE_SUCCESS) {
wtap_block_add_string_option_format(g_array_index(shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, "Editcap " VERSION);
}
diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h
index 333c179687..335adbb887 100644
--- a/epan/wslua/wslua.h
+++ b/epan/wslua/wslua.h
@@ -558,7 +558,7 @@ extern int wslua_set__index(lua_State *L);
char* str; \
if ((obj->member) && (obj->member->len > 0)) { \
if (wtap_block_get_string_option_value(g_array_index(obj->member, wtap_block_t, 0), option, &str) == WTAP_OPTTYPE_SUCCESS) { \
- lua_pushstring(L,str); /* this pushes nil if obj->member is null */ \
+ lua_pushstring(L,str); \
} \
} \
})
@@ -572,7 +572,7 @@ extern int wslua_set__index(lua_State *L);
char* str; \
if ((obj->member) && (obj->member->len > 0)) { \
if (wtap_block_get_nth_string_option_value(g_array_index(obj->member, wtap_block_t, 0), option, 0, &str) == WTAP_OPTTYPE_SUCCESS) { \
- lua_pushstring(L,str); /* this pushes nil if obj->member is null */ \
+ lua_pushstring(L,str); \
} \
} \
})
diff --git a/file.c b/file.c
index 73eef29fe8..f1773697be 100644
--- a/file.c
+++ b/file.c
@@ -3866,11 +3866,9 @@ cf_update_capture_comment(capture_file *cf, gchar *comment)
wtap_block_add_string_option(shb_inf, OPT_COMMENT, comment, strlen(comment));
} else {
/* See if the comment has changed or not */
- if (shb_comment) {
- if (strcmp(shb_comment, comment) == 0) {
- g_free(comment);
- return;
- }
+ if (strcmp(shb_comment, comment) == 0) {
+ g_free(comment);
+ return;
}
/* The comment has changed, let's update it */
diff --git a/tshark.c b/tshark.c
index 8fac691195..452e420bb3 100644
--- a/tshark.c
+++ b/tshark.c
@@ -2877,8 +2877,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->wth);
/* If we don't have an application name add Tshark */
- if (wtap_block_get_string_option_value(g_array_index(shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, &shb_user_appl) != WTAP_OPTTYPE_SUCCESS ||
- shb_user_appl == NULL) {
+ if (wtap_block_get_string_option_value(g_array_index(shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, &shb_user_appl) != WTAP_OPTTYPE_SUCCESS) {
/* this is free'd by wtap_block_free() later */
wtap_block_add_string_option_format(g_array_index(shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, "TShark (Wireshark) %s", get_ws_vcs_version_info());
}
diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c
index 78f596c49e..41946ca9ea 100644
--- a/ui/gtk/summary_dlg.c
+++ b/ui/gtk/summary_dlg.c
@@ -296,7 +296,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
/* XXX - this only shows the last comment */
for (i = 0; wtap_block_get_nth_string_option_value(shb_inf, OPT_COMMENT, i, &opt_comment) == WTAP_OPTTYPE_SUCCESS; i++) {
- if (opt_comment != NULL && opt_comment[0] != '\0')
+ if (opt_comment[0] != '\0')
gtk_text_buffer_set_text (buffer, opt_comment, -1);
}
}
@@ -349,20 +349,20 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
char *str;
if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS &&
- str != NULL && str[0] != '\0') {
+ str[0] != '\0') {
g_snprintf(string_buff, SHB_STR_SNIP_LEN, "%s", str);
add_string_to_grid(grid, &row, "Capture HW:",string_buff);
}
if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS &&
- str != NULL && str[0] != '\0') {
+ str[0] != '\0') {
/* truncate the strings to a reasonable length */
g_snprintf(string_buff, SHB_STR_SNIP_LEN, "%s", str);
add_string_to_grid(grid, &row, "OS:", string_buff);
}
if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS &&
- str != NULL && str[0] != '\0') {
+ str[0] != '\0') {
/* truncate the strings to a reasonable length */
g_snprintf(string_buff, SHB_STR_SNIP_LEN, "%s", str);
add_string_to_grid(grid, &row, "Capture application:", string_buff);
@@ -766,19 +766,19 @@ summary_to_texbuff(GtkTextBuffer *buffer)
char *str;
if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS &&
- str != NULL && str[0] != '\0') {
+ str[0] != '\0') {
/* truncate the string to a reasonable length */
g_snprintf(string_buff, SUM_STR_MAX, INDENT "Capture HW: %s\n", str);
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);
}
if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS &&
- str != NULL && str[0] != '\0') {
+ str[0] != '\0') {
/* truncate the strings to a reasonable length */
g_snprintf(string_buff, SUM_STR_MAX, INDENT "OS: %s\n", str);
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);
}
if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS &&
- str != NULL && str[0] != '\0') {
+ str[0] != '\0') {
/* truncate the string to a reasonable length */
g_snprintf(string_buff, SUM_STR_MAX, INDENT "Capture application: %s\n", str);
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);
@@ -902,7 +902,7 @@ summary_to_texbuff(GtkTextBuffer *buffer)
for (i = 0; wtap_block_get_nth_string_option_value(shb_inf, OPT_COMMENT, i, &opt_comment) == WTAP_OPTTYPE_SUCCESS; i++) {
/* XXX - separator between comments? */
- if (opt_comment != NULL && opt_comment[0] != '\0')
+ if (opt_comment[0] != '\0')
gtk_text_buffer_insert_at_cursor(buffer, opt_comment, -1);
}
}
diff --git a/ui/qt/capture_file_properties_dialog.cpp b/ui/qt/capture_file_properties_dialog.cpp
index 60ce9ddcb1..c4b835c6cf 100644
--- a/ui/qt/capture_file_properties_dialog.cpp
+++ b/ui/qt/capture_file_properties_dialog.cpp
@@ -248,7 +248,7 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
if (shb_inf != NULL) {
QString capture_hardware(unknown);
if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS) {
- if (str != NULL && str[0] != '\0') {
+ if (str[0] != '\0') {
capture_hardware = str;
}
}
@@ -260,7 +260,7 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
QString capture_os(unknown);
if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS) {
- if (str != NULL && str[0] != '\0') {
+ if (str[0] != '\0') {
capture_os = str;
}
}
@@ -271,7 +271,7 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
QString capture_app(unknown);
if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS) {
- if (str != NULL && str[0] != '\0') {
+ if (str[0] != '\0') {
capture_app = str;
}
}
diff --git a/wiretap/merge.c b/wiretap/merge.c
index 7df0f2ba7b..85cc1d9d51 100644
--- a/wiretap/merge.c
+++ b/wiretap/merge.c
@@ -387,7 +387,7 @@ create_shb_header(const merge_in_file_t *in_files, const guint in_file_count,
* XXX - fix this to handle multiple comments from a single file.
*/
if (wtap_block_get_nth_string_option_value(shb_hdr, OPT_COMMENT, 0, &shb_comment) == WTAP_OPTTYPE_SUCCESS &&
- shb_comment && strlen(shb_comment) > 0) {
+ strlen(shb_comment) > 0) {
/* very lame way to save comments - does not save them from the other files */
g_string_append_printf(comment_gstr, "%s \n",shb_comment);
}