]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3315 --resolve Fix typedef declaration for switch_cap_callback_t Thanks Peter
authorJeff Lenk <jeff@jefflenk.com>
Thu, 26 May 2011 13:39:28 +0000 (08:39 -0500)
committerJeff Lenk <jeff@jefflenk.com>
Thu, 26 May 2011 13:39:28 +0000 (08:39 -0500)
src/include/switch_platform.h
src/include/switch_types.h
src/mod/applications/mod_dptools/mod_dptools.c
src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c

index 609dde8b7a42f7db4621a92b8112309578837fc3..7603b585444b7a0f7a6433967a84de9d1b78f124 100644 (file)
@@ -137,14 +137,17 @@ typedef int gid_t;
 #ifdef WIN32
 #if defined(SWITCH_CORE_DECLARE_STATIC)
 #define SWITCH_DECLARE(type)                   type __stdcall
+#define SWITCH_DECLARE_TYPEDEF(type, name)     type (__stdcall name)
 #define SWITCH_DECLARE_NONSTD(type)            type __cdecl
 #define SWITCH_DECLARE_DATA
 #elif defined(FREESWITCHCORE_EXPORTS)
 #define SWITCH_DECLARE(type)                   __declspec(dllexport) type __stdcall
+#define SWITCH_DECLARE_TYPEDEF(type, name)     __declspec(dllexport) type (__stdcall name)
 #define SWITCH_DECLARE_NONSTD(type)            __declspec(dllexport) type __cdecl
 #define SWITCH_DECLARE_DATA                            __declspec(dllexport)
 #else
 #define SWITCH_DECLARE(type)                   __declspec(dllimport) type __stdcall
+#define SWITCH_DECLARE_TYPEDEF(type, name)     __declspec(dllimport) type (__stdcall name)
 #define SWITCH_DECLARE_NONSTD(type)            __declspec(dllimport) type __cdecl
 #define SWITCH_DECLARE_DATA                            __declspec(dllimport)
 #endif
@@ -174,6 +177,7 @@ typedef int gid_t;
 #define O_BINARY 0
 #if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(SWITCH_API_VISIBILITY)
 #define SWITCH_DECLARE(type)           __attribute__((visibility("default"))) type
+#define SWITCH_DECLARE_TYPEDEF(type, name)     type (name)
 #define SWITCH_DECLARE_NONSTD(type)    __attribute__((visibility("default"))) type
 #define SWITCH_DECLARE_DATA            __attribute__((visibility("default")))
 #define SWITCH_MOD_DECLARE(type)       __attribute__((visibility("default"))) type
@@ -182,6 +186,7 @@ typedef int gid_t;
 #define SWITCH_DECLARE_CLASS           __attribute__((visibility("default")))
 #else
 #define SWITCH_DECLARE(type)           type
+#define SWITCH_DECLARE_TYPEDEF(type, name)     type (name)
 #define SWITCH_DECLARE_NONSTD(type)    type
 #define SWITCH_DECLARE_DATA
 #define SWITCH_MOD_DECLARE(type)       type
index 2b2b3de45d4798cb28276ae0313507ec4a95c5ac..a94bfbd29bd9e3e231def487cfd7681dcbed2cde 100644 (file)
@@ -1690,7 +1690,7 @@ struct switch_console_callback_match {
 };
 typedef struct switch_console_callback_match switch_console_callback_match_t;
 
-typedef void (*switch_cap_callback_t) (const char *var, const char *val, void *user_data);
+typedef SWITCH_DECLARE_TYPEDEF(void, *switch_cap_callback_t) (const char *var, const char *val, void *user_data);
 typedef switch_status_t (*switch_console_complete_callback_t) (const char *, const char *, switch_console_callback_match_t **matches);
 typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t);
 typedef switch_bool_t (*switch_tone_detect_callback_t) (switch_core_session_t *, const char *, const char *);
index 87886cfdd138356d11df4f0baadae1d009389b3b..e0b8e0aa93cdf08d6ee5effe4618b8e9f739bbef 100755 (executable)
@@ -2320,7 +2320,7 @@ SWITCH_STANDARD_APP(capture_function)
        if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
                && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) == 3) {
                if ((proceed = switch_regex_perform(argv[1], argv[2], &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
-                       switch_capture_regex(re, proceed, argv[1], ovector, argv[0], (switch_cap_callback_t)switch_regex_set_var_callback, session);
+                       switch_capture_regex(re, proceed, argv[1], ovector, argv[0], switch_regex_set_var_callback, session);
                }
                switch_regex_safe_free(re);
        } else {
index c3f90083764efee234405ebe67157502519c2965..5f042fbf26cc6c473a09705b536c78b090a305f5 100644 (file)
@@ -224,7 +224,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                } else {
                        if (field && strchr(expression, '(')) {
                                switch_channel_set_variable(channel, "DP_MATCH", NULL);
-                               switch_capture_regex(re, proceed, field_data, ovector, "DP_MATCH", (switch_cap_callback_t)switch_regex_set_var_callback, session);
+                               switch_capture_regex(re, proceed, field_data, ovector, "DP_MATCH", switch_regex_set_var_callback, session);
                        }
 
                        for (xaction = switch_xml_child(xcond, "action"); xaction; xaction = xaction->next) {