Skip to content

Commit

Permalink
Merge branch 'ign-transport8' into scpeters/merge_8_11
Browse files Browse the repository at this point in the history
  • Loading branch information
scpeters committed Jun 11, 2023
2 parents 8b7835c + 3d68f46 commit 95d8599
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ message(STATUS "\n\n-- ====== Finding Dependencies ======")

#--------------------------------------
# Find Protobuf
set(REQ_PROTOBUF_VER 3)
ign_find_package(IgnProtobuf
VERSION ${REQ_PROTOBUF_VER}
REQUIRED
PRETTY Protobuf)

Expand Down
4 changes: 2 additions & 2 deletions include/gz/transport/Discovery.hh
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ namespace ignition
sockaddr_in clntAddr;
socklen_t addrLen = sizeof(clntAddr);

uint16_t received = recvfrom(this->sockets.at(0),
int64_t received = recvfrom(this->sockets.at(0),
reinterpret_cast<raw_type *>(rcvStr),
this->kMaxRcvStr, 0,
reinterpret_cast<sockaddr *>(&clntAddr),
Expand Down Expand Up @@ -823,7 +823,7 @@ namespace ignition
// unexpected size, then we ignore the message.

// If-condition for version 8+
if (len + sizeof(len) == received)
if (len + sizeof(len) == static_cast<uint16_t>(received))
{
std::string srcAddr = inet_ntoa(clntAddr.sin_addr);
uint16_t srcPort = ntohs(clntAddr.sin_port);
Expand Down
8 changes: 6 additions & 2 deletions include/gz/transport/RepHandler.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#pragma warning(pop)
#endif

#if GOOGLE_PROTOBUF_VERSION > 2999999
#if GOOGLE_PROTOBUF_VERSION > 2999999 && GOOGLE_PROTOBUF_VERSION < 4022000
#include <google/protobuf/stubs/casts.h>
#endif

Expand Down Expand Up @@ -140,7 +140,11 @@ namespace ignition
return false;
}

#if GOOGLE_PROTOBUF_VERSION > 2999999
#if GOOGLE_PROTOBUF_VERSION >= 4022000
auto msgReq =
google::protobuf::internal::DownCast<const Req*>(&_msgReq);
auto msgRep = google::protobuf::internal::DownCast<Rep*>(&_msgRep);
#elif GOOGLE_PROTOBUF_VERSION > 2999999
auto msgReq = google::protobuf::down_cast<const Req*>(&_msgReq);
auto msgRep = google::protobuf::down_cast<Rep*>(&_msgRep);
#else
Expand Down
6 changes: 4 additions & 2 deletions include/gz/transport/SubscriptionHandler.hh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include <google/protobuf/stubs/common.h>

#if GOOGLE_PROTOBUF_VERSION >= 3000000
#if GOOGLE_PROTOBUF_VERSION >= 3000000 && GOOGLE_PROTOBUF_VERSION < 4022000
#include <google/protobuf/stubs/casts.h>
#endif

Expand Down Expand Up @@ -211,7 +211,9 @@ namespace ignition
if (!this->UpdateThrottling())
return true;

#if GOOGLE_PROTOBUF_VERSION >= 3000000
#if GOOGLE_PROTOBUF_VERSION >= 4022000
auto msgPtr = google::protobuf::internal::DownCast<const T*>(&_msg);
#elif GOOGLE_PROTOBUF_VERSION >= 3000000
auto msgPtr = google::protobuf::down_cast<const T*>(&_msg);
#else
auto msgPtr = google::protobuf::internal::down_cast<const T*>(&_msg);
Expand Down

0 comments on commit 95d8599

Please sign in to comment.