[Freeswitch-svn] [commit] r5084 - freeswitch/trunk/src/mod/languages/mod_mono

Freeswitch SVN mikej at freeswitch.org
Thu May 3 21:25:29 EDT 2007


Author: mikej
Date: Thu May  3 21:25:29 2007
New Revision: 5084

Modified:
   freeswitch/trunk/src/mod/languages/mod_mono/Makefile
   freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.c

Log:
fix mod_mono build. still needs some testing

Modified: freeswitch/trunk/src/mod/languages/mod_mono/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_mono/Makefile	(original)
+++ freeswitch/trunk/src/mod/languages/mod_mono/Makefile	Thu May  3 21:25:29 2007
@@ -8,7 +8,7 @@
 PKGCONFIG = pkg-config-0.21
 PKGCONFIG_DIR = $(switch_srcdir)/libs/$(PKGCONFIG)
 
-LOCAL_CFLAGS=`$(PREFIX)/bin/pkg-config --cflags mono`
+LOCAL_CFLAGS=-w `$(PREFIX)/bin/pkg-config --cflags mono`
 LOCAL_LDFLAGS=`$(PREFIX)/bin/pkg-config --libs mono`
 include ../../../../build/modmake.rules
 

Modified: freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.c	Thu May  3 21:25:29 2007
@@ -96,12 +96,10 @@
 	char *assembly_dir = (char *) switch_core_alloc(mono_pool, assembly_dir_len);
 	char *assembly_file = (char *) switch_core_alloc(mono_pool, assembly_file_len);
 
-	apr_finfo_t *assembly_finfo = (apr_finfo_t *) switch_core_alloc(mono_pool, sizeof(*assembly_finfo));
-
 	snprintf(assembly_dir, assembly_dir_len, "%s/%s", SWITCH_GLOBAL_dirs.base_dir, SWITCH_MONO_LIBDIR);
 	snprintf(assembly_file, assembly_file_len, "%s/%s%s", SWITCH_GLOBAL_dirs.base_dir, SWITCH_MONO_LIBDIR, SWITCH_MONO_ASSEMBLY);
 
-	if (apr_stat(assembly_finfo, assembly_file, 0, mono_pool) != SWITCH_STATUS_SUCCESS) {
+    if (switch_file_exists(assembly_file, mono_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not find FreeSwitch.NET assembly\n");
 		return SWITCH_STATUS_FALSE;
 	}
@@ -143,7 +141,7 @@
 
 	for (p = switch_hash_first(mono_pool, globals.plugins); p; p = switch_hash_next(p)) {
 		mono_plugin *plugin = (mono_plugin *) switch_core_alloc(mono_pool, sizeof(*plugin));
-		apr_ssize_t *key_length = NULL;
+		switch_ssize_t *key_length = NULL;
 		const void *key = NULL;
 		void *value = NULL;
 
@@ -177,19 +175,14 @@
  */
 switch_status_t mod_mono_load_modules(const char *module_dir)
 {
-	apr_finfo_t *module_finfo = (apr_finfo_t *) switch_core_alloc(mono_pool, sizeof(*module_finfo));
-
-	if (apr_stat(module_finfo, module_dir, 0, mono_pool) != SWITCH_STATUS_SUCCESS) {
+	if (switch_file_exists(module_dir, mono_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not access module dir!.\n");
 		return SWITCH_STATUS_FALSE;
 	}
 
-	apr_dir_t *module_dir_handle;
+	switch_dir_t *module_dir_handle;
 	char *file;
 	size_t len;
-	char *ptr;
-	apr_finfo_t finfo;
-	apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
 	const char *ext = ".dll";
 	const char *EXT = ".DLL";
 	MonoAssembly *assembly;
@@ -197,24 +190,15 @@
 	gpointer iter;
 	iter = NULL;
 	mono_plugin *plugin = NULL;
+    const char *fname = NULL;
 
-	if (apr_dir_open(&module_dir_handle, module_dir, mono_pool) != SWITCH_STATUS_SUCCESS)
+	if (switch_dir_open(&module_dir_handle, module_dir, mono_pool) != SWITCH_STATUS_SUCCESS)
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not open directory: %s\n", module_dir);
 
 	/* Read the modules directory */
-	while (apr_dir_read(&finfo, finfo_flags, module_dir_handle) == SWITCH_STATUS_SUCCESS) {
+	while ((fname = switch_dir_next_file(module_dir_handle))) {
 		assembly = (MonoAssembly *) switch_core_alloc(mono_pool, sizeof(assembly));
 		image = (MonoImage *) switch_core_alloc(mono_pool, sizeof(image));
-		const char *fname = finfo.fname;
-
-		if (finfo.filetype != APR_REG)
-			continue;
-
-		if (!fname)
-			fname = finfo.name;
-
-		if (!(ptr = (char *) fname))
-			continue;
 
 		if (!strstr(fname, ext) && !strstr(fname, EXT))
 			continue;



More information about the Freeswitch-svn mailing list