From: Takashi Iwai Subject: Re: snd_card_load Date: Tue, 28 Jun 2005 11:59:09 +0200 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Immanuel Litzroth Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org 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