rename major/minor to majorVersion/minorVersion
PokerTH fails to build on Debian GNU/kFreeBSD and GNU/Hurd with:
In file included from src/third_party/protobuf/pokerth.pb.cc:4:0:
src/third_party/protobuf/pokerth.pb.h:936:37: error: expected unqualified-id before 'int'
src/third_party/protobuf/pokerth.pb.h:936:37: error: expected ')' before 'int'
src/third_party/protobuf/pokerth.pb.h:936:37: error: expected ')' before 'int'
src/third_party/protobuf/pokerth.pb.h:943:37: error: expected unqualified-id before 'int'
src/third_party/protobuf/pokerth.pb.h:943:37: error: expected ')' before 'int'
src/third_party/protobuf/pokerth.pb.h:943:37: error: expected ')' before 'int'
src/third_party/protobuf/pokerth.pb.h:9618:60: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.h:9640:60: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc: In member function 'virtual void AnnounceMessage_Version::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const':
src/third_party/protobuf/pokerth.pb.cc:1581:72: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1581:72: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc:1586:72: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1586:72: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc: In member function 'virtual int AnnounceMessage_Version::ByteSize() const':
src/third_party/protobuf/pokerth.pb.cc:1599:17: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1599:17: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc:1606:17: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1606:17: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc: In member function 'void AnnounceMessage_Version::MergeFrom(const AnnounceMessage_Version&)':
src/third_party/protobuf/pokerth.pb.cc:1625:22: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1625:22: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc:1628:22: error: expected unqualified-id before '(' token
src/third_party/protobuf/pokerth.pb.cc:1628:22: error: expected primary-expression before ')' token
src/third_party/protobuf/pokerth.pb.cc: At global scope:
src/third_party/protobuf/pokerth.pb.cc:14319:6: warning: unused parameter 'output' [-Wunused-parameter]
src/third_party/protobuf/pokerth.pb.cc:18344:6: warning: unused parameter 'output' [-Wunused-parameter]
make[2]: *** [obj/pokerth.pb.o] Error 1
Renaming the vars to majorVersion/minorVersion fixes this issue.
The problem on kFreeBSD is, that
/usr/include/sys/kern/types.h
has
#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
and this is included somewhere when you include stdlib.h, which protobuf's
headers do.
Hurd has similar definitions in /usr/include/i386-gnu/sys/sysmacros.h.
This commit is contained in:
@@ -848,8 +848,8 @@ ClientStateStartSession::InternalHandlePacket(boost::shared_ptr<ClientThread> cl
|
||||
// Server has send announcement - check data.
|
||||
const AnnounceMessage &netAnnounce = tmpPacket->GetMsg()->announcemessage();
|
||||
// Check current game version.
|
||||
if (netAnnounce.latestgameversion().major() != POKERTH_VERSION_MAJOR
|
||||
|| netAnnounce.latestgameversion().minor() != POKERTH_VERSION_MINOR) {
|
||||
if (netAnnounce.latestgameversion().majorversion() != POKERTH_VERSION_MAJOR
|
||||
|| netAnnounce.latestgameversion().minorversion() != POKERTH_VERSION_MINOR) {
|
||||
client->GetCallback().SignalNetClientNotification(NTF_NET_NEW_RELEASE_AVAILABLE);
|
||||
} else if (POKERTH_BETA_REVISION && netAnnounce.latestbetarevision() != POKERTH_BETA_REVISION) {
|
||||
client->GetCallback().SignalNetClientNotification(NTF_NET_OUTDATED_BETA);
|
||||
@@ -867,8 +867,8 @@ ClientStateStartSession::InternalHandlePacket(boost::shared_ptr<ClientThread> cl
|
||||
boost::shared_ptr<NetPacket> init(new NetPacket);
|
||||
init->GetMsg()->set_messagetype(PokerTHMessage::Type_InitMessage);
|
||||
InitMessage *netInit = init->GetMsg()->mutable_initmessage();
|
||||
netInit->mutable_requestedversion()->set_major(NET_VERSION_MAJOR);
|
||||
netInit->mutable_requestedversion()->set_minor(NET_VERSION_MINOR);
|
||||
netInit->mutable_requestedversion()->set_majorversion(NET_VERSION_MAJOR);
|
||||
netInit->mutable_requestedversion()->set_minorversion(NET_VERSION_MINOR);
|
||||
netInit->set_buildid(0);
|
||||
if (!context.GetSessionGuid().empty()) {
|
||||
netInit->set_mylastsessionid(context.GetSessionGuid());
|
||||
@@ -946,8 +946,8 @@ ClientStateWaitEnterLogin::TimerLoop(const boost::system::error_code& ec, boost:
|
||||
boost::shared_ptr<NetPacket> init(new NetPacket);
|
||||
init->GetMsg()->set_messagetype(PokerTHMessage::Type_InitMessage);
|
||||
InitMessage *netInit = init->GetMsg()->mutable_initmessage();
|
||||
netInit->mutable_requestedversion()->set_major(NET_VERSION_MAJOR);
|
||||
netInit->mutable_requestedversion()->set_minor(NET_VERSION_MINOR);
|
||||
netInit->mutable_requestedversion()->set_majorversion(NET_VERSION_MAJOR);
|
||||
netInit->mutable_requestedversion()->set_minorversion(NET_VERSION_MINOR);
|
||||
netInit->set_buildid(0);
|
||||
if (!context.GetSessionGuid().empty()) {
|
||||
netInit->set_mylastsessionid(context.GetSessionGuid());
|
||||
|
||||
@@ -282,10 +282,10 @@ ServerLobbyThread::AddConnection(boost::shared_ptr<tcp::socket> sock)
|
||||
boost::shared_ptr<NetPacket> packet(new NetPacket);
|
||||
packet->GetMsg()->set_messagetype(PokerTHMessage::Type_AnnounceMessage);
|
||||
AnnounceMessage *netAnnounce = packet->GetMsg()->mutable_announcemessage();
|
||||
netAnnounce->mutable_protocolversion()->set_major(NET_VERSION_MAJOR);
|
||||
netAnnounce->mutable_protocolversion()->set_minor(NET_VERSION_MINOR);
|
||||
netAnnounce->mutable_latestgameversion()->set_major(POKERTH_VERSION_MAJOR);
|
||||
netAnnounce->mutable_latestgameversion()->set_minor(POKERTH_VERSION_MINOR);
|
||||
netAnnounce->mutable_protocolversion()->set_majorversion(NET_VERSION_MAJOR);
|
||||
netAnnounce->mutable_protocolversion()->set_minorversion(NET_VERSION_MINOR);
|
||||
netAnnounce->mutable_latestgameversion()->set_majorversion(POKERTH_VERSION_MAJOR);
|
||||
netAnnounce->mutable_latestgameversion()->set_minorversion(POKERTH_VERSION_MINOR);
|
||||
netAnnounce->set_latestbetarevision(POKERTH_BETA_REVISION);
|
||||
switch (GetServerMode()) {
|
||||
case SERVER_MODE_LAN:
|
||||
@@ -957,7 +957,7 @@ ServerLobbyThread::HandleNetPacketInit(boost::shared_ptr<SessionData> session, c
|
||||
}
|
||||
|
||||
// Check the protocol version.
|
||||
if (initMessage.requestedversion().major() != NET_VERSION_MAJOR
|
||||
if (initMessage.requestedversion().majorversion() != NET_VERSION_MAJOR
|
||||
|| session->GetPlayerData()) { // Has this session already sent an init?
|
||||
SessionError(session, ERR_NET_VERSION_NOT_SUPPORTED);
|
||||
return;
|
||||
|
||||
+32
-32
@@ -1465,8 +1465,8 @@ const AnnounceMessage_ServerType AnnounceMessage::ServerType_MAX;
|
||||
const int AnnounceMessage::ServerType_ARRAYSIZE;
|
||||
#endif // _MSC_VER
|
||||
#ifndef _MSC_VER
|
||||
const int AnnounceMessage_Version::kMajorFieldNumber;
|
||||
const int AnnounceMessage_Version::kMinorFieldNumber;
|
||||
const int AnnounceMessage_Version::kMajorVersionFieldNumber;
|
||||
const int AnnounceMessage_Version::kMinorVersionFieldNumber;
|
||||
#endif // !_MSC_VER
|
||||
|
||||
AnnounceMessage_Version::AnnounceMessage_Version()
|
||||
@@ -1485,8 +1485,8 @@ AnnounceMessage_Version::AnnounceMessage_Version(const AnnounceMessage_Version&
|
||||
|
||||
void AnnounceMessage_Version::SharedCtor() {
|
||||
_cached_size_ = 0;
|
||||
major_ = 0u;
|
||||
minor_ = 0u;
|
||||
majorversion_ = 0u;
|
||||
minorversion_ = 0u;
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
}
|
||||
|
||||
@@ -1516,8 +1516,8 @@ AnnounceMessage_Version* AnnounceMessage_Version::New() const {
|
||||
|
||||
void AnnounceMessage_Version::Clear() {
|
||||
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
major_ = 0u;
|
||||
minor_ = 0u;
|
||||
majorversion_ = 0u;
|
||||
minorversion_ = 0u;
|
||||
}
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
}
|
||||
@@ -1528,30 +1528,30 @@ bool AnnounceMessage_Version::MergePartialFromCodedStream(
|
||||
::google::protobuf::uint32 tag;
|
||||
while ((tag = input->ReadTag()) != 0) {
|
||||
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
|
||||
// required uint32 major = 1;
|
||||
// required uint32 majorVersion = 1;
|
||||
case 1: {
|
||||
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
||||
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
|
||||
input, &major_)));
|
||||
set_has_major();
|
||||
input, &majorversion_)));
|
||||
set_has_majorversion();
|
||||
} else {
|
||||
goto handle_uninterpreted;
|
||||
}
|
||||
if (input->ExpectTag(16)) goto parse_minor;
|
||||
if (input->ExpectTag(16)) goto parse_minorVersion;
|
||||
break;
|
||||
}
|
||||
|
||||
// required uint32 minor = 2;
|
||||
// required uint32 minorVersion = 2;
|
||||
case 2: {
|
||||
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
||||
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
|
||||
parse_minor:
|
||||
parse_minorVersion:
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
|
||||
input, &minor_)));
|
||||
set_has_minor();
|
||||
input, &minorversion_)));
|
||||
set_has_minorversion();
|
||||
} else {
|
||||
goto handle_uninterpreted;
|
||||
}
|
||||
@@ -1576,14 +1576,14 @@ bool AnnounceMessage_Version::MergePartialFromCodedStream(
|
||||
|
||||
void AnnounceMessage_Version::SerializeWithCachedSizes(
|
||||
::google::protobuf::io::CodedOutputStream* output) const {
|
||||
// required uint32 major = 1;
|
||||
if (has_major()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->major(), output);
|
||||
// required uint32 majorVersion = 1;
|
||||
if (has_majorversion()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->majorversion(), output);
|
||||
}
|
||||
|
||||
// required uint32 minor = 2;
|
||||
if (has_minor()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->minor(), output);
|
||||
// required uint32 minorVersion = 2;
|
||||
if (has_minorversion()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->minorversion(), output);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1592,18 +1592,18 @@ int AnnounceMessage_Version::ByteSize() const {
|
||||
int total_size = 0;
|
||||
|
||||
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
// required uint32 major = 1;
|
||||
if (has_major()) {
|
||||
// required uint32 majorVersion = 1;
|
||||
if (has_majorversion()) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::UInt32Size(
|
||||
this->major());
|
||||
this->majorversion());
|
||||
}
|
||||
|
||||
// required uint32 minor = 2;
|
||||
if (has_minor()) {
|
||||
// required uint32 minorVersion = 2;
|
||||
if (has_minorversion()) {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::UInt32Size(
|
||||
this->minor());
|
||||
this->minorversion());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1621,11 +1621,11 @@ void AnnounceMessage_Version::CheckTypeAndMergeFrom(
|
||||
void AnnounceMessage_Version::MergeFrom(const AnnounceMessage_Version& from) {
|
||||
GOOGLE_CHECK_NE(&from, this);
|
||||
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
if (from.has_major()) {
|
||||
set_major(from.major());
|
||||
if (from.has_majorversion()) {
|
||||
set_majorversion(from.majorversion());
|
||||
}
|
||||
if (from.has_minor()) {
|
||||
set_minor(from.minor());
|
||||
if (from.has_minorversion()) {
|
||||
set_minorversion(from.minorversion());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1644,8 +1644,8 @@ bool AnnounceMessage_Version::IsInitialized() const {
|
||||
|
||||
void AnnounceMessage_Version::Swap(AnnounceMessage_Version* other) {
|
||||
if (other != this) {
|
||||
std::swap(major_, other->major_);
|
||||
std::swap(minor_, other->minor_);
|
||||
std::swap(majorversion_, other->majorversion_);
|
||||
std::swap(minorversion_, other->minorversion_);
|
||||
std::swap(_has_bits_[0], other->_has_bits_[0]);
|
||||
std::swap(_cached_size_, other->_cached_size_);
|
||||
}
|
||||
|
||||
+42
-42
@@ -929,29 +929,29 @@ class AnnounceMessage_Version : public ::google::protobuf::MessageLite {
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
// required uint32 major = 1;
|
||||
inline bool has_major() const;
|
||||
inline void clear_major();
|
||||
static const int kMajorFieldNumber = 1;
|
||||
inline ::google::protobuf::uint32 major() const;
|
||||
inline void set_major(::google::protobuf::uint32 value);
|
||||
// required uint32 majorVersion = 1;
|
||||
inline bool has_majorversion() const;
|
||||
inline void clear_majorversion();
|
||||
static const int kMajorVersionFieldNumber = 1;
|
||||
inline ::google::protobuf::uint32 majorversion() const;
|
||||
inline void set_majorversion(::google::protobuf::uint32 value);
|
||||
|
||||
// required uint32 minor = 2;
|
||||
inline bool has_minor() const;
|
||||
inline void clear_minor();
|
||||
static const int kMinorFieldNumber = 2;
|
||||
inline ::google::protobuf::uint32 minor() const;
|
||||
inline void set_minor(::google::protobuf::uint32 value);
|
||||
// required uint32 minorVersion = 2;
|
||||
inline bool has_minorversion() const;
|
||||
inline void clear_minorversion();
|
||||
static const int kMinorVersionFieldNumber = 2;
|
||||
inline ::google::protobuf::uint32 minorversion() const;
|
||||
inline void set_minorversion(::google::protobuf::uint32 value);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:AnnounceMessage.Version)
|
||||
private:
|
||||
inline void set_has_major();
|
||||
inline void clear_has_major();
|
||||
inline void set_has_minor();
|
||||
inline void clear_has_minor();
|
||||
inline void set_has_majorversion();
|
||||
inline void clear_has_majorversion();
|
||||
inline void set_has_minorversion();
|
||||
inline void clear_has_minorversion();
|
||||
|
||||
::google::protobuf::uint32 major_;
|
||||
::google::protobuf::uint32 minor_;
|
||||
::google::protobuf::uint32 majorversion_;
|
||||
::google::protobuf::uint32 minorversion_;
|
||||
|
||||
mutable int _cached_size_;
|
||||
::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
|
||||
@@ -9601,48 +9601,48 @@ inline void PlayerResult::set_cardsvalue(::google::protobuf::uint32 value) {
|
||||
|
||||
// AnnounceMessage_Version
|
||||
|
||||
// required uint32 major = 1;
|
||||
inline bool AnnounceMessage_Version::has_major() const {
|
||||
// required uint32 majorVersion = 1;
|
||||
inline bool AnnounceMessage_Version::has_majorversion() const {
|
||||
return (_has_bits_[0] & 0x00000001u) != 0;
|
||||
}
|
||||
inline void AnnounceMessage_Version::set_has_major() {
|
||||
inline void AnnounceMessage_Version::set_has_majorversion() {
|
||||
_has_bits_[0] |= 0x00000001u;
|
||||
}
|
||||
inline void AnnounceMessage_Version::clear_has_major() {
|
||||
inline void AnnounceMessage_Version::clear_has_majorversion() {
|
||||
_has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
inline void AnnounceMessage_Version::clear_major() {
|
||||
major_ = 0u;
|
||||
clear_has_major();
|
||||
inline void AnnounceMessage_Version::clear_majorversion() {
|
||||
majorversion_ = 0u;
|
||||
clear_has_majorversion();
|
||||
}
|
||||
inline ::google::protobuf::uint32 AnnounceMessage_Version::major() const {
|
||||
return major_;
|
||||
inline ::google::protobuf::uint32 AnnounceMessage_Version::majorversion() const {
|
||||
return majorversion_;
|
||||
}
|
||||
inline void AnnounceMessage_Version::set_major(::google::protobuf::uint32 value) {
|
||||
set_has_major();
|
||||
major_ = value;
|
||||
inline void AnnounceMessage_Version::set_majorversion(::google::protobuf::uint32 value) {
|
||||
set_has_majorversion();
|
||||
majorversion_ = value;
|
||||
}
|
||||
|
||||
// required uint32 minor = 2;
|
||||
inline bool AnnounceMessage_Version::has_minor() const {
|
||||
// required uint32 minorVersion = 2;
|
||||
inline bool AnnounceMessage_Version::has_minorversion() const {
|
||||
return (_has_bits_[0] & 0x00000002u) != 0;
|
||||
}
|
||||
inline void AnnounceMessage_Version::set_has_minor() {
|
||||
inline void AnnounceMessage_Version::set_has_minorversion() {
|
||||
_has_bits_[0] |= 0x00000002u;
|
||||
}
|
||||
inline void AnnounceMessage_Version::clear_has_minor() {
|
||||
inline void AnnounceMessage_Version::clear_has_minorversion() {
|
||||
_has_bits_[0] &= ~0x00000002u;
|
||||
}
|
||||
inline void AnnounceMessage_Version::clear_minor() {
|
||||
minor_ = 0u;
|
||||
clear_has_minor();
|
||||
inline void AnnounceMessage_Version::clear_minorversion() {
|
||||
minorversion_ = 0u;
|
||||
clear_has_minorversion();
|
||||
}
|
||||
inline ::google::protobuf::uint32 AnnounceMessage_Version::minor() const {
|
||||
return minor_;
|
||||
inline ::google::protobuf::uint32 AnnounceMessage_Version::minorversion() const {
|
||||
return minorversion_;
|
||||
}
|
||||
inline void AnnounceMessage_Version::set_minor(::google::protobuf::uint32 value) {
|
||||
set_has_minor();
|
||||
minor_ = value;
|
||||
inline void AnnounceMessage_Version::set_minorversion(::google::protobuf::uint32 value) {
|
||||
set_has_minorversion();
|
||||
minorversion_ = value;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user