Merge pull request #3165 from AlericInglewood/master

Compiler warnings fixes.
This commit is contained in:
AndrewMeadows 2014-07-14 11:10:48 -07:00
commit 64ff5f6ecf
8 changed files with 69 additions and 53 deletions

View file

@ -112,12 +112,11 @@ Audio::Audio(int16_t initialJitterBufferSamples, QObject* parent) :
_scopeInput(0),
_scopeOutputLeft(0),
_scopeOutputRight(0),
_audioMixerAvatarStreamAudioStats(),
_starveCount(0),
_consecutiveNotMixedCount(0),
_outgoingAvatarAudioSequenceNumber(0),
_incomingMixedAudioSequenceNumberStats(INCOMING_SEQ_STATS_HISTORY_LENGTH),
_interframeTimeGapStats(TIME_GAPS_STATS_INTERVAL_SAMPLES, TIME_GAP_STATS_WINDOW_INTERVALS),
_starveCount(0),
_consecutiveNotMixedCount(0)
_interframeTimeGapStats(TIME_GAPS_STATS_INTERVAL_SAMPLES, TIME_GAP_STATS_WINDOW_INTERVALS)
{
// clear the array of locally injected samples
memset(_localProceduralSamples, 0, NETWORK_BUFFER_LENGTH_BYTES_PER_CHANNEL);

View file

@ -26,6 +26,7 @@
#include "MetavoxelUtil.h"
#include "ScriptCache.h"
#include "StreamUtils.h"
static int scriptHashType = qRegisterMetaType<ScriptHash>();
static int parameterizedURLType = qRegisterMetaType<ParameterizedURL>();
@ -310,9 +311,8 @@ Box operator*(const glm::mat4& matrix, const Box& box) {
return newBox;
}
QDebug& operator<<(QDebug& out, const Box& box) {
return out << '(' << box.minimum.x << box.minimum.y << box.minimum.z << ") (" <<
box.maximum.x << box.maximum.y << box.maximum.z << ')';
QDebug& operator<<(QDebug& dbg, const Box& box) {
return dbg.nospace() << "{type='Box', minimum=" << box.minimum << ", maximum=" << box.maximum << "}";
}
QMetaObjectEditor::QMetaObjectEditor(QWidget* parent) : QWidget(parent) {

View file

@ -42,7 +42,7 @@ public:
STREAM glm::vec3 minimum;
STREAM glm::vec3 maximum;
Box(const glm::vec3& minimum = glm::vec3(), const glm::vec3& maximum = glm::vec3());
explicit Box(const glm::vec3& minimum = glm::vec3(), const glm::vec3& maximum = glm::vec3());
bool contains(const glm::vec3& point) const;

View file

@ -368,7 +368,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
uint32_t editID;
// check to make sure we have enough content to keep reading...
if (processedBytes + sizeof(editID) > length) {
if (length - processedBytes - sizeof(editID) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -387,7 +387,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
uint32_t creatorTokenID;
// check to make sure we have enough content to keep reading...
if (processedBytes + sizeof(creatorTokenID) > length) {
if (length - processedBytes - sizeof(creatorTokenID) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -426,7 +426,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// lastEdited
// check to make sure we have enough content to keep reading...
if (processedBytes + sizeof(newParticle._lastEdited) > length) {
if (length - processedBytes - sizeof(newParticle._lastEdited) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -439,7 +439,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// properties included bits
uint16_t packetContainsBits = 0;
if (!isNewParticle) {
if (processedBytes + sizeof(packetContainsBits) > length) {
if (length - processedBytes - sizeof(packetContainsBits) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -452,7 +452,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// radius
if (isNewParticle || ((packetContainsBits & CONTAINS_RADIUS) == CONTAINS_RADIUS)) {
if (processedBytes + sizeof(newParticle._radius) > length) {
if (length - processedBytes - sizeof(newParticle._radius) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -464,7 +464,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// position
if (isNewParticle || ((packetContainsBits & CONTAINS_POSITION) == CONTAINS_POSITION)) {
if (processedBytes + sizeof(newParticle._position) > length) {
if (length - processedBytes - sizeof(newParticle._position) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -476,7 +476,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// color
if (isNewParticle || ((packetContainsBits & CONTAINS_COLOR) == CONTAINS_COLOR)) {
if (processedBytes + sizeof(newParticle._color) > length) {
if (length - processedBytes - sizeof(newParticle._color) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -488,7 +488,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// velocity
if (isNewParticle || ((packetContainsBits & CONTAINS_VELOCITY) == CONTAINS_VELOCITY)) {
if (processedBytes + sizeof(newParticle._velocity) > length) {
if (length - processedBytes - sizeof(newParticle._velocity) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -500,7 +500,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// gravity
if (isNewParticle || ((packetContainsBits & CONTAINS_GRAVITY) == CONTAINS_GRAVITY)) {
if (processedBytes + sizeof(newParticle._gravity) > length) {
if (length - processedBytes - sizeof(newParticle._gravity) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -512,7 +512,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// damping
if (isNewParticle || ((packetContainsBits & CONTAINS_DAMPING) == CONTAINS_DAMPING)) {
if (processedBytes + sizeof(newParticle._damping) > length) {
if (length - processedBytes - sizeof(newParticle._damping) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -524,7 +524,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// lifetime
if (isNewParticle || ((packetContainsBits & CONTAINS_LIFETIME) == CONTAINS_LIFETIME)) {
if (processedBytes + sizeof(newParticle._lifetime) > length) {
if (length - processedBytes - sizeof(newParticle._lifetime) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -537,7 +537,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// TODO: make inHand and shouldDie into single bits
// inHand
if (isNewParticle || ((packetContainsBits & CONTAINS_INHAND) == CONTAINS_INHAND)) {
if (processedBytes + sizeof(newParticle._inHand) > length) {
if (length - processedBytes - sizeof(newParticle._inHand) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -549,7 +549,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// shouldDie
if (isNewParticle || ((packetContainsBits & CONTAINS_SHOULDDIE) == CONTAINS_SHOULDDIE)) {
if (processedBytes + sizeof(newParticle._shouldDie) > length) {
if (length - processedBytes - sizeof(newParticle._shouldDie) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -562,7 +562,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// script
if (isNewParticle || ((packetContainsBits & CONTAINS_SCRIPT) == CONTAINS_SCRIPT)) {
uint16_t scriptLength;
if (processedBytes + sizeof(scriptLength) > length) {
if (length - processedBytes - sizeof(scriptLength) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -571,7 +571,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
dataAt += sizeof(scriptLength);
processedBytes += sizeof(scriptLength);
if (processedBytes + scriptLength > length) {
if (length - processedBytes - scriptLength < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -585,7 +585,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// modelURL
if (isNewParticle || ((packetContainsBits & CONTAINS_MODEL_URL) == CONTAINS_MODEL_URL)) {
uint16_t modelURLLength;
if (processedBytes + sizeof(modelURLLength) > length) {
if (length - processedBytes - sizeof(modelURLLength) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -594,7 +594,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
dataAt += sizeof(modelURLLength);
processedBytes += sizeof(modelURLLength);
if (processedBytes + modelURLLength > length) {
if (length - processedBytes - modelURLLength < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -607,7 +607,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// modelScale
if (isNewParticle || ((packetContainsBits & CONTAINS_MODEL_SCALE) == CONTAINS_MODEL_SCALE)) {
if (processedBytes + sizeof(newParticle._modelScale) > length) {
if (length - processedBytes - sizeof(newParticle._modelScale) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -619,7 +619,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// modelTranslation
if (isNewParticle || ((packetContainsBits & CONTAINS_MODEL_TRANSLATION) == CONTAINS_MODEL_TRANSLATION)) {
if (processedBytes + sizeof(newParticle._modelTranslation) > length) {
if (length - processedBytes - sizeof(newParticle._modelTranslation) < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer
@ -632,7 +632,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
// modelRotation
if (isNewParticle || ((packetContainsBits & CONTAINS_MODEL_ROTATION) == CONTAINS_MODEL_ROTATION)) {
const int expectedBytesForPackedQuat = sizeof(uint16_t) * 4; // this is how we pack the quats
if (processedBytes + expectedBytesForPackedQuat > length) {
if (length - processedBytes - expectedBytesForPackedQuat < 0) {
valid = false;
processedBytes = length;
return newParticle; // fail as if we read the entire buffer

View file

@ -95,3 +95,34 @@ std::ostream& operator<<(std::ostream& s, const CapsuleShape& capsule) {
#endif // DEBUG
#ifndef QT_NO_DEBUG_STREAM
#include <QDebug>
QDebug& operator<<(QDebug& dbg, const glm::vec3& v) {
dbg.nospace() << "{type='glm::vec3'"
", x=" << v.x <<
", y=" << v.y <<
", z=" << v.z <<
"}";
return dbg;
}
QDebug& operator<<(QDebug& dbg, const glm::quat& q) {
dbg.nospace() << "{type='glm::quat'"
", x=" << q.x <<
", y=" << q.y <<
", z=" << q.z <<
", w=" << q.w <<
"}";
return dbg;
}
QDebug& operator<<(QDebug& dbg, const glm::mat4& m) {
dbg.nospace() << "{type='glm::mat4', [";
for (int j = 0; j < 4; ++j) {
dbg << ' ' << m[0][j] << ' ' << m[1][j] << ' ' << m[2][j] << ' ' << m[3][j] << ';';
}
return dbg << " ]}";
}
#endif // QT_NO_DEBUG_STREAM

View file

@ -38,13 +38,20 @@ QDataStream& operator>>(QDataStream& in, glm::quat& quaternion);
// less common utils can be enabled with DEBUG
#ifdef DEBUG
#include "CollisionInfo.h"
#include "SphereShape.h"
#include "CapsuleShape.h"
class CollisionInfo;
class SphereShape;
class CapsuleShape.h;
std::ostream& operator<<(std::ostream& s, const CollisionInfo& c);
std::ostream& operator<<(std::ostream& s, const SphereShape& shape);
std::ostream& operator<<(std::ostream& s, const CapsuleShape& capsule);
#endif // DEBUG
#ifndef QT_NO_DEBUG_STREAM
class QDebug;
// Add support for writing these to qDebug().
QDebug& operator<<(QDebug& s, const glm::vec3& v);
QDebug& operator<<(QDebug& s, const glm::quat& q);
QDebug& operator<<(QDebug& s, const glm::mat4& m);
#endif // QT_NO_DEBUG_STREAM
#endif // hifi_StreamUtils_h

View file

@ -12,25 +12,7 @@
#include <glm/gtc/type_ptr.hpp>
#include "PhysicsTestUtil.h"
std::ostream& operator<<(std::ostream& s, const glm::vec3& v) {
s << "<" << v.x << "," << v.y << "," << v.z << ">";
return s;
}
std::ostream& operator<<(std::ostream& s, const glm::quat& q) {
s << "<" << q.x << "," << q.y << "," << q.z << "," << q.w << ">";
return s;
}
std::ostream& operator<<(std::ostream& s, const glm::mat4& m) {
s << "[";
for (int j = 0; j < 4; ++j) {
s << " " << m[0][j] << " " << m[1][j] << " " << m[2][j] << " " << m[3][j] << ";";
}
s << " ]";
return s;
}
#include "StreamUtils.h"
std::ostream& operator<<(std::ostream& s, const CollisionInfo& c) {
s << "[penetration=" << c._penetration

View file

@ -21,9 +21,6 @@ const glm::vec3 xAxis(1.f, 0.f, 0.f);
const glm::vec3 yAxis(0.f, 1.f, 0.f);
const glm::vec3 zAxis(0.f, 0.f, 1.f);
std::ostream& operator<<(std::ostream& s, const glm::vec3& v);
std::ostream& operator<<(std::ostream& s, const glm::quat& q);
std::ostream& operator<<(std::ostream& s, const glm::mat4& m);
std::ostream& operator<<(std::ostream& s, const CollisionInfo& c);
#endif // hifi_PhysicsTestUtil_h