From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O3QFE-0003jN-Mb for qemu-devel@nongnu.org; Sun, 18 Apr 2010 04:52:48 -0400 Received: from [140.186.70.92] (port=37221 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3QFC-0003hE-O1 for qemu-devel@nongnu.org; Sun, 18 Apr 2010 04:52:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O3QFB-00063O-3X for qemu-devel@nongnu.org; Sun, 18 Apr 2010 04:52:46 -0400 Received: from mail-pv0-f173.google.com ([74.125.83.173]:52263) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O3QFA-00063D-V6 for qemu-devel@nongnu.org; Sun, 18 Apr 2010 04:52:45 -0400 Received: by pvd12 with SMTP id 12so2340860pvd.4 for ; Sun, 18 Apr 2010 01:52:43 -0700 (PDT) MIME-Version: 1.0 Date: Sun, 18 Apr 2010 11:52:43 +0300 Message-ID: From: Blue Swirl Content-Type: text/plain; charset=UTF-8 Subject: [Qemu-devel] [RFC, PATCH 2/2] bt-sdp: Fix if statement with empty body, spotted by clang List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrzej Zaborowski , qemu-devel Fix clang error: CC bt-sdp.o /src/qemu/hw/bt-sdp.c:174:17: error: if statement has empty body [-Wempty-body] if (len > 1); However, fixing this means that some code that was previously ignored by the compiler now gets compiled, resulting in this error: CC bt-sdp.o cc1: warnings being treated as errors /src/qemu/hw/bt-sdp.c: In function 'sdp_svc_search': /src/qemu/hw/bt-sdp.c:184: error: 'max' may be used uninitialized in this function I could not figure out how to calculate max, so I just invented some figure to suppress the error. Signed-off-by: Blue Swirl --- hw/bt-sdp.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/hw/bt-sdp.c b/hw/bt-sdp.c index b8732d0..c0bfd4d 100644 --- a/hw/bt-sdp.c +++ b/hw/bt-sdp.c @@ -171,12 +171,14 @@ static ssize_t sdp_svc_search(struct bt_l2cap_sdp_state_s *sdp, } else start = 0; - if (len > 1); + if (len > 1) { return -SDP_INVALID_SYNTAX; + } /* Output the results */ len = 4; count = 0; + max = INT_MAX; /* XXX: probably horribly incorrect */ end = start; for (i = 0; i < sdp->services; i ++) if (sdp->service_list[i].match) { -- 1.6.2.4