From patchwork Fri May 24 05:36:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 246063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 515D82C01FC for ; Fri, 24 May 2013 15:38:22 +1000 (EST) Received: from localhost ([::1]:60717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufkho-00020s-GB for incoming@patchwork.ozlabs.org; Fri, 24 May 2013 01:38:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfkhC-0001kA-H1 for qemu-devel@nongnu.org; Fri, 24 May 2013 01:37:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ufkh6-0006uu-JC for qemu-devel@nongnu.org; Fri, 24 May 2013 01:37:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufkh6-0006un-BY for qemu-devel@nongnu.org; Fri, 24 May 2013 01:37:36 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4O5bZKP021931 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 24 May 2013 01:37:35 -0400 Received: from localhost.nay.redhat.com ([10.66.7.14]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r4O5bEIT020349; Fri, 24 May 2013 01:37:30 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Fri, 24 May 2013 13:36:57 +0800 Message-Id: <1369373827-9152-3-git-send-email-famz@redhat.com> In-Reply-To: <1369373827-9152-1-git-send-email-famz@redhat.com> References: <1369373827-9152-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, jcody@redhat.com, Fam Zheng , rjones@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v6 02/12] curl: change magic number to sizeof X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org String field length is duplicated in two places. Make it a sizeof. Signed-off-by: Fam Zheng --- block/curl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/curl.c b/block/curl.c index a829fe7..a11002b 100644 --- a/block/curl.c +++ b/block/curl.c @@ -569,7 +569,7 @@ static void curl_readv_bh_cb(void *p) state->orig_buf = g_malloc(state->buf_len); state->acb[0] = acb; - snprintf(state->range, 127, "%zd-%zd", start, end); + snprintf(state->range, sizeof(state->range) - 1, "%zd-%zd", start, end); DPRINTF("CURL (AIO): Reading %d at %zd (%s)\n", (acb->nb_sectors * SECTOR_SIZE), start, state->range); curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range);