type squishes in Agent class

This commit is contained in:
Stephen Birarda 2013-05-15 14:20:15 -07:00
parent 12b4b485f0
commit 80284470ed
2 changed files with 6 additions and 6 deletions

View file

@ -22,17 +22,17 @@
using shared_lib::printLog; using shared_lib::printLog;
int unpackAgentId(unsigned char *packedData, uint16_t *agentId) { int unpackAgentId(unsigned char* packedData, uint16_t* agentId) {
memcpy(agentId, packedData, sizeof(uint16_t)); memcpy(agentId, packedData, sizeof(uint16_t));
return sizeof(uint16_t); return sizeof(uint16_t);
} }
int packAgentId(unsigned char *packStore, uint16_t agentId) { int packAgentId(unsigned char* packStore, uint16_t agentId) {
memcpy(packStore, &agentId, sizeof(uint16_t)); memcpy(packStore, &agentId, sizeof(uint16_t));
return sizeof(uint16_t); return sizeof(uint16_t);
} }
Agent::Agent(sockaddr *publicSocket, sockaddr *localSocket, char type, uint16_t agentID) : Agent::Agent(sockaddr* publicSocket, sockaddr* localSocket, char type, uint16_t agentID) :
_type(type), _type(type),
_agentID(agentID), _agentID(agentID),
_wakeMicrostamp(usecTimestampNow()), _wakeMicrostamp(usecTimestampNow()),
@ -61,7 +61,7 @@ Agent::Agent(const Agent &otherAgent) :
_wakeMicrostamp(otherAgent._wakeMicrostamp), _wakeMicrostamp(otherAgent._wakeMicrostamp),
_lastHeardMicrostamp(otherAgent._lastHeardMicrostamp), _lastHeardMicrostamp(otherAgent._lastHeardMicrostamp),
_isAlive(otherAgent._isAlive) _isAlive(otherAgent._isAlive)
{ {
if (otherAgent._publicSocket) { if (otherAgent._publicSocket) {
_publicSocket = new sockaddr(*otherAgent._localSocket); _publicSocket = new sockaddr(*otherAgent._localSocket);
} else { } else {

View file

@ -23,13 +23,13 @@
class Agent { class Agent {
public: public:
Agent(sockaddr *publicSocket, sockaddr *localSocket, char type, uint16_t agentID); Agent(sockaddr* publicSocket, sockaddr* localSocket, char type, uint16_t agentID);
Agent(const Agent &otherAgent); Agent(const Agent &otherAgent);
~Agent(); ~Agent();
Agent& operator=(Agent otherAgent); Agent& operator=(Agent otherAgent);
bool operator==(const Agent& otherAgent); bool operator==(const Agent& otherAgent);
bool matches(sockaddr *otherPublicSocket, sockaddr *otherLocalSocket, char otherAgentType); bool matches(sockaddr* otherPublicSocket, sockaddr* otherLocalSocket, char otherAgentType);
char getType() const { return _type; } char getType() const { return _type; }
void setType(char type) { _type = type; } void setType(char type) { _type = type; }