From 3803807841c614007ad55b9e95f4b2cefede23e7 Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 1 May 2008 19:14:33 +0000 Subject: [PATCH] switch_size_t to int git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8239 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_cpp.h | 2 +- .../src/org/freeswitch/swig/CoreSession.java | 4 +- .../org/freeswitch/swig/freeswitchJNI.java | 2 +- .../languages/mod_java/switch_swig_wrap.cpp | 12 ++---- src/mod/languages/mod_lua/mod_lua_wrap.cpp | 27 ++++--------- src/mod/languages/mod_perl/mod_perl_wrap.cpp | 39 +++++++------------ src/switch_cpp.cpp | 2 +- 7 files changed, 31 insertions(+), 57 deletions(-) diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index 41171a1f7a..a61777ae0d 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -221,7 +221,7 @@ class CoreSession { * receiving dtmf digits. For that, use collectDigits. */ SWITCH_DECLARE(char *) getDigits( - switch_size_t maxdigits, + int maxdigits, char *terminators, char *terminator, int timeout); diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java index 5808bd20ef..a65fa304c4 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java @@ -161,8 +161,8 @@ public class CoreSession { return freeswitchJNI.CoreSession_collectDigits(swigCPtr, this, timeout); } - public String getDigits(SWIGTYPE_p_switch_size_t maxdigits, String terminators, byte[] terminator, int timeout) { - return freeswitchJNI.CoreSession_getDigits(swigCPtr, this, SWIGTYPE_p_switch_size_t.getCPtr(maxdigits), terminators, terminator, timeout); + public String getDigits(int maxdigits, String terminators, byte[] terminator, int timeout) { + return freeswitchJNI.CoreSession_getDigits(swigCPtr, this, maxdigits, terminators, terminator, timeout); } public int transfer(String extensions, String dialplan, String context) { diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java index f0a65d7190..e34b599e98 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java @@ -87,7 +87,7 @@ class freeswitchJNI { public final static native int CoreSession_speak(long jarg1, CoreSession jarg1_, String jarg2); public final static native void CoreSession_set_tts_parms(long jarg1, CoreSession jarg1_, String jarg2, String jarg3); public final static native int CoreSession_collectDigits(long jarg1, CoreSession jarg1_, int jarg2); - public final static native String CoreSession_getDigits(long jarg1, CoreSession jarg1_, long jarg2, String jarg3, byte[] jarg4, int jarg5); + public final static native String CoreSession_getDigits(long jarg1, CoreSession jarg1_, int jarg2, String jarg3, byte[] jarg4, int jarg5); public final static native int CoreSession_transfer(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, String jarg4); public final static native String CoreSession_playAndGetDigits(long jarg1, CoreSession jarg1_, int jarg2, int jarg3, int jarg4, int jarg5, String jarg6, String jarg7, String jarg8, String jarg9); public final static native int CoreSession_streamFile__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2, int jarg3); diff --git a/src/mod/languages/mod_java/switch_swig_wrap.cpp b/src/mod/languages/mod_java/switch_swig_wrap.cpp index 3c4ba2e597..2541b6f464 100644 --- a/src/mod/languages/mod_java/switch_swig_wrap.cpp +++ b/src/mod/languages/mod_java/switch_swig_wrap.cpp @@ -1576,26 +1576,20 @@ SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1coll } -SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1getDigits(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jstring jarg3, jbyteArray jarg4, jint jarg5) { +SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1getDigits(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3, jbyteArray jarg4, jint jarg5) { jstring jresult = 0 ; CoreSession *arg1 = (CoreSession *) 0 ; - switch_size_t arg2 ; + int arg2 ; char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; int arg5 ; char *result = 0 ; - switch_size_t *argp2 ; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(CoreSession **)&jarg1; - argp2 = *(switch_size_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null switch_size_t"); - return 0; - } - arg2 = *argp2; + arg2 = (int)jarg2; arg3 = 0; if (jarg3) { arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index 98cc6fdccc..ac1a011b84 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -1499,12 +1499,11 @@ SWIG_Lua_dostring(lua_State *L, const char* str) { #define SWIGTYPE_p_switch_input_args_t swig_types[12] #define SWIGTYPE_p_switch_input_type_t swig_types[13] #define SWIGTYPE_p_switch_priority_t swig_types[14] -#define SWIGTYPE_p_switch_size_t swig_types[15] -#define SWIGTYPE_p_switch_status_t swig_types[16] -#define SWIGTYPE_p_switch_stream_handle_t swig_types[17] -#define SWIGTYPE_p_void swig_types[18] -static swig_type_info *swig_types[20]; -static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0}; +#define SWIGTYPE_p_switch_status_t swig_types[15] +#define SWIGTYPE_p_switch_stream_handle_t swig_types[16] +#define SWIGTYPE_p_void swig_types[17] +static swig_type_info *swig_types[19]; +static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -4097,16 +4096,15 @@ fail: static int _wrap_CoreSession_getDigits(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; - switch_size_t arg2 ; + int arg2 ; char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; int arg5 ; char *result = 0 ; - switch_size_t *argp2 ; SWIG_check_num_args("getDigits",5,5) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getDigits",1,"CoreSession *"); - if(!lua_isuserdata(L,2)) SWIG_fail_arg("getDigits",2,"switch_size_t"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("getDigits",2,"int"); if(!lua_isstring(L,3)) SWIG_fail_arg("getDigits",3,"char *"); if(!lua_isstring(L,4)) SWIG_fail_arg("getDigits",4,"char *"); if(!lua_isnumber(L,5)) SWIG_fail_arg("getDigits",5,"int"); @@ -4115,12 +4113,7 @@ static int _wrap_CoreSession_getDigits(lua_State* L) { SWIG_fail_ptr("CoreSession_getDigits",1,SWIGTYPE_p_CoreSession); } - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_size_t,0))){ - SWIG_fail_ptr("CoreSession_getDigits",2,SWIGTYPE_p_switch_size_t); - } - arg2 = *argp2; - + arg2 = (int)lua_tonumber(L, 2); arg3 = (char *)lua_tostring(L, 3); arg4 = (char *)lua_tostring(L, 4); arg5 = (int)lua_tonumber(L, 5); @@ -5493,7 +5486,6 @@ static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_e static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_switch_size_t = {"_p_switch_size_t", "switch_size_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; @@ -5514,7 +5506,6 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_switch_input_args_t, &_swigt__p_switch_input_type_t, &_swigt__p_switch_priority_t, - &_swigt__p_switch_size_t, &_swigt__p_switch_status_t, &_swigt__p_switch_stream_handle_t, &_swigt__p_void, @@ -5535,7 +5526,6 @@ static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_switch_size_t[] = { {&_swigt__p_switch_size_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; @@ -5556,7 +5546,6 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_switch_input_args_t, _swigc__p_switch_input_type_t, _swigc__p_switch_priority_t, - _swigc__p_switch_size_t, _swigc__p_switch_status_t, _swigc__p_switch_stream_handle_t, _swigc__p_void, diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 1ef7a95b79..aa5772d540 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -1461,12 +1461,11 @@ SWIG_Perl_SetModule(swig_module_info *module) { #define SWIGTYPE_p_switch_input_args_t swig_types[12] #define SWIGTYPE_p_switch_input_type_t swig_types[13] #define SWIGTYPE_p_switch_priority_t swig_types[14] -#define SWIGTYPE_p_switch_size_t swig_types[15] -#define SWIGTYPE_p_switch_status_t swig_types[16] -#define SWIGTYPE_p_switch_stream_handle_t swig_types[17] -#define SWIGTYPE_p_void swig_types[18] -static swig_type_info *swig_types[20]; -static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0}; +#define SWIGTYPE_p_switch_status_t swig_types[15] +#define SWIGTYPE_p_switch_stream_handle_t swig_types[16] +#define SWIGTYPE_p_void swig_types[17] +static swig_type_info *swig_types[19]; +static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -5223,15 +5222,15 @@ XS(_wrap_CoreSession_collectDigits) { XS(_wrap_CoreSession_getDigits) { { CoreSession *arg1 = (CoreSession *) 0 ; - switch_size_t arg2 ; + int arg2 ; char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; int arg5 ; char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; + int val2 ; + int ecode2 = 0 ; int res3 ; char *buf3 = 0 ; int alloc3 = 0 ; @@ -5251,17 +5250,11 @@ XS(_wrap_CoreSession_getDigits) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'"); } arg1 = reinterpret_cast< CoreSession * >(argp1); - { - res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_size_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "switch_size_t""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "switch_size_t""'"); - } else { - arg2 = *(reinterpret_cast< switch_size_t * >(argp2)); - } - } + ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'"); @@ -5280,12 +5273,14 @@ XS(_wrap_CoreSession_getDigits) { result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5); ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; if (alloc4 == SWIG_NEWOBJ) delete[] buf4; XSRETURN(argvi); fail: + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; if (alloc4 == SWIG_NEWOBJ) delete[] buf4; @@ -6612,7 +6607,6 @@ static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_e static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_switch_size_t = {"_p_switch_size_t", "switch_size_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; @@ -6633,7 +6627,6 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_switch_input_args_t, &_swigt__p_switch_input_type_t, &_swigt__p_switch_priority_t, - &_swigt__p_switch_size_t, &_swigt__p_switch_status_t, &_swigt__p_switch_stream_handle_t, &_swigt__p_void, @@ -6654,7 +6647,6 @@ static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_switch_size_t[] = { {&_swigt__p_switch_size_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; @@ -6675,7 +6667,6 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_switch_input_args_t, _swigc__p_switch_input_type_t, _swigc__p_switch_priority_t, - _swigc__p_switch_size_t, _swigc__p_switch_status_t, _swigc__p_switch_stream_handle_t, _swigc__p_void, diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index a9de7df403..caa1b77a77 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -470,7 +470,7 @@ SWITCH_DECLARE(int) CoreSession::collectDigits(int timeout) { return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(char *) CoreSession::getDigits(switch_size_t maxdigits, +SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits, char *terminators, char *terminator, int timeout)