[flac-dev] [PATCH] Optionally, allow distros to use openssl for MD5 verification

Eric Wong normalperson at yhbt.net
Sat May 5 18:04:05 PDT 2012


Cristian Rodríguez <crrodriguez at opensuse.org> wrote:
> +#if defined(HAVE_OPENSSL)
> +    /* decoder->private_->computed_md5sum is NULL when decoder->private_->do_md5_checking == false
> +    * that causes assertion failure crash in openSSL.
> +    */
> +    if(decoder->private_->do_md5_checking) {
> +        md5_failed = (EVP_DigestFinal_ex(&decoder->private_->md5context, decoder->private_->computed_md5sum, NULL) == 0);
> +    }
> +#else
>  	FLAC__MD5Final(decoder->private_->computed_md5sum, &decoder->private_->md5context);
> -
> +#endif

Can you do this without sprinkling #ifdefs all over the place?

Mixing #ifdefs and normal C control structures make code hard to
read/maintain.  This is *especially* true for folks who aren't regular
contributors to flac, myself included.

I would define workalike macros/no-op functions instead and hide
OpenSSL-related functionality behind them.

Thanks.


More information about the flac-dev mailing list