Commit 04650efd authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #28529: sip: fix compilation for gcc 4.6 and off-by-one error

parent 31968806
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#include <cstdlib> #include <cstdlib>
#include <array>
#include <memory>
#ifdef SFL_VIDEO #ifdef SFL_VIDEO
#include "video/libav_utils.h" #include "video/libav_utils.h"
...@@ -64,7 +66,7 @@ const char *const TRUE_STR = "true"; ...@@ -64,7 +66,7 @@ const char *const TRUE_STR = "true";
const char *const FALSE_STR = "false"; const char *const FALSE_STR = "false";
} }
bool SIPAccount::portsInUse_[UINT16_MAX]; bool SIPAccount::portsInUse_[1 << 16];
SIPAccount::SIPAccount(const std::string& accountID) SIPAccount::SIPAccount(const std::string& accountID)
: Account(accountID) : Account(accountID)
...@@ -119,7 +121,7 @@ SIPAccount::SIPAccount(const std::string& accountID) ...@@ -119,7 +121,7 @@ SIPAccount::SIPAccount(const std::string& accountID)
, via_addr_() , via_addr_()
, audioPortRange_({16384, 32766}) , audioPortRange_({16384, 32766})
#ifdef SFL_VIDEO #ifdef SFL_VIDEO
, videoPortRange_({49152, UINT16_MAX - 2}) , videoPortRange_({49152, (1 << 16) - 2})
#endif #endif
{ {
via_addr_.host.ptr = 0; via_addr_.host.ptr = 0;
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <cstdint>
#include "account.h" #include "account.h"
#include "pjsip/sip_transport_tls.h" #include "pjsip/sip_transport_tls.h"
#include "pjsip/sip_types.h" #include "pjsip/sip_types.h"
...@@ -789,7 +788,7 @@ class SIPAccount : public Account { ...@@ -789,7 +788,7 @@ class SIPAccount : public Account {
*/ */
std::pair<uint16_t, uint16_t> videoPortRange_; std::pair<uint16_t, uint16_t> videoPortRange_;
#endif #endif
static bool portsInUse_[UINT16_MAX]; static bool portsInUse_[1 << 16];
static uint16_t getRandomEvenNumber(const std::pair<uint16_t, uint16_t> &range); static uint16_t getRandomEvenNumber(const std::pair<uint16_t, uint16_t> &range);
}; };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment