change switch_strip_spaces to specify if you want it to dup the string or destroy the current buffer

This commit is contained in:
Anthony Minessale 2010-12-21 20:30:19 -06:00
parent 638cbf16cc
commit 4d7e4f1ec2
6 changed files with 60 additions and 14 deletions

View File

@ -622,7 +622,7 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(_In_ char *buf, char delim,
SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *delim, _Post_count_(return) char **array, unsigned int arraylen);
SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str);
SWITCH_DECLARE(char *) switch_strip_spaces(const char *str);
SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup);
SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str);
SWITCH_DECLARE(char *) switch_strip_commas(char *in, char *out, switch_size_t len);
SWITCH_DECLARE(char *) switch_strip_nonnumerics(char *in, char *out, switch_size_t len);

View File

@ -1428,8 +1428,8 @@ SWITCH_STANDARD_API(cond_function)
int a_is_num, b_is_num;
*expr++ = '\0';
b = expr;
s_a = switch_strip_spaces(a);
s_b = switch_strip_spaces(b);
s_a = switch_strip_spaces(a, SWITCH_TRUE);
s_b = switch_strip_spaces(b, SWITCH_TRUE);
a_is_num = switch_is_number(s_a);
b_is_num = switch_is_number(s_b);

View File

@ -12726,13 +12726,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) {
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1) {
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1, int jarg2) {
char * jresult ;
char *arg1 = (char *) 0 ;
switch_bool_t arg2 ;
char *result = 0 ;
arg1 = (char *)jarg1;
result = (char *)switch_strip_spaces((char const *)arg1);
arg2 = (switch_bool_t)jarg2;
result = (char *)switch_strip_spaces(arg1,arg2);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
@ -23624,6 +23626,16 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_caller_extension(void * ja
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_sort_cid(void * jarg1, int jarg2) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_bool_t arg2 ;
arg1 = (switch_channel_t *)jarg1;
arg2 = (switch_bool_t)jarg2;
switch_channel_sort_cid(arg1,arg2);
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_caller_extension(void * jarg1) {
void * jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
@ -29013,6 +29025,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_debug_jitter_buffer(void * jarg1, char * jarg2) {
int jresult ;
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
char *arg2 = (char *) 0 ;
switch_status_t result;
arg1 = (switch_rtp_t *)jarg1;
arg2 = (char *)jarg2;
result = (switch_status_t)switch_rtp_debug_jitter_buffer(arg1,(char const *)arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_deactivate_jitter_buffer(void * jarg1) {
int jresult ;
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;

View File

@ -2867,8 +2867,8 @@ public class freeswitch {
return ret;
}
public static string switch_strip_spaces(string str) {
string ret = freeswitchPINVOKE.switch_strip_spaces(str);
public static string switch_strip_spaces(string str, switch_bool_t dup) {
string ret = freeswitchPINVOKE.switch_strip_spaces(str, (int)dup);
return ret;
}
@ -3318,6 +3318,10 @@ public class freeswitch {
freeswitchPINVOKE.switch_channel_set_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_extension.getCPtr(caller_extension));
}
public static void switch_channel_sort_cid(SWIGTYPE_p_switch_channel channel, switch_bool_t arg1) {
freeswitchPINVOKE.switch_channel_sort_cid(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)arg1);
}
public static switch_caller_extension switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel channel) {
IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel));
switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
@ -4635,6 +4639,11 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, string name) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), name);
return ret;
}
public static switch_status_t switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
return ret;
@ -8647,7 +8656,7 @@ class freeswitchPINVOKE {
public static extern int switch_is_number(string jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")]
public static extern string switch_strip_spaces(string jarg1);
public static extern string switch_strip_spaces(string jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_strip_whitespace")]
public static extern string switch_strip_whitespace(string jarg1);
@ -11313,6 +11322,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_caller_extension")]
public static extern void switch_channel_set_caller_extension(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_sort_cid")]
public static extern void switch_channel_sort_cid(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_caller_extension")]
public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1);
@ -12441,6 +12453,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")]
public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_debug_jitter_buffer")]
public static extern int switch_rtp_debug_jitter_buffer(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_deactivate_jitter_buffer")]
public static extern int switch_rtp_deactivate_jitter_buffer(HandleRef jarg1);
@ -21509,6 +21524,7 @@ public enum switch_channel_flag_t {
CF_BRIDGE_NOWRITE,
CF_RECOVERED,
CF_JITTERBUFFER,
CF_DIALPLAN,
CF_FLAG_MAX
}

View File

@ -9732,17 +9732,17 @@ XS(SWIG_init) {
SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
SvREADONLY_on(sv);

View File

@ -831,9 +831,9 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str)
return s;
}
SWITCH_DECLARE(char *) switch_strip_spaces(const char *str)
SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup)
{
const char *sp = str;
char *sp = str;
char *p, *s = NULL;
if (!sp)
@ -843,7 +843,11 @@ SWITCH_DECLARE(char *) switch_strip_spaces(const char *str)
sp++;
}
if (dup) {
s = strdup(sp);
} else {
s = sp;
}
if (!s)
return NULL;