fix for treating "long" as "int64_t" in block-vmdk.c
PATCH 1/1 fix for treating "long" as "int64_t" in block-vmdk.c
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 (working copy) renamed from block-vmdk.c (revision 5208) +3 -3
@@ -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