Max Kellermann <[EMAIL PROTECTED]> wrote:
> On 2008/09/06 05:36, Eric Wong <[EMAIL PROTECTED]> wrote:
> > Then I shall name it deconst_HACK(), complete with capitalization to
> > ward off excessive usage of it.
> > 
> > Even if we got library authors to change their API declarations, it'll
> > still be 5-10 years before existing software gets phased out...
> 
> Follow-up to that discussion: the following patchlet from your patch
> 925843cf demonstrates why I don't like a general-use deconst()
> function:
> 
> index 49d69ee..c1f7849 100644
> --- a/src/audioOutputs/audioOutput_shout.c
> +++ b/src/audioOutputs/audioOutput_shout.c
> @@ -637,7 +636,8 @@ static int myShout_play(AudioOutput * audioOutput,
>  
>       for (i = 0; i < samples; i++) {
>               for (j = 0; j < sd->audioFormat->channels; j++) {
> -                     vorbbuf[j][i] = (*((mpd_sint16 *) playChunk)) / 32768.0;
> +                     vorbbuf[j][i] =
> +                       (*((mpd_sint16 *)deconst_ptr(playChunk))) / 32768.0;
>                       playChunk += bytes;
>               }
>       }
> 
> This happens when it's just too easy and comfortable to use
> deconst_ptr() ... I'd write:
> 
> index f334558..7a07f53 100644
> --- a/src/audioOutputs/audioOutput_shout.c
> +++ b/src/audioOutputs/audioOutput_shout.c
> @@ -637,7 +637,7 @@ static int myShout_play(AudioOutput * audioOutput,
>  
>       for (i = 0; i < samples; i++) {
>               for (j = 0; j < sd->audioFormat->channels; j++) {
> -                     vorbbuf[j][i] = (*((mpd_sint16 *) playChunk)) / 32768.0;
> +                     vorbbuf[j][i] = (*((const mpd_sint16 *) playChunk)) / 
> 32768.0;

Fair enough, I'll change that :)

-- 
Eric Wong

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to