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,