Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LwP82-00026n-9Z for qemu-devel@nongnu.org; Tue, 21 Apr 2009 19:11:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LwP80-00026C-T1 for qemu-devel@nongnu.org; Tue, 21 Apr 2009 19:11:49 -0400 Received: from [199.232.76.173] (port=36395 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LwP80-000261-MZ for qemu-devel@nongnu.org; Tue, 21 Apr 2009 19:11:48 -0400 Received: from savannah.gnu.org ([199.232.41.3]:43493 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LwP7z-00034j-DS for qemu-devel@nongnu.org; Tue, 21 Apr 2009 19:11:47 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LwP7y-000184-3f for qemu-devel@nongnu.org; Tue, 21 Apr 2009 23:11:46 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LwP7x-000180-S3 for qemu-devel@nongnu.org; Tue, 21 Apr 2009 23:11:46 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Tue, 21 Apr 2009 23:11:45 +0000 Subject: [Qemu-devel] [7213] qcow2: Fix warnings in check_refcount() (Kevin Wolf) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 7213 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7213 Author: aliguori Date: 2009-04-21 23:11:45 +0000 (Tue, 21 Apr 2009) Log Message: ----------- qcow2: Fix warnings in check_refcount() (Kevin Wolf) From: Kevin Wolf This code is currently only compiled when DEBUG_ALLOC is defined, so you usually don't see compiler warnings on it. This patch series wants to enable the code, so fix the format string warnings first. While we're at it, let's print error messages to stderr. Signed-off-by: Kevin Wolf Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/block-qcow2.c Modified: trunk/block-qcow2.c =================================================================== --- trunk/block-qcow2.c 2009-04-21 22:31:41 UTC (rev 7212) +++ trunk/block-qcow2.c 2009-04-21 23:11:45 UTC (rev 7213) @@ -2583,10 +2583,12 @@ cluster_offset += s->cluster_size) { k = cluster_offset >> s->cluster_bits; if (k < 0 || k >= refcount_table_size) { - printf("ERROR: invalid cluster offset=0x%llx\n", cluster_offset); + fprintf(stderr, "ERROR: invalid cluster offset=0x%" PRIx64 "\n", + cluster_offset); } else { if (++refcount_table[k] == 0) { - printf("ERROR: overflow cluster offset=0x%llx\n", cluster_offset); + fprintf(stderr, "ERROR: overflow cluster offset=0x%" PRIx64 + "\n", cluster_offset); } } } @@ -2623,8 +2625,8 @@ if (check_copied) { refcount = get_refcount(bs, (l2_offset & ~QCOW_OFLAG_COPIED) >> s->cluster_bits); if ((refcount == 1) != ((l2_offset & QCOW_OFLAG_COPIED) != 0)) { - printf("ERROR OFLAG_COPIED: l2_offset=%llx refcount=%d\n", - l2_offset, refcount); + fprintf(stderr, "ERROR OFLAG_COPIED: l2_offset=%" PRIx64 + " refcount=%d\n", l2_offset, refcount); } } l2_offset &= ~QCOW_OFLAG_COPIED; @@ -2635,8 +2637,9 @@ if (offset != 0) { if (offset & QCOW_OFLAG_COMPRESSED) { if (offset & QCOW_OFLAG_COPIED) { - printf("ERROR: cluster %lld: copied flag must never be set for compressed clusters\n", - offset >> s->cluster_bits); + fprintf(stderr, "ERROR: cluster %" PRId64 ": " + "copied flag must never be set for compressed " + "clusters\n", offset >> s->cluster_bits); offset &= ~QCOW_OFLAG_COPIED; } nb_csectors = ((offset >> s->csize_shift) & @@ -2649,8 +2652,8 @@ if (check_copied) { refcount = get_refcount(bs, (offset & ~QCOW_OFLAG_COPIED) >> s->cluster_bits); if ((refcount == 1) != ((offset & QCOW_OFLAG_COPIED) != 0)) { - printf("ERROR OFLAG_COPIED: offset=%llx refcount=%d\n", - offset, refcount); + fprintf(stderr, "ERROR OFLAG_COPIED: offset=%" + PRIx64 " refcount=%d\n", offset, refcount); } } offset &= ~QCOW_OFLAG_COPIED; @@ -2670,7 +2673,7 @@ qemu_free(l2_table); return 0; fail: - printf("ERROR: I/O error in check_refcounts_l1\n"); + fprintf(stderr, "ERROR: I/O error in check_refcounts_l1\n"); qemu_free(l1_table); qemu_free(l2_table); return -EIO; @@ -2722,7 +2725,7 @@ refcount1 = get_refcount(bs, i); refcount2 = refcount_table[i]; if (refcount1 != refcount2) - printf("ERROR cluster %d refcount=%d reference=%d\n", + fprintf(stderr, "ERROR cluster %d refcount=%d reference=%d\n", i, refcount1, refcount2); }