qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Zeev Tarantov" <zeev.tarantov@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] fix for treating "long" as "int64_t" in block-vmdk.c
Date: Sun, 14 Sep 2008 16:47:27 +0300	[thread overview]
Message-ID: <12d7e64c0809140647g22df201dlaab4fcc7032f46fa@mail.gmail.com> (raw)

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

                 reply	other threads:[~2008-09-14 13:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12d7e64c0809140647g22df201dlaab4fcc7032f46fa@mail.gmail.com \
    --to=zeev.tarantov@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).