From c40bc0cfc2ad9bdbede56d56a56abc58fbacfba2 Mon Sep 17 00:00:00 2001 From: Richard Powell Date: Tue, 5 Jun 2018 19:15:33 +0100 Subject: [PATCH] Fix some compile warnings. --- include/sc2api/sc2_client.h | 2 ++ include/sc2utils/sc2_simple_serialization.h | 1 + src/sc2api/sc2_connection.cc | 2 +- src/sc2api/sc2_data.cc | 6 ++---- src/sc2api/sc2_server.cc | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/sc2api/sc2_client.h b/include/sc2api/sc2_client.h index 6025b966..f3a023fc 100644 --- a/include/sc2api/sc2_client.h +++ b/include/sc2api/sc2_client.h @@ -43,6 +43,8 @@ enum class ClientError { //! A set of common events a user can override in their derived bot or replay observer class. class ClientEvents { public: + virtual ~ClientEvents() {} + //! Called when a game is started after a load. Fast restarting will not call this. virtual void OnGameFullStart() {} diff --git a/include/sc2utils/sc2_simple_serialization.h b/include/sc2utils/sc2_simple_serialization.h index 83abfc96..3434f6fa 100644 --- a/include/sc2utils/sc2_simple_serialization.h +++ b/include/sc2utils/sc2_simple_serialization.h @@ -7,6 +7,7 @@ #include #include #include +#include namespace sc2 { diff --git a/src/sc2api/sc2_connection.cc b/src/sc2api/sc2_connection.cc index d27ce7ad..17075620 100644 --- a/src/sc2api/sc2_connection.cc +++ b/src/sc2api/sc2_connection.cc @@ -92,8 +92,8 @@ static void ConnectionClosedHandler(const struct mg_connection* conn, void *) { } Connection::Connection() : - verbose_(false), connection_(nullptr), + verbose_(false), queue_(), mutex_(), condition_(), diff --git a/src/sc2api/sc2_data.cc b/src/sc2api/sc2_data.cc index 7cb90114..79e61df3 100644 --- a/src/sc2api/sc2_data.cc +++ b/src/sc2api/sc2_data.cc @@ -88,8 +88,7 @@ void AbilityData::ReadFromProto(const SC2APIProtocol::AbilityData& ability_data) target = Target::PointOrNone; break; } - case SC2APIProtocol::AbilityData_Target_None: { - } + case SC2APIProtocol::AbilityData_Target_None: default: { target = Target::None; break; @@ -159,8 +158,7 @@ std::string AbilityData::Log() const { str_out += " Target: Point or unit\n"; break; } - case Target::None: { - } + case Target::None: default: { str_out += " Target: None\n"; break; diff --git a/src/sc2api/sc2_server.cc b/src/sc2api/sc2_server.cc index 4809cef5..78d5e02a 100644 --- a/src/sc2api/sc2_server.cc +++ b/src/sc2api/sc2_server.cc @@ -86,7 +86,7 @@ static void SendMessage(mg_connection* conn, std::queue& message_queue) { google::protobuf::Message* message = message_queue.front().second; size_t size = message->ByteSize(); - void* bytes = new char[size]; + char* bytes = new char[size]; message->SerializeToArray(bytes, (int)size); mg_websocket_write( conn, @@ -95,7 +95,7 @@ static void SendMessage(mg_connection* conn, std::queue& message_queue) { size ); message_queue.pop(); - delete bytes; + delete [] bytes; delete message; }