From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kerwo-0004nv-1e for qemu-devel@nongnu.org; Sun, 14 Sep 2008 09:47:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kerwn-0004mz-3e for qemu-devel@nongnu.org; Sun, 14 Sep 2008 09:47:29 -0400 Received: from [199.232.76.173] (port=48820 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kerwm-0004mr-WE for qemu-devel@nongnu.org; Sun, 14 Sep 2008 09:47:29 -0400 Received: from yx-out-1718.google.com ([74.125.44.154]:58924) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kerwm-0001D9-R6 for qemu-devel@nongnu.org; Sun, 14 Sep 2008 09:47:28 -0400 Received: by yx-out-1718.google.com with SMTP id 3so486927yxi.82 for ; Sun, 14 Sep 2008 06:47:27 -0700 (PDT) Message-ID: <12d7e64c0809140647g22df201dlaab4fcc7032f46fa@mail.gmail.com> Date: Sun, 14 Sep 2008 16:47:27 +0300 From: "Zeev Tarantov" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: [Qemu-devel] [PATCH] fix for treating "long" as "int64_t" in block-vmdk.c Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 32bit x86 I get these warnings: block-vmdk.c: In function 'vmdk_create': block-vmdk.c:796: warning: format '%lu' expects type 'long unsigned int', but argument 8 has type 'int64_t' block-vmdk.c:796: warning: format '%lu' expects type 'long unsigned int', but argument 8 has type 'int64_t' It seems the code was developed on a 64bit machine because the author treats "long in" as "int64_t". This patch fixes the warnings and the downcast. There are no more uses of "long"in the code. Please consider committing this, as well as my previous patch. --- block-vmdk.c (revision 5208) +++ block-vmdk.c (working copy) @@ -710,13 +710,13 @@ "createType=\"monolithicSparse\"\n" "\n" "# Extent description\n" - "RW %lu SPARSE \"%s\"\n" + "RW %llu SPARSE \"%s\"\n" "\n" "# The Disk Data Base \n" "#DDB\n" "\n" "ddb.virtualHWVersion = \"%d\"\n" - "ddb.geometry.cylinders = \"%lu\"\n" + "ddb.geometry.cylinders = \"%llu\"\n" "ddb.geometry.heads = \"16\"\n" "ddb.geometry.sectors = \"63\"\n" "ddb.adapterType = \"ide\"\n"; @@ -792,7 +792,7 @@ if ((temp_str = strrchr(real_filename, ':')) != NULL) real_filename = temp_str + 1; snprintf(desc, sizeof(desc), desc_template, (unsigned int)time(NULL), - (unsigned long)total_size, real_filename, + (uint64_t)total_size, real_filename, (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (63 * 16)); /* write the descriptor */ -Zeev