foreach spacing and reference repairs

This commit is contained in:
Stephen Birarda 2014-01-14 15:54:09 -08:00
parent fa01383f3f
commit 8676ac38f9
13 changed files with 37 additions and 37 deletions

View file

@ -188,7 +188,7 @@ void AudioMixer::prepareMixForListeningNode(Node* node) {
memset(_clientSamples, 0, sizeof(_clientSamples)); memset(_clientSamples, 0, sizeof(_clientSamples));
// loop through all other nodes that have sufficient audio to mix // loop through all other nodes that have sufficient audio to mix
foreach(SharedNodePointer otherNode, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& otherNode, NodeList::getInstance()->getNodeHash()) {
if (otherNode->getLinkedData()) { if (otherNode->getLinkedData()) {
AudioMixerClientData* otherNodeClientData = (AudioMixerClientData*) otherNode->getLinkedData(); AudioMixerClientData* otherNodeClientData = (AudioMixerClientData*) otherNode->getLinkedData();
@ -263,13 +263,13 @@ void AudioMixer::run() {
break; break;
} }
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getLinkedData()) { if (node->getLinkedData()) {
((AudioMixerClientData*) node->getLinkedData())->checkBuffersBeforeFrameSend(JITTER_BUFFER_SAMPLES); ((AudioMixerClientData*) node->getLinkedData())->checkBuffersBeforeFrameSend(JITTER_BUFFER_SAMPLES);
} }
} }
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getType() == NODE_TYPE_AGENT && node->getActiveSocket() && node->getLinkedData() if (node->getType() == NODE_TYPE_AGENT && node->getActiveSocket() && node->getLinkedData()
&& ((AudioMixerClientData*) node->getLinkedData())->getAvatarAudioRingBuffer()) { && ((AudioMixerClientData*) node->getLinkedData())->getAvatarAudioRingBuffer()) {
prepareMixForListeningNode(node.data()); prepareMixForListeningNode(node.data());
@ -282,7 +282,7 @@ void AudioMixer::run() {
} }
// push forward the next output pointers for any audio buffers we used // push forward the next output pointers for any audio buffers we used
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getLinkedData()) { if (node->getLinkedData()) {
((AudioMixerClientData*) node->getLinkedData())->pushBuffersAfterFrameSend(); ((AudioMixerClientData*) node->getLinkedData())->pushBuffersAfterFrameSend();
} }

View file

