From patchwork Tue Aug 11 19:47:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 31162 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 893F0B6EDE for ; Wed, 12 Aug 2009 05:49:51 +1000 (EST) Received: from localhost ([127.0.0.1]:47598 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MaxLv-0002ww-LX for incoming@patchwork.ozlabs.org; Tue, 11 Aug 2009 15:49:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MaxKK-0002UI-7f for qemu-devel@nongnu.org; Tue, 11 Aug 2009 15:48:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MaxKF-0002Tt-5y for qemu-devel@nongnu.org; Tue, 11 Aug 2009 15:48:07 -0400 Received: from [199.232.76.173] (port=59894 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MaxKF-0002Tq-1a for qemu-devel@nongnu.org; Tue, 11 Aug 2009 15:48:03 -0400 Received: from mx20.gnu.org ([199.232.41.8]:26835) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MaxKE-00050l-Fk for qemu-devel@nongnu.org; Tue, 11 Aug 2009 15:48:02 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MaxKC-0005Ky-Sx for qemu-devel@nongnu.org; Tue, 11 Aug 2009 15:48:01 -0400 Received: (qmail 14737 invoked from network); 11 Aug 2009 19:47:59 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 11 Aug 2009 19:47:59 -0000 From: Nathan Froyd To: qemu-devel@nongnu.org Date: Tue, 11 Aug 2009 12:47:59 -0700 Message-Id: <1250020079-30940-1-git-send-email-froydnj@codesourcery.com> X-Mailer: git-send-email 1.6.3.2 X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Subject: [Qemu-devel] [PATCH] eliminate errors about unused results in block/vpc.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org These errors come up when compiling with gcc-4.3.3 and some older headers: /scratch/froydnj/qemu.git/block/vpc.c: In function 'vpc_create': /scratch/froydnj/qemu.git/block/vpc.c:514: error: value computed is not used /scratch/froydnj/qemu.git/block/vpc.c:516: error: value computed is not used /scratch/froydnj/qemu.git/block/vpc.c:517: error: value computed is not used /scratch/froydnj/qemu.git/block/vpc.c:566: error: value computed is not used Use memcpy to copy the strings instead of strncpy. Signed-off-by: Nathan Froyd --- block/vpc.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) v2: use memcpy instead of strncpy and casts to void* diff --git a/block/vpc.c b/block/vpc.c index ba482e9..6be24bf 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -511,10 +511,10 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options) // Prepare the Hard Disk Footer memset(buf, 0, 1024); - strncpy(footer->creator, "conectix", 8); + memcpy(footer->creator, "conectix", 8); // TODO Check if "qemu" creator_app is ok for VPC - strncpy(footer->creator_app, "qemu", 4); - strncpy(footer->creator_os, "Wi2k", 4); + memcpy(footer->creator_app, "qemu", 4); + memcpy(footer->creator_os, "Wi2k", 4); footer->features = be32_to_cpu(0x02); footer->version = be32_to_cpu(0x00010000); @@ -563,7 +563,7 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options) // Prepare the Dynamic Disk Header memset(buf, 0, 1024); - strncpy(dyndisk_header->magic, "cxsparse", 8); + memcpy(dyndisk_header->magic, "cxsparse", 8); dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFF); dyndisk_header->table_offset = be64_to_cpu(3 * 512);