From dd45f3d599f76c882fc0f65136d14f3f9ed6633c Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 4 May 2007 01:25:29 +0000 Subject: [PATCH] fix mod_mono build. still needs some testing git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5084 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/languages/mod_mono/Makefile | 2 +- src/mod/languages/mod_mono/mod_mono.c | 30 +++++++-------------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/mod/languages/mod_mono/Makefile b/src/mod/languages/mod_mono/Makefile index 2d5c876231..2b6b04cf4e 100644 --- a/src/mod/languages/mod_mono/Makefile +++ b/src/mod/languages/mod_mono/Makefile @@ -8,7 +8,7 @@ GETTEXT_DIR = $(switch_srcdir)/libs/$(GETTEXT) 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 diff --git a/src/mod/languages/mod_mono/mod_mono.c b/src/mod/languages/mod_mono/mod_mono.c index c9de8e3a73..39783194f3 100755 --- a/src/mod/languages/mod_mono/mod_mono.c +++ b/src/mod/languages/mod_mono/mod_mono.c @@ -96,12 +96,10 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod 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 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod 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_MOD_DECLARE(switch_status_t) switch_module_shutdown(void) */ 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 @@ switch_status_t mod_mono_load_modules(const char *module_dir) 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;