@ -67,7 +67,7 @@ void broadcastAvatarData() {
NodeList* nodeList = NodeList::getInstance(); NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT && node->getActiveSocket()) { if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT && node->getActiveSocket()) {
// reset packet pointers for this node // reset packet pointers for this node
@ -76,7 +76,7 @@ void broadcastAvatarData() {
// this is an AGENT we have received head data from // this is an AGENT we have received head data from
// send back a packet with other active node data to this node // send back a packet with other active node data to this node
foreach(SharedNodePointer otherNode, nodeList->getNodeHash()) { foreach (const SharedNodePointer& otherNode, nodeList->getNodeHash()) {
if (otherNode->getLinkedData() && otherNode->getUUID() != node->getUUID()) { if (otherNode->getLinkedData() && otherNode->getUUID() != node->getUUID()) {
unsigned char* avatarDataEndpoint = addNodeToBroadcastPacket((unsigned char*)&avatarDataBuffer[0], unsigned char* avatarDataEndpoint = addNodeToBroadcastPacket((unsigned char*)&avatarDataBuffer[0],
@ -142,7 +142,7 @@ void AvatarMixer::processDatagram(const QByteArray& dataByteArray, const HifiSoc
QUuid nodeUUID = QUuid::fromRfc4122(dataByteArray.mid(numBytesForPacketHeader((unsigned char*) dataByteArray.data()), QUuid nodeUUID = QUuid::fromRfc4122(dataByteArray.mid(numBytesForPacketHeader((unsigned char*) dataByteArray.data()),
NUM_BYTES_RFC4122_UUID)); NUM_BYTES_RFC4122_UUID));
// let everyone else know about the update // let everyone else know about the update
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getActiveSocket() && node->getUUID() != nodeUUID) { if (node->getActiveSocket() && node->getUUID() != nodeUUID) {
nodeList->getNodeSocket().writeDatagram(dataByteArray, nodeList->getNodeSocket().writeDatagram(dataByteArray,
node->getActiveSocket()->getAddress(), node->getActiveSocket()->getAddress(),

View file

@ -201,7 +201,7 @@ void DomainServer::readAvailableDatagrams() {
if (numInterestTypes > 0) { if (numInterestTypes > 0) {
// if the node has sent no types of interest, assume they want nothing but their own ID back // if the node has sent no types of interest, assume they want nothing but their own ID back
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getUUID() != nodeUUID && if (node->getUUID() != nodeUUID &&
memchr(nodeTypesOfInterest, node->getType(), numInterestTypes)) { memchr(nodeTypesOfInterest, node->getType(), numInterestTypes)) {
@ -318,7 +318,7 @@ int DomainServer::civetwebRequestHandler(struct mg_connection *connection) {
QJsonObject assignedNodesJSON; QJsonObject assignedNodesJSON;
// enumerate the NodeList to find the assigned nodes // enumerate the NodeList to find the assigned nodes
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
if (node->getLinkedData()) { if (node->getLinkedData()) {
// add the node using the UUID as the key // add the node using the UUID as the key
QString uuidString = uuidStringWithoutCurlyBraces(node->getUUID()); QString uuidString = uuidStringWithoutCurlyBraces(node->getUUID());
@ -370,7 +370,7 @@ int DomainServer::civetwebRequestHandler(struct mg_connection *connection) {
// enumerate the NodeList to find the assigned nodes // enumerate the NodeList to find the assigned nodes
NodeList* nodeList = NodeList::getInstance(); NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
// add the node using the UUID as the key // add the node using the UUID as the key
QString uuidString = uuidStringWithoutCurlyBraces(node->getUUID()); QString uuidString = uuidStringWithoutCurlyBraces(node->getUUID());
nodesJSON[uuidString] = jsonObjectForNode(node.data()); nodesJSON[uuidString] = jsonObjectForNode(node.data());
@ -735,7 +735,7 @@ bool DomainServer::checkInWithUUIDMatchesExistingNode(const HifiSockAddr& nodePu
const QUuid& checkInUUID) { const QUuid& checkInUUID) {
NodeList* nodeList = NodeList::getInstance(); NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getLinkedData() if (node->getLinkedData()
&& nodePublicSocket == node->getPublicSocket() && nodePublicSocket == node->getPublicSocket()
&& nodeLocalSocket == node->getLocalSocket() && nodeLocalSocket == node->getLocalSocket()
@ -767,7 +767,7 @@ void DomainServer::addStaticAssignmentsBackToQueueAfterRestart() {
NodeList* nodeList = NodeList::getInstance(); NodeList* nodeList = NodeList::getInstance();
// enumerate the nodes and check if there is one with an attached assignment with matching UUID // enumerate the nodes and check if there is one with an attached assignment with matching UUID
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getLinkedData()) { if (node->getLinkedData()) {
Assignment* linkedAssignment = (Assignment*) node->getLinkedData(); Assignment* linkedAssignment = (Assignment*) node->getLinkedData();
if (linkedAssignment->getUUID() == _staticAssignments[i].getUUID()) { if (linkedAssignment->getUUID() == _staticAssignments[i].getUUID()) {

View file

@ -1969,7 +1969,7 @@ void Application::updateLookatTargetAvatar(const glm::vec3& mouseRayOrigin, cons
Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, const glm::vec3& mouseRayDirection, Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, const glm::vec3& mouseRayDirection,
glm::vec3& eyePosition, QUuid& nodeUUID = DEFAULT_NODE_ID_REF) { glm::vec3& eyePosition, QUuid& nodeUUID = DEFAULT_NODE_ID_REF) {
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
Avatar* avatar = (Avatar*)node->getLinkedData(); Avatar* avatar = (Avatar*)node->getLinkedData();
float distance; float distance;
@ -2029,7 +2029,7 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateAvatars()"); PerformanceWarning warn(showWarnings, "Application::updateAvatars()");
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
QMutexLocker(&node->getMutex()); QMutexLocker(&node->getMutex());
if (node->getLinkedData()) { if (node->getLinkedData()) {
Avatar *avatar = (Avatar *)node->getLinkedData(); Avatar *avatar = (Avatar *)node->getLinkedData();
@ -2657,7 +2657,7 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node
int inViewServers = 0; int inViewServers = 0;
int unknownJurisdictionServers = 0; int unknownJurisdictionServers = 0;
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
// only send to the NodeTypes that are serverType // only send to the NodeTypes that are serverType
if (node->getActiveSocket() != NULL && node->getType() == serverType) { if (node->getActiveSocket() != NULL && node->getType() == serverType) {
totalServers++; totalServers++;
@ -2717,7 +2717,7 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node
NodeList* nodeList = NodeList::getInstance(); NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
// only send to the NodeTypes that are serverType // only send to the NodeTypes that are serverType
if (node->getActiveSocket() != NULL && node->getType() == serverType) { if (node->getActiveSocket() != NULL && node->getType() == serverType) {
@ -3292,7 +3292,7 @@ void Application::displayOverlay() {
int totalAvatars = 0, totalServers = 0; int totalAvatars = 0, totalServers = 0;
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
node->getType() == NODE_TYPE_AGENT ? totalAvatars++ : totalServers++; node->getType() == NODE_TYPE_AGENT ? totalAvatars++ : totalServers++;
} }
@ -3406,7 +3406,7 @@ void Application::displayStats() {
unsigned long totalPingVoxel = 0; unsigned long totalPingVoxel = 0;
int voxelServerCount = 0; int voxelServerCount = 0;
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getType() == NODE_TYPE_VOXEL_SERVER) { if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
totalPingVoxel += node->getPingMs(); totalPingVoxel += node->getPingMs();
voxelServerCount++; voxelServerCount++;
@ -3757,7 +3757,7 @@ void Application::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) {
// Render avatars of other nodes // Render avatars of other nodes
NodeList* nodeList = NodeList::getInstance(); NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
QMutexLocker(&node->getMutex()); QMutexLocker(&node->getMutex());
if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {

View file

@ -145,7 +145,7 @@ void DataServerClient::processSendFromDataServer(unsigned char* packetData, int
} else { } else {
// mesh URL for a UUID, find avatar in our list // mesh URL for a UUID, find avatar in our list
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
Avatar* avatar = (Avatar *) node->getLinkedData(); Avatar* avatar = (Avatar *) node->getLinkedData();
@ -163,7 +163,7 @@ void DataServerClient::processSendFromDataServer(unsigned char* packetData, int
Application::getInstance()->getProfile()->setSkeletonModelURL(QUrl(valueList[i])); Application::getInstance()->getProfile()->setSkeletonModelURL(QUrl(valueList[i]));
} else { } else {
// skeleton URL for a UUID, find avatar in our list // skeleton URL for a UUID, find avatar in our list
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
Avatar* avatar = (Avatar *) node->getLinkedData(); Avatar* avatar = (Avatar *) node->getLinkedData();

View file

@ -1605,7 +1605,7 @@ void VoxelSystem::falseColorizeBySource() {
// create a bunch of colors we'll use during colorization // create a bunch of colors we'll use during colorization
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
if (node->getType() == NODE_TYPE_VOXEL_SERVER) { if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
uint16_t nodeID = VoxelTreeElement::getSourceNodeUUIDKey(node->getUUID()); uint16_t nodeID = VoxelTreeElement::getSourceNodeUUIDKey(node->getUUID());
int groupColor = voxelServerCount % NUMBER_OF_COLOR_GROUPS; int groupColor = voxelServerCount % NUMBER_OF_COLOR_GROUPS;

View file

@ -368,7 +368,7 @@ void Hand::updateCollisions() {
glm::vec3 totalPenetration; glm::vec3 totalPenetration;
// check other avatars // check other avatars
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT) { if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT) {
Avatar* otherAvatar = (Avatar*)node->getLinkedData(); Avatar* otherAvatar = (Avatar*)node->getLinkedData();
if (Menu::getInstance()->isOptionChecked(MenuOption::PlaySlaps)) { if (Menu::getInstance()->isOptionChecked(MenuOption::PlaySlaps)) {

View file

@ -843,7 +843,7 @@ void MyAvatar::updateChatCircle(float deltaTime) {
// find all circle-enabled members and sort by distance // find all circle-enabled members and sort by distance
QVector<SortedAvatar> sortedAvatars; QVector<SortedAvatar> sortedAvatars;
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT) { if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT) {
SortedAvatar sortedAvatar; SortedAvatar sortedAvatar;
sortedAvatar.avatar = (Avatar*)node->getLinkedData(); sortedAvatar.avatar = (Avatar*)node->getLinkedData();

View file

@ -244,7 +244,7 @@ void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NODE_TYPE serve
NodeList* nodeList = NodeList::getInstance(); NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
// only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER // only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER
if (node->getType() == serverType) { if (node->getType() == serverType) {
serverCount++; serverCount++;

View file

@ -44,7 +44,7 @@ bool JurisdictionListener::queueJurisdictionRequest() {
NodeList* nodeList = NodeList::getInstance(); NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (nodeList->getNodeActiveSocketOrPing(node.data()) && if (nodeList->getNodeActiveSocketOrPing(node.data()) &&
node->getType() == getNodeType()) { node->getType() == getNodeType()) {
const HifiSockAddr* nodeAddress = node->getActiveSocket(); const HifiSockAddr* nodeAddress = node->getActiveSocket();

View file

@ -58,7 +58,7 @@ bool OctreeEditPacketSender::serversExist() const {
bool atLeastOnJurisdictionMissing = false; // assume the best bool atLeastOnJurisdictionMissing = false; // assume the best
NodeList* nodeList = NodeList::getInstance(); NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
// only send to the NodeTypes that are getMyNodeType() // only send to the NodeTypes that are getMyNodeType()
if (node->getType() == getMyNodeType()) { if (node->getType() == getMyNodeType()) {
if (nodeList->getNodeActiveSocketOrPing(node.data())) { if (nodeList->getNodeActiveSocketOrPing(node.data())) {
@ -87,7 +87,7 @@ bool OctreeEditPacketSender::serversExist() const {
void OctreeEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, unsigned char* buffer, ssize_t length) { void OctreeEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, unsigned char* buffer, ssize_t length) {
NodeList* nodeList = NodeList::getInstance(); NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) { foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
// only send to the NodeTypes that are getMyNodeType() // only send to the NodeTypes that are getMyNodeType()
if (node->getType() == getMyNodeType() && if (node->getType() == getMyNodeType() &&
((node->getUUID() == nodeUUID) || (nodeUUID.isNull()))) { ((node->getUUID() == nodeUUID) || (nodeUUID.isNull()))) {
@ -170,7 +170,7 @@ void OctreeEditPacketSender::queuePacketToNodes(unsigned char* buffer, ssize_t l
// for a different server... So we need to actually manage multiple queued packets... one // for a different server... So we need to actually manage multiple queued packets... one
// for each server // for each server
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
// only send to the NodeTypes that are getMyNodeType() // only send to the NodeTypes that are getMyNodeType()
if (node->getActiveSocket() != NULL && node->getType() == getMyNodeType()) { if (node->getActiveSocket() != NULL && node->getType() == getMyNodeType()) {
QUuid nodeUUID = node->getUUID(); QUuid nodeUUID = node->getUUID();
@ -216,7 +216,7 @@ void OctreeEditPacketSender::queueOctreeEditMessage(PACKET_TYPE type, unsigned c
// for a different server... So we need to actually manage multiple queued packets... one // for a different server... So we need to actually manage multiple queued packets... one
// for each server // for each server
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
// only send to the NodeTypes that are getMyNodeType() // only send to the NodeTypes that are getMyNodeType()
if (node->getActiveSocket() != NULL && node->getType() == getMyNodeType()) { if (node->getActiveSocket() != NULL && node->getType() == getMyNodeType()) {
QUuid nodeUUID = node->getUUID(); QUuid nodeUUID = node->getUUID();

View file

@ -188,7 +188,7 @@ void ParticleCollisionSystem::updateCollisionWithAvatars(Particle* particle) {
// loop through all the other avatars for potential interactions... // loop through all the other avatars for potential interactions...
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) { foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
//qDebug() << "updateCollisionWithAvatars()... node:" << *node << "\n"; //qDebug() << "updateCollisionWithAvatars()... node:" << *node << "\n";
if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT) { if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT) {
// TODO: dot collidingPalm and hand velocities and skip collision when they are moving apart. // TODO: dot collidingPalm and hand velocities and skip collision when they are moving apart.

View file

@ -110,7 +110,7 @@ void NodeList::setDomainHostname(const QString& domainHostname) {
} }
void NodeList::timePingReply(const HifiSockAddr& nodeAddress, unsigned char *packetData) { void NodeList::timePingReply(const HifiSockAddr& nodeAddress, unsigned char *packetData) {
foreach(SharedNodePointer node, _nodeHash) { foreach (const SharedNodePointer& node, _nodeHash) {
if (node->getPublicSocket() == nodeAddress || if (node->getPublicSocket() == nodeAddress ||
node->getLocalSocket() == nodeAddress) { node->getLocalSocket() == nodeAddress) {
@ -254,7 +254,7 @@ int NodeList::updateNodeWithData(Node *node, const HifiSockAddr& senderSockAddr,
SharedNodePointer NodeList::nodeWithAddress(const HifiSockAddr &senderSockAddr) { SharedNodePointer NodeList::nodeWithAddress(const HifiSockAddr &senderSockAddr) {
// naively returns the first node that has a matching active HifiSockAddr // naively returns the first node that has a matching active HifiSockAddr
// note that there can be multiple nodes that have a matching active socket, so this isn't a good way to uniquely identify // note that there can be multiple nodes that have a matching active socket, so this isn't a good way to uniquely identify
foreach(SharedNodePointer node, _nodeHash) { foreach (const SharedNodePointer& node, _nodeHash) {
if (node->getActiveSocket() && *node->getActiveSocket() == senderSockAddr) { if (node->getActiveSocket() && *node->getActiveSocket() == senderSockAddr) {
return node; return node;
} }
@ -721,7 +721,7 @@ SharedNodePointer NodeList::addOrUpdateNode(const QUuid& uuid, char nodeType,
unsigned NodeList::broadcastToNodes(unsigned char* broadcastData, size_t dataBytes, const char* nodeTypes, int numNodeTypes) { unsigned NodeList::broadcastToNodes(unsigned char* broadcastData, size_t dataBytes, const char* nodeTypes, int numNodeTypes) {
unsigned n = 0; unsigned n = 0;
foreach(SharedNodePointer node, _nodeHash) { foreach (const SharedNodePointer& node, _nodeHash) {
// only send to the NodeTypes we are asked to send to. // only send to the NodeTypes we are asked to send to.
if (memchr(nodeTypes, node->getType(), numNodeTypes)) { if (memchr(nodeTypes, node->getType(), numNodeTypes)) {
if (getNodeActiveSocketOrPing(node.data())) { if (getNodeActiveSocketOrPing(node.data())) {
@ -737,7 +737,7 @@ unsigned NodeList::broadcastToNodes(unsigned char* broadcastData, size_t dataByt
} }
void NodeList::pingInactiveNodes() { void NodeList::pingInactiveNodes() {
foreach(SharedNodePointer node, _nodeHash) { foreach (const SharedNodePointer& node, _nodeHash) {
if (!node->getActiveSocket()) { if (!node->getActiveSocket()) {
// we don't have an active link to this node, ping it to set that up // we don't have an active link to this node, ping it to set that up
pingPublicAndLocalSocketsForInactiveNode(node.data()); pingPublicAndLocalSocketsForInactiveNode(node.data());
@ -756,7 +756,7 @@ const HifiSockAddr* NodeList::getNodeActiveSocketOrPing(Node* node) {
void NodeList::activateSocketFromNodeCommunication(const HifiSockAddr& nodeAddress) { void NodeList::activateSocketFromNodeCommunication(const HifiSockAddr& nodeAddress) {
foreach(SharedNodePointer node, _nodeHash) { foreach (const SharedNodePointer& node, _nodeHash) {
if (!node->getActiveSocket()) { if (!node->getActiveSocket()) {
// check both the public and local addresses for each node to see if we find a match // check both the public and local addresses for each node to see if we find a match
// prioritize the private address so that we prune erroneous local matches // prioritize the private address so that we prune erroneous local matches
@ -774,7 +774,7 @@ void NodeList::activateSocketFromNodeCommunication(const HifiSockAddr& nodeAddre
SharedNodePointer NodeList::soloNodeOfType(char nodeType) { SharedNodePointer NodeList::soloNodeOfType(char nodeType) {
if (memchr(SOLO_NODE_TYPES, nodeType, sizeof(SOLO_NODE_TYPES)) != NULL) { if (memchr(SOLO_NODE_TYPES, nodeType, sizeof(SOLO_NODE_TYPES)) != NULL) {
foreach(SharedNodePointer node, _nodeHash) { foreach (const SharedNodePointer& node, _nodeHash) {
if (node->getType() == nodeType) { if (node->getType() == nodeType) {
return node; return node;
} }