From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M8haj-0000zN-G2 for qemu-devel@nongnu.org; Mon, 25 May 2009 17:20:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M8hae-0000zB-4h for qemu-devel@nongnu.org; Mon, 25 May 2009 17:20:17 -0400 Received: from [199.232.76.173] (port=48150 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M8hae-0000z8-1S for qemu-devel@nongnu.org; Mon, 25 May 2009 17:20:12 -0400 Received: from mx2.redhat.com ([66.187.237.31]:46835) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M8had-0006Xe-Kg for qemu-devel@nongnu.org; Mon, 25 May 2009 17:20:11 -0400 From: Eduardo Habkost Date: Mon, 25 May 2009 18:20:05 -0300 Message-Id: <1243286405-12289-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH] Fix vga_screen_dump_blank() PPM generation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org vga_screen_dump_blank() was not generating a valid PPM file: the width of the image made no sense (why it was multiplied by sizeof(uint32_t)?), and there was only one sample per pixel, instead of three. Signed-off-by: Eduardo Habkost --- hw/vga.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/vga.c b/hw/vga.c index 013ff10..18afa2a 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -2584,8 +2584,9 @@ static void vga_screen_dump_blank(VGAState *s, const char *filename) { FILE *f; unsigned int y, x, w, h; + unsigned char blank_sample[3] = { 0, 0, 0 }; - w = s->last_scr_width * sizeof(uint32_t); + w = s->last_scr_width; h = s->last_scr_height; f = fopen(filename, "wb"); @@ -2594,7 +2595,7 @@ static void vga_screen_dump_blank(VGAState *s, const char *filename) fprintf(f, "P6\n%d %d\n%d\n", w, h, 255); for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - fputc(0, f); + fwrite(blank_sample, 3, 1, f); } } fclose(f); -- 1.6.3.rc4.29.g8146