summaryrefslogtreecommitdiffstats
path: root/ext/ladspa/search.c
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
commit7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2 (patch)
treef863b467dea9559a6ec9c48affbfae11f8104164 /ext/ladspa/search.c
parenta19db4bbdc4a15ea0d8f4d28e9a1302c9c3d1657 (diff)
downloadgst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.gz
gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.bz2
gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.zip
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'ext/ladspa/search.c')
-rw-r--r--ext/ladspa/search.c92
1 files changed, 45 insertions, 47 deletions
diff --git a/ext/ladspa/search.c b/ext/ladspa/search.c
index 08b28d12..0f690275 100644
--- a/ext/ladspa/search.c
+++ b/ext/ladspa/search.c
@@ -27,19 +27,20 @@
/* Search just the one directory. */
static void
-LADSPADirectoryPluginSearch
-(const char * pcDirectory,
- LADSPAPluginSearchCallbackFunction fCallbackFunction) {
+ LADSPADirectoryPluginSearch
+ (const char *pcDirectory,
+ LADSPAPluginSearchCallbackFunction fCallbackFunction)
+{
- char * pcFilename;
- DIR * psDirectory;
+ char *pcFilename;
+ DIR *psDirectory;
LADSPA_Descriptor_Function fDescriptorFunction;
long lDirLength;
long iNeedSlash;
- struct dirent * psDirectoryEntry;
- void * pvPluginHandle;
+ struct dirent *psDirectoryEntry;
+ void *pvPluginHandle;
- lDirLength = strlen(pcDirectory);
+ lDirLength = strlen (pcDirectory);
if (!lDirLength)
return;
if (pcDirectory[lDirLength - 1] == '/')
@@ -47,66 +48,63 @@ LADSPADirectoryPluginSearch
else
iNeedSlash = 1;
- psDirectory = opendir(pcDirectory);
+ psDirectory = opendir (pcDirectory);
if (!psDirectory)
return;
while (1) {
- psDirectoryEntry = readdir(psDirectory);
+ psDirectoryEntry = readdir (psDirectory);
if (!psDirectoryEntry) {
- closedir(psDirectory);
+ closedir (psDirectory);
return;
}
- pcFilename = malloc(lDirLength
- + strlen(psDirectoryEntry->d_name)
- + 1 + iNeedSlash);
- strcpy(pcFilename, pcDirectory);
+ pcFilename = malloc (lDirLength + strlen (psDirectoryEntry->d_name)
+ + 1 + iNeedSlash);
+ strcpy (pcFilename, pcDirectory);
if (iNeedSlash)
- strcat(pcFilename, "/");
- strcat(pcFilename, psDirectoryEntry->d_name);
-
- pvPluginHandle = dlopen(pcFilename, RTLD_LAZY);
+ strcat (pcFilename, "/");
+ strcat (pcFilename, psDirectoryEntry->d_name);
+
+ pvPluginHandle = dlopen (pcFilename, RTLD_LAZY);
if (pvPluginHandle) {
/* This is a file and the file is a shared library! */
- dlerror();
+ dlerror ();
fDescriptorFunction
- = (LADSPA_Descriptor_Function)dlsym(pvPluginHandle,
- "ladspa_descriptor");
- if (dlerror() == NULL && fDescriptorFunction) {
+ = (LADSPA_Descriptor_Function) dlsym (pvPluginHandle,
+ "ladspa_descriptor");
+ if (dlerror () == NULL && fDescriptorFunction) {
/* We've successfully found a ladspa_descriptor function. Pass
- it to the callback function. */
- fCallbackFunction(pcFilename,
- pvPluginHandle,
- fDescriptorFunction);
- }
- else {
+ it to the callback function. */
+ fCallbackFunction (pcFilename, pvPluginHandle, fDescriptorFunction);
+ } else {
/* It was a library, but not a LADSPA one. Unload it. */
- dlclose(pcFilename);
+ dlclose (pcFilename);
}
}
- free(pcFilename);
+ free (pcFilename);
}
}
/*****************************************************************************/
-void
-LADSPAPluginSearch(LADSPAPluginSearchCallbackFunction fCallbackFunction) {
+void
+LADSPAPluginSearch (LADSPAPluginSearchCallbackFunction fCallbackFunction)
+{
- char * pcBuffer;
- const char * pcEnd;
- const char * pcLADSPAPath;
- const char * pcStart;
+ char *pcBuffer;
+ const char *pcEnd;
+ const char *pcLADSPAPath;
+ const char *pcStart;
/* thomasvs: I'm sorry, but I'm going to add glib stuff here.
- * I'm appending logical values for LADSPA_PATH here
- */
+ * I'm appending logical values for LADSPA_PATH here
+ */
pcLADSPAPath = g_strdup_printf ("%s:/usr/lib/ladspa:/usr/local/lib/ladspa",
- getenv("LADSPA_PATH"));
+ getenv ("LADSPA_PATH"));
if (!pcLADSPAPath) {
/* fprintf(stderr, */
@@ -114,20 +112,20 @@ LADSPAPluginSearch(LADSPAPluginSearchCallbackFunction fCallbackFunction) {
/* "environment variable set.\n"); */
return;
}
-
+
pcStart = pcLADSPAPath;
while (*pcStart != '\0') {
pcEnd = pcStart;
while (*pcEnd != ':' && *pcEnd != '\0')
pcEnd++;
-
- pcBuffer = malloc(1 + pcEnd - pcStart);
+
+ pcBuffer = malloc (1 + pcEnd - pcStart);
if (pcEnd > pcStart)
- strncpy(pcBuffer, pcStart, pcEnd - pcStart);
+ strncpy (pcBuffer, pcStart, pcEnd - pcStart);
pcBuffer[pcEnd - pcStart] = '\0';
-
- LADSPADirectoryPluginSearch(pcBuffer, fCallbackFunction);
- free(pcBuffer);
+
+ LADSPADirectoryPluginSearch (pcBuffer, fCallbackFunction);
+ free (pcBuffer);
pcStart = pcEnd;
if (*pcStart == ':')