From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEbZp-00033d-0K for qemu-devel@nongnu.org; Tue, 05 Aug 2014 06:02:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEbZi-0002JR-SE for qemu-devel@nongnu.org; Tue, 05 Aug 2014 06:02:40 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:47458 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEbXW-0001YH-GR for qemu-devel@nongnu.org; Tue, 05 Aug 2014 06:00:18 -0400 References: <1407152873-16772-1-git-send-email-rjones@redhat.com> <1407152873-16772-2-git-send-email-rjones@redhat.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= Date: Tue, 05 Aug 2014 10:57:26 +0100 In-reply-to: <1407152873-16772-2-git-send-email-rjones@redhat.com> Message-ID: <874mxrl0hz.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v5 1/2] loader: Add load_image_gzipped function. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Richard W.M. Jones" Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, qemu-devel@nongnu.org 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 > + /* Is it a gzip-compressed file? */ > + if (len < 2 || > + compressed_data[0] != '\x1f' || > + compressed_data[1] != '\x8b') { > + goto out; > + } 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