qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 1/2] loader: Add load_image_gzipped function.


From: Alex Bennée
Subject: Re: [Qemu-devel] [PATCH v5 1/2] loader: Add load_image_gzipped function.
Date: Tue, 05 Aug 2014 10:57:26 +0100

Richard W.M. Jones writes:

> As the name suggests this lets you load a ROM/disk image that is
> gzipped.  It is uncompressed before storing it in guest memory.
>
> Signed-off-by: Richard W.M. Jones <address@hidden>
<snip>
> +    /* Is it a gzip-compressed file? */
> +    if (len < 2 ||
> +        compressed_data[0] != '\x1f' ||
> +        compressed_data[1] != '\x8b') {
> +        goto out;
> +    }
<snip>

Hmm serves me right for not compiling this first. I had to explicit
literals to get this to compile:

        Modified   hw/core/loader.c
diff --git a/hw/core/loader.c b/hw/core/loader.c
index e773aab..83136e8 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -599,8 +599,8 @@ int load_image_gzipped(const char *filename, hwaddr addr, 
uint64_t max_sz)
 
     /* Is it a gzip-compressed file? */
     if (len < 2 ||
-        compressed_data[0] != '\x1f' ||
-        compressed_data[1] != '\x8b') {
+        compressed_data[0] != 0x1f ||
+        compressed_data[1] != 0x8b ) {
         goto out;
     }

Otherwise I get:
hw/core/loader.c: In function ‘load_image_gzipped’:
hw/core/loader.c:603:9: error: comparison is always true due to limited range 
of data type [-Werror=type-limits]
         compressed_data[1] != '\x8b') {

-- 
Alex Bennée



reply via email to

[Prev in Thread] Current Thread [Next in Thread]