Some (trivial) cppcheck fixes.

This commit is contained in:
Martin Mathieson 2022-01-04 10:48:22 +00:00
parent b7ae71a9c2
commit 10ffdcb3c0
7 changed files with 14 additions and 19 deletions

View File

@ -273,8 +273,7 @@ dissect_cpha(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
if (tree) {
ti = proto_tree_add_item(tree, proto_cphap, tvb, offset, -1, ENC_NA);
cpha_tree = proto_item_add_subtree(ti, ett_cphap);
}
if (tree) {
proto_tree_add_item(cpha_tree, hf_magic_number, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;

View File

@ -331,7 +331,7 @@ static void dissect_msgpack_object(tvbuff_t* tvb, packet_info* pinfo, proto_tree
if (type == 0xc2 || type == 0xc3) {
proto_tree_add_boolean(tree, hf_msgpack_bool, tvb, *offset, 1, type - 0xc2);
if (value)
*value = (type - 0xc2 ? "True" : "False");
*value = (type - 0xc2) ? "True" : "False";
*offset += 1;
return;
}

View File

@ -531,10 +531,7 @@ ncsi_bcd_dig_to_str(tvbuff_t *tvb, const gint offset)
digit_str[str_offset++] = '.';
}
if ((octet >> 4) != 0xf) {
digit_str[str_offset++] = HEXSTR((octet >> 4) & 0x0f);
}
digit_str[str_offset++] = HEXSTR((octet >> 4) & 0x0f);
digit_str[str_offset++] = HEXSTR(octet & 0x0f);
}

View File

@ -1519,7 +1519,7 @@ static void dissect_tlv_list(ptvcursor_t * ptvc, packet_info* pinfo, gint len);
static void dissect_array_value(ptvcursor_t * ptvc, packet_info* pinfo, const char* name, guint32 ett_idx, guint32 count, tlv_decode decode)
{
guint16 i = 0;
guint16 i;
if (count > 0)
{

View File

@ -2780,9 +2780,8 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
if (show) {
ALIGN_ZERO(offset, get_native_type_cdr_alignment(member_kind, encoding_version), offset_zero);
gdouble value = tvb_get_ieee_double(tvb, offset, encoding);
if (show)
proto_tree_add_double_format(tree, hf_rtps_dissection_double, tvb, offset, length, value,
"%s: %.6f", name, value);
proto_tree_add_double_format(tree, hf_rtps_dissection_double, tvb, offset, length, value,
"%s: %.6f", name, value);
}
offset += length;
break;
@ -5205,7 +5204,7 @@ static void rtps_util_add_type_element_enumeration(proto_tree *tree,
proto_tree * enumerated_constant;
guint32 member_id = 0, member_length = 0;
guint32 long_number, i;
gint enum_size, offset_tmp = offset;
gint enum_size, offset_tmp;
offset = rtps_util_add_type_library_type(tree, tvb, offset, encoding, info);
@ -7967,7 +7966,7 @@ static gboolean dissect_parameter_sequence_v1(proto_tree *rtps_parameter_tree, p
* }
*/
case PID_FILTER_SIGNATURE: {
guint32 temp_offset = offset;
guint32 temp_offset;
guint32 prev_offset;
guint32 fs_elem;
guint32 fs[4];
@ -8317,7 +8316,7 @@ static gboolean dissect_parameter_sequence_v2(proto_tree *rtps_parameter_tree, p
* }
*/
case PID_CONTENT_FILTER_INFO: {
guint32 temp_offset = offset;
guint32 temp_offset;
guint32 prev_offset;
guint32 fs_elem;
guint32 fs[4];

View File

@ -798,7 +798,7 @@ static void snort_show_alert(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo
/* Write 6 figures to position after decimal place in timestamp. Must have managed to
parse out fields already, so will definitely be long enough for memcpy() to succeed. */
char digits[7];
snprintf(digits, 7, "%06u", pinfo->abs_ts.nsecs / 1000);
snprintf(digits, 7, "%06d", pinfo->abs_ts.nsecs / 1000);
memcpy(alert->raw_alert+18, digits, 6);
alert->raw_alert_ts_fixed = TRUE;
}

View File

@ -3906,8 +3906,8 @@ dissect_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo,
address_flags_len = tvb_get_guint8 (tvb, offset);
address_len = address_flags_len & ADDRESS_LEN;
address_record_len = address_len
+ (address_flags_len & BEARER_TYPE_INCLUDED ? 1 : 0)
+ (address_flags_len & PORT_NUMBER_INCLUDED ? 2 : 0)
+ ((address_flags_len & BEARER_TYPE_INCLUDED) ? 1 : 0)
+ ((address_flags_len & PORT_NUMBER_INCLUDED) ? 2 : 0)
;
ti = proto_tree_add_uint(addresses_tree, hf_address_entry,
@ -4082,8 +4082,8 @@ add_addresses(proto_tree *tree, tvbuff_t *tvb, int hf)
address_flags_len = tvb_get_guint8 (tvb, offset);
address_len = address_flags_len & ADDRESS_LEN;
address_record_len = address_len
+ (address_flags_len & BEARER_TYPE_INCLUDED ? 1 : 0)
+ (address_flags_len & PORT_NUMBER_INCLUDED ? 2 : 0)
+ ((address_flags_len & BEARER_TYPE_INCLUDED) ? 1 : 0)
+ ((address_flags_len & PORT_NUMBER_INCLUDED) ? 2 : 0)
;
ti = proto_tree_add_uint(addresses_tree, hf_address_entry,