Skip to content

Commit

Permalink
Fixed according to code review and compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Małecki committed Sep 21, 2017
1 parent 9748eef commit 31c1b82
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions common/socketoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using namespace std;


set<string> true_names = { "1", "yes", "on", "true" };
set<string> false_names = { "0", "no", "off", "false" };
extern const set<string> true_names = { "1", "yes", "on", "true" };
extern const set<string> false_names = { "0", "no", "off", "false" };

std::map<std::string, int> enummap_transtype = {
extern const std::map<std::string, int> enummap_transtype = {
{ "live", SRTT_LIVE },
{ "vod", SRTT_VOD },
{ "file", SRTT_VOD }
Expand Down
8 changes: 4 additions & 4 deletions common/socketoptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct OptionValue
size_t size = 0;
};

extern std::set<std::string> false_names, true_names;
extern const std::set<std::string> false_names, true_names;

struct SocketOption
{
Expand All @@ -38,7 +38,7 @@ struct SocketOption
int symbol;
Binding binding;
Type type;
std::map<std::string, int>* valmap;
const std::map<std::string, int>* valmap;

template <Domain D>
bool apply(int socket, std::string value) const;
Expand Down Expand Up @@ -180,10 +180,10 @@ inline bool SocketOption::apply(int socket, std::string value) const
return false;
}

extern std::map<std::string, int> enummap_transtype;
extern const std::map<std::string, int> enummap_transtype;

namespace {
SocketOption srt_options [] {
const SocketOption srt_options [] {
{ "maxbw", 0, SRTO_MAXBW, SocketOption::PRE, SocketOption::INT64, nullptr},
{ "pbkeylen", 0, SRTO_PBKEYLEN, SocketOption::PRE, SocketOption::INT, nullptr},
{ "passphrase", 0, SRTO_PASSPHRASE, SocketOption::PRE, SocketOption::STRING, nullptr},
Expand Down
2 changes: 1 addition & 1 deletion srtcore/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ std::string ConnectStatusStr(EConnectStatus cst)

std::string TransmissionEventStr(ETransmissionEvent ev)
{
static std::string vals [] =
static const std::string vals [] =
{
"init",
"ack",
Expand Down
2 changes: 1 addition & 1 deletion srtcore/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ struct EventVariant
*this = arg;
}

int32_t* get_ptr()
const int32_t* get_ptr() const
{
return u.array.ptr;
}
Expand Down
4 changes: 2 additions & 2 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ void CUDT::setOpt(SRT_SOCKOPT optName, const void* optval, int optlen)
throw CUDTException(MJ_NOTSUP, MN_ISCONNECTED, 0);

m_zOPT_ExpPayloadSize = *(int*)optval;
break;

case SRTO_TRANSTYPE:
if (m_bConnected)
Expand Down Expand Up @@ -4039,7 +4040,7 @@ bool CUDT::createCrypter(HandshakeSide side, bool bidirectional)
return m_pCryptoControl->init(side, bidirectional);
}

bool CUDT::setupCC()
void CUDT::setupCC()
{
// Prepare configuration object,
// Create the CCC object and configure it.
Expand Down Expand Up @@ -4071,7 +4072,6 @@ bool CUDT::setupCC()
<< " bw=" << m_iBandwidth;

updateCC(TEV_INIT, TEV_INIT_RESET);
return true;
}

void CUDT::considerLegacySrtHandshake(uint64_t timebase)
Expand Down
2 changes: 1 addition & 1 deletion srtcore/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ class CUDT
void releaseSynch();

private: // Common connection Congestion Control setup
bool setupCC();
void setupCC();
void updateCC(ETransmissionEvent, EventVariant arg);
bool createCrypter(HandshakeSide side, bool bidi);

Expand Down
8 changes: 4 additions & 4 deletions srtcore/srt.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ enum CodeMinor
MN_CONGESTION = 4
};

static const enum CodeMinor MN_ISSTREAM SRT_ATR_DEPRECATED = 9;
static const enum CodeMinor MN_ISDGRAM SRT_ATR_DEPRECATED = 10;
static const enum CodeMinor MN_ISSTREAM SRT_ATR_DEPRECATED = CodeMinor(9);
static const enum CodeMinor MN_ISDGRAM SRT_ATR_DEPRECATED = CodeMinor(10);

// Stupid, but effective. This will be #undefined, so don't worry.
#define MJ(major) (1000*MJ_##major)
Expand Down Expand Up @@ -397,8 +397,8 @@ typedef enum SRT_ERRNO
SRT_EPEERERR = MJ(PEERERROR)
} SRT_ERRNO;

static const SRT_ERRNO SRT_EISSTREAM SRT_ATR_DEPRECATED = MN(NOTSUP, INVALMSGAPI);
static const SRT_ERRNO SRT_EISDGRAM = MN(NOTSUP, INVALBUFFERAPI),
static const SRT_ERRNO SRT_EISSTREAM SRT_ATR_DEPRECATED = SRT_ERRNO MN(NOTSUP, INVALMSGAPI);
static const SRT_ERRNO SRT_EISDGRAM = SRT_ERRNO MN(NOTSUP, INVALBUFFERAPI);

#undef MJ
#undef MN
Expand Down

0 comments on commit 31c1b82

Please sign in to comment.