File alsa-lib-hg-fixes.diff of Package alsa

diff -r f5f02f509ea1 include/control.h
--- a/include/control.h	Thu Dec 07 15:04:28 2006 +0100
+++ b/include/control.h	Mon Dec 18 10:46:32 2006 +0100
@@ -260,7 +260,6 @@ snd_ctl_type_t snd_ctl_type(snd_ctl_t *c
 
 const char *snd_ctl_elem_type_name(snd_ctl_elem_type_t type);
 const char *snd_ctl_elem_iface_name(snd_ctl_elem_iface_t iface);
-const char *snd_ctl_iface_conf_name(snd_ctl_elem_iface_t iface);
 const char *snd_ctl_event_type_name(snd_ctl_event_type_t type);
 
 unsigned int snd_ctl_event_elem_get_mask(const snd_ctl_event_t *obj);
diff -r f5f02f509ea1 src/control/namehint.c
--- a/src/control/namehint.c	Thu Dec 07 15:04:28 2006 +0100
+++ b/src/control/namehint.c	Mon Dec 18 10:46:32 2006 +0100
@@ -601,7 +601,8 @@ int snd_device_name_free_hint(void **hin
 
 /**
  * \brief Get a hint Free a string list with device name hints.
- * \param hints A string list to free
+ * \param hint A pointer to hint
+ * \param id Hint ID (see bellow)
  * \result an allocated ASCII string if success, otherwise NULL
  *
  * List of valid IDs:
diff -r f5f02f509ea1 src/pcm/pcm_direct.c
--- a/src/pcm/pcm_direct.c	Thu Dec 07 15:04:28 2006 +0100
+++ b/src/pcm/pcm_direct.c	Mon Jan 08 16:38:49 2007 +0100
@@ -895,7 +895,7 @@ int snd_pcm_direct_initialize_slave(snd_
 		}
 		if (ret < 0 && dmix->type != SND_PCM_TYPE_DMIX) {
 			/* TODO: try to choose a good format */
-			ret = snd_pcm_hw_params_set_format_first(spcm, hw_params, &format);
+			ret = INTERNAL(snd_pcm_hw_params_set_format_first)(spcm, hw_params, &format);
 		}
 		if (ret < 0) {
 			SNDERR("requested or auto-format is not available");
diff -r f5f02f509ea1 src/pcm/pcm_ladspa.c
--- a/src/pcm/pcm_ladspa.c	Thu Dec 07 15:04:28 2006 +0100
+++ b/src/pcm/pcm_ladspa.c	Mon Jan 08 15:02:22 2007 +0100
@@ -406,33 +406,36 @@ static int snd_pcm_ladspa_connect_plugin
 					  snd_pcm_ladspa_plugin_io_t *io,
 					  snd_pcm_ladspa_eps_t *eps)
 {
-	unsigned int port, channels, idx;
+	unsigned int port, channels, idx, idx1;
 	int err;
 
 	assert(plugin->policy == SND_PCM_LADSPA_POLICY_NONE);
 	channels = io->port_bindings_size > 0 ?
 	                io->port_bindings_size :
 	                snd_pcm_ladspa_count_ports(plugin, io->pdesc | LADSPA_PORT_AUDIO);
-	for (idx = 0; idx < channels; idx++) {
+	for (idx = idx1 = 0; idx < channels; idx++) {
 		if (io->port_bindings_size > 0)
         		port = io->port_bindings[idx];
                 else {
         		err = snd_pcm_ladspa_find_port(&port, plugin, io->pdesc | LADSPA_PORT_AUDIO, idx);
         		if (err < 0) {
-        		        SNDERR("unable to find audio %s port %u plugin '%s'\n", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", idx, plugin->desc->Name);
+        		        SNDERR("unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", idx, plugin->desc->Name);
         			return err;
                         }
                 }
-        	err = snd_pcm_ladspa_add_to_carray(&eps->channels, idx, idx);
+                if (port == NO_ASSIGN)
+                	continue;
+        	err = snd_pcm_ladspa_add_to_carray(&eps->channels, idx1, idx);
         	if (err < 0) {
-        		SNDERR("unable to add channel %u for audio %s plugin '%s'\n", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+        		SNDERR("unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
         	        return err;
                 }
-        	err = snd_pcm_ladspa_add_to_array(&eps->ports, idx, port);
+        	err = snd_pcm_ladspa_add_to_array(&eps->ports, idx1, port);
         	if (err < 0) {
-        		SNDERR("unable to add port %u for audio %s plugin '%s'\n", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+        		SNDERR("unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
         	        return err;
                 }
+                idx1++;
 	}
 	return 0;
 }
@@ -465,18 +468,18 @@ static int snd_pcm_ladspa_connect_plugin
 	} else {
 		err = snd_pcm_ladspa_find_port(&port, plugin, io->pdesc | LADSPA_PORT_AUDIO, 0);
 		if (err < 0) {
-		        SNDERR("unable to find audio %s port %u plugin '%s'\n", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", (unsigned int)0, plugin->desc->Name);
+		        SNDERR("unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", (unsigned int)0, plugin->desc->Name);
 			return err;
                 }
 	}
 	err = snd_pcm_ladspa_add_to_carray(&eps->channels, 0, idx);
 	if (err < 0) {
-        	SNDERR("unable to add channel %u for audio %s plugin '%s'\n", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+        	SNDERR("unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
 	        return err;
         }
         err = snd_pcm_ladspa_add_to_array(&eps->ports, 0, port);
         if (err < 0) {
-        	SNDERR("unable to add port %u for audio %s plugin '%s'\n", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+        	SNDERR("unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
         	return err;
         }
         return 0;
@@ -592,13 +595,13 @@ static int snd_pcm_ladspa_check_connect(
 	for (idx = midx = 0; idx < plugin->desc->PortCount; idx++)
 		if ((plugin->desc->PortDescriptors[idx] & (io->pdesc | LADSPA_PORT_AUDIO)) == (io->pdesc | LADSPA_PORT_AUDIO)) {
                         if (eps->channels.array[midx] == NO_ASSIGN) {
-                                SNDERR("%s port for plugin %s depth %u is not connected\n", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name, depth);
+                                SNDERR("%s port for plugin %s depth %u is not connected", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name, depth);
                                 err++;
                         }
 			midx++;
 		}
         if (err > 0) {
-                SNDERR("%i connection errors total\n", err);
+                SNDERR("%i connection errors total", err);
                 return -EINVAL;
         }
         return 0;
@@ -715,11 +718,13 @@ static int snd_pcm_ladspa_allocate_memor
 			nchannels = channels;
 			for (idx = 0; idx < instance->input.channels.size; idx++) {
 			        chn = instance->input.channels.array[idx];
+			        assert(instance->input.ports.array[idx] != NO_ASSIGN);
         			if (chn >= nchannels)
         			        nchannels = chn + 1;
                         }
 			for (idx = 0; idx < instance->output.channels.size; idx++) {
 			        chn = instance->output.channels.array[idx];
+			        assert(instance->output.ports.array[idx] != NO_ASSIGN);
         			if (chn >= nchannels)
         			        nchannels = chn + 1;
                         }
@@ -876,8 +881,8 @@ snd_pcm_ladspa_write_areas(snd_pcm_t *pc
                                         if (data == NULL) {
                                 		data = (LADSPA_Data *)((char *)areas[chn].addr + (areas[chn].first / 8));
                                        		data += offset;
-                                        }	
-                			instance->desc->connect_port(instance->handle, instance->input.ports.array[idx], data);
+                                        }
+                                        instance->desc->connect_port(instance->handle, instance->input.ports.array[idx], data);
         			}
         			for (idx = 0; idx < instance->output.channels.size; idx++) {
                                         chn = instance->output.channels.array[idx];
@@ -886,7 +891,7 @@ snd_pcm_ladspa_write_areas(snd_pcm_t *pc
                                 		data = (LADSPA_Data *)((char *)slave_areas[chn].addr + (areas[chn].first / 8));
                                 		data += slave_offset;
                                         }
-        		        	instance->desc->connect_port(instance->handle, instance->output.ports.array[idx], data);
+					instance->desc->connect_port(instance->handle, instance->output.ports.array[idx], data);
         			}
         			instance->desc->run(instance->handle, size1);
         		}
@@ -1005,7 +1010,7 @@ static void snd_pcm_ladspa_dump_array(sn
                         snd_output_putc(out, '-');
                 else
                         snd_output_printf(out, "%u", val);
-                if (plugin)
+                if (plugin && val != NO_ASSIGN)
                         snd_output_printf(out, " \"%s\"", plugin->desc->PortNames[val]);
         }
 }
@@ -1099,8 +1104,10 @@ static int snd_pcm_ladspa_check_file(snd
                                 if (label != NULL) {
                                         lc = localeconv ();
                                         labellocale = malloc (strlen (label) + 1);
-                                        if (labellocale == NULL)
+                                        if (labellocale == NULL) {
+                                        	dlclose(handle);
                                                 return -ENOMEM;
+					}
                                         strcpy (labellocale, label);
                                         if (strrchr(labellocale, '.'))
                                                 *strrchr (labellocale, '.') = *lc->decimal_point;
@@ -1114,8 +1121,10 @@ static int snd_pcm_ladspa_check_file(snd
 				if (ladspa_id > 0 && d->UniqueID != ladspa_id)
 					continue;
 				plugin->filename = strdup(filename);
-				if (plugin->filename == NULL)
+				if (plugin->filename == NULL) {
+					dlclose(handle);
 					return -ENOMEM;
+				}
 				plugin->dl_handle = handle;
 				plugin->desc = d;
 				return 1;
@@ -1153,18 +1162,24 @@ static int snd_pcm_ladspa_check_dir(snd_
 		}
 		
 		filename = malloc(len + strlen(dirent->d_name) + 1 + need_slash);
-		if (filename == NULL)
+		if (filename == NULL) {
+			closedir(dir);
 			return -ENOMEM;
+		}
 		strcpy(filename, path);
 		if (need_slash)
 			strcat(filename, "/");
 		strcat(filename, dirent->d_name);
 		err = snd_pcm_ladspa_check_file(plugin, filename, label, ladspa_id);
 		free(filename);
-		if (err < 0 && err != -ENOENT)
+		if (err < 0 && err != -ENOENT) {
+			closedir(dir);
 			return err;
-		if (err > 0)
+		}
+		if (err > 0) {
+			closedir(dir);
 			return 1;
+		}
 	}
 	/* never reached */
 	return 0;
diff -r f5f02f509ea1 src/timer/timer.c
--- a/src/timer/timer.c	Thu Dec 07 15:04:28 2006 +0100
+++ b/src/timer/timer.c	Mon Jan 08 15:04:17 2007 +0100
@@ -92,7 +92,7 @@ static int snd_timer_open_conf(snd_timer
 #ifndef PIC
 	extern void *snd_timer_open_symbols(void);
 #endif
-	void *h;
+	void *h = NULL;
 	if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
 		if (name)
 			SNDERR("Invalid type for TIMER %s definition", name);
diff -r f5f02f509ea1 src/timer/timer_query.c
--- a/src/timer/timer_query.c	Thu Dec 07 15:04:28 2006 +0100
+++ b/src/timer/timer_query.c	Mon Jan 08 16:28:40 2007 +0100
@@ -50,7 +50,7 @@ static int snd_timer_query_open_conf(snd
 #ifndef PIC
 	extern void *snd_timer_query_open_symbols(void);
 #endif
-	void *h;
+	void *h = NULL;
 	if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
 		if (name)
 			SNDERR("Invalid type for TIMER %s definition", name);
@@ -77,6 +77,7 @@ static int snd_timer_query_open_conf(snd
 	if (err >= 0) {
 		if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
 			SNDERR("Invalid type for TIMER type %s definition", str);
+			err = -EINVAL;
 			goto _err;
 		}
 		snd_config_for_each(i, next, type_conf) {
openSUSE Build Service is sponsored by