From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 18:22:43 +0000 (+0100) Subject: wireshark/ceph/packet-ceph.c: fix some issues from cppcheck X-Git-Tag: v0.58~66^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=533fd7a8c8e4b4887f1bca777dc789d580f34c63;p=ceph.git wireshark/ceph/packet-ceph.c: fix some issues from cppcheck Fix some smaller performance related issues from cppcheck due to "Variable '..xy..' is reassigned a value before the old one has been used. Fix some indention. Signed-off-by: Danny Al-Gaaf --- diff --git a/wireshark/ceph/packet-ceph.c b/wireshark/ceph/packet-ceph.c index 2a4e31fad3f6..4379fda0fe0b 100644 --- a/wireshark/ceph/packet-ceph.c +++ b/wireshark/ceph/packet-ceph.c @@ -486,7 +486,7 @@ void proto_register_ceph (void) static guint32 dissect_sockaddr_in(tvbuff_t *tvb, proto_tree *tree, guint32 offset) { - proto_tree *ceph_sockaddr_tree = NULL; + proto_tree *ceph_sockaddr_tree; proto_item *ceph_sub_item = NULL; proto_item *ceph_item = proto_tree_get_parent(tree); @@ -581,11 +581,11 @@ static guint32 dissect_ceph_footer(tvbuff_t *tvb, proto_tree *tree, guint32 offs static guint32 dissect_ceph_client_connect(tvbuff_t *tvb, proto_tree *tree, guint32 offset) { - proto_tree *ceph_header_tree = NULL; + proto_tree *ceph_header_tree; proto_item *ceph_sub_item = NULL; proto_item *ceph_item = proto_tree_get_parent(tree); struct ceph_msg_connect *msg; - guint32 auth_len = 0; + guint32 auth_len; offset = dissect_ceph_banner(tvb, tree, offset); @@ -623,7 +623,7 @@ static guint32 dissect_ceph_client_connect(tvbuff_t *tvb, proto_tree *tree, guin static guint32 dissect_ceph_server_connect(tvbuff_t *tvb, proto_tree *tree, guint32 offset) { - proto_tree *ceph_header_tree = NULL; + proto_tree *ceph_header_tree; proto_item *ceph_sub_item = NULL; proto_item *ceph_item = proto_tree_get_parent(tree); struct ceph_msg_connect_reply *msg; @@ -1093,7 +1093,7 @@ static guint32 dissect_ceph_front(tvbuff_t *tvb, packet_info *pinfo, proto_tree static guint32 dissect_ceph_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset) { - proto_tree *ceph_header_tree = NULL; + proto_tree *ceph_header_tree; proto_item *ceph_sub_item = NULL; proto_item *ceph_item = proto_tree_get_parent(tree); guint32 front_len, middle_len, data_len; @@ -1103,12 +1103,12 @@ static guint32 dissect_ceph_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tre guint16 type; guint64 seq; struct ceph_msg_header *header; - unsigned int data_crc = 0; + unsigned int data_crc = 0; - tag = tvb_get_guint8(tvb, offset); - hlen = ( tag == CEPH_MSGR_TAG_ACK ) ? ACK_MSG_SIZE:0; - hlen += sizeof(struct ceph_msg_header); - hlen++; + tag = tvb_get_guint8(tvb, offset); + hlen = ( tag == CEPH_MSGR_TAG_ACK ) ? ACK_MSG_SIZE:0; + hlen += sizeof(struct ceph_msg_header); + hlen++; ceph_header_tree = proto_item_add_subtree(ceph_item, ett_ceph);