From 55babbf7b6ed554a01eeac16e19ce0994d54902f Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Mon, 13 Jan 2014 00:30:23 -0800 Subject: [PATCH] windows type mismatch warning fixes --- interface/src/Application.cpp | 1 + interface/src/Audio.cpp | 12 ++++---- interface/src/Cloud.cpp | 2 +- interface/src/DataServerClient.cpp | 2 +- interface/src/ImportDialog.cpp | 2 +- interface/src/Menu.cpp | 2 +- interface/src/VoxelSystem.cpp | 6 ++-- interface/src/VoxelSystem.h | 2 +- interface/src/avatar/Avatar.cpp | 30 +++++++++---------- interface/src/avatar/Hand.cpp | 16 +++++----- interface/src/avatar/Head.cpp | 22 +++++++------- interface/src/avatar/MyAvatar.cpp | 14 ++++----- interface/src/avatar/SkeletonModel.cpp | 6 ++-- interface/src/devices/Faceshift.cpp | 2 +- interface/src/devices/SerialInterface.cpp | 12 ++++---- interface/src/renderer/FBXReader.cpp | 8 ++--- interface/src/renderer/Model.cpp | 8 ++--- interface/src/ui/ChatEntry.cpp | 6 ++-- libraries/avatars/src/HandData.cpp | 6 ++-- .../metavoxels/src/DatagramSequencer.cpp | 4 +-- libraries/octree/src/ViewFrustum.cpp | 6 ++-- libraries/shared/src/NodeList.cpp | 14 ++++----- libraries/shared/src/SharedUtil.cpp | 6 ++-- libraries/shared/src/SharedUtil.h | 2 +- 24 files changed, 96 insertions(+), 95 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index f568fbaa18..810c93f4b9 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1373,6 +1373,7 @@ static glm::vec3 getFaceVector(BoxFace face) { case MIN_Z_FACE: return glm::vec3(0, 0, -1); + default: // quiet windows warnings case MAX_Z_FACE: return glm::vec3(0, 0, 1); } diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 7835340e54..84b693c282 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -608,7 +608,7 @@ void Audio::render(int screenWidth, int screenHeight) { char out[40]; sprintf(out, "%3.0f\n", _averagedLatency); - drawtext(startX + _averagedLatency / AUDIO_CALLBACK_MSECS * frameWidth - 10, topY - 9, 0.10, 0, 1, 0, out, 1,1,0); + drawtext(startX + _averagedLatency / AUDIO_CALLBACK_MSECS * frameWidth - 10, topY - 9, 0.10f, 0, 1, 0, out, 1,1,0); // Show a red bar with the 'start' point of one frame plus the jitter buffer @@ -616,12 +616,12 @@ void Audio::render(int screenWidth, int screenHeight) { int jitterBufferPels = (1.f + (float)getJitterBufferSamples() / (float) NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL) * frameWidth; sprintf(out, "%.0f\n", getJitterBufferSamples() / SAMPLE_RATE * 1000.f); - drawtext(startX + jitterBufferPels - 5, topY - 9, 0.10, 0, 1, 0, out, 1, 0, 0); + drawtext(startX + jitterBufferPels - 5, topY - 9, 0.10f, 0, 1, 0, out, 1, 0, 0); sprintf(out, "j %.1f\n", _measuredJitter); if (Menu::getInstance()->getAudioJitterBufferSamples() == 0) { - drawtext(startX + jitterBufferPels - 5, bottomY + 12, 0.10, 0, 1, 0, out, 1, 0, 0); + drawtext(startX + jitterBufferPels - 5, bottomY + 12, 0.10f, 0, 1, 0, out, 1, 0, 0); } else { - drawtext(startX, bottomY + 12, 0.10, 0, 1, 0, out, 1, 0, 0); + drawtext(startX, bottomY + 12, 0.10f, 0, 1, 0, out, 1, 0, 0); } glBegin(GL_QUADS); @@ -637,8 +637,8 @@ void Audio::render(int screenWidth, int screenHeight) { // Take a pointer to the acquired microphone input samples and add procedural sounds void Audio::addProceduralSounds(int16_t* monoInput, int numSamples) { - const float MAX_AUDIBLE_VELOCITY = 6.0; - const float MIN_AUDIBLE_VELOCITY = 0.1; + const float MAX_AUDIBLE_VELOCITY = 6.0f; + const float MIN_AUDIBLE_VELOCITY = 0.1f; const int VOLUME_BASELINE = 400; const float SOUND_PITCH = 8.f; diff --git a/interface/src/Cloud.cpp b/interface/src/Cloud.cpp index ba4c16b8fd..a89ee04810 100644 --- a/interface/src/Cloud.cpp +++ b/interface/src/Cloud.cpp @@ -23,7 +23,7 @@ Cloud::Cloud() { _particles = new Particle[_count]; _field = new Field(PARTICLE_WORLD_SIZE, FIELD_COUPLE); - for (int i = 0; i < _count; i++) { + for (unsigned int i = 0; i < _count; i++) { _particles[i].position = randVector() * box; const float INIT_VEL_SCALE = 0.03f; _particles[i].velocity = randVector() * ((float)PARTICLE_WORLD_SIZE * INIT_VEL_SCALE); diff --git a/interface/src/DataServerClient.cpp b/interface/src/DataServerClient.cpp index 525b63a5a5..072689e863 100644 --- a/interface/src/DataServerClient.cpp +++ b/interface/src/DataServerClient.cpp @@ -135,7 +135,7 @@ void DataServerClient::processSendFromDataServer(unsigned char* packetData, int QStringList valueList = QString(valuesPosition).split(MULTI_KEY_VALUE_SEPARATOR); // user string was UUID, find matching avatar and associate data - for (size_t i = 0; i < keyList.size(); i++) { + for (int i = 0; i < keyList.size(); i++) { if (valueList[i] != " ") { if (keyList[i] == DataServerKey::FaceMeshURL) { diff --git a/interface/src/ImportDialog.cpp b/interface/src/ImportDialog.cpp index eea090dfbd..8851446f13 100644 --- a/interface/src/ImportDialog.cpp +++ b/interface/src/ImportDialog.cpp @@ -26,7 +26,7 @@ const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths const glm::vec3 UP_VECT = glm::vec3(0, 1, 0); const float ANGULAR_RATE = 0.02f; -const float VERTICAL_ANGLE = M_PI_4 / 2.0f; +const float VERTICAL_ANGLE = (float)M_PI_4 / 2.0f; const float RETURN_RATE = 0.02f; const float NEAR_CLIP = 0.5f; const float FAR_CLIP = 10.0f; diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 545a765dce..f87d2d074b 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -762,7 +762,7 @@ void sendFakeEnterEvent() { } const int QLINE_MINIMUM_WIDTH = 400; -const float DIALOG_RATIO_OF_WINDOW = 0.30; +const float DIALOG_RATIO_OF_WINDOW = 0.30f; void Menu::login() { QInputDialog loginDialog(Application::getInstance()->getWindow()); diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index 74307b2123..2c0203cb1f 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -205,7 +205,7 @@ void VoxelSystem::freeBufferIndex(glBufferIndex index) { // make sure the index isn't already in the free list..., this is a debugging measure only done if you've enabled audits if (Menu::getInstance()->isOptionChecked(MenuOption::AutomaticallyAuditTree)) { - for (long i = 0; i < _freeIndexes.size(); i++) { + for (unsigned long i = 0; i < _freeIndexes.size(); i++) { if (_freeIndexes[i] == index) { printf("freeBufferIndex(glBufferIndex index)... index=%ld already in free list!\n", index); inList = true; @@ -382,7 +382,7 @@ void VoxelSystem::setupFaceIndices(GLuint& faceVBOID, GLubyte faceIdentityIndice // populate the indicesArray // this will not change given new voxels, so we can set it all up now - for (int n = 0; n < _maxVoxels; n++) { + for (unsigned long n = 0; n < _maxVoxels; n++) { // fill the indices array int voxelIndexOffset = n * INDICES_PER_FACE; GLuint* currentIndicesPos = indicesArray + voxelIndexOffset; @@ -421,7 +421,7 @@ void VoxelSystem::initVoxelMemory() { // populate the indicesArray // this will not change given new voxels, so we can set it all up now - for (int n = 0; n < _maxVoxels; n++) { + for (unsigned long n = 0; n < _maxVoxels; n++) { indicesArray[n] = n; } diff --git a/interface/src/VoxelSystem.h b/interface/src/VoxelSystem.h index 51bfd51fe8..dff0c36bbc 100644 --- a/interface/src/VoxelSystem.h +++ b/interface/src/VoxelSystem.h @@ -149,7 +149,7 @@ public slots: protected: float _treeScale; - int _maxVoxels; + unsigned long _maxVoxels; VoxelTree* _tree; void setupNewVoxelsForDrawing(); diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index b3b4793b39..a2e1510db5 100755 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -33,17 +33,17 @@ using namespace std; const bool BALLS_ON = false; const glm::vec3 DEFAULT_UP_DIRECTION(0.0f, 1.0f, 0.0f); -const float YAW_MAG = 500.0; -const float MY_HAND_HOLDING_PULL = 0.2; -const float YOUR_HAND_HOLDING_PULL = 1.0; +const float YAW_MAG = 500.0f; +const float MY_HAND_HOLDING_PULL = 0.2f; +const float YOUR_HAND_HOLDING_PULL = 1.0f; const float BODY_SPRING_DEFAULT_TIGHTNESS = 1000.0f; const float BODY_SPRING_FORCE = 300.0f; const float BODY_SPRING_DECAY = 16.0f; -const float COLLISION_RADIUS_SCALAR = 1.2; // pertains to avatar-to-avatar collisions -const float COLLISION_BALL_FORCE = 200.0; // pertains to avatar-to-avatar collisions -const float COLLISION_BODY_FORCE = 30.0; // pertains to avatar-to-avatar collisions -const float HEAD_ROTATION_SCALE = 0.70; -const float HEAD_ROLL_SCALE = 0.40; +const float COLLISION_RADIUS_SCALAR = 1.2f; // pertains to avatar-to-avatar collisions +const float COLLISION_BALL_FORCE = 200.0f; // pertains to avatar-to-avatar collisions +const float COLLISION_BODY_FORCE = 30.0f; // pertains to avatar-to-avatar collisions +const float HEAD_ROTATION_SCALE = 0.70f; +const float HEAD_ROLL_SCALE = 0.40f; const float HEAD_MAX_PITCH = 45; const float HEAD_MIN_PITCH = -45; const float HEAD_MAX_YAW = 85; @@ -52,14 +52,14 @@ const float AVATAR_BRAKING_STRENGTH = 40.0f; const float MOUSE_RAY_TOUCH_RANGE = 0.01f; const float FLOATING_HEIGHT = 0.13f; const bool USING_HEAD_LEAN = false; -const float LEAN_SENSITIVITY = 0.15; -const float LEAN_MAX = 0.45; -const float LEAN_AVERAGING = 10.0; +const float LEAN_SENSITIVITY = 0.15f; +const float LEAN_MAX = 0.45f; +const float LEAN_AVERAGING = 10.0f; const float HEAD_RATE_MAX = 50.f; -const float SKIN_COLOR[] = {1.0, 0.84, 0.66}; -const float DARK_SKIN_COLOR[] = {0.9, 0.78, 0.63}; +const float SKIN_COLOR[] = {1.0f, 0.84f, 0.66f}; +const float DARK_SKIN_COLOR[] = {0.9f, 0.78f, 0.63f}; const int NUM_BODY_CONE_SIDES = 9; -const float CHAT_MESSAGE_SCALE = 0.0015; +const float CHAT_MESSAGE_SCALE = 0.0015f; const float CHAT_MESSAGE_HEIGHT = 0.1f; void Avatar::sendAvatarURLsMessage(const QUrl& voxelURL) { @@ -269,7 +269,7 @@ void Avatar::render(bool forceRenderHead) { glRotatef(glm::angle(chatRotation), chatAxis.x, chatAxis.y, chatAxis.z); - glColor3f(0, 0.8, 0); + glColor3f(0, 0.8f, 0); glRotatef(180, 0, 1, 0); glRotatef(180, 0, 0, 1); glScalef(_scale * CHAT_MESSAGE_SCALE, _scale * CHAT_MESSAGE_SCALE, 1.0f); diff --git a/interface/src/avatar/Hand.cpp b/interface/src/avatar/Hand.cpp index 2cbbd6fa51..5f85885c1e 100644 --- a/interface/src/avatar/Hand.cpp +++ b/interface/src/avatar/Hand.cpp @@ -19,15 +19,15 @@ using namespace std; -const float FINGERTIP_COLLISION_RADIUS = 0.01; -const float FINGERTIP_VOXEL_SIZE = 0.05; +const float FINGERTIP_COLLISION_RADIUS = 0.01f; +const float FINGERTIP_VOXEL_SIZE = 0.05f; const int TOY_BALL_HAND = 1; const float TOY_BALL_RADIUS = 0.05f; const float TOY_BALL_DAMPING = 0.1f; const glm::vec3 NO_VELOCITY = glm::vec3(0,0,0); const glm::vec3 NO_GRAVITY = glm::vec3(0,0,0); const float NO_DAMPING = 0.f; -const glm::vec3 TOY_BALL_GRAVITY = glm::vec3(0,-2.0,0); +const glm::vec3 TOY_BALL_GRAVITY = glm::vec3(0,-2.0f,0); const QString TOY_BALL_UPDATE_SCRIPT(""); const float PALM_COLLISION_RADIUS = 0.03f; const float CATCH_RADIUS = 0.3f; @@ -159,7 +159,7 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f IN_HAND, TOY_BALL_UPDATE_SCRIPT); // Play a new ball sound - app->getAudio()->startDrumSound(1.0, 2000, 0.5, 0.02); + app->getAudio()->startDrumSound(1.0f, 2000, 0.5f, 0.02f); } if (grabButtonPressed) { @@ -359,7 +359,7 @@ void Hand::updateCollisions() { getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex); // check for collisions - for (int i = 0; i < getNumPalms(); i++) { + for (size_t i = 0; i < getNumPalms(); i++) { PalmData& palm = getPalms()[i]; if (!palm.isActive()) { continue; @@ -379,7 +379,7 @@ void Hand::updateCollisions() { bool wasColliding = palm.getIsCollidingWithPalm(); palm.setIsCollidingWithPalm(false); // If 'Play Slaps' is enabled, look for palm-to-palm collisions and make sound - for (int j = 0; j < otherAvatar->getHand().getNumPalms(); j++) { + for (size_t j = 0; j < otherAvatar->getHand().getNumPalms(); j++) { PalmData& otherPalm = otherAvatar->getHand().getPalms()[j]; if (!otherPalm.isActive()) { continue; @@ -505,7 +505,7 @@ void Hand::render(bool isMine) { } if (Menu::getInstance()->isOptionChecked(MenuOption::CollisionProxies)) { - for (int i = 0; i < getNumPalms(); i++) { + for (size_t i = 0; i < getNumPalms(); i++) { PalmData& palm = getPalms()[i]; if (!palm.isActive()) { continue; @@ -611,7 +611,7 @@ void Hand::renderLeapHands(bool isMine) { glColor4f(handColor.r, handColor.g, handColor.b, 0.5); glm::vec3 tip = finger.getTipPosition(); glm::vec3 root = finger.getRootPosition(); - Avatar::renderJointConnectingCone(root, tip, 0.001, 0.003); + Avatar::renderJointConnectingCone(root, tip, 0.001f, 0.003f); } } } diff --git a/interface/src/avatar/Head.cpp b/interface/src/avatar/Head.cpp index 5471f8554a..115e231994 100644 --- a/interface/src/avatar/Head.cpp +++ b/interface/src/avatar/Head.cpp @@ -20,12 +20,12 @@ using namespace std; const float EYE_RIGHT_OFFSET = 0.27f; const float EYE_UP_OFFSET = 0.36f; const float EYE_FRONT_OFFSET = 0.8f; -const float EAR_RIGHT_OFFSET = 1.0; +const float EAR_RIGHT_OFFSET = 1.0f; const float MOUTH_UP_OFFSET = -0.3f; -const float HEAD_MOTION_DECAY = 0.1; +const float HEAD_MOTION_DECAY = 0.1f; const float MINIMUM_EYE_ROTATION_DOT = 0.5f; // based on a dot product: 1.0 is straight ahead, 0.0 is 90 degrees off -const float EYEBALL_RADIUS = 0.017; -const float EYELID_RADIUS = 0.019; +const float EYEBALL_RADIUS = 0.017f; +const float EYELID_RADIUS = 0.019f; const float EYEBALL_COLOR[3] = { 0.9f, 0.9f, 0.8f }; const float HAIR_SPRING_FORCE = 15.0f; @@ -35,12 +35,12 @@ const float HAIR_DRAG = 10.0f; const float HAIR_LENGTH = 0.09f; const float HAIR_THICKNESS = 0.03f; -const float NOSE_LENGTH = 0.025; -const float NOSE_WIDTH = 0.03; -const float NOSE_HEIGHT = 0.034; -const float NOSE_UP_OFFSET = -0.07; -const float NOSE_UPTURN = 0.005; -const float IRIS_RADIUS = 0.007; +const float NOSE_LENGTH = 0.025f; +const float NOSE_WIDTH = 0.03f; +const float NOSE_HEIGHT = 0.034f; +const float NOSE_UP_OFFSET = -0.07f; +const float NOSE_UPTURN = 0.005f; +const float IRIS_RADIUS = 0.007f; const float IRIS_PROTRUSION = 0.0145f; const char IRIS_TEXTURE_FILENAME[] = "resources/images/iris.png"; @@ -148,7 +148,7 @@ void Head::simulate(float deltaTime, bool isMine) { } _saccade += (_saccadeTarget - _saccade) * 0.50f; - const float AUDIO_AVERAGING_SECS = 0.05; + const float AUDIO_AVERAGING_SECS = 0.05f; _averageLoudness = (1.f - deltaTime / AUDIO_AVERAGING_SECS) * _averageLoudness + (deltaTime / AUDIO_AVERAGING_SECS) * _audioLoudness; diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 3b6bfd83c5..ce7a21d577 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -29,14 +29,14 @@ using namespace std; const glm::vec3 DEFAULT_UP_DIRECTION(0.0f, 1.0f, 0.0f); const float YAW_MAG = 500.0f; const float PITCH_MAG = 100.0f; -const float COLLISION_RADIUS_SCALAR = 1.2; // pertains to avatar-to-avatar collisions +const float COLLISION_RADIUS_SCALAR = 1.2f; // pertains to avatar-to-avatar collisions const float COLLISION_BALL_FORCE = 200.0f; // pertains to avatar-to-avatar collisions const float COLLISION_BODY_FORCE = 30.0f; // pertains to avatar-to-avatar collisions const float COLLISION_RADIUS_SCALE = 0.125f; const float MOUSE_RAY_TOUCH_RANGE = 0.01f; const bool USING_HEAD_LEAN = false; -const float SKIN_COLOR[] = {1.0, 0.84, 0.66}; -const float DARK_SKIN_COLOR[] = {0.9, 0.78, 0.63}; +const float SKIN_COLOR[] = {1.0f, 0.84f, 0.66f}; +const float DARK_SKIN_COLOR[] = {0.9f, 0.78f, 0.63f}; MyAvatar::MyAvatar(Node* owningNode) : Avatar(owningNode), @@ -470,7 +470,7 @@ void MyAvatar::render(bool forceRenderHead) { glRotatef(glm::angle(chatRotation), chatAxis.x, chatAxis.y, chatAxis.z); - glColor3f(0, 0.8, 0); + glColor3f(0, 0.8f, 0); glRotatef(180, 0, 1, 0); glRotatef(180, 0, 0, 1); glScalef(_scale * CHAT_MESSAGE_SCALE, _scale * CHAT_MESSAGE_SCALE, 1.0f); @@ -617,8 +617,8 @@ void MyAvatar::updateThrust(float deltaTime, Transmitter * transmitter) { // If thrust keys are being held down, slowly increase thrust to allow reaching great speeds if (_driveKeys[FWD] || _driveKeys[BACK] || _driveKeys[RIGHT] || _driveKeys[LEFT] || _driveKeys[UP] || _driveKeys[DOWN]) { - const float THRUST_INCREASE_RATE = 1.05; - const float MAX_THRUST_MULTIPLIER = 75.0; + const float THRUST_INCREASE_RATE = 1.05f; + const float MAX_THRUST_MULTIPLIER = 75.0f; //printf("m = %.3f\n", _thrustMultiplier); if (_thrustMultiplier < MAX_THRUST_MULTIPLIER) { _thrustMultiplier *= 1.f + deltaTime * THRUST_INCREASE_RATE; @@ -919,7 +919,7 @@ void MyAvatar::updateChatCircle(float deltaTime) { // compute the accumulated centers glm::vec3 center = _position; - for (size_t i = 0; i < sortedAvatars.size(); i++) { + for (int i = 0; i < sortedAvatars.size(); i++) { SortedAvatar& sortedAvatar = sortedAvatars[i]; sortedAvatar.accumulatedCenter = (center += sortedAvatar.avatar->getPosition()) / (i + 2.0f); } diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index 04fe879aa2..7ef2f54fde 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -73,7 +73,7 @@ bool SkeletonModel::render(float alpha) { glm::vec3 skinColor, darkSkinColor; _owningAvatar->getSkinColors(skinColor, darkSkinColor); - for (size_t i = 0; i < _jointStates.size(); i++) { + for (int i = 0; i < _jointStates.size(); i++) { glPushMatrix(); glm::vec3 position; @@ -164,7 +164,7 @@ void SkeletonModel::applyPalmData(int jointIndex, const QVector& fingerJoin // sort the finger indices by raw x, get the average direction QVector fingerIndices; glm::vec3 direction; - for (int i = 0; i < palm.getNumFingers(); i++) { + for (size_t i = 0; i < palm.getNumFingers(); i++) { glm::vec3 fingerVector = palm.getFingers()[i].getTipPosition() - palm.getPosition(); float length = glm::length(fingerVector); if (length > EPSILON) { @@ -191,7 +191,7 @@ void SkeletonModel::applyPalmData(int jointIndex, const QVector& fingerJoin // match them up as best we can float proportion = fingerIndices.size() / (float)fingerJointIndices.size(); - for (size_t i = 0; i < fingerJointIndices.size(); i++) { + for (int i = 0; i < fingerJointIndices.size(); i++) { int fingerIndex = fingerIndices.at(roundf(i * proportion)).index; glm::vec3 fingerVector = palm.getFingers()[fingerIndex].getTipPosition() - palm.getFingers()[fingerIndex].getRootPosition(); diff --git a/interface/src/devices/Faceshift.cpp b/interface/src/devices/Faceshift.cpp index 075898982d..6e895c96b6 100644 --- a/interface/src/devices/Faceshift.cpp +++ b/interface/src/devices/Faceshift.cpp @@ -159,7 +159,7 @@ void Faceshift::readFromSocket() { } float Faceshift::getBlendshapeCoefficient(int index) const { - return (index >= 0 && index < _blendshapeCoefficients.size()) ? _blendshapeCoefficients[index] : 0.0f; + return (index >= 0 && index < (int)_blendshapeCoefficients.size()) ? _blendshapeCoefficients[index] : 0.0f; } void Faceshift::send(const std::string& message) { diff --git a/interface/src/devices/SerialInterface.cpp b/interface/src/devices/SerialInterface.cpp index 4082bc87ef..0fdb48e4a8 100644 --- a/interface/src/devices/SerialInterface.cpp +++ b/interface/src/devices/SerialInterface.cpp @@ -157,17 +157,17 @@ void SerialInterface::renderLevels(int width, int height) { // Draw the numeric degree/sec values from the gyros sprintf(val, "Yaw %4.1f", _estimatedRotation.y); - drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y, 0.10, 0, 1.0, 1, val, 0, 1, 0); + drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y, 0.10f, 0, 1.0f, 1, val, 0, 1, 0); sprintf(val, "Pitch %4.1f", _estimatedRotation.x); - drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 15, 0.10, 0, 1.0, 1, val, 0, 1, 0); + drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 15, 0.10f, 0, 1.0f, 1, val, 0, 1, 0); sprintf(val, "Roll %4.1f", _estimatedRotation.z); - drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 30, 0.10, 0, 1.0, 1, val, 0, 1, 0); + drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 30, 0.10f, 0, 1.0f, 1, val, 0, 1, 0); sprintf(val, "X %4.3f", _lastAcceleration.x - _gravity.x); - drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 45, 0.10, 0, 1.0, 1, val, 0, 1, 0); + drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 45, 0.10f, 0, 1.0f, 1, val, 0, 1, 0); sprintf(val, "Y %4.3f", _lastAcceleration.y - _gravity.y); - drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 60, 0.10, 0, 1.0, 1, val, 0, 1, 0); + drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 60, 0.10f, 0, 1.0f, 1, val, 0, 1, 0); sprintf(val, "Z %4.3f", _lastAcceleration.z - _gravity.z); - drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 75, 0.10, 0, 1.0, 1, val, 0, 1, 0); + drawtext(LEVEL_CORNER_X, LEVEL_CORNER_Y + 75, 0.10f, 0, 1.0f, 1, val, 0, 1, 0); // Draw the levels as horizontal lines const int LEVEL_CENTER = 150; diff --git a/interface/src/renderer/FBXReader.cpp b/interface/src/renderer/FBXReader.cpp index f49b2b4d19..141ee7d166 100644 --- a/interface/src/renderer/FBXReader.cpp +++ b/interface/src/renderer/FBXReader.cpp @@ -48,13 +48,13 @@ template QVariant readBinaryArray(QDataStream& in) { QDataStream uncompressedIn(uncompressed); uncompressedIn.setByteOrder(QDataStream::LittleEndian); uncompressedIn.setVersion(QDataStream::Qt_4_5); // for single/double precision switch - for (int i = 0; i < arrayLength; i++) { + for (quint32 i = 0; i < arrayLength; i++) { T value; uncompressedIn >> value; values.append(value); } } else { - for (int i = 0; i < arrayLength; i++) { + for (quint32 i = 0; i < arrayLength; i++) { T value; in >> value; values.append(value); @@ -142,7 +142,7 @@ FBXNode parseBinaryFBXNode(QDataStream& in) { } node.name = in.device()->read(nameLength); - for (int i = 0; i < propertyCount; i++) { + for (quint32 i = 0; i < propertyCount; i++) { node.properties.append(parseBinaryFBXProperty(in)); } @@ -337,7 +337,7 @@ QVariantHash parseMapping(QIODevice* device) { } else if (sections.size() >= 4) { QVariantHash heading = properties.value(name).toHash(); QVariantList contents; - for (size_t i = 2; i < sections.size(); i++) { + for (int i = 2; i < sections.size(); i++) { contents.append(sections.at(i).trimmed()); } heading.insertMulti(sections.at(1).trimmed(), contents); diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index e7fb6c7c1d..1702e984bc 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -164,9 +164,9 @@ void Model::simulate(float deltaTime) { memcpy(_blendedVertices.data(), mesh.vertices.constData(), vertexCount * sizeof(glm::vec3)); // blend in each coefficient - for (int j = 0; j < _blendshapeCoefficients.size(); j++) { + for (unsigned int j = 0; j < _blendshapeCoefficients.size(); j++) { float coefficient = _blendshapeCoefficients[j]; - if (coefficient == 0.0f || j >= mesh.blendshapes.size() || mesh.blendshapes[j].vertices.isEmpty()) { + if (coefficient == 0.0f || j >= (unsigned int)mesh.blendshapes.size() || mesh.blendshapes[j].vertices.isEmpty()) { continue; } const glm::vec3* vertex = mesh.blendshapes[j].vertices.constData(); @@ -345,9 +345,9 @@ bool Model::render(float alpha) { memcpy(_blendedNormals.data(), mesh.normals.constData(), vertexCount * sizeof(glm::vec3)); // blend in each coefficient - for (int j = 0; j < _blendshapeCoefficients.size(); j++) { + for (unsigned int j = 0; j < _blendshapeCoefficients.size(); j++) { float coefficient = _blendshapeCoefficients[j]; - if (coefficient == 0.0f || j >= mesh.blendshapes.size() || mesh.blendshapes[j].vertices.isEmpty()) { + if (coefficient == 0.0f || j >= (unsigned int)mesh.blendshapes.size() || mesh.blendshapes[j].vertices.isEmpty()) { continue; } const float NORMAL_COEFFICIENT_SCALE = 0.01f; diff --git a/interface/src/ui/ChatEntry.cpp b/interface/src/ui/ChatEntry.cpp index f9ea4eb1f6..6cbdb4b534 100644 --- a/interface/src/ui/ChatEntry.cpp +++ b/interface/src/ui/ChatEntry.cpp @@ -42,7 +42,7 @@ bool ChatEntry::keyPressEvent(QKeyEvent* event) { return true; case Qt::Key_Delete: - if (_cursorPos < _contents.size()) { + if (_cursorPos < (int)_contents.size()) { _contents.erase(_cursorPos, 1); } return true; @@ -86,11 +86,11 @@ void ChatEntry::render(int screenWidth, int screenHeight) { glVertex2f(left - 5, top - 3); glEnd(); - drawtext(left, bottom, 0.10, 0, 1.0, 0, _contents.c_str(), 1, 1, 1); + drawtext(left, bottom, 0.10f, 0, 1.0f, 0, _contents.c_str(), 1, 1, 1); float width = 0; for (string::iterator it = _contents.begin(), end = it + _cursorPos; it != end; it++) { - width += widthChar(0.10, 0, *it); + width += widthChar(0.10f, 0, *it); } glDisable(GL_LINE_SMOOTH); glBegin(GL_LINE_STRIP); diff --git a/libraries/avatars/src/HandData.cpp b/libraries/avatars/src/HandData.cpp index e8b2c97ff0..44f291411c 100644 --- a/libraries/avatars/src/HandData.cpp +++ b/libraries/avatars/src/HandData.cpp @@ -44,7 +44,7 @@ const int SIXENSE_CONTROLLER_ID_RIGHT_HAND = 1; void HandData::getLeftRightPalmIndices(int& leftPalmIndex, int& rightPalmIndex) const { leftPalmIndex = -1; rightPalmIndex = -1; - for (int i = 0; i < _palms.size(); i++) { + for (size_t i = 0; i < _palms.size(); i++) { const PalmData& palm = _palms[i]; if (palm.isActive()) { if (palm.getSixenseID() == SIXENSE_CONTROLLER_ID_LEFT_HAND) { @@ -81,7 +81,7 @@ void PalmData::addToPosition(const glm::vec3& delta) { // convert to Leap coordinates, then add to palm and finger positions glm::vec3 leapDelta = _owningHandData->worldVectorToLeapVector(delta); _rawPosition += leapDelta; - for (int i = 0; i < getNumFingers(); i++) { + for (size_t i = 0; i < getNumFingers(); i++) { FingerData& finger = _fingers[i]; if (finger.isActive()) { finger.setRawTipPosition(finger.getTipRawPosition() + leapDelta); @@ -263,7 +263,7 @@ void FingerData::updateTrail() { _tipTrailPositions[_tipTrailCurrentStartIndex] = getTipPosition(); - if (_tipTrailCurrentValidLength < _tipTrailPositions.size()) + if (_tipTrailCurrentValidLength < (int)_tipTrailPositions.size()) _tipTrailCurrentValidLength++; } else { diff --git a/libraries/metavoxels/src/DatagramSequencer.cpp b/libraries/metavoxels/src/DatagramSequencer.cpp index 82ea27dfab..028a01e2e8 100644 --- a/libraries/metavoxels/src/DatagramSequencer.cpp +++ b/libraries/metavoxels/src/DatagramSequencer.cpp @@ -67,7 +67,7 @@ void DatagramSequencer::receivedDatagram(const QByteArray& datagram) { QIODeviceOpener opener(&_incomingDatagramBuffer, QIODevice::ReadOnly); // read the sequence number - quint32 sequenceNumber; + int sequenceNumber; _incomingDatagramStream >> sequenceNumber; // if it's less than the last, ignore @@ -107,7 +107,7 @@ void DatagramSequencer::receivedDatagram(const QByteArray& datagram) { // read the list of acknowledged packets quint32 acknowledgementCount; _incomingPacketStream >> acknowledgementCount; - for (int i = 0; i < acknowledgementCount; i++) { + for (quint32 i = 0; i < acknowledgementCount; i++) { quint32 packetNumber; _incomingPacketStream >> packetNumber; if (_sendRecords.isEmpty()) { diff --git a/libraries/octree/src/ViewFrustum.cpp b/libraries/octree/src/ViewFrustum.cpp index 5195ebe9e6..d556dc68d3 100644 --- a/libraries/octree/src/ViewFrustum.cpp +++ b/libraries/octree/src/ViewFrustum.cpp @@ -31,9 +31,9 @@ ViewFrustum::ViewFrustum() : _up(0,0,0), _right(0,0,0), _fieldOfView(0.0), - _aspectRatio(1.0), - _nearClip(0.1), - _farClip(500.0), + _aspectRatio(1.0f), + _nearClip(0.1f), + _farClip(500.0f), _focalLength(0.25f), _keyholeRadius(DEFAULT_KEYHOLE_RADIUS), _farTopLeft(0,0,0), diff --git a/libraries/shared/src/NodeList.cpp b/libraries/shared/src/NodeList.cpp index 9a3af7942d..6c068524b4 100644 --- a/libraries/shared/src/NodeList.cpp +++ b/libraries/shared/src/NodeList.cpp @@ -392,7 +392,7 @@ void NodeList::processSTUNResponse(unsigned char* packetData, size_t dataBytes) const uint32_t RFC_5389_MAGIC_COOKIE_NETWORK_ORDER = htonl(RFC_5389_MAGIC_COOKIE); - int attributeStartIndex = NUM_BYTES_STUN_HEADER; + size_t attributeStartIndex = NUM_BYTES_STUN_HEADER; if (memcmp(packetData + NUM_BYTES_MESSAGE_TYPE_AND_LENGTH, &RFC_5389_MAGIC_COOKIE_NETWORK_ORDER, @@ -606,7 +606,7 @@ int NodeList::processDomainServerList(unsigned char* packetData, size_t dataByte unsigned char* readPtr = packetData + numBytesForPacketHeader(packetData); unsigned char* startPtr = packetData; - while((readPtr - startPtr) < dataBytes - sizeof(uint16_t)) { + while((size_t)(readPtr - startPtr) < dataBytes - sizeof(uint16_t)) { nodeType = *readPtr++; QUuid nodeUUID = QUuid::fromRfc4122(QByteArray((char*) readPtr, NUM_BYTES_RFC4122_UUID)); readPtr += NUM_BYTES_RFC4122_UUID; @@ -955,7 +955,7 @@ void NodeList::addDomainListener(DomainChangeListener* listener) { } void NodeList::removeDomainListener(DomainChangeListener* listener) { - for (int i = 0; i < _domainListeners.size(); i++) { + for (size_t i = 0; i < _domainListeners.size(); i++) { if (_domainListeners[i] == listener) { _domainListeners.erase(_domainListeners.begin() + i); return; @@ -968,7 +968,7 @@ void NodeList::addHook(NodeListHook* hook) { } void NodeList::removeHook(NodeListHook* hook) { - for (int i = 0; i < _hooks.size(); i++) { + for (size_t i = 0; i < _hooks.size(); i++) { if (_hooks[i] == hook) { _hooks.erase(_hooks.begin() + i); return; @@ -977,21 +977,21 @@ void NodeList::removeHook(NodeListHook* hook) { } void NodeList::notifyHooksOfAddedNode(Node* node) { - for (int i = 0; i < _hooks.size(); i++) { + for (size_t i = 0; i < _hooks.size(); i++) { //printf("NodeList::notifyHooksOfAddedNode() i=%d\n", i); _hooks[i]->nodeAdded(node); } } void NodeList::notifyHooksOfKilledNode(Node* node) { - for (int i = 0; i < _hooks.size(); i++) { + for (size_t i = 0; i < _hooks.size(); i++) { //printf("NodeList::notifyHooksOfKilledNode() i=%d\n", i); _hooks[i]->nodeKilled(node); } } void NodeList::notifyDomainChanged() { - for (int i = 0; i < _domainListeners.size(); i++) { + for (size_t i = 0; i < _domainListeners.size(); i++) { _domainListeners[i]->domainChanged(_domainHostname); } } diff --git a/libraries/shared/src/SharedUtil.cpp b/libraries/shared/src/SharedUtil.cpp index e4ef4b64bb..8b18f81f8a 100644 --- a/libraries/shared/src/SharedUtil.cpp +++ b/libraries/shared/src/SharedUtil.cpp @@ -372,7 +372,7 @@ unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r, unsigned char byte = 0; // we will be adding coding bits here int bitInByteNDX = 0; // keep track of where we are in byte as we go int byteNDX = 1; // keep track of where we are in buffer of bytes as we go - int octetsDone = 0; + unsigned int octetsDone = 0; // Now we actually fill out the voxel code while (octetsDone < voxelSizeInOctets) { @@ -471,7 +471,7 @@ void printVoxelCode(unsigned char* voxelCode) { qDebug("voxelSizeInOctets=%d\n",voxelSizeInOctets); qDebug("voxelBufferSize=%d\n",voxelBufferSize); - for(int i=0;i