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:
Evgeni Golov
2012-12-28 12:14:54 +01:00
parent a102afe606
commit 1bbe608f50
6 changed files with 143 additions and 143 deletions
+6 -6
View File
@@ -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());