From 48f2ed527da2be9436258108b45d315995730a00 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Fri, 27 Nov 2009 20:14:42 +0000 Subject: [PATCH] Fixes to compile in Windows C++ compiler git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@913 a93c3328-9c30-0410-af19-c9cd2b2d52af --- libs/freetdm/src/include/openzap.h | 10 +++++----- libs/freetdm/src/include/zap_types.h | 11 +++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libs/freetdm/src/include/openzap.h b/libs/freetdm/src/include/openzap.h index 5350489687..ddcb9b0133 100644 --- a/libs/freetdm/src/include/openzap.h +++ b/libs/freetdm/src/include/openzap.h @@ -175,6 +175,10 @@ #include "zap_buffer.h" #include "zap_threadmutex.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef __WINDOWS__ #define zap_sleep(x) Sleep(x) #else @@ -227,7 +231,7 @@ #define zap_set_flag(obj, flag) (obj)->flags |= (flag) #define zap_set_flag_locked(obj, flag) assert(obj->mutex != NULL); \ zap_mutex_lock(obj->mutex); \ - (obj)->flags |= (flag); \ + (obj)->flags |= (flag); \ zap_mutex_unlock(obj->mutex); #define zap_set_pflag(obj, flag) (obj)->pflags |= (flag) @@ -317,10 +321,6 @@ */ #define zap_copy_flags(dest, src, flags) (dest)->flags &= ~(flags); (dest)->flags |= ((src)->flags & (flags)) -#ifdef __cplusplus -extern "C" { -#endif - typedef enum { ZAP_STATE_CHANGE_FAIL, ZAP_STATE_CHANGE_SUCCESS, diff --git a/libs/freetdm/src/include/zap_types.h b/libs/freetdm/src/include/zap_types.h index 0e0d232523..8cf2b6b30c 100644 --- a/libs/freetdm/src/include/zap_types.h +++ b/libs/freetdm/src/include/zap_types.h @@ -405,6 +405,17 @@ typedef enum { ZAP_CHANNEL_ANSWERED = (1 << 23), ZAP_CHANNEL_MUTE = (1 << 24) } zap_channel_flag_t; +#if defined(__cplusplus) && defined(WIN32) + // fix C2676 +__inline__ zap_channel_flag_t operator|=(zap_channel_flag_t a, int32_t b) { + a = (zap_channel_flag_t)(a | b); + return a; +} +__inline__ zap_channel_flag_t operator&=(zap_channel_flag_t a, int32_t b) { + a = (zap_channel_flag_t)(a & b); + return a; +} +#endif typedef enum { ZSM_NONE,