Tomas Härdin:
>> +int ff_inflate_init(FFZStream *z, void *logctx)
>> +{
>> +    z_stream *const zstream = &z->zstream;
>> +    int zret;
>> +
>> +    z->inited = 0;
>> +    zstream->next_in  = Z_NULL;
>> +    zstream->avail_in = 0;
>> +    zstream->zalloc   = Z_NULL;
>> +    zstream->zfree    = Z_NULL;
>> +    zstream->opaque   = Z_NULL;
> 
> why not bzero()?
> 
> Rest of the patch looks fine
> 

bzero()? You mean memset to zero? The reason that I initialize exactly
these fields is because these are exactly the fields required to be
initialized by zlib (for inflate; next_in and avail_in are not required
to be initialized for deflate): "The fields next_in, avail_in, zalloc,
zfree and opaque must be initialized before by the caller." zlib treats
all the other fields as uninitialized, so why should we initialize them
(Actually reinitialize them -- most FFZStreams are already zeroed
initially as part of a codec's private context.)? The way it is done in
this patch shows directly which elements zlib expects to be set; setting
everything would not achieve the same.

- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to