[xiph-commits] r16839 - in trunk/ao/src: . plugins/pulse
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Wed Jan 27 23:10:02 PST 2010
Author: xiphmont
Date: 2010-01-27 23:10:02 -0800 (Wed, 27 Jan 2010)
New Revision: 16839
Modified:
trunk/ao/src/audio_out.c
trunk/ao/src/plugins/pulse/ao_pulse.c
Log:
Fixes Debian #522101; eliminate use of PATH_MAX_LEN as it doesn't exist
on hurd-i386
Modified: trunk/ao/src/audio_out.c
===================================================================
--- trunk/ao/src/audio_out.c 2010-01-28 06:58:08 UTC (rev 16838)
+++ trunk/ao/src/audio_out.c 2010-01-28 07:10:02 UTC (rev 16839)
@@ -258,7 +258,6 @@
struct dirent *plugin_dirent;
char *ext;
struct stat statbuf;
- char fullpath[PATH_MAX];
DIR *plugindir;
driver_list *plugin;
driver_list *driver = end;
@@ -266,24 +265,25 @@
/* now insert any plugins we find */
plugindir = opendir(AO_PLUGIN_PATH);
if (plugindir != NULL) {
- while ((plugin_dirent = readdir(plugindir)) != NULL) {
- snprintf(fullpath, PATH_MAX, "%s/%s",
- AO_PLUGIN_PATH, plugin_dirent->d_name);
- if (!stat(fullpath, &statbuf) &&
- S_ISREG(statbuf.st_mode) &&
- (ext = strrchr(plugin_dirent->d_name, '.')) != NULL) {
- if (strcmp(ext, SHARED_LIB_EXT) == 0) {
- plugin = _get_plugin(fullpath);
- if (plugin) {
- driver->next = plugin;
- plugin->next = NULL;
- driver = driver->next;
- }
- }
- }
- }
+ while ((plugin_dirent = readdir(plugindir)) != NULL) {
+ char fullpath[strlen(AO_PLUGIN_PATH) + 1 + strlen(plugin_dirent->d_name) + 1];
+ snprintf(fullpath, sizeof(fullpath), "%s/%s",
+ AO_PLUGIN_PATH, plugin_dirent->d_name);
+ if (!stat(fullpath, &statbuf) &&
+ S_ISREG(statbuf.st_mode) &&
+ (ext = strrchr(plugin_dirent->d_name, '.')) != NULL) {
+ if (strcmp(ext, SHARED_LIB_EXT) == 0) {
+ plugin = _get_plugin(fullpath);
+ if (plugin) {
+ driver->next = plugin;
+ plugin->next = NULL;
+ driver = driver->next;
+ }
+ }
+ }
+ }
- closedir(plugindir);
+ closedir(plugindir);
}
#endif
}
Modified: trunk/ao/src/plugins/pulse/ao_pulse.c
===================================================================
--- trunk/ao/src/plugins/pulse/ao_pulse.c 2010-01-28 06:58:08 UTC (rev 16838)
+++ trunk/ao/src/plugins/pulse/ao_pulse.c 2010-01-28 07:10:02 UTC (rev 16839)
@@ -79,7 +79,7 @@
}
int ao_plugin_test(void) {
- char p[PATH_MAX], t[256], t2[256];
+ char *p=NULL, t[256], t2[256];
const char *fn;
struct pa_simple *s;
static const struct pa_sample_spec ss = {
@@ -87,16 +87,32 @@
.rate = 44100,
.channels = 2
};
+ size_t allocated = 128;
disable_sigpipe();
if (getenv("PULSE_SERVER") || getenv("PULSE_SINK"))
return 1;
- if ((fn = pa_get_binary_name(p, sizeof(p)))) {
+ while (1) {
+ p = pa_xmalloc(allocated);
+
+ if (!(fn = pa_get_binary_name(p, allocated))) {
+ pa_xfree(p);
+ break;
+ }
+
+ if (fn != p || strlen(p) < allocated - 1) {
snprintf(t, sizeof(t), "libao[%s]", fn);
snprintf(t2, sizeof(t2), "libao[%s] test", fn);
+ break;
+ }
+
+ pa_xfree(p);
+ allocated *= 2;
}
+ pa_xfree(p);
+ p = NULL;
if (!(s = pa_simple_new(NULL, fn ? t : "libao", PA_STREAM_PLAYBACK, NULL, fn ? t2 : "libao test", &ss, NULL, NULL, NULL)))
return 0;
@@ -202,12 +218,13 @@
};
int ao_plugin_open(ao_device *device, ao_sample_format *format) {
- char p[PATH_MAX], t[256], t2[256];
+ char *p=NULL, t[256], t2[256];
const char *fn = NULL;
ao_pulse_internal *internal;
struct pa_sample_spec ss;
struct pa_channel_map map;
int usemap=0;
+ size_t allocated = 128;
assert(device && device->internal && format);
@@ -228,11 +245,26 @@
disable_sigpipe();
- if (pa_get_binary_name(p, sizeof(p))) {
- fn = pa_path_get_filename(p);
- snprintf(t, sizeof(t), "libao[%s]", fn);
- snprintf(t2, sizeof(t2), "libao[%s] playback stream", fn);
+ while (1) {
+ p = pa_xmalloc(allocated);
+
+ if (!(fn = pa_get_binary_name(p, allocated))) {
+ pa_xfree(p);
+ break;
+ }
+
+ if (fn != p || strlen(p) < allocated - 1) {
+ fn = pa_path_get_filename(fn);
+ snprintf(t, sizeof(t), "libao[%s]", fn);
+ snprintf(t2, sizeof(t2), "libao[%s] playback stream", fn);
+ break;
+ }
+
+ pa_xfree(p);
+ allocated *= 2;
}
+ pa_xfree(p);
+ p = NULL;
if(!device->output_matrix){
if(format->matrix){
More information about the commits
mailing list