From: Takashi Iwai Subject: Re: [PATCH alsa-lib] pcm: rate: Don't return negative frame count on success in rewind Date: Mon, 07 Apr 2014 12:43:22 +0200 Message-ID: References: <20140404182725.GQ24575@foghorn.codeweavers.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id BC41B2610CE for ; Mon, 7 Apr 2014 12:43:22 +0200 (CEST) In-Reply-To: <20140404182725.GQ24575@foghorn.codeweavers.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Andrew Eikum Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Fri, 4 Apr 2014 13:27:25 -0500, Andrew Eikum wrote: > > snd_pcm_rewind is documented to return <0 on failure and >=0 on > success. > > Signed-off-by: Andrew Eikum Thanks, applied now. Takashi > --- > I checked all other rewind implementations, and this was the only one > that obviously had this bug. > > diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c > index 54a3e67..2eb4b1b 100644 > --- a/src/pcm/pcm_rate.c > +++ b/src/pcm/pcm_rate.c > @@ -702,7 +702,7 @@ static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f > snd_atomic_write_begin(&rate->watom); > n = snd_pcm_rate_move_applptr(pcm, -frames); > snd_atomic_write_end(&rate->watom); > - return n; > + return n < 0 ? -n : n; > } > > static snd_pcm_sframes_t snd_pcm_rate_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames) > -- > 1.9.1 > > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel >