aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2018-07-03 19:37:43 -0400
committerDeterminant <ted.sybil@gmail.com>2018-07-03 19:37:43 -0400
commit2b956e784e740853a19ed8856f296a166a270e62 (patch)
treea4f7abd7bab05804c9c7bc34bbe649ac3fbbbc95
parent0d7edf5486daf8a3bd30ca5374d0e27998a34888 (diff)
...
-rw-r--r--include/salticidae/msg.h15
-rw-r--r--include/salticidae/netaddr.h2
-rw-r--r--include/salticidae/util.h4
-rw-r--r--src/util.cpp2
4 files changed, 17 insertions, 6 deletions
diff --git a/include/salticidae/msg.h b/include/salticidae/msg.h
index 62fc33b..594ac07 100644
--- a/include/salticidae/msg.h
+++ b/include/salticidae/msg.h
@@ -42,8 +42,8 @@ template<typename OpcodeType = uint8_t,
class MsgBase {
public:
using opcode_t = OpcodeType;
- static const opcode_t OPCODE_PING = PING;
- static const opcode_t OPCODE_PONG = PONG;
+ static const opcode_t OPCODE_PING;
+ static const opcode_t OPCODE_PONG;
static const size_t header_size;
private:
@@ -248,6 +248,17 @@ const size_t MsgBase<OpcodeType, _, __>::header_size =
sizeof(MsgBase<OpcodeType, _, __>) -
sizeof(MsgBase<OpcodeType, _, __>::payload) -
sizeof(MsgBase<OpcodeType, _, __>::no_payload);
+
+template<typename OpcodeType,
+ OpcodeType PING,
+ OpcodeType _>
+const OpcodeType MsgBase<OpcodeType, PING, _>::OPCODE_PING = PING;
+
+template<typename OpcodeType,
+ OpcodeType _,
+ OpcodeType PONG>
+const OpcodeType MsgBase<OpcodeType, _, PONG>::OPCODE_PONG = PONG;
+
}
#endif
diff --git a/include/salticidae/netaddr.h b/include/salticidae/netaddr.h
index b11f9b3..1b53dff 100644
--- a/include/salticidae/netaddr.h
+++ b/include/salticidae/netaddr.h
@@ -66,7 +66,7 @@ struct NetAddr {
long port;
try {
port = std::stol(port_str.c_str());
- } catch (std::logic_error) {
+ } catch (std::logic_error &) {
throw SalticidaeError("invalid port format");
}
if (port < 0)
diff --git a/include/salticidae/util.h b/include/salticidae/util.h
index b3eb991..19d87cb 100644
--- a/include/salticidae/util.h
+++ b/include/salticidae/util.h
@@ -161,7 +161,7 @@ class Config {
size_t idx;
try {
val = stoi(strval, &idx);
- } catch (std::invalid_argument) {
+ } catch (std::invalid_argument &) {
throw SalticidaeError("invalid integer");
}
}
@@ -175,7 +175,7 @@ class Config {
size_t idx;
try {
val = stod(strval, &idx);
- } catch (std::invalid_argument) {
+ } catch (std::invalid_argument &) {
throw SalticidaeError("invalid double");
}
}
diff --git a/src/util.cpp b/src/util.cpp
index 8ce908d..9a24a8c 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -61,7 +61,7 @@ const std::string get_current_datetime() {
SalticidaeError::SalticidaeError() : msg("unknown") {}
SalticidaeError::SalticidaeError(const std::string &fmt, ...) {
- size_t guessed_size = 128;
+ int guessed_size = 128;
std::string buff;
va_list ap;
for (;;)