static int tight_init_stream(VncState *vs, int stream_id,

                             int level, int strategy)

{

    z_streamp zstream = &vs->tight_stream[stream_id];



    if (zstream->opaque == NULL) {

        int err;



        VNC_DEBUG("VNC: TIGHT: initializing zlib stream %d\n", stream_id);

        VNC_DEBUG("VNC: TIGHT: opaque = %p | vs = %p\n", zstream->opaque, vs);

        zstream->zalloc = vnc_zlib_zalloc;

        zstream->zfree = vnc_zlib_zfree;



        err = deflateInit2(zstream, level, Z_DEFLATED, MAX_WBITS,

                           MAX_MEM_LEVEL, strategy);



        if (err != Z_OK) {

            fprintf(stderr, "VNC: error initializing zlib\n");

            return -1;

        }



        vs->tight_levels[stream_id] = level;

        zstream->opaque = vs;

    }



    if (vs->tight_levels[stream_id] != level) {

        if (deflateParams(zstream, level, strategy) != Z_OK) {

            return -1;

        }

        vs->tight_levels[stream_id] = level;

    }

    return 0;

}

static int tight_init_stream(VncState *vs, int stream_id,

                             int level, int strategy)

{

    z_streamp zstream = &vs->tight_stream[stream_id];



    if (zstream->opaque == NULL) {

        int err;



        VNC_DEBUG("VNC: TIGHT: initializing zlib stream %d\n", stream_id);

        VNC_DEBUG("VNC: TIGHT: opaque = %p | vs = %p\n", zstream->opaque, vs);

        zstream->zalloc = vnc_zlib_zalloc;

        zstream->zfree = vnc_zlib_zfree;



        err = deflateInit2(zstream, level, Z_DEFLATED, MAX_WBITS,

                           MAX_MEM_LEVEL, strategy);



        if (err != Z_OK) {

            fprintf(stderr, "VNC: error initializing zlib\n");

            return -1;

        }



        vs->tight_levels[stream_id] = level;

        zstream->opaque = vs;

    }



    if (vs->tight_levels[stream_id] != level) {

        if (deflateParams(zstream, level, strategy) != Z_OK) {

            return -1;

        }

        vs->tight_levels[stream_id] = level;

    }

    return 0;

}

static int FUNC_0(VncState *VAR_0, int VAR_1,

                             int VAR_2, int VAR_3)

{

    z_streamp zstream = &VAR_0->tight_stream[VAR_1];



    if (zstream->opaque == NULL) {

        int VAR_4;



        VNC_DEBUG("VNC: TIGHT: initializing zlib stream %d\n", VAR_1);

        VNC_DEBUG("VNC: TIGHT: opaque = %p | VAR_0 = %p\n", zstream->opaque, VAR_0);

        zstream->zalloc = vnc_zlib_zalloc;

        zstream->zfree = vnc_zlib_zfree;



        VAR_4 = deflateInit2(zstream, VAR_2, Z_DEFLATED, MAX_WBITS,

                           MAX_MEM_LEVEL, VAR_3);



        if (VAR_4 != Z_OK) {

            fprintf(stderr, "VNC: error initializing zlib\n");

            return -1;

        }



        VAR_0->tight_levels[VAR_1] = VAR_2;

        zstream->opaque = VAR_0;

    }



    if (VAR_0->tight_levels[VAR_1] != VAR_2) {

        if (deflateParams(zstream, VAR_2, VAR_3) != Z_OK) {

            return -1;

        }

        VAR_0->tight_levels[VAR_1] = VAR_2;

    }

    return 0;

}

static int FUNC_0(VncState *VAR_0, int VAR_1,
int VAR_2, int VAR_3)
{ z_streamp zstream = &VAR_0->tight_stream[VAR_1]; if (zstream->opaque == NULL) { int VAR_4; VNC_DEBUG("VNC: TIGHT: initializing zlib stream %d\n", VAR_1); VNC_DEBUG("VNC: TIGHT: opaque = %p | VAR_0 = %p\n", zstream->opaque, VAR_0); zstream->zalloc = vnc_zlib_zalloc; zstream->zfree = vnc_zlib_zfree; VAR_4 = deflateInit2(zstream, VAR_2, Z_DEFLATED, MAX_WBITS,
MAX_MEM_LEVEL, VAR_3); if (VAR_4 != Z_OK) { fprintf(stderr, "VNC: error initializing zlib\n"); return -1; } VAR_0->tight_levels[VAR_1] = VAR_2; zstream->opaque = VAR_0; } if (VAR_0->tight_levels[VAR_1] != VAR_2) { if (deflateParams(zstream, VAR_2, VAR_3) != Z_OK) { return -1; } VAR_0->tight_levels[VAR_1] = VAR_2; } return 0; }