sun studio/solaris build fixes

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5290 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-06-08 14:52:50 +00:00
parent da58c31380
commit f32f6f24d7
8 changed files with 26 additions and 17 deletions

View File

@ -123,6 +123,8 @@ if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC) APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC)
APR_ADDTO(SWITCH_AM_CXXFLAGS, "-features=extensions")
APR_ADDTO(SWITCH_AM_LDFLAGS, -R${prefix}/lib) APR_ADDTO(SWITCH_AM_LDFLAGS, -R${prefix}/lib)
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC) APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)

View File

@ -53,8 +53,10 @@
#define __EXTENSIONS__ 1 #define __EXTENSIONS__ 1
#ifndef MACOSX #ifndef MACOSX
#ifndef _XOPEN_SOURCE #ifndef _XOPEN_SOURCE
#ifndef __cplusplus
#define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE 600
#endif #endif
#endif
#ifndef __BSD_VISIBLE #ifndef __BSD_VISIBLE
#define __BSD_VISIBLE 1 #define __BSD_VISIBLE 1
#endif #endif

View File

@ -26,7 +26,7 @@ class CoreSession {
switch_input_args_t *ap; switch_input_args_t *ap;
public: public:
CoreSession(char *uuid); CoreSession(char *uuid);
CoreSession(switch_core_session_t *session); CoreSession(switch_core_session_t *new_session);
~CoreSession(); ~CoreSession();
switch_core_session_t *session; switch_core_session_t *session;
switch_channel_t *channel; switch_channel_t *channel;

View File

@ -562,7 +562,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
typedef enum { typedef enum {
SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0), SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0),
SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1), 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; } switch_ivr_menu_flags;
/* Actions are either set in switch_ivr_menu_bind_function or returned by a callback */ /* Actions are either set in switch_ivr_menu_bind_function or returned by a callback */
typedef enum { 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_BACK, /* Go back 1 menu. */
SWITCH_IVR_ACTION_TOMAIN, /* Go back to the top level menu. */ SWITCH_IVR_ACTION_TOMAIN, /* Go back to the top level menu. */
SWITCH_IVR_ACTION_TRANSFER, /* Transfer caller to another ext. */ 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; } switch_ivr_action_t;
struct switch_ivr_menu; struct switch_ivr_menu;
typedef switch_ivr_action_t switch_ivr_menu_action_function_t(struct switch_ivr_menu *, char *, char *, size_t, void *); typedef switch_ivr_action_t switch_ivr_menu_action_function_t(struct switch_ivr_menu *, char *, char *, size_t, void *);

View File

@ -106,12 +106,12 @@ typedef struct {
typedef struct { typedef struct {
int16_t type; int16_t type;
uint16_t length; uint16_t length;
char value[]; char value[1];
} switch_stun_packet_attribute_t; } switch_stun_packet_attribute_t;
typedef struct { typedef struct {
switch_stun_packet_header_t header; switch_stun_packet_header_t header;
uint8_t first_attribute[]; uint8_t first_attribute[1];
} switch_stun_packet_t; } switch_stun_packet_t;
typedef struct { typedef struct {

View File

@ -161,7 +161,7 @@ typedef enum {
SST_POSTAL_ADDRESS, SST_POSTAL_ADDRESS,
SST_ACCOUNT_NUMBER, SST_ACCOUNT_NUMBER,
SST_NAME_SPELLED, SST_NAME_SPELLED,
SST_NAME_PHONETIC, SST_NAME_PHONETIC
} switch_say_type_t; } switch_say_type_t;
typedef enum { typedef enum {
@ -196,7 +196,7 @@ typedef enum {
SWITCH_ABC_TYPE_READ, SWITCH_ABC_TYPE_READ,
SWITCH_ABC_TYPE_WRITE, SWITCH_ABC_TYPE_WRITE,
SWITCH_ABC_TYPE_WRITE_REPLACE, SWITCH_ABC_TYPE_WRITE_REPLACE,
SWITCH_ABC_TYPE_CLOSE, SWITCH_ABC_TYPE_CLOSE
} switch_abc_type_t; } switch_abc_type_t;
typedef struct { typedef struct {
@ -332,7 +332,7 @@ typedef enum {
typedef enum { typedef enum {
SWITCH_PRIORITY_NORMAL, SWITCH_PRIORITY_NORMAL,
SWITCH_PRIORITY_LOW, SWITCH_PRIORITY_LOW,
SWITCH_PRIORITY_HIGH, SWITCH_PRIORITY_HIGH
} switch_priority_t; } switch_priority_t;
/*! /*!
@ -702,7 +702,7 @@ SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0) - Free interface's pool on destruct
</pre> </pre>
*/ */
typedef enum { typedef enum {
SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0), SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0)
} switch_directory_flag_t; } switch_directory_flag_t;
@ -732,7 +732,7 @@ SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0) - Free timer's pool on destruction
</pre> </pre>
*/ */
typedef enum { typedef enum {
SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0), SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0)
} switch_timer_flag_t; } switch_timer_flag_t;
@ -786,7 +786,7 @@ typedef enum {
} switch_file_flag_t; } switch_file_flag_t;
typedef enum { typedef enum {
SWITCH_IO_FLAG_NOOP = 0, SWITCH_IO_FLAG_NOOP = 0
} switch_io_flag_t; } switch_io_flag_t;
/* make sure this is synced with the EVENT_NAMES array in switch_event.c /* make sure this is synced with the EVENT_NAMES array in switch_event.c

View File

@ -6,6 +6,7 @@
#endif #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(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) #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) 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(); init_vars();
session = new_session;
channel = switch_core_session_get_channel(session); channel = switch_core_session_get_channel(session);
switch_core_session_read_lock(session); switch_core_session_read_lock(session);
} }
@ -55,13 +57,13 @@ int CoreSession::preAnswer()
void CoreSession::hangup(char *cause) void CoreSession::hangup(char *cause)
{ {
sanity_check(); sanity_check_noreturn;
switch_channel_hangup(channel, switch_channel_str2cause(cause)); switch_channel_hangup(channel, switch_channel_str2cause(cause));
} }
void CoreSession::setVariable(char *var, char *val) void CoreSession::setVariable(char *var, char *val)
{ {
sanity_check(); sanity_check_noreturn;
switch_channel_set_variable(channel, var, val); switch_channel_set_variable(channel, var, val);
} }
@ -74,7 +76,7 @@ char *CoreSession::getVariable(char *var)
void CoreSession::execute(char *app, char *data) void CoreSession::execute(char *app, char *data)
{ {
const switch_application_interface_t *application_interface; const switch_application_interface_t *application_interface;
sanity_check(); sanity_check_noreturn;
if ((application_interface = switch_loadable_module_get_application_interface(app))) { if ((application_interface = switch_loadable_module_get_application_interface(app))) {
begin_allow_threads(); 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) void CoreSession::setDTMFCallback(switch_input_callback_function_t cb, void *buf, uint32_t buflen)
{ {
sanity_check(); sanity_check_noreturn;
if (cb) { if (cb) {
args.buf = buf; args.buf = buf;
args.buflen = buflen; 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) 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(tts_name);
switch_safe_free(voice_name); switch_safe_free(voice_name);
tts_name = strdup(tts_name_p); tts_name = strdup(tts_name_p);

View File

@ -60,6 +60,9 @@
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
#include <sys/mman.h> #include <sys/mman.h>
#ifdef __sun
extern int madvise(caddr_t, size_t, int);
#endif
#endif #endif
#define SWITCH_XML_WS "\t\r\n " // whitespace #define SWITCH_XML_WS "\t\r\n " // whitespace