mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-13 21:01:08 -04:00
Compiling 100% with Types change approach - still does not build.
This commit is contained in:
+1
-1
@@ -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")
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
+5
-5
@@ -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;
|
||||
|
||||
+3
-3
@@ -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<unsigned, ServerTrackObject *>(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;
|
||||
|
||||
+4
-3
@@ -11,7 +11,8 @@
|
||||
#ifndef BASE_LINUX_TYPES_H
|
||||
#define BASE_LINUX_TYPES_H
|
||||
|
||||
#include <sys/bitypes.h>
|
||||
//#include <sys/bitypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#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
|
||||
};
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
+4
-4
@@ -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)
|
||||
{
|
||||
|
||||
+10
-10
@@ -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;
|
||||
|
||||
+2
-2
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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<std::string, ChatServerRoomOwner>::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));
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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<int64>(static_cast<double>(bonus) * static_cast<double>(adjustment) / static_cast<double>(100)));
|
||||
adjustment += static_cast<int64>(std::max(static_cast<double>(1), static_cast<double>(bonus) * static_cast<double>(adjustment) / 100));
|
||||
}
|
||||
|
||||
LOG("CustomerService", ("GcwScore: imperial %s %d (from %s - %s)", gcwCategory.c_str(), static_cast<int>(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<int64>(static_cast<double>(bonus) * static_cast<double>(adjustment) / static_cast<double>(100)));
|
||||
adjustment += static_cast<int64>(std::max(static_cast<double>(1), static_cast<double>(bonus) * static_cast<double>(adjustment) / 100));
|
||||
}
|
||||
|
||||
LOG("CustomerService", ("GcwScore: rebel %s %d (from %s - %s)", gcwCategory.c_str(), static_cast<int>(adjustment), source.c_str(), sourceObject->getNetworkId().getValueString().c_str()));
|
||||
|
||||
@@ -6115,7 +6115,7 @@ void PlayerObject::getByteStreamFromAutoVariable(const std::string & name, Archi
|
||||
{
|
||||
if(name == "quests")
|
||||
{
|
||||
Archive::AutoDeltaMap<unsigned long, PlayerQuestData>(m_quests).pack(target);
|
||||
Archive::AutoDeltaMap<unsigned int, PlayerQuestData>(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<unsigned long, PlayerQuestData>::Command Commands;
|
||||
typedef Archive::AutoDeltaMap<unsigned int, PlayerQuestData>::Command Commands;
|
||||
std::vector<Commands> quests;
|
||||
|
||||
m_quests.clear();
|
||||
Archive::AutoDeltaMap<unsigned long, PlayerQuestData>(m_quests).unpack(ri, quests);
|
||||
Archive::AutoDeltaMap<unsigned int, PlayerQuestData>(m_quests).unpack(ri, quests);
|
||||
|
||||
for (std::vector<Commands>::const_iterator questIter = quests.begin(); questIter != quests.end(); ++questIter)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ ResourcePoolObject::~ResourcePoolObject()
|
||||
*/
|
||||
float ResourcePoolObject::harvest(float installedEfficiency, uint32 lastHarvestTime) const
|
||||
{
|
||||
int elapsedTime=static_cast<int>(std::min(ServerClock::getInstance().getGameTimeSeconds(),m_depletedTimestamp) - lastHarvestTime);
|
||||
int elapsedTime=static_cast<int>(std::min(ServerClock::getInstance().getGameTimeSeconds(),static_cast<unsigned long>(m_depletedTimestamp)) - lastHarvestTime);
|
||||
if (elapsedTime < 0)
|
||||
return 0;
|
||||
float elapsedTicks =static_cast<float>(elapsedTime) / static_cast<float>(ConfigServerGame::getSecondsPerResourceTick());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -843,14 +843,14 @@ int Pvp::calculateGcwImperialScorePercentile(std::string const & gcwCategory, st
|
||||
{
|
||||
std::map<std::string, std::pair<int64, int64> >::const_iterator const iterImperial = gcwImperialScore.find(gcwCategory);
|
||||
if (iterImperial != gcwImperialScore.end())
|
||||
totalImperial = static_cast<uint64>(std::max(0ll, iterImperial->second.first)) + static_cast<uint64>(std::max(0ll, iterImperial->second.second));
|
||||
totalImperial = static_cast<uint64>(std::max(0l, iterImperial->second.first)) + static_cast<uint64>(std::max(0l, iterImperial->second.second));
|
||||
}
|
||||
|
||||
uint64 total = totalImperial;
|
||||
{
|
||||
std::map<std::string, std::pair<int64, int64> >::const_iterator const iterRebel = gcwRebelScore.find(gcwCategory);
|
||||
if (iterRebel != gcwRebelScore.end())
|
||||
total += (static_cast<uint64>(std::max(0ll, iterRebel->second.first)) + static_cast<uint64>(std::max(0ll, iterRebel->second.second)));
|
||||
total += (static_cast<uint64>(std::max(0l, iterRebel->second.first)) + static_cast<uint64>(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
|
||||
|
||||
@@ -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<int>(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<int64_t>(neighbor);
|
||||
//
|
||||
// int mungedInt = neighborInt * 1295183;
|
||||
//
|
||||
// code ^= mungedInt;
|
||||
// }
|
||||
//
|
||||
// return code;
|
||||
//}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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<uint32>(crashAddress1), lib1, file1, BUFLEN, line1);
|
||||
bool result1 = DebugHelp::lookupAddress(reinterpret_cast<uint64>(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<uint32>(frameAddress) >> 16);
|
||||
uint64 frameAddressHigh = (reinterpret_cast<uint64>(frameAddress) >> 16);
|
||||
crashAddress2a = __builtin_return_address(0);
|
||||
if (crashAddress2a != nullptr)
|
||||
{
|
||||
frameAddressA = __builtin_frame_address(1);
|
||||
if (frameAddressA != nullptr &&
|
||||
(reinterpret_cast<uint32>(frameAddressA) >> 16 == frameAddressHigh))
|
||||
(reinterpret_cast<uint64>(frameAddressA) >> 16 == frameAddressHigh))
|
||||
{
|
||||
crashAddress2b = __builtin_return_address(1);
|
||||
if (crashAddress2b != nullptr)
|
||||
{
|
||||
frameAddressB = __builtin_frame_address(2);
|
||||
if (frameAddressB != nullptr &&
|
||||
(reinterpret_cast<uint32>(frameAddressB) >> 16 == frameAddressHigh))
|
||||
(reinterpret_cast<uint64>(frameAddressB) >> 16 == frameAddressHigh))
|
||||
{
|
||||
crashAddress2c = __builtin_return_address(2);
|
||||
if (crashAddress2c != nullptr)
|
||||
{
|
||||
result2 = DebugHelp::lookupAddress(reinterpret_cast<uint32>(
|
||||
result2 = DebugHelp::lookupAddress(reinterpret_cast<uint64>(
|
||||
crashAddress2c), lib2, file2, BUFLEN, line2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<uint32>(getValue());
|
||||
}
|
||||
//inline void DB::BindableLong::getValue(uint32 &buffer) const
|
||||
//{
|
||||
// buffer=static_cast<uint32>(getValue());
|
||||
//}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -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<OCISession*>(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<OCISession*>(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<OCISession*>(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<OCISession*>(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;
|
||||
//}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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<unsigned int>(info.dli_fbase))
|
||||
addrOffset = reinterpret_cast<unsigned int>(info.dli_fbase);
|
||||
u_int64_t addrOffset = 0;
|
||||
if (progAddr < reinterpret_cast<u_int64_t>(info.dli_fbase))
|
||||
addrOffset = reinterpret_cast<u_int64_t>(info.dli_fbase);
|
||||
const void *testAddr = reinterpret_cast<const void *>(progAddr+addrOffset);
|
||||
if (testAddr >= addr)
|
||||
{
|
||||
@@ -509,12 +517,12 @@ static bool stabSearch(Stab const *stab, unsigned int stabSize, char const *stab
|
||||
if (reinterpret_cast<void const *>(stab->n_value) > info.dli_fbase)
|
||||
funcBase = reinterpret_cast<void const *>(stab->n_value);
|
||||
else
|
||||
funcBase = reinterpret_cast<void const *>(reinterpret_cast<unsigned int>(info.dli_fbase)+stab->n_value);
|
||||
funcBase = reinterpret_cast<void const *>(reinterpret_cast<u_int64_t>(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<unsigned int>(addr)-reinterpret_cast<unsigned int>(funcBase))
|
||||
if (stab->n_value < reinterpret_cast<u_int64_t>(addr)-reinterpret_cast<u_int64_t>(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<void const *>(address), libName, fileName, line, fileNameLength);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
// ======================================================================
|
||||
|
||||
typedef unsigned long uint32;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
// ======================================================================
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <pthread.h>
|
||||
|
||||
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;
|
||||
|
||||
@@ -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<bufferSize>::FormattedString()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <int bufferSize>
|
||||
inline char const * FormattedString<bufferSize>::sprintf(char const * const format, ...)
|
||||
inline char const * FormattedString<bufferSize>::sprintf(const char * format, ...)
|
||||
{
|
||||
char const * result = nullptr;
|
||||
va_list va;
|
||||
@@ -56,7 +56,7 @@ inline char const * FormattedString<bufferSize>::sprintf(char const * const form
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
template <int bufferSize>
|
||||
inline char const * FormattedString<bufferSize>::vsprintf(char const * const format, va_list const & va)
|
||||
inline char const * FormattedString<bufferSize>::vsprintf(const char * format, va_list va)
|
||||
{
|
||||
// Format the string
|
||||
|
||||
|
||||
@@ -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<uint>(length));
|
||||
return memmove(destination, source, static_cast<size_t>(length));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -10,18 +10,19 @@
|
||||
#define PLATFORM_LINUX
|
||||
|
||||
#include <cstdio>
|
||||
#include <stdint.h>
|
||||
// ======================================================================
|
||||
// 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;
|
||||
|
||||
|
||||
@@ -15,17 +15,18 @@
|
||||
|
||||
#define PLATFORM_WIN32
|
||||
|
||||
#include <stdint.h>
|
||||
// ======================================================================
|
||||
// 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;
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -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<unsigned int const>(object)));
|
||||
WARNING(true, ("validateObject(): Object-derived class with address [%x] failed to return valid C++ type info; likely a deleted Object.", reinterpret_cast<unsigned uint64_t const>(object)));
|
||||
isInvalid = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+4
-3
@@ -11,7 +11,8 @@
|
||||
#ifndef BASE_LINUX_TYPES_H
|
||||
#define BASE_LINUX_TYPES_H
|
||||
|
||||
#include <sys/bitypes.h>
|
||||
//#include <sys/bitypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#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
|
||||
};
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
+7
-7
@@ -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);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
#ifndef BASE_LINUX_TYPES_H
|
||||
#define BASE_LINUX_TYPES_H
|
||||
|
||||
#include <sys/bitypes.h>
|
||||
//#include <sys/bitypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#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
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
#ifndef BASE_LINUX_TYPES_H
|
||||
#define BASE_LINUX_TYPES_H
|
||||
|
||||
#include <sys/bitypes.h>
|
||||
//#include <sys/bitypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#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
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
+7
-7
@@ -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);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
#ifndef BASE_LINUX_TYPES_H
|
||||
#define BASE_LINUX_TYPES_H
|
||||
|
||||
#include <sys/bitypes.h>
|
||||
//#include <sys/bitypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#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
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
#define STRINGIFY(S) #S
|
||||
|
||||
#ifdef linux
|
||||
#include <sys/bitypes.h>
|
||||
//#include <sys/bitypes.h>
|
||||
#include <stdint.h>
|
||||
#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;
|
||||
|
||||
@@ -204,6 +204,18 @@ namespace Archive
|
||||
internal_unpack(source, buffer, "%i %i:");
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void AutoDeltaPackedMap<int, uint32_t>::pack(ByteStream & target, const std::string & buffer)
|
||||
{
|
||||
internal_pack(target, buffer, "%i %i");
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void AutoDeltaPackedMap<int, uint32_t>::unpack(ReadIterator & source, std::string & buffer)
|
||||
{
|
||||
internal_unpack(source, buffer, "%i %i:");
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void AutoDeltaPackedMap<int, unsigned long>::pack(ByteStream & target, const std::string & buffer)
|
||||
{
|
||||
@@ -217,6 +229,17 @@ namespace Archive
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
template<>
|
||||
inline void AutoDeltaPackedMap<unsigned long, unsigned __int32>::pack(ByteStream & target, const std::string & buffer)
|
||||
{
|
||||
internal_pack(target, buffer, "%lu %I64u");
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void AutoDeltaPackedMap<unsigned long, unsigned __int32>::unpack(ReadIterator & source, std::string & buffer)
|
||||
{
|
||||
internal_unpack(source, buffer, "%lu %I64u:");
|
||||
}
|
||||
template<>
|
||||
inline void AutoDeltaPackedMap<unsigned long, unsigned __int64>::pack(ByteStream & target, const std::string & buffer)
|
||||
{
|
||||
@@ -231,13 +254,24 @@ namespace Archive
|
||||
|
||||
#else
|
||||
template<>
|
||||
inline void AutoDeltaPackedMap<unsigned long, unsigned long long int>::pack(ByteStream & target, const std::string & buffer)
|
||||
inline void AutoDeltaPackedMap<unsigned long, uint32_t>::pack(ByteStream & target, const std::string & buffer)
|
||||
{
|
||||
internal_pack(target, buffer, "%lu %llu");
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void AutoDeltaPackedMap<unsigned long, unsigned long long int>::unpack(ReadIterator & source, std::string & buffer)
|
||||
inline void AutoDeltaPackedMap<unsigned long, uint32_t>::unpack(ReadIterator & source, std::string & buffer)
|
||||
{
|
||||
internal_unpack(source, buffer, "%lu %llu:");
|
||||
}
|
||||
template<>
|
||||
inline void AutoDeltaPackedMap<unsigned long, uint64_t>::pack(ByteStream & target, const std::string & buffer)
|
||||
{
|
||||
internal_pack(target, buffer, "%lu %llu");
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void AutoDeltaPackedMap<unsigned long, uint64_t>::unpack(ReadIterator & source, std::string & buffer)
|
||||
{
|
||||
internal_unpack(source, buffer, "%lu %llu:");
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
+56
-56
@@ -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 <class T> inline T rotlFixed(T x, unsigned int y)
|
||||
template <class T> inline T rotlFixed(T x, uint32_t y)
|
||||
{
|
||||
assert(y < sizeof(T)*8);
|
||||
return (x<<y) | (x>>(sizeof(T)*8-y));
|
||||
}
|
||||
|
||||
template <class T> inline T rotrFixed(T x, unsigned int y)
|
||||
template <class T> inline T rotrFixed(T x, uint32_t y)
|
||||
{
|
||||
assert(y < sizeof(T)*8);
|
||||
return (x>>y) | (x<<(sizeof(T)*8-y));
|
||||
}
|
||||
|
||||
template <class T> inline T rotlVariable(T x, unsigned int y)
|
||||
template <class T> inline T rotlVariable(T x, uint32_t y)
|
||||
{
|
||||
assert(y < sizeof(T)*8);
|
||||
return (x<<y) | (x>>(sizeof(T)*8-y));
|
||||
}
|
||||
|
||||
template <class T> inline T rotrVariable(T x, unsigned int y)
|
||||
template <class T> inline T rotrVariable(T x, uint32_t y)
|
||||
{
|
||||
assert(y < sizeof(T)*8);
|
||||
return (x>>y) | (x<<(sizeof(T)*8-y));
|
||||
}
|
||||
|
||||
template <class T> inline T rotlMod(T x, unsigned int y)
|
||||
template <class T> inline T rotlMod(T x, uint32_t y)
|
||||
{
|
||||
y %= sizeof(T)*8;
|
||||
return (x<<y) | (x>>(sizeof(T)*8-y));
|
||||
}
|
||||
|
||||
template <class T> inline T rotrMod(T x, unsigned int y)
|
||||
template <class T> 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 <class T> inline T rotrMod(T x, unsigned int y)
|
||||
|
||||
#ifdef INTEL_INTRINSICS
|
||||
|
||||
template<> inline word32 rotlFixed<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotlFixed<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
assert(y < 32);
|
||||
return y ? _lrotl(x, y) : x;
|
||||
}
|
||||
|
||||
template<> inline word32 rotrFixed<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotrFixed<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
assert(y < 32);
|
||||
return y ? _lrotr(x, y) : x;
|
||||
}
|
||||
|
||||
template<> inline word32 rotlVariable<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotlVariable<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
assert(y < 32);
|
||||
return _lrotl(x, y);
|
||||
}
|
||||
|
||||
template<> inline word32 rotrVariable<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotrVariable<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
assert(y < 32);
|
||||
return _lrotr(x, y);
|
||||
}
|
||||
|
||||
template<> inline word32 rotlMod<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotlMod<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
return _lrotl(x, y);
|
||||
}
|
||||
|
||||
template<> inline word32 rotrMod<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotrMod<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
return _lrotr(x, y);
|
||||
}
|
||||
@@ -167,36 +167,36 @@ template<> inline word32 rotrMod<word32>(word32 x, unsigned int y)
|
||||
|
||||
#ifdef PPC_INTRINSICS
|
||||
|
||||
template<> inline word32 rotlFixed<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotlFixed<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
assert(y < 32);
|
||||
return y ? __rlwinm(x,y,0,31) : x;
|
||||
}
|
||||
|
||||
template<> inline word32 rotrFixed<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotrFixed<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
assert(y < 32);
|
||||
return y ? __rlwinm(x,32-y,0,31) : x;
|
||||
}
|
||||
|
||||
template<> inline word32 rotlVariable<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotlVariable<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
assert(y < 32);
|
||||
return (__rlwnm(x,y,0,31));
|
||||
}
|
||||
|
||||
template<> inline word32 rotrVariable<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotrVariable<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
assert(y < 32);
|
||||
return (__rlwnm(x,32-y,0,31));
|
||||
}
|
||||
|
||||
template<> inline word32 rotlMod<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotlMod<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
return (__rlwnm(x,y,0,31));
|
||||
}
|
||||
|
||||
template<> inline word32 rotrMod<word32>(word32 x, unsigned int y)
|
||||
template<> inline word32 rotrMod<word32>(word32 x, uint32_t y)
|
||||
{
|
||||
return (__rlwnm(x,32-y,0,31));
|
||||
}
|
||||
@@ -297,17 +297,17 @@ inline T bitReverse(T value)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
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<count; i++)
|
||||
uint32_t count = (byteCount+sizeof(T)-1)/sizeof(T);
|
||||
for (uint32_t i=0; i<count; i++)
|
||||
out[i] = byteReverse(in[i]);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
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 <class T>
|
||||
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 <unsigned int N>
|
||||
template <uint32_t N>
|
||||
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 <unsigned int D, unsigned int N, unsigned int M, unsigned int Q=1>
|
||||
template <uint32_t D, uint32_t N, uint32_t M, uint32_t Q=1>
|
||||
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 <class T> struct SecBlock
|
||||
{
|
||||
explicit SecBlock(unsigned int size=0)
|
||||
explicit SecBlock(uint32_t size=0)
|
||||
: size(size) {ptr = SecAlloc(T, size);}
|
||||
SecBlock(const SecBlock<T> &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 <class T> 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<size); return ptr[index];}
|
||||
const T& operator[](unsigned int index) const
|
||||
const T& operator[](uint32_t index) const
|
||||
{assert(index<size); return ptr[index];}
|
||||
#endif
|
||||
|
||||
@@ -570,9 +570,9 @@ template <class T> 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 <class T> struct SecBlock
|
||||
return !operator==(t);
|
||||
}
|
||||
|
||||
void New(unsigned int newSize)
|
||||
void New(uint32_t newSize)
|
||||
{
|
||||
if (newSize != size)
|
||||
{
|
||||
@@ -611,7 +611,7 @@ template <class T> struct SecBlock
|
||||
}
|
||||
}
|
||||
|
||||
void CleanNew(unsigned int newSize)
|
||||
void CleanNew(uint32_t newSize)
|
||||
{
|
||||
if (newSize != size)
|
||||
{
|
||||
@@ -623,7 +623,7 @@ template <class T> 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 <class T> struct SecBlock
|
||||
}
|
||||
}
|
||||
|
||||
void CleanGrow(unsigned int newSize)
|
||||
void CleanGrow(uint32_t newSize)
|
||||
{
|
||||
if (newSize > size)
|
||||
{
|
||||
@@ -648,7 +648,7 @@ template <class T> struct SecBlock
|
||||
}
|
||||
}
|
||||
|
||||
void Resize(unsigned int newSize)
|
||||
void Resize(uint32_t newSize)
|
||||
{
|
||||
if (newSize != size)
|
||||
{
|
||||
@@ -662,7 +662,7 @@ template <class T> struct SecBlock
|
||||
|
||||
void swap(SecBlock<T> &b);
|
||||
|
||||
unsigned int size;
|
||||
uint32_t size;
|
||||
T *ptr;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user