All of lore.kernel.org
 help / color / mirror / Atom feed
* snd_card_load
@ 2005-06-24 11:28 Immanuel Litzroth
  2005-06-28  9:59 ` snd_card_load Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Immanuel Litzroth @ 2005-06-24 11:28 UTC (permalink / raw)
  To: alsa-devel

I am currently writing some C++ classes around parts of the alsa
api. I have a lot of work figuring out the semantics of the alsa calls
and am using a combination of the doxygen documentation, the alsalib
source and the sources to programs that use alsa.
The problem I ran into  yesterday concerns the snd_card_load function.
1) the documentation states that that functions returns 0 if the
driver is not present and 1 if it is. The code at the end of the
function goes:

if (open_dev >= 0) {
        close (open_dev);
	return 0;
	}
return open_dev ? 1 : 0;

it seems to me that 0 is returned if the driver is loaded and 1 if it
is not. moreover the last expression (return open_dev ? 1 : 0;) is
superflous and should be just "return 1;"
2) somewhat further in snd_card_get_index the following tests are made
   if(snd_card_load(card) >= 0) --> always true
   if(snd_card_load(card) < 0) --> always false

Am I missing something?
Immanuel

***************************************************************************
I can, I can't.
Tubbs Tattsyrup

--
Immanuel Litzroth
Software Development Engineer
Enfocus Software
Antwerpsesteenweg 41-45
9000 Gent
Belgium
Voice: +32 9 269 23 90
Fax : +32 9 269 16 91
Email: Immanuell@enfocus.be
web : www.enfocus.be
***************************************************************************



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: snd_card_load
  2005-06-24 11:28 snd_card_load Immanuel Litzroth
@ 2005-06-28  9:59 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2005-06-28  9:59 UTC (permalink / raw)
  To: Immanuel Litzroth; +Cc: alsa-devel

At 24 Jun 2005 13:28:08 +0200,
Immanuel Litzroth wrote:
> 
> I am currently writing some C++ classes around parts of the alsa
> api. I have a lot of work figuring out the semantics of the alsa calls
> and am using a combination of the doxygen documentation, the alsalib
> source and the sources to programs that use alsa.
> The problem I ran into  yesterday concerns the snd_card_load function.
> 1) the documentation states that that functions returns 0 if the
> driver is not present and 1 if it is. The code at the end of the
> function goes:
> 
> if (open_dev >= 0) {
>         close (open_dev);
> 	return 0;
> 	}
> return open_dev ? 1 : 0;
> 
> it seems to me that 0 is returned if the driver is loaded and 1 if it
> is not. moreover the last expression (return open_dev ? 1 : 0;) is
> superflous and should be just "return 1;"
>
> 2) somewhat further in snd_card_get_index the following tests are made
>    if(snd_card_load(card) >= 0) --> always true
>    if(snd_card_load(card) < 0) --> always false
> 
> Am I missing something?

On both you're right, it's definitely a bug of alsa-lib.
Fixed on CVS.  snd_card_load() follows to the behavior described in
the document now.

Thanks for spotting out this.


Takashi


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-06-28  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-24 11:28 snd_card_load Immanuel Litzroth
2005-06-28  9:59 ` snd_card_load Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.