From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGyei-0005Sc-RI for qemu-devel@nongnu.org; Wed, 17 Jun 2009 13:10:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGyeY-0005H4-So for qemu-devel@nongnu.org; Wed, 17 Jun 2009 13:10:30 -0400 Received: from [199.232.76.173] (port=54839 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGyeX-0005Fy-OT for qemu-devel@nongnu.org; Wed, 17 Jun 2009 13:10:25 -0400 Received: from mx2.redhat.com ([66.187.237.31]:35967) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MGyeU-0007z0-Ig for qemu-devel@nongnu.org; Wed, 17 Jun 2009 13:10:23 -0400 From: Glauber Costa Date: Wed, 17 Jun 2009 13:10:04 -0400 Message-Id: <1245258604-2843-16-git-send-email-glommer@redhat.com> In-Reply-To: <1245258604-2843-15-git-send-email-glommer@redhat.com> References: <1245258604-2843-1-git-send-email-glommer@redhat.com> <1245258604-2843-2-git-send-email-glommer@redhat.com> <1245258604-2843-3-git-send-email-glommer@redhat.com> <1245258604-2843-4-git-send-email-glommer@redhat.com> <1245258604-2843-5-git-send-email-glommer@redhat.com> <1245258604-2843-6-git-send-email-glommer@redhat.com> <1245258604-2843-7-git-send-email-glommer@redhat.com> <1245258604-2843-8-git-send-email-glommer@redhat.com> <1245258604-2843-9-git-send-email-glommer@redhat.com> <1245258604-2843-10-git-send-email-glommer@redhat.com> <1245258604-2843-11-git-send-email-glommer@redhat.com> <1245258604-2843-12-git-send-email-glommer@redhat.com> <1245258604-2843-13-git-send-email-glommer@redhat.com> <1245258604-2843-14-git-send-email-glommer@redhat.com> <1245258604-2843-15-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH 15/15] Fix vga_screen_dump_blank() PPM generation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, Eduardo Habkost From: Eduardo Habkost 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 Signed-off-by: Anthony Liguori Signed-off-by: Glauber Costa --- hw/vga.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/vga.c b/hw/vga.c index 709d6bb..00a7ae5 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -2606,8 +2606,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"); @@ -2616,7 +2617,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.2.2