From 64507e70cad12cce5b744ac70775a6b66417e3e9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 30 Mar 2006 23:02:50 +0000 Subject: [PATCH] icc changes part 1 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@982 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- Makefile.am | 3 - Makefile.in | 18 +- aclocal.m4 | 172 ++--- configure | 323 ++++++---- modules.conf.in | 24 +- src/include/switch.h | 1 - src/include/switch_apr.h | 68 ++ src/include/switch_buffer.h | 14 +- src/include/switch_channel.h | 16 +- src/include/switch_core.h | 32 +- src/include/switch_event.h | 2 +- src/include/switch_frame.h | 8 +- src/include/switch_ivr.h | 2 +- src/include/switch_loadable_module.h | 6 +- src/include/switch_module_interfaces.h | 30 +- src/include/switch_mutex.h | 114 ---- src/include/switch_platform.h | 4 + src/include/switch_resample.h | 10 +- src/include/switch_types.h | 6 +- .../applications/mod_ivrtest/mod_ivrtest.c | 2 +- src/mod/asr_tts/mod_cepstral/mod_cepstral.c | 11 +- src/mod/codecs/mod_g711/g711.c | 3 + src/mod/codecs/mod_g711/mod_g711.c | 4 +- src/mod/codecs/mod_gsm/mod_gsm.c | 4 +- src/mod/codecs/mod_speex/mod_speex.c | 2 +- .../mod_dialplan_demo/mod_dialplan_demo.c | 2 +- .../mod_dialplan_directory.c | 2 +- src/mod/dialplans/mod_pcre/mod_pcre.c | 2 +- src/mod/directories/mod_ldap/mod_ldap.c | 2 +- src/mod/endpoints/mod_exosip/mod_exosip.c | 30 +- src/mod/endpoints/mod_exosip/osip_rfc3264.c | 4 + src/mod/endpoints/mod_iax/mod_iax.c | 19 +- src/mod/endpoints/mod_portaudio/pablio.c | 4 + src/mod/endpoints/mod_portaudio/ringbuffer.c | 3 + src/mod/endpoints/mod_wanpipe/mod_wanpipe.c | 607 +++++++++--------- src/mod/endpoints/mod_woomera/mod_woomera.c | 43 +- .../mod_event_multicast/mod_event_multicast.c | 4 +- .../mod_event_test/mod_event_test.c | 1 - .../mod_xmpp_event/mod_xmpp_event.c | 12 +- .../mod_zeroconf/mod_zeroconf.c | 2 +- src/mod/formats/mod_sndfile/mod_sndfile.c | 10 +- src/mod/languages/mod_perl/Makefile | 2 +- src/mod/languages/mod_perl/mod_perl.c | 4 +- src/mod/languages/mod_perl/perlxsi.c | 19 + src/mod/languages/mod_perl/switch_swig.c | 12 +- .../mod_spidermonkey/mod_spidermonkey.c | 19 +- src/switch.c | 6 + src/switch_buffer.c | 36 +- src/switch_channel.c | 33 +- src/switch_console.c | 9 +- src/switch_core.c | 95 ++- src/switch_event.c | 27 +- src/switch_ivr.c | 45 +- src/switch_loadable_module.c | 68 +- src/switch_mutex.c | 58 -- src/switch_resample.c | 13 +- src/switch_utils.c | 31 +- 57 files changed, 1055 insertions(+), 1048 deletions(-) delete mode 100644 src/include/switch_mutex.h create mode 100644 src/mod/languages/mod_perl/perlxsi.c delete mode 100644 src/switch_mutex.c diff --git a/Makefile.am b/Makefile.am index 87dde60afd..61460482ca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,7 +57,6 @@ src/include/switch_frame.h\ src/include/switch_ivr.h\ src/include/switch_loadable_module.h\ src/include/switch_module_interfaces.h\ -src/include/switch_mutex.h\ src/include/switch_platform.h\ src/include/switch_resample.h\ src/include/switch_sqlite.h\ @@ -71,7 +70,6 @@ src/switch_config.c \ src/switch_console.c \ src/switch_core.c \ src/switch_loadable_module.c \ -src/switch_mutex.c \ src/switch_utils.c \ src/switch_event.c \ src/switch_resample.c \ @@ -97,7 +95,6 @@ src/include/switch_frame.h\ src/include/switch_ivr.h\ src/include/switch_loadable_module.h\ src/include/switch_module_interfaces.h\ -src/include/switch_mutex.h\ src/include/switch_platform.h\ src/include/switch_resample.h\ src/include/switch_sqlite.h\ diff --git a/Makefile.in b/Makefile.in index 293b4dced8..c8921d7ebf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -46,12 +46,10 @@ DIST_COMMON = README $(am__configure_deps) $(library_include_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/configure $(top_srcdir)/src/include/config.h.in \ $(top_srcdir)/src/include/switch_version.h.in AUTHORS COPYING \ - ChangeLog INSTALL NEWS TODO build/config/compile \ + ChangeLog INSTALL NEWS build/config/compile \ build/config/config.guess build/config/config.sub \ build/config/depcomp build/config/install-sh \ - build/config/ltmain.sh build/config/missing compile \ - config.guess config.sub depcomp install-sh ltmain.sh missing \ - mkinstalldirs + build/config/ltmain.sh build/config/missing mkinstalldirs subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in @@ -80,7 +78,6 @@ am_libfreeswitch_la_OBJECTS = libfreeswitch_la-switch_buffer.lo \ libfreeswitch_la-switch_console.lo \ libfreeswitch_la-switch_core.lo \ libfreeswitch_la-switch_loadable_module.lo \ - libfreeswitch_la-switch_mutex.lo \ libfreeswitch_la-switch_utils.lo \ libfreeswitch_la-switch_event.lo \ libfreeswitch_la-switch_resample.lo \ @@ -275,7 +272,6 @@ src/include/switch_frame.h\ src/include/switch_ivr.h\ src/include/switch_loadable_module.h\ src/include/switch_module_interfaces.h\ -src/include/switch_mutex.h\ src/include/switch_platform.h\ src/include/switch_resample.h\ src/include/switch_sqlite.h\ @@ -289,7 +285,6 @@ src/switch_config.c \ src/switch_console.c \ src/switch_core.c \ src/switch_loadable_module.c \ -src/switch_mutex.c \ src/switch_utils.c \ src/switch_event.c \ src/switch_resample.c \ @@ -314,7 +309,6 @@ src/include/switch_frame.h\ src/include/switch_ivr.h\ src/include/switch_loadable_module.h\ src/include/switch_module_interfaces.h\ -src/include/switch_mutex.h\ src/include/switch_platform.h\ src/include/switch_resample.h\ src/include/switch_sqlite.h\ @@ -468,7 +462,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_event.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_ivr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_loadable_module.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_mutex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_resample.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfreeswitch_la-switch_utils.Plo@am__quote@ @@ -542,13 +535,6 @@ libfreeswitch_la-switch_loadable_module.lo: src/switch_loadable_module.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_loadable_module.lo `test -f 'src/switch_loadable_module.c' || echo '$(srcdir)/'`src/switch_loadable_module.c -libfreeswitch_la-switch_mutex.lo: src/switch_mutex.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_mutex.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_mutex.Tpo" -c -o libfreeswitch_la-switch_mutex.lo `test -f 'src/switch_mutex.c' || echo '$(srcdir)/'`src/switch_mutex.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libfreeswitch_la-switch_mutex.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_mutex.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_mutex.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/switch_mutex.c' object='libfreeswitch_la-switch_mutex.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_mutex.lo `test -f 'src/switch_mutex.c' || echo '$(srcdir)/'`src/switch_mutex.c - libfreeswitch_la-switch_utils.lo: src/switch_utils.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_utils.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_utils.Tpo" -c -o libfreeswitch_la-switch_utils.lo `test -f 'src/switch_utils.c' || echo '$(srcdir)/'`src/switch_utils.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libfreeswitch_la-switch_utils.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_utils.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_utils.Tpo"; exit 1; fi diff --git a/aclocal.m4 b/aclocal.m4 index 42ac573159..e5da51da21 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -143,7 +143,7 @@ rm="rm -f" default_ofile=libtool can_build_shared=yes -# All known linkers require a `.a' archive for static linking (except M$VC, +# All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" @@ -359,8 +359,8 @@ if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string="`eval $cmd`") 2>/dev/null && - echo_test_string="`eval $cmd`" && + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break @@ -529,7 +529,7 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in + case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) @@ -611,7 +611,7 @@ AC_CACHE_CHECK([$1], [$2], # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) @@ -650,7 +650,7 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], LDFLAGS="$LDFLAGS $3" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized + # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. @@ -725,7 +725,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else - lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` @@ -737,7 +737,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 - # + # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; @@ -854,7 +854,7 @@ int main () }] EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; @@ -1003,7 +1003,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) @@ -1021,7 +1021,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi - chmod u+w . + chmod u+w . 2>&AS_MESSAGE_LOG_FD $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation @@ -1281,7 +1281,8 @@ cygwin* | mingw* | pw32*) dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' @@ -1334,7 +1335,7 @@ darwin* | rhapsody*) soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -1372,7 +1373,14 @@ kfreebsd*-gnu) freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) @@ -1417,7 +1425,7 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in + case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes @@ -1813,7 +1821,7 @@ AC_DEFUN([AC_LIBTOOL_DLOPEN], # AC_LIBTOOL_WIN32_DLL # -------------------- -# declare package support for building win32 dll's +# declare package support for building win32 DLLs AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_WIN32_DLL @@ -1987,7 +1995,7 @@ dnl not every word. This closes a longstanding sh security hole. if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then @@ -2097,7 +2105,7 @@ AC_CACHE_VAL(lt_cv_path_LD, if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. + # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null && - echo_test_string="`eval $cmd`" && + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break @@ -3462,7 +3462,7 @@ else if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. + # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. + # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 (exit $ac_status); }; then - case "`/usr/bin/file conftest.o`" in + case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) @@ -5588,7 +5588,7 @@ else elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else - lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` @@ -5903,7 +5903,7 @@ rm="rm -f" default_ofile=libtool can_build_shared=yes -# All known linkers require a `.a' archive for static linking (except M$VC, +# All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" @@ -6224,7 +6224,7 @@ else if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then @@ -6286,7 +6286,7 @@ else if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then @@ -6435,7 +6435,7 @@ else LDFLAGS="$LDFLAGS $lt_prog_compiler_static" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized + # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. @@ -6486,7 +6486,7 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:6492: $lt_compile\"" >&5) @@ -6576,7 +6576,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -6623,7 +6623,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -6653,12 +6653,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-static' + lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' @@ -6748,7 +6748,7 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:6754: $lt_compile\"" >&5) @@ -6782,7 +6782,7 @@ else fi fi -case "$host_os" in +case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= @@ -6810,7 +6810,7 @@ else # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:6816: $lt_compile\"" >&5) @@ -6828,7 +6828,7 @@ else lt_cv_prog_compiler_c_o=yes fi fi - chmod u+w . + chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation @@ -7028,11 +7028,11 @@ EOF tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -7340,7 +7340,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec=' ' archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds it's shared libraries. + # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi @@ -7380,7 +7380,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - case "$host_os" in + case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag='${wl}-undefined ${wl}suppress' ;; @@ -7409,7 +7409,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi output_verbose_link_cmd='echo' archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else @@ -7418,7 +7418,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; @@ -7484,7 +7484,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10* | hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; @@ -7493,7 +7493,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; esac else - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' ;; @@ -7503,7 +7503,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac fi if test "$with_gnu_ld" = no; then - case "$host_cpu" in + case $host_cpu in hppa*64*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' @@ -7962,7 +7962,8 @@ cygwin* | mingw* | pw32*) dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' @@ -8015,7 +8016,7 @@ darwin* | rhapsody*) soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -8053,7 +8054,14 @@ kfreebsd*-gnu) freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) @@ -8098,7 +8106,7 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in + case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes @@ -9053,7 +9061,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null + (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; @@ -9151,7 +9159,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null + (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; @@ -9267,7 +9275,7 @@ test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. -case "$host_os" in +case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then @@ -9870,7 +9878,7 @@ postdeps_CXX= compiler_lib_search_path_CXX= # Source file extension for C++ test sources. -ac_ext=cc +ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o @@ -10006,7 +10014,7 @@ else if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. + # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. + # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 # The `*' in the case matches for architectures that use `case' in # $output_verbose_cmd can trigger glob expansion during the loop # eval without this substitution. - output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` for p in `eval $output_verbose_link_cmd`; do case $p in @@ -11097,6 +11098,20 @@ fi $rm -f confest.$objext +# PORTME: override above test on systems where it is broken +case $host_os in +solaris*) + case $cc_basename in + CC*) + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + postdeps_CXX='-lCstd -lCrun' + ;; + esac +esac + + case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac @@ -11152,7 +11167,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) ;; *) @@ -11221,7 +11236,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -11262,7 +11277,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' - lt_prog_compiler_static_CXX='-static' + lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ @@ -11396,14 +11411,14 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11402: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11417: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11406: \$? = $ac_status" >&5 + echo "$as_me:11421: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11430,7 +11445,7 @@ else fi fi -case "$host_os" in +case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= @@ -11458,14 +11473,14 @@ else # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11464: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11479: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11468: \$? = $ac_status" >&5 + echo "$as_me:11483: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11476,7 +11491,7 @@ else lt_cv_prog_compiler_c_o_CXX=yes fi fi - chmod u+w . + chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation @@ -11739,7 +11754,8 @@ cygwin* | mingw* | pw32*) dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' @@ -11792,7 +11808,7 @@ darwin* | rhapsody*) soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -11830,7 +11846,14 @@ kfreebsd*-gnu) freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) @@ -11875,7 +11898,7 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in + case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes @@ -12830,7 +12853,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null + (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; @@ -12928,7 +12951,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null + (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; @@ -13550,7 +13573,7 @@ test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. -case "$host_os" in +case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then @@ -13638,7 +13661,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -13685,7 +13708,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_wl_F77='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -13715,12 +13738,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fpic' - lt_prog_compiler_static_F77='-static' + lt_prog_compiler_static_F77='-Bstatic' ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' @@ -13810,14 +13833,14 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13816: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13839: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13820: \$? = $ac_status" >&5 + echo "$as_me:13843: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13844,7 +13867,7 @@ else fi fi -case "$host_os" in +case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= @@ -13872,14 +13895,14 @@ else # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13878: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13901: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13882: \$? = $ac_status" >&5 + echo "$as_me:13905: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13890,7 +13913,7 @@ else lt_cv_prog_compiler_c_o_F77=yes fi fi - chmod u+w . + chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation @@ -14090,11 +14113,11 @@ EOF tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -14382,7 +14405,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77=' ' archive_cmds_need_lc_F77=yes - # This is similar to how AIX traditionally builds it's shared libraries. + # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi @@ -14422,7 +14445,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - case "$host_os" in + case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' ;; @@ -14451,7 +14474,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi output_verbose_link_cmd='echo' archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else @@ -14460,7 +14483,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; @@ -14526,7 +14549,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10* | hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; @@ -14535,7 +14558,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; esac else - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' ;; @@ -14545,7 +14568,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac fi if test "$with_gnu_ld" = no; then - case "$host_cpu" in + case $host_cpu in hppa*64*) hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld_F77='+b $libdir' @@ -15004,7 +15027,8 @@ cygwin* | mingw* | pw32*) dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' @@ -15057,7 +15081,7 @@ darwin* | rhapsody*) soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -15095,7 +15119,14 @@ kfreebsd*-gnu) freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) @@ -15140,7 +15171,7 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in + case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes @@ -15994,14 +16025,14 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16000: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16031: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16004: \$? = $ac_status" >&5 + echo "$as_me:16035: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16084,7 +16115,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -16131,7 +16162,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_wl_GCJ='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -16161,12 +16192,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-fpic' - lt_prog_compiler_static_GCJ='-static' + lt_prog_compiler_static_GCJ='-Bstatic' ;; ccc*) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16256,14 +16287,14 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16262: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16293: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16266: \$? = $ac_status" >&5 + echo "$as_me:16297: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16290,7 +16321,7 @@ else fi fi -case "$host_os" in +case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_GCJ= @@ -16318,14 +16349,14 @@ else # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16324: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16355: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16328: \$? = $ac_status" >&5 + echo "$as_me:16359: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16336,7 +16367,7 @@ else lt_cv_prog_compiler_c_o_GCJ=yes fi fi - chmod u+w . + chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation @@ -16536,11 +16567,11 @@ EOF tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -16848,7 +16879,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_GCJ=' ' archive_cmds_need_lc_GCJ=yes - # This is similar to how AIX traditionally builds it's shared libraries. + # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi @@ -16888,7 +16919,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - case "$host_os" in + case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' ;; @@ -16917,7 +16948,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else @@ -16926,7 +16957,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; @@ -16992,7 +17023,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux10* | hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; @@ -17001,7 +17032,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; esac else - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' ;; @@ -17011,7 +17042,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac fi if test "$with_gnu_ld" = no; then - case "$host_cpu" in + case $host_cpu in hppa*64*) hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' @@ -17470,7 +17501,8 @@ cygwin* | mingw* | pw32*) dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' @@ -17523,7 +17555,7 @@ darwin* | rhapsody*) soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -17561,7 +17593,14 @@ kfreebsd*-gnu) freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) @@ -17606,7 +17645,7 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in + case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes @@ -18561,7 +18600,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null + (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; @@ -18659,7 +18698,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null + (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; diff --git a/modules.conf.in b/modules.conf.in index 3e50d90251..39bde8d252 100644 --- a/modules.conf.in +++ b/modules.conf.in @@ -1,28 +1,30 @@ applications/mod_bridgecall -applications/mod_playback +applications/mod_echo #applications/mod_ivrtest +applications/mod_playback #applications/mod_skel -codecs/mod_gsm +#asr_tts/mod_cepstral codecs/mod_g711 +#codecs/mod_g729 +codecs/mod_gsm +#codecs/mod_ilbc codecs/mod_l16 #codecs/mod_speex dialplans/mod_dialplan_demo +#dialplans/mod_dialplan_directory +dialplans/mod_pcre +#directories/mod_ldap endpoints/mod_exosip endpoints/mod_iax #endpoints/mod_opal #endpoints/mod_portaudio #endpoints/mod_wanpipe #endpoints/mod_woomera +#event_handlers/mod_event_multicast #event_handlers/mod_event_test #event_handlers/mod_xmpp_event -formats/mod_sndfile -timers/mod_softtimer -dialplans/mod_pcre -#directories/mod_ldap -#dialplans/mod_dialplan_directory #event_handlers/mod_zeroconf -#asr_tts/mod_cepstral -#languages/mod_spidermonkey +formats/mod_sndfile #languages/mod_perl - - +#languages/mod_spidermonkey +timers/mod_softtimer diff --git a/src/include/switch.h b/src/include/switch.h index 16d698e871..f8551332a9 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -57,7 +57,6 @@ extern "C" { #include #include #include -#include #include #include #include diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index d548bda828..2ad916766f 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -1342,6 +1342,74 @@ DoxyDefine(apr_status_t switch_queue_trypop(switch_queue_t *queue, void **data); DoxyDefine(apr_status_t switch_queue_trypush(switch_queue_t *queue, void *data);) #define switch_queue_trypush apr_queue_trypush +/** + * @defgroup switch_thread_mutex Thread Mutex Routines + * @ingroup switch_apr + * @{ + */ + +/** Opaque thread-local mutex structure */ +typedef apr_thread_mutex_t switch_mutex_t; + +/** Lock Flags */ + +#define SWITCH_MUTEX_DEFAULT APR_THREAD_MUTEX_DEFAULT /**< platform-optimal lock behavior */ +#define SWITCH_MUTEX_NESTED APR_THREAD_MUTEX_NESTED /**< enable nested (recursive) locks */ +#define SWITCH_MUTEX_UNNESTED APR_THREAD_MUTEX_UNNESTED /**< disable nested locks */ + + +/** + * Create and initialize a mutex that can be used to synchronize threads. + * @param lock the memory address where the newly created mutex will be + * stored. + * @param flags Or'ed value of: + *
+ *           SWITCH_THREAD_MUTEX_DEFAULT   platform-optimal lock behavior.
+ *           SWITCH_THREAD_MUTEX_NESTED    enable nested (recursive) locks.
+ *           SWITCH_THREAD_MUTEX_UNNESTED  disable nested locks (non-recursive).
+ * 
+ * @param pool the pool from which to allocate the mutex. + * @warning Be cautious in using SWITCH_THREAD_MUTEX_DEFAULT. While this is the + * most optimial mutex based on a given platform's performance charateristics, + * it will behave as either a nested or an unnested lock. + * +SWITCH_DECLARE(switch_status) switch_mutex_init(switch_mutex_t **lock, + switch_lock_flag flags, + switch_memory_pool *pool); +*/ +#define switch_mutex_init apr_thread_mutex_create +/** + * Destroy the mutex and free the memory associated with the lock. + * @param lock the mutex to destroy. + */ +//SWITCH_DECLARE(switch_status) switch_mutex_destroy(switch_mutex_t *lock); +#define switch_mutex_destroy apr_thread_mutex_destroy + +/** + * Acquire the lock for the given mutex. If the mutex is already locked, + * the current thread will be put to sleep until the lock becomes available. + * @param lock the mutex on which to acquire the lock. + */ +//SWITCH_DECLARE(switch_status) switch_mutex_lock(switch_mutex_t *lock); +#define switch_mutex_lock apr_thread_mutex_lock + +/** + * Release the lock for the given mutex. + * @param lock the mutex from which to release the lock. + */ +//SWITCH_DECLARE(switch_status) switch_mutex_unlock(switch_mutex_t *lock); +#define switch_mutex_unlock apr_thread_mutex_unlock + +/** + * Attempt to acquire the lock for the given mutex. If the mutex has already + * been acquired, the call returns immediately with APR_EBUSY. Note: it + * is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine + * if the return value was APR_EBUSY, for portability reasons. + * @param lock the mutex on which to attempt the lock acquiring. + */ +//SWITCH_DECLARE(switch_status) switch_mutex_trylock(switch_mutex_t *lock); +#define switch_mutex_trylock apr_thread_mutex_trylock + /** @} */ /** @} */ diff --git a/src/include/switch_buffer.h b/src/include/switch_buffer.h index fd0366ef16..64fbf74543 100644 --- a/src/include/switch_buffer.h +++ b/src/include/switch_buffer.h @@ -62,25 +62,25 @@ struct switch_buffer; * \param max_len length required by the buffer * \return status */ -SWITCH_DECLARE(switch_status) switch_buffer_create(switch_memory_pool *pool, switch_buffer **buffer, size_t max_len); +SWITCH_DECLARE(switch_status) switch_buffer_create(switch_memory_pool *pool, switch_buffer **buffer, switch_size_t max_len); /*! \brief Get the length of a switch_buffer * \param buffer any buffer of type switch_buffer * \return int size of the buffer. */ -SWITCH_DECLARE(int) switch_buffer_len(switch_buffer *buffer); +SWITCH_DECLARE(switch_size_t) switch_buffer_len(switch_buffer *buffer); /*! \brief Get the freespace of a switch_buffer * \param buffer any buffer of type switch_buffer * \return int freespace in the buffer. */ -SWITCH_DECLARE(int) switch_buffer_freespace(switch_buffer *buffer); +SWITCH_DECLARE(switch_size_t) switch_buffer_freespace(switch_buffer *buffer); /*! \brief Get the in use amount of a switch_buffer * \param buffer any buffer of type switch_buffer * \return int ammount of buffer curently in use */ -SWITCH_DECLARE(size_t) switch_buffer_inuse(switch_buffer *buffer); +SWITCH_DECLARE(switch_size_t) switch_buffer_inuse(switch_buffer *buffer); /*! \brief Read data from a switch_buffer up to the ammount of datalen if it is available. Remove read data from buffer. * \param buffer any buffer of type switch_buffer @@ -88,7 +88,7 @@ SWITCH_DECLARE(size_t) switch_buffer_inuse(switch_buffer *buffer); * \param datalen amount of data to be returned * \return int ammount of data actually read */ -SWITCH_DECLARE(int) switch_buffer_read(switch_buffer *buffer, void *data, size_t datalen); +SWITCH_DECLARE(switch_size_t) switch_buffer_read(switch_buffer *buffer, void *data, switch_size_t datalen); /*! \brief Write data into a switch_buffer up to the length of datalen * \param buffer any buffer of type switch_buffer @@ -96,14 +96,14 @@ SWITCH_DECLARE(int) switch_buffer_read(switch_buffer *buffer, void *data, size_t * \param datalen amount of data to be written * \return int amount of buffer used after the write, or 0 if no space available */ -SWITCH_DECLARE(int) switch_buffer_write(switch_buffer *buffer, void *data, size_t datalen); +SWITCH_DECLARE(switch_size_t) switch_buffer_write(switch_buffer *buffer, void *data, switch_size_t datalen); /*! \brief Remove data from the buffer * \param buffer any buffer of type switch_buffer * \param datalen amount of data to be removed * \return int size of buffer, or 0 if unable to toss that much data */ -SWITCH_DECLARE(int) switch_buffer_toss(switch_buffer *buffer, size_t datalen); +SWITCH_DECLARE(switch_size_t) switch_buffer_toss(switch_buffer *buffer, switch_size_t datalen); /*! \brief Remove all data from the buffer * \param buffer any buffer of type switch_buffer diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 762f610708..417edfe979 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -105,7 +105,7 @@ SWITCH_DECLARE(switch_status) switch_channel_alloc(switch_channel **channel, swi SWITCH_DECLARE(switch_status) switch_channel_init(switch_channel *channel, switch_core_session *session, switch_channel_state state, - switch_channel_flag flags); + uint32_t flags); /*! \brief Set the given channel's caller profile @@ -192,25 +192,23 @@ SWITCH_DECLARE(switch_caller_extension *) switch_channel_get_caller_extension(sw \brief Test for presence of given flag(s) on a given channel \param channel channel to test \param flags or'd list of channel flags to test - \return SWITCH_STATUS_SUCCESS if provided flags are set + \return TRUE if flags were present */ -SWITCH_DECLARE(switch_status) switch_channel_test_flag(switch_channel *channel, int flags); +SWITCH_DECLARE(int) switch_channel_test_flag(switch_channel *channel, switch_channel_flag flags); /*! \brief Set given flag(s) on a given channel \param channel channel on which to set flag(s) \param flags or'd list of flags to set - \return SWITCH_STATUS_SUCCESS if flags were set */ -SWITCH_DECLARE(switch_status) switch_channel_set_flag(switch_channel *channel, int flags); +SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel *channel, switch_channel_flag flags); /*! \brief Clear given flag(s) from a channel \param channel channel to clear flags from \param flags or'd list of flags to clear - \return SWITCH_STATUS_SUCCESS if flags were cleared */ -SWITCH_DECLARE(switch_status) switch_channel_clear_flag(switch_channel *channel, int flags); +SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel *channel, switch_channel_flag flags); /*! \brief Answer a channel (initiate/acknowledge a successful connection) @@ -284,7 +282,7 @@ SWITCH_DECLARE(switch_channel_state) switch_channel_hangup(switch_channel *chann \param channel channel to test \return number of digits in the queue */ -SWITCH_DECLARE(size_t) switch_channel_has_dtmf(switch_channel *channel); +SWITCH_DECLARE(switch_size_t) switch_channel_has_dtmf(switch_channel *channel); /*! \brief Queue DTMF on a given channel @@ -301,7 +299,7 @@ SWITCH_DECLARE(switch_status) switch_channel_queue_dtmf(switch_channel *channel, \param len max size in bytes of the buffer \return number of bytes read into the buffer */ -SWITCH_DECLARE(int) switch_channel_dequeue_dtmf(switch_channel *channel, char *dtmf, size_t len); +SWITCH_DECLARE(int) switch_channel_dequeue_dtmf(switch_channel *channel, char *dtmf, switch_size_t len); /*! \brief Render the name of the provided state enum diff --git a/src/include/switch_core.h b/src/include/switch_core.h index ec8d6d3c8a..8f2ea5a58c 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -59,22 +59,22 @@ struct switch_core_session_message { /*! optional string arg*/ char *string_arg; /*! optional string arg*/ - size_t string_arg_size; + switch_size_t string_arg_size; /*! optional arbitrary pointer arg */ void *pointer_arg; /*! optional arbitrary pointer arg's size */ - size_t pointer_arg_size; + switch_size_t pointer_arg_size; /*! optional numeric reply*/ int numeric_reply; /*! optional string reply*/ char *string_reply; /*! optional string reply*/ - size_t string_reply_size; + switch_size_t string_reply_size; /*! optional arbitrary pointer reply */ void *pointer_reply; /*! optional arbitrary pointer reply's size */ - size_t pointer_reply_size; + switch_size_t pointer_reply_size; }; @@ -169,7 +169,7 @@ SWITCH_DECLARE(unsigned int) switch_core_session_runing(switch_core_session *ses \return a void pointer to the allocated memory \note this memory never goes out of scope until the core is destroyed */ -SWITCH_DECLARE(void *) switch_core_permenant_alloc(size_t memory); +SWITCH_DECLARE(void *) switch_core_permenant_alloc(switch_size_t memory); /*! \brief Allocate memory directly from a memory pool @@ -177,7 +177,7 @@ SWITCH_DECLARE(void *) switch_core_permenant_alloc(size_t memory); \param memory the number of bytes to allocate \return a void pointer to the allocated memory */ -SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool *pool, size_t memory); +SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool *pool, switch_size_t memory); /*! \brief Allocate memory from a session's pool @@ -186,7 +186,7 @@ SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool *pool, size_t memory \return a void pointer to the newly allocated memory \note the memory will be in scope as long as the session exists */ -SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session *session, size_t memory); +SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session *session, switch_size_t memory); /*! \brief Copy a string using permenant memory allocation @@ -610,7 +610,7 @@ SWITCH_DECLARE(switch_status) switch_core_codec_init(switch_codec *codec, int rate, int ms, int channels, - switch_codec_flag flags, + uint32_t flags, const switch_codec_settings *codec_settings, switch_memory_pool *pool); @@ -631,10 +631,10 @@ SWITCH_DECLARE(switch_status) switch_core_codec_init(switch_codec *codec, SWITCH_DECLARE(switch_status) switch_core_codec_encode(switch_codec *codec, switch_codec *other_codec, void *decoded_data, - size_t decoded_data_len, + switch_size_t decoded_data_len, int decoded_rate, void *encoded_data, - size_t *encoded_data_len, + switch_size_t *encoded_data_len, int *encoded_rate, unsigned int *flag); @@ -655,10 +655,10 @@ SWITCH_DECLARE(switch_status) switch_core_codec_encode(switch_codec *codec, SWITCH_DECLARE(switch_status) switch_core_codec_decode(switch_codec *codec, switch_codec *other_codec, void *encoded_data, - size_t encoded_data_len, + switch_size_t encoded_data_len, int encoded_rate, void *decoded_data, - size_t *decoded_data_len, + switch_size_t *decoded_data_len, int *decoded_rate, unsigned int *flag); @@ -739,7 +739,7 @@ SWITCH_DECLARE(switch_status) switch_core_file_open(switch_file_handle *fh, char \param len the max size of the buffer \return SWITCH_STATUS_SUCCESS with len adjusted to the bytes read if successful */ -SWITCH_DECLARE(switch_status) switch_core_file_read(switch_file_handle *fh, void *data, size_t *len); +SWITCH_DECLARE(switch_status) switch_core_file_read(switch_file_handle *fh, void *data, switch_size_t *len); /*! \brief Write media to a file handle @@ -748,7 +748,7 @@ SWITCH_DECLARE(switch_status) switch_core_file_read(switch_file_handle *fh, void \param len the amount of data to write from the buffer \return SWITCH_STATUS_SUCCESS with len adjusted to the bytes written if successful */ -SWITCH_DECLARE(switch_status) switch_core_file_write(switch_file_handle *fh, void *data, size_t *len); +SWITCH_DECLARE(switch_status) switch_core_file_write(switch_file_handle *fh, void *data, switch_size_t *len); /*! \brief Seek a position in a file @@ -829,8 +829,8 @@ SWITCH_DECLARE(switch_status) switch_core_speech_feed_tts(switch_speech_handle * */ SWITCH_DECLARE(switch_status) switch_core_speech_read_tts(switch_speech_handle *sh, void *data, - size_t *datalen, - size_t *rate, + switch_size_t *datalen, + switch_size_t *rate, switch_speech_flag *flags); /*! \brief Close an open speech handle diff --git a/src/include/switch_event.h b/src/include/switch_event.h index 13da936886..4a5bf052aa 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -229,7 +229,7 @@ SWITCH_DECLARE(switch_status) switch_event_reserve_subclass_detailed(char *owner \return SWITCH_STATUS_SUCCESS if the operation was successful \note the body supplied by this function will supersede an existing body the event may have */ -SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *buf, size_t buflen, char *fmt, ...); +SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *buf, switch_size_t buflen, char *fmt, ...); /*! \brief Determine if the event system has been initilized diff --git a/src/include/switch_frame.h b/src/include/switch_frame.h index d269cee927..39714c9fe2 100644 --- a/src/include/switch_frame.h +++ b/src/include/switch_frame.h @@ -49,13 +49,15 @@ struct switch_frame { /*! the frame data */ void *data; /*! the size of the buffer that is in use */ - size_t datalen; + switch_size_t datalen; /*! the entire size of the buffer */ - size_t buflen; + switch_size_t buflen; /*! the number of audio samples present (audio only) */ - size_t samples; + switch_size_t samples; /*! the rate of the frame */ int rate; + /*! the timestamp of the frame */ + int32_t timestamp; }; #ifdef __cplusplus diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index cf602edd75..a44626ceed 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -144,7 +144,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session char *tts_name, char *voice_name, char *timer_name, - size_t rate, + switch_size_t rate, switch_dtmf_callback_function dtmf_callback, char *text, void *buf, diff --git a/src/include/switch_loadable_module.h b/src/include/switch_loadable_module.h index 1d0277b704..2c7c3fc90f 100644 --- a/src/include/switch_loadable_module.h +++ b/src/include/switch_loadable_module.h @@ -165,7 +165,6 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool *pool, /*! \brief Retrieve the list of loaded codecs into an array based on another array showing the sorted order - \param pool the memory pool to use for the hash index \param array the array to populate \param arraylen the max size in elements of the array \param prefs the array of preferred codec names @@ -173,8 +172,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool *pool, \return the number of elements added to the array \note this function only considers codecs that are listed in the "prefs" array and ignores the rest. */ -SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(switch_memory_pool *pool, - switch_codec_interface **array, +SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(switch_codec_interface **array, int arraylen, char **prefs, int preflen); @@ -187,7 +185,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(switch_memory_pool \param len the length in bytes of retbuf \return the status returned by the API call */ -SWITCH_DECLARE(switch_status) switch_api_execute(char *cmd, char *arg, char *retbuf, size_t len); +SWITCH_DECLARE(switch_status) switch_api_execute(char *cmd, char *arg, char *retbuf, switch_size_t len); /* Prototypes of module interface functions */ diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index aac4b07d7d..e3827175dc 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -197,7 +197,7 @@ struct switch_timer { /*! time interval expressed in milliseconds */ int interval; /*! flags to control behaviour */ - unsigned int flags; + uint32_t flags; /*! sample count to increment by on each cycle */ unsigned int samples; /*! current sample count based on samples parameter */ @@ -241,9 +241,9 @@ struct switch_file_interface { /*! function to close the file */ switch_status (*file_close)(switch_file_handle *); /*! function to read from the file */ - switch_status (*file_read)(switch_file_handle *, void *data, size_t *len); + switch_status (*file_read)(switch_file_handle *, void *data, switch_size_t *len); /*! function to write from the file */ - switch_status (*file_write)(switch_file_handle *, void *data, size_t *len); + switch_status (*file_write)(switch_file_handle *, void *data, switch_size_t *len); /*! function to seek to a certian position in the file */ switch_status (*file_seek)(switch_file_handle *, unsigned int *cur_pos, int64_t samples, int whence); /*! list of supported file extensions */ @@ -256,7 +256,7 @@ struct switch_file_handle { /*! the interface of the module that implemented the current file type */ const struct switch_file_interface *file_interface; /*! flags to control behaviour */ - unsigned int flags; + uint32_t flags; /*! a file descriptor if neceessary */ switch_file_t *fd; /*! samples position of the handle */ @@ -304,8 +304,8 @@ struct switch_speech_interface { /*! function to read audio from the TTS*/ switch_status (*speech_read_tts)(switch_speech_handle *sh, void *data, - size_t *datalen, - size_t *rate, + switch_size_t *datalen, + switch_size_t *rate, switch_speech_flag *flags); const struct switch_speech_interface *next; @@ -317,7 +317,7 @@ struct switch_speech_handle { /*! the interface of the module that implemented the current speech interface */ const struct switch_speech_interface *speech_interface; /*! flags to control behaviour */ - unsigned int flags; + uint32_t flags; /*! the handle's memory pool */ switch_memory_pool *memory_pool; @@ -350,7 +350,7 @@ struct switch_directory_handle { /*! the interface of the module that implemented the current directory interface */ const struct switch_directory_interface *directory_interface; /*! flags to control behaviour */ - unsigned int flags; + uint32_t flags; /*! the handle's memory pool */ switch_memory_pool *memory_pool; @@ -405,7 +405,7 @@ struct switch_codec { /*! codec settings for this handle */ struct switch_codec_settings codec_settings; /*! flags to modify behaviour */ - switch_codec_flag flags; + uint32_t flags; /*! the handle's memory pool*/ switch_memory_pool *memory_pool; /*! private data for the codec module to store handle specific info */ @@ -423,7 +423,7 @@ struct switch_codec_implementation { /*! number of samples that denote one frame */ int samples_per_frame; /*! number of bytes that denote one frame decompressed */ - size_t bytes_per_frame; + switch_size_t bytes_per_frame; /*! number of bytes that denote one frame compressed */ int encoded_bytes_per_frame; /*! number of channels represented */ @@ -433,25 +433,25 @@ struct switch_codec_implementation { /*! max number of frames to send in one network packet */ int max_frames_per_packet; /*! function to initialize a codec handle using this implementation */ - switch_status (*init)(switch_codec *, switch_codec_flag, const switch_codec_settings *codec_settings); + switch_status (*init)(switch_codec *, uint32_t, const switch_codec_settings *codec_settings); /*! function to encode raw data into encoded data */ switch_status (*encode)(switch_codec *codec, switch_codec *other_codec, void *decoded_data, - size_t decoded_data_len, + switch_size_t decoded_data_len, int decoded_rate, void *encoded_data, - size_t *encoded_data_len, + switch_size_t *encoded_data_len, int *encoded_rate, unsigned int *flag); /*! function to decode encoded data into raw data */ switch_status (*decode)(switch_codec *codec, switch_codec *other_codec, void *encoded_data, - size_t encoded_data_len, + switch_size_t encoded_data_len, int encoded_rate, void *decoded_data, - size_t *decoded_data_len, + switch_size_t *decoded_data_len, int *decoded_rate, unsigned int *flag); /*! deinitalize a codec handle using this implementation */ diff --git a/src/include/switch_mutex.h b/src/include/switch_mutex.h deleted file mode 100644 index 3f94f5bd47..0000000000 --- a/src/include/switch_mutex.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II - * - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * - * The Initial Developer of the Original Code is - * Anthony Minessale II - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II - * - * - * switch_mutex.h -- Mutex Locking - * - */ -/*! \file switch_mutex.h - \brief Mutex Locking -*/ - -#ifndef SWITCH_MUTEX_H -#define SWITCH_MUTEX_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** - * @defgroup switch_thread_mutex Thread Mutex Routines - * @ingroup switch_apr - * @{ - */ - -/** Opaque thread-local mutex structure */ -typedef apr_thread_mutex_t switch_mutex_t; - -/** Lock Flags */ -typedef enum { - SWITCH_MUTEX_DEFAULT = APR_THREAD_MUTEX_DEFAULT /**< platform-optimal lock behavior */, - SWITCH_MUTEX_NESTED = APR_THREAD_MUTEX_NESTED /**< enable nested (recursive) locks */, - SWITCH_MUTEX_UNNESTED = APR_THREAD_MUTEX_UNNESTED /**< disable nested locks */ -} switch_lock_flag; - -/** - * Create and initialize a mutex that can be used to synchronize threads. - * @param lock the memory address where the newly created mutex will be - * stored. - * @param flags Or'ed value of: - *
- *           SWITCH_THREAD_MUTEX_DEFAULT   platform-optimal lock behavior.
- *           SWITCH_THREAD_MUTEX_NESTED    enable nested (recursive) locks.
- *           SWITCH_THREAD_MUTEX_UNNESTED  disable nested locks (non-recursive).
- * 
- * @param pool the pool from which to allocate the mutex. - * @warning Be cautious in using SWITCH_THREAD_MUTEX_DEFAULT. While this is the - * most optimial mutex based on a given platform's performance charateristics, - * it will behave as either a nested or an unnested lock. - */ -SWITCH_DECLARE(switch_status) switch_mutex_init(switch_mutex_t **lock, - switch_lock_flag flags, - switch_memory_pool *pool); - -/** - * Destroy the mutex and free the memory associated with the lock. - * @param lock the mutex to destroy. - */ -SWITCH_DECLARE(switch_status) switch_mutex_destroy(switch_mutex_t *lock); - -/** - * Acquire the lock for the given mutex. If the mutex is already locked, - * the current thread will be put to sleep until the lock becomes available. - * @param lock the mutex on which to acquire the lock. - */ -SWITCH_DECLARE(switch_status) switch_mutex_lock(switch_mutex_t *lock); - -/** - * Release the lock for the given mutex. - * @param lock the mutex from which to release the lock. - */ -SWITCH_DECLARE(switch_status) switch_mutex_unlock(switch_mutex_t *lock); - -/** - * Attempt to acquire the lock for the given mutex. If the mutex has already - * been acquired, the call returns immediately with APR_EBUSY. Note: it - * is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine - * if the return value was APR_EBUSY, for portability reasons. - * @param lock the mutex on which to attempt the lock acquiring. - */ -SWITCH_DECLARE(switch_status) switch_mutex_trylock(switch_mutex_t *lock); - -/** @} */ -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h index f9234da415..4f62832be8 100644 --- a/src/include/switch_platform.h +++ b/src/include/switch_platform.h @@ -38,6 +38,10 @@ extern "C" { #endif +#ifdef __ICC +#pragma warning (disable:810 869 981 279 1469) +#endif + #ifdef _MSC_VER #ifndef FREESWITCHCORE_EXPORTS diff --git a/src/include/switch_resample.h b/src/include/switch_resample.h index 4cf8f00149..6b1779d429 100644 --- a/src/include/switch_resample.h +++ b/src/include/switch_resample.h @@ -63,13 +63,13 @@ struct switch_audio_resampler { /*! the size of the from buffer used */ int from_len; /*! the total size of the from buffer */ - size_t from_size; + switch_size_t from_size; /*! a pointer to store a float buffer for resampled data */ float *to; /*! the size of the to buffer used */ int to_len; /*! the total size of the to buffer */ - size_t to_size; + switch_size_t to_size; }; /*! @@ -84,9 +84,9 @@ struct switch_audio_resampler { */ SWITCH_DECLARE(switch_status) switch_resample_create(switch_audio_resampler **new_resampler, int from_rate, - size_t from_size, + switch_size_t from_size, int to_rate, - size_t to_size, + switch_size_t to_size, switch_memory_pool *pool); /*! @@ -114,7 +114,7 @@ SWITCH_DECLARE(int) switch_resample_process(switch_audio_resampler *resampler, f \param len the length of the buffers \return the size of the converted buffer */ -SWITCH_DECLARE(size_t) switch_float_to_short(float *f, short *s, size_t len); +SWITCH_DECLARE(switch_size_t) switch_float_to_short(float *f, short *s, switch_size_t len); /*! \brief Convert an array of chars to an array of floats diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 2a023541ae..c6de5e0b7e 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -36,6 +36,9 @@ #ifdef __cplusplus extern "C" { +#ifdef _FORMATBUG +} +#endif #endif #include @@ -426,7 +429,6 @@ typedef enum { SWITCH_EVENT_ALL } switch_event_t; - typedef struct switch_core_session_message switch_core_session_message; typedef struct switch_audio_resampler switch_audio_resampler; typedef struct switch_event_header switch_event_header; @@ -486,7 +488,7 @@ typedef switch_status (*switch_kill_channel_hook)(switch_core_session *, int); typedef switch_status (*switch_waitfor_read_hook)(switch_core_session *, int, int); typedef switch_status (*switch_waitfor_write_hook)(switch_core_session *, int, int); typedef switch_status (*switch_send_dtmf_hook)(switch_core_session *, char *); -typedef switch_status (*switch_api_function)(char *in, char *out, size_t outlen); +typedef switch_status (*switch_api_function)(char *in, char *out, switch_size_t outlen); typedef switch_status (*switch_dtmf_callback_function)(switch_core_session *session, char *dtmf, void *buf, unsigned int buflen); typedef int (*switch_core_db_callback_func)(void *pArg, int argc, char **argv, char **columnNames); diff --git a/src/mod/applications/mod_ivrtest/mod_ivrtest.c b/src/mod/applications/mod_ivrtest/mod_ivrtest.c index 4c5fdc3f15..aca949d6cc 100644 --- a/src/mod/applications/mod_ivrtest/mod_ivrtest.c +++ b/src/mod/applications/mod_ivrtest/mod_ivrtest.c @@ -103,7 +103,7 @@ static void tts_function(switch_core_session *session, char *data) return; } - if ((argc = switch_separate_string(mydata, ':', argv, sizeof(argv) / sizeof(argv[0]))) > 1) { + if ((argc = switch_separate_string(mydata, ':', argv, sizeof(argv) / sizeof(argv[0]))) > 1 && argc) { tts_name = argv[0]; voice_name = argv[1]; text = argv[2]; diff --git a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c index de3b5e6c2b..09280a4dfb 100644 --- a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c +++ b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c @@ -29,6 +29,10 @@ * mod_cepstral.c -- Cepstral Interface * */ +#ifdef __ICC +#pragma warning (disable:188) +#endif + #include #include @@ -56,7 +60,6 @@ static swift_result_t write_audio(swift_event *event, swift_event_t type, void * swift_event_t rv = SWIFT_SUCCESS; void *buf = NULL; int len = 0; - int wrote; cepstral = udata; assert(cepstral != NULL); @@ -64,7 +67,7 @@ static swift_result_t write_audio(swift_event *event, swift_event_t type, void * /* Only proceed when we have success */ if (!SWIFT_FAILED((rv = swift_event_get_audio(event, &buf, &len)))) { switch_mutex_lock(cepstral->audio_lock); - if ((wrote=switch_buffer_write(cepstral->audio_buffer, buf, len)) <= 0) { + if (switch_buffer_write(cepstral->audio_buffer, buf, len) <= 0) { rv = SWIFT_UNKNOWN_ERROR; } switch_mutex_unlock(cepstral->audio_lock); @@ -242,7 +245,7 @@ static switch_status cepstral_speech_read_tts(switch_speech_handle *sh, return status; } -const switch_speech_interface cepstral_speech_interface = { +static const switch_speech_interface cepstral_speech_interface = { /*.interface_name*/ "cepstral", /*.speech_open*/ cepstral_speech_open, /*.speech_close*/ cepstral_speech_close, @@ -253,7 +256,7 @@ const switch_speech_interface cepstral_speech_interface = { }; -const switch_loadable_module_interface cepstral_module_interface = { +static const switch_loadable_module_interface cepstral_module_interface = { /*.module_name */ modname, /*.endpoint_interface */ NULL, /*.timer_interface */ NULL, diff --git a/src/mod/codecs/mod_g711/g711.c b/src/mod/codecs/mod_g711/g711.c index 334c079fdf..c4e2a4a5c6 100644 --- a/src/mod/codecs/mod_g711/g711.c +++ b/src/mod/codecs/mod_g711/g711.c @@ -39,6 +39,9 @@ */ #include "g711.h" +#ifdef __ICC +#pragma warning (disable:810 869 1418) +#endif /* * g711.c diff --git a/src/mod/codecs/mod_g711/mod_g711.c b/src/mod/codecs/mod_g711/mod_g711.c index 327a604bc7..376be89039 100644 --- a/src/mod/codecs/mod_g711/mod_g711.c +++ b/src/mod/codecs/mod_g711/mod_g711.c @@ -187,6 +187,7 @@ static switch_status switch_g711a_destroy(switch_codec *codec) /* Registration */ +#if 0 static const switch_codec_implementation g711u_8k_60ms_implementation = { /*.samples_per_second */ 8000, @@ -204,6 +205,7 @@ static const switch_codec_implementation g711u_8k_60ms_implementation = { /*.destroy */ switch_g711u_destroy }; + static const switch_codec_implementation g711u_8k_30ms_implementation = { /*.samples_per_second */ 8000, /*.bits_per_second */ 96000, @@ -220,7 +222,7 @@ static const switch_codec_implementation g711u_8k_30ms_implementation = { /*.destroy */ switch_g711u_destroy, /*.next */ &g711u_8k_60ms_implementation }; - +#endif static const switch_codec_implementation g711u_16k_implementation = { /*.samples_per_second */ 16000, diff --git a/src/mod/codecs/mod_gsm/mod_gsm.c b/src/mod/codecs/mod_gsm/mod_gsm.c index 001ebd6ed8..6160dba81f 100644 --- a/src/mod/codecs/mod_gsm/mod_gsm.c +++ b/src/mod/codecs/mod_gsm/mod_gsm.c @@ -121,11 +121,11 @@ static switch_status switch_gsm_decode(switch_codec *codec, switch_codec *other_ if (new_len <= *decoded_data_len) { *decoded_data_len = new_len; } else { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "buffer overflow!!! %d %d\n", new_len, *decoded_data_len); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "buffer overflow!!! %u %u\n", new_len, *decoded_data_len); return SWITCH_STATUS_FALSE; } } else { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "yo this frame is an odd size [%d]\n", encoded_data_len); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "yo this frame is an odd size [%u]\n", encoded_data_len); } return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/codecs/mod_speex/mod_speex.c b/src/mod/codecs/mod_speex/mod_speex.c index b4477cb02d..c476fb2db0 100644 --- a/src/mod/codecs/mod_speex/mod_speex.c +++ b/src/mod/codecs/mod_speex/mod_speex.c @@ -35,7 +35,7 @@ static const char modname[] = "mod_speexcodec"; -const struct switch_codec_settings default_codec_settings = { +static const struct switch_codec_settings default_codec_settings = { /*.quality */ 5, /*.complexity */ 5, /*.enhancement */ 1, diff --git a/src/mod/dialplans/mod_dialplan_demo/mod_dialplan_demo.c b/src/mod/dialplans/mod_dialplan_demo/mod_dialplan_demo.c index c6c42efe3e..a25537f6e4 100644 --- a/src/mod/dialplans/mod_dialplan_demo/mod_dialplan_demo.c +++ b/src/mod/dialplans/mod_dialplan_demo/mod_dialplan_demo.c @@ -38,7 +38,7 @@ static const char modname[] = "mod_dialplan_demo"; -switch_caller_extension *demo_dialplan_hunt(switch_core_session *session) +static switch_caller_extension *demo_dialplan_hunt(switch_core_session *session) { switch_caller_profile *caller_profile; switch_caller_extension *extension = NULL; diff --git a/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c b/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c index d08d5298d4..fe492487ae 100644 --- a/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c +++ b/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c @@ -82,7 +82,7 @@ static void load_config(void) switch_config_close_file(&cfg); } -switch_caller_extension *directory_dialplan_hunt(switch_core_session *session) +static switch_caller_extension *directory_dialplan_hunt(switch_core_session *session) { switch_caller_profile *caller_profile; switch_caller_extension *extension = NULL; diff --git a/src/mod/dialplans/mod_pcre/mod_pcre.c b/src/mod/dialplans/mod_pcre/mod_pcre.c index 593edf7b92..58d94311cc 100644 --- a/src/mod/dialplans/mod_pcre/mod_pcre.c +++ b/src/mod/dialplans/mod_pcre/mod_pcre.c @@ -42,7 +42,7 @@ static const char modname[] = "mod_pcre"; re = NULL;\ } -switch_caller_extension *dialplan_hunt(switch_core_session *session) +static switch_caller_extension *dialplan_hunt(switch_core_session *session) { switch_caller_profile *caller_profile; switch_caller_extension *extension = NULL; diff --git a/src/mod/directories/mod_ldap/mod_ldap.c b/src/mod/directories/mod_ldap/mod_ldap.c index 5ec4ec8568..4ab430116b 100644 --- a/src/mod/directories/mod_ldap/mod_ldap.c +++ b/src/mod/directories/mod_ldap/mod_ldap.c @@ -140,7 +140,7 @@ static switch_status mod_ldap_next(switch_directory_handle *dh) return SWITCH_STATUS_SUCCESS; } -switch_status mod_ldap_next_pair(switch_directory_handle *dh, char **var, char **val) +static switch_status mod_ldap_next_pair(switch_directory_handle *dh, char **var, char **val) { struct ldap_context *context; diff --git a/src/mod/endpoints/mod_exosip/mod_exosip.c b/src/mod/endpoints/mod_exosip/mod_exosip.c index d39e6fa7bf..1131709f26 100644 --- a/src/mod/endpoints/mod_exosip/mod_exosip.c +++ b/src/mod/endpoints/mod_exosip/mod_exosip.c @@ -282,8 +282,7 @@ static switch_status exosip_on_init(switch_core_session *session) sdp_message_m_media_add(tech_pvt->local_sdp, "audio", port, NULL, "RTP/AVP"); /* Add in every codec we support on this outbound call */ if (globals.codec_string) { - num_codecs = switch_loadable_module_get_codecs_sorted(switch_core_session_get_pool(tech_pvt->session), - codecs, + num_codecs = switch_loadable_module_get_codecs_sorted(codecs, SWITCH_MAX_CODECS, globals.codec_order, globals.codec_order_last); @@ -301,7 +300,7 @@ static switch_status exosip_on_init(switch_core_session *session) for (i = 0; i < num_codecs; i++) { int x = 0; - snprintf(tmp, sizeof(tmp), "%i", codecs[i]->ianacode); + snprintf(tmp, sizeof(tmp), "%u", codecs[i]->ianacode); sdp_message_m_payload_add(tech_pvt->local_sdp, 0, osip_strdup(tmp)); for (imp = codecs[i]->implementations; imp; imp = imp->next) { /* Add to SDP config */ @@ -309,8 +308,7 @@ static switch_status exosip_on_init(switch_core_session *session) imp->samples_per_second, x++); /* Add to SDP message */ - snprintf(tmp, sizeof(tmp), "%i %s/%i", codecs[i]->ianacode, codecs[i]->iananame, - imp->samples_per_second); + snprintf(tmp, sizeof(tmp), "%u %s/%d", codecs[i]->ianacode, codecs[i]->iananame, imp->samples_per_second); sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "rtpmap", osip_strdup(tmp)); memset(tmp, 0, sizeof(tmp)); } @@ -464,7 +462,7 @@ static void activate_rtp(struct private_object *tech_pvt) bw *= 8; } - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Activating RTP %s:%d->%s:%d codec: %d ms: %d\n", + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Activating RTP %s:%d->%s:%d codec: %u ms: %d\n", tech_pvt->local_sdp_audio_ip, tech_pvt->local_sdp_audio_port, tech_pvt->remote_sdp_audio_ip, @@ -684,7 +682,7 @@ static switch_status exosip_write_frame(switch_core_session *session, switch_fra struct private_object *tech_pvt; switch_channel *channel = NULL; switch_status status = SWITCH_STATUS_SUCCESS; - int bytes = 0, samples = 0, ms = 0, frames = 0; + int bytes = 0, samples = 0, frames = 0; channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -712,7 +710,6 @@ static switch_status exosip_write_frame(switch_core_session *session, switch_fra bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame; frames = ((int) frame->datalen / bytes); samples = frames * tech_pvt->read_codec.implementation->samples_per_frame; - ms = frames * tech_pvt->read_codec.implementation->microseconds_per_frame / 1000; } else { assert(0); } @@ -739,8 +736,12 @@ static switch_status exosip_write_frame(switch_core_session *session, switch_fra for (x = 0; x < loops; x++) { jrtp4c_write_payload(tech_pvt->rtp_session, tech_pvt->out_digit_packet, 4, 101, ts, tech_pvt->out_digit_seq); - printf("Send %s packet for [%c] ts=%d sofar=%d dur=%d\n", loops == 1 ? "middle" : "end", tech_pvt->out_digit, ts, - tech_pvt->out_digit_sofar, duration); + printf("Send %s packet for [%c] ts=%d sofar=%u dur=%d\n", + loops == 1 ? "middle" : "end", + tech_pvt->out_digit, + ts, + tech_pvt->out_digit_sofar, + duration); } } @@ -762,7 +763,7 @@ static switch_status exosip_write_frame(switch_core_session *session, switch_fra tech_pvt->out_digit_seq++; for (x = 0; x < 3; x++) { jrtp4c_write_payload(tech_pvt->rtp_session, tech_pvt->out_digit_packet, 4, 101, ts, tech_pvt->out_digit_seq); - printf("Send start packet for [%c] ts=%d sofar=%d dur=%d\n", tech_pvt->out_digit, ts, + printf("Send start packet for [%c] ts=%d sofar=%u dur=%d\n", tech_pvt->out_digit, ts, tech_pvt->out_digit_sofar, 0); } @@ -1111,8 +1112,7 @@ static switch_status exosip_create_call(eXosip_event_t * event) if (globals.codec_string) { - num_codecs = switch_loadable_module_get_codecs_sorted(switch_core_session_get_pool(tech_pvt->session), - codecs, + num_codecs = switch_loadable_module_get_codecs_sorted(codecs, SWITCH_MAX_CODECS, globals.codec_order, globals.codec_order_last); @@ -1245,7 +1245,7 @@ static switch_status exosip_create_call(eXosip_event_t * event) } - return 0; + return SWITCH_STATUS_SUCCESS; } @@ -1624,7 +1624,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void) config_exosip(0); if (globals.debug) { - osip_trace_initialize(globals.debug, stdout); + osip_trace_initialize((osip_trace_level_t) globals.debug, stdout); } if (eXosip_init()) { diff --git a/src/mod/endpoints/mod_exosip/osip_rfc3264.c b/src/mod/endpoints/mod_exosip/osip_rfc3264.c index 64043d3118..f336d08b96 100644 --- a/src/mod/endpoints/mod_exosip/osip_rfc3264.c +++ b/src/mod/endpoints/mod_exosip/osip_rfc3264.c @@ -17,6 +17,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef __ICC +#pragma warning (disable:810 869 1418 981) +#endif + #include #include diff --git a/src/mod/endpoints/mod_iax/mod_iax.c b/src/mod/endpoints/mod_iax/mod_iax.c index 0ca709fbcf..3ad06b4ff6 100644 --- a/src/mod/endpoints/mod_iax/mod_iax.c +++ b/src/mod/endpoints/mod_iax/mod_iax.c @@ -215,8 +215,7 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s int x, srate = 8000; if (globals.codec_string) { - if ((num_codecs = switch_loadable_module_get_codecs_sorted(switch_core_session_get_pool(tech_pvt->session), - codecs, + if ((num_codecs = switch_loadable_module_get_codecs_sorted(codecs, SWITCH_MAX_CODECS, globals.codec_order, globals.codec_order_last)) <= 0) { @@ -863,9 +862,7 @@ static switch_status load_config(void) SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void) { - int res; - int netfd; - int refresh; + //int refresh; struct iax_event *iaxevent = NULL; switch_event *s_event; if (load_config() != SWITCH_STATUS_SUCCESS) { @@ -875,14 +872,14 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void) if (globals.debug) { iax_enable_debug(); } - if (((res = iax_init(globals.port) < 0)) != 0) { + if (iax_init(globals.port) < 0) { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error Binding Port!\n"); return SWITCH_STATUS_TERM; } iax_set_error(iax_err_cb); iax_set_output(iax_out_cb); - netfd = iax_get_fd(); + //netfd = iax_get_fd(); switch_console_printf(SWITCH_CHANNEL_CONSOLE, "IAX Ready Port %d\n", globals.port); @@ -912,8 +909,8 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void) switch (iaxevent->etype) { case IAX_EVENT_REGACK: switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Registration completed successfully.\n"); - if (iaxevent->ies.refresh) - refresh = iaxevent->ies.refresh; + //if (iaxevent->ies.refresh) + //refresh = iaxevent->ies.refresh; break; case IAX_EVENT_REGREJ: switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Registration failed.\n"); @@ -927,7 +924,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void) if (iax_set_codec(tech_pvt, iaxevent->session, &format, &cap, &iaxevent->ies.samprate, IAX_SET) != SWITCH_STATUS_SUCCESS) { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WTF? %d %d\n", iaxevent->ies.format, + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WTF? %u %u\n", iaxevent->ies.format, iaxevent->ies.capability); } } @@ -961,7 +958,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void) case IAX_EVENT_CONNECT: // incoming call detected switch_console_printf(SWITCH_CHANNEL_CONSOLE, - "Incoming call connected %s, %s, %s %d/%d\n", + "Incoming call connected %s, %s, %s %u/%u\n", iaxevent->ies.called_number, iaxevent->ies.calling_number, iaxevent->ies.calling_name, iaxevent->ies.format, iaxevent->ies.capability); diff --git a/src/mod/endpoints/mod_portaudio/pablio.c b/src/mod/endpoints/mod_portaudio/pablio.c index d7008ce5e3..ec96f47ef4 100644 --- a/src/mod/endpoints/mod_portaudio/pablio.c +++ b/src/mod/endpoints/mod_portaudio/pablio.c @@ -38,6 +38,10 @@ * PLB021214 - check for valid stream in CloseAudioStream() to prevent hang. * add timeOutMSec to CloseAudioStream() to prevent hang. */ + +#ifdef __ICC +#pragma warning (disable:810 869 981 279 1469) +#endif #include #include #include diff --git a/src/mod/endpoints/mod_portaudio/ringbuffer.c b/src/mod/endpoints/mod_portaudio/ringbuffer.c index 36d06a49d7..765a2cba05 100644 --- a/src/mod/endpoints/mod_portaudio/ringbuffer.c +++ b/src/mod/endpoints/mod_portaudio/ringbuffer.c @@ -33,6 +33,9 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ +#ifdef __ICC +#pragma warning (disable:810 869 981 279 1469) +#endif #include #include #include diff --git a/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c b/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c index 0a8de530c3..89b66fcf98 100644 --- a/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c +++ b/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c @@ -191,7 +191,7 @@ static int str2dp(char *dp) return PRI_UNKNOWN; } -static const switch_endpoint_interface wanpipe_endpoint_interface; + static void set_global_dialplan(char *dialplan); static int str2node(char *node); @@ -395,6 +395,307 @@ static switch_status wanpipe_on_transmit(switch_core_session *session) return SWITCH_STATUS_SUCCESS; } + +static switch_status wanpipe_answer_channel(switch_core_session *session) +{ + struct private_object *tech_pvt; + switch_channel *channel = NULL; + + channel = switch_core_session_get_channel(session); + assert(channel != NULL); + + tech_pvt = switch_core_session_get_private(session); + assert(tech_pvt != NULL); + + if (switch_test_flag(tech_pvt, TFLAG_INBOUND) && !switch_test_flag(tech_pvt, TFLAG_NOSIG)) { + pri_answer(tech_pvt->spri->pri, tech_pvt->call, 0, 1); + } + return SWITCH_STATUS_SUCCESS; +} + + + +static switch_status wanpipe_read_frame(switch_core_session *session, switch_frame **frame, int timeout, + switch_io_flag flags, int stream_id) +{ + struct private_object *tech_pvt; + switch_channel *channel = NULL; + uint8_t *bp; + int bytes = 0, res = 0; + char digit_str[80]; + + channel = switch_core_session_get_channel(session); + assert(channel != NULL); + + tech_pvt = switch_core_session_get_private(session); + assert(tech_pvt != NULL); + + + if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { + return SWITCH_STATUS_GENERR; + } + + bp = tech_pvt->databuf; + + *frame = NULL; + memset(tech_pvt->databuf, 0, sizeof(tech_pvt->databuf)); + while (bytes < globals.mtu) { + if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { + return SWITCH_STATUS_GENERR; + } + if ((res = sangoma_socket_waitfor(tech_pvt->socket, timeout, POLLIN | POLLERR)) < 0) { + return SWITCH_STATUS_GENERR; + } else if (res == 0) { + tech_pvt->read_frame.datalen = 0; + return SWITCH_STATUS_SUCCESS; + } + + if ((res = sangoma_readmsg_socket(tech_pvt->socket, + &tech_pvt->hdrframe, + sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) { + if (errno == EBUSY) { + continue; + } else { + return SWITCH_STATUS_GENERR; + } + + } + bytes += res; + bp += bytes; + } + + if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { + return SWITCH_STATUS_GENERR; + } + + tech_pvt->read_frame.datalen = bytes; + tech_pvt->read_frame.samples = bytes / 2; + + res = teletone_dtmf_detect (&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples); + res = teletone_dtmf_get(&tech_pvt->dtmf_detect, digit_str, sizeof(digit_str)); + + if(digit_str[0]) { + switch_channel_queue_dtmf(channel, digit_str); + if (globals.debug) { + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "DTMF DETECTED: [%s]\n", digit_str); + } + if (globals.supress_dtmf_tone) { + memset(tech_pvt->read_frame.data, 0, tech_pvt->read_frame.datalen); + } + } + + if (tech_pvt->skip_read_frames > 0) { + memset(tech_pvt->read_frame.data, 0, tech_pvt->read_frame.datalen); + tech_pvt->skip_read_frames--; + } + +#ifdef DOTRACE + write(tech_pvt->fd2, tech_pvt->read_frame.data, (int) tech_pvt->read_frame.datalen); +#endif + //printf("read %d\n", tech_pvt->read_frame.datalen); + *frame = &tech_pvt->read_frame; + return SWITCH_STATUS_SUCCESS; +} + +static switch_status wanpipe_write_frame(switch_core_session *session, switch_frame *frame, int timeout, + switch_io_flag flags, int stream_id) +{ + struct private_object *tech_pvt; + switch_channel *channel = NULL; + int result = 0; + int bytes = frame->datalen; + uint8_t *bp = frame->data; + unsigned char dtmf[1024]; + int bread, bwrote = 0; + switch_status status = SWITCH_STATUS_SUCCESS; + + channel = switch_core_session_get_channel(session); + assert(channel != NULL); + + tech_pvt = switch_core_session_get_private(session); + assert(tech_pvt != NULL); + + + while (tech_pvt->dtmf_buffer && bwrote < frame->datalen && bytes > 0 && switch_buffer_inuse(tech_pvt->dtmf_buffer) > 0) { + if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { + return SWITCH_STATUS_GENERR; + } + + if ((bread = switch_buffer_read(tech_pvt->dtmf_buffer, dtmf, globals.mtu)) < globals.mtu) { + while (bread < globals.mtu) { + dtmf[bread++] = 0; + } + } + + + sangoma_socket_waitfor(tech_pvt->socket, -1, POLLOUT | POLLERR | POLLHUP); + + +#ifdef DOTRACE + write(tech_pvt->fd, dtmf, (int) bread); +#endif + result = sangoma_sendmsg_socket(tech_pvt->socket, + &tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), dtmf, bread, 0); + if (result < 0) { + switch_console_printf(SWITCH_CHANNEL_CONSOLE, + "Bad Write %d bytes returned %d (%s)!\n", bread, + result, strerror(errno)); + if (errno == EBUSY) { + continue; + } + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Write Failed!\n"); + status = SWITCH_STATUS_GENERR; + break; + } else { + bytes -= result; + bwrote += result; + bp += result; + result = 0; + } + } + + if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { + return SWITCH_STATUS_GENERR; + } + + if (tech_pvt->skip_write_frames) { + tech_pvt->skip_write_frames--; + return SWITCH_STATUS_SUCCESS; + } + + while (bytes > 0) { + unsigned int towrite; + + if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { + return SWITCH_STATUS_GENERR; + } + + sangoma_socket_waitfor(tech_pvt->socket, -1, POLLOUT | POLLERR | POLLHUP); +#ifdef DOTRACE + write(tech_pvt->fd, bp, (int) globals.mtu); +#endif + towrite = bytes >= globals.mtu ? globals.mtu : bytes; + + result = sangoma_sendmsg_socket(tech_pvt->socket, + &tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), bp, towrite, 0); + if (result < 0) { + switch_console_printf(SWITCH_CHANNEL_CONSOLE, + "Bad Write frame len %u write %d bytes returned %d (%s)!\n", frame->datalen, + globals.mtu, result, strerror(errno)); + if (errno == EBUSY) { + continue; + } + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Write Failed!\n"); + status = SWITCH_STATUS_GENERR; + break; + } else { + bytes -= result; + bp += result; + result = 0; + } + } + + //printf("write %d %d\n", frame->datalen, status); + return status; +} + +static switch_status wanpipe_send_dtmf(switch_core_session *session, char *digits) +{ + struct private_object *tech_pvt; + switch_channel *channel = NULL; + switch_status status = SWITCH_STATUS_SUCCESS; + int wrote = 0; + char *cur = NULL; + + channel = switch_core_session_get_channel(session); + assert(channel != NULL); + + tech_pvt = switch_core_session_get_private(session); + assert(tech_pvt != NULL); + + if (!tech_pvt->dtmf_buffer) { + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocate DTMF Buffer...."); + if (switch_buffer_create(switch_core_session_get_pool(session), &tech_pvt->dtmf_buffer, 3192) != SWITCH_STATUS_SUCCESS) { + switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "FAILURE!\n"); + return SWITCH_STATUS_FALSE; + } else { + switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "SUCCESS!\n"); + } + } + for (cur = digits; *cur; cur++) { + if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int)*cur]))) { + switch_buffer_write(tech_pvt->dtmf_buffer, tech_pvt->tone_session.buffer, wrote * 2); + } + } + + tech_pvt->skip_read_frames = 200; + + return status; +} + +static switch_status wanpipe_receive_message(switch_core_session *session, switch_core_session_message *msg) +{ + return SWITCH_STATUS_FALSE; +} + +static switch_status wanpipe_kill_channel(switch_core_session *session, int sig) +{ + struct private_object *tech_pvt; + switch_channel *channel = NULL; + + channel = switch_core_session_get_channel(session); + assert(channel != NULL); + + tech_pvt = switch_core_session_get_private(session); + assert(tech_pvt != NULL); + + switch_set_flag(tech_pvt, TFLAG_BYE); + switch_clear_flag(tech_pvt, TFLAG_MEDIA); + + return SWITCH_STATUS_SUCCESS; + +} + + +static const switch_io_routines wanpipe_io_routines = { + /*.outgoing_channel */ wanpipe_outgoing_channel, + /*.answer_channel */ wanpipe_answer_channel, + /*.read_frame */ wanpipe_read_frame, + /*.write_frame */ wanpipe_write_frame, + /*.kill_channel */ wanpipe_kill_channel, + /*.waitfor_read */ NULL, + /*.waitfor_read */ NULL, + /*.send_dtmf*/ wanpipe_send_dtmf, + /*.receive_message*/ wanpipe_receive_message +}; + +static const switch_state_handler_table wanpipe_state_handlers = { + /*.on_init */ wanpipe_on_init, + /*.on_ring */ wanpipe_on_ring, + /*.on_execute */ NULL, + /*.on_hangup */ wanpipe_on_hangup, + /*.on_loopback */ wanpipe_on_loopback, + /*.on_transmit */ wanpipe_on_transmit +}; + +static const switch_endpoint_interface wanpipe_endpoint_interface = { + /*.interface_name */ "wanpipe", + /*.io_routines */ &wanpipe_io_routines, + /*.state_handlers */ &wanpipe_state_handlers, + /*.private */ NULL, + /*.next */ NULL +}; + +static const switch_loadable_module_interface wanpipe_module_interface = { + /*.module_name */ modname, + /*.endpoint_interface */ &wanpipe_endpoint_interface, + /*.timer_interface */ NULL, + /*.dialplan_interface */ NULL, + /*.codec_interface */ NULL, + /*.application_interface */ NULL +}; + + static switch_status wanpipe_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile, switch_core_session **new_session, switch_memory_pool *pool) { @@ -600,304 +901,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit return SWITCH_STATUS_GENERR; } -static switch_status wanpipe_answer_channel(switch_core_session *session) -{ - struct private_object *tech_pvt; - switch_channel *channel = NULL; - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - if (switch_test_flag(tech_pvt, TFLAG_INBOUND) && !switch_test_flag(tech_pvt, TFLAG_NOSIG)) { - pri_answer(tech_pvt->spri->pri, tech_pvt->call, 0, 1); - } - return SWITCH_STATUS_SUCCESS; -} - - - -static switch_status wanpipe_read_frame(switch_core_session *session, switch_frame **frame, int timeout, - switch_io_flag flags, int stream_id) -{ - struct private_object *tech_pvt; - switch_channel *channel = NULL; - void *bp; - int bytes = 0, res = 0; - char digit_str[80]; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - - if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { - return SWITCH_STATUS_GENERR; - } - - bp = tech_pvt->databuf; - - *frame = NULL; - memset(tech_pvt->databuf, 0, sizeof(tech_pvt->databuf)); - while (bytes < globals.mtu) { - if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { - return SWITCH_STATUS_GENERR; - } - if ((res = sangoma_socket_waitfor(tech_pvt->socket, timeout, POLLIN | POLLERR)) < 0) { - return SWITCH_STATUS_GENERR; - } else if (res == 0) { - tech_pvt->read_frame.datalen = 0; - return SWITCH_STATUS_SUCCESS; - } - - if ((res = sangoma_readmsg_socket(tech_pvt->socket, - &tech_pvt->hdrframe, - sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) { - if (errno == EBUSY) { - continue; - } else { - return SWITCH_STATUS_GENERR; - } - - } - bytes += res; - bp += bytes; - } - - if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { - return SWITCH_STATUS_GENERR; - } - - tech_pvt->read_frame.datalen = bytes; - tech_pvt->read_frame.samples = bytes / 2; - - res = teletone_dtmf_detect (&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples); - res = teletone_dtmf_get(&tech_pvt->dtmf_detect, digit_str, sizeof(digit_str)); - - if(digit_str[0]) { - switch_channel_queue_dtmf(channel, digit_str); - if (globals.debug) { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "DTMF DETECTED: [%s]\n", digit_str); - } - if (globals.supress_dtmf_tone) { - memset(tech_pvt->read_frame.data, 0, tech_pvt->read_frame.datalen); - } - } - - if (tech_pvt->skip_read_frames > 0) { - memset(tech_pvt->read_frame.data, 0, tech_pvt->read_frame.datalen); - tech_pvt->skip_read_frames--; - } - -#ifdef DOTRACE - write(tech_pvt->fd2, tech_pvt->read_frame.data, (int) tech_pvt->read_frame.datalen); -#endif - //printf("read %d\n", tech_pvt->read_frame.datalen); - *frame = &tech_pvt->read_frame; - return SWITCH_STATUS_SUCCESS; -} - -static switch_status wanpipe_write_frame(switch_core_session *session, switch_frame *frame, int timeout, - switch_io_flag flags, int stream_id) -{ - struct private_object *tech_pvt; - switch_channel *channel = NULL; - int res = 0; - int bytes = frame->datalen; - void *bp = frame->data; - unsigned char dtmf[1024]; - int inuse, bread, bwrote = 0; - switch_status status = SWITCH_STATUS_SUCCESS; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - - while (tech_pvt->dtmf_buffer && bwrote < frame->datalen && bytes > 0 && (inuse = switch_buffer_inuse(tech_pvt->dtmf_buffer)) > 0) { - if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { - return SWITCH_STATUS_GENERR; - } - - if ((bread = switch_buffer_read(tech_pvt->dtmf_buffer, dtmf, globals.mtu)) < globals.mtu) { - while (bread < globals.mtu) { - dtmf[bread++] = 0; - } - } - - - sangoma_socket_waitfor(tech_pvt->socket, -1, POLLOUT | POLLERR | POLLHUP); - - -#ifdef DOTRACE - write(tech_pvt->fd, dtmf, (int) bread); -#endif - res = sangoma_sendmsg_socket(tech_pvt->socket, - &tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), dtmf, bread, 0); - if (res < 0) { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, - "Bad Write %d bytes returned %d (%s)!\n", bread, - res, strerror(errno)); - if (errno == EBUSY) { - continue; - } - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Write Failed!\n"); - status = SWITCH_STATUS_GENERR; - break; - } else { - bytes -= res; - bwrote += res; - bp += res; - res = 0; - } - } - - if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { - return SWITCH_STATUS_GENERR; - } - - if (tech_pvt->skip_write_frames) { - tech_pvt->skip_write_frames--; - return SWITCH_STATUS_SUCCESS; - } - - while (bytes > 0) { - unsigned int towrite; - - if (switch_test_flag(tech_pvt, TFLAG_BYE) || tech_pvt->socket < 0) { - return SWITCH_STATUS_GENERR; - } - - sangoma_socket_waitfor(tech_pvt->socket, -1, POLLOUT | POLLERR | POLLHUP); -#ifdef DOTRACE - write(tech_pvt->fd, bp, (int) globals.mtu); -#endif - towrite = bytes >= globals.mtu ? globals.mtu : bytes; - - res = sangoma_sendmsg_socket(tech_pvt->socket, - &tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), bp, towrite, 0); - if (res < 0) { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, - "Bad Write frame len %d write %d bytes returned %d (%s)!\n", frame->datalen, - globals.mtu, res, strerror(errno)); - if (errno == EBUSY) { - continue; - } - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Write Failed!\n"); - status = SWITCH_STATUS_GENERR; - break; - } else { - bytes -= res; - bp += res; - res = 0; - } - } - - //printf("write %d %d\n", frame->datalen, status); - return status; -} - -static switch_status wanpipe_send_dtmf(switch_core_session *session, char *digits) -{ - struct private_object *tech_pvt; - switch_channel *channel = NULL; - switch_status status = SWITCH_STATUS_SUCCESS; - int wrote = 0; - char *cur = NULL; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - if (!tech_pvt->dtmf_buffer) { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocate DTMF Buffer...."); - if (switch_buffer_create(switch_core_session_get_pool(session), &tech_pvt->dtmf_buffer, 3192) != SWITCH_STATUS_SUCCESS) { - switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "FAILURE!\n"); - return SWITCH_STATUS_FALSE; - } else { - switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "SUCCESS!\n"); - } - } - for (cur = digits; *cur; cur++) { - if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int)*cur]))) { - switch_buffer_write(tech_pvt->dtmf_buffer, tech_pvt->tone_session.buffer, wrote * 2); - } - } - - tech_pvt->skip_read_frames = 200; - - return status; -} - -static switch_status wanpipe_receive_message(switch_core_session *session, switch_core_session_message *msg) -{ - return SWITCH_STATUS_FALSE; -} - -static switch_status wanpipe_kill_channel(switch_core_session *session, int sig) -{ - struct private_object *tech_pvt; - switch_channel *channel = NULL; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - switch_set_flag(tech_pvt, TFLAG_BYE); - switch_clear_flag(tech_pvt, TFLAG_MEDIA); - - return SWITCH_STATUS_SUCCESS; - -} - - -static const switch_io_routines wanpipe_io_routines = { - /*.outgoing_channel */ wanpipe_outgoing_channel, - /*.answer_channel */ wanpipe_answer_channel, - /*.read_frame */ wanpipe_read_frame, - /*.write_frame */ wanpipe_write_frame, - /*.kill_channel */ wanpipe_kill_channel, - /*.waitfor_read */ NULL, - /*.waitfor_read */ NULL, - /*.send_dtmf*/ wanpipe_send_dtmf, - /*.receive_message*/ wanpipe_receive_message -}; - -static const switch_state_handler_table wanpipe_state_handlers = { - /*.on_init */ wanpipe_on_init, - /*.on_ring */ wanpipe_on_ring, - /*.on_execute */ NULL, - /*.on_hangup */ wanpipe_on_hangup, - /*.on_loopback */ wanpipe_on_loopback, - /*.on_transmit */ wanpipe_on_transmit -}; - -static const switch_endpoint_interface wanpipe_endpoint_interface = { - /*.interface_name */ "wanpipe", - /*.io_routines */ &wanpipe_io_routines, - /*.state_handlers */ &wanpipe_state_handlers, - /*.private */ NULL, - /*.next */ NULL -}; - -static const switch_loadable_module_interface wanpipe_module_interface = { - /*.module_name */ modname, - /*.endpoint_interface */ &wanpipe_endpoint_interface, - /*.timer_interface */ NULL, - /*.dialplan_interface */ NULL, - /*.codec_interface */ NULL, - /*.application_interface */ NULL -}; static void s_pri_error(struct pri *pri, char *s) { @@ -926,7 +930,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul } /* start the pri's */ - if ((status = config_wanpipe(0) != SWITCH_STATUS_SUCCESS)) { + if ((status = config_wanpipe(0)) != SWITCH_STATUS_SUCCESS) { return status; } @@ -1222,7 +1226,7 @@ static int on_dchan_down(struct sangoma_pri *spri, sangoma_pri_event_t event_typ static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event) { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Caught Event span %d %d (%s)\n", spri->span, event_type, + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Caught Event span %d %u (%s)\n", spri->span, event_type, sangoma_pri_event_str(event_type)); return 0; } @@ -1276,7 +1280,6 @@ static switch_status config_wanpipe(int reload) { switch_config cfg; char *var, *val; - int count = 0; char *cf = "wanpipe.conf"; int current_span = 0; @@ -1404,7 +1407,7 @@ static switch_status config_wanpipe(int reload) - return count; + return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/endpoints/mod_woomera/mod_woomera.c b/src/mod/endpoints/mod_woomera/mod_woomera.c index 0a083c8043..c51a51c2e4 100644 --- a/src/mod/endpoints/mod_woomera/mod_woomera.c +++ b/src/mod/endpoints/mod_woomera/mod_woomera.c @@ -329,8 +329,8 @@ static switch_status woomerachan_kill_channel(switch_core_session *session, int udp_socket_close(tech_pvt); switch_channel_hangup(channel); - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s WOOMERACHAN KILL %d\n", switch_channel_get_name(channel), - tech_pvt->udp_socket); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel)); + return SWITCH_STATUS_SUCCESS; @@ -355,7 +355,7 @@ static switch_status woomerachan_waitfor_read(switch_core_session *session, int tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); - return switch_socket_waitfor(&tech_pvt->read_poll, ms); + return switch_socket_waitfor(&tech_pvt->read_poll, ms) ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS; } static switch_status woomerachan_waitfor_write(switch_core_session *session, int ms, int stream_id) @@ -375,7 +375,6 @@ static switch_status woomerachan_read_frame(switch_core_session *session, switch switch_channel *channel = NULL; struct private_object *tech_pvt = NULL; switch_frame *pframe; - switch_status status; channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -395,12 +394,12 @@ static switch_status woomerachan_read_frame(switch_core_session *session, switch *frame = pframe; pframe->datalen = sizeof(tech_pvt->databuf); - if ((status = - switch_socket_recvfrom(tech_pvt->udpread, tech_pvt->udp_socket, 0, tech_pvt->databuf, - &pframe->datalen)) == SWITCH_STATUS_SUCCESS) { + if (switch_socket_recvfrom(tech_pvt->udpread, tech_pvt->udp_socket, 0, tech_pvt->databuf, &pframe->datalen) == SWITCH_STATUS_SUCCESS) { pframe->samples = (int) pframe->datalen / 2; + return SWITCH_STATUS_SUCCESS; } - return status; + + return SWITCH_STATUS_FALSE; } static switch_status woomerachan_write_frame(switch_core_session *session, switch_frame *frame, int timeout, @@ -408,7 +407,7 @@ static switch_status woomerachan_write_frame(switch_core_session *session, switc { switch_channel *channel = NULL; struct private_object *tech_pvt = NULL; - switch_frame *pframe; + //switch_frame *pframe; channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -420,9 +419,12 @@ static switch_status woomerachan_write_frame(switch_core_session *session, switc return SWITCH_STATUS_GENERR; } - pframe = &tech_pvt->frame; - return switch_socket_sendto(tech_pvt->udp_socket, tech_pvt->udpwrite, 0, frame->data, &frame->datalen); + //pframe = &tech_pvt->frame; + if (switch_socket_sendto(tech_pvt->udp_socket, tech_pvt->udpwrite, 0, frame->data, &frame->datalen) == SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_GENERR; } static const switch_state_handler_table woomerachan_event_handlers = { @@ -623,10 +625,9 @@ static int woomera_dequeue_event(woomera_event_queue * event_queue, woomera_mess static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, int timeout, woomera_profile * profile, woomera_event_queue * event_queue) { - char *cur, *cr, *next = NULL, *eor = NULL; + char *cur, *cr, *next = NULL; char buf[2048] = "", *ptr; int bytes = 0; - int failto = 0; memset(wmsg, 0, sizeof(woomera_message)); @@ -636,14 +637,13 @@ static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, in if (timeout < 0) { timeout = abs(timeout); - failto = 1; } else if (timeout == 0) { timeout = -1; } ptr = buf; bytes = 0; - while ((eor = strstr(buf, WOOMERA_RECORD_SEPERATOR)) == 0) { + while (!strstr(buf, WOOMERA_RECORD_SEPERATOR)) { size_t len = 1; if (!profile->thread_running) { @@ -774,14 +774,12 @@ static int connect_woomera(switch_socket_t **new_sock, woomera_profile * profile { switch_sockaddr_t *sa; - switch_status status; - status = switch_sockaddr_info_get(&sa, profile->woomera_host, AF_INET, profile->woomera_port, 0, module_pool); - if (status != SWITCH_STATUS_SUCCESS) { + if (switch_sockaddr_info_get(&sa, profile->woomera_host, AF_INET, profile->woomera_port, 0, module_pool) != SWITCH_STATUS_SUCCESS) { return -1; } - status = switch_socket_create(new_sock, AF_INET, SOCK_STREAM, 0, module_pool); - if (status != SWITCH_STATUS_SUCCESS) { + + if (switch_socket_create(new_sock, AF_INET, SOCK_STREAM, 0, module_pool) != SWITCH_STATUS_SUCCESS) { return -1; } /* @@ -791,8 +789,7 @@ static int connect_woomera(switch_socket_t **new_sock, woomera_profile * profile return -1; } */ - status = switch_socket_connect((*new_sock), sa); - if (status != SWITCH_STATUS_SUCCESS) { + if (switch_socket_connect((*new_sock), sa) != SWITCH_STATUS_SUCCESS) { return -1; } @@ -1220,7 +1217,7 @@ static void *woomera_thread_run(void *obj) profile->woomera_host, profile->woomera_port); } }*/ - continue; + //continue; } if (!strcasecmp(wmsg.command, "INCOMING")) { diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index 43f033fae7..11c81eb398 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -95,7 +95,6 @@ static void event_handler(switch_event *event) switch (event->event_id) { case SWITCH_EVENT_LOG: return; - break; default: switch_event_serialize(event, buf, sizeof(buf), NULL); len = strlen(buf); @@ -191,7 +190,6 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void) SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void) { switch_event *local_event; - switch_status status; char buf[1024]; globals.running = 1; @@ -199,7 +197,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void) switch_sockaddr_t addr = {0}; size_t len = sizeof(buf); memset(buf, 0, len); - if ((status = switch_socket_recvfrom(&addr, globals.udp_socket, 0, buf, &len)) == SWITCH_STATUS_SUCCESS) { + if (switch_socket_recvfrom(&addr, globals.udp_socket, 0, buf, &len) == SWITCH_STATUS_SUCCESS) { if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT) == SWITCH_STATUS_SUCCESS) { char *var, *val, *term = NULL; switch_event_add_header(local_event, SWITCH_STACK_BOTTOM, "Multicast", "yes"); diff --git a/src/mod/event_handlers/mod_event_test/mod_event_test.c b/src/mod/event_handlers/mod_event_test/mod_event_test.c index 3383aa22f1..a524920db2 100644 --- a/src/mod/event_handlers/mod_event_test/mod_event_test.c +++ b/src/mod/event_handlers/mod_event_test/mod_event_test.c @@ -43,7 +43,6 @@ static void event_handler(switch_event *event) switch (event->event_id) { case SWITCH_EVENT_LOG: return; - break; default: switch_event_serialize(event, buf, sizeof(buf), NULL); switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nEVENT\n--------------------------------\n%s\n", buf); diff --git a/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c b/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c index d63b5149bf..a213d2c9a3 100644 --- a/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c +++ b/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c @@ -144,13 +144,13 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_jid, globals.jid) } -int on_result(struct session *sess, ikspak * pak) +static int on_result(struct session *sess, ikspak * pak) { return IKS_FILTER_EAT; } -int on_stream(struct session *sess, int type, iks * node) +static int on_stream(struct session *sess, int type, iks * node) { sess->counter = opt_timeout; @@ -216,7 +216,7 @@ int on_stream(struct session *sess, int type, iks * node) return IKS_OK; } -int on_msg(void *user_data, ikspak * pak) +static int on_msg(void *user_data, ikspak * pak) { char *cmd = iks_find_cdata(pak->x, "body"); char *arg = NULL; @@ -238,13 +238,13 @@ int on_msg(void *user_data, ikspak * pak) return 0; } -int on_error(void *user_data, ikspak * pak) +static int on_error(void *user_data, ikspak * pak) { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "authorization failed\n"); return IKS_FILTER_EAT; } -void on_log(struct session *sess, const char *data, size_t size, int is_incoming) +static void on_log(struct session *sess, const char *data, size_t size, int is_incoming) { if (iks_is_secure(sess->parser)) fprintf(stderr, "Sec"); @@ -255,7 +255,7 @@ void on_log(struct session *sess, const char *data, size_t size, int is_incoming fprintf(stderr, "[%s]\n", data); } -void j_setup_filter(struct session *sess) +static void j_setup_filter(struct session *sess) { if (my_filter) iks_filter_delete(my_filter); diff --git a/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c b/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c index 450c469ba5..9fd6e61e9e 100644 --- a/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c +++ b/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c @@ -172,7 +172,7 @@ static void event_handler(switch_event *event) my_service_reply, NULL, &globals.disc_id)) != SW_OKAY) { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "publish failed: %d\n", result); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "publish failed: %u\n", result); sw_text_record_fina(text_record); switch_mutex_unlock(globals.zc_lock); return; diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index 0d1b1dc7de..7e4f088716 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -41,7 +41,7 @@ struct sndfile_context { typedef struct sndfile_context sndfile_context; -switch_status sndfile_file_open(switch_file_handle *handle, char *path) +static switch_status sndfile_file_open(switch_file_handle *handle, char *path) { sndfile_context *context; int mode = 0; @@ -144,7 +144,7 @@ switch_status sndfile_file_open(switch_file_handle *handle, char *path) return SWITCH_STATUS_SUCCESS; } -switch_status sndfile_file_close(switch_file_handle *handle) +static switch_status sndfile_file_close(switch_file_handle *handle) { sndfile_context *context = handle->private_info; @@ -153,7 +153,7 @@ switch_status sndfile_file_close(switch_file_handle *handle) return SWITCH_STATUS_SUCCESS; } -switch_status sndfile_file_seek(switch_file_handle *handle, unsigned int *cur_sample, int64_t samples, int whence) +static switch_status sndfile_file_seek(switch_file_handle *handle, unsigned int *cur_sample, int64_t samples, int whence) { sndfile_context *context = handle->private_info; @@ -169,7 +169,7 @@ switch_status sndfile_file_seek(switch_file_handle *handle, unsigned int *cur_sa } -switch_status sndfile_file_read(switch_file_handle *handle, void *data, size_t *len) +static switch_status sndfile_file_read(switch_file_handle *handle, void *data, size_t *len) { size_t inlen = *len; sndfile_context *context = handle->private_info; @@ -191,7 +191,7 @@ switch_status sndfile_file_read(switch_file_handle *handle, void *data, size_t * return SWITCH_STATUS_SUCCESS; } -switch_status sndfile_file_write(switch_file_handle *handle, void *data, size_t *len) +static switch_status sndfile_file_write(switch_file_handle *handle, void *data, size_t *len) { size_t inlen = *len; sndfile_context *context = handle->private_info; diff --git a/src/mod/languages/mod_perl/Makefile b/src/mod/languages/mod_perl/Makefile index 198a1dd72a..86796fd817 100644 --- a/src/mod/languages/mod_perl/Makefile +++ b/src/mod/languages/mod_perl/Makefile @@ -40,7 +40,7 @@ $(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c $(MODNAME).o $(OBJS) $(CC) $(SOLINK) -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(MODNAME).o $(OBJS) $(LDFLAGS) clean: - rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~ perlxsi.c .perlok + rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~ .perlok install: mkdir -p $(PREFIX)/perl diff --git a/src/mod/languages/mod_perl/mod_perl.c b/src/mod/languages/mod_perl/mod_perl.c index 7c33a443a1..ca2aafef0a 100644 --- a/src/mod/languages/mod_perl/mod_perl.c +++ b/src/mod/languages/mod_perl/mod_perl.c @@ -29,7 +29,9 @@ * mod_perl.c -- Perl * */ - +#ifdef __ICC +#pragma warning (disable:1419) +#endif #ifdef _MSC_VER #include #pragma comment(lib, PERL_LIB) diff --git a/src/mod/languages/mod_perl/perlxsi.c b/src/mod/languages/mod_perl/perlxsi.c new file mode 100644 index 0000000000..c5978dab89 --- /dev/null +++ b/src/mod/languages/mod_perl/perlxsi.c @@ -0,0 +1,19 @@ +#ifdef __ICC +#pragma warning (disable:1419) +#endif +#include +#include + +EXTERN_C void xs_init (pTHX); + +EXTERN_C void boot_DynaLoader (pTHX_ CV* cv); + +EXTERN_C void +xs_init(pTHX) +{ + char *file = __FILE__; + dXSUB_SYS; + + /* DynaLoader is a special case */ + newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); +} diff --git a/src/mod/languages/mod_perl/switch_swig.c b/src/mod/languages/mod_perl/switch_swig.c index 4c6ac66546..2d46c54631 100644 --- a/src/mod/languages/mod_perl/switch_swig.c +++ b/src/mod/languages/mod_perl/switch_swig.c @@ -1,4 +1,9 @@ #include +#ifdef __ICC +#pragma warning (disable:1418) +#endif + + #ifdef _MSC_VER #include @@ -108,9 +113,12 @@ void fs_channel_set_state(struct switch_core_session *session, char *state) switch_channel_set_state(channel, fs_state); } -int fs_ivr_play_file(struct switch_core_session *session, char *file, char *timer_name_in) +int fs_ivr_play_file(struct switch_core_session *session, char *file, char *timer_name) { - char *timer_name = switch_strlen_zero(timer_name_in) ? NULL : timer_name; + if (switch_strlen_zero(timer_name)) { + timer_name = NULL; + } + switch_status status = switch_ivr_play_file(session, NULL, file, timer_name, NULL, NULL, 0); return status == SWITCH_STATUS_SUCCESS ? 1 : 0; } diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index b4a534b4bd..01eb82c624 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -33,6 +33,9 @@ #define HAVE_CURL #endif #define JS_BUFFER_SIZE 131072 +#ifdef __ICC +#pragma warning (disable:310 193 1418) +#endif #include #include "jstypes.h" @@ -1363,8 +1366,8 @@ static JSBool db_fetch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js } for (x = 0; x < colcount; x++) { snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"", - switch_core_db_column_name(dbo->stmt, x), - switch_core_db_column_text(dbo->stmt, x)); + (char *) switch_core_db_column_name(dbo->stmt, x), + (char *) switch_core_db_column_text(dbo->stmt, x)); eval_some_js(code, dbo->cx, dbo->obj, rval); if (*rval == JS_FALSE) { @@ -1517,7 +1520,7 @@ static JSBool teletone_construct(JSContext *cx, JSObject *obj, uintN argc, jsval (read_codec->implementation->samples_per_second / 50) * read_codec->implementation->number_of_channels, pool) == SWITCH_STATUS_SUCCESS) { tto->timer = &tto->timer_base; - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Timer INIT Success %d\n", ms); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Timer INIT Success %u\n", ms); } else { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Timer INIT Failed\n"); } @@ -1653,9 +1656,7 @@ static JSBool teletone_generate(JSContext *cx, JSObject *obj, uintN argc, jsval } if (tto->timer) { - int x; - - if ((x = switch_core_timer_next(tto->timer)) < 0) { + if (switch_core_timer_next(tto->timer)< 0) { break; } @@ -1850,7 +1851,7 @@ static JSBool js_email(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js if ( argc > 4) { file = JS_GetStringBytes(JS_ValueToString(cx, argv[4])); } - snprintf(filename, 80, "%smail.%ld", SWITCH_GLOBAL_dirs.temp_dir, switch_time_now()); + snprintf(filename, 80, "%smail.%ld%04x", SWITCH_GLOBAL_dirs.temp_dir, time(NULL), rand() & 0xffff); if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) { if (file) { @@ -2051,7 +2052,7 @@ static int env_init(JSContext *cx, JSObject *javascript_object) static void js_parse_and_execute(switch_core_session *session, char *input_code) { - JSObject *javascript_global_object = NULL, *session_obj = NULL; + JSObject *javascript_global_object = NULL; char buf[1024], *script, *arg, *argv[512]; int argc = 0, x = 0, y = 0; unsigned int flags = 0; @@ -2067,7 +2068,7 @@ static void js_parse_and_execute(switch_core_session *session, char *input_code) JS_SetGlobalObject(cx, javascript_global_object); /* Emaculent conception of session object into the script if one is available */ - if (session && (session_obj = new_js_session(cx, javascript_global_object, session, &jss, "session", flags))) { + if (session && new_js_session(cx, javascript_global_object, session, &jss, "session", flags)) { JS_SetPrivate(cx, javascript_global_object, session); } } else { diff --git a/src/switch.c b/src/switch.c index d566cd92be..a8dab950e2 100644 --- a/src/switch.c +++ b/src/switch.c @@ -36,6 +36,7 @@ static int RUNNING = 0; static int handle_SIGPIPE(int sig) { + if(sig); switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Sig Pipe!\n"); return 0; } @@ -50,12 +51,14 @@ static int handle_SIGBUS(int sig) /* no ctl-c mofo */ static int handle_SIGINT(int sig) { + if (sig); return 0; } static int handle_SIGHUP(int sig) { + if(sig); RUNNING = 0; return 0; } @@ -113,6 +116,9 @@ int main(int argc, char *argv[]) } +#ifdef __ICC +#pragma warning (disable:167) +#endif /* set signal handlers */ signal(SIGINT, (void *) handle_SIGINT); diff --git a/src/switch_buffer.c b/src/switch_buffer.c index b63c7e7f0c..3541cab2d3 100644 --- a/src/switch_buffer.c +++ b/src/switch_buffer.c @@ -33,11 +33,11 @@ struct switch_buffer { unsigned char *data; - size_t used; - size_t datalen; + switch_size_t used; + switch_size_t datalen; }; -SWITCH_DECLARE(switch_status) switch_buffer_create(switch_memory_pool *pool, switch_buffer **buffer, size_t max_len) +SWITCH_DECLARE(switch_status) switch_buffer_create(switch_memory_pool *pool, switch_buffer **buffer, switch_size_t max_len) { switch_buffer *new_buffer; @@ -50,33 +50,33 @@ SWITCH_DECLARE(switch_status) switch_buffer_create(switch_memory_pool *pool, swi return SWITCH_STATUS_MEMERR; } -SWITCH_DECLARE(int) switch_buffer_len(switch_buffer *buffer) +SWITCH_DECLARE(switch_size_t) switch_buffer_len(switch_buffer *buffer) { assert(buffer != NULL); - return (int) buffer->datalen; + return buffer->datalen; } -SWITCH_DECLARE(int) switch_buffer_freespace(switch_buffer *buffer) +SWITCH_DECLARE(switch_size_t) switch_buffer_freespace(switch_buffer *buffer) { assert(buffer != NULL); - return (int) (buffer->datalen - buffer->used); + return (switch_size_t) (buffer->datalen - buffer->used); } -SWITCH_DECLARE(size_t) switch_buffer_inuse(switch_buffer *buffer) +SWITCH_DECLARE(switch_size_t) switch_buffer_inuse(switch_buffer *buffer) { assert(buffer != NULL); - return (int) buffer->used; + return buffer->used; } -SWITCH_DECLARE(int) switch_buffer_toss(switch_buffer *buffer, size_t datalen) +SWITCH_DECLARE(switch_size_t) switch_buffer_toss(switch_buffer *buffer, switch_size_t datalen) { - size_t reading = 0; + switch_size_t reading = 0; assert(buffer != NULL); @@ -92,12 +92,12 @@ SWITCH_DECLARE(int) switch_buffer_toss(switch_buffer *buffer, size_t datalen) memmove(buffer->data, buffer->data + reading, buffer->datalen - reading); buffer->used -= datalen; - return (int) buffer->datalen; + return buffer->datalen; } -SWITCH_DECLARE(int) switch_buffer_read(switch_buffer *buffer, void *data, size_t datalen) +SWITCH_DECLARE(switch_size_t) switch_buffer_read(switch_buffer *buffer, void *data, switch_size_t datalen) { - size_t reading = 0; + switch_size_t reading = 0; assert(buffer != NULL); assert(data != NULL); @@ -116,12 +116,12 @@ SWITCH_DECLARE(int) switch_buffer_read(switch_buffer *buffer, void *data, size_t memmove(buffer->data, buffer->data + reading, buffer->datalen - reading); buffer->used -= reading; //printf("o %d = %d\n", reading, buffer->used); - return (int) reading; + return reading; } -SWITCH_DECLARE(int) switch_buffer_write(switch_buffer *buffer, void *data, size_t datalen) +SWITCH_DECLARE(switch_size_t) switch_buffer_write(switch_buffer *buffer, void *data, switch_size_t datalen) { - size_t freespace; + switch_size_t freespace; assert(buffer != NULL); assert(data != NULL); @@ -136,7 +136,7 @@ SWITCH_DECLARE(int) switch_buffer_write(switch_buffer *buffer, void *data, size_ buffer->used += datalen; } //printf("i %d = %d\n", datalen, buffer->used); - return (int) buffer->used; + return buffer->used; } SWITCH_DECLARE(void) switch_buffer_zero(switch_buffer *buffer) diff --git a/src/switch_channel.c b/src/switch_channel.c index 3acbdd8104..6b2190aa05 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -37,7 +37,7 @@ struct switch_channel { switch_mutex_t *dtmf_mutex; switch_core_session *session; switch_channel_state state; - switch_channel_flag flags; + uint32_t flags; switch_caller_profile *caller_profile; switch_caller_profile *originator_caller_profile; switch_caller_profile *originatee_caller_profile; @@ -115,9 +115,9 @@ SWITCH_DECLARE(switch_status) switch_channel_get_raw_mode(switch_channel *channe } -SWITCH_DECLARE(size_t) switch_channel_has_dtmf(switch_channel *channel) +SWITCH_DECLARE(switch_size_t) switch_channel_has_dtmf(switch_channel *channel) { - size_t has; + switch_size_t has; assert(channel != NULL); switch_mutex_lock(channel->dtmf_mutex); @@ -130,22 +130,27 @@ SWITCH_DECLARE(size_t) switch_channel_has_dtmf(switch_channel *channel) SWITCH_DECLARE(switch_status) switch_channel_queue_dtmf(switch_channel *channel, char *dtmf) { switch_status status; + register switch_size_t len, inuse; assert(channel != NULL); switch_mutex_lock(channel->dtmf_mutex); - if (switch_buffer_inuse(channel->dtmf_buffer) + strlen(dtmf) > (size_t) switch_buffer_len(channel->dtmf_buffer)) { + + inuse = switch_buffer_inuse(channel->dtmf_buffer); + len = strlen(dtmf); + + if (len + inuse > switch_buffer_len(channel->dtmf_buffer)) { switch_buffer_toss(channel->dtmf_buffer, strlen(dtmf)); } - status = switch_buffer_write(channel->dtmf_buffer, dtmf, strlen(dtmf)); + status = switch_buffer_write(channel->dtmf_buffer, dtmf, len) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_MEMERR; switch_mutex_unlock(channel->dtmf_mutex); return status; } -SWITCH_DECLARE(int) switch_channel_dequeue_dtmf(switch_channel *channel, char *dtmf, size_t len) +SWITCH_DECLARE(int) switch_channel_dequeue_dtmf(switch_channel *channel, char *dtmf, switch_size_t len) { int bytes; switch_event *event; @@ -170,7 +175,7 @@ SWITCH_DECLARE(int) switch_channel_dequeue_dtmf(switch_channel *channel, char *d SWITCH_DECLARE(switch_status) switch_channel_init(switch_channel *channel, switch_core_session *session, - switch_channel_state state, switch_channel_flag flags) + switch_channel_state state, uint32_t flags) { assert(channel != NULL); channel->state = state; @@ -225,21 +230,19 @@ SWITCH_DECLARE(switch_status) switch_channel_set_variable(switch_channel *channe return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status) switch_channel_test_flag(switch_channel *channel, int flags) +SWITCH_DECLARE(int) switch_channel_test_flag(switch_channel *channel, switch_channel_flag flags) { - return switch_test_flag(channel, flags); + return switch_test_flag(channel, flags) ? 1 : 0; } -SWITCH_DECLARE(switch_status) switch_channel_set_flag(switch_channel *channel, int flags) +SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel *channel, switch_channel_flag flags) { switch_set_flag(channel, flags); - return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status) switch_channel_clear_flag(switch_channel *channel, int flags) +SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel *channel, switch_channel_flag flags) { - switch_set_flag(channel, flags); - return SWITCH_STATUS_SUCCESS; + switch_clear_flag(channel, flags); } SWITCH_DECLARE(switch_channel_state) switch_channel_get_state(switch_channel *channel) @@ -447,9 +450,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel *channel, swit for (hi = switch_hash_first(switch_core_session_get_pool(channel->session), channel->variables); hi; hi = switch_hash_next(hi)) { char buf[1024]; - switch_event_subclass *subclass; switch_hash_this(hi, &var, NULL, &val); - subclass = val; snprintf(buf, sizeof(buf), "variable_%s", (char *) var); switch_event_add_header(event, SWITCH_STACK_BOTTOM, buf, (char *) val); } diff --git a/src/switch_console.c b/src/switch_console.c index 157ca8785e..0cecdd8ec7 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -31,7 +31,7 @@ */ #include #include -#define CMD_BUFLEN SWITCH_RECCOMMENDED_BUFFER_SIZE * 10 +#define CMD_BUFLEN 1024 * 1000 static int switch_console_process(char *cmd, char *retbuf, int retlen) { @@ -62,8 +62,7 @@ static int switch_console_process(char *cmd, char *retbuf, int retlen) *arg++ = '\0'; } if (switch_api_execute(cmd, arg, retbuf, retlen) == SWITCH_STATUS_SUCCESS) { - switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "API CALL [%s(%s)] output:\n%s\n", cmd, arg ? arg : "", - retbuf); + switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "API CALL [%s(%s)] output:\n%s\n", cmd, arg ? arg : "", retbuf); } else { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Unknown Command: %s\n", cmd); } @@ -98,7 +97,7 @@ SWITCH_DECLARE(void) switch_console_printf(switch_text_channel channel, char *fi if (channel == SWITCH_CHANNEL_ID_CONSOLE_CLEAN) { fprintf(handle, "%s", data); } else { - size_t retsize; + switch_size_t retsize; switch_time_exp_t tm; switch_event *event; switch_time_exp_lt(&tm, switch_time_now()); @@ -152,7 +151,7 @@ SWITCH_DECLARE(void) switch_console_loop(void) memset(&cmd, 0, sizeof(cmd)); for (x = 0; x < sizeof(cmd); x++) { - cmd[x] = (char)getchar(); + cmd[x] = (char) getchar(); if (cmd[x] == '\n') { cmd[x] = '\0'; break; diff --git a/src/switch_core.c b/src/switch_core.c index 4742522a78..53d0b71d0c 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -33,7 +33,7 @@ //#define DEBUG_ALLOC struct switch_core_session { - unsigned long id; + uint32_t id; char name[80]; int thread_running; switch_memory_pool *pool; @@ -74,7 +74,7 @@ SWITCH_DECLARE_DATA switch_directories SWITCH_GLOBAL_dirs; struct switch_core_runtime { time_t initiated; - unsigned long session_id; + uint32_t session_id; apr_pool_t *memory_pool; switch_hash *session_table; switch_core_db *db; @@ -96,7 +96,7 @@ static void switch_core_standard_on_transmit(switch_core_session *session); /* The main runtime obj we keep this hidden for ourselves */ static struct switch_core_runtime runtime; -static void db_pick_path(char *dbname, char *buf, size_t size) +static void db_pick_path(char *dbname, char *buf, switch_size_t size) { memset(buf, 0, size); @@ -227,7 +227,7 @@ SWITCH_DECLARE(switch_codec *) switch_core_session_get_write_codec(switch_core_s } SWITCH_DECLARE(switch_status) switch_core_codec_init(switch_codec *codec, char *codec_name, int rate, int ms, - int channels, switch_codec_flag flags, + int channels, uint32_t flags, const switch_codec_settings *codec_settings, switch_memory_pool *pool) { @@ -282,10 +282,10 @@ SWITCH_DECLARE(switch_status) switch_core_codec_init(switch_codec *codec, char * SWITCH_DECLARE(switch_status) switch_core_codec_encode(switch_codec *codec, switch_codec *other_codec, void *decoded_data, - size_t decoded_data_len, + switch_size_t decoded_data_len, int decoded_rate, void *encoded_data, - size_t *encoded_data_len, int *encoded_rate, unsigned int *flag) + switch_size_t *encoded_data_len, int *encoded_rate, unsigned int *flag) { assert(codec != NULL); assert(encoded_data != NULL); @@ -313,10 +313,10 @@ SWITCH_DECLARE(switch_status) switch_core_codec_encode(switch_codec *codec, SWITCH_DECLARE(switch_status) switch_core_codec_decode(switch_codec *codec, switch_codec *other_codec, void *encoded_data, - size_t encoded_data_len, + switch_size_t encoded_data_len, int encoded_rate, void *decoded_data, - size_t *decoded_data_len, int *decoded_rate, unsigned int *flag) + switch_size_t *decoded_data_len, int *decoded_rate, unsigned int *flag) { assert(codec != NULL); @@ -392,14 +392,14 @@ SWITCH_DECLARE(switch_status) switch_core_file_open(switch_file_handle *fh, char return fh->file_interface->file_open(fh, file_path); } -SWITCH_DECLARE(switch_status) switch_core_file_read(switch_file_handle *fh, void *data, size_t *len) +SWITCH_DECLARE(switch_status) switch_core_file_read(switch_file_handle *fh, void *data, switch_size_t *len) { assert(fh != NULL); return fh->file_interface->file_read(fh, data, len); } -SWITCH_DECLARE(switch_status) switch_core_file_write(switch_file_handle *fh, void *data, size_t *len) +SWITCH_DECLARE(switch_status) switch_core_file_write(switch_file_handle *fh, void *data, switch_size_t *len) { assert(fh != NULL); @@ -513,8 +513,8 @@ SWITCH_DECLARE(switch_status) switch_core_speech_feed_tts(switch_speech_handle * SWITCH_DECLARE(switch_status) switch_core_speech_read_tts(switch_speech_handle *sh, void *data, - size_t *datalen, - size_t *rate, + switch_size_t *datalen, + switch_size_t *rate, switch_speech_flag *flags) { assert(sh != NULL); @@ -599,6 +599,7 @@ static void *switch_core_service_thread(switch_thread *thread, void *obj) switch_frame *read_frame; int stream_id = *stream_id_p; + assert(thread != NULL); assert(session != NULL); channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -612,7 +613,6 @@ static void *switch_core_service_thread(switch_thread *thread, void *obj) default: data->running = -1; continue; - break; } switch_yield(10000); @@ -650,7 +650,7 @@ SWITCH_DECLARE(switch_memory_pool *) switch_core_session_get_pool(switch_core_se /* **ONLY** alloc things with this function that **WILL NOT** outlive the session itself or expect an earth shattering KABOOM!*/ -SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session *session, size_t memory) +SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session *session, switch_size_t memory) { void *ptr = NULL; assert(session != NULL); @@ -670,7 +670,7 @@ SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session *session, s /* **ONLY** alloc things with these functions that **WILL NOT** need to be freed *EVER* ie this is for *PERMENANT* memory allocation */ -SWITCH_DECLARE(void *) switch_core_permenant_alloc(size_t memory) +SWITCH_DECLARE(void *) switch_core_permenant_alloc(switch_size_t memory) { void *ptr = NULL; assert(runtime.memory_pool != NULL); @@ -688,7 +688,7 @@ SWITCH_DECLARE(void *) switch_core_permenant_alloc(size_t memory) SWITCH_DECLARE(char *) switch_core_permenant_strdup(char *todup) { char *duped = NULL; - size_t len; + switch_size_t len; assert(runtime.memory_pool != NULL); @@ -711,7 +711,7 @@ SWITCH_DECLARE(char *) switch_core_permenant_strdup(char *todup) SWITCH_DECLARE(char *) switch_core_session_strdup(switch_core_session *session, char *todup) { char *duped = NULL; - size_t len; + switch_size_t len; assert(session != NULL); assert(session->pool != NULL); @@ -734,7 +734,7 @@ SWITCH_DECLARE(char *) switch_core_session_strdup(switch_core_session *session, SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool *pool, char *todup) { char *duped = NULL; - size_t len; + switch_size_t len; assert(pool != NULL); if (!todup) { @@ -963,9 +963,9 @@ SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session break; default: switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s decoder error!\n", + session->read_codec->codec_interface->interface_name); return status; - break; } } if (session->read_resampler) { @@ -988,8 +988,8 @@ SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session perfect = TRUE; } else { if (!session->raw_read_buffer) { - size_t bytes = session->read_codec->implementation->bytes_per_frame * 10; - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Engaging Read Buffer at %d bytes\n", bytes); + switch_size_t bytes = session->read_codec->implementation->bytes_per_frame * 10; + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Engaging Read Buffer at %u bytes\n", bytes); switch_buffer_create(session->pool, &session->raw_read_buffer, bytes); } if (!switch_buffer_write(session->raw_read_buffer, read_frame->data, read_frame->datalen)) { @@ -1013,13 +1013,14 @@ SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session } session->enc_read_frame.datalen = session->enc_read_frame.buflen; status = switch_core_codec_encode(session->read_codec, - (*frame)->codec, - session->raw_read_frame.data, - session->raw_read_frame.datalen, - (*frame)->codec->implementation->samples_per_second, + enc_frame->codec, + enc_frame->data, + enc_frame->datalen, + enc_frame->codec->implementation->samples_per_second, session->enc_read_frame.data, &session->enc_read_frame.datalen, - &session->enc_read_frame.rate, &flag); + &session->enc_read_frame.rate, + &flag); switch (status) { @@ -1122,7 +1123,6 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio break; case SWITCH_STATUS_BREAK: return SWITCH_STATUS_SUCCESS; - break; case SWITCH_STATUS_NOOP: write_frame = frame; status = SWITCH_STATUS_SUCCESS; @@ -1131,7 +1131,6 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s decoder error!\n", frame->codec->codec_interface->interface_name); return status; - break; } } if (session->write_resampler) { @@ -1155,9 +1154,9 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio perfect = TRUE; } else { if (!session->raw_write_buffer) { - size_t bytes = session->write_codec->implementation->bytes_per_frame * 10; + switch_size_t bytes = session->write_codec->implementation->bytes_per_frame * 10; switch_console_printf(SWITCH_CHANNEL_CONSOLE, - "Engaging Write Buffer at %d bytes to accomodate %d->%d\n", + "Engaging Write Buffer at %u bytes to accomodate %u->%u\n", bytes, write_frame->datalen, session->write_codec->implementation->bytes_per_frame); if ((status = @@ -1202,15 +1201,14 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio session->read_codec->codec_interface->interface_name); write_frame = NULL; return status; - break; } status = perform_write(session, write_frame, timeout, io_flag, stream_id); return status; } else { - size_t used = switch_buffer_inuse(session->raw_write_buffer); - size_t bytes = session->write_codec->implementation->bytes_per_frame; - size_t frames = (used / bytes); + switch_size_t used = switch_buffer_inuse(session->raw_write_buffer); + switch_size_t bytes = session->write_codec->implementation->bytes_per_frame; + switch_size_t frames = (used / bytes); @@ -1219,7 +1217,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio status = SWITCH_STATUS_SUCCESS; if (frames) { - size_t x; + switch_size_t x; for (x = 0; x < frames; x++) { if ((session->raw_write_frame.datalen = switch_buffer_read(session->raw_write_buffer, session->raw_write_frame.data, bytes)) != 0) { @@ -1264,7 +1262,6 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio session->read_codec->codec_interface->interface_name); write_frame = NULL; return status; - break; } if (session->read_resampler) { @@ -1672,13 +1669,12 @@ static void switch_core_standard_on_execute(switch_core_session *session) static void switch_core_standard_on_loopback(switch_core_session *session) { - switch_channel_state state; switch_frame *frame; int stream_id; switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Standard LOOPBACK\n"); - while ((state = switch_channel_get_state(session->channel)) == CS_LOOPBACK) { + while (switch_channel_get_state(session->channel) == CS_LOOPBACK) { for (stream_id = 0; stream_id < session->stream_count; stream_id++) { if (switch_core_session_read_frame(session, &frame, -1, stream_id) == SWITCH_STATUS_SUCCESS) { switch_core_session_write_frame(session, frame, -1, stream_id); @@ -1689,6 +1685,7 @@ static void switch_core_standard_on_loopback(switch_core_session *session) static void switch_core_standard_on_transmit(switch_core_session *session) { + assert(session != NULL); switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Standard TRANSMIT\n"); } @@ -1754,7 +1751,6 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session) break; case CS_DONE: continue; - break; case CS_HANGUP: /* Deactivate and end the thread */ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "(%s) State HANGUP\n", switch_channel_get_name(session->channel)); if (!driver_state_handler->on_hangup || @@ -2016,6 +2012,7 @@ SWITCH_DECLARE(switch_status) switch_core_hash_init(switch_hash **hash, switch_m SWITCH_DECLARE(switch_status) switch_core_hash_destroy(switch_hash *hash) { + assert(hash != NULL); return SWITCH_STATUS_SUCCESS; } @@ -2088,19 +2085,16 @@ SWITCH_DECLARE(void) switch_core_launch_thread(switch_thread_start_t func, void static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread *thread, void *obj) { - unsigned int id; switch_core_session *session = obj; session->thread = thread; + session->id = runtime.session_id++; - id = runtime.session_id++; - session->id = id; - - snprintf(session->name, sizeof(session->name), "%ld", session->id); + snprintf(session->name, sizeof(session->name), "%u", session->id); switch_core_hash_insert(runtime.session_table, session->uuid_str, session); switch_core_session_run(session); switch_core_hash_delete(runtime.session_table, session->uuid_str); - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Session %ld (%s) Ended\n", id, switch_channel_get_name(session->channel)); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Session %u (%s) Ended\n", session->id, switch_channel_get_name(session->channel)); switch_core_session_destroy(&session); return NULL; } @@ -2135,7 +2129,7 @@ SWITCH_DECLARE(void) switch_core_session_launch_thread(switch_core_session *sess } -SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool *pool, size_t memory) +SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool *pool, switch_size_t memory) { void *ptr = NULL; assert(pool != NULL); @@ -2179,7 +2173,7 @@ SWITCH_DECLARE(switch_core_session *) switch_core_session_request(const switch_e return NULL; } - switch_channel_init(session->channel, session, CS_NEW, CF_SEND_AUDIO | CF_RECV_AUDIO); + switch_channel_init(session->channel, session, CS_NEW, (CF_SEND_AUDIO | CF_RECV_AUDIO)); /* The session *IS* the pool you may not alter it because you have no idea how its all private it will be passed to the thread run function */ @@ -2222,14 +2216,13 @@ SWITCH_DECLARE(switch_core_session *) switch_core_session_request_by_name(char * static void core_event_handler(switch_event *event) { - char buf[1024]; + //char buf[1024]; switch (event->event_id) { case SWITCH_EVENT_LOG: return; - break; default: - buf[0] = '\0'; + //buf[0] = '\0'; //switch_event_serialize(event, buf, sizeof(buf), NULL); //switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nCORE EVENT\n--------------------------------\n%s\n", buf); break; @@ -2293,7 +2286,7 @@ SWITCH_DECLARE(switch_status) switch_core_init(char *console) - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocated memory pool. Sessions are %d bytes\n", sizeof(struct switch_core_session)); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocated memory pool. Sessions are %u bytes\n", sizeof(struct switch_core_session)); switch_event_init(runtime.memory_pool); assert(runtime.memory_pool != NULL); diff --git a/src/switch_event.c b/src/switch_event.c index 58a71ba9a5..7f660c0d2c 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -45,7 +45,7 @@ static switch_hash *CUSTOM_HASH = NULL; static int THREAD_RUNNING = 0; #if 0 -static void *locked_alloc(size_t len) +static void *locked_alloc(switch_size_t len) { void *mem; @@ -146,6 +146,8 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread *thread, void void *pop; int i, len[3] = {0,0,0}; + assert(thread != NULL); + assert(obj == NULL); assert(POOL_LOCK != NULL); assert(RUNTIME_POOL != NULL); THREAD_RUNNING = 1; @@ -161,10 +163,12 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread *thread, void ) { for(i = 0; i < 3; i++) { - queue = queues[i]; - while (queue && switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS) { - out_event = pop; - switch_event_deliver(&out_event); + if (len[i]) { + queue = queues[i]; + while (queue && switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS) { + out_event = pop; + switch_event_deliver(&out_event); + } } } @@ -361,7 +365,7 @@ SWITCH_DECLARE(switch_status) switch_event_add_header(switch_event *event, switc header->name = DUP(header_name); header->value = DUP(data); - if (((stack = SWITCH_STACK_TOP)) != 0) { + if (stack == SWITCH_STACK_TOP) { header->next = event->headers; event->headers = header; } else { @@ -404,10 +408,9 @@ SWITCH_DECLARE(void) switch_event_destroy(switch_event **event) for (hp = ep->headers; hp;) { this = hp; - FREE(hp->name); - FREE(hp->value); hp = hp->next; - + FREE(this->name); + FREE(this->value); } FREE(ep->body); FREE(ep); @@ -448,9 +451,9 @@ SWITCH_DECLARE(switch_status) switch_event_dup(switch_event **event, switch_even return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *buf, size_t buflen, char *fmt, ...) +SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *buf, switch_size_t buflen, char *fmt, ...) { - size_t len = 0; + switch_size_t len = 0; switch_event_header *hp; char *data = NULL, *body = NULL; int ret = 0; @@ -507,7 +510,7 @@ SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, switch_time_exp_t tm; char date[80] = ""; - size_t retsize; + switch_size_t retsize; assert(BLOCK != NULL); assert(RUNTIME_POOL != NULL); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index ed0fb1b231..1c48c3cd90 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -200,7 +200,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_record_file(switch_core_session *sessio switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Raw Codec Activated\n"); switch_core_session_set_read_codec(session, &codec); } else { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Raw Codec Activation Failed %s@%dhz %d channels %dms\n", + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, read_codec->implementation->microseconds_per_frame / 1000); switch_core_file_close(fh); return SWITCH_STATUS_GENERR; @@ -208,7 +208,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_record_file(switch_core_session *sessio while(switch_channel_ready(channel)) { - size_t len; + switch_size_t len; if (dtmf_callback || buf) { /* @@ -234,7 +234,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_record_file(switch_core_session *sessio break; } if (!switch_test_flag(fh, SWITCH_FILE_PAUSE)) { - len = (size_t) read_frame->datalen / 2; + len = (switch_size_t) read_frame->datalen / 2; switch_core_file_write(fh, read_frame->data, &len); } } @@ -257,14 +257,13 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session, short abuf[960]; char dtmf[128]; int interval = 0, samples = 0; - size_t len = 0, ilen = 0, olen = 0; + switch_size_t len = 0, ilen = 0, olen = 0; switch_frame write_frame; switch_timer timer; switch_core_thread_session thread_session; switch_codec codec; switch_memory_pool *pool = switch_core_session_get_pool(session); char *codec_name; - int x; int stream_id; switch_status status = SWITCH_STATUS_SUCCESS; switch_file_handle lfh; @@ -290,7 +289,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session, write_frame.buflen = sizeof(abuf); - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OPEN FILE %s %dhz %d channels\n", file, fh->samplerate, fh->channels); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OPEN FILE %s %uhz %u channels\n", file, fh->samplerate, fh->channels); interval = 20; samples = (fh->samplerate / 50) * fh->channels; @@ -308,7 +307,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session, switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Raw Codec Activated\n"); write_frame.codec = &codec; } else { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Raw Codec Activation Failed %s@%dhz %d channels %dms\n", + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval); switch_core_file_close(fh); return SWITCH_STATUS_GENERR; @@ -321,7 +320,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session, switch_core_file_close(fh); return SWITCH_STATUS_GENERR; } - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "setup timer success %d bytes per %d ms!\n", len, interval); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "setup timer success %u bytes per %d ms!\n", len, interval); } write_frame.rate = fh->samplerate; @@ -389,9 +388,9 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session, if (fh->speed && do_speed) { float factor = 0.25f * abs(fh->speed); - size_t newlen, supplement, step; + switch_size_t newlen, supplement, step; short *bp = write_frame.data; - size_t wrote = 0; + switch_size_t wrote = 0; if (!fh->audio_buffer) { switch_buffer_create(fh->memory_pool, &fh->audio_buffer, SWITCH_RECCOMMENDED_BUFFER_SIZE); @@ -418,7 +417,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session, } } if (wrote < newlen) { - size_t r = newlen - wrote; + switch_size_t r = newlen - wrote; switch_buffer_write(fh->audio_buffer, bp, r*2); wrote += r; } @@ -443,7 +442,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session, } } if (timer_name) { - if ((x = switch_core_timer_next(&timer)) < 0) { + if (switch_core_timer_next(&timer) < 0) { break; } } else { /* time off the channel (if you must) */ @@ -475,7 +474,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session char *tts_name, char *voice_name, char *timer_name, - size_t rate, + switch_size_t rate, switch_dtmf_callback_function dtmf_callback, char *text, void *buf, @@ -485,9 +484,9 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session short abuf[960]; char dtmf[128]; int interval = 0; - size_t samples = 0; - size_t len = 0; - size_t ilen = 0; + switch_size_t samples = 0; + switch_size_t len = 0; + switch_size_t ilen = 0; switch_frame write_frame; switch_timer timer; switch_core_thread_session thread_session; @@ -501,7 +500,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session switch_status status = SWITCH_STATUS_SUCCESS; switch_speech_handle sh; - switch_speech_flag flags = SWITCH_SPEECH_FLAG_TTS; + uint32_t flags = SWITCH_SPEECH_FLAG_TTS; memset(&sh, 0, sizeof(sh)); @@ -543,8 +542,8 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Raw Codec Activated\n"); write_frame.codec = &codec; } else { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Raw Codec Activation Failed %s@%dhz %d channels %dms\n", - codec_name, rate, 1, interval); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Raw Codec Activation Failed %s@%uhz 1 channel %dms\n", + codec_name, rate, interval); flags = 0; switch_core_speech_close(&sh, &flags); return SWITCH_STATUS_GENERR; @@ -558,7 +557,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session switch_core_speech_close(&sh, &flags); return SWITCH_STATUS_GENERR; } - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "setup timer success %d bytes per %d ms!\n", len, interval); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "setup timer success %u bytes per %d ms!\n", len, interval); } flags = 0; @@ -692,6 +691,7 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj) switch_dtmf_callback_function dtmf_callback; void *user_data; + assert(thread != NULL); switch_channel *chan_a, *chan_b; switch_frame *read_frame; switch_core_session *session_a, *session_b; @@ -700,7 +700,7 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj) session_b = data->objs[1]; stream_id_p = data->objs[2]; - dtmf_callback = data->objs[3]; + dtmf_callback = (switch_dtmf_callback_function) data->objs[3]; user_data = data->objs[4]; his_thread = data->objs[5]; @@ -723,7 +723,6 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj) case CS_HANGUP: data->running = -1; continue; - break; default: break; } @@ -762,7 +761,7 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj) if (switch_core_session_read_frame(session_a, &read_frame, -1, stream_id) == SWITCH_STATUS_SUCCESS && read_frame->datalen) { if (switch_core_session_write_frame(session_b, read_frame, -1, stream_id) != SWITCH_STATUS_SUCCESS) { - switch_console_printf(SWITCH_CHANNEL_CONSOLE, "write: %s Bad Frame....[%d] Bubye!\n", switch_channel_get_name(chan_b), read_frame->datalen); + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "write: %s Bad Frame....[%u] Bubye!\n", switch_channel_get_name(chan_b), read_frame->datalen); data->running = -1; } } else { diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 7923149508..5830b482b7 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -32,18 +32,26 @@ #include +typedef switch_status (*switch_module_load_t) (switch_loadable_module_interface **, char *); +typedef switch_status (*switch_module_reload_t) (void); +typedef switch_status (*switch_module_pause_t) (void); +typedef switch_status (*switch_module_resume_t) (void); +typedef switch_status (*switch_module_status_t) (void); +typedef switch_status (*switch_module_runtime_t) (void); +typedef switch_status (*switch_module_shutdown_t) (void); + + struct switch_loadable_module { char *filename; const switch_loadable_module_interface *interface; void *lib; - switch_status (*switch_module_load) (switch_loadable_module_interface **, char *); - switch_status (*switch_module_reload) (void); - switch_status (*switch_module_pause) (void); - switch_status (*switch_module_resume) (void); - switch_status (*switch_module_status) (void); - switch_status (*switch_module_runtime) (void); - switch_status (*switch_module_shutdown) (void); - + switch_module_load_t switch_module_load; + switch_module_reload_t switch_module_reload; + switch_module_pause_t switch_module_pause; + switch_module_resume_t switch_module_resume; + switch_module_status_t switch_module_status; + switch_module_runtime_t switch_module_runtime; + switch_module_shutdown_t switch_module_shutdown; }; struct switch_loadable_module_container { @@ -64,6 +72,9 @@ static struct switch_loadable_module_container loadable_modules; static void *switch_loadable_module_exec(switch_thread *thread, void *obj) { + + assert(thread != NULL); + switch_status status = SWITCH_STATUS_SUCCESS; switch_core_thread_session *ts = obj; switch_loadable_module *module = ts->objs[0]; @@ -85,6 +96,9 @@ static void *switch_loadable_module_exec(switch_thread *thread, void *obj) return NULL; } + +typedef switch_status (*switch_load_fp_t)(switch_loadable_module_interface **, char *); + static switch_status switch_loadable_module_load_file(char *filename, switch_memory_pool *pool, switch_loadable_module **new_module) { @@ -92,7 +106,8 @@ static switch_status switch_loadable_module_load_file(char *filename, switch_mem apr_dso_handle_t *dso = NULL; apr_status_t status = SWITCH_STATUS_SUCCESS; apr_dso_handle_sym_t function_handle = NULL; - switch_status (*load_func_ptr) (switch_loadable_module_interface **, char *) = NULL; + //switch_status (*load_func_ptr) (switch_loadable_module_interface **, char *) = NULL; + switch_load_fp_t load_func_ptr = NULL; int loading = 1; const char *err = NULL; switch_loadable_module_interface *interface = NULL; @@ -111,7 +126,7 @@ static switch_status switch_loadable_module_load_file(char *filename, switch_mem } status = apr_dso_sym(&function_handle, dso, "switch_module_load"); - load_func_ptr = function_handle; + load_func_ptr = (switch_load_fp_t) function_handle; if (load_func_ptr == NULL) { err = "Cannot Load"; @@ -142,27 +157,27 @@ static switch_status switch_loadable_module_load_file(char *filename, switch_mem module->switch_module_load = load_func_ptr; if ((status = apr_dso_sym(&function_handle, dso, "switch_module_reload")) == APR_SUCCESS) { - module->switch_module_reload = function_handle; + module->switch_module_reload = (switch_module_reload_t) function_handle; } if ((status = apr_dso_sym(&function_handle, dso, "switch_module_pause")) == APR_SUCCESS) { - module->switch_module_pause = function_handle; + module->switch_module_pause = (switch_module_pause_t) function_handle; } if ((status = apr_dso_sym(&function_handle, dso, "switch_module_resume")) == APR_SUCCESS) { - module->switch_module_resume = function_handle; + module->switch_module_resume = (switch_module_resume_t) function_handle; } if ((status = apr_dso_sym(&function_handle, dso, "switch_module_status")) == APR_SUCCESS) { - module->switch_module_status = function_handle; + module->switch_module_status = (switch_module_status_t) function_handle; } if ((status = apr_dso_sym(&function_handle, dso, "switch_module_shutdown")) == APR_SUCCESS) { - module->switch_module_shutdown = function_handle; + module->switch_module_shutdown = (switch_module_shutdown_t) function_handle; } if ((status = apr_dso_sym(&function_handle, dso, "switch_module_runtime")) == APR_SUCCESS) { - module->switch_module_runtime = function_handle; + module->switch_module_runtime = (switch_module_runtime_t) function_handle; } module->lib = dso; @@ -180,7 +195,7 @@ static switch_status switch_loadable_module_load_file(char *filename, switch_mem static void process_module_file(char *dir, char *fname) { - size_t len = 0; + switch_size_t len = 0; char *path; char *file; switch_loadable_module *new_module = NULL; @@ -202,11 +217,15 @@ static void process_module_file(char *dir, char *fname) path = switch_core_strdup(loadable_modules.pool, file); } else { if (strchr(file, '.')) { - len = strlen(dir) + strlen(file) + 4; + len = strlen(dir); + len += strlen(file); + len += 4; path = (char *) switch_core_alloc(loadable_modules.pool, len); snprintf(path, len, "%s%s%s", dir, SWITCH_PATH_SEPARATOR, file); } else { - len = strlen(dir) + strlen(file) + 8; + len = strlen(dir); + len += strlen(file); + len += 8; path = (char *) switch_core_alloc(loadable_modules.pool, len); snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext); } @@ -330,7 +349,6 @@ static void switch_loadable_module_path_init() SWITCH_DECLARE(switch_status) switch_loadable_module_init() { - char *ptr = NULL; apr_finfo_t finfo = {0}; apr_dir_t *module_dir_handle = NULL; apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME; @@ -424,7 +442,7 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init() fname = finfo.name; } - if ((ptr = (char *) fname) == 0) { + if (!fname) { continue; } @@ -451,10 +469,10 @@ SWITCH_DECLARE(void) switch_loadable_module_shutdown(void) module = (switch_loadable_module *) val; switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Checking %s\t", module->interface->module_name); if (module->switch_module_shutdown) { - switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "(yes)\n", module->interface->module_name); + switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "(yes)\n"); module->switch_module_shutdown(); } else { - switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "(no)\n", module->interface->module_name); + switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "(no)\n"); } } @@ -524,7 +542,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool *pool, } -SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(switch_memory_pool *pool, switch_codec_interface **array, +SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(switch_codec_interface **array, int arraylen, char **prefs, int preflen) { int x, i = 0; @@ -542,7 +560,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(switch_memory_pool return i; } -SWITCH_DECLARE(switch_status) switch_api_execute(char *cmd, char *arg, char *retbuf, size_t len) +SWITCH_DECLARE(switch_status) switch_api_execute(char *cmd, char *arg, char *retbuf, switch_size_t len) { switch_api_interface *api; switch_status status; diff --git a/src/switch_mutex.c b/src/switch_mutex.c deleted file mode 100644 index 8cb9b6c4a3..0000000000 --- a/src/switch_mutex.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II - * - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * - * The Initial Developer of the Original Code is - * Anthony Minessale II - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II - * - * - * switch_mutex.c -- Mutex Locking - * - */ -#include - -SWITCH_DECLARE(switch_status) switch_mutex_init(switch_mutex_t **lock, switch_lock_flag flags, switch_memory_pool *pool) -{ - - return (apr_thread_mutex_create(lock, flags, pool) == APR_SUCCESS) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_GENERR; -} - -SWITCH_DECLARE(switch_status) switch_mutex_destroy(switch_mutex_t *lock) -{ - return apr_thread_mutex_destroy(lock); -} - -SWITCH_DECLARE(switch_status) switch_mutex_lock(switch_mutex_t *lock) -{ - return apr_thread_mutex_lock(lock); -} - -SWITCH_DECLARE(switch_status) switch_mutex_unlock(switch_mutex_t *lock) -{ - return apr_thread_mutex_unlock(lock); -} - -SWITCH_DECLARE(switch_status) switch_mutex_trylock(switch_mutex_t *lock) -{ - return apr_thread_mutex_trylock(lock); -} diff --git a/src/switch_resample.c b/src/switch_resample.c index 3c6f07b932..74da467031 100644 --- a/src/switch_resample.c +++ b/src/switch_resample.c @@ -48,10 +48,11 @@ SWITCH_DECLARE(switch_status) switch_resample_create(switch_audio_resampler **new_resampler, int from_rate, - size_t from_size, - int to_rate, size_t to_size, switch_memory_pool *pool) + switch_size_t from_size, + int to_rate, switch_size_t to_size, switch_memory_pool *pool) { switch_audio_resampler *resampler; + double lto_rate, lfrom_rate; if ((resampler = switch_core_alloc(pool, sizeof(*resampler))) == 0) { return SWITCH_STATUS_MEMERR; @@ -59,7 +60,9 @@ SWITCH_DECLARE(switch_status) switch_resample_create(switch_audio_resampler **ne resampler->from_rate = from_rate; resampler->to_rate = to_rate; - resampler->factor = ((double) resampler->to_rate / (double) resampler->from_rate); + lto_rate = (double) resampler->to_rate; + lfrom_rate = (double) resampler->from_rate; + resampler->factor = (lto_rate / lfrom_rate); resampler->resampler = resample_open(QUALITY, resampler->factor, resampler->factor); switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Activate Resampler %d->%d %f\n", resampler->from_rate, @@ -103,9 +106,9 @@ SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler *resampler) } -SWITCH_DECLARE(size_t) switch_float_to_short(float *f, short *s, size_t len) +SWITCH_DECLARE(switch_size_t) switch_float_to_short(float *f, short *s, switch_size_t len) { - size_t i; + switch_size_t i; float ft; for (i = 0; i < len; i++) { ft = f[i] * NORMFACT; diff --git a/src/switch_utils.c b/src/switch_utils.c index b34665c4c2..fc805effe3 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -36,16 +36,12 @@ SWITCH_DECLARE(char *) switch_priority_name(switch_priority_t priority) switch(priority) { /*lol*/ case SWITCH_PRIORITY_NORMAL: return "NORMAL"; - break; case SWITCH_PRIORITY_LOW: return "LOW"; - break; case SWITCH_PRIORITY_HIGH: return "HIGH"; - break; default: return "INVALID"; - break; } } @@ -53,19 +49,24 @@ static char RFC2833_CHARS[] = "0123456789*#ABCDF"; SWITCH_DECLARE(char) switch_rfc2833_to_char(int event) { - return (event > -1 && event < sizeof(RFC2833_CHARS)) ? RFC2833_CHARS[event] : '\0'; + if (event > -1 && event < sizeof(RFC2833_CHARS)) { + return RFC2833_CHARS[event]; + } + return '\0'; } SWITCH_DECLARE(unsigned char) switch_char_to_rfc2833(char key) { char *c; + unsigned char counter = 0; for (c = RFC2833_CHARS; *c ; c++) { if (*c == key) { - return (unsigned char)(c - RFC2833_CHARS); + return counter; } - } - return (unsigned char)-1; + counter++; + } + return '\0'; } SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char **array, int arraylen) @@ -123,10 +124,9 @@ SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_int16_t flags, switch_memory_pool *pool) { switch_pollset_t *pollset; - switch_status status; - if ((status = switch_pollset_create(&pollset, 1, pool, flags)) != SWITCH_STATUS_SUCCESS) { - return status; + if (switch_pollset_create(&pollset, 1, pool, flags) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_GENERR; } poll->desc_type = SWITCH_POLL_SOCKET; @@ -134,16 +134,19 @@ SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll, poll->desc.s = sock; poll->client_data = sock; - return switch_pollset_add(pollset, poll); + if (switch_pollset_add(pollset, poll) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_GENERR; + } + + return SWITCH_STATUS_SUCCESS; } SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms) { - switch_status status; int nsds = 0; - if ((status = switch_poll(poll, 1, &nsds, ms)) != SWITCH_STATUS_SUCCESS) { + if (switch_poll(poll, 1, &nsds, ms) != SWITCH_STATUS_SUCCESS) { return -1; }