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));
// 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()) {
AudioMixerClientData* otherNodeClientData = (AudioMixerClientData*) otherNode->getLinkedData();
@ -263,13 +263,13 @@ void AudioMixer::run() {
break;
}
foreach(SharedNodePointer node, nodeList->getNodeHash()) {
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getLinkedData()) {
((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()
&& ((AudioMixerClientData*) node->getLinkedData())->getAvatarAudioRingBuffer()) {
prepareMixForListeningNode(node.data());
@ -282,7 +282,7 @@ void AudioMixer::run() {
}
// 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()) {
((AudioMixerClientData*) node->getLinkedData())->pushBuffersAfterFrameSend();
}

View file

@ -67,7 +67,7 @@ void broadcastAvatarData() {
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()) {
// reset packet pointers for this node
@ -76,7 +76,7 @@ void broadcastAvatarData() {
// this is an AGENT we have received head data from
// 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()) {
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()),
NUM_BYTES_RFC4122_UUID));
// let everyone else know about the update
foreach(SharedNodePointer node, nodeList->getNodeHash()) {
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getActiveSocket() && node->getUUID() != nodeUUID) {
nodeList->getNodeSocket().writeDatagram(dataByteArray,
node->getActiveSocket()->getAddress(),

View file

@ -201,7 +201,7 @@ void DomainServer::readAvailableDatagrams() {
if (numInterestTypes > 0) {
// 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 &&
memchr(nodeTypesOfInterest, node->getType(), numInterestTypes)) {
@ -318,7 +318,7 @@ int DomainServer::civetwebRequestHandler(struct mg_connection *connection) {
QJsonObject assignedNodesJSON;
// enumerate the NodeList to find the assigned nodes
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) {
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
if (node->getLinkedData()) {
// add the node using the UUID as the key
QString uuidString = uuidStringWithoutCurlyBraces(node->getUUID());
@ -370,7 +370,7 @@ int DomainServer::civetwebRequestHandler(struct mg_connection *connection) {
// enumerate the NodeList to find the assigned nodes
NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) {
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
// add the node using the UUID as the key
QString uuidString = uuidStringWithoutCurlyBraces(node->getUUID());
nodesJSON[uuidString] = jsonObjectForNode(node.data());
@ -735,7 +735,7 @@ bool DomainServer::checkInWithUUIDMatchesExistingNode(const HifiSockAddr& nodePu
const QUuid& checkInUUID) {
NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) {
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getLinkedData()
&& nodePublicSocket == node->getPublicSocket()
&& nodeLocalSocket == node->getLocalSocket()
@ -767,7 +767,7 @@ void DomainServer::addStaticAssignmentsBackToQueueAfterRestart() {
NodeList* nodeList = NodeList::getInstance();
// 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()) {
Assignment* linkedAssignment = (Assignment*) node->getLinkedData();
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,
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) {
Avatar* avatar = (Avatar*)node->getLinkedData();
float distance;
@ -2029,7 +2029,7 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateAvatars()");
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) {
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
QMutexLocker(&node->getMutex());
if (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 unknownJurisdictionServers = 0;
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) {
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
// only send to the NodeTypes that are serverType
if (node->getActiveSocket() != NULL && node->getType() == serverType) {
totalServers++;
@ -2717,7 +2717,7 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node
NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) {
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
// only send to the NodeTypes that are serverType
if (node->getActiveSocket() != NULL && node->getType() == serverType) {
@ -3292,7 +3292,7 @@ void Application::displayOverlay() {
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++;
}
@ -3406,7 +3406,7 @@ void Application::displayStats() {
unsigned long totalPingVoxel = 0;
int voxelServerCount = 0;
foreach(SharedNodePointer node, nodeList->getNodeHash()) {
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
totalPingVoxel += node->getPingMs();
voxelServerCount++;
@ -3757,7 +3757,7 @@ void Application::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) {
// Render avatars of other nodes
NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) {
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
QMutexLocker(&node->getMutex());
if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {

View file

@ -145,7 +145,7 @@ void DataServerClient::processSendFromDataServer(unsigned char* packetData, int
} else {
// 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) {
Avatar* avatar = (Avatar *) node->getLinkedData();
@ -163,7 +163,7 @@ void DataServerClient::processSendFromDataServer(unsigned char* packetData, int
Application::getInstance()->getProfile()->setSkeletonModelURL(QUrl(valueList[i]));
} else {
// 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) {
Avatar* avatar = (Avatar *) node->getLinkedData();

View file

@ -1605,7 +1605,7 @@ void VoxelSystem::falseColorizeBySource() {
// 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) {
uint16_t nodeID = VoxelTreeElement::getSourceNodeUUIDKey(node->getUUID());
int groupColor = voxelServerCount % NUMBER_OF_COLOR_GROUPS;

View file

@ -368,7 +368,7 @@ void Hand::updateCollisions() {
glm::vec3 totalPenetration;
// check other avatars
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) {
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT) {
Avatar* otherAvatar = (Avatar*)node->getLinkedData();
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
QVector<SortedAvatar> sortedAvatars;
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) {
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT) {
SortedAvatar sortedAvatar;
sortedAvatar.avatar = (Avatar*)node->getLinkedData();

View file

@ -244,7 +244,7 @@ void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NODE_TYPE serve
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
if (node->getType() == serverType) {
serverCount++;

View file

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

View file

@ -58,7 +58,7 @@ bool OctreeEditPacketSender::serversExist() const {
bool atLeastOnJurisdictionMissing = false; // assume the best
NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) {
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
// only send to the NodeTypes that are getMyNodeType()
if (node->getType() == getMyNodeType()) {
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) {
NodeList* nodeList = NodeList::getInstance();
foreach(SharedNodePointer node, nodeList->getNodeHash()) {
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
// only send to the NodeTypes that are getMyNodeType()
if (node->getType() == getMyNodeType() &&
((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 each server
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) {
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
// only send to the NodeTypes that are getMyNodeType()
if (node->getActiveSocket() != NULL && node->getType() == getMyNodeType()) {
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 each server
foreach(SharedNodePointer node, NodeList::getInstance()->getNodeHash()) {
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
// only send to the NodeTypes that are getMyNodeType()
if (node->getActiveSocket() != NULL && node->getType() == getMyNodeType()) {
QUuid nodeUUID = node->getUUID();

View file

@ -188,7 +188,7 @@ void ParticleCollisionSystem::updateCollisionWithAvatars(Particle* particle) {
// 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";
if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT) {
// 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) {
foreach(SharedNodePointer node, _nodeHash) {
foreach (const SharedNodePointer& node, _nodeHash) {
if (node->getPublicSocket() == nodeAddress ||
node->getLocalSocket() == nodeAddress) {
@ -254,7 +254,7 @@ int NodeList::updateNodeWithData(Node *node, const HifiSockAddr& senderSockAddr,
SharedNodePointer NodeList::nodeWithAddress(const HifiSockAddr &senderSockAddr) {
// 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
foreach(SharedNodePointer node, _nodeHash) {
foreach (const SharedNodePointer& node, _nodeHash) {
if (node->getActiveSocket() && *node->getActiveSocket() == senderSockAddr) {
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 n = 0;
foreach(SharedNodePointer node, _nodeHash) {
foreach (const SharedNodePointer& node, _nodeHash) {
// only send to the NodeTypes we are asked to send to.
if (memchr(nodeTypes, node->getType(), numNodeTypes)) {
if (getNodeActiveSocketOrPing(node.data())) {
@ -737,7 +737,7 @@ unsigned NodeList::broadcastToNodes(unsigned char* broadcastData, size_t dataByt
}
void NodeList::pingInactiveNodes() {
foreach(SharedNodePointer node, _nodeHash) {
foreach (const SharedNodePointer& node, _nodeHash) {
if (!node->getActiveSocket()) {
// we don't have an active link to this node, ping it to set that up
pingPublicAndLocalSocketsForInactiveNode(node.data());
@ -756,7 +756,7 @@ const HifiSockAddr* NodeList::getNodeActiveSocketOrPing(Node* node) {
void NodeList::activateSocketFromNodeCommunication(const HifiSockAddr& nodeAddress) {
foreach(SharedNodePointer node, _nodeHash) {
foreach (const SharedNodePointer& node, _nodeHash) {
if (!node->getActiveSocket()) {
// 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
@ -774,7 +774,7 @@ void NodeList::activateSocketFromNodeCommunication(const HifiSockAddr& nodeAddre
SharedNodePointer NodeList::soloNodeOfType(char nodeType) {
if (memchr(SOLO_NODE_TYPES, nodeType, sizeof(SOLO_NODE_TYPES)) != NULL) {
foreach(SharedNodePointer node, _nodeHash) {
foreach (const SharedNodePointer& node, _nodeHash) {
if (node->getType() == nodeType) {
return node;
}