diff --git a/configure.in b/configure.in index 69149ffd44..ac58ea7beb 100644 --- a/configure.in +++ b/configure.in @@ -123,6 +123,8 @@ if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC) + APR_ADDTO(SWITCH_AM_CXXFLAGS, "-features=extensions") + APR_ADDTO(SWITCH_AM_LDFLAGS, -R${prefix}/lib) elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC) diff --git a/src/include/switch.h b/src/include/switch.h index a739caa732..d1323cb587 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -53,8 +53,10 @@ #define __EXTENSIONS__ 1 #ifndef MACOSX #ifndef _XOPEN_SOURCE +#ifndef __cplusplus #define _XOPEN_SOURCE 600 #endif +#endif #ifndef __BSD_VISIBLE #define __BSD_VISIBLE 1 #endif diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index 6381f88450..57a5e7d6c8 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -26,7 +26,7 @@ class CoreSession { switch_input_args_t *ap; public: CoreSession(char *uuid); - CoreSession(switch_core_session_t *session); + CoreSession(switch_core_session_t *new_session); ~CoreSession(); switch_core_session_t *session; switch_channel_t *channel; diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 3247a81e02..73e8d02dda 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -562,7 +562,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw typedef enum { SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0), SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1), - SWITCH_IVR_MENU_FLAG_STACK = (1 << 2), + SWITCH_IVR_MENU_FLAG_STACK = (1 << 2) } switch_ivr_menu_flags; /* Actions are either set in switch_ivr_menu_bind_function or returned by a callback */ typedef enum { @@ -575,7 +575,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw SWITCH_IVR_ACTION_BACK, /* Go back 1 menu. */ SWITCH_IVR_ACTION_TOMAIN, /* Go back to the top level menu. */ SWITCH_IVR_ACTION_TRANSFER, /* Transfer caller to another ext. */ - SWITCH_IVR_ACTION_NOOP, /* No operation */ + SWITCH_IVR_ACTION_NOOP /* No operation */ } switch_ivr_action_t; struct switch_ivr_menu; typedef switch_ivr_action_t switch_ivr_menu_action_function_t(struct switch_ivr_menu *, char *, char *, size_t, void *); diff --git a/src/include/switch_stun.h b/src/include/switch_stun.h index 00961e5121..b8c31f75e5 100644 --- a/src/include/switch_stun.h +++ b/src/include/switch_stun.h @@ -106,12 +106,12 @@ typedef struct { typedef struct { int16_t type; uint16_t length; - char value[]; + char value[1]; } switch_stun_packet_attribute_t; typedef struct { switch_stun_packet_header_t header; - uint8_t first_attribute[]; + uint8_t first_attribute[1]; } switch_stun_packet_t; typedef struct { diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 8de15d21e2..dd4c5c90d3 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -161,7 +161,7 @@ typedef enum { SST_POSTAL_ADDRESS, SST_ACCOUNT_NUMBER, SST_NAME_SPELLED, - SST_NAME_PHONETIC, + SST_NAME_PHONETIC } switch_say_type_t; typedef enum { @@ -196,7 +196,7 @@ typedef enum { SWITCH_ABC_TYPE_READ, SWITCH_ABC_TYPE_WRITE, SWITCH_ABC_TYPE_WRITE_REPLACE, - SWITCH_ABC_TYPE_CLOSE, + SWITCH_ABC_TYPE_CLOSE } switch_abc_type_t; typedef struct { @@ -332,7 +332,7 @@ typedef enum { typedef enum { SWITCH_PRIORITY_NORMAL, SWITCH_PRIORITY_LOW, - SWITCH_PRIORITY_HIGH, + SWITCH_PRIORITY_HIGH } switch_priority_t; /*! @@ -702,7 +702,7 @@ SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0) - Free interface's pool on destruct */ typedef enum { - SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0), + SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0) } switch_directory_flag_t; @@ -732,7 +732,7 @@ SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0) - Free timer's pool on destruction */ typedef enum { - SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0), + SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0) } switch_timer_flag_t; @@ -786,7 +786,7 @@ typedef enum { } switch_file_flag_t; typedef enum { - SWITCH_IO_FLAG_NOOP = 0, + SWITCH_IO_FLAG_NOOP = 0 } switch_io_flag_t; /* make sure this is synced with the EVENT_NAMES array in switch_event.c diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index cc213ec652..4a24bc91f6 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -6,6 +6,7 @@ #endif #define sanity_check(x) do { if (!session) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0) +#define sanity_check_noreturn do { if (!session) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0) #define init_vars() do { session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; memset(&args, 0, sizeof(args)); ap = NULL;} while(0) CoreSession::CoreSession(char *nuuid) @@ -17,9 +18,10 @@ CoreSession::CoreSession(char *nuuid) } } -CoreSession::CoreSession(switch_core_session_t *session) +CoreSession::CoreSession(switch_core_session_t *new_session) { init_vars(); + session = new_session; channel = switch_core_session_get_channel(session); switch_core_session_read_lock(session); } @@ -55,13 +57,13 @@ int CoreSession::preAnswer() void CoreSession::hangup(char *cause) { - sanity_check(); + sanity_check_noreturn; switch_channel_hangup(channel, switch_channel_str2cause(cause)); } void CoreSession::setVariable(char *var, char *val) { - sanity_check(); + sanity_check_noreturn; switch_channel_set_variable(channel, var, val); } @@ -74,7 +76,7 @@ char *CoreSession::getVariable(char *var) void CoreSession::execute(char *app, char *data) { const switch_application_interface_t *application_interface; - sanity_check(); + sanity_check_noreturn; if ((application_interface = switch_loadable_module_get_application_interface(app))) { begin_allow_threads(); @@ -99,7 +101,7 @@ int CoreSession::playFile(char *file, char *timer_name) void CoreSession::setDTMFCallback(switch_input_callback_function_t cb, void *buf, uint32_t buflen) { - sanity_check(); + sanity_check_noreturn; if (cb) { args.buf = buf; args.buflen = buflen; @@ -126,7 +128,7 @@ int CoreSession::speakText(char *text) void CoreSession::set_tts_parms(char *tts_name_p, char *voice_name_p) { - sanity_check(); + sanity_check_noreturn; switch_safe_free(tts_name); switch_safe_free(voice_name); tts_name = strdup(tts_name_p); diff --git a/src/switch_xml.c b/src/switch_xml.c index d1b4dfad30..64c75be7a5 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -60,6 +60,9 @@ #ifdef HAVE_MMAP #include +#ifdef __sun +extern int madvise(caddr_t, size_t, int); +#endif #endif #define SWITCH_XML_WS "\t\r\n " // whitespace