From adb6ffe7c4eb8ea66cc57591bb086acda26bf490 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Sat, 15 Mar 2014 22:00:44 -0700 Subject: [PATCH] more warnings fixes --- animation-server/src/AnimationServer.cpp | 21 +++++++------------ assignment-client/src/audio/AudioMixer.cpp | 1 - .../src/octree/OctreeSendThread.cpp | 4 +--- interface/src/Util.cpp | 10 ++++----- libraries/voxels/src/VoxelTreeElement.cpp | 7 ++++--- 5 files changed, 17 insertions(+), 26 deletions(-) diff --git a/animation-server/src/AnimationServer.cpp b/animation-server/src/AnimationServer.cpp index b165590c30..1f0828ec17 100644 --- a/animation-server/src/AnimationServer.cpp +++ b/animation-server/src/AnimationServer.cpp @@ -40,13 +40,13 @@ bool waitForVoxelServer = true; const int ANIMATION_LISTEN_PORT = 40107; int ANIMATE_FPS = 60; double ANIMATE_FPS_IN_MILLISECONDS = 1000.0/ANIMATE_FPS; // determines FPS from our desired FPS -int ANIMATE_VOXELS_INTERVAL_USECS = (ANIMATE_FPS_IN_MILLISECONDS * 1000.0); // converts from milliseconds to usecs +quint64 ANIMATE_VOXELS_INTERVAL_USECS = (ANIMATE_FPS_IN_MILLISECONDS * 1000); // converts from milliseconds to usecs int PROCESSING_FPS = 60; double PROCESSING_FPS_IN_MILLISECONDS = 1000.0/PROCESSING_FPS; // determines FPS from our desired FPS int FUDGE_USECS = 650; // a little bit of fudge to actually do some processing -int PROCESSING_INTERVAL_USECS = (PROCESSING_FPS_IN_MILLISECONDS * 1000.0) - FUDGE_USECS; // converts from milliseconds to usecs +quint64 PROCESSING_INTERVAL_USECS = (PROCESSING_FPS_IN_MILLISECONDS * 1000) - FUDGE_USECS; // converts from milliseconds to usecs bool wantLocalDomain = false; @@ -611,9 +611,6 @@ void* animateVoxels(void* args) { } lastProcessTime = usecTimestampNow(); - int packetsStarting = 0; - int packetsEnding = 0; - // The while loop will be running at PROCESSING_FPS, but we only want to call these animation functions at // ANIMATE_FPS. So we check out last animate time and only call these if we've elapsed that time. quint64 now = usecTimestampNow(); @@ -627,8 +624,6 @@ void* animateVoxels(void* args) { animateLoopsPerAnimate++; lastAnimateTime = now; - packetsStarting = ::voxelEditPacketSender->packetsToSendCount(); - // some animations //sendVoxelBlinkMessage(); @@ -652,8 +647,6 @@ void* animateVoxels(void* args) { doBuildStreet(); } - packetsEnding = ::voxelEditPacketSender->packetsToSendCount(); - if (animationElapsed > ANIMATE_VOXELS_INTERVAL_USECS) { animationElapsed -= ANIMATE_VOXELS_INTERVAL_USECS; // credit ourselves one animation frame } else { @@ -670,9 +663,9 @@ void* animateVoxels(void* args) { processesPerAnimate++; } // dynamically sleep until we need to fire off the next set of voxels - quint64 usecToSleep = PROCESSING_INTERVAL_USECS - (usecTimestampNow() - lastProcessTime); - if (usecToSleep > PROCESSING_INTERVAL_USECS) { - usecToSleep = PROCESSING_INTERVAL_USECS; + quint64 usecToSleep = ::PROCESSING_INTERVAL_USECS - (usecTimestampNow() - lastProcessTime); + if (usecToSleep > ::PROCESSING_INTERVAL_USECS) { + usecToSleep = ::PROCESSING_INTERVAL_USECS; } if (usecToSleep > 0) { @@ -758,7 +751,7 @@ AnimationServer::AnimationServer(int &argc, char **argv) : } } printf("ANIMATE_FPS=%d\n",ANIMATE_FPS); - printf("ANIMATE_VOXELS_INTERVAL_USECS=%d\n",ANIMATE_VOXELS_INTERVAL_USECS); + printf("ANIMATE_VOXELS_INTERVAL_USECS=%llu\n",ANIMATE_VOXELS_INTERVAL_USECS); const char* processingFPSCommand = getCmdOption(argc, (const char**) argv, "--ProcessingFPS"); const char* processingIntervalCommand = getCmdOption(argc, (const char**) argv, "--ProcessingInterval"); @@ -774,7 +767,7 @@ AnimationServer::AnimationServer(int &argc, char **argv) : } } printf("PROCESSING_FPS=%d\n",PROCESSING_FPS); - printf("PROCESSING_INTERVAL_USECS=%d\n",PROCESSING_INTERVAL_USECS); + printf("PROCESSING_INTERVAL_USECS=%llu\n",PROCESSING_INTERVAL_USECS); nodeList->linkedDataCreateCallback = NULL; // do we need a callback? diff --git a/assignment-client/src/audio/AudioMixer.cpp b/assignment-client/src/audio/AudioMixer.cpp index 812acc8d70..4c745ef2eb 100644 --- a/assignment-client/src/audio/AudioMixer.cpp +++ b/assignment-client/src/audio/AudioMixer.cpp @@ -79,7 +79,6 @@ void AudioMixer::addBufferToMixForListeningNodeWithBuffer(PositionalAudioRingBuf if (bufferToAdd != listeningNodeBuffer) { // if the two buffer pointers do not match then these are different buffers - glm::vec3 listenerPosition = listeningNodeBuffer->getPosition(); glm::vec3 relativePosition = bufferToAdd->getPosition() - listeningNodeBuffer->getPosition(); glm::quat inverseOrientation = glm::inverse(listeningNodeBuffer->getOrientation()); diff --git a/assignment-client/src/octree/OctreeSendThread.cpp b/assignment-client/src/octree/OctreeSendThread.cpp index ef69771607..09ebb99298 100644 --- a/assignment-client/src/octree/OctreeSendThread.cpp +++ b/assignment-client/src/octree/OctreeSendThread.cpp @@ -54,15 +54,13 @@ bool OctreeSendThread::process() { nodeData = (OctreeQueryNode*) node->getLinkedData(); - int packetsSent = 0; - // Sometimes the node data has not yet been linked, in which case we can't really do anything if (nodeData) { bool viewFrustumChanged = nodeData->updateCurrentViewFrustum(); if (_myServer->wantsDebugSending() && _myServer->wantsVerboseDebug()) { printf("nodeData->updateCurrentViewFrustum() changed=%s\n", debug::valueOf(viewFrustumChanged)); } - packetsSent = packetDistributor(node, nodeData, viewFrustumChanged); + packetDistributor(node, nodeData, viewFrustumChanged); } } else { _nodeMissingCount++; diff --git a/interface/src/Util.cpp b/interface/src/Util.cpp index 45b2c4a616..f54bfb9d00 100644 --- a/interface/src/Util.cpp +++ b/interface/src/Util.cpp @@ -535,7 +535,7 @@ void runTimingTests() { } gettimeofday(&endTime, NULL); elapsedMsecs = diffclock(&startTime, &endTime); - qDebug("rand() stored in array usecs: %f", 1000.0f * elapsedMsecs / (float) numTests); + qDebug("rand() stored in array usecs: %f, first result:%d", 1000.0f * elapsedMsecs / (float) numTests, iResults[0]); // Random number generation using randFloat() gettimeofday(&startTime, NULL); @@ -544,7 +544,7 @@ void runTimingTests() { } gettimeofday(&endTime, NULL); elapsedMsecs = diffclock(&startTime, &endTime); - qDebug("randFloat() stored in array usecs: %f", 1000.0f * elapsedMsecs / (float) numTests); + qDebug("randFloat() stored in array usecs: %f, first result: %f", 1000.0f * elapsedMsecs / (float) numTests, fResults[0]); // PowF function fTest = 1145323.2342f; @@ -567,8 +567,8 @@ void runTimingTests() { } gettimeofday(&endTime, NULL); elapsedMsecs = diffclock(&startTime, &endTime); - qDebug("vector math usecs: %f [%f msecs total for %d tests]", - 1000.0f * elapsedMsecs / (float) numTests, elapsedMsecs, numTests); + qDebug("vector math usecs: %f [%f msecs total for %d tests], last result:%f", + 1000.0f * elapsedMsecs / (float) numTests, elapsedMsecs, numTests, distance); // Vec3 test glm::vec3 vecA(randVector()), vecB(randVector()); @@ -581,7 +581,7 @@ void runTimingTests() { } gettimeofday(&endTime, NULL); elapsedMsecs = diffclock(&startTime, &endTime); - qDebug("vec3 assign and dot() usecs: %f", 1000.0f * elapsedMsecs / (float) numTests); + qDebug("vec3 assign and dot() usecs: %f, last result:%f", 1000.0f * elapsedMsecs / (float) numTests, result); } float loadSetting(QSettings* settings, const char* name, float defaultValue) { diff --git a/libraries/voxels/src/VoxelTreeElement.cpp b/libraries/voxels/src/VoxelTreeElement.cpp index be6bd50e3d..debcfee987 100644 --- a/libraries/voxels/src/VoxelTreeElement.cpp +++ b/libraries/voxels/src/VoxelTreeElement.cpp @@ -178,13 +178,14 @@ void VoxelTreeElement::calculateAverageFromChildren() { bool VoxelTreeElement::collapseChildren() { // scan children, verify that they are ALL present and accounted for bool allChildrenMatch = true; // assume the best (ottimista) - int red,green,blue; + int red = 0; + int green = 0; + int blue = 0; for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { VoxelTreeElement* childAt = getChildAtIndex(i); // if no child, child isn't a leaf, or child doesn't have a color if (!childAt || !childAt->isLeaf() || !childAt->isColored()) { - allChildrenMatch=false; - //qDebug("SADNESS child missing or not colored! i=%d\n",i); + allChildrenMatch = false; break; } else { if (i==0) {