From: Michael Gernoth Date: Sun, 6 Jun 2010 01:37:49 +0000 (+0200) Subject: initialize zlib X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/rigol/commitdiff_plain/070fd3ff6fdc7ab2d22ccdc4a95d6532bb8f4157 initialize zlib --- diff --git a/png.c b/png.c index 98d5993..accf415 100644 --- a/png.c +++ b/png.c @@ -2,6 +2,8 @@ #include #include #include +#include +#include #include "png.h" @@ -76,6 +78,7 @@ unsigned char *lcd2png(unsigned char *lcd, int *len) uint32_t l; int i; int toalloc = 0; + z_stream strm; for(i = 0; i < 256; i++) { lut[i][0] = ((i >> 6) * 0x55); @@ -89,6 +92,15 @@ unsigned char *lcd2png(unsigned char *lcd, int *len) screen_conv[i+2] = lut[lcd[i/3]][2]; } + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + if (deflateInit(&strm, 9) != Z_OK) { + perror("deflateInit"); + exit(EXIT_FAILURE); + } + + image = malloc(320*234*2); /* TODO: FIXME! */ outpos = image; memcpy(outpos, png, sizeof(png));