diff --git a/CMakeLists.txt b/CMakeLists.txt index fbb41059..e3594347 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,7 @@ elseif (UNIX) endif () # our "always on" flags - build by default for the system we're on but include all instruction sets - set(CMAKE_CXX_FLAGS "-m32 -pipe -march=native -mtune=native \ + set(CMAKE_CXX_FLAGS "-pipe -march=native -mtune=native \ -Wformat -Wno-overloaded-virtual -Wno-missing-braces -Wno-format \ -Wno-write-strings -Wno-unknown-pragmas \ -Wno-uninitialized -Wno-reorder -Wno-tautological-constant-out-of-range-compare -Wno-stringop-overflow -Wno-address-of-packed-member") diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.h b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.h index 176ec79e..617f75fd 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.h @@ -40,7 +40,7 @@ public: void onSendAbortTransaction(unsigned int, unsigned int, void *) {}; void onSendAuditAssetTransfer(unsigned int, unsigned int, void *) {}; - void onGetNewTransactionID(unsigned int, unsigned int, int64, void *) {}; + void onGetNewTransactionID(unsigned int, unsigned int, int64_t, void *) {}; // Responses to reply requests void onReplyReceivePrepareTransaction(unsigned int, unsigned int, void *) {}; @@ -52,10 +52,10 @@ public: void onIdentifyHost(unsigned int, unsigned int, void *) {}; // callbacks initiated by auction - void onReceivePrepareTransaction(unsigned int, int64, unsigned int, unsigned int, int64, const char *) {}; - void onReceiveCommitTransaction(unsigned int, int64) {}; - void onReceiveAbortTransaction(unsigned int, int64) {}; - void onReceiveGetCharacterList(unsigned int, unsigned int, const char *) {}; + void onReceivePrepareTransaction(unsigned int, int64_t, unsigned int, unsigned int, int64_t, const char *) {}; + void onReceiveCommitTransaction(unsigned int, int64_t) {}; + void onReceiveAbortTransaction(unsigned int, int64_t) {}; + void onReceiveGetCharacterList(unsigned int, int64_t, const char *) {}; private: diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.h index a3d85096..2ad6d405 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.h @@ -62,7 +62,7 @@ public: virtual void onSendCommitTransaction (unsigned trackingNumber, unsigned responseCode, void *user) = 0; virtual void onSendAbortTransaction (unsigned trackingNumber, unsigned responseCode, void *user) = 0; virtual void onSendAuditAssetTransfer(unsigned trackingNumber, unsigned responseCode, void *user) = 0; - virtual void onGetNewTransactionID( unsigned trackingNumber, unsigned responseCode, long long transactionID, void *user) = 0; + virtual void onGetNewTransactionID( unsigned trackingNumber, unsigned responseCode, int64_t transactionID, void *user) = 0; // responses to reply requests virtual void onReplyReceivePrepareTransaction (unsigned trackingNumber, unsigned responseCode, void *user) = 0; @@ -75,10 +75,10 @@ public: // Callbacks initiated by the Auction System - virtual void onReceivePrepareTransaction (unsigned trackingNumber, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const char *newName) = 0; - virtual void onReceiveCommitTransaction (unsigned trackingNumber, long long transactionID) = 0; - virtual void onReceiveAbortTransaction (unsigned trackingNumber, long long transactionID) = 0; - virtual void onReceiveGetCharacterList(unsigned trackingNumber, unsigned stationID, const char *serverID) = 0; + virtual void onReceivePrepareTransaction (unsigned trackingNumber, int64_t transactionID, unsigned stationID, unsigned characterID, int64_t assetID, const char *newName) = 0; + virtual void onReceiveCommitTransaction (unsigned trackingNumber, int64_t transactionID) = 0; + virtual void onReceiveAbortTransaction (unsigned trackingNumber, int64_t transactionID) = 0; + virtual void onReceiveGetCharacterList(unsigned trackingNumber, int64_t stationID, const char *serverID) = 0; private: AuctionTransferAPICore *m_apiCore; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.cpp index c2ccccb0..cc7d509d 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.cpp @@ -135,7 +135,7 @@ void AuctionTransferAPICore::responseCallback(short type, Base::ByteStream::Read ServerTrackObject *stobj = new ServerTrackObject(++m_mappedServerTrack, real_server_track, connection); m_serverTracks.insert(std::pair(m_mappedServerTrack, stobj)); - long long transactionID; + int64_t transactionID; get(iter, transactionID); switch (type) { @@ -143,7 +143,7 @@ void AuctionTransferAPICore::responseCallback(short type, Base::ByteStream::Read { unsigned stationID; unsigned characterID; - long long assetID; + int64_t assetID; std::string newName; get(iter, stationID); get(iter, characterID); @@ -167,7 +167,7 @@ void AuctionTransferAPICore::responseCallback(short type, Base::ByteStream::Read // this had the stationID read in as the transactionID std::string serverID; get(iter, serverID); - m_api->onReceiveGetCharacterList(m_mappedServerTrack, (unsigned int)transactionID, serverID.c_str()); + m_api->onReceiveGetCharacterList(m_mappedServerTrack, transactionID, serverID.c_str()); } default: break; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Types.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Types.h index 69419a0f..a5eb0413 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Types.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Types.h @@ -11,7 +11,8 @@ #ifndef BASE_LINUX_TYPES_H #define BASE_LINUX_TYPES_H -#include +//#include +#include #ifdef EXTERNAL_DISTRO namespace NAMESPACE @@ -34,9 +35,9 @@ typedef signed short int16; typedef unsigned short uint16; typedef int32_t int32; -typedef u_int32_t uint32; +typedef uint32_t uint32; typedef int64_t int64; -typedef u_int64_t uint64; +typedef uint64_t uint64; } #ifdef EXTERNAL_DISTRO }; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h index 0c64cb2c..aa9ba015 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h @@ -28,10 +28,10 @@ typedef unsigned char uint8; typedef short int16; typedef unsigned short uint16; -typedef int int32; -typedef unsigned uint32; -typedef __int64 int64; -typedef unsigned __int64 uint64; +typedef int32_t int32; +typedef uint32_t uint32; +typedef int64_t int64; +typedef uint64_t uint64; }; #ifdef EXTERNAL_DISTRO diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp index ed2e0ad3..c1268159 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp @@ -76,7 +76,7 @@ void ReplyRequest::pack(Base::ByteStream &msg) } ////////////////////////////////////////////////////////////////////////////////////// -CommonRequest::CommonRequest( RequestTypes type, unsigned serverTrack, long long transactionID ) +CommonRequest::CommonRequest( RequestTypes type, unsigned serverTrack, int64_t transactionID ) : GenericRequest((short)type, serverTrack), m_transactionID(transactionID) { } @@ -101,7 +101,7 @@ void GetIDRequest::pack(Base::ByteStream &msg) } ////////////////////////////////////////////////////////////////////////////////////// -SendPrepareCompressedRequest::SendPrepareCompressedRequest(RequestTypes type, unsigned serverTrack, const char *serverID, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const unsigned char *xmlAsset, unsigned length) +SendPrepareCompressedRequest::SendPrepareCompressedRequest(RequestTypes type, unsigned serverTrack, const char *serverID, int64_t transactionID, unsigned stationID, unsigned characterID, int64_t assetID, const unsigned char *xmlAsset, unsigned length) : GenericRequest((short)type, serverTrack), m_transactionID(transactionID), m_stationID(stationID), @@ -125,7 +125,7 @@ void SendPrepareCompressedRequest::pack(Base::ByteStream &msg) } ////////////////////////////////////////////////////////////////////////////////////// -SendPrepareRequest::SendPrepareRequest( RequestTypes type, unsigned serverTrack, const char *serverID, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const char *xml ) +SendPrepareRequest::SendPrepareRequest( RequestTypes type, unsigned serverTrack, const char *serverID, int64_t transactionID, unsigned stationID, unsigned characterID, int64_t assetID, const char *xml ) : GenericRequest((short)type, serverTrack), m_transactionID(transactionID), m_stationID(stationID), @@ -194,7 +194,7 @@ void IdentifyServerRequest::pack(Base::ByteStream &msg) ////////////////////////////////////////////////////////////////////////////////////// SendAuditRequest::SendAuditRequest( RequestTypes type, unsigned serverTrack, const char *gameCode, const char *serverCode, - long long inGameAssetID, unsigned stationID, const char *event, const char *message) + int64_t inGameAssetID, unsigned stationID, const char *event, const char *message) : GenericRequest((short)type, serverTrack), m_gameCode(gameCode), m_serverCode(serverCode), m_assetID(inGameAssetID), m_userID(stationID), m_event(event), m_message(message) { diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.h index f848c26b..d59c86c9 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.h @@ -43,12 +43,12 @@ namespace AuctionTransfer class CommonRequest: public GenericRequest { public: - CommonRequest(RequestTypes type, unsigned serverTrack, long long transactionID); + CommonRequest(RequestTypes type, unsigned serverTrack, int64_t transactionID); virtual ~CommonRequest() {}; void pack(Base::ByteStream &msg); private: - long long m_transactionID; + int64_t m_transactionID; }; ////////////////////////////////////////////////////////////////////////////////////// @@ -66,15 +66,15 @@ namespace AuctionTransfer class SendPrepareRequest: public GenericRequest { public: - SendPrepareRequest(RequestTypes type, unsigned serverTrack, const char *serverID, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const char *xmlAsset); + SendPrepareRequest(RequestTypes type, unsigned serverTrack, const char *serverID, int64_t transactionID, unsigned stationID, unsigned characterID, int64_t assetID, const char *xmlAsset); virtual ~SendPrepareRequest() {}; void pack(Base::ByteStream &msg); private: - long long m_transactionID; + int64_t m_transactionID; unsigned m_stationID; unsigned m_characterID; - long long m_assetID; + int64_t m_assetID; std::string m_xml; std::string m_serverID; }; @@ -83,15 +83,15 @@ namespace AuctionTransfer class SendPrepareCompressedRequest: public GenericRequest { public: - SendPrepareCompressedRequest(RequestTypes type, unsigned serverTrack, const char *serverID, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const unsigned char *xmlAsset, unsigned length); + SendPrepareCompressedRequest(RequestTypes type, unsigned serverTrack, const char *serverID, int64_t transactionID, unsigned stationID, unsigned characterID, int64_t assetID, const unsigned char *xmlAsset, unsigned length); virtual ~SendPrepareCompressedRequest() {}; void pack(Base::ByteStream &msg); private: - long long m_transactionID; + int64_t m_transactionID; unsigned m_stationID; unsigned m_characterID; - long long m_assetID; + int64_t m_assetID; //std::string m_xml; std::string m_serverID; Blob m_data; @@ -127,13 +127,13 @@ namespace AuctionTransfer { public: SendAuditRequest( RequestTypes type, unsigned serverTrack, const char *gameCode, const char *serverCode, - long long inGameAssetID, unsigned stationID, const char *event, const char *message); + int64_t inGameAssetID, unsigned stationID, const char *event, const char *message); ~SendAuditRequest() {}; void pack(Base::ByteStream &msg); private: std::string m_gameCode; std::string m_serverCode; - long long m_assetID; + int64_t m_assetID; unsigned m_userID; std::string m_event; std::string m_message; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.h index c7352fa2..709f4abc 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.h @@ -22,10 +22,10 @@ namespace AuctionTransfer public: GetIDResponse(RequestTypes type, void *user); virtual ~GetIDResponse() {} - long long getNewID() { return m_transactionID; } + int64_t getNewID() { return m_transactionID; } virtual void unpack(Base::ByteStream::ReadIterator &iter); private: - long long m_transactionID; + int64_t m_transactionID; }; diff --git a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp index c52044b8..afc1b2f4 100755 --- a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp @@ -355,7 +355,7 @@ void ChatInterface::OnGetRoom(unsigned track, unsigned result, const ChatRoom *r ChatServer::putSystemAvatarInRoom(roomName); } std::string lowerRoomName = toLower(roomName); - unsigned sequence = (unsigned)user; + uint64_t sequence = (uint64_t)user; std::unordered_map::iterator f = roomList.find(lowerRoomName); if (f != roomList.end() && room) { @@ -416,7 +416,7 @@ void ChatInterface::OnGetRoom(unsigned track, unsigned result, const ChatRoom *r //----------------------------------------------------------------------- -void ChatInterface::queryRoom(const NetworkId & id, ConnectionServerConnection * connection, const unsigned int sequence, const std::string & roomName) +void ChatInterface::queryRoom(const NetworkId & id, ConnectionServerConnection * connection, const uint64_t sequence, const std::string & roomName) { UNREF(connection); ChatServer::fileLog(s_enableChatRoomLogs, "ChatInterface", "queryRoom() id(%s) connection(%s) sequence(%u) roomName(%s)", id.getValueString().c_str(), ChatServer::getConnectionAddress(connection).c_str(), sequence, roomName.c_str()); @@ -1579,7 +1579,7 @@ void ChatInterface::OnCreateRoom(unsigned track,unsigned result, const ChatRoom PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnCreateRoom"); UNREF(user); - unsigned sequence = (unsigned)user; + uint64_t sequence = (uint64_t)user; static Unicode::String wideSWG = Unicode::narrowToWide("SOE+SWG"); static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); @@ -1882,7 +1882,7 @@ void ChatInterface::OnEnterRoom(unsigned track, unsigned result, const ChatAvata return; } - unsigned sequence = (unsigned)user; + uint64_t sequence = (uint64_t)user; ChatAvatarId srcId; if (srcAvatar) @@ -2559,7 +2559,7 @@ void ChatInterface::OnLeaveRoom(unsigned track, unsigned result, const ChatAvata return; } - unsigned sequence = (unsigned)user; + uint64_t sequence = (uint64_t)user; ChatAvatarId id; if (srcAvatar) @@ -2913,7 +2913,7 @@ void ChatInterface::OnSendRoomMessage(unsigned track, unsigned result, const Cha } UNREF(srcAvatar); UNREF(destRoom); - unsigned sequence = (unsigned)user; + uint64_t sequence = (uint64_t)user; ChatOnSendRoomMessage chat(sequence, result); IGNORE_RETURN(ChatServer::sendResponseForTrackId(track, chat)); } @@ -2998,7 +2998,7 @@ void ChatInterface::OnSendInstantMessage(unsigned track, unsigned result, const } UNREF(srcAvatar); - unsigned sequence = (unsigned)user; + uint64_t sequence = (uint64_t)user; ChatOnSendInstantMessage chat(sequence, result); IGNORE_RETURN(ChatServer::sendResponseForTrackId(track, chat)); @@ -3053,7 +3053,7 @@ void ChatInterface::OnSendPersistentMessage(unsigned track, unsigned result, con DEBUG_WARNING(true, ("We received an OnSendPersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } - unsigned sequence = (unsigned)user; + uint64_t sequence = (uint64_t)user; UNREF(srcAvatar); ChatOnSendPersistentMessage chat(sequence, result); IGNORE_RETURN(ChatServer::sendResponseForTrackId(track, chat)); diff --git a/engine/server/application/ChatServer/src/shared/ChatInterface.h b/engine/server/application/ChatServer/src/shared/ChatInterface.h index 31c3bed6..3fc0f225 100755 --- a/engine/server/application/ChatServer/src/shared/ChatInterface.h +++ b/engine/server/application/ChatServer/src/shared/ChatInterface.h @@ -68,7 +68,7 @@ public: std::string getChatName(const NetworkId &id); - void queryRoom (const NetworkId & id, ConnectionServerConnection * connection, const unsigned int sequenceId, const std::string & roomName); + void queryRoom (const NetworkId & id, ConnectionServerConnection * connection, const uint64_t sequenceId, const std::string & roomName); void updateRoomForThisChatAPI(const ChatRoom *room, const ChatAvatar *additionalAvatar); void updateRooms(); diff --git a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp index 73ff91ae..b9dc88ea 100755 --- a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp +++ b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp @@ -120,7 +120,7 @@ void SessionApiClient::OnSessionValidate(const apiTrackingNumber trackingNumber, else { // attempt to validate a CS Tool associated with this request. - CSToolConnection::validateCSTool( ( uint32 )userData, result, session ); + CSToolConnection::validateCSTool( ( uint64 )userData, result, session ); } } diff --git a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp index 0ecbb8d6..29ae6e71 100755 --- a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp @@ -2349,7 +2349,7 @@ void PlanetObject::adjustGcwImperialScore(std::string const & source, CreatureOb // grant GCW Region Defender bonus float bonus = 0.0f; if (gcwCategoryData->gcwRegionDefender && PvpData::isImperialFactionId(sourceObject->getPvpFaction()) && (adjustment > 0) && (playerObject->getCurrentGcwRegion() == gcwCategory) && Pvp::getGcwDefenderRegionBonus(*sourceObject, *playerObject, bonus) && (bonus > 0.0f)) - adjustment += std::max(1ll, static_cast(static_cast(bonus) * static_cast(adjustment) / static_cast(100))); + adjustment += static_cast(std::max(static_cast(1), static_cast(bonus) * static_cast(adjustment) / 100)); } LOG("CustomerService", ("GcwScore: imperial %s %d (from %s - %s)", gcwCategory.c_str(), static_cast(adjustment), source.c_str(), sourceObject->getNetworkId().getValueString().c_str())); @@ -2394,7 +2394,7 @@ void PlanetObject::adjustGcwRebelScore(std::string const & source, CreatureObjec // grant GCW Region Defender bonus float bonus = 0.0f; if (gcwCategoryData->gcwRegionDefender && PvpData::isRebelFactionId(sourceObject->getPvpFaction()) && (adjustment > 0) && (playerObject->getCurrentGcwRegion() == gcwCategory) && Pvp::getGcwDefenderRegionBonus(*sourceObject, *playerObject, bonus) && (bonus > 0.0f)) - adjustment += std::max(1ll, static_cast(static_cast(bonus) * static_cast(adjustment) / static_cast(100))); + adjustment += static_cast(std::max(static_cast(1), static_cast(bonus) * static_cast(adjustment) / 100)); } LOG("CustomerService", ("GcwScore: rebel %s %d (from %s - %s)", gcwCategory.c_str(), static_cast(adjustment), source.c_str(), sourceObject->getNetworkId().getValueString().c_str())); diff --git a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp index 615c8824..2c1df6ae 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp @@ -6115,7 +6115,7 @@ void PlayerObject::getByteStreamFromAutoVariable(const std::string & name, Archi { if(name == "quests") { - Archive::AutoDeltaMap(m_quests).pack(target); + Archive::AutoDeltaMap(m_quests).pack(target); } else if(name == "completedQuests") { @@ -6202,11 +6202,11 @@ void PlayerObject::setAutoVariableFromByteStream(const std::string & name, const Archive::ReadIterator ri(source); if(name == "quests") { - typedef Archive::AutoDeltaMap::Command Commands; + typedef Archive::AutoDeltaMap::Command Commands; std::vector quests; m_quests.clear(); - Archive::AutoDeltaMap(m_quests).unpack(ri, quests); + Archive::AutoDeltaMap(m_quests).unpack(ri, quests); for (std::vector::const_iterator questIter = quests.begin(); questIter != quests.end(); ++questIter) { diff --git a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp index 82e2a710..e0835433 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp @@ -54,7 +54,7 @@ ResourcePoolObject::~ResourcePoolObject() */ float ResourcePoolObject::harvest(float installedEfficiency, uint32 lastHarvestTime) const { - int elapsedTime=static_cast(std::min(ServerClock::getInstance().getGameTimeSeconds(),m_depletedTimestamp) - lastHarvestTime); + int elapsedTime=static_cast(std::min(ServerClock::getInstance().getGameTimeSeconds(),static_cast(m_depletedTimestamp)) - lastHarvestTime); if (elapsedTime < 0) return 0; float elapsedTicks =static_cast(elapsedTime) / static_cast(ConfigServerGame::getSecondsPerResourceTick()); diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.h b/engine/server/library/serverGame/src/shared/object/ServerObject.h index 23e12f28..90437a5c 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.h +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.h @@ -551,7 +551,7 @@ public: virtual bool isVisibleOnClient (const Client & client) const = 0; virtual void kill (); - void performSocial (const NetworkId & target, unsigned long socialType, bool animationOk, bool textOk); + void performSocial (const NetworkId & target, uint32 socialType, bool animationOk, bool textOk); void performSocial (const MessageQueueSocial & socialMsg); void performCombatSpam (const MessageQueueCombatSpam & combatSpam, bool sendToSelf, bool sendToTarget, bool sendToBystanders); @@ -583,7 +583,7 @@ public: virtual void setOwnerId(const NetworkId &id); void setSceneIdOnThisAndContents (const std::string & sceneId); void setPlayerControlled (bool newValue); - void speakText (NetworkId const &target, unsigned long chatType, unsigned long mood, unsigned long flags, Unicode::String const &speech, int language, Unicode::String const &oob); + void speakText (NetworkId const &target, uint32 chatType, uint32 mood, uint32 flags, Unicode::String const &speech, int language, Unicode::String const &oob); virtual void speakText (MessageQueueSpatialChat const &spatialChat); virtual void hearText (ServerObject const &source, MessageQueueSpatialChat const &spatialChat, int chatMessageIndex); void teleportObject (Vector const & position_w, NetworkId const &targetContainer, std::string const &targetCellName, Vector const &position_p, std::string const &scriptCallback, bool forceLoadScreen = false); diff --git a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp index d6e291ae..5cd42a72 100755 --- a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp @@ -843,14 +843,14 @@ int Pvp::calculateGcwImperialScorePercentile(std::string const & gcwCategory, st { std::map >::const_iterator const iterImperial = gcwImperialScore.find(gcwCategory); if (iterImperial != gcwImperialScore.end()) - totalImperial = static_cast(std::max(0ll, iterImperial->second.first)) + static_cast(std::max(0ll, iterImperial->second.second)); + totalImperial = static_cast(std::max(0l, iterImperial->second.first)) + static_cast(std::max(0l, iterImperial->second.second)); } uint64 total = totalImperial; { std::map >::const_iterator const iterRebel = gcwRebelScore.find(gcwCategory); if (iterRebel != gcwRebelScore.end()) - total += (static_cast(std::max(0ll, iterRebel->second.first)) + static_cast(std::max(0ll, iterRebel->second.second))); + total += (static_cast(std::max(0l, iterRebel->second.first)) + static_cast(std::max(0l, iterRebel->second.second))); } // if the score is less than 1, treat it as a tie; note that score is scaled by 1000 diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp index 8ec08af5..b8ed9a83 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp @@ -709,32 +709,32 @@ void CityPathGraph::setLinkDistance ( float dist ) // we cast the addresses of all the neighbors to ints, multiply them // by a random large prime number, then xor the bits together. -int CityPathGraph::getNeighborCode ( int whichNode ) const -{ - CityPathNode const * node = _getNode(whichNode); - - if(node == nullptr) return 0; - - int edgeCount = node->getEdgeCount(); - - int code = 0; - - for(int i = 0; i < edgeCount; i++) - { - int neighborId = node->getNeighbor(i); - - CityPathNode const * neighbor = _getNode(neighborId); - - if(neighbor == nullptr) continue; - - int neighborInt = reinterpret_cast(neighbor); - - int mungedInt = neighborInt * 1295183; - - code ^= mungedInt; - } - - return code; -} +//int CityPathGraph::getNeighborCode ( int whichNode ) const +//{ +// CityPathNode const * node = _getNode(whichNode); +// +// if(node == nullptr) return 0; +// +// int edgeCount = node->getEdgeCount(); +// +// int code = 0; +// +// for(int i = 0; i < edgeCount; i++) +// { +// int neighborId = node->getNeighbor(i); +// +// CityPathNode const * neighbor = _getNode(neighborId); +// +// if(neighbor == nullptr) continue; +// +// int neighborInt = reinterpret_cast(neighbor); +// +// int mungedInt = neighborInt * 1295183; +// +// code ^= mungedInt; +// } +// +// return code; +//} // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.h b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.h index 322f653c..89835c99 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.h +++ b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.h @@ -84,7 +84,7 @@ public: static float getLinkDistance ( void ); static void setLinkDistance ( float dist ); - int getNeighborCode ( int whichNode ) const; +// int getNeighborCode ( int whichNode ) const; protected: diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 75f83e68..b1df5f35 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -790,7 +790,7 @@ void JavaLibrary::fatalHandler(int signum) char lib1[BUFLEN], lib2[BUFLEN]; char file1[BUFLEN], file2[BUFLEN]; int line1, line2; - bool result1 = DebugHelp::lookupAddress(reinterpret_cast(crashAddress1), lib1, file1, BUFLEN, line1); + bool result1 = DebugHelp::lookupAddress(reinterpret_cast(crashAddress1), lib1, file1, BUFLEN, line1); // do a second test based on the return address // it turns out that in some java crashes we don't even have 2 return @@ -801,25 +801,25 @@ void JavaLibrary::fatalHandler(int signum) void *crashAddress2c = nullptr; void *frameAddressA = nullptr; void *frameAddressB = nullptr; - uint32 frameAddressHigh = (reinterpret_cast(frameAddress) >> 16); + uint64 frameAddressHigh = (reinterpret_cast(frameAddress) >> 16); crashAddress2a = __builtin_return_address(0); if (crashAddress2a != nullptr) { frameAddressA = __builtin_frame_address(1); if (frameAddressA != nullptr && - (reinterpret_cast(frameAddressA) >> 16 == frameAddressHigh)) + (reinterpret_cast(frameAddressA) >> 16 == frameAddressHigh)) { crashAddress2b = __builtin_return_address(1); if (crashAddress2b != nullptr) { frameAddressB = __builtin_frame_address(2); if (frameAddressB != nullptr && - (reinterpret_cast(frameAddressB) >> 16 == frameAddressHigh)) + (reinterpret_cast(frameAddressB) >> 16 == frameAddressHigh)) { crashAddress2c = __builtin_return_address(2); if (crashAddress2c != nullptr) { - result2 = DebugHelp::lookupAddress(reinterpret_cast( + result2 = DebugHelp::lookupAddress(reinterpret_cast( crashAddress2c), lib2, file2, BUFLEN, line2); } } diff --git a/engine/server/library/serverUtility/src/shared/ServerConnection.h b/engine/server/library/serverUtility/src/shared/ServerConnection.h index d7fd6519..e53b23d6 100755 --- a/engine/server/library/serverUtility/src/shared/ServerConnection.h +++ b/engine/server/library/serverUtility/src/shared/ServerConnection.h @@ -41,7 +41,7 @@ public: virtual void reportReceive (const Archive::ByteStream & bs); virtual void reportSend (const Archive::ByteStream & bs); virtual void send (const GameNetworkMessage & message, const bool reliable); - virtual void setProcessId (const unsigned long newProcessId); + virtual void setProcessId (const uint32 newProcessId); public: class MessageConnectionCallback: public MessageDispatch::MessageBase diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableLong.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableLong.h index f4dc519c..c76c2621 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableLong.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableLong.h @@ -32,7 +32,7 @@ namespace DB { // following alternate getValue's are provided for convenience, particularly in // the auto-generated code: void getValue(unsigned int &buffer) const; - void getValue(uint32 &buffer) const; // for some reason, our compiler is convinced that uint32 != unsigned int +// void getValue(uint32 &buffer) const; // for some reason, our compiler is convinced that uint32 != unsigned int void getValue(long int &buffer) const; void getValue(int &buffer) const; void getValue(int8 &buffer) const; @@ -57,10 +57,10 @@ inline void DB::BindableLong::getValue(unsigned int &buffer) const // ---------------------------------------------------------------------- -inline void DB::BindableLong::getValue(uint32 &buffer) const -{ - buffer=static_cast(getValue()); -} +//inline void DB::BindableLong::getValue(uint32 &buffer) const +//{ +// buffer=static_cast(getValue()); +//} // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp index b0cec73d..39e3303a 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp @@ -154,22 +154,22 @@ bool BindableVarrayNumber::push_back(long int value) return true; } // ---------------------------------------------------------------------- - -bool BindableVarrayNumber::push_back(int64 value) -{ - OCINumber buffer; - - OCIInd buffer_indicator (OCI_IND_NOTNULL); - - OCISession *localSession = safe_cast(m_session); - - if (! (localSession->m_server->checkerr(*localSession, OCINumberFromInt(localSession->errhp, &value, sizeof(value), OCI_NUMBER_SIGNED, &buffer)))) - return false; - if (! (localSession->m_server->checkerr(*localSession, OCICollAppend(localSession->envhp, localSession->errhp, &buffer, &buffer_indicator, m_data)))) - return false; - - return true; -} +// +//bool BindableVarrayNumber::push_back(int64 value) +//{ +// OCINumber buffer; +// +// OCIInd buffer_indicator (OCI_IND_NOTNULL); +// +// OCISession *localSession = safe_cast(m_session); +// +// if (! (localSession->m_server->checkerr(*localSession, OCINumberFromInt(localSession->errhp, &value, sizeof(value), OCI_NUMBER_SIGNED, &buffer)))) +// return false; +// if (! (localSession->m_server->checkerr(*localSession, OCICollAppend(localSession->envhp, localSession->errhp, &buffer, &buffer_indicator, m_data)))) +// return false; +// +// return true; +//} // ---------------------------------------------------------------------- @@ -255,31 +255,31 @@ bool BindableVarrayNumber::push_back(bool IsNULL, long int value) return true; } // ---------------------------------------------------------------------- - -bool BindableVarrayNumber::push_back(bool IsNULL, int64 value) -{ - OCINumber buffer; - - OCIInd buffer_indicator; - - if ( IsNULL ) - { - buffer_indicator = OCI_IND_NULL; - } - else - { - buffer_indicator = OCI_IND_NOTNULL; - } - - OCISession *localSession = safe_cast(m_session); - - if (! (localSession->m_server->checkerr(*localSession, OCINumberFromInt(localSession->errhp, &value, sizeof(value), OCI_NUMBER_SIGNED, &buffer)))) - return false; - if (! (localSession->m_server->checkerr(*localSession, OCICollAppend(localSession->envhp, localSession->errhp, &buffer, &buffer_indicator, m_data)))) - return false; - - return true; -} +// +//bool BindableVarrayNumber::push_back(bool IsNULL, int64 value) +//{ +// OCINumber buffer; +// +// OCIInd buffer_indicator; +// +// if ( IsNULL ) +// { +// buffer_indicator = OCI_IND_NULL; +// } +// else +// { +// buffer_indicator = OCI_IND_NOTNULL; +// } +// +// OCISession *localSession = safe_cast(m_session); +// +// if (! (localSession->m_server->checkerr(*localSession, OCINumberFromInt(localSession->errhp, &value, sizeof(value), OCI_NUMBER_SIGNED, &buffer)))) +// return false; +// if (! (localSession->m_server->checkerr(*localSession, OCICollAppend(localSession->envhp, localSession->errhp, &buffer, &buffer_indicator, m_data)))) +// return false; +// +// return true; +//} // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.h b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.h index a9233b6f..29737005 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.h +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.h @@ -60,11 +60,11 @@ namespace DB bool push_back(bool IsNULL, int value); bool push_back(bool IsNULL, double value); bool push_back(bool IsNULL, long int value); - bool push_back(bool IsNULL, int64 value); +// bool push_back(bool IsNULL, int64 value); bool push_back(int value); bool push_back(double value); bool push_back(long int value); - bool push_back(int64 value); +// bool push_back(int64 value); virtual std::string outputValue() const; }; diff --git a/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp b/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp index c1639ebd..e7a2fb7b 100755 --- a/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp +++ b/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp @@ -174,6 +174,14 @@ inline unsigned int dwarfGet(char const *src, u_int32_t &dest) // ---------------------------------------------------------------------- +inline unsigned int dwarfGet(char const *src, u_int64_t &dest) +{ + memcpy(&dest, src, sizeof(u_int64_t)); + return sizeof(u_int64_t); +} + +// ---------------------------------------------------------------------- + class LEB128 { public: @@ -294,7 +302,7 @@ static bool dwarfSearch(char const *dwarfLines, unsigned int linesLength, void c { int progFile = 0; int progLine = 1; - u_int32_t progAddr = 0; + u_int64_t progAddr = 0; bool done = false; bool valid = false; @@ -384,9 +392,9 @@ static bool dwarfSearch(char const *dwarfLines, unsigned int linesLength, void c if (valid) { - unsigned int addrOffset = 0; - if (progAddr < reinterpret_cast(info.dli_fbase)) - addrOffset = reinterpret_cast(info.dli_fbase); + u_int64_t addrOffset = 0; + if (progAddr < reinterpret_cast(info.dli_fbase)) + addrOffset = reinterpret_cast(info.dli_fbase); const void *testAddr = reinterpret_cast(progAddr+addrOffset); if (testAddr >= addr) { @@ -509,12 +517,12 @@ static bool stabSearch(Stab const *stab, unsigned int stabSize, char const *stab if (reinterpret_cast(stab->n_value) > info.dli_fbase) funcBase = reinterpret_cast(stab->n_value); else - funcBase = reinterpret_cast(reinterpret_cast(info.dli_fbase)+stab->n_value); + funcBase = reinterpret_cast(reinterpret_cast(info.dli_fbase)+stab->n_value); foundSrcLine = -1; } else if (stab->n_type == N_SLINE && addr >= funcBase) // source line { - if (stab->n_value < reinterpret_cast(addr)-reinterpret_cast(funcBase)) + if (stab->n_value < reinterpret_cast(addr)-reinterpret_cast(funcBase)) foundSrcLine = stab->n_desc; else { @@ -667,7 +675,7 @@ void DebugHelp::remove() // ---------------------------------------------------------------------- -bool DebugHelp::lookupAddress(uint32 address, char *libName, char *fileName, int fileNameLength, int &line) +bool DebugHelp::lookupAddress(uint64 address, char *libName, char *fileName, int fileNameLength, int &line) { return lookupAddressInfo(reinterpret_cast(address), libName, fileName, line, fileNameLength); } diff --git a/engine/shared/library/sharedDebug/src/linux/DebugHelp.h b/engine/shared/library/sharedDebug/src/linux/DebugHelp.h index 972b4979..e297f8eb 100755 --- a/engine/shared/library/sharedDebug/src/linux/DebugHelp.h +++ b/engine/shared/library/sharedDebug/src/linux/DebugHelp.h @@ -20,7 +20,7 @@ public: static void remove(); static void getCallStack(uint32 *callStack, int sizeOfCallStack); - static bool lookupAddress(uint32 address, char *libName, char *fileName, int fileNameLength, int &line); + static bool lookupAddress(uint64 address, char *libName, char *fileName, int fileNameLength, int &line); }; // ====================================================================== diff --git a/engine/shared/library/sharedDebug/src/win32/DebugHelp.h b/engine/shared/library/sharedDebug/src/win32/DebugHelp.h index ead64d75..74e379ab 100755 --- a/engine/shared/library/sharedDebug/src/win32/DebugHelp.h +++ b/engine/shared/library/sharedDebug/src/win32/DebugHelp.h @@ -10,7 +10,7 @@ // ====================================================================== -typedef unsigned long uint32; +typedef uint32_t uint32; // ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h index 867d7086..374994cd 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h @@ -10,7 +10,7 @@ #include typedef unsigned short int WORD; -typedef unsigned long int DWORD; +typedef uint32_t DWORD; typedef bool BOOL; typedef long long __int64; //lint !e13 !e19 // Error: 13 (Bad type), Error: 19 (Useless declaration) // -TRF- Lint preprocessor discrepency, @todo look into this. typedef __int64 LARGE_INTEGER; diff --git a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h index d778be27..7d5b8001 100755 --- a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h +++ b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h @@ -18,8 +18,8 @@ public: FormattedString(); - char const * sprintf(char const * format, ...); - char const * vsprintf(char const * format, va_list const & va); + char const * sprintf(const char * format, ...); + char const * vsprintf(const char * format, va_list va); private: @@ -40,7 +40,7 @@ inline FormattedString::FormattedString() //----------------------------------------------------------------------------- template -inline char const * FormattedString::sprintf(char const * const format, ...) +inline char const * FormattedString::sprintf(const char * format, ...) { char const * result = nullptr; va_list va; @@ -56,7 +56,7 @@ inline char const * FormattedString::sprintf(char const * const form // ---------------------------------------------------------------------- template -inline char const * FormattedString::vsprintf(char const * const format, va_list const & va) +inline char const * FormattedString::vsprintf(const char * format, va_list va) { // Format the string diff --git a/engine/shared/library/sharedFoundation/src/shared/Misc.h b/engine/shared/library/sharedFoundation/src/shared/Misc.h index 1c29b6ed..d0e70c94 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Misc.h +++ b/engine/shared/library/sharedFoundation/src/shared/Misc.h @@ -230,7 +230,7 @@ inline void *memmove(void *destination, const void *source, int length) { DEBUG_FATAL(!destination, ("nullptr destination arg")); DEBUG_FATAL(!source, ("nullptr source arg")); - return memmove(destination, source, static_cast(length)); + return memmove(destination, source, static_cast(length)); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFoundation/src/shared/NetworkId.h b/engine/shared/library/sharedFoundation/src/shared/NetworkId.h index 18ada619..112fc96c 100755 --- a/engine/shared/library/sharedFoundation/src/shared/NetworkId.h +++ b/engine/shared/library/sharedFoundation/src/shared/NetworkId.h @@ -68,8 +68,8 @@ private: friend class DB::BindableNetworkId; - private: - explicit NetworkId(int value); // catch people who incorrectly try to construct one of these from an int +// private: +// explicit NetworkId(int value); // catch people who incorrectly try to construct one of these from an int // also makes constructing one of these from any other incorrect numeric type ambiguous }; diff --git a/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h b/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h index 386c4ffb..347b06b4 100755 --- a/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h +++ b/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h @@ -10,18 +10,19 @@ #define PLATFORM_LINUX #include +#include // ====================================================================== // basic types that we assume to be around -typedef unsigned int uint; +typedef uint32_t uint; typedef unsigned char uint8; typedef unsigned short uint16; -typedef unsigned long uint32; +typedef uint32_t uint32; typedef signed char int8; typedef signed short int16; -typedef signed long int32; -typedef signed long long int int64; -typedef unsigned long long int uint64; +typedef int32_t int32; +typedef int64_t int64; +typedef uint64_t uint64; typedef float real; typedef FILE* FILE_HANDLE; diff --git a/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h b/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h index 622039d8..43a297ab 100755 --- a/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h +++ b/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h @@ -15,17 +15,18 @@ #define PLATFORM_WIN32 +#include // ====================================================================== // basic types that we assume to be around typedef unsigned char uint8; typedef unsigned short uint16; -typedef unsigned long uint32; -typedef unsigned __int64 uint64; +typedef uint32_t uint32; +typedef uint64_t uint64; typedef signed char int8; typedef signed short int16; -typedef signed long int32; -typedef signed __int64 int64; +typedef int32_t int32; +typedef int64_t int64; typedef int FILE_HANDLE; // ====================================================================== diff --git a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp index dc2a932c..2ae61799 100755 --- a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp @@ -313,7 +313,7 @@ void AlterSchedulerNamespace::validateObject(Object const *object) } catch (...) { //lint !e1775 // catch block does not declare any exception // that's right: I want to catch it all. - WARNING(true, ("validateObject(): Object-derived class with address [%x] failed to return valid C++ type info; likely a deleted Object.", reinterpret_cast(object))); + WARNING(true, ("validateObject(): Object-derived class with address [%x] failed to return valid C++ type info; likely a deleted Object.", reinterpret_cast(object))); isInvalid = true; } } diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathNode.h b/engine/shared/library/sharedPathfinding/src/shared/PathNode.h index fd62f52c..aeaeaaf7 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathNode.h +++ b/engine/shared/library/sharedPathfinding/src/shared/PathNode.h @@ -67,8 +67,8 @@ public: int getUserId ( void ) const; void setUserId ( int newId ) const; - int getMark ( int whichMark ) const; - void setMark ( int whichMark, int newValue ) const; + int64_t getMark ( int whichMark ) const; + void setMark ( int whichMark, int64_t newValue ) const; void clearMarks ( void ) const; // ---------- @@ -95,8 +95,8 @@ protected: // These are used to speed up some algorithms. They're not persisted. // Code that uses the marks MUST clear them after use. - mutable int m_userId; - mutable int m_marks[4]; + mutable int m_userId; + mutable int64_t m_marks[4]; }; // ---------------------------------------------------------------------- @@ -214,12 +214,12 @@ inline void PathNode::setUserId ( int newId ) const // ---------- -inline int PathNode::getMark ( int whichMark ) const +inline int64_t PathNode::getMark ( int whichMark ) const { return m_marks[whichMark]; } -inline void PathNode::setMark ( int whichMark, int newMark ) const +inline void PathNode::setMark ( int whichMark, int64_t newMark ) const { m_marks[whichMark] = newMark; } diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp index e09a5cab..f708a315 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp @@ -182,7 +182,7 @@ PathSearchNode * PathSearchNode::createSearchNode( PathNode const * node ) PathSearchNode * oldNode = nullptr; - int mark = node->getMark(3); + int64_t mark = node->getMark(3); if(mark != -1) { @@ -193,7 +193,7 @@ PathSearchNode * PathSearchNode::createSearchNode( PathNode const * node ) PathSearchNode * searchNode = new PathSearchNode(m_search,m_graph,node); - node->setMark( 3, (int)((void*)searchNode) ); + node->setMark( 3, (int64)((void*)searchNode) ); m_search->m_visitedNodes->push_back(node); @@ -208,7 +208,7 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node ) PathSearchNode * searchNode = nullptr; - int mark = node->getMark(3); + int64_t mark = node->getMark(3); if(mark != -1) { @@ -493,7 +493,7 @@ void PathSearch::cleanup ( void ) { PathNode const * visitedNode = m_visitedNodes->at(i); - int mark = visitedNode->getMark(3); + int64_t mark = visitedNode->getMark(3); if(mark != -1) { diff --git a/external/3rd/library/platform/utils/Base/BlockAllocator.h b/external/3rd/library/platform/utils/Base/BlockAllocator.h index bbfbf273..f9f9f863 100755 --- a/external/3rd/library/platform/utils/Base/BlockAllocator.h +++ b/external/3rd/library/platform/utils/Base/BlockAllocator.h @@ -17,7 +17,7 @@ namespace Base BlockAllocator(); ~BlockAllocator(); void *getBlock(unsigned accum); - void returnBlock(unsigned *handle); + void returnBlock(uintptr_t *handle); private: uintptr_t *m_blocks[31]; diff --git a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp index 29d91074..f4042d1f 100755 --- a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp @@ -23,8 +23,8 @@ namespace Base { while(m_blocks[i] != nullptr) { - unsigned *tmp = m_blocks[i]; - m_blocks[i] = (unsigned *)*m_blocks[i]; + uintptr_t *tmp = m_blocks[i]; + m_blocks[i] = (uintptr_t *)*m_blocks[i]; free(tmp); } } @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = nullptr; + uintptr_t *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -79,7 +79,7 @@ namespace Base if(m_blocks[accum] == 0) { // remove the pre allocated block from the linked list - handle = (unsigned *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned)); + handle = (uintptr_t *)calloc(((1 << accum) / 4) + 2, sizeof(uintptr_t)); handle[1] = accum; handle[0] = 0; } @@ -87,20 +87,20 @@ namespace Base { // Allocate a new block handle = m_blocks[accum]; - m_blocks[accum] = (unsigned *)handle[0]; + m_blocks[accum] = (uintptr_t *)handle[0]; handle[0] = 0; } // return a pointer that skips over the header used for the allocator's purposes return(handle + 2); } - void BlockAllocator::returnBlock(unsigned *handle) + void BlockAllocator::returnBlock(uintptr_t *handle) { // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head - *(handle - 2) = (unsigned)m_blocks[*(handle - 1)]; + *(handle - 2) = (uintptr_t)m_blocks[*(handle - 1)]; // Add this entry to the proper linked list node m_blocks[*(handle - 1)] = (handle - 2); } diff --git a/external/3rd/library/platform/utils/Base/linux/Types.h b/external/3rd/library/platform/utils/Base/linux/Types.h index 6ee50450..a685807d 100755 --- a/external/3rd/library/platform/utils/Base/linux/Types.h +++ b/external/3rd/library/platform/utils/Base/linux/Types.h @@ -11,7 +11,8 @@ #ifndef BASE_LINUX_TYPES_H #define BASE_LINUX_TYPES_H -#include +//#include +#include #ifdef EXTERNAL_DISTRO namespace NAMESPACE @@ -31,9 +32,9 @@ typedef signed short int16; typedef unsigned short uint16; typedef int32_t int32; -typedef u_int32_t uint32; +typedef uint32_t uint32; typedef int64_t int64; -typedef u_int64_t uint64; +typedef uint64_t uint64; } #ifdef EXTERNAL_DISTRO }; diff --git a/external/3rd/library/platform/utils/Base/win32/Types.h b/external/3rd/library/platform/utils/Base/win32/Types.h index 0c64cb2c..aa9ba015 100755 --- a/external/3rd/library/platform/utils/Base/win32/Types.h +++ b/external/3rd/library/platform/utils/Base/win32/Types.h @@ -28,10 +28,10 @@ typedef unsigned char uint8; typedef short int16; typedef unsigned short uint16; -typedef int int32; -typedef unsigned uint32; -typedef __int64 int64; -typedef unsigned __int64 uint64; +typedef int32_t int32; +typedef uint32_t uint32; +typedef int64_t int64; +typedef uint64_t uint64; }; #ifdef EXTERNAL_DISTRO diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/BlockAllocator.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/BlockAllocator.h index bbfbf273..f9f9f863 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/BlockAllocator.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/BlockAllocator.h @@ -17,7 +17,7 @@ namespace Base BlockAllocator(); ~BlockAllocator(); void *getBlock(unsigned accum); - void returnBlock(unsigned *handle); + void returnBlock(uintptr_t *handle); private: uintptr_t *m_blocks[31]; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp index 29d91074..f4042d1f 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp @@ -23,8 +23,8 @@ namespace Base { while(m_blocks[i] != nullptr) { - unsigned *tmp = m_blocks[i]; - m_blocks[i] = (unsigned *)*m_blocks[i]; + uintptr_t *tmp = m_blocks[i]; + m_blocks[i] = (uintptr_t *)*m_blocks[i]; free(tmp); } } @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = nullptr; + uintptr_t *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -79,7 +79,7 @@ namespace Base if(m_blocks[accum] == 0) { // remove the pre allocated block from the linked list - handle = (unsigned *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned)); + handle = (uintptr_t *)calloc(((1 << accum) / 4) + 2, sizeof(uintptr_t)); handle[1] = accum; handle[0] = 0; } @@ -87,20 +87,20 @@ namespace Base { // Allocate a new block handle = m_blocks[accum]; - m_blocks[accum] = (unsigned *)handle[0]; + m_blocks[accum] = (uintptr_t *)handle[0]; handle[0] = 0; } // return a pointer that skips over the header used for the allocator's purposes return(handle + 2); } - void BlockAllocator::returnBlock(unsigned *handle) + void BlockAllocator::returnBlock(uintptr_t *handle) { // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head - *(handle - 2) = (unsigned)m_blocks[*(handle - 1)]; + *(handle - 2) = (uintptr_t)m_blocks[*(handle - 1)]; // Add this entry to the proper linked list node m_blocks[*(handle - 1)] = (handle - 2); } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Types.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Types.h index 69419a0f..a5eb0413 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Types.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Types.h @@ -11,7 +11,8 @@ #ifndef BASE_LINUX_TYPES_H #define BASE_LINUX_TYPES_H -#include +//#include +#include #ifdef EXTERNAL_DISTRO namespace NAMESPACE @@ -34,9 +35,9 @@ typedef signed short int16; typedef unsigned short uint16; typedef int32_t int32; -typedef u_int32_t uint32; +typedef uint32_t uint32; typedef int64_t int64; -typedef u_int64_t uint64; +typedef uint64_t uint64; } #ifdef EXTERNAL_DISTRO }; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h index 0c64cb2c..aa9ba015 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h @@ -28,10 +28,10 @@ typedef unsigned char uint8; typedef short int16; typedef unsigned short uint16; -typedef int int32; -typedef unsigned uint32; -typedef __int64 int64; -typedef unsigned __int64 uint64; +typedef int32_t int32; +typedef uint32_t uint32; +typedef int64_t int64; +typedef uint64_t uint64; }; #ifdef EXTERNAL_DISTRO diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/linux/Types.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/linux/Types.h index 69419a0f..a5eb0413 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/linux/Types.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/linux/Types.h @@ -11,7 +11,8 @@ #ifndef BASE_LINUX_TYPES_H #define BASE_LINUX_TYPES_H -#include +//#include +#include #ifdef EXTERNAL_DISTRO namespace NAMESPACE @@ -34,9 +35,9 @@ typedef signed short int16; typedef unsigned short uint16; typedef int32_t int32; -typedef u_int32_t uint32; +typedef uint32_t uint32; typedef int64_t int64; -typedef u_int64_t uint64; +typedef uint64_t uint64; } #ifdef EXTERNAL_DISTRO }; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h index 0c64cb2c..aa9ba015 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h @@ -28,10 +28,10 @@ typedef unsigned char uint8; typedef short int16; typedef unsigned short uint16; -typedef int int32; -typedef unsigned uint32; -typedef __int64 int64; -typedef unsigned __int64 uint64; +typedef int32_t int32; +typedef uint32_t uint32; +typedef int64_t int64; +typedef uint64_t uint64; }; #ifdef EXTERNAL_DISTRO diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/BlockAllocator.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/BlockAllocator.h index bbfbf273..f9f9f863 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/BlockAllocator.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/BlockAllocator.h @@ -17,7 +17,7 @@ namespace Base BlockAllocator(); ~BlockAllocator(); void *getBlock(unsigned accum); - void returnBlock(unsigned *handle); + void returnBlock(uintptr_t *handle); private: uintptr_t *m_blocks[31]; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp index 29d91074..f4042d1f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp @@ -23,8 +23,8 @@ namespace Base { while(m_blocks[i] != nullptr) { - unsigned *tmp = m_blocks[i]; - m_blocks[i] = (unsigned *)*m_blocks[i]; + uintptr_t *tmp = m_blocks[i]; + m_blocks[i] = (uintptr_t *)*m_blocks[i]; free(tmp); } } @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = nullptr; + uintptr_t *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -79,7 +79,7 @@ namespace Base if(m_blocks[accum] == 0) { // remove the pre allocated block from the linked list - handle = (unsigned *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned)); + handle = (uintptr_t *)calloc(((1 << accum) / 4) + 2, sizeof(uintptr_t)); handle[1] = accum; handle[0] = 0; } @@ -87,20 +87,20 @@ namespace Base { // Allocate a new block handle = m_blocks[accum]; - m_blocks[accum] = (unsigned *)handle[0]; + m_blocks[accum] = (uintptr_t *)handle[0]; handle[0] = 0; } // return a pointer that skips over the header used for the allocator's purposes return(handle + 2); } - void BlockAllocator::returnBlock(unsigned *handle) + void BlockAllocator::returnBlock(uintptr_t *handle) { // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head - *(handle - 2) = (unsigned)m_blocks[*(handle - 1)]; + *(handle - 2) = (uintptr_t)m_blocks[*(handle - 1)]; // Add this entry to the proper linked list node m_blocks[*(handle - 1)] = (handle - 2); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Types.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Types.h index 6ee50450..a685807d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Types.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Types.h @@ -11,7 +11,8 @@ #ifndef BASE_LINUX_TYPES_H #define BASE_LINUX_TYPES_H -#include +//#include +#include #ifdef EXTERNAL_DISTRO namespace NAMESPACE @@ -31,9 +32,9 @@ typedef signed short int16; typedef unsigned short uint16; typedef int32_t int32; -typedef u_int32_t uint32; +typedef uint32_t uint32; typedef int64_t int64; -typedef u_int64_t uint64; +typedef uint64_t uint64; } #ifdef EXTERNAL_DISTRO }; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h index 0c64cb2c..aa9ba015 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h @@ -28,10 +28,10 @@ typedef unsigned char uint8; typedef short int16; typedef unsigned short uint16; -typedef int int32; -typedef unsigned uint32; -typedef __int64 int64; -typedef unsigned __int64 uint64; +typedef int32_t int32; +typedef uint32_t uint32; +typedef int64_t int64; +typedef uint64_t uint64; }; #ifdef EXTERNAL_DISTRO diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h index ba396c51..389d8a49 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h @@ -6,7 +6,8 @@ #define STRINGIFY(S) #S #ifdef linux -#include +//#include +#include #endif #define DECLSPEC @@ -38,17 +39,17 @@ namespace soe typedef unsigned short uint16; #ifdef WIN32 - typedef int int32; - typedef unsigned uint32; - typedef __int64 int64; - typedef unsigned __int64 uint64; + typedef int32_t int32; + typedef uint32_t uint32; + typedef int64_t int64; + typedef uint64_t uint64; #elif linux - typedef int32_t int32; - typedef u_int32_t uint32; - typedef int64_t int64; - typedef u_int64_t uint64; + typedef int32_t int32; + typedef uint32_t uint32; + typedef int64_t int64; + typedef uint64_t uint64; //! the previous seem erroneous // typedef signed int int32; // typedef unsigned int uint32; diff --git a/external/ours/library/archive/src/shared/AutoDeltaPackedMap.h b/external/ours/library/archive/src/shared/AutoDeltaPackedMap.h index e73b56b3..466bbde3 100755 --- a/external/ours/library/archive/src/shared/AutoDeltaPackedMap.h +++ b/external/ours/library/archive/src/shared/AutoDeltaPackedMap.h @@ -204,6 +204,18 @@ namespace Archive internal_unpack(source, buffer, "%i %i:"); } + template<> + inline void AutoDeltaPackedMap::pack(ByteStream & target, const std::string & buffer) + { + internal_pack(target, buffer, "%i %i"); + } + + template<> + inline void AutoDeltaPackedMap::unpack(ReadIterator & source, std::string & buffer) + { + internal_unpack(source, buffer, "%i %i:"); + } + template<> inline void AutoDeltaPackedMap::pack(ByteStream & target, const std::string & buffer) { @@ -217,6 +229,17 @@ namespace Archive } #ifdef WIN32 + template<> + inline void AutoDeltaPackedMap::pack(ByteStream & target, const std::string & buffer) + { + internal_pack(target, buffer, "%lu %I64u"); + } + + template<> + inline void AutoDeltaPackedMap::unpack(ReadIterator & source, std::string & buffer) + { + internal_unpack(source, buffer, "%lu %I64u:"); + } template<> inline void AutoDeltaPackedMap::pack(ByteStream & target, const std::string & buffer) { @@ -231,13 +254,24 @@ namespace Archive #else template<> - inline void AutoDeltaPackedMap::pack(ByteStream & target, const std::string & buffer) + inline void AutoDeltaPackedMap::pack(ByteStream & target, const std::string & buffer) { internal_pack(target, buffer, "%lu %llu"); } template<> - inline void AutoDeltaPackedMap::unpack(ReadIterator & source, std::string & buffer) + inline void AutoDeltaPackedMap::unpack(ReadIterator & source, std::string & buffer) + { + internal_unpack(source, buffer, "%lu %llu:"); + } + template<> + inline void AutoDeltaPackedMap::pack(ByteStream & target, const std::string & buffer) + { + internal_pack(target, buffer, "%lu %llu"); + } + + template<> + inline void AutoDeltaPackedMap::unpack(ReadIterator & source, std::string & buffer) { internal_unpack(source, buffer, "%lu %llu:"); } diff --git a/external/ours/library/crypto/src/shared/original/misc.cpp b/external/ours/library/crypto/src/shared/original/misc.cpp index 5e49edfc..c1a7d078 100755 --- a/external/ours/library/crypto/src/shared/original/misc.cpp +++ b/external/ours/library/crypto/src/shared/original/misc.cpp @@ -10,7 +10,7 @@ byte OAEP_P_DEFAULT[1]; void xorbuf(byte *buf, const byte *mask, unsigned int count) { - if (((unsigned int)buf | (unsigned int)mask | count) % WORD_SIZE == 0) + if (((size_t)buf | (size_t)mask | count) % WORD_SIZE == 0) XorWords((word *)buf, (const word *)mask, count/WORD_SIZE); else { @@ -21,7 +21,7 @@ void xorbuf(byte *buf, const byte *mask, unsigned int count) void xorbuf(byte *output, const byte *input, const byte *mask, unsigned int count) { - if (((unsigned int)output | (unsigned int)input | (unsigned int)mask | count) % WORD_SIZE == 0) + if (((size_t)output | (size_t)input | (size_t)mask | count) % WORD_SIZE == 0) XorWords((word *)output, (const word *)input, (const word *)mask, count/WORD_SIZE); else { diff --git a/external/ours/library/crypto/src/shared/original/misc.h b/external/ours/library/crypto/src/shared/original/misc.h index 8eb15e2e..862970a9 100755 --- a/external/ours/library/crypto/src/shared/original/misc.h +++ b/external/ours/library/crypto/src/shared/original/misc.h @@ -15,39 +15,39 @@ NAMESPACE_BEGIN(CryptoPP) // ************** misc functions *************** -#define GETBYTE(x, y) (unsigned int)(((x)>>(8*(y)))&255) +#define GETBYTE(x, y) (uint32_t)(((x)>>(8*(y)))&255) // this one may be faster on a Pentium // #define GETBYTE(x, y) (((byte *)&(x))[y]) -unsigned int Parity(unsigned long); -unsigned int BytePrecision(unsigned long); -unsigned int BitPrecision(unsigned long); -unsigned long Crop(unsigned long, unsigned int size); +uint32_t Parity(unsigned long); +uint32_t BytePrecision(unsigned long); +uint32_t BitPrecision(unsigned long); +unsigned long Crop(unsigned long, uint32_t size); -inline unsigned int bitsToBytes(unsigned int bitCount) +inline uint32_t bitsToBytes(uint32_t bitCount) { return ((bitCount+7)/(8)); } -inline unsigned int bytesToWords(unsigned int byteCount) +inline uint32_t bytesToWords(uint32_t byteCount) { return ((byteCount+WORD_SIZE-1)/WORD_SIZE); } -inline unsigned int bitsToWords(unsigned int bitCount) +inline uint32_t bitsToWords(uint32_t bitCount) { return ((bitCount+WORD_BITS-1)/(WORD_BITS)); } -void xorbuf(byte *buf, const byte *mask, unsigned int count); -void xorbuf(byte *output, const byte *input, const byte *mask, unsigned int count); +void xorbuf(byte *buf, const byte *mask, uint32_t count); +void xorbuf(byte *output, const byte *input, const byte *mask, uint32_t count); -inline unsigned int RoundDownToMultipleOf(unsigned int n, unsigned int m) +inline uint32_t RoundDownToMultipleOf(uint32_t n, uint32_t m) { return n - n%m; } -inline unsigned int RoundUpToMultipleOf(unsigned int n, unsigned int m) +inline uint32_t RoundUpToMultipleOf(uint32_t n, uint32_t m) { return RoundDownToMultipleOf(n+m-1, m); } @@ -91,37 +91,37 @@ std::string IntToString(T a) // ************** rotate functions *************** -template inline T rotlFixed(T x, unsigned int y) +template inline T rotlFixed(T x, uint32_t y) { assert(y < sizeof(T)*8); return (x<>(sizeof(T)*8-y)); } -template inline T rotrFixed(T x, unsigned int y) +template inline T rotrFixed(T x, uint32_t y) { assert(y < sizeof(T)*8); return (x>>y) | (x<<(sizeof(T)*8-y)); } -template inline T rotlVariable(T x, unsigned int y) +template inline T rotlVariable(T x, uint32_t y) { assert(y < sizeof(T)*8); return (x<>(sizeof(T)*8-y)); } -template inline T rotrVariable(T x, unsigned int y) +template inline T rotrVariable(T x, uint32_t y) { assert(y < sizeof(T)*8); return (x>>y) | (x<<(sizeof(T)*8-y)); } -template inline T rotlMod(T x, unsigned int y) +template inline T rotlMod(T x, uint32_t y) { y %= sizeof(T)*8; return (x<>(sizeof(T)*8-y)); } -template inline T rotrMod(T x, unsigned int y) +template inline T rotrMod(T x, uint32_t y) { y %= sizeof(T)*8; return (x>>y) | (x<<(sizeof(T)*8-y)); @@ -129,36 +129,36 @@ template inline T rotrMod(T x, unsigned int y) #ifdef INTEL_INTRINSICS -template<> inline word32 rotlFixed(word32 x, unsigned int y) +template<> inline word32 rotlFixed(word32 x, uint32_t y) { assert(y < 32); return y ? _lrotl(x, y) : x; } -template<> inline word32 rotrFixed(word32 x, unsigned int y) +template<> inline word32 rotrFixed(word32 x, uint32_t y) { assert(y < 32); return y ? _lrotr(x, y) : x; } -template<> inline word32 rotlVariable(word32 x, unsigned int y) +template<> inline word32 rotlVariable(word32 x, uint32_t y) { assert(y < 32); return _lrotl(x, y); } -template<> inline word32 rotrVariable(word32 x, unsigned int y) +template<> inline word32 rotrVariable(word32 x, uint32_t y) { assert(y < 32); return _lrotr(x, y); } -template<> inline word32 rotlMod(word32 x, unsigned int y) +template<> inline word32 rotlMod(word32 x, uint32_t y) { return _lrotl(x, y); } -template<> inline word32 rotrMod(word32 x, unsigned int y) +template<> inline word32 rotrMod(word32 x, uint32_t y) { return _lrotr(x, y); } @@ -167,36 +167,36 @@ template<> inline word32 rotrMod(word32 x, unsigned int y) #ifdef PPC_INTRINSICS -template<> inline word32 rotlFixed(word32 x, unsigned int y) +template<> inline word32 rotlFixed(word32 x, uint32_t y) { assert(y < 32); return y ? __rlwinm(x,y,0,31) : x; } -template<> inline word32 rotrFixed(word32 x, unsigned int y) +template<> inline word32 rotrFixed(word32 x, uint32_t y) { assert(y < 32); return y ? __rlwinm(x,32-y,0,31) : x; } -template<> inline word32 rotlVariable(word32 x, unsigned int y) +template<> inline word32 rotlVariable(word32 x, uint32_t y) { assert(y < 32); return (__rlwnm(x,y,0,31)); } -template<> inline word32 rotrVariable(word32 x, unsigned int y) +template<> inline word32 rotrVariable(word32 x, uint32_t y) { assert(y < 32); return (__rlwnm(x,32-y,0,31)); } -template<> inline word32 rotlMod(word32 x, unsigned int y) +template<> inline word32 rotlMod(word32 x, uint32_t y) { return (__rlwnm(x,y,0,31)); } -template<> inline word32 rotrMod(word32 x, unsigned int y) +template<> inline word32 rotrMod(word32 x, uint32_t y) { return (__rlwnm(x,32-y,0,31)); } @@ -297,17 +297,17 @@ inline T bitReverse(T value) } template -void byteReverse(T *out, const T *in, unsigned int byteCount) +void byteReverse(T *out, const T *in, uint32_t byteCount) { - unsigned int count = (byteCount+sizeof(T)-1)/sizeof(T); - for (unsigned int i=0; i -inline void GetUserKeyLittleEndian(T *out, unsigned int outlen, const byte *in, unsigned int inlen) +inline void GetUserKeyLittleEndian(T *out, uint32_t outlen, const byte *in, uint32_t inlen) { - const unsigned int U = sizeof(T); + const uint32_t U = sizeof(T); assert(inlen <= outlen*U); memcpy(out, in, inlen); memset((byte *)out+inlen, 0, outlen*U-inlen); @@ -317,9 +317,9 @@ inline void GetUserKeyLittleEndian(T *out, unsigned int outlen, const byte *in, } template -inline void GetUserKeyBigEndian(T *out, unsigned int outlen, const byte *in, unsigned int inlen) +inline void GetUserKeyBigEndian(T *out, uint32_t outlen, const byte *in, uint32_t inlen) { - const unsigned int U = sizeof(T); + const uint32_t U = sizeof(T); assert(inlen <= outlen*U); memcpy(out, in, inlen); memset((byte *)out+inlen, 0, outlen*U-inlen); @@ -468,23 +468,23 @@ T StringToWord(const std::string &str, bool highFirst = true) // ************** key length query *************** /// support query of fixed key length -template +template class FixedKeyLength { public: enum {KEYLENGTH=N, MIN_KEYLENGTH=N, MAX_KEYLENGTH=N, DEFAULT_KEYLENGTH=N}; /// returns the key length - static unsigned int KeyLength(unsigned int) {return KEYLENGTH;} + static uint32_t KeyLength(uint32_t) {return KEYLENGTH;} }; /// support query of variable key length, template parameters are default, min, max, multiple (default multiple 1) -template +template class VariableKeyLength { public: enum {MIN_KEYLENGTH=N, MAX_KEYLENGTH=M, DEFAULT_KEYLENGTH=D, KEYLENGTH_MULTIPLE=Q}; /// returns the smallest valid key length in bytes that is >= min(n, MAX_KEYLENGTH) - static unsigned int KeyLength(unsigned int n) + static uint32_t KeyLength(uint32_t n) { assert(KEYLENGTH_MULTIPLE > 0 && MIN_KEYLENGTH % KEYLENGTH_MULTIPLE == 0 && MAX_KEYLENGTH % KEYLENGTH_MULTIPLE == 0); if (n < MIN_KEYLENGTH) @@ -503,7 +503,7 @@ class SameKeyLengthAs public: enum {MIN_KEYLENGTH=T::MIN_KEYLENGTH, MAX_KEYLENGTH=T::MAX_KEYLENGTH, DEFAULT_KEYLENGTH=T::DEFAULT_KEYLENGTH}; /// returns the smallest valid key length in bytes that is >= min(n, MAX_KEYLENGTH) - static unsigned int KeyLength(unsigned int keylength) + static uint32_t KeyLength(uint32_t keylength) {return T::KeyLength(keylength);} }; @@ -520,11 +520,11 @@ public: //! a block of memory allocated using SecAlloc template struct SecBlock { - explicit SecBlock(unsigned int size=0) + explicit SecBlock(uint32_t size=0) : size(size) {ptr = SecAlloc(T, size);} SecBlock(const SecBlock &t) : size(t.size) {ptr = SecAlloc(T, size); memcpy(ptr, t.ptr, size*sizeof(T));} - SecBlock(const T *t, unsigned int len) + SecBlock(const T *t, uint32_t len) : size(len) {ptr = SecAlloc(T, len); memcpy(ptr, t, len*sizeof(T));} ~SecBlock() {SecFree(ptr, size);} @@ -551,13 +551,13 @@ template struct SecBlock // CodeWarrior defines _MSC_VER #if !defined(_MSC_VER) || defined(__MWERKS__) - T *operator +(unsigned int offset) + T *operator +(uint32_t offset) {return ptr+offset;} - const T *operator +(unsigned int offset) const + const T *operator +(uint32_t offset) const {return ptr+offset;} - T& operator[](unsigned int index) + T& operator[](uint32_t index) {assert(index struct SecBlock T* End() {return ptr+size;} - unsigned int Size() const {return size;} + uint32_t Size() const {return size;} - void Assign(const T *t, unsigned int len) + void Assign(const T *t, uint32_t len) { New(len); memcpy(ptr, t, len*sizeof(T)); @@ -600,7 +600,7 @@ template struct SecBlock return !operator==(t); } - void New(unsigned int newSize) + void New(uint32_t newSize) { if (newSize != size) { @@ -611,7 +611,7 @@ template struct SecBlock } } - void CleanNew(unsigned int newSize) + void CleanNew(uint32_t newSize) { if (newSize != size) { @@ -623,7 +623,7 @@ template struct SecBlock memset(ptr, 0, size*sizeof(T)); } - void Grow(unsigned int newSize) + void Grow(uint32_t newSize) { if (newSize > size) { @@ -635,7 +635,7 @@ template struct SecBlock } } - void CleanGrow(unsigned int newSize) + void CleanGrow(uint32_t newSize) { if (newSize > size) { @@ -648,7 +648,7 @@ template struct SecBlock } } - void Resize(unsigned int newSize) + void Resize(uint32_t newSize) { if (newSize != size) { @@ -662,7 +662,7 @@ template struct SecBlock void swap(SecBlock &b); - unsigned int size; + uint32_t size; T *ptr; };