From cfcd34b06ea3a9349bfc1d5b6637f3c893cce533 Mon Sep 17 00:00:00 2001 From: FlUxIuS Date: Wed, 4 Jan 2023 13:29:18 +0100 Subject: [PATCH] Fixes for C++17 --- CommonLibs/ScalarTypes.h | 24 ++++++++++++++++++++++-- SIP/SIPEngine.cpp | 2 +- install_dependences.sh | 8 ++------ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/CommonLibs/ScalarTypes.h b/CommonLibs/ScalarTypes.h index b6072fb..7dc0666 100644 --- a/CommonLibs/ScalarTypes.h +++ b/CommonLibs/ScalarTypes.h @@ -3,7 +3,7 @@ * traditionally complex, proprietary hardware systems. * * Copyright 2011-2014 Range Networks, Inc. - * + * Patched by FlUxIuS @ Penthertz SAS * This software is distributed under the terms of the GNU Affero General * Public License version 3. See the COPYING and NOTICE files in the main * directory for licensing information. @@ -31,6 +31,18 @@ Basetype* operator&() { return &value; } \ +#define _INITIALIZED_SCALAR_FUNCSBOOL(Classname,Basetype,Init) \ + Classname() : value(Init) {} \ + Classname(Basetype wvalue) { value = wvalue; } /* Can set from basetype. */ \ + operator Basetype(void) const { return value; } /* Converts from basetype. */ \ + Basetype operator++() { return true; } \ + Basetype operator++(int) { return true; } \ + Basetype operator=(Basetype wvalue) { return value = wvalue; } \ + Basetype operator+=(Basetype wvalue) { return value = value + wvalue; } \ + Basetype operator-=(Basetype wvalue) { return value = value - wvalue; } \ + Basetype* operator&() { return &value; } \ + + #define _DECLARE_SCALAR_TYPE(Classname_i,Classname_z,Basetype) \ template \ struct Classname_i { \ @@ -39,6 +51,14 @@ }; \ typedef Classname_i<0> Classname_z; +#define _DECLARE_SCALAR_TYPEBOOL(Classname_i,Classname_z,Basetype) \ + template \ + struct Classname_i { \ + Basetype value; \ + _INITIALIZED_SCALAR_FUNCSBOOL(Classname_i,Basetype,Init) \ + }; \ + typedef Classname_i<0> Classname_z; + // Usage: // Where 'classname' is one of the types listed below, then: @@ -55,7 +75,7 @@ _DECLARE_SCALAR_TYPE(UInt8_i, UInt8_z, uint8_t) _DECLARE_SCALAR_TYPE(UInt16_i, UInt16_z, uint16_t) _DECLARE_SCALAR_TYPE(UInt32_i, UInt32_z, uint32_t) _DECLARE_SCALAR_TYPE(Size_t_i, Size_t_z, size_t) -_DECLARE_SCALAR_TYPE(Bool_i, Bool_z, bool) +_DECLARE_SCALAR_TYPEBOOL(Bool_i, Bool_z, bool) // float is special, because C++ does not permit the template initalization: struct Float_z { diff --git a/SIP/SIPEngine.cpp b/SIP/SIPEngine.cpp index 8cb2ed3..583ff52 100644 --- a/SIP/SIPEngine.cpp +++ b/SIP/SIPEngine.cpp @@ -754,7 +754,7 @@ void SIPEngine::InitRTP(const osip_message_t * msg ) #ifdef ORTP_NEW_API rtp_session_set_local_addr(mSession, "0.0.0.0", mRTPPort, -1); #else - rtp_session_set_local_addr(mSession, "0.0.0.0", mRTPPort); + rtp_session_set_local_addr(mSession, "0.0.0.0", mRTPPort, mRTPPort+1); #endif rtp_session_set_remote_addr(mSession, d_ip_addr, atoi(d_port)); diff --git a/install_dependences.sh b/install_dependences.sh index 3db7a0c..774b9af 100755 --- a/install_dependences.sh +++ b/install_dependences.sh @@ -1,13 +1,9 @@ #!/bin/bash # This script has been tested in Ubuntu 16.04 and 18.04. Please report any problem you find. -# Latest UHD from Ettus PPA -sudo add-apt-repository ppa:ettusresearch/uhd -sudo apt-get update -sudo apt-get install libuhd-dev libuhd003 uhd-host +# Install all package dependencies +sudo apt install autoconf libtool build-essential libuhd-dev uhd-host libzmq3-dev libosip2-dev libortp-dev libusb-1.0-0-dev asn1c libtool-bin libsqlite3-dev libreadline-dev -# Other dependencies, mostly build-time -sudo apt-get install git autoconf libtool libtool-bin gpp g++ libzmq3-dev pkg-config libosip2-dev libortp-dev libusb-dev libusb-1.0-0-dev libreadline-dev libsqlite3-dev -y # Clone submodules from base repo git submodule init git submodule update