On Tue, 2016-06-07 at 11:17 +0100, Frediano Ziglio wrote: > This change is less clean the other similar patches as zlib and > glz require more steps. > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > server/dcc-encoders.c | 18 +++++++++--------- > server/dcc-encoders.h | 5 +++++ > server/dcc.c | 4 ++-- > server/dcc.h | 5 ----- > 4 files changed, 16 insertions(+), 16 deletions(-) > > diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c > index c4b85d3..a6e7b2c 100644 > --- a/server/dcc-encoders.c > +++ b/server/dcc-encoders.c > @@ -386,14 +386,14 @@ static inline void dcc_init_lz4(EncodersData *enc) > } > #endif > > -static void dcc_init_zlib(DisplayChannelClient *dcc) > +static void dcc_init_zlib(EncodersData *enc) Same comment about function name (encoders_data_) > { > - dcc->zlib_data.usr.more_space = zlib_usr_more_space; > - dcc->zlib_data.usr.more_input = zlib_usr_more_input; > + enc->zlib_data.usr.more_space = zlib_usr_more_space; > + enc->zlib_data.usr.more_input = zlib_usr_more_input; > > - dcc->zlib = zlib_encoder_create(&dcc->zlib_data.usr, > ZLIB_DEFAULT_COMPRESSION_LEVEL); > + enc->zlib = zlib_encoder_create(&enc->zlib_data.usr, > ZLIB_DEFAULT_COMPRESSION_LEVEL); > > - if (!dcc->zlib) { > + if (!enc->zlib) { > spice_critical("create zlib encoder failed"); > } > } > @@ -409,10 +409,10 @@ void dcc_encoders_init(DisplayChannelClient *dcc) > #ifdef USE_LZ4 > dcc_init_lz4(enc); > #endif > - dcc_init_zlib(dcc); > + dcc_init_zlib(enc); > > // todo: tune level according to bandwidth > - dcc->zlib_level = ZLIB_DEFAULT_COMPRESSION_LEVEL; > + enc->zlib_level = ZLIB_DEFAULT_COMPRESSION_LEVEL; > } > > void dcc_encoders_free(DisplayChannelClient *dcc) > @@ -428,8 +428,8 @@ void dcc_encoders_free(DisplayChannelClient *dcc) > lz4_encoder_destroy(enc->lz4); > enc->lz4 = NULL; > #endif > - zlib_encoder_destroy(dcc->zlib); > - dcc->zlib = NULL; > + zlib_encoder_destroy(enc->zlib); > + enc->zlib = NULL; > } > > /* Remove from the to_free list and the instances_list. > diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h > index e682b05..f1c4edf 100644 > --- a/server/dcc-encoders.h > +++ b/server/dcc-encoders.h > @@ -178,6 +178,11 @@ struct EncodersData { > Lz4Data lz4_data; > Lz4EncoderContext *lz4; > #endif > + > + int zlib_level; > + > + ZlibData zlib_data; > + ZlibEncoder *zlib; > }; > > typedef struct compress_send_data_t { > diff --git a/server/dcc.c b/server/dcc.c > index c59858c..46182f9 100644 > --- a/server/dcc.c > +++ b/server/dcc.c > @@ -746,14 +746,14 @@ static int dcc_compress_image_glz(DisplayChannelClient > *dcc, > goto glz; > } > stat_start_time_init(&start_time, &display_channel->zlib_glz_stat); > - zlib_data = &dcc->zlib_data; > + zlib_data = &dcc->encoders.zlib_data; > > encoder_data_init(&zlib_data->data); > > zlib_data->data.u.compressed_data.next = glz_data->data.bufs_head; > zlib_data->data.u.compressed_data.size_left = glz_size; > > - zlib_size = zlib_encode(dcc->zlib, dcc->zlib_level, > + zlib_size = zlib_encode(dcc->encoders.zlib, dcc->encoders.zlib_level, > glz_size, zlib_data->data.bufs_head->buf.bytes, > sizeof(zlib_data->data.bufs_head->buf)); > > diff --git a/server/dcc.h b/server/dcc.h > index ef4fae22..0f1a20a 100644 > --- a/server/dcc.h > +++ b/server/dcc.h > @@ -63,11 +63,6 @@ struct DisplayChannelClient { > > EncodersData encoders; > > - int zlib_level; > - > - ZlibData zlib_data; > - ZlibEncoder *zlib; > - > int expect_init; > > PixmapCache *pixmap_cache; Reviewed-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel