Commit 58935915 authored by Kővágó, Zoltán's avatar Kővágó, Zoltán Committed by Gerd Hoffmann
Browse files

audio: remove audio_MIN, audio_MAX



There's already a MIN and MAX macro in include/qemu/osdep.h, use them
instead.

Signed-off-by: default avatarKővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 303222477df6f7373217e0df768635fab5855745.1566168923.git.DirtY.iCE.hu@gmail.com
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 8692bf7d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -634,7 +634,7 @@ static void alsa_write_pending (ALSAVoiceOut *alsa)

    while (alsa->pending) {
        int left_till_end_samples = hw->samples - alsa->wpos;
        int len = audio_MIN (alsa->pending, left_till_end_samples);
        int len = MIN (alsa->pending, left_till_end_samples);
        char *src = advance (alsa->pcm_buf, alsa->wpos << hw->info.shift);

        while (len) {
@@ -697,7 +697,7 @@ static int alsa_run_out (HWVoiceOut *hw, int live)
        return 0;
    }

    decr = audio_MIN (live, avail);
    decr = MIN (live, avail);
    decr = audio_pcm_hw_clip_out (hw, alsa->pcm_buf, decr, alsa->pending);
    alsa->pending += decr;
    alsa_write_pending (alsa);
@@ -915,7 +915,7 @@ static int alsa_run_in (HWVoiceIn *hw)
        }
    }

    decr = audio_MIN (dead, avail);
    decr = MIN (dead, avail);
    if (!decr) {
        return 0;
    }
+10 −10
Original line number Diff line number Diff line
@@ -535,7 +535,7 @@ static int audio_pcm_hw_find_min_in (HWVoiceIn *hw)

    for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) {
        if (sw->active) {
            m = audio_MIN (m, sw->total_hw_samples_acquired);
            m = MIN (m, sw->total_hw_samples_acquired);
        }
    }
    return m;
@@ -555,14 +555,14 @@ int audio_pcm_hw_clip_out (HWVoiceOut *hw, void *pcm_buf,
                           int live, int pending)
{
    int left = hw->samples - pending;
    int len = audio_MIN (left, live);
    int len = MIN (left, live);
    int clipped = 0;

    while (len) {
        struct st_sample *src = hw->mix_buf + hw->rpos;
        uint8_t *dst = advance (pcm_buf, hw->rpos << hw->info.shift);
        int samples_till_end_of_buf = hw->samples - hw->rpos;
        int samples_to_clip = audio_MIN (len, samples_till_end_of_buf);
        int samples_to_clip = MIN (len, samples_till_end_of_buf);

        hw->clip (dst, src, samples_to_clip);

@@ -616,7 +616,7 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size)
    }

    swlim = (live * sw->ratio) >> 32;
    swlim = audio_MIN (swlim, samples);
    swlim = MIN (swlim, samples);

    while (swlim) {
        src = hw->conv_buf + rpos;
@@ -664,7 +664,7 @@ static int audio_pcm_hw_find_min_out (HWVoiceOut *hw, int *nb_livep)

    for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) {
        if (sw->active || !sw->empty) {
            m = audio_MIN (m, sw->total_hw_samples_mixed);
            m = MIN (m, sw->total_hw_samples_mixed);
            nb_live += 1;
        }
    }
@@ -727,7 +727,7 @@ int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int size)

    dead = hwsamples - live;
    swlim = ((int64_t) dead << 32) / sw->ratio;
    swlim = audio_MIN (swlim, samples);
    swlim = MIN (swlim, samples);
    if (swlim) {
        sw->conv (sw->buf, buf, swlim);

@@ -739,7 +739,7 @@ int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int size)
    while (swlim) {
        dead = hwsamples - live;
        left = hwsamples - wpos;
        blck = audio_MIN (dead, left);
        blck = MIN (dead, left);
        if (!blck) {
            break;
        }
@@ -1031,7 +1031,7 @@ static void audio_capture_mix_and_clear (HWVoiceOut *hw, int rpos, int samples)
            n = samples;
            while (n) {
                int till_end_of_hw = hw->samples - rpos2;
                int to_write = audio_MIN (till_end_of_hw, n);
                int to_write = MIN (till_end_of_hw, n);
                int bytes = to_write << hw->info.shift;
                int written;

@@ -1049,7 +1049,7 @@ static void audio_capture_mix_and_clear (HWVoiceOut *hw, int rpos, int samples)
        }
    }

    n = audio_MIN (samples, hw->samples - rpos);
    n = MIN (samples, hw->samples - rpos);
    mixeng_clear (hw->mix_buf + rpos, n);
    mixeng_clear (hw->mix_buf, samples - n);
}
@@ -1205,7 +1205,7 @@ static void audio_run_capture (AudioState *s)
        rpos = hw->rpos;
        while (live) {
            int left = hw->samples - rpos;
            int to_capture = audio_MIN (live, left);
            int to_capture = MIN (live, left);
            struct st_sample *src;
            struct capture_callback *cb;

+0 −17
Original line number Diff line number Diff line
@@ -147,23 +147,6 @@ static inline void *advance (void *p, int incr)
    return (d + incr);
}

#ifdef __GNUC__
#define audio_MIN(a, b) ( __extension__ ({      \
    __typeof (a) ta = a;                        \
    __typeof (b) tb = b;                        \
    ((ta)>(tb)?(tb):(ta));                      \
}))

#define audio_MAX(a, b) ( __extension__ ({      \
    __typeof (a) ta = a;                        \
    __typeof (b) tb = b;                        \
    ((ta)<(tb)?(tb):(ta));                      \
}))
#else
#define audio_MIN(a, b) ((a)>(b)?(b):(a))
#define audio_MAX(a, b) ((a)<(b)?(b):(a))
#endif

int wav_start_capture(AudioState *state, CaptureState *s, const char *path,
                      int freq, int bits, int nchannels);

+1 −1
Original line number Diff line number Diff line
@@ -413,7 +413,7 @@ static int coreaudio_run_out (HWVoiceOut *hw, int live)
                core->live);
    }

    decr = audio_MIN (core->decr, live);
    decr = MIN (core->decr, live);
    core->decr -= decr;

    core->live = live - decr;
+1 −1
Original line number Diff line number Diff line
@@ -707,7 +707,7 @@ static int dsound_run_in (HWVoiceIn *hw)
    if (!len) {
        return 0;
    }
    len = audio_MIN (len, dead);
    len = MIN (len, dead);

    err = dsound_lock_in (
        dscb,
Loading