Misc minor issues caught by cppcheck

All trivial (unused variables, duplicate `break`s, etc).

Change-Id: Idbfffae4f6c0b0119a90ae5849de2ed7a1180c9b
Reviewed-on: https://code.wireshark.org/review/11886
Petri-Dish: Evan Huus <eapache@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
Evan Huus 2015-11-16 16:02:43 -05:00
parent 9a7973770e
commit c3025544b6
8 changed files with 4 additions and 11 deletions

View File

@ -816,7 +816,6 @@ free_airpcap_interface_list(GList *if_list)
{
g_list_foreach(if_list, free_airpcap_if_cb, NULL);
g_list_free(if_list);
if_list = NULL;
}
/*
@ -1138,7 +1137,6 @@ airpcap_if_info_free(airpcap_if_info_t *if_info)
if (if_info != NULL)
{
g_free(if_info);
if_info = NULL;
}
}
}

View File

@ -246,7 +246,6 @@ INT AirPDcapCcmpDecrypt(
while (space >= AES_BLOCK_LEN) {
CCMP_DECRYPT(i, b, b0, pos, a, AES_BLOCK_LEN);
pos += AES_BLOCK_LEN, space -= AES_BLOCK_LEN;
data_len -= AES_BLOCK_LEN;
i++;
}

View File

@ -268,7 +268,7 @@ DIAG_ON(cast-qual)
}
exit(1);
}
DEBUG_PRINT("file_type_subtype is %u\n", wtap_file_type_subtype(wth));
DEBUG_PRINT("file_type_subtype is %d\n", wtap_file_type_subtype(wth));
shb_hdr = wtap_file_get_shb_for_new_file(wth);
idb_inf = wtap_file_get_idb_info(wth);

View File

@ -48,7 +48,7 @@ read_language_pref(gchar *key, const gchar *value,
if (strcmp(key, LANGUAGE_PREF_LANGUAGE) == 0) {
if (language)
g_free(language);
if (!value || (value && !*value))
if (!value || !*value)
language = g_strdup("auto");
else
language = g_strdup(value);

View File

@ -182,7 +182,6 @@ static void print_file(const char *file_name, HDC hdc, int width, int height)
#define Y_OFFSET 5
FILE* fh1;
size_t results;
int cnt=0, y_pos = Y_OFFSET, y_cnt = 0;
char buf[MAX_BUF_SIZE];
char ch;
@ -204,7 +203,7 @@ static void print_file(const char *file_name, HDC hdc, int width, int height)
return;
}
while ((results = fread(&ch, 1, 1, fh1)) != 0) {
while (fread(&ch, 1, 1, fh1) != 0) {
/* end of page (form feed)? */
if (ch == 0x0c) {
/* send buffer */

View File

@ -92,7 +92,7 @@ static gboolean esc_read(FILE_T fh, guint8 *buf, int len, int *err, gchar **err_
/* Magic text to check for eyesdn-ness of file */
static const unsigned char eyesdn_hdr_magic[] =
{ 'E', 'y', 'e', 'S', 'D', 'N'};
#define EYESDN_HDR_MAGIC_SIZE (sizeof(eyesdn_hdr_magic) / sizeof(eyesdn_hdr_magic[0]))
#define EYESDN_HDR_MAGIC_SIZE sizeof(eyesdn_hdr_magic)
/* Size of a record header */
#define EYESDN_HDR_LENGTH 12

View File

@ -2381,7 +2381,6 @@ ng_read_bytes_or_eof(wtap *wth, void *buffer, unsigned int nbytes, gboolean is_r
ngsniffer_t *ngsniffer;
FILE_T infile;
ngsniffer_comp_stream_t *comp_stream;
gint64 copied_bytes = 0; /* bytes already copied */
unsigned char *outbuffer = (unsigned char *)buffer; /* where to write next decompressed data */
blob_info_t *blob;
unsigned int bytes_to_copy;
@ -2477,7 +2476,6 @@ ng_read_bytes_or_eof(wtap *wth, void *buffer, unsigned int nbytes, gboolean is_r
memcpy(outbuffer, &comp_stream->buf[comp_stream->nextout],
bytes_to_copy);
nbytes -= bytes_to_copy;
copied_bytes += bytes_to_copy;
outbuffer += bytes_to_copy;
comp_stream->nextout += bytes_to_copy;
comp_stream->uncomp_offset += bytes_to_copy;

View File

@ -1909,7 +1909,6 @@ read_options:
pcapng_debug("pcapng_read_name_resolution_block: opt_comment length %u seems strange", oh.option_length);
}
break;
break;
default:
#ifdef HAVE_PLUGINS
/*